20161226_jeffrey - silenceuncrio/diary GitHub Wiki
- 0930 - review
- 0940 - http://nvie.com/posts/a-successful-git-branching-model/
-
1000 - 把之前做的部分手工整合到
nandflash
這個 brach -
1010 - 整
fsl-release-bsp/sources/meta-proscend/recipes-core/prosrc/prosrc_0.1.bb
- 1040 - 參考之前 commit 的紀錄 - patch for u-boot-fw-utils since we need access uboot env from linux
-
1130 - 修
/meta-proscend/conf/distro/proscend-m300.conf b/meta-proscend/conf/distro/proscend-m300.conf
-
1240 - 整
\M300_git\M300\sources\meta-fsl-arm\conf\machine\imx6ulevk.conf
-
1310 - 整
M300_git/M300:<u-boot-imx>/include/configs/mx6ul_14x14_evk.h
-
1340 -
u-boot-fw-utils
-
1355 - 利用
M300_git\M300\proscend\base_fs\default\rootfs
整u-boot-fw-utils
-
1410 - 利用
git status
盤今天改了什麼 - 1440 - commit
- 1500 - engineering notebook
-
1510 - 整合
rc.local
- 配合新的 image 修改 mfgtool 的ucl2.xml
-
1540 - 改權限 -
chmod 775 FILE...
- -fw_printenv
,fw_setenv
和FirmwareUpgrade.sh
-
1600 - 改
imx6ul-14x14-evk.dts
-
1710 - 修正
FirmwareUpgrade.sh
- 製作 firmware.tar - commit
review
繼續 study http://nvie.com/posts/a-successful-git-branching-model/
參考 http://nvie.com/posts/a-successful-git-branching-model/
Switched to a new branch "nandflash"
➜ M300 git:(develop) ✗ git checkout -b nandflash develop
M proscend/opensrc/inadyn-mt.v.02.28.10/configure
Switched to a new branch 'nandflash'
開始把之前做的部分手工整合到 nandflash
這個 brach
先整 fsl-release-bsp/sources/meta-proscend/recipes-core/prosrc/prosrc_0.1.bb
- from -
\M300\fsl-release-bsp\sources\meta-proscend\recipes-core\prosrc\prosrc_0.1.bb
- to -
\M300_git\M300\meta-proscend\recipes-core\prosrc\prosrc_0.1.bb
build image... fail
...
| ***
| *** Can't find default configuration "arch/../configs/mx6ul_14x14_evk_defconfig"!
| ***
| make[1]: *** [mx6ul_14x14_evk_defconfig] Error 1
| make: *** [mx6ul_14x14_evk_config] Error 2
| WARNING: exit code 1 from a shell command.
| ERROR: oe_runmake failed
| ERROR: Function failed: do_compile (log file is located at /var/m300/build_small/tmp/work/m300-poky-linux-gnueabi/u-boot-
...
參考之前 commit 的紀錄
...
commit c9eccb99c39eb686e2937c1f5a090182eafbb313
Author: Jeffrey Lee <[email protected]>
Date: Tue Dec 20 18:28:35 2016 +0800
patch for u-boot-fw-utils since we need access uboot env from linux
...
利用 git show c9eccb99c39eb686e2937c1f5a090182eafbb313
➜ M300 git:(nandflash) git show c9eccb99c39eb686e2937c1f5a090182eafbb313
看一下細節
commit c9eccb99c39eb686e2937c1f5a090182eafbb313
Author: Jeffrey Lee <[email protected]>
Date: Tue Dec 20 18:28:35 2016 +0800
patch for u-boot-fw-utils since we need access uboot env from linux
diff --git a/fsl-release-bsp/sources/meta-proscend/recipes-bsp/u-boot-fw-utils/files/add_mx6ul_14x14_evk_nand_conf
ig.patch b/fsl-release-bsp/sources/meta-proscend/recipes-bsp/u-boot-fw-utils/files/add_mx6ul_14x14_evk_nand_config
.patch
new file mode 100644
index 0000000..ff75262
--- /dev/null
+++ b/fsl-release-bsp/sources/meta-proscend/recipes-bsp/u-boot-fw-utils/files/add_mx6ul_14x14_evk_nand_config.patc
h
@@ -0,0 +1,10 @@
+Index: git/configs/mx6ul_14x14_evk_nand_defconfig
+===================================================================
+--- /dev/null
++++ git/configs/mx6ul_14x14_evk_nand_defconfig
+@@ -0,0 +1,5 @@
++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
diff --git a/fsl-release-bsp/sources/meta-proscend/recipes-bsp/u-boot-fw-utils/files/modify.fw_env.config.patch b/fsl-release-bsp/sources/meta-proscend/recipes-bsp/u-boot-fw-utils/files/modify.fw_env.config.patch
new file mode 100644
index 0000000..a1109c2
--- /dev/null
+++ b/fsl-release-bsp/sources/meta-proscend/recipes-bsp/u-boot-fw-utils/files/modify.fw_env.config.patch
@@ -0,0 +1,25 @@
+Index: git/tools/env/fw_env.config
+===================================================================
+--- git.orig/tools/env/fw_env.config
++++ git/tools/env/fw_env.config
+@@ -5,18 +5,5 @@
+ # Futhermore, if the Flash sector size is ommitted, this value is assumed to
+ # be the same as the Environment size, which is valid for NOR and SPI-dataflash
+
+-# NOR example
+-# MTD device name Device offset Env. size Flash sector size Number of sectors
+-/dev/mtd1 0x0000 0x4000 0x4000
+-/dev/mtd2 0x0000 0x4000 0x4000
+-
+-# MTD SPI-dataflash example
+-# MTD device name Device offset Env. size Flash sector size Number of sectors
+-#/dev/mtd5 0x4200 0x4200
+-#/dev/mtd6 0x4200 0x4200
+-
+-# NAND example
+-#/dev/mtd0 0x4000 0x4000 0x20000 2
+-
+-# Block device example
+-#/dev/mmcblk0 0xc0000 0x20000
++# MTD device name Device offset Env. size Flash sector size
++/dev/mtd1 0x00000000 0x00100000 0x00100000
diff --git a/fsl-release-bsp/sources/meta-proscend/recipes-bsp/u-boot-fw-utils/u-boot-fw-utils_2015.01.bbappend b/fsl-release-bsp/sources/meta-proscend/recipes-bsp/u-boot-fw-utils/u-boot-fw-utils_2015.01.bbappend
new file mode 100644
index 0000000..7567773
--- /dev/null
+++ b/fsl-release-bsp/sources/meta-proscend/recipes-bsp/u-boot-fw-utils/u-boot-fw-utils_2015.01.bbappend
@@ -0,0 +1,6 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI_append = " \
+ file://add_mx6ul_14x14_evk_nand_config.patch \
+ file://modify.fw_env.config.patch \
+"
我需要新增 2 個 files:
<u-boot-fw-utils>/configs/mx6ul_14x14_evk_defconfig
<u-boot-fw-utils>/configs/mx6ul_14x14_evk_nand_defconfig
還需要修改
<u-boot-fw-utils>/tools/env/fw_env.config
直接一次改好了
- bitbake u-boot-fw-utils -c devshell
- quilt new nandflash.patch
- quilt add configs/mx6ul_14x14_evk_defconfig
- quilt add configs/mx6ul_14x14_evk_nand_defconfig
- quilt add tools/env/fw_env.config`
- copy mx6ul_14x14_evk_defconfig from M300:
- copy mx6ul_14x14_evk_nand_defconfig from M300:
- copy fw_env.config from M300:
- quilt refresh
切到 \M300_git\M300\meta-proscend\recipes-bsp\
資料夾下操作
- 新增
\u-boot-fw-utils
資料夾 - 新增
\u-boot-fw-utils\files
資料夾 - copy
nandflash.patch
from M300_git\M300:\patches - 新增
\u-boot-fw-utils\u-boot-fw-utils_2015.07.bbappend
\u-boot-fw-utils\u-boot-fw-utils_2015.07.bbappend
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI_append = " \
file://nandflash.patch \
"
出現沒看過的錯誤...
...
| In file included from ./tools/env/fw_env.h:13:0,
| from tools/env/../../common/env_flags.c:14,
| from tools/env/env_flags.c:1:
| include/config.h:7:22: fatal error: configs/.h: No such file or directory
| compilation terminated.
...
先修一下 /meta-proscend/conf/distro/proscend-m300.conf b/meta-proscend/conf/distro/proscend-m300.conf
diff --git a/meta-proscend/conf/distro/proscend-m300.conf b/meta-proscend/conf/distro/proscend-m300.conf
index 10e0807..629c5df 100644
--- a/meta-proscend/conf/distro/proscend-m300.conf
+++ b/meta-proscend/conf/distro/proscend-m300.conf
@@ -109,4 +109,4 @@ EXTERNALSRC_BUILD_pn-prosrc = "${BSPDIR}/proscend"
ACCEPT_FSL_EULA = ""
-#UBOOT_CONFIG = "nand"
+UBOOT_CONFIG = "nand"
build image 還是會出錯
修改 \M300_git\M300\meta-proscend\recipes-core\prosrc\prosrc_0.1.bb
先拿掉 u-boot-fw-utils
build image...
...
ERROR: Error: The image creation script '/var/m300/build_small/tmp/work/m300-poky-linux-gnueabi/core-image-minimal/1.0-r0/temp/create_image.sdcard' returned 1:
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000450985 s, 0.0 kB/s
Model: (file)
Disk /var/m300/build_small/tmp/deploy/images/m300/core-image-minimal-m300-20161226034748.rootfs.sdcard: 71.3MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 4194kB 12.6MB 8389kB primary lba
2 12.6MB 67.1MB 54.5MB primary
dd: failed to open '/var/m300/build_small/tmp/deploy/images/m300/u-boot-m300.imx': No such file or directory
WARNING: exit code 1 from a shell command.
ERROR: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /var/m300/build_small/tmp/work/m300-poky-linux-gnueabi/core-image-minimal/1.0-r0/temp/log.do_rootfs.4964
ERROR: Task 7 (/var/m300/sources/poky/meta/recipes-core/images/core-image-minimal.bb, do_rootfs) failed with exit code '1'
NOTE: Tasks Summary: Attempted 2402 tasks of which 2393 didn't need to be rerun and 1 failed.
No currently running tasks (2402 of 2403)
Summary: 1 task failed:
/var/m300/sources/poky/meta/recipes-core/images/core-image-minimal.bb, do_rootfs
Summary: There were 4 WARNING messages shown.
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
慘了...
發現 aaron 忘了整 \M300_git\M300\sources\meta-fsl-arm\conf\machine\imx6ulevk.conf
diff --git a/conf/machine/imx6ulevk.conf b/conf/machine/imx6ulevk.conf
index 1a60c6a..c8cbda4 100644
--- a/conf/machine/imx6ulevk.conf
+++ b/conf/machine/imx6ulevk.conf
@@ -18,5 +18,6 @@ SPL_BINARY = "SPL"
UBOOT_MAKE_TARGET = ""
UBOOT_CONFIG ??= "sd"
UBOOT_CONFIG[sd] = "mx6ul_14x14_evk_config,sdcard"
+UBOOT_CONFIG[nand] = "mx6ul_14x14_evk_nand_config,ubifs"
UBOOT_CONFIG[qspi1] = "mx6ul_14x14_evk_qspi1_config"
UBOOT_CONFIG[mfgtool] = "mx6ul_14x14_evk_config"
因應目前的 \meta-proscend\conf\machine\m300.conf
來作修改
diff --git a/meta-proscend/conf/machine/m300.conf b/meta-proscend/conf/machine/m300.conf
index c7ed44b..58bad39 100644
--- a/meta-proscend/conf/machine/m300.conf
+++ b/meta-proscend/conf/machine/m300.conf
@@ -16,5 +16,6 @@ KERNEL_DEVICETREE = "imx6ul-14x14-evk.dtb imx6ul-14x14-evk-csi.dtb imx6ul-14x14-
UBOOT_CONFIG ??= "sd"
UBOOT_CONFIG[sd] = "mx6ul_14x14_evk_config,sdcard"
+UBOOT_CONFIG[nand] = "mx6ul_14x14_evk_nand_config,ubifs"
UBOOT_CONFIG[qspi1] = "mx6ul_14x14_evk_qspi1_config"
UBOOT_CONFIG[mfgtool] = "mx6ul_14x14_evk_config"
build image... ok
先來整 M300_git/M300:<u-boot-imx>/include/configs/mx6ul_14x14_evk.h
- bitbake u-boot-imx -c devshell
- quilt new nandflash.patch
- quilt add include/configs/mx6ul_14x14_evk.h
- merge from
M300:<u-boot-imx>
- quilt refresh
- copy
patches\nandflash.patch
to\M300_git\M300\meta-proscend\recipes-bsp\u-boot\files
- modify
\M300_git\M300\meta-proscend\recipes-bsp\u-boot\u-boot-imx_2015.04.bbappend
\M300_git\M300\meta-proscend\recipes-bsp\u-boot\u-boot-imx_2015.04.bbappend
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI_append = " \
file://000_enable_ENET_CLK_when_booting.patch \
file://add_mx6ul_14x14_evk_nand_config.patch \
file://set_do_default_low.patch \
file://nandflash.patch \
"
build image... ok
回到 u-boot-fw-utils
bitbake u-boot-fw-utils -c clean
... ok
bitbake u-boot-fw-utils -c compile -vf
... fail
...
| ***
| *** Can't find default configuration "arch/../configs/mx6ul_14x14_evk_nand_defconfig"!
| ***
| make[1]: *** [mx6ul_14x14_evk_nand_defconfig] Error 1
...
直接從剛剛整完的 M300_git\M300:<u-boot-imx>\configs\mx6ul_14x14_evk_nand_defconfig
複製過來
bitbake u-boot-fw-utils -c compile -vf
... fail
...
| In file included from tools/env/fw_env.h:13:0,
| from tools/env/fw_env_main.c:37:
| include/config.h:8:22: fatal error: configs/.h: No such file or directory
...
我看就先利用 M300_git\M300\proscend\base_fs\default\rootfs
來整 u-boot-fw-utils
- fw_env.config
- from -
M300:<core-image-minimal>\..\rootfs\etc
- to -
M300_git\M300:<prosrc>\base_fs\default\rootfs\etc
- from -
- fw_printenv
- from -
M300:<core-image-minimal>\..\rootfs\sbin
- to -
M300_git\M300:<prosrc>\base_fs\default\rootfs\usr\sbin
- from -
- fw_setenv
- from -
M300:<core-image-minimal>\..\rootfs\sbin
- to -
M300_git\M300:<prosrc>\base_fs\default\rootfs\usr\sbin
- from -
利用 git status
來盤一下今天我改了什麼
➜ M300 git:(nandflash) ✗ git status
On branch nandflash
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: meta-proscend/conf/distro/proscend-m300.conf
modified: meta-proscend/conf/machine/m300.conf
modified: meta-proscend/recipes-bsp/u-boot/u-boot-imx_2015.04.bbappend
modified: meta-proscend/recipes-core/prosrc/prosrc_0.1.bb
modified: proscend/opensrc/inadyn-mt.v.02.28.10/configure
Untracked files:
(use "git add <file>..." to include in what will be committed)
meta-proscend/recipes-bsp/u-boot/files/nandflash.patch
proscend/base_fs/default/rootfs/etc/fw_env.config
proscend/base_fs/default/rootfs/usr/sbin/fw_printenv
proscend/base_fs/default/rootfs/usr/sbin/fw_setenv
no changes added to commit (use "git add" and/or "git commit -a")
再利用 git diff <path>
來看每個檔案我改了什麼
git diff meta-proscend/conf/distro/proscend-m300.conf
diff --git a/meta-proscend/conf/distro/proscend-m300.conf b/meta-proscend/conf/distro/proscend-m300.conf
index 10e0807..629c5df 100644
--- a/meta-proscend/conf/distro/proscend-m300.conf
+++ b/meta-proscend/conf/distro/proscend-m300.conf
@@ -109,4 +109,4 @@ EXTERNALSRC_BUILD_pn-prosrc = "${BSPDIR}/proscend"
ACCEPT_FSL_EULA = ""
-#UBOOT_CONFIG = "nand"
+UBOOT_CONFIG = "nand"
git diff meta-proscend/conf/machine/m300.conf
diff --git a/meta-proscend/conf/machine/m300.conf b/meta-proscend/conf/machine/m300.conf
index c7ed44b..58bad39 100644
--- a/meta-proscend/conf/machine/m300.conf
+++ b/meta-proscend/conf/machine/m300.conf
@@ -16,5 +16,6 @@ KERNEL_DEVICETREE = "imx6ul-14x14-evk.dtb imx6ul-14x14-evk-csi.dtb imx6ul-14x14-
UBOOT_CONFIG ??= "sd"
UBOOT_CONFIG[sd] = "mx6ul_14x14_evk_config,sdcard"
+UBOOT_CONFIG[nand] = "mx6ul_14x14_evk_nand_config,ubifs"
UBOOT_CONFIG[qspi1] = "mx6ul_14x14_evk_qspi1_config"
UBOOT_CONFIG[mfgtool] = "mx6ul_14x14_evk_config"
git diff meta-proscend/recipes-bsp/u-boot/u-boot-imx_2015.04.bbappend
diff --git a/meta-proscend/recipes-bsp/u-boot/u-boot-imx_2015.04.bbappend b/meta-proscend/recipes-bsp/u-boot/u-boot-imx_2015.04.bbappend
index ececc7e..90fb6c1 100644
--- a/meta-proscend/recipes-bsp/u-boot/u-boot-imx_2015.04.bbappend
+++ b/meta-proscend/recipes-bsp/u-boot/u-boot-imx_2015.04.bbappend
@@ -4,4 +4,5 @@ SRC_URI_append = " \
file://000_enable_ENET_CLK_when_booting.patch \
file://add_mx6ul_14x14_evk_nand_config.patch \
file://set_do_default_low.patch \
+ file://nandflash.patch \
"
git diff meta-proscend/recipes-core/prosrc/prosrc_0.1.bb
diff --git a/meta-proscend/recipes-core/prosrc/prosrc_0.1.bb b/meta-proscend/recipes-core/prosrc/prosrc_0.1.bb
index 71203d6..ece166f 100644
--- a/meta-proscend/recipes-core/prosrc/prosrc_0.1.bb
+++ b/meta-proscend/recipes-core/prosrc/prosrc_0.1.bb
@@ -16,7 +16,7 @@ INSANE_SKIP_${PN} += "already-stripped"
INSANE_SKIP_${PN} += "installed-vs-shipped "
# Runtime dependence
-RDEPENDS_${PN} += "ppp ppp-oe iptables iperf dnsmasq pptp-linux bridge-utils dhcp-server dhcp-client openvpn openssl openssl-conf iproute2 iproute2-tc procps socat strongswan cryptodev-module"
+RDEPENDS_${PN} += "ppp ppp-oe iptables iperf dnsmasq pptp-linux bridge-utils dhcp-server dhcp-client openvpn openssl openssl-conf iproute2 iproute2-tc procps socat strongswan cryptodev-module mtd-utils mtd-utils-ubifs imx-kobs tar bzip2"
# Build dependence
DEPENDS = "json-c rp-pppoe apr libxml2 libpcap sqlite3 xz"
先把 proscend/opensrc/inadyn-mt.v.02.28.10/configure
刪掉再 checkout 回來
build image... ok
先 commit 吧
commit 5f8bc5222c5600817d6bd67141ee94087bc7e861
Author: jeffrey <[email protected]>
Date: Mon Dec 26 14:38:31 2016 +0800
- define `UBOOT_CONFIG = "nand"` at proscend-m300.conf
- add `UBOOT_CONFIG[nand] = "mx6ul_14x14_evk_nand_config,ubifs"` at m300.conf
- patch u-boot-imx_2015.04.bbappend for nand flash
- prepare the tools for firmware upgrade(include uboot)
engineering notebook
繼續整合 M300\fsl-release-bsp\proscend\base_fs\default\rootfs\etc\rc.local
- form -
M300\fsl-release-bsp\proscend\base_fs\default\rootfs\etc\rc.local
- to -
M300_git\M300\proscend\base_fs\default\rootfs\etc\rc.local
再新增 M300_git\M300\proscend\prosrc\icos\script\FirmwareUpgrade.sh
build image... ok
mfgtool flash firmware...
配合新的 image 修改 mfgtool 的 ucl2.xml
<UCL>
<CFG>
<STATE name="BootStrap" dev="MX6SL" vid="15A2" pid="0063"/>
<STATE name="BootStrap" dev="MX6D" vid="15A2" pid="0061"/>
<STATE name="BootStrap" dev="MX6Q" vid="15A2" pid="0054"/>
<STATE name="BootStrap" dev="MX6SX" vid="15A2" pid="0071"/>
<STATE name="BootStrap" dev="MX6UL" vid="15A2" pid="007D"/>
<STATE name="BootStrap" dev="MX7D" vid="15A2" pid="0076"/>
<STATE name="Updater" dev="MSC" vid="066F" pid="37FF"/>
</CFG>
<LIST name="NAND Flash" desc="Choose NAND as media">
<CMD state="BootStrap" type="boot"
body="BootStrap" file ="firmware/u-boot.imx">Loading U-boot</CMD>
<CMD state="BootStrap" type="load"
file="firmware/zImage" address="0x80800000"
loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE" >Loading Kernel.</CMD>
<CMD state="BootStrap" type="load"
file="firmware/%initramfs%" address="0x83800000"
loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE">Loading Initramfs.</CMD>
<CMD state="BootStrap" type="load"
file="firmware/zImage-imx6ul-%6uldtb%-%nanddtb%.dtb" address="0x83000000"
loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE">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/mtd0 0 0">Erasing Boot partition</CMD>
<CMD state="Updater" type="push"
body="$ flash_erase /dev/mtd1 0 0">Erasing Boot env partition</CMD>
<CMD state="Updater" type="push"
body="send" file="files/u-boot.imx" ifdev="MX6UL">Sending u-boot.bin</CMD>
<CMD state="Updater" type="push"
body="$ kobs-ng init -x -v --chip_0_device_path=/dev/mtd0 $FILE">Flashing Bootloader</CMD>
<!--burn the kernel to NAND: -->
<CMD state="Updater" type="push"
body="$ flash_erase /dev/mtd2 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/mtd2 -p $FILE">Flashing Kernel</CMD>
<CMD state="Updater" type="push"
body="$ flash_erase /dev/mtd3 0 0">Erasing dtb partition</CMD>
<CMD state="Updater" type="push"
body="send" file="files/zImage-imx6ul-14x14-evk.dtb">Sending Device Tree file</CMD>
<CMD state="Updater" type="push"
body="$ nandwrite -p /dev/mtd3 -p $FILE">Flashing dtb</CMD>
<!--prepare all ubi device: -->
<CMD state="Updater" type="push"
body="$ flash_erase /dev/mtd4 0 0">Erasing rootfs_a partition</CMD>
<CMD state="Updater" type="push"
body="$ flash_erase /dev/mtd5 0 0">Erasing config_a partition</CMD>
<CMD state="Updater" type="push"
body="$ flash_erase /dev/mtd9 0 0">Erasing rootfs_b partition</CMD>
<CMD state="Updater" type="push"
body="$ flash_erase /dev/mtd10 0 0">Erasing config_b partition</CMD>
<CMD state="Updater" type="push"
body="$ ubiformat /dev/mtd4"/>
<CMD state="Updater" type="push"
body="$ ubiformat /dev/mtd5"/>
<CMD state="Updater" type="push"
body="$ ubiformat /dev/mtd9"/>
<CMD state="Updater" type="push"
body="$ ubiformat /dev/mtd10"/>
<CMD state="Updater" type="push"
body="$ ubiattach /dev/ubi_ctrl -m 4">Attaching UBI partition - /dev/ubi0</CMD>
<CMD state="Updater" type="push"
body="$ ubiattach /dev/ubi_ctrl -m 5">Attaching UBI partition - /dev/ubi1</CMD>
<CMD state="Updater" type="push"
body="$ ubiattach /dev/ubi_ctrl -m 9">Attaching UBI partition - /dev/ubi2</CMD>
<CMD state="Updater" type="push"
body="$ ubiattach /dev/ubi_ctrl -m 10">Attaching UBI partition - /dev/ubi3</CMD>
<CMD state="Updater" type="push"
body="$ ubimkvol /dev/ubi0 -N rootfs_a -m"/>
<CMD state="Updater" type="push"
body="$ ubimkvol /dev/ubi1 -N config_a -m"/>
<CMD state="Updater" type="push"
body="$ ubimkvol /dev/ubi2 -N rootfs_b -m"/>
<CMD state="Updater" type="push"
body="$ ubimkvol /dev/ubi3 -N config_b -m"/>
<!--burn the rootfs_a to NAND: -->
<CMD state="Updater" type="push"
body="$ mkdir -p /mnt/rootfs_a"/>
<CMD state="Updater" type="push"
body="$ mount -t ubifs ubi0:rootfs_a /mnt/rootfs_a"/>
<CMD state="Updater" type="push"
body="pipe tar -jxv -C /mnt/rootfs_a" file="files/core-image-minimal-m300.tar.bz2">Sending and writting rootfs_a</CMD>
<CMD state="Updater" type="push"
body="frf">Finishing rootfs write</CMD>
<CMD state="Updater" type="push"
body="$ umount /mnt/rootfs_a">Unmounting rootfs_a partition</CMD>
<CMD state="Updater" type="push"
body="$ echo Update Complete!">Done</CMD>
</LIST>
</UCL>
想起來 zImage-imx6ul-14x14-evk.dtb
還沒改... 先沿用舊的
忘了下面這些 files 都要改權限 - chmod 775 FILE...
M300_git\M300:<prosrc>\base_fs\default\rootfs\usr\sbin\fw_printenv
M300_git\M300:<prosrc>\base_fs\default\rootfs\usr\sbin\fw_setenv
M300_git\M300:<prosrc>\prosrc\icos\script\FirmwareUpgrade.sh
build image... ok
mfgtool flash firmware... ok
開機
root@M300:~# fw_printenv
active_firmware=a
baudrate=115200
bootargs=console=ttymxc0,115200 ubi.mtd=4 root=ubi0:rootfs_a rootfstype=ubifs mtdparts=gpmi-nand:3m(boot),1m(boot_env),10m(kernel_a),2m(dtb_a),96m(rootfs_a),16m(config_a),4m(misc),10m(kernel_b),2m(dtb_b),96m(rootfs_b),-(config_b)
bootcmd=saveenv;nand read ${loadaddr} ${kernel_a_addr} 0x800000;nand read ${fdt_addr} ${dtb_a_addr} 0x100000;bootz ${loadaddr} - ${fdt_addr}
bootcmd_mfg=run mfgtool_args;bootz ${loadaddr} ${initrd_addr} ${fdt_addr};
bootdelay=3
console=ttymxc0
dtb_a_addr=0x00E00000
dtb_b_addr=0x08E00000
ethact=FEC1
ethprime=FEC
fdt_addr=0x83000000
fdt_high=0xffffffff
initrd_addr=0x83800000
initrd_high=0xffffffff
kernel_a_addr=0x00400000
kernel_b_addr=0x08400000
loadaddr=0x80800000
mfgtool_args=setenv bootargs console=${console},${baudrate} rdinit=/linuxrc g_mass_storage.stall=0 g_mass_storage.removable=1 g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF g_mass_storage.iSerialNumber="" mtdparts=gpmi-nand:3m(boot),1m(boot_env),10m(kernel_a),2m(dtb_a),96m(rootfs_a),16m(config_a),4m(misc),10m(kernel_b),2m(dtb_b),96m(rootfs_b),-(config_b)
panel=TFT43AB
rootfs_a_mtd=4
rootfs_b_mtd=9
fw_printenv
... ok
改 imx6ul-14x14-evk.dts
- bitbake linux-imx -c devshell
- quilt new add_nandflash.patch
- quilt add arch/arm/boot/dts/imx6ul-14x14-evk.dts
- merge from
M300:<linux-imx>\arch\arm\boot\dts\imx6ul-14x14-evk.dts
- quilt refresh
- copy
M300:<linux-imx>\patches\add_nandflash.patch
toM300_git\M300\meta-proscend\recipes-kernel\linux\files
- modify
M300_git\M300\meta-proscend\recipes-kernel\linux\linux-imx_4.1.15.bbappend
linux-imx_4.1.15.bbappend
diff --git a/meta-proscend/recipes-kernel/linux/linux-imx_4.1.15.bbappend b/meta-proscend/recipes-kernel/linux/linux-imx_4.1.15.bbappend
index b3318ff..d06935f 100644
--- a/meta-proscend/recipes-kernel/linux/linux-imx_4.1.15.bbappend
+++ b/meta-proscend/recipes-kernel/linux/linux-imx_4.1.15.bbappend
@@ -7,6 +7,7 @@ SRC_URI_append = " \
file://add_usbserial_ppp_support.patch \
file://modify_working_temperature.patch \
file://m301_lan_driver.patch \
+ file://add_nandflash.patch \
"
do_copy_defconfig_append () {
build image... ok
mfgtool flash firmware... ok
fw_printenv... ok
可以來試 FirmwareUpgrade.sh
想起來沒裝 nfs-utils
build@39cf45d83b59:/var/m300/build_small$ cat conf/local.conf
...
IMAGE_INSTALL_append += " nfs-utils"
...
build image... ok
mfgtool flash firmware... ok
開機... ok
mount nfs... ok
製作 firmware.tar... ok
複製 firmware.tar 到 /tmp
FirmwareUpgrade.sh firmware.tar
... fail
root@M300:/tmp# FirmwareUpgrade.sh firmware.tar
-sh: /usr/sbin/icos/FirmwareUpgrade.sh: /bin/bash^M: bad interpreter: No such file or directory
/bin/bash^M
???
耐著性子敲 command 看看哪邊錯了
修正一下 FirmwareUpgrade.sh
#!/bin/bash
# firmware upgrade shell script
if [ -n "$1" ]
then
echo "Extract all files from $1"
tar -xf $1
else
echo "Please offer archive .tar"
exit 1
fi
echo "Burn the kernel to NAND..."
if df | grep rootfs_a
then
echo "Erasing kernel_b partition - MTD device 7 (/dev/mtd7)"
flash_erase /dev/mtd7 0 0
echo "Flashing Kernel"
nandwrite -p /dev/mtd7 -p /tmp/firmware/zImage
else
echo "Erasing kernel_a partition - MTD device 2 (/dev/mtd2)"
flash_erase /dev/mtd2 0 0
echo "Flashing Kernel"
nandwrite -p /dev/mtd2 -p /tmp/firmware/zImage
fi
echo "Burn the dtb to NAND..."
if df | grep rootfs_a
then
echo "Erasing dtb_b partition - MTD device 8 (/dev/mtd8)"
flash_erase /dev/mtd8 0 0
echo "Flashing dtb"
nandwrite -p /dev/mtd8 -p /tmp/firmware/zImage-imx6ul-14x14-evk.dtb
else
echo "Erasing dtb_a partition - MTD device 3 (/dev/mtd3)"
flash_erase /dev/mtd3 0 0
echo "Flashing dtb"
nandwrite -p /dev/mtd3 -p /tmp/firmware/zImage-imx6ul-14x14-evk.dtb
fi
echo "Burn the rootfs to NAND..."
if df | grep rootfs_a
then
echo "Attach rootfs_b patition to UBI - MTD device 9"
ubiattach /dev/ubi_ctrl -m 9
echo "Create derectory /mnt/rootfs_b"
mkdir -p /mnt/rootfs_b
echo "Mount /mnt/rootfs_b with node ubi2:rootfs_b"
mount -t ubifs ubi2:rootfs_b /mnt/rootfs_b
echo "Writting rootfs"
tar -jxv -C /mnt/rootfs_b -f /tmp/firmware/core-image-minimal-m300.tar.bz2
echo "Unmount /mnt/rootfs_b"
umount /mnt/rootfs_b
else
echo "Attach rootfs_a patition to UBI - MTD device 4"
ubiattach /dev/ubi_ctrl -m 4
echo "Create derectory /mnt/rootfs_a"
mkdir -p /mnt/rootfs_a
echo "Mount /mnt/rootfs_a with node ubi2:rootfs_a"
mount -t ubifs ubi2:rootfs_a /mnt/rootfs_a
echo "Writting rootfs"
tar -jxvm -C /mnt/rootfs_a -f /tmp/firmware/core-image-minimal-m300.tar.bz2
echo "Unmount /mnt/rootfs_a"
umount /mnt/rootfs_a
fi
echo "Change uboot env..."
if df | grep rootfs_a
then
echo "The active firmware is a, switch to b"
echo "Modify uboot env 'bootargs'"
fw_setenv bootargs "console=ttymxc0,115200 ubi.mtd=9 root=ubi0:rootfs_b rootfstype=ubifs mtdparts=gpmi-nand:3m(boot),1m(boot_env),10m(kernel_a),2m(dtb_a),96m(rootfs_a),16m(config_a),4m(misc),10m(kernel_b),2m(dtb_b),96m(rootfs_b),-(config_b)"
echo "Modify uboot env 'bootcmd'"
fw_setenv bootcmd "saveenv;nand read \${loadaddr} \${kernel_b_addr} 0x800000;nand read \${fdt_addr} \${dtb_b_addr} 0x100000;bootz \${loadaddr} - \${fdt_addr}"
else
echo "The active firmware is b, switch to a"
echo "Modify uboot env 'bootargs'"
fw_setenv bootargs "console=ttymxc0,115200 ubi.mtd=4 root=ubi0:rootfs_a rootfstype=ubifs mtdparts=gpmi-nand:3m(boot),1m(boot_env),10m(kernel_a),2m(dtb_a),96m(rootfs_a),16m(config_a),4m(misc),10m(kernel_b),2m(dtb_b),96m(rootfs_b),-(config_b)"
echo "Modify uboot env 'bootcmd'"
fw_setenv bootcmd "saveenv;nand read \${loadaddr} \${kernel_a_addr} 0x800000;nand read \${fdt_addr} \${dtb_a_addr} 0x100000;bootz \${loadaddr} - \${fdt_addr}"
fi
build image... ok
mfgtool flash firmware... ok
開機... ok
root@M300:~# FirmwareUpgrade.sh
Please offer archive .tar
shell script 執行沒問題
製作 firmware.tar
- mkdir -p /tmp/firmware
- cp zImage /tmp/firmware
- cp zImage-imx6ul-14x14-evk.dtb /tmp/firmware
- cp core-image-minimal-m300.tar.bz2 /tmp/firmware
- cd /tmp
- rm firmware.tar
- tar -cf firmware.tar firmware
- cp firmware.tar ~/M300/fsl-release-bsp/build_small/images
切到 m300 console
- mkdir images
- mount -t nfs 192.168.1.200:/home/jeffrey/M300/fsl-release-bsp/build_small/images images
- cp images/firmware.tar /tmp
- cd /tmp
- FirmwareUpgrade.sh firmware.tar
過程順利
重開機
root@M300:~# df
Filesystem 1024-blocks Used Available Use% Mounted on
ubi0:rootfs_b 81080 27776 49128 36% /
devtmpfs 90956 0 90956 0% /dev
tmpfs 254988 156 254832 0% /run
tmpfs 254988 188 254800 0% /var/volatile
ubi1:config_b 7796 44 7320 1% /mnt/data
看來可以先 commit 了
commit 7c9747ebb7e2cee0305ba2a606710d517ecd1afe
Author: jeffrey <[email protected]>
Date: Mon Dec 26 17:46:48 2016 +0800
- patch linux-imx_4.1.15.bbappend for nandflash
- modify rc.local for attach the related MTD device to UBI, according to the current rootfs
- add FirmwareUpgrade.sh for firmware upgrade