Difference between revisions of "CL-SOM-iMX7: Linux: Manual Installation"

From Compulab Mediawiki
Jump to: navigation, search
Line 1: Line 1:
 
== Introduction ==
 
== Introduction ==
This article provides an introduction on how to install the example root filesystem image on the CompuLab CL-SOM-iMX7 System-on-Module / Computer-on-Module eMMC internal storage device or removable MMC/SD card.
+
This article provides an introduction on how to install the Linux kernel and the example root filesystem image on the CompuLab CL-SOM-iMX7 System-on-Module / Computer-on-Module eMMC internal storage device or removable MMC/SD card.<br>
 
+
The following media can be used as a source for installation onto the eMMC internal storage device:
== Preparation steps ==
+
* [[CL-SOM-iMX7: Linux: Manual Installation: Source: SD|SD card]]
* Obtain a PC workstation with a serial communication port.
+
* [[CL-SOM-iMX7: Linux: Manual Installation: Source: USB|USB storage device]]
* For networked installation you need to install a TFTP server on the host PC. For Windows machines we recommend [http://tftpd32.jounin.net/ TFTPD32] included in the Linux package for CL-SOM-iMX7 (link below).
+
* [[CL-SOM-iMX7: Linux: Manual Installation: Source: Network|Network interface]]
* Download the Linux package for CL-SOM-iMX7 from [http://www.compulab.com/products/computer-on-modules/cl-som-imx7-freescale-i-mx-7-system-on-module/#devres CompuLab website]. Unzip the package to a directory on your host workstation.
+
Additionally, Linux images can be installed onto removable SD card using [[CL-SOM-iMX7: Linux: Manual Installation: SD|Linux host machine]].
* All image files mentioned below can be found in the {{filename|images}} subdirectory.
 
* Connect the host PC to the SBC-iMX7 base-board (connector P8) via the serial cable supplied with the evaluation kit.
 
* Start terminal emulation software on your PC with the following serial port settings:
 
<blockquote>
 
{{:SB-SOM: serial port parameters table}}
 
</blockquote>
 
* Turn on the CL-SOM-iMX7 evaluation system. The U-Boot boot-loader will start and you will get a command prompt.
 
*: {{Note|If the boot settings of your CL-SOM-iMX7 are different than the default, you may need to press and hold '''Ctrl-C''' while turning the CL-SOM-iMX7 on, in order to get command prompt.}}
 
 
 
== Boot into the installation environment (ramdisk) ==
 
The first step in CL-SOM-iMX7 Linux installation is starting the installation environment (Linux kernel and Ramdisk image).
 
This can be done using the following media:
 
* [[#Using installation environment on MMC/SD card|MMC/SD card]]
 
* [[#Using installation environment on USB storage|USB storage device]]
 
* [[#Using installation environment from TFTP server|Network TFTP server]]
 
 
 
=== Using installation environment on MMC/SD card ===
 
* Copy {{filename|'''kernel.img'''}}, {{filename|'''ramdisk.dtb'''}}, {{filename|'''ramdisk.img'''}}, {{filename|'''rootfs.tar.bz2'''}}, {{filename|'''imx7d-*.dtb'''}} and {{filename|'''zImage-cl-som-imx7'''}} from [http://www.compulab.com/products/computer-on-modules/cl-som-imx7-freescale-i-mx-7-system-on-module/#devres Linux package for CL-SOM-iMX7] to the root directory on the first partition of the MMC/SD card. The partition can be formatted either ext2/3/4 or FAT file system.
 
* Insert the MMC/SD card into the SD socket (P9) on the SBC-iMX7.
 
* Use the following U-Boot commands to boot the installation environment on the CL-SOM-iMX7 evaluation system:
 
<pre>
 
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 # mmc rescan
 
CL-SOM-iMX7 # load mmc 0 ${loadaddr} kernel.img && load mmc 0 ${fdt_addr} ${fdt_file} && load mmc 0 ${ramdisk_addr} ramdisk.img
 
CL-SOM-iMX7 # bootz ${loadaddr} ${ramdisk_addr} ${fdt_addr}
 
</pre>
 
* Continue to the [[#Install Linux Images | Install Linux Images]] section.
 
 
 
=== Using installation environment on USB storage ===
 
* Copy {{filename|'''kernel.img'''}}, {{filename|'''ramdisk.dtb'''}}, {{filename|'''ramdisk.img'''}}, {{filename|'''rootfs.tar.bz2'''}}, {{filename|'''imx7d-*.dtb'''}} and {{filename|'''zImage-cl-som-imx7'''}} from [http://www.compulab.com/products/computer-on-modules/cl-som-imx7-freescale-i-mx-7-system-on-module/#devres Linux package for CL-SOM-iMX7] to the root directory on the first partition of the USB storage. The partition can be formatted either ext2/3/4 or FAT file system.
 
* Plug the USB storage to either port on the dual USB host connector P6 of the SBC-iMX7.
 
{{Note|SBC-iMX7 jumper {{parameter|E7}} must be open}}
 
* Use the following U-Boot commands to boot the installation environment on a CL-SOM-iMX7 evaluation system:
 
<pre>
 
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>
 
* Continue to the [[#Install Linux Images | Install Linux Images]] section.
 
 
 
=== Using installation environment from TFTP server ===
 
* Connect the CL-SOM-iMX7 Ethernet port (connector P21 on the SBC-iMX7) to your local network.
 
* Put {{filename|'''kernel.img'''}}, {{filename|'''ramdisk.dtb'''}} and {{filename|'''ramdisk.img'''}} from [http://www.compulab.com/products/computer-on-modules/cl-som-imx7-freescale-i-mx-7-system-on-module/#devres Linux package for CL-SOM-iMX7] 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 {{filename|/tftpboot}} or {{filename|/tftproot}}.
 
* You can use U-Boot {{cmd|dhcp}} command to obtain an IP address or manually set {{parameter|ipaddr}} environment variable:
 
<pre>
 
CL-SOM-iMX7 # setenv ipaddr <CL-SOM-iMX7 ip address>
 
</pre>
 
* Set the {{parameter|serverip}} environment variable:
 
<pre>
 
CL-SOM-iMX7 # setenv serverip <tftp server host ip address>
 
</pre>
 
* Use the following U-Boot commands to boot Linux on CL-SOM-iMX7:
 
<pre>
 
CL-SOM-iMX7 # env default -a
 
CL-SOM-iMX7 # setenv loadaddr 0x80800000
 
CL-SOM-iMX7 # setenv fdt_addr 0x83000000
 
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 ip=dhcp vram=16M'
 
CL-SOM-iMX7 # tftpboot ${loadaddr} kernel.img && tftpboot ${fdt_addr} ${fdt_file} && tftpboot ${ramdisk_addr} ramdisk.img
 
CL-SOM-iMX7 # bootz ${loadaddr} ${ramdisk_addr} ${fdt_addr}
 
</pre>
 
* Continue to the [[#Install Linux Images | Install Linux Images]] section.
 
 
 
== Install Linux Images ==
 
The next step is installing the kernel and Debian Linux images. The following media can be used as a source for installation:
 
* [[#Mount an MMC/SD Card|MMC/SD Card]]
 
* [[#Mount a USB Storage Device|USB storage device]]
 
* [[#Mount an NFS drive|NFS drive]]
 
 
 
=== Mount an MMC/SD Card ===
 
* The MMC/SD card is inserted into the SD socket (P9) on the SBC-iMX7 and it's mounted automatically under {{filename|/media/mmcblk0p'''X'''}}. Where '''X''' is the partition number.
 
* If for some reason the MMC/SD card hasn't been mounted automatically, use the following mount command:
 
<pre>
 
root@cl-ramdisk:~# mkdir -p /media/mmcblk0pX && mount /dev/mmcblk0pX /media/mmcblk0pX
 
</pre>
 
* Continue to the [[#Install Images | Install Images]] section.
 
 
 
=== Mount a USB Storage Device ===
 
* The USB storage device is plugged to the dual USB host connector P6 of the SBC-iMX7 and it is mounted automatically under {{filename|/media/sd{{parameter|XY}}}}. Where {{parameter|X}} is the device letter and {{parameter|Y}} is the partition number.
 
* If for some reason the USB storage device hasn't been mounted automatically, use the following mount command:
 
<pre>
 
root@cl-ramdisk:~# mkdir -p /media/sdXY && mount /dev/sdXY /media/sdXY
 
</pre>
 
* Continue to the [[#Install Images | Install Images]] section.
 
 
 
=== Mount an NFS drive ===
 
* Connect the CL-SOM-iMX7 Ethernet port (connector P21 on the SBC-iMX7) to your local network.
 
* Copy the {{filename|'''rootfs.tar.bz2'''}}, {{filename|'''imx7d-*.dtb'''}} and the {{filename|'''zImage-cl-som-imx7'''}} from the [http://www.compulab.com/products/computer-on-modules/cl-som-imx7-freescale-i-mx-7-system-on-module/#devres Linux package for CL-SOM-iMX7] to a directory exported through NFS.
 
* Obtain an IP address for the CL-SOM-iMX7:
 
** Using DHCP:<pre>root@cl-ramdisk:~# ifup eth0</pre>
 
** If you do not have a DHCP server, you can set a static IP address using {{cmd|ifconfig}}:<pre>root@cl-ramdisk:~# ifconfig eth0 <ip address></pre>
 
* Mount the NFS share:
 
<pre>
 
root@cl-ramdisk:~# mount -o nolock <host ip>:/path/to/nfs/share /mnt/net
 
</pre>
 
* Continue to [[#Install Images | Install Images]] section.
 
 
 
=== Install Images ===
 
* In this subsection the term {{filename|/mount/point}} can be:
 
** {{filename|/mnt/net}} if NFS is used
 
** {{filename|/media/mmcblk0pX}} if an MMC/SD card is used, where X is the partition number.
 
** {{filename|/media/sdXY}} if USB storage is used, where X is the USB drive letter and Y is the partition number.
 
Once the ramdisk image is loaded and the media containing the CL-SOM-iMX7 Kernel and Debian Linux images is mounted, the installation can be done on:
 
* [[#Install on MMC/SD or eMMC|MMC/SD or eMMC]]
 
==== Install on MMC/SD or eMMC ====
 
{{Note|The below procedure will work on an empty MMC device only.<br>If you have already used the MMC device, please delete all the partitions before proceeding.}}
 
* Define an environment variable that describes an MMC/SD device:
 
'''MMC/SD'''
 
<pre>
 
root@cl-ramdisk:~# export TARGET_DEVICE=mmcblk0
 
</pre>
 
'''eMMC'''
 
<pre>
 
root@cl-ramdisk:~# export TARGET_DEVICE=mmcblk2
 
</pre>
 
* Unmount all '''TARGET_DEVICE''' partitions:
 
<pre>
 
root@cl-ramdisk:~# umount -l /dev/${TARGET_DEVICE}p*
 
</pre>
 
* Clean up the on the '''TARGET_DEVICE''':
 
<pre>
 
root@cl-ramdisk:~# dd if=/dev/zero of=/dev/${TARGET_DEVICE} bs=1M count=1
 
root@cl-ramdisk:~# hdparm -z /dev/${TARGET_DEVICE}
 
</pre>
 
* Create two partitions for the Linux kernel (FAT32 100M) and root file system (EXT4 the rest of the disk) on the MMC device:
 
<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/${TARGET_DEVICE}
 
</pre>
 
* Adjust the '''TARGET_DEVICE''' name:
 
<pre>
 
root@cl-ramdisk:~# TARGET_DEVICE=$(awk -v device=${TARGET_DEVICE} 'BEGIN {if (device~/mmc/) {part="p"}; print device part}')
 
</pre>
 
* Format the first partition with FAT32 file system:
 
<pre>
 
root@cl-ramdisk:~# mkfs.vfat -n boot /dev/${TARGET_DEVICE}1
 
</pre>
 
* Format the second partition with EXT4 file system:
 
<pre>
 
root@cl-ramdisk:~# mkfs.ext4 -L rootfs /dev/${TARGET_DEVICE}2
 
</pre>
 
* Mount both partitions:
 
<pre>
 
root@cl-ramdisk:~# mkdir -p /media/boot && mount /dev/${TARGET_DEVICE}1 /media/boot
 
root@cl-ramdisk:~# mkdir -p /media/rootfs && mount /dev/${TARGET_DEVICE}2 /media/rootfs
 
</pre>
 
* Copy {{filename|zImage-cl-som-imx7}} and {{filename|imx7d-sbc-imx7.dtb}} to the first (FAT) partition:
 
<pre>
 
root@cl-ramdisk:~# cp /mount/point/zImage-cl-som-imx7 /mount/point/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 /mount/point/rootfs.tar.bz2 -C /media/rootfs && sync
 
</pre>
 
* Unmount both partitions:
 
<pre>
 
root@cl-ramdisk:~# umount /dev/${TARGET_DEVICE}1
 
root@cl-ramdisk:~# umount /dev/${TARGET_DEVICE}2
 
</pre>
 
* Continue to the [[#After Installation | After Installation]] section.
 
 
 
== After Installation ==
 
 
 
=== Boot Environment ===
 
Turn on the CL-SOM-iMX7 evaluation system to start U-Boot bootloader and get a command prompt.
 
{{Note|If the boot settings of the CL-SOM-iMX7 are different than default, you may need to press and hold '''Ctrl-C''' while turning the CL-SOM-iMX7 on, in order to get command prompt.}}
 
 
 
==== Common Environment Variables ====
 
<pre>
 
CL-SOM-iMX7 # setenv bootdelay 3
 
CL-SOM-iMX7 # setenv image zImage-cl-som-imx7
 
CL-SOM-iMX7 # setenv loadaddr 0x80800000
 
CL-SOM-iMX7 # setenv fdt_file imx7d-sbc-imx7.dtb
 
CL-SOM-iMX7 # setenv fdt_addr 0x83000000
 
</pre>
 
 
 
==== Configuration Dependent Environment Variables ====
 
===== Display options =====
 
SBC-iMX7 has an option to connect either an LCD or a DVI display.<br>
 
 
 
Below are examples that show how to change the boot environment in order to set the correct interface timing and geometry and work with either an LCD or a DVI display separately.
 
 
 
* DVI display enable function:
 
<pre>
 
CL-SOM-iMX7 # setenv set_display 'fdt addr ${fdt_addr}; fdt rm lcdif/display/display-timings/lcd'
 
</pre>
 
* LCD display enable function:
 
<pre>
 
CL-SOM-iMX7 # setenv set_display 'fdt addr ${fdt_addr}; fdt rm lcdif/display/display-timings/dvi'
 
</pre>
 
 
 
===== MMC/SD or eMMC =====
 
* {{parameter|mmcdev}} environment variable:
 
'''MMC'''
 
<pre>
 
CL-SOM-iMX7 # setenv mmcdev 0
 
CL-SOM-iMX7 # setenv mmcblk 0
 
</pre>
 
'''eMMC'''
 
<pre>
 
CL-SOM-iMX7 # setenv mmcdev 1
 
CL-SOM-iMX7 # setenv mmcblk 2
 
</pre>
 
* {{parameter|mmcroot}} environment variable:
 
<pre>
 
CL-SOM-iMX7 # setenv mmcroot "/dev/mmcblk${mmcblk}p2 rootwait rw"
 
</pre>
 
* Kernel and device tree loaders:
 
<pre>
 
CL-SOM-iMX7 # setenv loadimage 'load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}'
 
CL-SOM-iMX7 # setenv loadfdt 'load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}'
 
</pre>
 
* {{parameter|bootargs}} environment variable:
 
<pre>
 
CL-SOM-iMX7 # setenv bootargs "console=ttymxc0,115200 root=${mmcroot}"
 
</pre>
 
 
 
==== Boot command ====
 
* Default boot command:
 
<pre>
 
CL-SOM-iMX7 # setenv bootcmd 'run loadimage; run loadfdt; run set_display; bootz ${loadaddr} - ${fdt_addr}'
 
</pre>
 
* To boot Linux, type:
 
<pre>
 
CL-SOM-iMX7 # saveenv
 
CL-SOM-iMX7 # run bootcmd
 
</pre>
 
  
 
== See also ==
 
== See also ==
* [[CL-SOM-iMX7: Evaluation Kit: Getting Started]]
 
* [[CL-SOM-iMX7: Evaluation Kit: Hardware Guide]]
 
 
* [[CL-SOM-iMX7: Linux: Automatic Installation]]
 
* [[CL-SOM-iMX7: Linux: Automatic Installation]]
* [[CL-SOM-iMX7: Linux: Debian]]
+
* [[CL-SOM-iMX7: Linux: Package contents]]
* [[CL-SOM-iMX7: Linux: Kernel]]
 
* [[Linux Development for ARM modules]]
 
  
 
[[Category:Linux]]
 
[[Category:Linux]]
 
[[Category:CL-SOM-iMX7]]
 
[[Category:CL-SOM-iMX7]]

Revision as of 10:32, 24 April 2017

Introduction

This article provides an introduction on how to install the Linux kernel and the example root filesystem image on the CompuLab CL-SOM-iMX7 System-on-Module / Computer-on-Module eMMC internal storage device or removable MMC/SD card.
The following media can be used as a source for installation onto the eMMC internal storage device:

Additionally, Linux images can be installed onto removable SD card using Linux host machine.

See also