User Tools

Site Tools


Sidebar

do_gentoo_on_usd_for_iot-gate-imx7
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

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
  • 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.dtb: Device Tree Blob version 17, size=38270, boot CPU=0, string block size=2330, DT structure block size=35884
  • imx7d-sbc-imx7-csi.dtb: Device Tree Blob version 17, size=43079, boot CPU=0, string block size=2679, DT structure block size=40344
  • imx7d-sbc-imx7-lvds.dtb: Device Tree Blob version 17, size=42667, boot CPU=0, string block size=2667, DT structure block size=39944
  • imx7d-sbc-imx7-m4.dtb: Device Tree Blob version 17, size=41964, boot CPU=0, string block size=2600, DT structure block size=39308
  • imx7d-sbc-imx7.dtb: Device Tree Blob version 17, size=41848, boot CPU=0, string block size=2580, DT structure block size=39212
  • imx7d-sbc-iot-imx7-can.dtb: Device Tree Blob version 17, size=42078, boot CPU=0, string block size=2542, DT structure block size=39480
  • imx7d-sbc-iot-imx7.dtb: Device Tree Blob version 17, size=41978, boot CPU=0, string block size=2542, DT structure block size=39380
  • imx7d-sbc-ucm-imx7.dtb: Device Tree Blob version 17, size=41205, boot CPU=0, string block size=2565, DT structure block size=38584
  • imx7d-ucm-imx7.dtb: Device Tree Blob version 17, size=37249, boot CPU=0, string block size=2277, DT structure block size=34916
  • install.ext2: Linux rev 1.0 ext2 filesystem data, UUID=dba7e302-51ee-45c2-a182-25674c4846dc, volume name “installer.imx7”
  • kernel.img: Linux kernel ARM boot executable zImage (little-endian)
  • ramdisk.img: u-boot legacy uImage, , Linux/ARM, RAMDisk Image (gzip), 6561285 bytes, Sun Aug 20 14:26:44 2017, Load Address: 0x00000000, Entry Point: 0x00000000, Header CRC: 0x804BB927, Data CRC: 0x4472DA7C
  • rootfs.tar.bz2: bzip2 compressed data, block size = 900k
  • 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
do_gentoo_on_usd_for_iot-gate-imx7.txt · Last modified: 2017/11/21 17:49 by admin