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

From Compulab Mediawiki
Jump to: navigation, search
(After Installation)
(Select video out)
Line 13: Line 13:
 
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 device|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-t335/#devres Linux package for CM-T335] to the root directory on the first partition of the MMC/SD card. Note, the partition must be FAT (16 or 32) formated.
+
* Copy {{filename|kernel.img}}, {{filename|ramdisk.img}} and {{filename|bootscr.img}} from [http://compulab.co.il/products/computer-on-modules/cm-t335/#devres Linux package for CM-T335] to the root directory on the first partition of the MMC/SD card. Note, the partition must be FAT (16 or 32) formatted.
 
* Insert the MMC/SD card into the SD socket (P23) on the SB-T335.
 
* Insert the MMC/SD card into the SD socket (P23) on the SB-T335.
 
* Use the following U-boot commands to boot the installation environment on the CM-T335:
 
* Use the following U-boot commands to boot the installation environment on the CM-T335:
Line 22: Line 23:
 
CM-T335 # mmc rescan
 
CM-T335 # mmc rescan
 
CM-T335 # fatload mmc 0:1 80400000 bootscr.img
 
CM-T335 # fatload mmc 0:1 80400000 bootscr.img
 +
CM-T335 # source 80400000
 +
</pre>
 +
* Continue to the [[#Install Kernel and Debian Linux Images | Install Kernel and Debian Linux Images]] section.
 +
 +
=== Using installation environment on USB storage device ===
 +
* Copy {{filename|kernel.img}}, {{filename|ramdisk.img}} and {{filename|bootscr.img}} from [http://compulab.co.il/products/computer-on-modules/cm-t335/#devres Linux package for CM-T335] to the root directory on the first partition on the USB storage device. Note, the partition must be FAT (16 or 32) formatted.
 +
* Plug the USB storage device into:
 +
** USB host connector (either P25, P26, P27 or P28) on SB-T335 if the CM-T335 module has U4 configuration or
 +
** USB OTG connector (P19) on SB-T335 if the CM-T335 module has U1 configuration
 +
* Use the following U-boot commands to boot the installation environment on the CM-T335:
 +
<pre>
 +
CM-T335 # usb start
 +
CM-T335 # fatload usb 0:1 80400000 bootscr.img
 
CM-T335 # source 80400000
 
CM-T335 # source 80400000
 
</pre>
 
</pre>
Line 52: Line 66:
 
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 an MMC/SD Card|MMC/SD Card]]
 
* [[#Mount an MMC/SD Card|MMC/SD Card]]
 +
* [[#Mount a USB Storage Device|USB storage device]]
 
* [[#Mount an NFS drive|NFS drive]]
 
* [[#Mount an NFS drive|NFS drive]]
  
Line 61: Line 76:
 
<pre>
 
<pre>
 
root@compulab:~# mkdir -p /media/mmcblk0pX && mount /dev/mmcblk0pX /media/mmcblk0pX
 
root@compulab:~# mkdir -p /media/mmcblk0pX && mount /dev/mmcblk0pX /media/mmcblk0pX
 +
</pre>
 +
* Continue to the [[#Install Images | Install Images]] section.
 +
 +
=== Mount a USB Storage Device ===
 +
* Copy the {{filename|debian-image.tar.bz2}} and the {{filename|uImage-cm-t335}} from [http://compulab.co.il/products/computer-on-modules/cm-t335/#devres Linux package for CM-T335] to the root directory of any partition on the USB storage device.
 +
* Plug the USB storage device to any USB host connector (either P25, P26, P27 or P28) on SB-T335 if the CM-T335 module has U4 configuration or to USB OTG connector (P19) on SB-T335 if the CM-T335 module has U1 configuration.
 +
* 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>
 +
root@compulab:~# 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.
Line 81: Line 106:
 
* 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/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.
 +
 
 
* 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>
Line 130: Line 157:
 
=== Select video out ===
 
=== Select video out ===
  
Default CM-T335 video output device is DVI.  
+
Default CM-T335 video output device is DVI. Other video output devices can be used as well.
LCD video output can be enabled by adding the following boot options to the kernel command line parameters:
+
* LCD video output can be enabled by adding the following boot options to the kernel command line parameters:
 
<pre>
 
<pre>
 
cm_t335_disp=lcd
 
cm_t335_disp=lcd
 +
</pre>
 +
* LVDS video output can be enabled by adding the following boot options to the kernel command line parameters:
 +
<pre>
 +
cm_t335_disp=lvds
 
</pre>
 
</pre>
  

Revision as of 10:48, 3 April 2014

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-T335 (link below).
  • Download the Linux package for CM-T335 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-T335 base-board (connector P11) 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-T335 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-T335 are different than the default, you may need to press and hold Ctrl-C while turning the CM-T335 on, in order to get command prompt.

Boot into the installation environment (ramdisk)

The first step in CM-T335 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-T335 to the root directory on the first partition of the MMC/SD card. Note, the partition must be FAT (16 or 32) formatted.
  • Insert the MMC/SD card into the SD socket (P23) on the SB-T335.
  • Use the following U-boot commands to boot the installation environment on the CM-T335:
CM-T335 # mmc rescan
CM-T335 # fatload mmc 0:1 80400000 bootscr.img
CM-T335 # source 80400000

Using installation environment on USB storage device

  • Copy kernel.img, ramdisk.img and bootscr.img from Linux package for CM-T335 to the root directory on the first partition on the USB storage device. Note, the partition must be FAT (16 or 32) formatted.
  • Plug the USB storage device into:
    • USB host connector (either P25, P26, P27 or P28) on SB-T335 if the CM-T335 module has U4 configuration or
    • USB OTG connector (P19) on SB-T335 if the CM-T335 module has U1 configuration
  • Use the following U-boot commands to boot the installation environment on the CM-T335:
CM-T335 # usb start
CM-T335 # fatload usb 0:1 80400000 bootscr.img
CM-T335 # source 80400000

Using installation environment from TFTP server

  • Connect the CM-T335 Ethernet port (connector P2 on the SB-T335) to your local network.
  • Put kernel.img and ramdisk.img from Linux package for CM-T335 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-T335 # setenv ipaddr <CM-T335 ip address>
  • Set the serverip environment variable and save the new environment:
CM-T335 # setenv serverip <tftp server host ip address>
CM-T335 # saveenv
  • Use the following U-Boot commands to boot Linux on CM-T335:
CM-T335 # setenv bootargs "root=/dev/ram0 ramdisk_size=16384 console=ttyO0,115200"
CM-T335 # tftpboot 82000000 kernel.img && tftpboot 81000000 ramdisk.img
CM-T335 # bootm 82000000 81000000

Install Kernel and Debian Linux Images

After the ramdisk image is loaded the Linux command line prompt will appear.
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 the debian-image.tar.bz2, and the uImage-cm-t335 from the Linux package for CM-T335 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 (P23) on the SB-T335.
  • 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.tar.bz2 and the uImage-cm-t335 from Linux package for CM-T335 to the root directory of any partition on the USB storage device.
  • Plug the USB storage device to any USB host connector (either P25, P26, P27 or P28) on SB-T335 if the CM-T335 module has U4 configuration or to USB OTG connector (P19) on SB-T335 if the CM-T335 module has U1 configuration.
  • 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-T335 Ethernet port (connector P2 on the SB-T335) to your local network.
  • Copy the debian-image.tar.bz2, and the uImage-cm-t335 from the Linux package for CM-T335 to a directory exported through NFS.
  • Obtain an IP address for the CM-T335:
    • 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 uImage-cm-t335, 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-T335 Kernel and Debian Linux images is mounted, the installation can proceed:

  • 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.
  • Format the NAND flash kernel partition and write the kernel image onto it:
root@compulab:~# flash_erase /dev/mtd5 0 0
root@compulab:~# nandwrite -p /dev/mtd5 /mount/point/uImage-cm-t335
  • Format the NAND flash root filesystem partition:
root@compulab:~# ubiformat /dev/mtd6
  • Attach the NAND flash root filesystem partition:
root@compulab:~# ubiattach -m 6 -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 --numeric-owner -xpf /mount/point/debian-image.tar.bz2 -C /media/rootfs && sync
  • Unmount the ubi volume:
root@compulab:~# umount /media/rootfs

After Installation

Admolition note.png If the boot settings of the CM-T335 are different than default, you may need to press and hold Ctrl-C while turning the CM-T335 on, in order to get command prompt.
  • Set the bootargs environment variable:
CM-T335 # setenv bootargs 'console=ttyO0,115200n8 root=ubi0:rootfs rw rootfstype=ubifs ubi.mtd=rootfs'
  • To boot Linux, type:
CM-T335 # setenv bootdelay 3
CM-T335 # setenv bootcmd 'nboot 82000000 nand0 900000; bootm'
CM-T335 # saveenv
CM-T335 # boot

Select video out

Default CM-T335 video output device is DVI. Other video output devices can be used as well.

  • LCD video output can be enabled by adding the following boot options to the kernel command line parameters:
cm_t335_disp=lcd
  • LVDS video output can be enabled by adding the following boot options to the kernel command line parameters:
cm_t335_disp=lvds

See also