Difference between revisions of "CL-SOM-iMX7: Linux: Manual Installation: Destination: NAND"
(→Install Images) |
imported>Uri.mashiach |
||
Line 44: | Line 44: | ||
=== Install kernel image === | === Install kernel image === | ||
<pre> | <pre> | ||
− | root@cl-ramdisk:~# flash_erase /dev/ | + | root@cl-ramdisk:~# kernel_mtd=`grep "kernel" /proc/mtd | cut -d: -f1` |
− | root@cl-ramdisk:~# nandwrite -p /dev/ | + | root@cl-ramdisk:~# flash_erase /dev/${kernel_mtd} 0 0 |
+ | root@cl-ramdisk:~# nandwrite -p /dev/${kernel_mtd} /media/install/zImage | ||
</pre> | </pre> | ||
=== Install dtb === | === Install dtb === | ||
<pre> | <pre> | ||
− | root@cl-ramdisk:~# flash_erase /dev/ | + | root@cl-ramdisk:~# dtb_mtd=`grep "dtb" /proc/mtd | cut -d: -f1` |
− | root@cl-ramdisk:~# nandwrite -p /dev/ | + | root@cl-ramdisk:~# flash_erase /dev/${dtb_mtd} 0 0 |
+ | root@cl-ramdisk:~# nandwrite -p /dev/${dtb_mtd} /media/install/imx7d-sbc-imx7.dtb | ||
</pre> | </pre> | ||
Line 57: | Line 59: | ||
* Format the NAND flash root filesystem partition: | * Format the NAND flash root filesystem partition: | ||
<pre> | <pre> | ||
− | root@cl-ramdisk:~# ubiformat --yes /dev/ | + | root@cl-ramdisk:~# mtd_num_rootfs=`grep "rootfs" /proc/mtd | cut -b 4` |
+ | root@cl-ramdisk:~# ubiformat --yes /dev/mtd${mtd_num_rootfs} | ||
</pre> | </pre> | ||
* Attach the NAND flash root filesystem partition: | * Attach the NAND flash root filesystem partition: | ||
<pre> | <pre> | ||
− | root@cl-ramdisk:~# ubiattach -m | + | root@cl-ramdisk:~# ubiattach -m ${mtd_num_rootfs} -d 0 |
</pre> | </pre> | ||
* Create a ubi volume and name it '''rootfs''': | * Create a ubi volume and name it '''rootfs''': |
Latest revision as of 15:02, 17 June 2019
Contents
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
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
For detailed NAND flash mapping, please check the Firmware Overview article. |
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
- Mount the ubi volume:
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
- Unmount the ubi volume:
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
- To boot Linux type:
run bootcmd