20160713_jeffrey - silenceuncrio/diary GitHub Wiki

Index

0845

邊吃早餐邊 review 前兩天做的

0900

charlie 一個人拿著 alarm sensor 的 prototype 進了大會議室

希望有好的結果阿

0905

昨晚下班前做的事如下

  • 保持 UBOOT_CONFIG = "nand"
  • /M300/fsl-release-bsp/ 目錄
    • 執行 MACHINE=imx6ul14x14ddr3arm2 source setup-environment build_small
  • bitbake u-boot-imx -c clean
  • <BUILD_DIR>/conf/local.conf - MACHINE ??= 'imx6ul14x14ddr3arm2'
  • 執行 bitbake core-image-minimal

早上收成得到

log 在 <BUILD_DIR>/tmp/work/imx6ul14x14ddr3arm2-poky-linux-gnueabi/core-image-minimal/1.0-r0/temp/log.do_rootfs.11387

...
NOTE: The image creation groups are: [['ext3', 'tar'], ['sdcard']]
...

還是沒有看到啥 ubifs 字眼

莫非是自己誤會了

0930

charlie 表示 alram sensor 的確有引起老闆的興趣

不過感覺觀望的氣息還是很濃厚

目前就等著我的 C# 作個簡單 UI 來控制一些聲音條件

wifi 和 mail 先放後面一點

0920

試著從 MfgTool 找一些跟 ubifs 相關的線索

mfgtools\Profiles\Linux\OS Firmware\ucl2.xml 來觀察一下 MfgTool 怎麼將相關的 image 燒錄到 NAND Flash 去

參考之前的日記 - 20160620_jeffrey

觀察 burn the rootfs to NAND: 部分

  • flash_erase /dev/mtd%part_rootfs% 0 0 - Erasing rootfs partition
  • ubiformat /dev/mtd%part_rootfs%
  • ubiattach /dev/ubi_ctrl -m %part_rootfs% - Attaching UBI partition
  • ubimkvol /dev/ubi0 -Nrootfs -m
  • mkdir -p /mnt/mtd%part_rootfs%
  • mount -t ubifs ubi0:rootfs /mnt/mtd%part_rootfs%
  • pipe tar -jxv -C /mnt/mtd%part_rootfs% - file="files/rootfs_nogpu.tar.bz2 - Sending and writting rootfs
  • frf - Finishing rootfs write
  • umount /mnt/mtd%part_rootfs% - Unmounting rootfs partition

這裡的 part_rootfs 在 mfgtool2-yocto-mx-14x14-arm2-nand.vbs 被定義成 3

可以發現 ubifs 跟我們產生的 rootfs 沒有關係

我們的 rootfs 就一個樣 - rootfs_nogpu.tar.bz2

只需要能傳到相對應的 /dev/mtd 去再解壓縮就做完了

1115

MACHINE 改回 imx6ulevk

直接改 <BUILD_DIR>/conf/local.conf

  • MACHINE ??= 'imx6ulevk'

再執行 bitbake core-image-minimal

1410

剛剛 morris 找我去看一下從示波器看到的 alarm sensor 是怎麼樣

目前針對聲音所開放出來能被設定的參數看來是足夠的

  • info_max - 多少筆資料結算一次
  • adc_trigger_level - 被觸發的靈敏度
  • adc_triggered_threshold - 聲波越密(越持續)就越容易累積觸發的 counter

不過讓 charlie 帶出去總要搭配個 UI 比較炫

目前的想法是讓 ESP8266 當 WiFi AP

手機連上 ESP8266 之後再利用幾組簡單的 RESTful API 來互動

桌上型的 UI 就忘了吧

直接用 Android 硬上了

討論的過程 charlie 和 Jim 都出現了

總是讓 alarm sensor 這個 project 慢慢浮出檯面

不過目前還是要在不影響 M300 的前提下端菜出來

1445

看一下 How-To use NAND boot on i.MX6UL EVK board 裡跟 MfgTool 相關的部分

MFGTOOL modification

  • Copy mfgtool2-yocto-mx6ul-evk-nand.vbs in the attachment to MFGTOOL root direcory
  • Copy u-boot-imx6ulevk_nand.imx and zImage-imx6ul-14x14-evk-gpmi-weim.dtb to MFGTOOL\Profiles\Linux\OS Firmware\firmware\
  • Copy u-boot-imx6ulevk_nand.imx and zImage-imx6ul-14x14-evk-gpmi-weim.dtb to MFGTOOL\Profiles\Linux\OS Firmware\files\

看一下 mfgtool2-yocto-mx6ul-evk-nand.vbs 的內容

Set wshShell = CreateObject("WScript.shell")
wshShell.run "mfgtool2.exe -c ""linux"" -l ""NAND Flash""  -s ""board=sabreauto"" -s ""6uluboot=evk"" -s ""nand=nand"" -s ""6uldtb=14x14-evk"" -s ""nanddtb=gpmi-weim"" -s ""part_uboot=0"" -s ""part_kernel=1"" -s ""part_dtb=2"" -s ""part_rootfs=3""   "
Set wshShell = Nothing

就以這個 mfgtool2-yocto-mx6ul-evk-nand.vbs 來搭配目前最新的 IMX6_L4.1.15_MFG_TOOL (REV L4.1.15_1.0.0)

下載得到 L4.1.15_1.0.0_ga-mfg-tools.tar.gz

解開至 D:\m300\tools\L4.1.15-1.0.0_ga-mfg-tools 得到

  • mfgtools-without-rootfs.tar.gz
  • mfgtools-with-rootfs.tar.gz

再解開 mfgtools-with-rootfs.tar.gzD:\m300\tools\L4.1.15-1.0.0_ga-mfg-tools\mfgtools

我們就說 <MFGTOOL_DIR>D:\m300\tools\L4.1.15-1.0.0_ga-mfg-tools\mfgtools

觀察 <MFGTOOL_DIR>\Profiles\Linux\OS Firmware\ucl2.xml 裡跟 NAND Flash 還有 MX6UL 相關的部分

<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" 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/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>

參考

  • mfgtool2-yocto-mx6ul-evk-nand.vbs
  • <MFGTOOL_DIR>\cfg.ini

換掉 <MFGTOOL_DIR>\Profiles\Linux\OS Firmware\ucl2.xml 裡的 variable

  • %6uluboot% - evk
  • %nand% - nand
  • %initramfs% - fsl-image-mfgtool-initramfs-imx_mfgtools.cpio.gz.u-boot
  • %6uldtb% - 14x14-evk
  • %nanddtb% - gpmi-weim
  • %part_uboot% - 0
  • %part_kernel% - 1
  • %part_dtb% - 2
  • %part_rootfs% - 3

得到

<LIST name="NAND Flash" desc="Choose NAND as media">

  <CMD state="BootStrap" type="boot" body="BootStrap" file ="firmware/u-boot-imx6ulevk_nand.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/fsl-image-mfgtool-initramfs-imx_mfgtools.cpio.gz.u-boot" address="0x83800000"
        loadSection="OTH" setSection="OTH" HasFlashHeader="FALSE">Loading Initramfs.</CMD>

  <CMD state="BootStrap" type="load" file="firmware/zImage-imx6ul-14x14-evk-gpmi-weim.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="send" file="files/u-boot-imx6ulevk_nand.imx">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/mtd1 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/mtd1 -p $FILE">Flashing Kernel</CMD>


  <CMD state="Updater" type="push" body="$ flash_erase /dev/mtd2 0 0">Erasing dtb partition</CMD>
  <CMD state="Updater" type="push" body="send" file="files/zImage-imx6ul-14x14-evk-gpmi-weim.dtb">Sending Device Tree file</CMD>
  <CMD state="Updater" type="push" body="$ nandwrite -p /dev/mtd2 -p $FILE">Flashing dtb</CMD>

  <!--burn the rootfs to NAND: -->
  <CMD state="Updater" type="push" body="$ flash_erase /dev/mtd3 0 0">Erasing rootfs partition</CMD>
  <CMD state="Updater" type="push" body="$ ubiformat /dev/mtd3"/>
  <CMD state="Updater" type="push" body="$ ubiattach /dev/ubi_ctrl -m 3">Attaching UBI partition</CMD>
  <CMD state="Updater" type="push" body="$ ubimkvol /dev/ubi0 -Nrootfs -m"/>
  <CMD state="Updater" type="push" body="$ mkdir -p /mnt/mtd3"/>
  <CMD state="Updater" type="push" body="$ mount -t ubifs ubi0:rootfs /mnt/mtd3"/>
  <CMD state="Updater" type="push" body="pipe tar -jxv -C /mnt/mtd3" 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/mtd3">Unmounting rootfs partition</CMD>

  <CMD state="Updater" type="push" body="$ echo Update Complete!">Done</CMD>
  </LIST>

Jumping to OS image 之前我們需要的 file 如下

  • <MFGTOOL_DIR>/Profiles/Linux/OS Firmware/firmware/u-boot-imx6ulevk_nand.imx
  • <MFGTOOL_DIR>/Profiles/Linux/OS Firmware/firmware/zImage
  • <MFGTOOL_DIR>/Profiles/Linux/OS Firmware/firmware/fsl-image-mfgtool-initramfs-imx_mfgtools.cpio.gz.u-boot
  • <MFGTOOL_DIR>/Profiles/Linux/OS Firmware/firmware/zImage-imx6ul-14x14-evk-gpmi-weim.dtb

Jumping to OS image 之後我們需要的 file 如下

  • <MFGTOOL_DIR>/Profiles/Linux/OS Firmware/files/u-boot-imx6ulevk_nand.imx
  • <MFGTOOL_DIR>/Profiles/Linux/OS Firmware/files/zImage
  • <MFGTOOL_DIR>/Profiles/Linux/OS Firmware/files/zImage-imx6ul-14x14-evk-gpmi-weim.dtb
  • <MFGTOOL_DIR>/Profiles/Linux/OS Firmware/files/rootfs_nogpu.tar.bz2

我們需要置換的就是 Jumping to OS image 之後需要的 file

我們說 <BUILD_DIR> 是 build image 時所在的目錄

  • M300/fsl-release-bsp/build_small/

使用 bitbake core-image-minimal build 出的 image 在 <BUILD_DIR>\tmp\deploy\images\imx6ulevk

  • u-boot.imx
  • zImage
  • zImage-imx6ul-14x14-evk.dtb
  • core-image-minimal-imx6ulevk-20160713031508.rootfs.tar.bz2

理論上就是用這四個 file 置換掉 <MFGTOOL_DIR>/Profiles/Linux/OS Firmware/files/ 下相對應的 file 就搞定了

等到板子回來就先驗證這個步驟對不對

啥 flash partition 和 mtdpart 參數就等這一步過了再說吧

1545

rayson 的 nelson 致電表示待會會來我們公司拿一串燈回去

1600

剛剛和 eric 一起跟 nelson 交換一下 聖誕燈串 的情報

  • 控制器(realtek solution) coding rayson 自己做
  • 手機 APP rayson 自己做
  • 因為 moto mesh 的授權跟目前的硬體平台綁在一起所以沒打算(沒辦法)換成 AMEBA
  • 軟體就 nelson 和另外一人負責 APP

1610

How-To use NAND boot on i.MX6UL EVK board 還有提供修改過的 mx6ul_14x14_evk.h

來研究一下 mx6ul_14x14_evk.h 好了

來看看修改過的 mx6ul_14x14_evk.h 裡到底修改了啥

  • CONFIG_SYS_MEMTEST_END - End addresses of the area used by the simple memory test
    • 參考 README
    • CONFIG_SYS_MEMTEST_START, CONFIG_SYS_MEMTEST_END
    • Begin and End addresses of the area used by the simple memory test.
  • CONFIG_ENV_OFFSET
    • 參考 README
    • Offset of environment data (variable area) to the beginning of flash memory;
      for instance, with bottom boot type flash chips the second sector can be used:
      the offset for this sector is given here.
    • CONFIG_ENV_OFFSET is used relative to CONFIG_SYS_FLASH_BASE.

感覺維持原來的 mx6ul_14x14_evk.h 也沒啥大不了的

⚠️ **GitHub.com Fallback** ⚠️