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

From Compulab Mediawiki
Jump to: navigation, search
(See also)
 
(Install on the NAND flash)
Line 3: Line 3:
 
* 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.}}
  
 
== Boot into the installation environment (ramdisk) ==
 
== Boot into the installation environment (ramdisk) ==
Line 61: Line 61:
  
 
=== Mount an MMC/SD Card ===
 
=== Mount an 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.
+
* 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 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.
 
* The MMC/SD card is mounted automatically under /media/mmcblk0pX. Where X is the partition number.
 
* The MMC/SD card is mounted automatically under /media/mmcblk0pX. Where X is the partition number.
Line 107: Line 107:
 
root@compulab:~# nandwrite -p /dev/mtd3 /mount/point/uImage-cm-fx6
 
root@compulab:~# nandwrite -p /dev/mtd3 /mount/point/uImage-cm-fx6
 
</pre>
 
</pre>
* Format the NAND flash root filesystem partition and write the Debian filesystem image onto it:
+
* Format the NAND flash root filesystem partition:
 
<pre>
 
<pre>
root@compulab:~# ubiformat -O 2048 /dev/mtd4 -f /mount/point/debian-image.ubi
+
root@compulab:~# ubiformat /dev/mtd4
 +
</pre>
 +
* Attach the NAND flash root filesystem partition:
 +
<pre>
 +
root@compulab:~# ubiattach -m 4 -d 0
 +
</pre>
 +
* Create a ubi volume and name it "rootfs":
 +
<pre>
 +
root@compulab:~# ubimkvol /dev/ubi0 -m -N rootfs
 +
</pre>
 +
* Mount the ubi volume:
 +
<pre>
 +
root@compulab:~# mkdir -p /media/rootfs && mount -t ubifs ubi0:rootfs /media/rootfs
 +
</pre>
 +
* Extract the content of {{filename|debian-image.tar.bz2}} onto the /media/rootfs:
 +
<pre>
 +
root@compulab:~# tar -xvpjf /mount/point/debian-image.tar.bz2 -C /media/rootfs && sync
 +
</pre>
 +
* Unmount the ubi volume:
 +
<pre>
 +
root@compulab:~# umount /media/rootfs
 
</pre>
 
</pre>
 
* Continue to the [[#After Installation | After Installation]] section.
 
* Continue to the [[#After Installation | After Installation]] section.

Revision as of 14:51, 3 July 2013

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.

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

  • Copy kernel.img, ramdisk.img and bootscr.img from 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.
  • 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:
CM-FX6 # mmc dev 2
CM-FX6 # mmc rescan
CM-FX6 # fatload mmc 2:1 10700000 bootscr.img
CM-FX6 # source 10700000

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.
  • Put kernel.img and ramdisk.img from Linux package for CM-FX6 to a location accessible by the TFTP server:
    - On Windows machine: copy kernel.img and ramdisk.img to the same folder and point the TFTP server to that folder
    - On Linux machine: copy kernel.img and ramdisk.img 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
  • Use the following U-Boot commands to boot Linux on CM-FX6:
CM-FX6 # setenv bootargs "root=/dev/ram0 ramdisk_size=16384 console=ttymxc3,115200"
CM-FX6 # tftpboot 10800000 kernel.img && tftpboot 12000000 ramdisk.img
CM-FX6 # bootm 10800000 12000000

Install Kernel and Debian Linux Images

After the ramdisk image is loaded the Linux login prompt will appear. Login as root into the system. Use 111111 password for login:

compulab login: root
Password: 111111

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

  • Copy the debian-image.ubi, the debian-image.tar.bz2, and the uImage-cm-fx6 from the Linux package for CM-FX6 to the root directory of any partition on the 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.
  • The MMC/SD card is mounted automatically under /media/mmcblk0pX. 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@compulab:~# mkdir -p /media/mmcblk0pX && mount /dev/mmcblk0pX /media/mmcblk0pX

Mount a USB Storage Device

  • Copy the debian-image.ubi, the debian-image.tar.bz2, and the uImage-cm-fx6 from the 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.
  • 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@compulab:~# mkdir -p /media/sdXY && mount /dev/sdXY /media/sdXY

Mount an NFS drive

  • Connect the CM-FX6 Ethernet port (connector P9 marked as "CM ETHERNET" on the SB-FX6) to your local network.
  • Copy the debian-image.ubi, the debian-image.tar.bz2, and the uImage-cm-fx6 from the Linux package for CM-FX6 to a directory exported through NFS.
  • Obtain an IP address for the CM-FX6:
    • Using DHCP:
      root@compulab:~# 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@compulab:~#  ifconfig `basename /sys/devices/platform/enet.0/net/eth?` <ip address>
  • Mount the NFS share containing the uImage-cm-fx6, the debian-image.ubi and the debian-image.tar.bz2 files:
root@compulab:~#  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/mmcblk0pX 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.
  • Format the NAND flash kernel partition and write the kernel image onto it:
root@compulab:~# flash_erase /dev/mtd3 0 0
root@compulab:~# nandwrite -p /dev/mtd3 /mount/point/uImage-cm-fx6
  • Format the NAND flash root filesystem partition:
root@compulab:~# ubiformat /dev/mtd4
  • Attach the NAND flash root filesystem partition:
root@compulab:~# ubiattach -m 4 -d 0
  • Create a ubi volume and name it "rootfs":
root@compulab:~# ubimkvol /dev/ubi0 -m -N rootfs
  • Mount the ubi volume:
root@compulab:~# mkdir -p /media/rootfs && mount -t ubifs ubi0:rootfs /media/rootfs
  • Extract the content of debian-image.tar.bz2 onto the /media/rootfs:
root@compulab:~# tar -xvpjf /mount/point/debian-image.tar.bz2 -C /media/rootfs && sync
  • Unmount the ubi volume:
root@compulab:~# umount /media/rootfs

Install on the SSD Disk-on-Chip

Admolition note.png 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.
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/mmcblk0pX 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 (FAT32 100M) and root file system (EXT4 the rest of the disk) on the SSD:
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
  • Format the first partition with FAT32 file system:
root@compulab:~# mkfs.vfat -n boot /dev/sda1
  • Format the second partition with EXT4 file system:
root@compulab:~# mkfs.ext4 /dev/sda2
  • Mount both partitions:
root@compulab:~# mkdir -p /media/boot && mount /dev/sda1 /media/boot
root@compulab:~# mkdir -p /media/rootfs && mount /dev/sda2 /media/rootfs
  • Copy the uImage-cm-fx6 to the first (FAT) partition:
root@compulab:~# cp /mount/point/uImage-cm-fx6 /media/boot && sync
  • Extract the content of debian-image.tar.bz2 onto the second partition:
root@compulab:~# tar -xvpjf /mount/point/debian-image.tar.bz2 -C /media/rootfs && sync
  • Unmount both SSD partitions:
root@compulab:~# umount /dev/sda1
root@compulab:~# 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.
  • CM-FX6 will boot Debian Linux from the internal NAND flash or the SSD Disk-on-Chip.

Boot from the NAND flash

  • Set the bootargs environment variable:
CM-FX6 # setenv bootargs 'console=ttymxc3,115200 root=ubi0:rootfs rw rootfstype=ubifs ubi.mtd=rootfs'
  • To boot Linux, type:
CM-FX6 # setenv bootdelay 3
CM-FX6 # setenv bootcmd "nand read 10800000 0 400000; bootm"
CM-FX6 # saveenv
CM-FX6 # boot


Boot from the SSD Disk-on-Chip

Current U-Boot version for CM-FX6 does not support the SSD Disk-on-Chip.

See also