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

From Compulab Mediawiki
Jump to: navigation, search
(Install Images)
Line 2: Line 2:
 
* Obtain a Linux PC workstation (host).  
 
* Obtain a Linux PC workstation (host).  
 
* Make sure a {{parameter|fastboot}} utility is installed on the host machine. For more details about the {{parameter|fastboot}} utility refer to [[CM-QS600: Linux: Kernel#Getting_Fastboot|Getting Fastboot]] section of the [[CM-QS600: Linux: Kernel]] article.
 
* Make sure a {{parameter|fastboot}} utility is installed on the host machine. For more details about the {{parameter|fastboot}} utility refer to [[CM-QS600: Linux: Kernel#Getting_Fastboot|Getting Fastboot]] section of the [[CM-QS600: Linux: Kernel]] article.
* Get a USB Card reader and a micro SD Card. Use either the micro SD card, supplied with the CM-QS600 Evaluation kit, or obtain a new one.
 
* Plug the USB SD Card reader to a host Linux PC. Insert the micro SD Card into the USB Card reader. From now we assume the device name of the micro SD card on your Linux PC is {{filename|/dev/sdq}}.
 
 
* Download the [http://compulab.co.il/products/computer-on-modules/cm-qs600/#devres Linux package for CM-QS600] from Compulab website. Unzip the package to a directory on your host workstation.
 
* Download the [http://compulab.co.il/products/computer-on-modules/cm-qs600/#devres Linux package for CM-QS600] from Compulab website. Unzip the package to a directory on your host workstation.
 
* All image files mentioned below can be found in {{filename|images}} subdirectory of the Demo package.
 
* All image files mentioned below can be found in {{filename|images}} subdirectory of the Demo package.
 +
* Connect the host PC to the SB-QS600 base-board micro USB port (P7) via the USB to micro USB cable supplied with the evaluation kit.
 +
* Connect the host PC to the SB-QS600 base-board mini USB port (P16) via the USB to mini USB cable supplied with the evaluation kit.
 +
* Make sure the new {{filename|/dev/ttyUSBx}} device file is created by using the {cmd|ls /dev/ttyUSB*}} command. {{parameter|x}} is the last number of the ttyUSB device.
 +
* Start the terminal emulation software on your PC's {{filename|/dev/ttyUSBx}}. Set baud rate to 115200 bps, 8 bit per frame, 1 stop bit, no parity, no flow control.
 +
* Turn on the CM-QS600 evaluation system. The application boot-loader (LK) will start and you will get a command prompt.
  
= Preparing micro SD card =
+
= Boot into the installation environment (ramfs) =
* Create GPT partition table and create one Linux filesystem (ext4) partition on it.
+
The first step in CM-QS600 Linux installation is starting the installation environment (boot image containing Linux kernel and Ramfs image).
 +
* Run the following fastboot command on the host machine:
 
<pre>
 
<pre>
Disk /dev/sdq: 3854336 sectors, 1.8 GiB
+
fastboot boot /path/to/cm-qs600-linux/images/bootramfs-cm-qs600.img
Logical sector size: 512 bytes
+
</pre>
Disk identifier (GUID): 28631117-2266-4EE4-AD25-58BF5B06223B
+
* Continue to the [[#Install Linux Images | Install Linux Images]] section.
Partition table holds up to 128 entries
 
First usable sector is 34, last usable sector is 3854302
 
Partitions will be aligned on 2048-sector boundaries
 
Total free space is 2014 sectors (1007.0 KiB)
 
  
Number  Start (sector)    End (sector)  Size      Code  Name
+
= Install Linux Images =
  1            2048        3854302  1.8 GiB    8300  Linux filesystem
+
After the ramdisk image is loaded the Linux login prompt will appear. Login as {{parameter|root}} into the system.
 +
<pre>
 +
compulab login: root
 
</pre>
 
</pre>
  
The example below shows how to create the GPT table and the ext4 filesystem using {{parameter|gdisk}} and {{parameter|mkfs.ext4}} utilities respectively.
+
== Mount the installation source media ==
Alternatively, you can use {{parameter|gparted}} to create the GPT table and the ext4 partition.
 
  
* Create GPT partition table:
+
The next step is installing the Debian Linux images. The following media can be used as a source for installation:
 +
* [[#Mount a micro SD Card|Micro SD Card]]
 +
* [[#Mount a USB Storage Device|USB storage device]]
 +
* [[#Mount an NFS drive|NFS drive]]
 +
 
 +
=== Mount a micro SD Card ===
 +
* Copy the {{filename|boot-cm-qs600.img}} and the {{filename|debian-image.tar.bz2}} from the [http://compulab.co.il/products/computer-on-modules/cm-qs600/#devres Linux package for CM-QS600] to the root directory of any partition on the micro SD card. The partition can be formatted either ext2/3/4 or FAT file system.
 +
* Insert the micro SD card into the SD socket (P5) on the SB-QS600 prior to booting into the installation environment.
 +
* The micro SD card is mounted automatically under /media/mmcblk1pX. Where X is the partition number.
 +
* If for some reason the micro SD card hasn't been mounted automatically, use the following mount command:
 
<pre>
 
<pre>
echo -e "o\ny\nn\n\n\n8300\nw\ny\neof\n" | sudo gdisk /dev/sdq
+
root@compulab:~# mkdir -p /media/mmcblk1pX && mount /dev/mmcblk1pX /media/mmcblk1pX
 
</pre>
 
</pre>
* Format ext4 partition:
+
* Continue to the [[#Install Images | Install Images]] section.
 +
 
 +
=== Mount a USB Storage Device ===
 +
* Copy the {{filename|boot-cm-qs600.img}} and the {{filename|debian-image.tar.bz2}} from [http://compulab.co.il/products/computer-on-modules/cm-qs600/#devres Linux package for CM-QS600] to the root directory of any partition on the USB storage device.
 +
* Plug the USB storage device to any USB host port (P13 or P14) on the SB-QS600.
 +
* 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:
 
<pre>
 
<pre>
sudo mkfs.ext4 -L rootfs /dev/sdq1
+
root@compulab:~# mkdir -p /media/sdXY && mount /dev/sdXY /media/sdXY
 
</pre>
 
</pre>
* Mount the partition under {{filename|/media/boot}} location:
+
* Continue to the [[#Install Images | Install Images]] section.
 +
 
 +
=== Mount an NFS drive ===
 +
* Connect the CM-QS600 Ethernet port (P13) to your local network.
 +
* Copy the {{filename|boot-cm-qs600.img}} and the {{filename|debian-image.tar.bz2}} from the [http://compulab.co.il/products/computer-on-modules/cm-qs600/#devres Linux package for CM-QS600] to a directory exported through NFS.
 +
* Obtain an IP address for the CM-QS600:
 +
** Using DHCP:<pre>root@compulab:~# ifup `basename /sys/class/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/class/net/eth?` <ip address></pre>
 +
* Mount the NFS share containing the {{filename|boot-cm-qs600.img}} and the {{filename|debian-image.tar.bz2}} files:
 
<pre>
 
<pre>
sudo mkdir -p /media/rootfs
+
root@compulab:~#  mount -o nolock <host ip>:/path/to/nfs/share /mnt/net
sudo mount /dev/sdq1 /media/rootfs
 
 
</pre>
 
</pre>
 +
* Continue to the [[#Install Images | Install Images]] section.
 +
 +
== Install Images ==
 +
Once the ramfs image is loaded and the media containing the CM-QS600 Debian Linux image is mounted, the installation can proceed:
  
= Installing Linux root filesystem =
+
* In this subsection the term {{filename|/mount/point}} can be:
* Extract the Linux root filesystem on to the micro SD card:
+
** {{filename|/mnt/net}} if NFS is used
 +
** {{filename|/media/mmcblk1pX}} if a micro 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.
 +
 
 +
* Copy the boot image containing Linux Kernel to the eMMC partition number 7 named {{parameter|boot}}:
 
<pre>
 
<pre>
sudo tar --numeric-owner -xjpf /path/to/cm-qs600-linux/images/debian-image.tar.bz2 -C /media/rootfs && sync
+
root@compulab:~# dd if=/mount/point/boot-cm-qs600.img of=/dev/mmcblk0p7
 
</pre>
 
</pre>
* Unmount micro SD card:
+
* Format the eMMC partition number 13 named {{parameter|userdata}}:
 
<pre>
 
<pre>
sudo umount /dev/sdq1
+
root@compulab:~# mkfs.ext4 /dev/mmcblk0p13
 
</pre>
 
</pre>
* Remove the micro SD card from the SD card reader and insert it into the SB-QS600 micro SD card socket (P5).
+
* Mount the {{parameter|userdata}} partition:
* Continue to the [[#Installing Kernel | Installing Kernel]] section.
+
<pre>
 
+
root@compulab:~# mkdir -p /media/mmcblk0p13 && mount /dev/mmcblk0p13 /media/mmcblk0p13
= Installing Kernel =
+
</pre>
* Connect the host PC to the SB-QS600 base-board micro USB port (P7) via the USB to micro USB cable supplied with the evaluation kit.
+
* Extract the content of {{filename|debian-image.tar.bz2}} onto the /media/mmcblk0p13:
* Connect the host PC to the SB-QS600 base-board mini USB port (P16) via the USB to mini USB cable supplied with the evaluation kit.
 
* Make sure the new {{filename|/dev/ttyUSBx}} device file is created by using the {{cmd|ls /dev/ttyUSB*}} command. {{parameter|x}} is the last number of the ttyUSB device.
 
* Start the terminal emulation software on your PC's {{filename|/dev/ttyUSBx}}. Set baud rate to 115200 bps, 8 bit per frame, 1 stop bit, no parity, no flow control.
 
* Turn on the CM-QS600 evaluation system. The application boot-loader (LK) will start and you will get a command prompt.
 
* Run the following fastboot command on the host machine:
 
 
<pre>
 
<pre>
fastboot flash boot /path/to/cm-qs600-linux/images/boot.img
+
root@compulab:~# tar --numeric-owner -xpf /mount/point/debian-image.tar.bz2 -C /media/mmcblk0p13 && sync
 
</pre>
 
</pre>
* Continue with the boot process:
+
* Unmount the {{parameter|userdata}} partition:
 
<pre>
 
<pre>
fastboot continue
+
root@compulab:~# umount /media/mmcblk0p13
 
</pre>
 
</pre>
* Alternatively, power cycle the CM-QS600 evaluation system or run the following fastboot command on the host machine:
+
* Reboot the CM-QS600 evaluation system.
 
<pre>
 
<pre>
fastboot reboot
+
root@compulab:~# reboot
 
</pre>
 
</pre>
  

Revision as of 10:05, 29 September 2014

Preparation steps

  • Obtain a Linux PC workstation (host).
  • Make sure a fastboot utility is installed on the host machine. For more details about the fastboot utility refer to Getting Fastboot section of the CM-QS600: Linux: Kernel article.
  • Download the Linux package for CM-QS600 from Compulab website. Unzip the package to a directory on your host workstation.
  • All image files mentioned below can be found in images subdirectory of the Demo package.
  • Connect the host PC to the SB-QS600 base-board micro USB port (P7) via the USB to micro USB cable supplied with the evaluation kit.
  • Connect the host PC to the SB-QS600 base-board mini USB port (P16) via the USB to mini USB cable supplied with the evaluation kit.
  • Make sure the new /dev/ttyUSBx device file is created by using the {cmd|ls /dev/ttyUSB*}} command. x is the last number of the ttyUSB device.
  • Start the terminal emulation software on your PC's /dev/ttyUSBx. Set baud rate to 115200 bps, 8 bit per frame, 1 stop bit, no parity, no flow control.
  • Turn on the CM-QS600 evaluation system. The application boot-loader (LK) will start and you will get a command prompt.

Boot into the installation environment (ramfs)

The first step in CM-QS600 Linux installation is starting the installation environment (boot image containing Linux kernel and Ramfs image).

  • Run the following fastboot command on the host machine:
fastboot boot /path/to/cm-qs600-linux/images/bootramfs-cm-qs600.img

Install Linux Images

After the ramdisk image is loaded the Linux login prompt will appear. Login as root into the system.

compulab login: root

Mount the installation source media

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

Mount a micro SD Card

  • Copy the boot-cm-qs600.img and the debian-image.tar.bz2 from the Linux package for CM-QS600 to the root directory of any partition on the micro SD card. The partition can be formatted either ext2/3/4 or FAT file system.
  • Insert the micro SD card into the SD socket (P5) on the SB-QS600 prior to booting into the installation environment.
  • The micro SD card is mounted automatically under /media/mmcblk1pX. Where X is the partition number.
  • If for some reason the micro SD card hasn't been mounted automatically, use the following mount command:
root@compulab:~# mkdir -p /media/mmcblk1pX && mount /dev/mmcblk1pX /media/mmcblk1pX

Mount a USB Storage Device

  • Copy the boot-cm-qs600.img and the debian-image.tar.bz2 from Linux package for CM-QS600 to the root directory of any partition on the USB storage device.
  • Plug the USB storage device to any USB host port (P13 or P14) on the SB-QS600.
  • 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-QS600 Ethernet port (P13) to your local network.
  • Copy the boot-cm-qs600.img and the debian-image.tar.bz2 from the Linux package for CM-QS600 to a directory exported through NFS.
  • Obtain an IP address for the CM-QS600:
    • Using DHCP:
      root@compulab:~# ifup `basename /sys/class/net/eth?`
    • If you do not have a DHCP server, you can set a static IP address using ifconfig:
      root@compulab:~#  ifconfig `basename /sys/class/net/eth?` <ip address>
  • Mount the NFS share containing the boot-cm-qs600.img and the debian-image.tar.bz2 files:
root@compulab:~#  mount -o nolock <host ip>:/path/to/nfs/share /mnt/net

Install Images

Once the ramfs image is loaded and the media containing the CM-QS600 Debian Linux image is mounted, the installation can proceed:

  • In this subsection the term /mount/point can be:
    • /mnt/net if NFS is used
    • /media/mmcblk1pX if a micro 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.
  • Copy the boot image containing Linux Kernel to the eMMC partition number 7 named boot:
root@compulab:~# dd if=/mount/point/boot-cm-qs600.img of=/dev/mmcblk0p7
  • Format the eMMC partition number 13 named userdata:
root@compulab:~# mkfs.ext4 /dev/mmcblk0p13
  • Mount the userdata partition:
root@compulab:~# mkdir -p /media/mmcblk0p13 && mount /dev/mmcblk0p13 /media/mmcblk0p13
  • Extract the content of debian-image.tar.bz2 onto the /media/mmcblk0p13:
root@compulab:~# tar --numeric-owner -xpf /mount/point/debian-image.tar.bz2 -C /media/mmcblk0p13 && sync
  • Unmount the userdata partition:
root@compulab:~# umount /media/mmcblk0p13
  • Reboot the CM-QS600 evaluation system.
root@compulab:~# reboot

See also