Introduction
This article provides an introduction on how to install Linux kernel and root filesystem image on the CompuLab CL-SOM-iMX7 System-on-Module / Computer-on-Module NAND flash using one of the following sources:
- SD card
- USB storage device
|
CL-SOM-iMX7 SoM offers two NAND size options: 128MB and 1GB. The example filesystem image provided by CL-SOM-iMX7 Linux Package is not designed for installation onto the 128MB NAND flash and will not fit that storage option. Customers who use 128MB NAND configuration are supposed to prepare their own filesystem customized for their application. The following discussion describes an installation procedure of the example root filesystem image onto 1GB NAND flash. This procedure is valid for 128MB NAND option if a proper sized filesystem is used.
|
Preparation steps
- Obtain a PC workstation with a serial communication port.
- For networked installation you need to install a TFTP server on the host PC. For Windows machines we recommend TFTPD32 included in the Linux package for CL-SOM-iMX7 (link below).
- Download the CL-SOM-iMX7 BSP binary from CompuLab website. Unzip the package to a directory on your host workstation.
- All image files mentioned below can be found in the install sub-directory.
- Connect the host PC to the SBC-iMX7 USB console connector (P7) with the USB cable supplied in the evaluation kit.
Preparing installation media
- Obtain an SD card or a USB storage.
- Create a first partition on it. The partition can be formatted either ext2/3/4 or FAT file system.
- Copy kernel.img, ramdisk.dtb, ramdisk.img, rootfs.tar.bz2, imx7d-*.dtb and zImage from the unzipped Linux package to the root directory on the first partition of the SD card.
Boot into the installation environment (ramdisk)
- Start terminal emulation software on your PC with the following serial port settings:
Baud Rate
|
Data Bits
|
Stop Bits
|
Parity
|
Flow Control
|
115200
|
8
|
1
|
none
|
none
|
- Plug the installation media into the SD socket (P9) or USB connector (P6) on the SBC-iMX7.
- Make sure no other removable media (e.g. USB storage) is plugged.
- Turn on the device. Press a key to prevent a possible autoboot and get into the U-Boot command prompt.
|
If the boot settings of your device are different than the default, you may need to press and hold Ctrl-C while turning the device on, in order to get command prompt.
|
- Use the following U-Boot commands to boot the installation environment from the installation SD card:
setenv ramdisk_addr 0x82000000; setenv fdtaddr 0x83000000
setenv bootargs 'root=/dev/ram0 rw ramdisk_size=16384 console=ttymxc0,115200 vram=16M'
mmc rescan
load mmc 0 ${loadaddr} kernel.img && load mmc 0 ${fdtaddr} ${fdtfile} && load mmc 0 ${ramdisk_addr} ramdisk.img
bootz ${loadaddr} ${ramdisk_addr} ${fdtaddr}
- Use the following U-Boot commands to boot the installation environment from the installation USB storage:-
setenv ramdisk_addr 0x82000000; setenv fdtaddr 0x83000000
setenv bootargs 'root=/dev/ram0 rw ramdisk_size=16384 console=ttymxc0,115200 vram=16M'
usb start
load usb 0 ${loadaddr} kernel.img && load usb 0 ${fdtaddr} ${fdtfile} && load usb 0 ${ramdisk_addr} ramdisk.img
bootz ${loadaddr} ${ramdisk_addr} ${fdtaddr}
Mount installation source
- Use the following mount command to mount the installation SD card.
root@cl-ramdisk:~# mkdir -p /media/install && mount /dev/mmcblk0p1 /media/install
- Use the following mount command to mount the installation USB storage.
root@cl-ramdisk:~# mkdir -p /media/install && mount /dev/sdа1 /media/install
Install Images
Install kernel image
root@cl-ramdisk:~# kernel_mtd=`grep "kernel" /proc/mtd | cut -d: -f1`
root@cl-ramdisk:~# flash_erase /dev/${kernel_mtd} 0 0
root@cl-ramdisk:~# nandwrite -p /dev/${kernel_mtd} /media/install/zImage
Install dtb
root@cl-ramdisk:~# dtb_mtd=`grep "dtb" /proc/mtd | cut -d: -f1`
root@cl-ramdisk:~# flash_erase /dev/${dtb_mtd} 0 0
root@cl-ramdisk:~# nandwrite -p /dev/${dtb_mtd} /media/install/imx7d-sbc-imx7.dtb
Install root filesystem
- Format the NAND flash root filesystem partition:
root@cl-ramdisk:~# mtd_num_rootfs=`grep "rootfs" /proc/mtd | cut -b 4`
root@cl-ramdisk:~# ubiformat --yes /dev/mtd${mtd_num_rootfs}
- Attach the NAND flash root filesystem partition:
root@cl-ramdisk:~# ubiattach -m ${mtd_num_rootfs} -d 0
- Create a ubi volume and name it rootfs:
root@cl-ramdisk:~# ubimkvol /dev/ubi0 -m -N rootfs
root@cl-ramdisk:~# mkdir -p /media/rootfs && mount -t ubifs ubi0:rootfs /media/rootfs
- Extract the content of rootfs.tar.bz2 onto the /media/rootfs:
root@cl-ramdisk:~# tar --numeric-owner -xvpf /media/install/rootfs.tar.bz2 -C /media/rootfs && sync
Unmount media
root@cl-ramdisk:~# umount /media/rootfs
- Detach the NAND flash root filesystem partition:
root@cl-ramdisk:~# ubidetach -d 0
- Unmount the installation media:
root@cl-ramdisk:~# umount /media/install/
After Installation
- Remove the installation media and reboot the device
- Press a key to prevent a possible autoboot and get into the U-Boot command prompt.
- Use the following U-Boot command to configure NAND as the main storage for both Linux kernel and root filesystem images:
setenv bootcmd 'run nandboot'
- To save this configuration:
saveenv
run bootcmd
See also