This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
do_gentoo_on_usd_for_iot-gate-imx7 [2017/11/04 23:47] admin |
do_gentoo_on_usd_for_iot-gate-imx7 [2017/11/21 17:49] (current) admin |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | == Parted == | ||
+ | parted /dev/sdX | ||
+ | mklabel msdos | ||
+ | mkpart primary fat32 2048s 150M | ||
+ | mkpart primary ext4 150M -1 | ||
+ | | ||
+ | mkfs.vfat -F 32 /dev/sdX1 | ||
+ | mkfs.ext4 -L root -m 0.1 /dev/sdX2 | ||
+ | |||
== Understand the firmware == | == Understand the firmware == | ||
When I open the folder **install/** into **cl-som-imx7-linux.zip**, I scan with ''file'' command to understand what I have, usually ARM hardware use uboot, then I hope uboot system + linux kernel + ramdisk. | When I open the folder **install/** into **cl-som-imx7-linux.zip**, I scan with ''file'' command to understand what I have, usually ARM hardware use uboot, then I hope uboot system + linux kernel + ramdisk. | ||
+ | |||
+ | I wish //gentoo// to have better 0-days hardened, but have to uSD card allow me debug the OS offline, save the data in all case. | ||
+ | |||
* boot.scr: u-boot legacy uImage, , Linux/ARM, Script File (Not compressed), 1086 bytes, Mon Aug 21 06:43:51 2017, Load Address: 0x00000000, Entry Point: 0x00000000, Header CRC: 0xF57D03AB, Data CRC: 0x289863A9 | * boot.scr: u-boot legacy uImage, , Linux/ARM, Script File (Not compressed), 1086 bytes, Mon Aug 21 06:43:51 2017, Load Address: 0x00000000, Entry Point: 0x00000000, Header CRC: 0xF57D03AB, Data CRC: 0x289863A9 | ||
* imx7d-cl-som-imx7-m4.dtb: Device Tree Blob version 17, size=38386, boot CPU=0, string block size=2350, DT structure block size=35980 | * imx7d-cl-som-imx7-m4.dtb: Device Tree Blob version 17, size=38386, boot CPU=0, string block size=2350, DT structure block size=35980 | ||
Line 17: | Line 29: | ||
* rootfs.tar.bz2: bzip2 compressed data, block size = 900k | * rootfs.tar.bz2: bzip2 compressed data, block size = 900k | ||
* zImage: Linux kernel ARM boot executable zImage (little-endian) | * zImage: Linux kernel ARM boot executable zImage (little-endian) | ||
+ | |||
+ | Into the boot scr decompiled I see: | ||
+ | setenv bootargs "root=/dev/ram0 rw ramdisk_size=16384 console=$tty vram=16M auto_install ${board_param}" | ||
+ | setenv ramimg ramdisk.img | ||
+ | load ${storagetype} ${storagedev} ${fdtaddr} ${fdtfile} | ||
+ | load ${storagetype} ${storagedev} ${loadaddr} ${kernel} | ||
+ | load ${storagetype} ${storagedev} ${rdaddr} ${ramimg} | ||
+ | |||
+ | Then it will be easy the boot the current kernel to uSD part to boot gentoo. | ||
+ | |||
+ | I do: | ||
+ | dd bs=1 skip=72 if=boot.scr of=boot.script | ||
+ | I change into: | ||
+ | #System for CL-SOM-iMX7 | ||
+ | | ||
+ | # Parameters | ||
+ | setenv tty "ttymxc0,115200" | ||
+ | setenv mmcdev 0 | ||
+ | setenv rdaddr 0x82000000 | ||
+ | setenv loadaddr 0x80800000 | ||
+ | setenv fdtaddr 0x83000000 | ||
+ | setenv fdt_high 0xffffffff | ||
+ | setenv initrd_high 0xffffffff | ||
+ | | ||
+ | test -z "$fdtfile" && setenv fdtfile $fdt_file | ||
+ | | ||
+ | setenv bootargs "root=/dev/mmcblk0p2 ro console=$tty vram=16M" | ||
+ | setenv kernel kernel.img | ||
+ | | ||
+ | test -z "$storagetype" && setenv storagetype mmc | ||
+ | test -z "$storagedev" && setenv storagedev ${mmcdev} | ||
+ | | ||
+ | # Script start | ||
+ | load ${storagetype} ${storagedev} ${fdtaddr} ${fdtfile} | ||
+ | load ${storagetype} ${storagedev} ${loadaddr} ${kernel} | ||
+ | echo "Starting uSD system ..." | ||
+ | bootz ${loadaddr} ${fdtaddr} | ||
+ | | ||
+ | After install the package **dev-embedded/u-boot-tools** I do: | ||
+ | mkimage -C none -A arm -T script -d boot.script boot.scr | ||
+ | |||
+ | After I do my ext4 part with rootfs.tar.bz2 content into my second uSD partition. Or other system keeping the **/lib/modules/** at the first time util I do my own kernel. FAT32 on first part with: | ||
+ | * boot.scr | ||
+ | * kernel.img | ||
+ | * imx7d-sbc-iot-imx7.dtb |