20160801_jeffrey - silenceuncrio/diary GitHub Wiki
- 0950 - review
-
1025 - 將
kernel
和rootfs
燒錄到 NAND 去所需要的 tool -
1120 -
bitbake linux-mfgtool
- 包含我們需要的 tool -
1125 - VirtualBox - 介面卡 1 附加到 NAT - 介面卡 2 附加到
僅限主機
介面卡 -
1150 -
svn up
update M300 -
1335 - jammy 的
000_enable_ENET_CLK_when_booting.patch
- 1435 - 為了之後的 NAND Flash boot 做了兩次 commit
- 1500 - 月會
- 1530 - 我們該提供什麼 image 讓 第三方 來做預燒的動作
-
1625 -
imx-kobs
recipe -bitbake imx-kobs
- 1640 - trace source code
先 review 上禮拜做的
觀察 MfgTool 的 ucl2.xml
<UCL>
...
<LIST name="NAND Flash" desc="Choose NAND as media">
<CMD state="BootStrap" type="boot" body="BootStrap"
file ="firmware/u-boot-imx6ul%6uluboot%_%nand%.imx">Loading U-boot</CMD>
<CMD state="BootStrap" type="load"
file="firmware/zImage" ...>Loading Kernel.</CMD>
<CMD state="BootStrap" type="load"
file="firmware/%initramfs%" ...>Loading Initramfs.</CMD>
<CMD state="BootStrap" type="load"
file="firmware/zImage-imx6ul-%6uldtb%-%nanddtb%.dtb" ...>Loading device tree.</CMD>
<CMD state="BootStrap" type="jump" > Jumping to OS image. </CMD>
<!--burn the uboot to NAND: -->
<CMD state="Updater" type="push"
body="$ mount -t debugfs debugfs /sys/kernel/debug">Mounting debugfs</CMD>
<CMD state="Updater" type="push"
body="$ flash_erase /dev/mtd%part_uboot% 0 0">Erasing Boot partition</CMD>
<CMD state="Updater" type="push"
body="send" file="files/u-boot-imx6ul%6uluboot%_%nand%.imx">Sending u-boot.bin</CMD>
<CMD state="Updater" type="push"
body="$ kobs-ng init -x -v --chip_0_device_path=/dev/mtd%part_uboot% $FILE">Flashing Bootloader</CMD>
<!--burn the kernel to NAND: -->
<CMD state="Updater" type="push"
body="$ flash_erase /dev/mtd%part_kernel% 0 0">Erasing Kernel partition</CMD>
<CMD state="Updater" type="push"
body="send" file="files/zImage">Sending kernel zImage</CMD>
<CMD state="Updater" type="push"
body="$ nandwrite -p /dev/mtd%part_kernel% -p $FILE">Flashing Kernel</CMD>
<CMD state="Updater" type="push"
body="$ flash_erase /dev/mtd%part_dtb% 0 0">Erasing dtb partition</CMD>
<CMD state="Updater" type="push"
body="send" file="files/zImage-imx6ul-%6uldtb%-%nanddtb%.dtb">Sending Device Tree file</CMD>
<CMD state="Updater" type="push"
body="$ nandwrite -p /dev/mtd%part_dtb% -p $FILE">Flashing dtb</CMD>
<!--burn the rootfs to NAND: -->
<CMD state="Updater" type="push"
body="$ flash_erase /dev/mtd%part_rootfs% 0 0">Erasing rootfs partition</CMD>
<CMD state="Updater" type="push"
body="$ ubiformat /dev/mtd%part_rootfs%"/>
<CMD state="Updater" type="push"
body="$ ubiattach /dev/ubi_ctrl -m %part_rootfs%">Attaching UBI partition</CMD>
<CMD state="Updater" type="push"
body="$ ubimkvol /dev/ubi0 -Nrootfs -m"/>
<CMD state="Updater" type="push"
body="$ mkdir -p /mnt/mtd%part_rootfs%"/>
<CMD state="Updater" type="push"
body="$ mount -t ubifs ubi0:rootfs /mnt/mtd%part_rootfs%"/>
<CMD state="Updater" type="push"
body="pipe tar -jxv -C /mnt/mtd%part_rootfs%" file="files/rootfs_nogpu.tar.bz2">Sending and writting rootfs</CMD>
<CMD state="Updater" type="push"
body="frf">Finishing rootfs write</CMD>
<CMD state="Updater" type="push"
body="$ umount /mnt/mtd%part_rootfs%">Unmounting rootfs partition</CMD>
<CMD state="Updater" type="push"
body="$ echo Update Complete!">Done</CMD>
</LIST>
</UCL>
從 Jumping to OS image
之後
看看 RAM 裡面的 Linux 做了些什麼事
- burn the uboot to NAND
- Mounting debugfs
- mount -t debugfs debugfs /sys/kernel/debug
- Erasing Boot partition
- flash_erase /dev/mtd%part_uboot% 0 0
- Flashing Bootloader
- kobs-ng init -x -v --chip_0_device_path=/dev/mtd%part_uboot% $FILE
- Mounting debugfs
- burn the kernel to NAND
- Erasing Kernel partition
- flash_erase /dev/mtd%part_kernel% 0 0
- Flashing Kernel
- nandwrite -p /dev/mtd%part_kernel% -p $FILE
- Erasing dtb partition
- flash_erase /dev/mtd%part_dtb% 0 0
- Flashing dtb
- nandwrite -p /dev/mtd%part_dtb% -p $FILE
- Erasing Kernel partition
- burn the rootfs to NAND
- Erasing rootfs partition
- flash_erase /dev/mtd%part_rootfs% 0 0
- ubiformat /dev/mtd%part_rootfs%
- Attaching UBI partition
- ubiattach /dev/ubi_ctrl -m %part_rootfs%
- ubimkvol /dev/ubi0 -Nrootfs -m
- mkdir -p /mnt/mtd%part_rootfs%
- mount -t ubifs ubi0:rootfs /mnt/mtd%part_rootfs%
- Sending and writting rootfs
- tar -jxv -C /mnt/mtd%part_rootfs%" file="files/rootfs_nogpu.tar.bz2
- Unmounting rootfs partition
- umount /mnt/mtd%part_rootfs%
- Erasing rootfs partition
盤一下該 Linux 需要什麼 tool 來做這些事
- burn the uboot to NAND
- mount
- flash_erase
- kobs-ng
- burn the kernel to NAND
- flash_erase
- nandwrite
- flash_erase
- nandwrite
- burn the rootfs to NAND
- flash_erase
- ubiformat
- ubiattach
- ubimkvol
- mkdir
- mount
- tar
- umount
扣除 burn the uboot to NAND
這件事的話
我們需要的 tool 有
- flash_erase
- nandwrite
- ubiformat
- ubiattach
- ubimkvol
- mkdir
- mount
- umount
- tar
這就是我們之後需要將 kernel
和 rootfs
燒錄到 NAND 去所需要的 tool
上禮拜五的 bitbake linux-mfgtool
已經 build 好了
這個 manufacturing tool image 應該就會包含我們需要的 tool
利用 bitbake linux-mfgtool -c devshell
跳到該 recipe 的 source code 後
利用 make menuconfig
便可以搜尋這些 tool 相關的選項是什麼
回到 VirtualBox m300_ubuntu_15
關機後修改網路的設定
- 介面卡 1
- 附加到 NAT
- 介面卡 2
- 附加到
僅限主機
介面卡
- 附加到
開機
jeffrey@jeffrey-VirtualBox:~$ ifconfig
enp0s3 Link encap:Ethernet HWaddr 08:00:27:54:18:c4
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
...
enp0s8 Link encap:Ethernet HWaddr 08:00:27:84:ad:03
inet addr:192.168.56.103 Bcast:192.168.56.255 Mask:255.255.255.0
...
- 介面卡 1
- 附加到 NAT
-
enp0s3
- 10.0.2.15
- 介面卡 2
- 附加到
僅限主機
介面卡 -
enp0s8
- 192.168.56.103
- 附加到
我目前的工作環境是 Window 10 專業版
安裝完 VirtualBox 之後會發現以下的網路介面
C:\Users\JEFFREY>ipconfig
乙太網路卡 VirtualBox Host-Only Network:
連線特定 DNS 尾碼 . . . . . . . . :
連結-本機 IPv6 位址 . . . . . . . : fe80::854:1b5d:66ad:ad12%5
IPv4 位址 . . . . . . . . . . . . : 192.168.56.1
子網路遮罩 . . . . . . . . . . . .: 255.255.255.0
預設閘道 . . . . . . . . . . . . .:
先把之前的 網路磁碟機 (Z:) 刪掉
C:\Users\JEFFREY>net use z: /delete
z: 已經刪除。
目前 m300_ubuntu_15
上的 samba 分享目前要改成 \\192.168.56.103\m300_develop
將其連線至網路磁碟機(Z:)
修改 m300_ubuntu_15
的 系統
以增進效能
- 主機板
- 延伸功能
- 啟用 I/O APIC - 勾選
- 延伸功能
- 處理器
- 處理器
- 4 CPUs
- 處理器
開機
先 做一下 svn up
update 一下 M300 最新狀態
jeffrey@jeffrey-VirtualBox:~/M300$ svn up
Updating '.':
C fsl-release-bsp/proscend/opensrc/ndisc6-1.0.3/Makefile.proscend
...
再利用 網路磁碟機(Z:) 直接使用 window 版的 TortoisesSVN
來看 log
最新版本的 log 如下
Revision: 265
Author: jammy
Date: 2016年7月31日 上午 08:38:27
Message:
rename patch after testing
----
Modified : /fsl-release-bsp/sources/meta-fsl-bsp-release/imx/meta-bsp/recipes-bsp/u-boot/u-boot-imx_2015.04.bb
Added : /fsl-release-bsp/sources/meta-fsl-bsp-release/imx/meta-bsp/recipes-bsp/u-boot/files/000_enable_ENET_CLK_when_booting.patch
Deleted : /fsl-release-bsp/sources/meta-fsl-bsp-release/imx/meta-bsp/recipes-bsp/u-boot/files/test_enable_ENET2_CLK_when_booting.patch
看一下 jammy 的 000_enable_ENET_CLK_when_booting.patch
改了什麼
先回憶一下 Yocto Project Mega-Manual 跟 patch
有關的章節
分別為了之後的 NAND Flash boot 做了兩次 commit
Revision: 266
Author: jeffrey
Date: 2016年8月1日 下午 02:29:53
Message:
add <UBOOT_DIR>/configs/mx6ul_14x14_evk_nand_config
----
Added : /fsl-release-bsp/sources/meta-fsl-bsp-release/imx/meta-bsp/recipes-bsp/u-boot/files/add_mx6ul_14x14_evk_nand_config.patch
Modified : /fsl-release-bsp/sources/meta-fsl-bsp-release/imx/meta-bsp/recipes-bsp/u-boot/u-boot-imx_2015.04.bb
Revision: 267
Author: jeffrey
Date: 2016年8月1日 下午 02:31:28
Message:
add - UBOOT_CONFIG[sd] = "mx6ul_14x14_evk_config,sdcard"
----
Modified : /fsl-release-bsp/sources/meta-fsl-arm/conf/machine/imx6ulevk.conf
月會
月會前跟 mirris 和 ariel 討論到要不要留 M300 板子上 USB OTG Port 的 issue
留 USB OTG Port 是為了 MfgTool 燒錄 code 時能使用
ariel 表示留 USB OTG Port 會讓客戶期待與之相關的功能 - 例如 NAS
目前並沒有安排相關的 schedule
若不留 USB OTG Port 的話
我們要克服 NAND Flash 燒錄的問題
NAND Flash 在焊到板子前就預燒是最省事的方法
重點是我們該提供什麼 image 讓 第三方 來做預燒的動作
參考 2016-07-25-MfgTool.no.14.nand-scrub.chip.log
UTP: received command '$ kobs-ng init -x -v --chip_0_device_path=/dev/mtd0 $FILE'
UTP: executing "kobs-ng init -x -v --chip_0_device_path=/dev/mtd0 $FILE"
MTD CONFIG:
chip_0_device_path = "/dev/mtd0"
...
-- We add the 1k-padding to the uboot.
.tmp_kobs_ng: verifying using key '00000000000000000000000000000000'
.tmp_kobs_ng: is a valid bootstream for key '00000000000000000000000000000000'
mtd: use new bch layout raw access mode
mtd: opening: "/dev/mtd0"
NFC geometry :
ECC Strength : 4
...
====================================================
mtd: opened '/dev/mtd0' - '(null)'
mtd: max_boot_stream_size_in_bytes = 33030144
mtd: boot_stream_size_in_bytes = 413696
mtd: boot_stream_size_in_pages = 202
mtd: #1 0x00100000 - 0x02080000 (0x00165000)
mtd: #2 0x02080000 - 0x04000000 (0x020e5000)
FCB
m_u32Checksum = 0x00000000
...
DBBT
m_u32Checksum = 0x00000000
...
Firmware: image #0 @ 0x100000 size 0x65000 - available 0x1f80000
Firmware: image #1 @ 0x2080000 size 0x65000 - available 0x1f80000
-------------- Start to write the [ FCB ] -----
mtd: erasing @0:0x0-0x20000
mtd: Writing FCB0 [ @0:0x0 ] (840) *
...
mtd_commit_bcb(FCB): status 0
-------------- Start to write the [ DBBT ] -----
mtd: erasing @0:0x80000-0xa0000
mtd: Writing DBBT0 [ @0:0x80000 ] (800) *
...
mtd_commit_bcb(DBBT): status 0
---------- Start to write the [ .tmp_kobs_ng ]----
mtd: Writting .tmp_kobs_ng: #0 @0: 0x00100000 - 0x00165000
mtd: erasing @0:0x100000-0x120000
mtd: erasing @0:0x120000-0x140000
mtd: erasing @0:0x140000-0x160000
mtd: erasing @0:0x160000-0x180000
mtd: We write one page for save guard. *
mtd: Writting .tmp_kobs_ng: #1 @0: 0x02080000 - 0x020e5000
mtd: erasing @0:0x2080000-0x20a0000
mtd: erasing @0:0x20a0000-0x20c0000
mtd: erasing @0:0x20c0000-0x20e0000
mtd: erasing @0:0x20e0000-0x2100000
mtd: We write one page for save guard. *
UTP: sending Success to kernel for command $ kobs-ng init -x -v --chip_0_device_path=/dev/mtd0 $FILE.
utp_poll: pass returned.
燒錄 U-Boot image 是由 kobs-ng
所負責
可以看到該 tool 顯示 We add the 1k-padding to the uboot
試著尋找 kobs-ng
的 source code
利用 ubuntu_16
來做實驗
利用 find . -name *kobs*.bb
先找一下相關的 *.bb
jeffrey@jeffbuntu:~/mfgtool_study/fsl-release-bsp/sources$ find . -name *kobs*.bb
./meta-fsl-arm/recipes-bsp/imx-kobs/imx-kobs_5.1.bb
./meta-fsl-bsp-release/imx/meta-bsp/recipes-bsp/imx-kobs/imx-kobs_5.4.bb
jeffrey@jeffbuntu:~/mfgtool_study/fsl-release-bsp/sources$
直接對 imx-kobs
recipe 動作 - bitbake imx-kobs
使用 bitbake imx-kobs -c devshell
來得知 source code 放在哪裡
搭配 2016-07-25-MfgTool.no.14.nand-scrub.chip.log trace 一下 source code 吧