UCM-iMX7: Linux: Manual Installation: Source: Network

From Compulab Mediawiki
Revision as of 12:09, 19 June 2017 by Grinberg (talk | contribs) (See also)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

This article provides an introduction on how to install the Linux kernel and the example root filesystem image on the CompuLab UCM-iMX7 System-on-Module / Computer-on-Module 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 for UCM-iMX7 (link below).
  • Download the Linux package for UCM-iMX7 from CompuLab website. 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 P7 on SBC-UCM-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

  • Connect the Ethernet port (connector P21) to your local network using the standard Cat 5 LAN cable.
  • Make sure the dedicated TFTP server as well as NFS server (may be the same machine) are connected to the local network too.
  • Put kernel.img, ramdisk.img, imx7d-sbc-ucm-imx7.dtb from the unzipped Linux package to a location accessible by the TFTP server:
    - On Windows machine: copy files to the same folder and point the TFTP server to that folder
    - On Linux machine: copy files to the TFTP server root directory, usually /tftpboot or /tftproot.

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
  • Make sure no other removable media (e.g. micro SD card or USB storage) 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.
  • You can use U-Boot dhcp command to obtain an IP address or manually set ipaddr environment variable:
UCM-iMX7 # setenv ipaddr <device ip address>
  • Set the serverip environment variable:
UCM-iMX7 # setenv serverip <tftp server ip address>
  • Use the following U-Boot commands to boot the installation environment on the device:
UCM-iMX7 # setenv loadaddr 0x80800000
UCM-iMX7 # setenv fdt_addr 0x83000000
UCM-iMX7 # setenv fdt_file sbc-ucm-imx7.dtb
UCM-iMX7 # setenv ramdisk_addr 0x82000000
UCM-iMX7 # setenv bootargs 'root=/dev/ram0 rw ramdisk_size=16384 console=ttymxc0,115200 vram=16M'
UCM-iMX7 # tftpboot ${loadaddr} kernel.img && tftpboot ${fdt_addr} ${fdt_file} && tftpboot ${ramdisk_addr} ramdisk.img
UCM-iMX7 # bootz ${loadaddr} ${ramdisk_addr} ${fdt_addr}

Install Linux Images

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

Mount an NFS drive

  • Copy rootfs.tar.bz2, imx7d-*.dtb and the zImage from the unzipped Linux package to a directory exported through NFS.
  • Obtain an IP address for the device:
    • Using DHCP:
      root@cl-ramdisk:~# ifup eth0
    • If you do not have a DHCP server, you can set a static IP address using ifconfig:
      root@cl-ramdisk:~# ifconfig eth0 <ip address>
  • Mount the NFS share:
root@cl-ramdisk:~# mkdir -p /media/install && mount -o nolock <host ip>:/path/to/nfs/share /media/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/rootfs && mount /dev/mmcblk2p2 /media/rootfs
root@cl-ramdisk:~# mkdir -p /media/rootfs/boot && mount /dev/mmcblk2p1 /media/rootfs/boot
  • Extract the content of rootfs.tar.bz2:
root@cl-ramdisk:~# tar --numeric-owner -xpf /media/install/rootfs.tar.bz2 -C /media/rootfs && sync
  • Copy zImage and imx7d-*imx7.dtb to the first (EXT2) partition:
root@cl-ramdisk:~# cp /media/install/zImage /media/install/imx7d-*.dtb /media/rootfs/boot && sync
  • Unmount both partitions:
root@cl-ramdisk:~# umount /dev/mmcblk2p1
root@cl-ramdisk:~# umount /dev/mmcblk2p2

After Installation

  • Reboot the device.
  • Press a key to prevent a possible autoboot and get into the U-Boot command prompt.
  • The default U-Boot environment configuration falls back to boot from the internal storage eMMC if no proper images are found on a micro SD card.
  • Alternatively, you can 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-ucm-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:
boot

See also