IOT-GATE-iMX7 and SBC-IOT-iMX7: Linux: Manual Installation: Micro SD
Instoduction
This article provides an introduction on how to install the Linux kernel and the example root filesystem image for the IOT-GATE-iMX7 Internet of Things Gateway or CompuLab SBC-IOT-iMX7 Internet of Things Single Board Computer onto removable micro SD card using Linux host machine.
Preparation steps
- Obtain a Linux PC workstation with a USB port.
- Download the Linux package for IOT-GATE-iMX7 and SBC-IOT-iMX7 from CompuLab website. Use either IOT-GATE-iMX7 or SBC-IOT-iMX7 product web page for downloading. Unzip the package to a directory on your host workstation. The following discussion uses /path/to/cl-som-imx7-linux/ template for this location. Please use the real path to the Linux package instead.
- All image files mentioned below can be found in the images subdirectory.
- Obtain a micro SD card. Any commercially available micro SD card of 1GB (or larger) may be used.
- Obtain a USB Card reader with micro SD card slot or use microSD-to-SD adapter.
Install Linux Images
- Plug the USB SD Card reader to a host Linux PC. Insert the micro SD Card into the USB Card reader. The following discussion assumes the device name of the micro SD card on your Linux PC is /dev/sdc Please use the actual device name instead.
- Depending on the desktop system setup, following steps might require super user privileges.
- Unmount micro SD card partitions:
umount -l /dev/sdc*
- Clean up the on the micro SD card:
dd if=/dev/zero of=/dev/sdc bs=1M count=1 hdparm -z /dev/sdc
- Create two partitions for the Linux kernel (FAT32 100M) and root file system (EXT4 the rest of the disk) on the micro SD card:
echo -e "n\np\n1\n\n+100M\na\n1\nt\nc\nn\np\n2\n\n\nw\neof\n" | fdisk /dev/sdc
- Format the first partition with FAT32 file system:
mkfs.vfat -n boot /dev/sdc1
- Format the second partition with EXT4 file system:
mkfs.ext4 -L rootfs /dev/sdc2
- Mount both partitions:
mkdir -p /media/boot && mount /dev/sdc1 /media/boot mkdir -p /media/rootfs && mount /dev/sdc2 /media/rootfs
- Copy zImage-cl-som-imx7 and imx7d-*imx7.dtb to the first (FAT) partition:
cp /path/to/cl-som-imx7-linux/images/zImage-cl-som-imx7 /path/to/cl-som-imx7-linux/images/imx7d-*.dtb /media/boot && sync
- Extract the content of rootfs.tar.bz2 onto the second partition:
tar --numeric-owner -xpf /path/to/cl-som-imx7-linux/images/rootfs.tar.bz2 -C /media/rootfs && sync
- Unmount both partitions:
umount /media/boot umount /media/rootfs
- Eject the micro SD card
eject /dev/sdc
- Remove the micro SD card from the SD card reader
After Installation
- Plug the installation media (micro MMC/SD card) to the microSD socket marked uSD on IOT-GATE-iMX7 front panel (slot P18 on the SBC-iMX7).
- Use the following U-Boot commands to configure removable micro SD card as the main storage for both Linux kernel and root filesystem images:
env default -a setenv bootdelay 3 setenv kernel zImage setenv loadaddr 0x80800000 setenv fdtfile imx7d-sbc-iot-imx7.dtb setenv fdtaddr 0x83000000 setenv mmcroot "/dev/mmcblk0p2 rootwait rw" setenv loadimage 'load mmc 0:1 ${loadaddr} ${kernel}' setenv loadfdt 'load mmc 0:1 ${fdtaddr} ${fdtfile}' setenv bootargs "console=ttymxc0,115200 root=${mmcroot}" setenv bootcmd 'run loadimage; run loadfdt; bootz ${loadaddr} - ${fdtaddr}'
- To save this configuration:
saveenv
- To boot Linux type:
run bootcmd