Difference between revisions of "CM-FX6: Linux: Getting started"

From Compulab Mediawiki
Jump to: navigation, search
(See also)
 
(See also)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
== Introduction ==
 +
This article provides an introduction on how to install the Debian example root filesystem image on the CompuLab CM-FX6 System-on-Module / Computer-on-Module NAND or SSD.
 +
 
== Preparation steps ==
 
== Preparation steps ==
 
* Obtain a PC workstation with a serial communication port.
 
* 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 [http://tftpd32.jounin.net/ TFTPD32] included in the Linux package for CM-FX6 (link below).
 
* 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 CM-FX6 (link below).
 
* Download the Linux package for CM-FX6 from [http://compulab.co.il/products/computer-on-modules/cm-fx6/#devres CompuLab website]. Unzip the package to a directory on your host workstation.
 
* Download the Linux package for CM-FX6 from [http://compulab.co.il/products/computer-on-modules/cm-fx6/#devres CompuLab website]. Unzip the package to a directory on your host workstation.
* All image files mentioned below can be found in {{filename|images}} subdirectory.
+
* All image files mentioned below can be found in the {{filename|images}} subdirectory.
 
* Connect the host PC to the SB-FX6 base-board (connector P60) via the serial cable supplied with the evaluation kit.
 
* Connect the host PC to the SB-FX6 base-board (connector P60) via the serial cable supplied with the evaluation kit.
* Start terminal emulation software on your PC. Set baud rate to 115200 bps, 8 bit per frame, 1 stop bit, no parity, no flow control.
+
* Start the terminal emulation software on your PC. Set baud rate to 115200 bps, 8 bit per frame, 1 stop bit, no parity, no flow control.
 
* Turn on the CM-FX6 evaluation system. The U-Boot boot-loader will start and you will get a command prompt.
 
* Turn on the CM-FX6 evaluation system. The U-Boot boot-loader will start and you will get a command prompt.
*: {{Note|If the boot settings of your CM-FX6 are different than default, you may need to press and hold '''Ctrl-C''' while turning the CM-FX6 on, in order to get command prompt.}}
+
*: {{Note|If the boot settings of your CM-FX6 are different than the default, you may need to press and hold '''Ctrl-C''' while turning the CM-FX6 on, in order to get command prompt.}}
 +
 
 +
== Installation and Deployment Files ==
 +
=== Installation media or TFTP export directory ===
 +
* {{filename|'''kernel.img'''}}
 +
* {{filename|'''imx6q-sbc-fx6.dtb'''}}
 +
* {{filename|'''imx6dl-sbc-fx6.dtb'''}}
 +
* {{filename|'''ramdisk.img'''}}
 +
* {{filename|'''boot.scr'''}}
 +
 
 +
=== Installation media or NFS export directory ===
 +
* {{filename|'''rootfs.tar.bz2'''}}
 +
* {{filename|'''kernel.update.tar.bz2'''}}
  
 
== Boot into the installation environment (ramdisk) ==
 
== Boot into the installation environment (ramdisk) ==
Line 13: Line 28:
 
This can be done using the following media:
 
This can be done using the following media:
 
* [[#Using installation environment on MMC/SD card|MMC/SD card]]
 
* [[#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 from TFTP server|Network TFTP server]]
  
 
=== Using installation environment on MMC/SD card ===
 
=== Using installation environment on MMC/SD card ===
* Copy {{filename|kernel.img}}, {{filename|ramdisk.img}} and {{filename|bootscr.img}} from [http://compulab.co.il/products/computer-on-modules/cm-fx6/#devres Linux package for CM-FX6] to the root directory on the first partition of the MMC/SD card. Note, the partition must be FAT (16 or 32) formated.
+
* Copy files listed in [[#Installation and Deployment Files | Installation and Deployment Files]] from [http://compulab.co.il/products/computer-on-modules/cm-fx6/#devres Linux package for CM-FX6] to the root directory on the first partition of the media.
 +
The partition can be formatted as either ext2/3/4 or FAT file system.
 
* Insert the MMC/SD card into the SD socket (P6) on the SB-FX6.
 
* Insert the MMC/SD card into the SD socket (P6) on the SB-FX6.
* Use the following U-boot commands to boot the installation environment on the CM-FX6:
+
* Use the following U-boot commands to boot the installation environment on the CM-FX6 quad/dual lite configuration:
 +
<pre>
 +
CM-FX6 #
 +
</pre>
 +
<pre>
 +
setenv loadaddr 0x10800000
 +
mmc dev 2; mmc rescan
 +
load mmc 2 ${loadaddr} boot.scr
 +
source ${loadaddr}
 +
</pre>
 +
* Continue to the [[#Install Kernel and Root Files System Images | Install Kernel and Root Files System Images]] section.
 +
 
 +
=== Using installation environment on USB storage ===
 +
* Copy files listed in [[#Installation and Deployment Files | Installation and Deployment Files]] from [http://compulab.co.il/products/computer-on-modules/cm-fx6/#devres Linux package for CM-FX6] to the root directory on the first partition of the media.
 +
The partition can be formatted as either ext2/3/4 or FAT file system.
 +
* Insert the USB storage into a USB socket on the SB-FX6.
 +
* Use the following U-boot commands to boot the installation environment on a CM-FX6 quad/dual lite configuration:
 +
<pre>
 +
CM-FX6 #
 +
</pre>
 
<pre>
 
<pre>
CM-FX6 # mmc dev 2
+
setenv loadaddr 0x10800000
CM-FX6 # mmc rescan
+
usb start
CM-FX6 # fatload mmc 2:1 10700000 bootscr.img
+
load usb 0 ${loadaddr} boot.scr
CM-FX6 # source 10700000
+
source ${loadaddr}
 
</pre>
 
</pre>
* Continue to the [[#Install Kernel and Debian Linux Images | Install Kernel and Debian Linux Images]] section.
+
* Continue to the [[#Install Kernel and Root Files System Images | Install Kernel and Root Files System Images]] section.
  
 
=== Using installation environment from TFTP server ===
 
=== Using installation environment from TFTP server ===
 
* Connect the CM-FX6 Ethernet port (connector P9 marked as "CM ETHERNET" on the SB-FX6) to your local network.
 
* Connect the CM-FX6 Ethernet port (connector P9 marked as "CM ETHERNET" on the SB-FX6) to your local network.
* Put {{filename|kernel.img}} and {{filename|ramdisk.img}} from [http://compulab.co.il/products/computer-on-modules/cm-fx6/#devres Linux package for CM-FX6] to a location accessible by the TFTP server:
+
* Copy files listed in [[#Installation media or TFTT export directory | Installation media or TFTT export directory]] from [http://compulab.co.il/products/computer-on-modules/cm-fx6/#devres Linux package for CM-FX6] to a TFTP server export directory:
*: - On Windows machine: copy {{filename|kernel.img}} and {{filename|ramdisk.img}} to the same folder and point the TFTP server to that folder
+
*: - On Windows machine: copy files to the same folder and point the TFTP server to that folder
*: - On Linux machine: copy {{filename|kernel.img}} and {{filename|ramdisk.img}} to the TFTP server root directory, usually {{filename|/tftpboot}} or {{filename|/tftproot}}.
+
*: - 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 IP address or manually set {{parameter|ipaddr}} environment variable:
 
* You can use U-boot {{cmd|dhcp}} command to obtain IP address or manually set {{parameter|ipaddr}} environment variable:
 
<pre>
 
<pre>
Line 41: Line 77:
 
CM-FX6 # saveenv
 
CM-FX6 # saveenv
 
</pre>
 
</pre>
 +
* Set a correct value for the '''fdt_file''' variable:
 +
:* Quad
 +
<pre>CM-FX6 # setenv fdt_file imx6q-sbc-fx6.dtb
 +
</pre>
 +
:* Dual
 +
<pre>CM-FX6 # setenv fdt_file imx6dl-sbc-fx6.dtb
 +
</pre>
 +
 
* Use the following U-Boot commands to boot Linux on CM-FX6:
 
* Use the following U-Boot commands to boot Linux on CM-FX6:
 
<pre>
 
<pre>
CM-FX6 # setenv bootargs "root=/dev/ram0 ramdisk_size=16384 console=ttymxc3,115200"
+
CM-FX6 #
CM-FX6 # tftpboot 10800000 kernel.img && tftpboot 12000000 ramdisk.img
 
CM-FX6 # bootm 10800000 12000000
 
 
</pre>
 
</pre>
* Continue to the [[#Install Kernel and Debian Linux Images | Install Kernel and Debian Linux Images]] section.
+
<pre>
 +
setenv fdt_high 0xffffffff
 +
setenv fdt_addr 0x15000000
 +
setenv bootm_low 0x15000000
 +
setenv bootm_size 0x20000000
 +
setenv load_addr 0x10800000
 +
setenv ramdisk_addr 0x12000000
 +
setenv bootargs 'root=/dev/ram0 rw ramdisk_size=16384 console=ttymxc3,115200 ip=dhcp'
 +
tftpboot ${load_addr} kernel.img && tftpboot ${fdt_addr} ${fdt_file} && tftpboot ${ramdisk_addr} ramdisk.img
 +
bootz ${load_addr} ${ramdisk_addr} ${fdt_addr}
 +
</pre>
 +
* Continue to the [[#Install Kernel and Root Files System Images | Install Kernel and Root Files System Images]] section.
  
== Install Kernel and Debian Linux Images ==
+
== Install Kernel and Root Files System Images ==
After the ramdisk image is loaded the Linux login prompt will appear. Login as {{parameter|root}} into the system. Use {{parameter|111111}} password for login:
+
After the ramdisk image is loaded the '''bash''' shell prompt shows up:
 
<pre>
 
<pre>
compulab login: root
+
root@cl-ramdisk:/#
Password: 111111
 
 
</pre>
 
</pre>
 
The next step is installing the kernel and Debian Linux images. The following media can be used as a source for installation:
 
The next step is installing the kernel and Debian Linux images. The following media can be used as a source for installation:
 
* [[#Mount the MMC/SD Card|MMC/SD Card]]
 
* [[#Mount the MMC/SD Card|MMC/SD Card]]
 
* [[#Mount a USB Storage Device|USB storage device]]
 
* [[#Mount a USB Storage Device|USB storage device]]
* [[#Mount the NFS drive|NFS drive]]
+
* [[#Mount an NFS drive|NFS drive]]
  
=== Mount an MMC/SD Card ===
+
=== Mount MMC/SD Card ===
* Copy the {{filename|debian-image.ubi}}, the {{filename|debian-image.tar.bz2}}, and the {{filename|uImage-cm-fx6}} from the [http://compulab.co.il/products/computer-on-modules/cm-fx6/#devres Linux package for CM-FX6] to the root directory of any partition on 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 (P6) on the SB-FX6.
 
* Insert the MMC/SD card into the SD socket (P6) on the SB-FX6.
* The MMC/SD card is mounted automatically under /media/mmcblk0pX. Where X is the partition number.
+
* The MMC/SD card is mounted automatically under {{filename|/media/mmcblk2p'''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:
 
* If for some reason the MMC/SD card hasn't been mounted automatically, use the following mount command:
 
<pre>
 
<pre>
root@compulab:~# mkdir -p /media/mmcblk0pX && mount /dev/mmcblk0pX /media/mmcblk0pX
+
root@cl-ramdisk:~# mkdir -p /media/mmcblk2pX && mount /dev/mmcblk2pX /media/mmcblk2pX
 
</pre>
 
</pre>
 
* Continue to the [[#Install Images | Install Images]] section.
 
* Continue to the [[#Install Images | Install Images]] section.
  
=== Mount a USB Storage Device ===
+
=== Mount USB Storage Device ===
* Copy the {{filename|debian-image.ubi}}, the {{filename|debian-image.tar.bz2}}, and the {{filename|uImage-cm-fx6}} from the [http://compulab.co.il/products/computer-on-modules/cm-fx6/#devres Linux package for CM-FX6] to the root directory of any partition on the USB storage device.
 
 
* Plug the USB storage device to the lower port on the dual USB host connector P13 of the SB-FX6.
 
* Plug the USB storage device to the lower port on the dual USB host connector P13 of the SB-FX6.
* The USB device is mounted automatically under /media/sdXY. Where X is the device letter and Y is the partition number.
+
* The USB device 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:
 
* If for some reason the USB storage device hasn't been mounted automatically, use the following mount command:
 
<pre>
 
<pre>
root@compulab:~# mkdir -p /media/sdXY && mount /dev/sdXY /media/sdXY
+
root@cl-ramdisk:~# mkdir -p /media/sdXY && mount /dev/sdXY /media/sdXY
 
</pre>
 
</pre>
 
* Continue to the [[#Install Images | Install Images]] section.
 
* Continue to the [[#Install Images | Install Images]] section.
  
=== Mount an NFS drive ===
+
=== Mount NFS drive ===
 
* Connect the CM-FX6 Ethernet port (connector P9 marked as "CM ETHERNET" on the SB-FX6) to your local network.
 
* Connect the CM-FX6 Ethernet port (connector P9 marked as "CM ETHERNET" on the SB-FX6) to your local network.
* Copy the {{filename|debian-image.ubi}}, the {{filename|debian-image.tar.bz2}}, and the {{filename|uImage-cm-fx6}} from the [http://compulab.co.il/products/computer-on-modules/cm-fx6/#devres Linux package for CM-FX6] to a directory exported through NFS.
+
* Copy files listed in [[#Installation media or NFS export directory | Installation media or NFS export directory]] from [http://compulab.co.il/products/computer-on-modules/cm-fx6/#devres Linux package for CM-FX6] to an NFS server export directory.
 
* Obtain an IP address for the CM-FX6:
 
* Obtain an IP address for the CM-FX6:
** Using DHCP:<pre>root@compulab:~# ifup `basename /sys/devices/platform/enet.0/net/eth?`</pre>
+
** Using DHCP:<pre>root@cl-ramdisk:~# ifup `basename /sys/devices/platform/enet.0/net/eth?`</pre>
** If you do not have a DHCP server, you can set a static IP address using {{cmd|ifconfig}}:<pre>root@compulab:~# ifconfig `basename /sys/devices/platform/enet.0/net/eth?` <ip address></pre>
+
** If you do not have a DHCP server, you can set a static IP address using {{cmd|ifconfig}}:<pre>root@cl-ramdisk:~# ifconfig `basename /sys/devices/platform/enet.0/net/eth?` <ip address></pre>
* Mount the NFS share containing the {{filename|uImage-cm-fx6}}, the {{filename|debian-image.ubi}} and the {{filename|debian-image.tar.bz2}} files:
+
* Mount the NFS share containing the {{filename|'''kernel.update.tar.bz2'''}} and the {{filename|'''rootfs.tar.bz2'''}} files:
 
<pre>
 
<pre>
root@compulab:~# mount -o nolock <host ip>:/path/to/nfs/share /mnt/net
+
root@cl-ramdisk:~# mount -o nolock <host ip>:/path/to/nfs/share /mnt/net
 
</pre>
 
</pre>
 
* Continue to [[#Install Images | Install Images]] section.
 
* Continue to [[#Install Images | Install Images]] section.
Line 100: Line 150:
 
* In this subsection the term {{filename|/mount/point}} can be:
 
* In this subsection the term {{filename|/mount/point}} can be:
 
** {{filename|/mnt/net}} if NFS is used
 
** {{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/mmcblk2pX}} if an MMC/SD card is used, where X is the partition number.
 
** {{filename|/media/sdXY}} if a USB storage is used, where X is the USB drive letter and Y is the partition number.
 
** {{filename|/media/sdXY}} if a USB storage is used, where X is the USB drive letter and Y is the partition number.
 +
===== rootfs/mtd4 =====
 +
* Format the NAND flash root filesystem partition:
 +
<pre>
 +
root@cl-ramdisk:~# ubiformat --yes /dev/mtd4
 +
</pre>
 +
* Attach the NAND flash root filesystem partition:
 +
<pre>
 +
root@cl-ramdisk:~# ubiattach -m 4 -d 0
 +
</pre>
 +
* Create a ubi volume and name it "rootfs":
 +
<pre>
 +
root@cl-ramdisk:~# ubimkvol /dev/ubi0 -m -N rootfs
 +
</pre>
 +
* Mount the ubi volume:
 +
<pre>
 +
root@cl-ramdisk:~# mkdir -p /media/rootfs && mount -t ubifs ubi0:rootfs /media/rootfs
 +
</pre>
 +
* Extract the content of {{filename|'''rootfs.tar.bz2'''}} onto the /media/rootfs:
 +
<pre>
 +
root@cl-ramdisk:~# tar -xvpjf /mount/point/rootfs.tar.bz2 -C /media/rootfs && sync
 +
</pre>
 +
* Extract the content of {{filename|'''kernel.update.tar.bz2'''}} onto the /media/rootfs:
 +
<pre>
 +
root@cl-ramdisk:~# tar -xvpjf /mount/point/kernel.update.tar.bz2 -C /media/rootfs && sync
 +
</pre>
 +
===== Kernel/mtd3 =====
 +
* Select a correct device tree file that meets the configuration requirements:
 +
:* Quad
 +
:<pre> root@cl-ramdisk:~# export fdt_file=imx6q-sbc-fx6.dtb </pre>
 +
:* Dual
 +
:<pre> root@cl-ramdisk:~# export fdt_file=imx6dl-sbc-fx6.dtb </pre>
 +
 
* Format the NAND flash kernel partition and write the kernel image onto it:
 
* Format the NAND flash kernel partition and write the kernel image onto it:
 
<pre>
 
<pre>
root@compulab:~# flash_erase /dev/mtd3 0 0
+
root@cl-ramdisk:~#
root@compulab:~# nandwrite -p /dev/mtd3 /mount/point/uImage-cm-fx6
+
</pre>
 +
<pre>
 +
flash_erase /dev/mtd3 0 0
 +
nandwrite -p /dev/mtd3 /media/rootfs/boot/zImage-cm-fx6
 +
nandwrite -p /dev/mtd3 -s 0x780000 /media/rootfs/boot/${fdt_file}
 
</pre>
 
</pre>
* Format the NAND flash root filesystem partition and write the Debian filesystem image onto it:
+
* Unmount the ubi volume:
 
<pre>
 
<pre>
root@compulab:~# ubiformat -O 2048 /dev/mtd4 -f /mount/point/debian-image.ubi
+
root@cl-ramdisk:~# umount /media/rootfs
 
</pre>
 
</pre>
 
* Continue to the [[#After Installation | After Installation]] section.
 
* Continue to the [[#After Installation | After Installation]] section.
  
 
==== Install on the SSD Disk-on-Chip ====
 
==== Install on the SSD Disk-on-Chip ====
{{Note|Current U-Boot for CM-FX6 does not support reading the kernel from SSD Disk-on-Chip. It is advised to load the kernel image from another storage device.}}
 
 
{{Note|The below procedure will work only on empty SSD Disk-on-Chip. If you have already used the SSD, please delete all the partitions before proceeding.}}
 
{{Note|The below procedure will work only on empty SSD Disk-on-Chip. If you have already used the SSD, please delete all the partitions before proceeding.}}
 
* In this subsection the term {{filename|/mount/point}} can be:
 
* In this subsection the term {{filename|/mount/point}} can be:
 
** {{filename|/mnt/net}} if NFS is used
 
** {{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/mmcblk2pX}} 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.
 
** {{filename|/media/sdXY}} if USB storage is used, where X is the USB drive letter and Y is the partition number.
* Create two partitions for the Linux kernel (FAT32 100M) and root file system (EXT4 the rest of the disk) on the SSD:
+
* Create two partitions for the Linux kernel (EXT4 100M) and root file system (EXT4 the rest of the disk) on the SSD:
 
<pre>
 
<pre>
root@compulab:~# echo -e "n\np\n1\n\n+100M\na\n1\nt\nc\nn\np\n2\n\n\nw\neof\n" | fdisk /dev/sda
+
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/sda
 
</pre>
 
</pre>
* Format the first partition with FAT32 file system:
+
* Format 1-st boot-partition with EXT4 file system:
 
<pre>
 
<pre>
root@compulab:~# mkfs.vfat -n boot /dev/sda1
+
root@cl-ramdisk:~# mkfs.ext4 -L boot /dev/sda1
 
</pre>
 
</pre>
* Format the second partition with EXT4 file system:
+
* Format 2-d rootfs-partition with EXT4 file system:
 
<pre>
 
<pre>
root@compulab:~# mkfs.ext4 /dev/sda2
+
root@cl-ramdisk:~# mkfs.ext4 -L rootfs /dev/sda2
 
</pre>
 
</pre>
 
* Mount both partitions:
 
* Mount both partitions:
 
<pre>
 
<pre>
root@compulab:~# mkdir -p /media/boot && mount /dev/sda1 /media/boot
+
root@cl-ramdisk:~# mkdir -p /media/rootfs && mount /dev/sda2 /media/rootfs
root@compulab:~# mkdir -p /media/rootfs && mount /dev/sda2 /media/rootfs
+
root@cl-ramdisk:~# mkdir -p /media/rootfs/boot && mount /dev/sda1 /media/rootfs/boot
 
</pre>
 
</pre>
* Copy the {{filename|uImage-cm-fx6}} to the first (FAT) partition:
+
* Extract the content of {{filename|'''rootfs.tar.bz2'''}} onto the second partition:
 
<pre>
 
<pre>
root@compulab:~# cp /mount/point/uImage-cm-fx6 /media/boot && sync
+
root@cl-ramdisk:~# tar -xvpjf /mount/point/rootfs.tar.bz2 -C /media/rootfs && sync
 
</pre>
 
</pre>
* Extract the content of {{filename|debian-image.tar.bz2}} onto the second partition:
+
* Extract the content of {{filename|'''kernel.update.tar.bz2'''}} onto the second partition:
 
<pre>
 
<pre>
root@compulab:~# tar -xvpjf /mount/point/debian-image.tar.bz2 -C /media/rootfs && sync
+
root@cl-ramdisk:~# tar -xvpjf /mount/point/kernel.update.tar.bz2 -C /media/rootfs && sync
 
</pre>
 
</pre>
 
* Unmount both SSD partitions:
 
* Unmount both SSD partitions:
 
<pre>
 
<pre>
root@compulab:~# umount /dev/sda1
+
root@cl-ramdisk:~# umount /dev/sda1
root@compulab:~# umount /dev/sda2
+
root@cl-ramdisk:~# umount /dev/sda2
 
</pre>
 
</pre>
 
* Continue to the [[#After Installation | After Installation]] section.
 
* Continue to the [[#After Installation | After Installation]] section.
Line 154: Line 239:
 
== After Installation ==
 
== After Installation ==
 
{{Note|If the boot settings of the CM-FX6 are different than default, you may need to press and hold '''Ctrl-C''' while turning the CM-FX6 on, in order to get command prompt.}}
 
{{Note|If the boot settings of the CM-FX6 are different than default, you may need to press and hold '''Ctrl-C''' while turning the CM-FX6 on, in order to get command prompt.}}
* CM-FX6 will boot Debian Linux from the internal NAND flash or the SSD Disk-on-Chip.
 
  
=== Boot from the NAND flash ===
+
=== Boot Environment ===
* Set the {{parameter|bootargs}} environment variable:
+
==== Common Environment Variables ====
 +
<pre>
 +
CM-FX6 #
 +
</pre>
 +
<pre>
 +
setenv bootdelay 3
 +
setenv loadaddr 0x10800000
 +
setenv fdt_high 0xffffffff
 +
setenv fdt_addr 0x15000000
 +
setenv bootm_low 0x15000000
 +
setenv bootm_size 0x20000000
 +
setenv zImage zImage-cm-fx6
 +
</pre>
 +
 
 +
==== Board Dependent Environment Variables ====
 +
CM-FX6 has two different SoC modifications: '''quad''' and '''dual lite'''.<br>
 +
The U-Boot has to read the SoC revision number in order to make use of
 +
a correct device tree blob.
 +
* Get and save board revision '''board_rev''':
 
<pre>
 
<pre>
CM-FX6 # setenv bootargs 'console=ttymxc3,115200 root=ubi0:rootfs rw rootfstype=ubifs ubi.mtd=rootfs'
+
CM-FX6 # setenv get_board_rev '\
 +
mw.b ${loadaddr} 0x61;\
 +
if cmp.b ${loadaddr} 0x020C8262 1;\
 +
then;\
 +
        setenv board_rev 'dl';\
 +
else;\
 +
        mw.b ${loadaddr} 0x63;\
 +
        if cmp.b ${loadaddr} 0x020C8262 1;\
 +
        then;\
 +
                setenv board_rev 'q';\
 +
        else;\
 +
                setenv board_rev;\
 +
        fi;\
 +
fi;'
 +
CM-FX6 # run get_board_rev; printenv board_rev && saveenv
 
</pre>
 
</pre>
* To boot Linux, type:
+
* Validate '''board_rev''':
 +
{{Note|Make sure that it is '''q''' or '''dl'''}}
 
<pre>
 
<pre>
CM-FX6 # setenv bootdelay 3
+
CM-FX6 # echo ${board_rev}
CM-FX6 # setenv bootcmd "nand read 10800000 0 400000; bootm"
+
</pre>
CM-FX6 # saveenv
+
* Set default value for '''fdt_file''':
CM-FX6 # boot
+
<pre>
 +
CM-FX6 # setenv fdt_file imx6${board_rev}-sbc-fx6.dtb
 +
</pre>
 +
 
 +
==== Display Options ====
 +
CM-FX6 evaluation platform has six video output interfaces: LCD, DVI, HDMI, 2xLVDS and MIPI.<br>
 +
Only four of them can be configured at the same time. The default configuration is: LCD, HDMI and 2xLVDS.<br>
 +
 
 +
===== Mapping Default Video Output =====
 +
Using a correct device tree file and a kernel video parameter allows changing the default (mxcfb0) mapping.<br>
 +
 
 +
* LCD, SB-FX6 P50 connector
 +
<pre>
 +
CM-FX6 # setenv fdt_file imx6${board_rev}-sbc-fx6.dtb
 +
</pre>
 +
* DVI, SB-FX6 J6 connector
 +
<pre>
 +
CM-FX6 # setenv video video=mxcfb0:dev=lcd,1920x1080M-32@50,if=RGB32
 +
CM-FX6 # setenv fdt_file imx6${board_rev}-sbc-fx6.dtb
 +
</pre>
 +
* HDMI, SB-FX6 J6 connector
 +
<pre>
 +
CM-FX6 # setenv fdt_file imx6${board_rev}-sbc-fx6-hdmi.dtb
 +
</pre>
 +
* MIPI, SB-FX6 P19 connector
 +
<pre>
 +
CM-FX6 # setenv fdt_file imx6${board_rev}-sbc-fx6-mipi.dtb
 +
</pre>
 +
 
 +
==== SSD/SATA Boot Parameters ====
 +
<pre>
 +
CM-FX6 #
 +
</pre>
 +
<pre>
 +
setenv set_media 'setenv satadev 0; sata init'
 +
setenv set_args 'setenv bootargs console=ttymxc3,115200 root=/dev/sda2 rootfstype=ext4 rw rootwait'
 +
setenv load_kernel 'load sata ${satadev} ${loadaddr} ${zimage}'
 +
setenv load_dtb 'load sata ${satadev} ${fdt_addr} ${fdt_file}'
 
</pre>
 
</pre>
  
 +
==== MMC Boot Parameters ====
 +
<pre>
 +
CM-FX6 #
 +
</pre>
 +
<pre>
 +
setenv set_media 'setenv mmcdev 2; mmc dev ${mmcdev}'
 +
setenv set_args 'setenv bootargs console=ttymxc3,115200 root=/dev/mmcblk2p2 rootfstype=ext4 rw rootwait'
 +
setenv load_kernel 'load mmc ${mmcdev} ${loadaddr} ${zimage}'
 +
setenv load_dtb 'load mmc ${mmcdev} ${fdt_addr} ${fdt_file}'
 +
</pre>
  
=== Boot from the SSD Disk-on-Chip ===
+
==== NAND Boot Parameters ====
Current U-Boot version for CM-FX6 does not support the SSD Disk-on-Chip.
+
<pre>
 +
CM-FX6 #
 +
</pre>
 +
<pre>
 +
setenv set_media 'echo nand is ready'
 +
setenv set_args 'setenv bootargs console=ttymxc3,115200 root=ubi0:rootfs rw rootfstype=ubifs ubi.mtd=rootfs'
 +
setenv load_kernel 'nand read ${loadaddr} 0 800000'
 +
setenv load_dtb 'nand read ${fdt_addr} 780000 10000'
 +
</pre>
 +
 
 +
==== Boot Command  ====
 +
* Extra boot parameters
 +
<pre>
 +
CM-FX6 # setenv set_args+ 'setenv bootargs ${bootargs} ${video} vmalloc=256M cma=384M ip=dhcp'
 +
</pre>
 +
* Default boot command
 +
<pre>
 +
CM-FX6 #
 +
</pre>
 +
<pre>
 +
setenv set_boot 'run set_media; run set_args; run set_args+; run load_kernel; run load_dtb;'
 +
setenv bootcmd 'run set_boot; bootz ${loadaddr} - ${fdt_addr}'
 +
</pre>
  
 
== See also ==
 
== See also ==
 +
* [[CM-FX6: Linux: Automatic Installation]]
 
* [[CM-FX6: Linux: Debian]]
 
* [[CM-FX6: Linux: Debian]]
 
* [[CM-FX6: Linux: Kernel]]
 
* [[CM-FX6: Linux: Kernel]]

Latest revision as of 13:22, 1 January 2017

Introduction

This article provides an introduction on how to install the Debian example root filesystem image on the CompuLab CM-FX6 System-on-Module / Computer-on-Module NAND or SSD.

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 CM-FX6 (link below).
  • Download the Linux package for CM-FX6 from CompuLab website. Unzip the package to a directory on your host workstation.
  • All image files mentioned below can be found in the images subdirectory.
  • Connect the host PC to the SB-FX6 base-board (connector P60) via the serial cable supplied with the evaluation kit.
  • Start the terminal emulation software on your PC. Set baud rate to 115200 bps, 8 bit per frame, 1 stop bit, no parity, no flow control.
  • Turn on the CM-FX6 evaluation system. The U-Boot boot-loader will start and you will get a command prompt.
Admolition note.png If the boot settings of your CM-FX6 are different than the default, you may need to press and hold Ctrl-C while turning the CM-FX6 on, in order to get command prompt.

Installation and Deployment Files

Installation media or TFTP export directory

  • kernel.img
  • imx6q-sbc-fx6.dtb
  • imx6dl-sbc-fx6.dtb
  • ramdisk.img
  • boot.scr

Installation media or NFS export directory

  • rootfs.tar.bz2
  • kernel.update.tar.bz2

Boot into the installation environment (ramdisk)

The first step in CM-FX6 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

The partition can be formatted as either ext2/3/4 or FAT file system.

  • Insert the MMC/SD card into the SD socket (P6) on the SB-FX6.
  • Use the following U-boot commands to boot the installation environment on the CM-FX6 quad/dual lite configuration:
CM-FX6 #
setenv loadaddr 0x10800000
mmc dev 2; mmc rescan
load mmc 2 ${loadaddr} boot.scr
source ${loadaddr}

Using installation environment on USB storage

The partition can be formatted as either ext2/3/4 or FAT file system.

  • Insert the USB storage into a USB socket on the SB-FX6.
  • Use the following U-boot commands to boot the installation environment on a CM-FX6 quad/dual lite configuration:
CM-FX6 #
setenv loadaddr 0x10800000
usb start
load usb 0 ${loadaddr} boot.scr
source ${loadaddr}

Using installation environment from TFTP server

  • Connect the CM-FX6 Ethernet port (connector P9 marked as "CM ETHERNET" on the SB-FX6) to your local network.
  • Copy files listed in Installation media or TFTT export directory from Linux package for CM-FX6 to a TFTP server export directory:
    - 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.
  • You can use U-boot dhcp command to obtain IP address or manually set ipaddr environment variable:
CM-FX6 # setenv ipaddr <CM-FX6 ip address>
  • Set the serverip environment variable and save the new environment:
CM-FX6 # setenv serverip <tftp server host ip address>
CM-FX6 # saveenv
  • Set a correct value for the fdt_file variable:
  • Quad
CM-FX6 # setenv fdt_file imx6q-sbc-fx6.dtb
  • Dual
CM-FX6 # setenv fdt_file imx6dl-sbc-fx6.dtb
  • Use the following U-Boot commands to boot Linux on CM-FX6:
CM-FX6 #
setenv fdt_high 0xffffffff
setenv fdt_addr 0x15000000
setenv bootm_low 0x15000000
setenv bootm_size 0x20000000
setenv load_addr 0x10800000
setenv ramdisk_addr 0x12000000
setenv bootargs 'root=/dev/ram0 rw ramdisk_size=16384 console=ttymxc3,115200 ip=dhcp'
tftpboot ${load_addr} kernel.img && tftpboot ${fdt_addr} ${fdt_file} && tftpboot ${ramdisk_addr} ramdisk.img
bootz ${load_addr} ${ramdisk_addr} ${fdt_addr}

Install Kernel and Root Files System Images

After the ramdisk image is loaded the bash shell prompt shows up:

root@cl-ramdisk:/#

The next step is installing the kernel and Debian Linux images. The following media can be used as a source for installation:

Mount MMC/SD Card

  • Insert the MMC/SD card into the SD socket (P6) on the SB-FX6.
  • The MMC/SD card is mounted automatically under /media/mmcblk2pX. Where X is the partition number.
  • If for some reason the MMC/SD card hasn't been mounted automatically, use the following mount command:
root@cl-ramdisk:~# mkdir -p /media/mmcblk2pX && mount /dev/mmcblk2pX /media/mmcblk2pX

Mount USB Storage Device

  • Plug the USB storage device to the lower port on the dual USB host connector P13 of the SB-FX6.
  • The USB device is mounted automatically under /media/sdXY. Where X is the device letter and Y is the partition number.
  • If for some reason the USB storage device hasn't been mounted automatically, use the following mount command:
root@cl-ramdisk:~# mkdir -p /media/sdXY && mount /dev/sdXY /media/sdXY

Mount NFS drive

  • Connect the CM-FX6 Ethernet port (connector P9 marked as "CM ETHERNET" on the SB-FX6) to your local network.
  • Copy files listed in Installation media or NFS export directory from Linux package for CM-FX6 to an NFS server export directory.
  • Obtain an IP address for the CM-FX6:
    • Using DHCP:
      root@cl-ramdisk:~# ifup `basename /sys/devices/platform/enet.0/net/eth?`
    • If you do not have a DHCP server, you can set a static IP address using ifconfig:
      root@cl-ramdisk:~# ifconfig `basename /sys/devices/platform/enet.0/net/eth?` <ip address>
  • Mount the NFS share containing the kernel.update.tar.bz2 and the rootfs.tar.bz2 files:
root@cl-ramdisk:~# mount -o nolock <host ip>:/path/to/nfs/share /mnt/net

Install Images

Once the ramdisk image is loaded and the media containing the CM-FX6 Kernel and Debian Linux images is mounted, the installation can be done on either of the following:

Install on the NAND flash

  • In this subsection the term /mount/point can be:
    • /mnt/net if NFS is used
    • /media/mmcblk2pX if an MMC/SD card is used, where X is the partition number.
    • /media/sdXY if a USB storage is used, where X is the USB drive letter and Y is the partition number.
rootfs/mtd4
  • Format the NAND flash root filesystem partition:
root@cl-ramdisk:~# ubiformat --yes /dev/mtd4
  • Attach the NAND flash root filesystem partition:
root@cl-ramdisk:~# ubiattach -m 4 -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 -xvpjf /mount/point/rootfs.tar.bz2 -C /media/rootfs && sync
  • Extract the content of kernel.update.tar.bz2 onto the /media/rootfs:
root@cl-ramdisk:~# tar -xvpjf /mount/point/kernel.update.tar.bz2 -C /media/rootfs && sync
Kernel/mtd3
  • Select a correct device tree file that meets the configuration requirements:
  • Quad
 root@cl-ramdisk:~# export fdt_file=imx6q-sbc-fx6.dtb 
  • Dual
 root@cl-ramdisk:~# export fdt_file=imx6dl-sbc-fx6.dtb 
  • Format the NAND flash kernel partition and write the kernel image onto it:
root@cl-ramdisk:~#
flash_erase /dev/mtd3 0 0
nandwrite -p /dev/mtd3 /media/rootfs/boot/zImage-cm-fx6
nandwrite -p /dev/mtd3 -s 0x780000 /media/rootfs/boot/${fdt_file}
  • Unmount the ubi volume:
root@cl-ramdisk:~# umount /media/rootfs

Install on the SSD Disk-on-Chip

Admolition note.png The below procedure will work only on empty SSD Disk-on-Chip. If you have already used the SSD, please delete all the partitions before proceeding.
  • In this subsection the term /mount/point can be:
    • /mnt/net if NFS is used
    • /media/mmcblk2pX if an MMC/SD card is used, where X is the partition number.
    • /media/sdXY if USB storage is used, where X is the USB drive letter and Y is the partition number.
  • Create two partitions for the Linux kernel (EXT4 100M) and root file system (EXT4 the rest of the disk) on the SSD:
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/sda
  • Format 1-st boot-partition with EXT4 file system:
root@cl-ramdisk:~# mkfs.ext4 -L boot /dev/sda1
  • Format 2-d rootfs-partition with EXT4 file system:
root@cl-ramdisk:~# mkfs.ext4 -L rootfs /dev/sda2
  • Mount both partitions:
root@cl-ramdisk:~# mkdir -p /media/rootfs && mount /dev/sda2 /media/rootfs
root@cl-ramdisk:~# mkdir -p /media/rootfs/boot && mount /dev/sda1 /media/rootfs/boot
  • Extract the content of rootfs.tar.bz2 onto the second partition:
root@cl-ramdisk:~# tar -xvpjf /mount/point/rootfs.tar.bz2 -C /media/rootfs && sync
  • Extract the content of kernel.update.tar.bz2 onto the second partition:
root@cl-ramdisk:~# tar -xvpjf /mount/point/kernel.update.tar.bz2 -C /media/rootfs && sync
  • Unmount both SSD partitions:
root@cl-ramdisk:~# umount /dev/sda1
root@cl-ramdisk:~# umount /dev/sda2

After Installation

Admolition note.png If the boot settings of the CM-FX6 are different than default, you may need to press and hold Ctrl-C while turning the CM-FX6 on, in order to get command prompt.

Boot Environment

Common Environment Variables

CM-FX6 #
setenv bootdelay 3
setenv loadaddr 0x10800000
setenv fdt_high 0xffffffff
setenv fdt_addr 0x15000000
setenv bootm_low 0x15000000
setenv bootm_size 0x20000000
setenv zImage zImage-cm-fx6

Board Dependent Environment Variables

CM-FX6 has two different SoC modifications: quad and dual lite.
The U-Boot has to read the SoC revision number in order to make use of a correct device tree blob.

  • Get and save board revision board_rev:
CM-FX6 # setenv get_board_rev '\
mw.b ${loadaddr} 0x61;\
if cmp.b ${loadaddr} 0x020C8262 1;\ 
then;\
        setenv board_rev 'dl';\
else;\
        mw.b ${loadaddr} 0x63;\
        if cmp.b ${loadaddr} 0x020C8262 1;\ 
        then;\
                setenv board_rev 'q';\
        else;\
                setenv board_rev;\
        fi;\
fi;'
CM-FX6 # run get_board_rev; printenv board_rev && saveenv
  • Validate board_rev:
Admolition note.png Make sure that it is q or dl
CM-FX6 # echo ${board_rev}
  • Set default value for fdt_file:
CM-FX6 # setenv fdt_file imx6${board_rev}-sbc-fx6.dtb

Display Options

CM-FX6 evaluation platform has six video output interfaces: LCD, DVI, HDMI, 2xLVDS and MIPI.
Only four of them can be configured at the same time. The default configuration is: LCD, HDMI and 2xLVDS.

Mapping Default Video Output

Using a correct device tree file and a kernel video parameter allows changing the default (mxcfb0) mapping.

  • LCD, SB-FX6 P50 connector
CM-FX6 # setenv fdt_file imx6${board_rev}-sbc-fx6.dtb
  • DVI, SB-FX6 J6 connector
CM-FX6 # setenv video video=mxcfb0:dev=lcd,1920x1080M-32@50,if=RGB32 
CM-FX6 # setenv fdt_file imx6${board_rev}-sbc-fx6.dtb
  • HDMI, SB-FX6 J6 connector
CM-FX6 # setenv fdt_file imx6${board_rev}-sbc-fx6-hdmi.dtb
  • MIPI, SB-FX6 P19 connector
CM-FX6 # setenv fdt_file imx6${board_rev}-sbc-fx6-mipi.dtb 

SSD/SATA Boot Parameters

CM-FX6 #
setenv set_media 'setenv satadev 0; sata init'
setenv set_args 'setenv bootargs console=ttymxc3,115200 root=/dev/sda2 rootfstype=ext4 rw rootwait'
setenv load_kernel 'load sata ${satadev} ${loadaddr} ${zimage}'
setenv load_dtb 'load sata ${satadev} ${fdt_addr} ${fdt_file}'

MMC Boot Parameters

CM-FX6 #
setenv set_media 'setenv mmcdev 2; mmc dev ${mmcdev}'
setenv set_args 'setenv bootargs console=ttymxc3,115200 root=/dev/mmcblk2p2 rootfstype=ext4 rw rootwait'
setenv load_kernel 'load mmc ${mmcdev} ${loadaddr} ${zimage}'
setenv load_dtb 'load mmc ${mmcdev} ${fdt_addr} ${fdt_file}'

NAND Boot Parameters

CM-FX6 #
setenv set_media 'echo nand is ready'
setenv set_args 'setenv bootargs console=ttymxc3,115200 root=ubi0:rootfs rw rootfstype=ubifs ubi.mtd=rootfs'
setenv load_kernel 'nand read ${loadaddr} 0 800000'
setenv load_dtb 'nand read ${fdt_addr} 780000 10000'

Boot Command

  • Extra boot parameters
CM-FX6 # setenv set_args+ 'setenv bootargs ${bootargs} ${video} vmalloc=256M cma=384M ip=dhcp'
  • Default boot command
CM-FX6 #
setenv set_boot 'run set_media; run set_args; run set_args+; run load_kernel; run load_dtb;'
setenv bootcmd 'run set_boot; bootz ${loadaddr} - ${fdt_addr}'

See also