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

From Compulab Mediawiki
Jump to: navigation, search
 
(After Installation)
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
{{Note|It is possible to install Linux on CM-X300 using either an NFS share or a USB flash drive. The first method is preferred because NFS setup will ease further Linux evaluation and development.}}
 
{{Note|It is possible to install Linux on CM-X300 using either an NFS share or a USB flash drive. The first method is preferred because NFS setup will ease further Linux evaluation and development.}}
 
* Obtain a PC workstation with serial communication port.
 
* Obtain a PC workstation with serial communication port.
* For installation using NFS install TFTP server on host PC. For Windows machines we recommend [http://tftpd32.jounin.net/ TFTPD32] included in this distribution package.
+
* For installation using NFS install TFTP server on host PC. For Windows machines we recommend [http://tftpd32.jounin.net/ TFTPD32] included in the [http://compulab.co.il/products/computer-on-modules/cm-x300/#devres Linux package for CM-X300].
* Download the [http://www.compulab.co.il/x300/download/x300-linux.zip Linux distribution package for CM-X300] from CompuLab's website . Unzip the package to a directory on your host workstation.
+
* Download the [http://compulab.co.il/products/computer-on-modules/cm-x300/#devres Linux package for CM-X300] from CompuLab's 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 {{filename|images}} subdirectory
* Copy {{filename|debian-image.ubi}} and {{filename|cm-x300-kernel.jffs2}} from [http://www.compulab.co.il/x300/download/x300-linux.zip Linux distribution package for CM-X300] either to a directory exported through NFS or to a USB flash drive.
+
* Copy {{filename|debian-image.ubi}} and {{filename|cm-x300-kernel.jffs2}} from [http://compulab.co.il/products/computer-on-modules/cm-x300/#devres Linux package for CM-X300] either to a directory exported through NFS or to a USB flash drive.
  
 
== Image installation ==
 
== Image installation ==
Line 15: Line 15:
 
=== Installation using NFS ===
 
=== Installation using NFS ===
 
* Connect CM-X300's ETH0 port to your local Ethernet
 
* Connect CM-X300's ETH0 port to your local Ethernet
* Make sure that Linux kernel binary image {{filename|kernel.img}}, ramdisk image {{filename|ramdisk.img}} and bootloader script image {{filename|first_boot.img}} are accessible by the TFTP server.  
+
* Make sure that Linux kernel binary image {{filename|kernel.img}}, ramdisk image {{filename|ramdisk.img}} and bootloader script image {{filename|bootscr.img}} are accessible by the TFTP server.  
*: - On Windows machine: copy {{filename|kernel.img}}, {{filename|ramdisk.img}} and {{filename|first_boot.img}} to the same folder and point the TFTP server to that folder
+
*: - On Windows machine: copy {{filename|kernel.img}}, {{filename|ramdisk.img}} and {{filename|bootscr.img}} to the same folder and point the TFTP server to that folder
*: - On Linux machine: copy {{filename|kernel.img}}, {{filename|ramdisk.img}} and {{filename|first_boot.img}} to TFTP sevrver root directory, usually {{filename|/tftpboot}} or {{filename|/tftproot}}.
+
*: - On Linux machine: copy {{filename|kernel.img}}, {{filename|ramdisk.img}} and {{filename|bootscr.img}} to TFTP sevrver 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 30: Line 30:
 
* Use the following U-boot command to boot Linux on CM-X300:
 
* Use the following U-boot command to boot Linux on CM-X300:
 
<pre>
 
<pre>
> tftp 80400000 first_boot.img && autoscr 80400000
+
> tftp 80400000 bootscr.img && autoscr 80400000
</pre>
 
* During boot the CM-X300 tries to obtain an IP address using DHCP. If you do not have DHCP server you can set the CM-X300 IP address statically using {{cmd|ifconfig}}:
 
<pre>
 
$ ifconfig eth0 <ip address>
 
 
</pre>  
 
</pre>  
 
* After the ramdisk image is loaded you will get Linux login prompt. Login as {{parameter|root}} into the system.
 
* After the ramdisk image is loaded you will get Linux login prompt. Login as {{parameter|root}} into the system.
 +
* Obtain an IP address for the CM-X300:
 +
** Using DHCP:<pre>root@compulab:~# ifup `basename /sys/devices/platform/enet.0/net/eth0`</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/eth0` <ip address></pre>
 
* Mount the NFS share containing {{filename|cm-x300-kernel.jffs2}} and {{filename|debian-image.ubi}} image:
 
* Mount the NFS share containing {{filename|cm-x300-kernel.jffs2}} and {{filename|debian-image.ubi}} image:
 
<pre>
 
<pre>
$ mount <host ip>:/path/to/nfs/share /mnt/net
+
$ mount -o nolock <host ip>:/path/to/nfs/share /mnt/net
 
</pre>  
 
</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:
Line 48: Line 47:
 
* Format the NAND flash root filesystem partition and write Debian filesystem image onto it:
 
* Format the NAND flash root filesystem partition and write Debian filesystem image onto it:
 
<pre>
 
<pre>
$ ubiformat /dev/mtd5 -f /mnt/net/debian-image.ubi
+
$ ubiformat -O 2048 /dev/mtd5 -f /mnt/net/debian-image.ubi
 
</pre>
 
</pre>
  
 
=== Installation using USB flash drive ===
 
=== Installation using USB flash drive ===
 
* Make sure that CM-X300's ETH0 port is '''disconnected'''
 
* Make sure that CM-X300's ETH0 port is '''disconnected'''
* Make sure that Linux kernel binary image {{filename|kernel.img}}, ramdisk image {{filename|ramdisk.img}}, kernel JFFS2 image {{filename|cm-x300-kernel.jffs2}}, Debian filesystem JFFS2 image {{filename|debian-image.ubi}} and bootloader script image {{filename|first_boot.img}} are present at the root directory of the USB flash drive.  
+
* Make sure that Linux kernel binary image {{filename|kernel.img}}, ramdisk image {{filename|ramdisk.img}}, kernel JFFS2 image {{filename|cm-x300-kernel.jffs2}}, Debian filesystem JFFS2 image {{filename|debian-image.ubi}} and bootloader script image {{filename|bootscr.img}} are present at the root directory of the USB flash drive.  
 
* Connect USB flash drive to CM-X300. Use USB2 (host/slave) port.  
 
* Connect USB flash drive to CM-X300. Use USB2 (host/slave) port.  
 
* Use the following U-boot command to boot Linux on CM-X300:
 
* Use the following U-boot command to boot Linux on CM-X300:
 
<pre>
 
<pre>
 
> usb start
 
> usb start
> fatload usb 0:1 80400000 first_boot.img
+
> fatload usb 0:1 80400000 bootscr.img
 
> autoscr 80400000
 
> autoscr 80400000
 
</pre>  
 
</pre>  
Line 70: Line 69:
 
* Format the NAND flash root filesystem partition and write Debian filesystem image onto it:
 
* Format the NAND flash root filesystem partition and write Debian filesystem image onto it:
 
<pre>
 
<pre>
$ ubiformat /dev/mtd5 -f /media/sda1/debian-image.ubi
+
$ ubiformat -O 2048 /dev/mtd5 -f /media/sda1/debian-image.ubi
 
</pre>
 
</pre>
  
Line 78: Line 77:
 
<li> Reset the CM-X300.</li>
 
<li> Reset the CM-X300.</li>
 
{{Note|If the boot settings of your CM-X300 are different than default, you may need to press and hold ^C while turning the CM-X300 on, in order to get command prompt.}}
 
{{Note|If the boot settings of your CM-X300 are different than default, you may need to press and hold ^C while turning the CM-X300 on, in order to get command prompt.}}
<li> To start Linux type:  
+
<li>
<pre>> fsload; bootm</pre>
+
Set the kernel command line parameters:
 +
<pre>
 +
> setenv bootargs "root=ubi0:ubi-image rootfstype=ubifs ubi.mtd=5 console=ttyS2,38400" && saveenv
 +
</pre>
 +
</li>
 +
<li> To start Linux type:
 +
<pre>> fsload && bootm</pre>
 
</li>
 
</li>
<li> If you want Linux to start automatically, type:  
+
<li> If you want Linux to start automatically, type:
 
<pre>
 
<pre>
 
> setenv bootdelay <delay in seconds>  
 
> setenv bootdelay <delay in seconds>  
> setenv bootcmd "fsload; bootm"
+
> setenv bootcmd "fsload && bootm"
 
> saveenv
 
> saveenv
 
> boot
 
> boot
Line 111: Line 116:
 
== See also ==
 
== See also ==
  
* [[Linux Development for XScale modules]]
+
* [[Linux: Development for ARM modules]]
* [[Linux Kernel for CM-X300]]
+
* [[CM-X300: Linux: Kernel]]
* [[Debian Linux for CM-X300]]
+
* [[CM-X300: Linux: Debian]]
 
* [[U-Boot for CM-X300]]
 
* [[U-Boot for CM-X300]]
  
 
[[Category:Linux|Getting started]]
 
[[Category:Linux|Getting started]]
 
[[Category:CM-X300|Linux:Getting started]]
 
[[Category:CM-X300|Linux:Getting started]]

Latest revision as of 10:58, 5 May 2014

Preparation steps

Admolition note.png It is possible to install Linux on CM-X300 using either an NFS share or a USB flash drive. The first method is preferred because NFS setup will ease further Linux evaluation and development.
  • Obtain a PC workstation with serial communication port.
  • For installation using NFS install TFTP server on host PC. For Windows machines we recommend TFTPD32 included in the Linux package for CM-X300.
  • Download the Linux package for CM-X300 from CompuLab's website . Unzip the package to a directory on your host workstation.
  • All image files mentioned below can be found in images subdirectory
  • Copy debian-image.ubi and cm-x300-kernel.jffs2 from Linux package for CM-X300 either to a directory exported through NFS or to a USB flash drive.

Image installation

  • Connect the host PC to the CM-X300 via a null modem cable supplied with the Eval Kit.
  • Start terminal emulation software on your PC using the COM port to which the null modem is connected. Set baud rate to 38400 bps, 8 bit per frame, 1 stop bit, no parity, no flow control.
  • Turn on the CM-X300. The U-Boot will start and you will get a command prompt.
Admolition note.png If the boot settings of your CM-X300 are different than default, you may need to press and hold ^C while turning the CM-X300 on, in order to get command prompt.

Installation using NFS

  • Connect CM-X300's ETH0 port to your local Ethernet
  • Make sure that Linux kernel binary image kernel.img, ramdisk image ramdisk.img and bootloader script image bootscr.img are accessible by the TFTP server.
    - On Windows machine: copy kernel.img, ramdisk.img and bootscr.img to the same folder and point the TFTP server to that folder
    - On Linux machine: copy kernel.img, ramdisk.img and bootscr.img to TFTP sevrver root directory, usually /tftpboot or /tftproot.
  • You can use U-boot dhcp command to obtain IP address or manually set ipaddr environment variable:
> setenv ipaddr <CM-X300 ip address>
  • Set serverip environment variable and save the new environment to NAND flash:
> setenv serverip <host ip address>
> saveenv
  • Use the following U-boot command to boot Linux on CM-X300:
> tftp 80400000 bootscr.img && autoscr 80400000
  • After the ramdisk image is loaded you will get Linux login prompt. Login as root into the system.
  • Obtain an IP address for the CM-X300:
    • Using DHCP:
      root@compulab:~# ifup `basename /sys/devices/platform/enet.0/net/eth0`
    • 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/eth0` <ip address>
  • Mount the NFS share containing cm-x300-kernel.jffs2 and debian-image.ubi image:
$  mount -o nolock <host ip>:/path/to/nfs/share /mnt/net
  • Format the NAND flash kernel partition and write the kernel image onto it:
$ flash_eraseall /dev/mtd4
$ nandwrite /dev/mtd4 /mnt/net/cm-x300-kernel.jffs2
  • Format the NAND flash root filesystem partition and write Debian filesystem image onto it:
$ ubiformat -O 2048 /dev/mtd5 -f /mnt/net/debian-image.ubi

Installation using USB flash drive

  • Make sure that CM-X300's ETH0 port is disconnected
  • Make sure that Linux kernel binary image kernel.img, ramdisk image ramdisk.img, kernel JFFS2 image cm-x300-kernel.jffs2, Debian filesystem JFFS2 image debian-image.ubi and bootloader script image bootscr.img are present at the root directory of the USB flash drive.
  • Connect USB flash drive to CM-X300. Use USB2 (host/slave) port.
  • Use the following U-boot command to boot Linux on CM-X300:
> usb start
> fatload usb 0:1 80400000 bootscr.img
> autoscr 80400000
  • After the ramdisk image is loaded you will get Linux login prompt. Login as root into the system.
  • The USB flash drive will be automatically mounted under /media/sda1
  • Format the NAND flash kernel partition and write the kernel image onto it:
$ flash_eraseall /dev/mtd4
$ nandwrite /dev/mtd4 /media/sda1/cm-x300-kernel.jffs2
  • Format the NAND flash root filesystem partition and write Debian filesystem image onto it:
$ ubiformat -O 2048 /dev/mtd5 -f /media/sda1/debian-image.ubi

After Installation

  1. Reset the CM-X300.
  2. Admolition note.png If the boot settings of your CM-X300 are different than default, you may need to press and hold ^C while turning the CM-X300 on, in order to get command prompt.
  3. Set the kernel command line parameters:
    > setenv bootargs "root=ubi0:ubi-image rootfstype=ubifs ubi.mtd=5 console=ttyS2,38400" && saveenv
    
  4. To start Linux type:
    > fsload && bootm
  5. If you want Linux to start automatically, type:
    > setenv bootdelay <delay in seconds> 
    > setenv bootcmd "fsload && bootm"
    > saveenv
    > boot
    

If you want to get back to U-Boot prompt, hold Ctrl-C during reset.

Connection and Logging In

Use the following usernames and passwords to login:

Account with administrative privileges:

User: root
Password: 111111

Regular user account:

User: user
Password: 111111

In addition to these accounts CM-X300 allows anonymous FTP access.

See also