Difference between revisions of "IOT-GATE-iMX7 and SBC-IOT-iMX7: Linux: Manual Installation: Source: USB"

From Compulab Mediawiki
Jump to: navigation, search
(After Installation)
 
 
(One intermediate revision by one other user not shown)
Line 8: Line 8:
 
* Obtain a USB storage device of 1GB or larger .
 
* Obtain a USB storage device of 1GB or larger .
 
* Create a first partition on it. The partition can be formatted either ext2/3/4 or FAT file system.
 
* Create a first partition on it. The partition can be formatted either ext2/3/4 or FAT file system.
*  Copy {{filename|'''kernel.img'''}}, {{filename|'''ramdisk.dtb'''}}, {{filename|'''ramdisk.img'''}}, {{filename|'''rootfs.tar.bz2'''}}, {{filename|'''imx7d-*.dtb'''}} and {{filename|'''zImage-cl-som-imx7'''}} from the unzipped Linux package to the root directory on the first partition of the USB storage.
+
*  Copy {{filename|kernel.img}}, {{filename|ramdisk.dtb}}, {{filename|ramdisk.img}}, {{filename|rootfs.tar.bz2}}, {{filename|imx7d-*.dtb}} and {{filename|zImage}} from the unzipped Linux package to the root directory on the first partition of the USB storage.
  
 
== Boot into the installation environment (ramdisk) ==
 
== Boot into the installation environment (ramdisk) ==
Line 20: Line 20:
 
*: {{Note|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.}}
 
*: {{Note|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 on the device:
 
* Use the following U-Boot commands to boot the installation environment on the device:
<pre>
+
{{:Transclusion: CL-SOM-iMX7: Linux: Manual Installation: Boot: USB}}
CL-SOM-iMX7 # env default -a
 
CL-SOM-iMX7 # setenv fdt_file ramdisk.dtb
 
CL-SOM-iMX7 # setenv ramdisk_addr 0x82000000
 
CL-SOM-iMX7 # setenv bootargs 'root=/dev/ram0 rw ramdisk_size=16384 console=ttymxc0,115200 vram=16M'
 
CL-SOM-iMX7 # usb start
 
CL-SOM-iMX7 # load usb 0 ${loadaddr} kernel.img && load usb 0 ${fdt_addr} ${fdt_file} && load usb 0 ${ramdisk_addr} ramdisk.img
 
CL-SOM-iMX7 # bootz ${loadaddr} ${ramdisk_addr} ${fdt_addr}
 
</pre>
 
  
 
== Install Linux Images ==
 
== Install Linux Images ==
Line 34: Line 26:
  
 
=== Mount the USB Storage Device ===
 
=== Mount the USB Storage Device ===
* The source USB storage device is mounted automatically under {{filename|/media/sda1/}}.
+
Use the following command to mount the installation USB storage:
* If for some reason the USB storage device hasn't been mounted automatically, use the following mount command:
 
 
<pre>
 
<pre>
root@cl-ramdisk:~# mkdir -p /media/sda1 && mount /dev/sda1 /media/sda1
+
root@cl-ramdisk:~# mount /dev/sda1 /mnt/install
 
</pre>
 
</pre>
  
 
=== Install Images on eMMC ===
 
=== Install Images on eMMC ===
* Unmount all eMMC partitions:
+
{{:Transclusion: CL-SOM-iMX7: Linux: Manual Installation: Install Images}}
<pre>
 
root@cl-ramdisk:~# umount -l /dev/mmcblk2p*
 
</pre>
 
* Clean up the on the eMMC flash:
 
<pre>
 
root@cl-ramdisk:~# dd if=/dev/zero of=/dev/mmcblk2 bs=1M count=1
 
root@cl-ramdisk:~# hdparm -z /dev/mmcblk2
 
</pre>
 
* Create two partitions for the Linux kernel (FAT32 100M) and root file system (EXT4 the rest of the disk) on the eMMC flash:
 
<pre>
 
root@cl-ramdisk:~# echo -e "n\np\n1\n\n+100M\na\n1\nt\nc\nn\np\n2\n\n\nw\neof\n" | fdisk /dev/mmcblk2
 
</pre>
 
* Format the first partition with FAT32 file system:
 
<pre>
 
root@cl-ramdisk:~# mkfs.vfat -n boot /dev/mmcblk2p1
 
</pre>
 
* Format the second partition with EXT4 file system:
 
<pre>
 
root@cl-ramdisk:~# mkfs.ext4 -L rootfs /dev/mmcblk2p2
 
</pre>
 
* Mount both partitions:
 
<pre>
 
root@cl-ramdisk:~# mkdir -p /media/boot && mount /dev/mmcblk2p1 /media/boot
 
root@cl-ramdisk:~# mkdir -p /media/rootfs && mount /dev/mmcblk2p2 /media/rootfs
 
</pre>
 
* Copy {{filename|zImage-cl-som-imx7}} and {{filename|imx7d-*imx7.dtb}} to the first (FAT) partition:
 
<pre>
 
root@cl-ramdisk:~# cp /media/sda1/zImage-cl-som-imx7 /media/sda1/imx7d-*.dtb /media/boot && sync
 
</pre>
 
* Extract the content of {{filename|rootfs.tar.bz2}} onto the second partition:
 
<pre>
 
root@cl-ramdisk:~# tar --numeric-owner -xpf /media/sda1/rootfs.tar.bz2 -C /media/rootfs && sync
 
</pre>
 
* Unmount both partitions:
 
<pre>
 
root@cl-ramdisk:~# umount /dev/mmcblk2p1
 
root@cl-ramdisk:~# umount /dev/mmcblk2p2
 
</pre>
 
  
 
== After Installation ==
 
== After Installation ==

Latest revision as of 07:35, 27 March 2018

Introduction

This article provides an introduction on how to install the Linux kernel and the example root filesystem image on the IOT-GATE-iMX7 Internet of Things Gateway or CompuLab SBC-IOT-iMX7 Internet of Things Single Board Computer eMMC internal storage device using USB storage device as the installation source.

Preparation steps

  • Obtain a PC workstation with a USB 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 (link below) under the utilities subdirectory.
  • Download the BSP binary 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.
  • All image files mentioned below can be found in the install subdirectory.
  • Use the standard microUSB-to-USB cable to connect the host PC to the micro USB connector marked Console on IOT-GATE-iMX7 rear panel (connector P3 on SBC-IOT-iMX7).
  • Make sure the new /dev/ttyUSBx device file is created by using the ls /dev/ttyUSB* command. x is the last number of the ttyUSB device.

Preparing installation media

  • Obtain a USB storage device of 1GB or larger .
  • 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 USB storage.

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 (USB storage device) to a any USB port on the IOT-GATE-iMX7 front/rear panel (slots P10-P13 on the SBC-iMX7).
  • Make sure no other removable media (e.g. additional USB storage, micro SD) is plugged.
  • Turn on the device. Press a key to prevent a possible autoboot and get into the U-Boot command prompt.
Admolition note.png 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 on the device:
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}

Install Linux Images

The next step is installing the kernel and Debian Linux images.

Mount the USB Storage Device

Use the following command to mount the installation USB storage:

root@cl-ramdisk:~# mount /dev/sda1 /mnt/install

Install Images on eMMC

  • Unmount all eMMC partitions:
root@cl-ramdisk:~# umount -l /dev/mmcblk2p*
  • Clean up the on the eMMC flash:
root@cl-ramdisk:~# dd if=/dev/zero of=/dev/mmcblk2 bs=1M count=1
root@cl-ramdisk:~# hdparm -z /dev/mmcblk2
  • Create two partitions for the Linux kernel (EXT2 100M) and root file system (EXT4 the rest of the disk) on the eMMC flash:
root@cl-ramdisk:~# echo -e "n\np\n1\n\n+100M\nn\np\n2\n\n\nw\neof\n" | fdisk /dev/mmcblk2
  • Format the first partition with EXT2 file system:
root@cl-ramdisk:~# mkfs.ext2 -L boot /dev/mmcblk2p1
  • Format the second partition with EXT4 file system:
root@cl-ramdisk:~# mkfs.ext4 -L rootfs /dev/mmcblk2p2
  • Mount both partitions:
root@cl-ramdisk:~# mkdir -p /media/boot && mount /dev/mmcblk2p1 /media/boot
root@cl-ramdisk:~# mkdir -p /media/rootfs && mount /dev/mmcblk2p2 /media/rootfs
  • Copy zImage and imx7d-*imx7.dtb to the first (EXT2) partition:
root@cl-ramdisk:~# cp /mnt/install/zImage /mnt/install/imx7d-*.dtb /media/boot && sync
  • Extract the content of rootfs.tar.bz2 onto the second partition:
root@cl-ramdisk:~# tar --numeric-owner -xpf /mnt/install/rootfs.tar.bz2 -C /media/rootfs && sync
  • Unmount both partitions:
root@cl-ramdisk:~# umount /dev/mmcblk2p1
root@cl-ramdisk:~# umount /dev/mmcblk2p2

After Installation

  • Remove the USB storage 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 commands to configure eMMC 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/mmcblk2p2 rootwait rw"
setenv loadimage 'load mmc 1:1 ${loadaddr} ${kernel}'
setenv loadfdt 'load mmc 1: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

See also