20160706_jeffrey - silenceuncrio/diary GitHub Wiki

Index

  • 0920 - M300 開機 web module init Error: /etc/mini_httpd.conf not exist!
  • 1050 - web 起來了 ifconfig eth0 up
  • 1115 - 網頁可以正常顯示了
  • 1130 - boot device 設定成 QSPI 卻可以從 SD Card 開機 morris R324 NAND_DATA0
  • 1155 - [issue]ariel 表示 網頁的帳密太簡單
  • 1315 - demo board 先拿給 ariel
  • 1440 - svn update conflict tf
  • 1445 - ariel 小紙條 我用最近的 code 怎麼 web server 沒起來?
  • 1455 - How-To use NAND boot on i.MX6UL EVK board
  • 1520 - mx6ul_14x14_evk_nand_defconfig
  • 1535 - Linux DTB modification and build
  • 1615 - jammy 已經準備好 dtb file
  • 1630 - 禮拜五要提出 kernel: EMMC/NAND MTD Driver 的 proposal
  • 1700 - u-boot : burn image - NAND flash 這個 proposal 也要提出來
  • 1705 - alarm sensor

0920

昨天下班前有些事來不及紀錄

  • svn
    • add mgmt_init_iptables
    • add new script - mgmt_rules

目前 M300 開機時的 web module init 訊息如下

...
### module <web> init
ps: invalid option -- 'e'
BusyBox v1.23.1 (2016-07-05 16:52:11 CST) multi-call binary.

Usage: ps

ps: invalid option -- 'e'
BusyBox v1.23.1 (2016-07-05 16:52:11 CST) multi-call binary.

Usage: ps

ps: invalid option -- 'e'
BusyBox v1.23.1 (2016-07-05 16:52:11 CST) multi-call binary.

Usage: ps

Error: /etc/mini_httpd.conf not exist!
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
...

先看 Error: /etc/mini_httpd.conf not exist!

直接從 svn 上的
579X/UGW-5.4/proscend/merge/etc/mini_httpd.conf
補到
M300/fsl-release-bsp/proscend/base_fs/default/rootfs/etc/mini_httpd.conf

先 commit

build image - source bimage.sh

有點久...

1050

flashing SD image - sudo dd if=core-image-minimal-imx6ulevk.sdcard of=/dev/sdb bs=1M && sync

開機

...
### module <web> init
ps: invalid option -- 'e'
BusyBox v1.23.1 (2016-07-05 16:52:11 CST) multi-call binary.

Usage: ps

ps: invalid option -- 'e'
BusyBox v1.23.1 (2016-07-05 16:52:11 CST) multi-call binary.

Usage: ps

ps: invalid option -- 'e'
BusyBox v1.23.1 (2016-07-05 16:52:11 CST) multi-call binary.

Usage: ps

iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
...

看一下 web 起來沒有

root@M300:~# ps
  PID USER       VSZ STAT COMMAND
    1 root      1560 S    init [5]
    2 root         0 SW   [kthreadd]
  ...
  502 root      1996 S    mini_httpd -C /etc/mini_httpd.conf -p 80 -dd /www
  ...
root@M300:~#

起來了

不過 eth0 要用 ifconfig eth0 up 把它叫起來

看網頁可不可以正常顯示

1115

網頁可以正常顯示了 username - admin password - 1234

1130

意外的發現手上這片 CPU 板的 boot device 明明設定成 QSPI - SW601[D1,D2,D3,D4] = [off,off,off,off]

但卻可以從 SD Card 開機

跟 morris 聊開機的時候又聊到 之前 jammy 分享的 How-To use NAND boot on i.MX6UL EVK board

沒想到裏頭竟然也有能夠幫助到 morris 的情報

After doing all that you say in your post, we can´t burn Nand image.
First of all i have to say that there is a R324 into the nand footprint that shouldn't be removed because it goes to the pin NAND_DATA0, so i have removed it and i have shorted its pads with tin in order to place the nand.
.
Once the nand is placed we have tried to burn it unsuccessfully. Here you can see two print screen of the process.
We have tried it with both "mfgtools-with-rootfs" and "mfgtools-without-rootfs" with the same result.
.
Any help will be apreciated
.
Thanks and best regards

這邊的

there is a R324 into the nand footprint that shouldn't be removed because it goes to the pin NAND_DATA0, so i have removed it and i have shorted its pads with tin in order to place the nand.

便是 morris 說應該在兩三個禮拜前跟他說的情報

不過現在大概就是二十來片需要人工 rework 後再進行打件的動作... 也不是多大的損失

但這些事情原廠的 FAE 都不知道

1155

ariel 表示 網頁的帳密太簡單了

  • username - admin
  • password - 1234 希望改成跟目前 console 一樣的帳密
  • username - root
  • password - 2wsx#EDC

1315

demo board 先拿給 ariel

先參考 How-To use NAND boot on i.MX6UL EVK board 看看有什麼可以先改的

1440

svn update 遇到 conflict 的問題

jeffrey@jeffrey-VirtualBox:~/M300$ sudo svn up
[sudo] password for jeffrey: 
Updating '.':
C    fsl-release-bsp/build_small/cache/bb_codeparser.dat
C    fsl-release-bsp/build_small/cache/bb_persist_data.sqlite3
U    fsl-release-bsp/proscend/prosrc/icos/include/icos_lte_api.h
U    fsl-release-bsp/proscend/prosrc/icos/include/icos_module.h
U    fsl-release-bsp/proscend/prosrc/icos/icoslib/lte/lte.c
U    fsl-release-bsp/proscend/prosrc/icos/icoslib/lte/lte_api.c
A    fsl-release-bsp/proscend/base_fs/default/rootfs/etc/ppp/peers/quectel-chat-connect
A    fsl-release-bsp/proscend/base_fs/default/rootfs/etc/ppp/peers/quectel-chat-disconnect
A    fsl-release-bsp/proscend/base_fs/default/rootfs/etc/ppp/peers/quectel-ppp
A    fsl-release-bsp/proscend/base_fs/default/rootfs/etc/ppp/peers/quectel-ppp-kill
A    fsl-release-bsp/proscend/base_fs/default/rootfs/etc/ppp/peers/quectel-pppd.sh
A    fsl-release-bsp/proscend/base_fs/default/rootfs/etc/ppp/ip-up
U    fsl-release-bsp/.repo/.repo_fetchtimes.json
U    fsl-release-bsp/.repo/projects/sources/poky.git/FETCH_HEAD
U    fsl-release-bsp/.repo/projects/sources/poky.git/refs/remotes/yocto/master-next
U    fsl-release-bsp/.repo/projects/sources/poky.git/logs/refs/remotes/yocto/master-next
U    fsl-release-bsp/.repo/projects/sources/meta-fsl-arm.git/FETCH_HEAD
U    fsl-release-bsp/.repo/projects/sources/meta-fsl-arm.git/refs/remotes/yocto/master-next
U    fsl-release-bsp/.repo/projects/sources/meta-fsl-arm.git/refs/remotes/yocto/krogoth-next
U    fsl-release-bsp/.repo/projects/sources/meta-fsl-arm.git/logs/refs/remotes/yocto/krogoth-next
U    fsl-release-bsp/.repo/projects/sources/meta-fsl-arm.git/logs/refs/remotes/yocto/master-next
Updated to revision 165.
Conflict discovered in file 'fsl-release-bsp/build_small/cache/bb_codeparser.dat'.
Select: (p) postpone, (df) show diff, (e) edit file, (m) merge,
        (mc) my side of conflict, (tc) their side of conflict,
        (s) show all options: 

看一下全部可以用的 option 有哪些

Select: (p) postpone, (df) show diff, (e) edit file, (m) merge,
        (mc) my side of conflict, (tc) their side of conflict,
        (s) show all options: s

  (e)  - change merged file in an editor  [edit]
  (df) - show all changes made to merged file
  (r)  - accept merged version of file

  (dc) - show all conflicts (ignoring merged version)
  (mc) - accept my version for all conflicts (same)  [mine-conflict]
  (tc) - accept their version for all conflicts (same)  [theirs-conflict]

  (mf) - accept my version of entire file (even non-conflicts)  [mine-full]
  (tf) - accept their version of entire file (same)  [theirs-full]

  (m)  - use internal merge tool to resolve conflict
  (l)  - launch external tool to resolve conflict  [launch]
  (p)  - mark the conflict to be resolved later  [postpone]
  (q)  - postpone all remaining conflicts
  (s)  - show this list (also 'h', '?')
Words in square brackets are the corresponding --accept option arguments.

Select: (p) postpone, (df) show diff, (e) edit file, (m) merge,
        (mc) my side of conflict, (tc) their side of conflict,
        (s) show all options: 

(tf) - accept their version of entire file (same) [theirs-full] 應該不錯

反正我又沒改 fsl-release-bsp/build_small/cache/bb_codeparser.dat

1445

剛剛和 morris 以及 charlie 聊一下 alarm sensor

回到位置就看到 ariel 留的小紙條 - 我用最近的 code 怎麼 web server 沒起來?

結果是 ariel build image 不成功
還是 loading 到舊的 image

不過這也說明了 alarm sensor 的事情讓 arile 有所不滿

我這夾心餅可真難為啊

1455

How-To use NAND boot on i.MX6UL EVK board 說到

Software Modification In Yocto-Linux BSP standard release, NAND device boot is not supported.
We need add support in u-boot, linux DTB and MFGTool.

  • u-boot-imx modification and build
    • Replace u-boot-imx/include/configs/mx6ul_14x14_evk.h with the same file in the attachment
    • Copy mx6ul_14x14_evk_nand_defconfig in the attachment to u-boot-imx/configs/
    • Build the new u-boot.imx: make distclean; make mx6ul_14x14_evk_nand_defconfig;make
    • Rename u-boot.imx to u-boot-imx6ulevk_nand.imx

先來看看這個朋友針對 mx6ul_14x14_evk.h 改了什麼

將下載下來的另存成 mx6ul_14x14_evk_from_nxp.h

暫時放在 tmp 的 u-boot-imx\2015.04-r0\git\include\configs

原來的 mx6ul_14x14_evk.h 就另外存一份 mx6ul_14x14_evk_original.h

目前 tmp 的 u-boot-imx\2015.04-r0\git\include\configs 裡計有

  • mx6ul_14x14_evk.h - 被拿來套用的
  • mx6ul_14x14_evk_from_nxp.h - nxp 討論區建議的
  • mx6ul_14x14_evk_original.h - 原來的

就用這個方式先把其他的掃一次

1520

  • Copy mx6ul_14x14_evk_nand_defconfig in the attachment to u-boot-imx/configs/

原來 tmp 的 u-boot-imx\2015.04-r0\git\configs 裡就沒有 mx6ul_14x14_evk_nand_defconfig, 直接放吧

該檔案的內容如下

CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6ul_14x14_evk/imximage.cfg,MX6UL,SYS_BOOT_NAND"
CONFIG_ARM=y
CONFIG_TARGET_MX6UL_14X14_EVK=y
CONFIG_DM=y
CONFIG_DM_THERMAL=y

目前用的應該是 mx6ul_14x14_evk_defconfig, 內容如下

CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6ul_14x14_evk/imximage.cfg,MX6UL"
CONFIG_ARM=y
CONFIG_TARGET_MX6UL_14X14_EVK=y
CONFIG_DM=y
CONFIG_DM_THERMAL=y

再來是 Build the new u-boot.imx: make distclean; make mx6ul_14x14_evk_nand_defconfig;make

這一步先不用做了

因為這需要裝 toolchain... 參考自己的日記 - Embedded Linux Projects Using Yocto Project Cookbook

至於要怎麼 commit 可以再想想

不過可以先寫 proposal

1535

  • Linux DTB modification and build
    • Copy imx6ul-14x14-evk-gpmi-weim.dts in the attachment to kernel/arch/arm/boot/dts/
    • Build imx6ul-14x14-evk-gpmi-weim.dtb: make imx6ul-14x14-evk-gpmi-weim.dtb
    • Rename imx6ul-14x14-evk-gpmi-weim.dtb to zImage-imx6ul-14x14-evk-gpmi-weim.dtb

這邊可能需要問一下 jammy

1615

jammy 表示已經為了之後 NAND Flash 的板子準備好相對應的 dtb file 了

討論的當下 ariel 也加入

不過 ariel 的建議需要比較多的時間才能消化

就是改啥 config.in
讓 make menuconfig 可以去選擇要 build 成 SD Card 用的 或是 NAND Flash
說會產生啥 config 和 autoconfig.h
一個給 makefile 讀的
一個是 header file
說 proscr 下有很多範例

這個當下我想我應該沒辦法法消化掉這些東西

更不要說 jammy 很熱心地提供我該怎麼去 trace imx6ul-14x14-evk-gpmi-weim.dts 的內容

/*
 * Copyright (C) 2015 Freescale Semiconductor, Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#include "imx6ul-14x14-evk.dts"

&qspi{
	status = "disabled";
};

&usdhc2 {
	status = "disabled";
};

&gpmi {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_gpmi_nand_1>;
	status = "okay";
	nand-on-flash-bbt;
};

&iomuxc {
	imx6ul-evk {
		pinctrl_gpmi_nand_1: gpmi-nand-1 {
			fsl,pins = <
				MX6UL_PAD_NAND_CLE__RAWNAND_CLE         0xb0b1
				MX6UL_PAD_NAND_ALE__RAWNAND_ALE         0xb0b1
				MX6UL_PAD_NAND_WP_B__RAWNAND_WP_B       0xb0b1
				MX6UL_PAD_NAND_READY_B__RAWNAND_READY_B 0xb000
				MX6UL_PAD_NAND_CE0_B__RAWNAND_CE0_B     0xb0b1
				MX6UL_PAD_NAND_CE1_B__RAWNAND_CE1_B     0xb0b1
				MX6UL_PAD_NAND_RE_B__RAWNAND_RE_B       0xb0b1
				MX6UL_PAD_NAND_WE_B__RAWNAND_WE_B       0xb0b1
				MX6UL_PAD_NAND_DATA00__RAWNAND_DATA00   0xb0b1
				MX6UL_PAD_NAND_DATA01__RAWNAND_DATA01   0xb0b1
				MX6UL_PAD_NAND_DATA02__RAWNAND_DATA02   0xb0b1
				MX6UL_PAD_NAND_DATA03__RAWNAND_DATA03   0xb0b1
				MX6UL_PAD_NAND_DATA04__RAWNAND_DATA04   0xb0b1
				MX6UL_PAD_NAND_DATA05__RAWNAND_DATA05   0xb0b1
				MX6UL_PAD_NAND_DATA06__RAWNAND_DATA06   0xb0b1
				MX6UL_PAD_NAND_DATA07__RAWNAND_DATA07   0xb0b1
			>;
		};
	};
};

什麼可以參考

  • linux-imx\3.14.52-r0\git\Documentation\devicetree\bindings\pinctrl\fsl,imx6ul-pinctrl.txt
  • linux-imx\3.14.52-r0\git\arch\arm\boot\dts\imx6ul-pinfunc.h

可以感受到 jammy 的熱心

不過我實在無福消受... 真的需要團隊合作... 東西太多了

1630

禮拜五要提出 kernel: EMMC/NAND MTD Driver 的 proposal

這個不難解決

1700

u-boot : burn image - NAND flash 這個 proposal 也要提出來

基本上就是參考 How-To use NAND boot on i.MX6UL EVK board 來寫成更適合我們的

1705

下班前來作一些 alarm sensor

...
x = 0
v = 0

send_once = 0

sound_level = 123

sound_duration = 5
sound_cnt = 0

sound_dbg = 0

tmr.alarm(1, 10, tmr.ALARM_AUTO, function()
  if x < 100 then
    x = x + 1
    a = adc.read(0)
    v = v + a
  else
    sound = v/100
    if sound_dbg == 1 then
      print(sound)
    end
    if sound > sound_level then
      sound_cnt = sound_cnt + 1
      print("#"..sound_cnt..": sound("..sound..") more than "..sound_level)
      if sound_cnt >= sound_duration then
        print("send mail")
        -- Send an email
--        send_email(
--          "detect alarm - sound level: " .. sound,
--          "alarm level: "..sound_level
--        )
        sound_cnt = 0
      end
    else
      sound_cnt = 0
    end      
    x = 0
    v = 0
  end  
end)
...

來解析自己之前在寫啥

x = 0
tmr.alarm(1, 10, tmr.ALARM_AUTO, function()
  if x < 100 then
    -- 一些統計的事
    x = x + 1
  else
    -- 滿一百筆就做個結算
    x = 0
  end  
end)
...

利用 tmr.alarm() 讓我們每 10 millisecond 作一些事

  • 作什麼事呢? 一些統計的事
  • 統計後要幹嘛? 統計了一百筆之後再說
v = 0
tmr.alarm(1, 10, tmr.ALARM_AUTO, function()
    ...
    -- 一些統計的事
    a = adc.read(0)
    v = v + a
    ...
end)
...

adc.read(0) 可以讀到 類比輸入端的電壓值(0~1024)
然後就一直作累加的動作

v = 0
sound_level = 123
sound_duration = 5
sound_cnt = 0

tmr.alarm(1, 10, tmr.ALARM_AUTO, function()
    -- ...
    -- 滿一百筆就做個結算
    sound = v/100
    if sound > sound_level then
      sound_cnt = sound_cnt + 1
      print("#"..sound_cnt..": sound("..sound..") more than "..sound_level)
      if sound_cnt >= sound_duration then
        -- Send an email
        sound_cnt = 0
      end
    else
      sound_cnt = 0
    end      
    v = 0
    -- ...
end)
...
  • sound = v/100 - 取平均
  • if sound > sound_level then ... else ... end
    • 如果平均值大於某個 level 就作一些事 - sound_cnt = sound_cnt + 1
  • 累計個幾次就發 mail - if sound_cnt >= sound_duration then ... end
⚠️ **GitHub.com Fallback** ⚠️