20161221_jeffrey - silenceuncrio/diary GitHub Wiki

Index

  • 0910 - review
  • 0940 - 盤一下 prosrc_0.1.bblocal.conf
  • 0950 - 修 <u-boot-imx>\include\configs\mx6ul_14x14_evk.h
  • 1020 - 幫 <u-boot-imx>\include\configs\mx6ul_14x14_evk.h 上 patch
  • 1045 - git commit
  • 1130 - 寫 shell script
  • 1315 - 修改 /etc/rc.local
  • 1415 - 幫 m300 裝一下 vim 方便編輯 shell script
  • 1700 - 修改 /etc/rc.local

0910

review 前兩天做的

0940

盤一下

  • fsl-release-bsp\sources\meta-proscend\recipes-core\prosrc\prosrc_0.1.bb
    • RDEPENDS_${PN}
  • fsl-release-bsp\build_small\conf\local.conf
    • IMAGE_INSTALL_append

目前 prosrc_0.1.bb - RDEPENDS_${PN}

# 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 mtd-utils mtd-utils-ubifs imx-kobs"

目前 local.conf - IMAGE_INSTALL_append

IMAGE_INSTALL_append += " nfs-utils tar bzip2 u-boot-fw-utils"

IMAGE_INSTALL_append 只保留 nfs-utils

tar, bzip2u-boot-fw-utils 都放到 prosrc_0.1.bbRDEPENDS_${PN}

# 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 mtd-utils mtd-utils-ubifs imx-kobs tar bzip2 u-boot-fw-utils"

使用 git diff 確認一下

diff --git a/fsl-release-bsp/sources/meta-proscend/recipes-core/prosrc/prosrc_0.1.bb b/fsl-release-bsp/sources/meta-proscend/recipes-core/prosrc/prosrc_0.1.bb
index 3a4e892..e487d90 100644
--- a/fsl-release-bsp/sources/meta-proscend/recipes-core/prosrc/prosrc_0.1.bb
+++ b/fsl-release-bsp/sources/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 mtd-utils mtd-utils-ubifs imx-kobs"
+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 u-boot-fw-utils"

 # Build dependence
 DEPENDS = "json-c rp-pppoe apr libxml2 libpcap sqlite3 xz"

build image 確認一下... ok

0950

順便修一下 <u-boot-imx>\include\configs\mx6ul_14x14_evk.h

...
#define CONFIG_EXTRA_ENV_SETTINGS \
    CONFIG_MFG_ENV_SETTINGS \
    CONFIG_VIDEO_MODE \
    "fdt_addr=0x83000000\0" \
    "fdt_high=0xffffffff\0"   \
    "console=ttymxc0\0" \
    "active_firmware=a\0" \
    "rootfs_a_mtd=4\0" \
    "rootfs_b_mtd=9\0" \
    "bootargs=console=ttymxc0,115200 ubi.mtd=4 " \
        "root=ubi0:rootfs_a rootfstype=ubifs " \
        CONFIG_NAND_PARTITION \
    "kernel_a_addr=0x00400000\0" \
    "kernel_b_addr=0x08400000\0" \
    "dtb_a_addr=0x00E00000\0" \
    "dtb_b_addr=0x08E00000\0" \
    "bootcmd=" \
        "saveenv;" \
        "nand read ${loadaddr} ${kernel_a_addr} 0x800000;" \
        "nand read ${fdt_addr} ${dtb_a_addr} 0x100000;" \
        "bootz ${loadaddr} - ${fdt_addr}\0"
...

修正了 uboot env bootargs 裡的 root 使其為 ubi0:rootfs_a

bitbake u-boot-imx -c compile -vf

bitbake u-boot-imx -c deploy

mfgtool flash firmware... ok

開機... 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 正常運作

1020

先幫 <u-boot-imx>\include\configs\mx6ul_14x14_evk.h 上 patch 方便後續的 git commit

  • bitbake u-boot-imx -c devshell
  • quilt new nand_flash_layout.patch
  • quilt add include/configs/mx6ul_14x14_evk.h
  • 套用最新的 <u-boot-imx>\include\configs\mx6ul_14x14_evk.h
  • quilt refresh
  • cp patch/nand_flash_layout.patch to fsl-release-bsp\sources\meta-proscend\recipes-bsp\u-boot\files
  • modify fsl-release-bsp\sources\meta-proscend\recipes-bsp\u-boot\u-boot-imx_2015.04.bbappend
    • add nand_flash_layout.patch to SRC_URI_append

bitbake u-boot-imx -c clean

bitbake u-boot-imx

built image... ok

mfgtool flash frimware... ok

1045

git commit 先

commit 15bd9f75268d6ae8a6832935cf3893ef912a53e0
Author: Jeffrey Lee <[email protected]>
Date:   Wed Dec 21 10:42:09 2016 +0800

    - add recipes `tar`, `bzip2` and `u-boot-fw-utils` to `RDEPENDS_${PN}` in prosrc_0.1.bb
      - tools for upgrade firmare
    - add patch `nand_flash_layout.patch` to `SRC_URI_append` in u-boot-imx_2015.04.bbappend
      - apply our nand flash layout

1130

可以放心地開始寫 shell script 了

1315

參考 [Linux Command Line and Shell Scripting Bible 3rd Edition] 來修改 /etc/rc.local

1415

幫 m300 裝一下 vim 方便編輯 shell script

直接在 fsl-release-bsp\build_small\conf\local.confIMAGE_INSTALL_append 新增 vim

1700

修改 /etc/rc.local

    # ======================================================================
    # | attach the related MTD device to UBI, 
    # | according to the current rootfs 
    # ======================================================================
    /bin/mkdir -p /mnt/data
    if df | grep rootfs_a
    then
        echo "attach MTD device 5 (mtd5) to UBI - ubi1:config_a"
        ubiattach -m 5
        mount -t ubifs ubi1:config_a /mnt/data
    else
        echo "attach MTD device 9 (mtd9) to UBI - ubi1:config_b"
        ubiattach -m 9
        mount -t ubifs ubi1:config_b /mnt/data
    fi



	# ==========================================================================
	# | mkdir /mnt/data/icos         for icos data storage (/etc/icos)
	# | mkdir /mnt/data/etc          for other app data storage
	# ==========================================================================
	/bin/mkdir -p /mnt/data/icos
	/bin/mkdir -p /mnt/data/etc

...

build image... ok

mfgtool flash firmware...

開機

...
Running local boot scripts (/etc/rc.local)ubi0:rootfs_a            81080     28668     48236  37% /
attach MTD device 5 (mtd5) to UBI - ubi1:config_a
UBI device number 1, total 128 LEBs (16252928 bytes, 15.5 MiB), available 0 LEBs (0 bytes), LEB size 126976 bytes (124.0 KiB)
...
root@M300:~# mount
rootfs on / type rootfs (rw)
ubi0:rootfs_a on / type ubifs (rw,relatime)
devtmpfs on /dev type devtmpfs (rw,relatime,size=91208k,nr_inodes=22802,mode=755)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /var/volatile type tmpfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620)
ubi1:config_a on /mnt/data type ubifs (rw,relatime)
root@M300:~# df
Filesystem           1024-blocks    Used Available Use% Mounted on
rootfs                   81080     28992     47912  38% /
ubi0:rootfs_a            81080     28992     47912  38% /
devtmpfs                 91208         4     91204   0% /dev
tmpfs                   255220       156    255064   0% /run
tmpfs                   255220       196    255024   0% /var/volatile
ubi1:config_a             7796        44      7320   1% /mnt/data

看起來還不錯

git commit 吧

commit 8e60de5b2ec2a7434117c501690c96cef690a74a
Author: Jeffrey Lee <[email protected]>
Date:   Wed Dec 21 17:42:11 2016 +0800

    attach the related MTD device to UBI, according to the current rootfs

diff --git a/fsl-release-bsp/proscend/base_fs/default/rootfs/etc/rc.local b/fsl-release-bsp/proscend/base_fs/default/rootfs/etc/rc.local
old mode 100755
new mode 100644
index af18a1d..2b97345
--- a/fsl-release-bsp/proscend/base_fs/default/rootfs/etc/rc.local
+++ b/fsl-release-bsp/proscend/base_fs/default/rootfs/etc/rc.local
@@ -47,6 +47,26 @@ echo 1 > /proc/sys/net/ipv4/ip_forward
        /bin/echo 1 > /proc/sys/kernel/printk
 #      [ -f /etc/sysctl.conf ] && sysctl -p -e >&-

+
+
+    # ======================================================================
+    # | attach the related MTD device to UBI,
+    # | according to the current rootfs
+    # ======================================================================
+    /bin/mkdir -p /mnt/data
+    if df | grep rootfs_a
+    then
+        echo "attach MTD device 5 (mtd5) to UBI - ubi1:config_a"
+        ubiattach -m 5
+        mount -t ubifs ubi1:config_a /mnt/data
+    else
+        echo "attach MTD device 9 (mtd9) to UBI - ubi1:config_b"
+        ubiattach -m 9
+        mount -t ubifs ubi1:config_b /mnt/data
+    fi
+
+
+
        # ==========================================================================
        # | mkdir /mnt/data/icos         for icos data storage (/etc/icos)
        # | mkdir /mnt/data/etc          for other app data storage
⚠️ **GitHub.com Fallback** ⚠️