CM-T335: Linux: Manual Linux Installation

From Compulab Mediawiki
Revision as of 16:06, 15 September 2016 by Grinberg (talk | contribs) (Using installation environment on USB storage device)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

This article provides an introduction on how to install the following on the CompuLab CM-T335 / Computer-on-Module NAND internal storage device:

  • Example user space (root filesystem) image.
  • Linux kernel images.

Preparation steps

  • Obtain a PC workstation with a serial communication port or a free USB 2.0 Host 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 terminal emulation software on your PC with the following serial port settings:
Baud Rate Data Bits Stop Bits Parity Flow Control
115200 8 1 none none
  • 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 one of the following media:

Using installation environment on MMC/SD card

  • Copy the following files from Linux package for CM-T335 to the root directory on the first partition of the MMC/SD card:
    kernel.img, am335x-sbc-t335.dtb, ramdisk.img, rootfs.tar.bz2, am335x-sbc-t335.dtb, zImage-cm-t335
Admolition note.png The partition has to be formatted with either ext2/3/4 or FAT16/32 file system.
  • 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 dev 0
CM-T335 # mmc rescan
CM-T335 # load mmc 0 $loadaddr kernel.img && load mmc 0 0x81000000 ramdisk.img && load mmc 0 0x83000000 am335x-sbc-t335.dtb
CM-T335 # setenv bootargs "root=/dev/ram0 rw ramdisk_size=16384 console=ttyO0,115200"
CM-T335 # bootz $loadaddr 0x81000000 0x83000000

Using installation environment on USB storage device

  • Copy the following files from Linux package for CM-T335 to the root directory on the first partition on the USB storage device:
    kernel.img, am335x-sbc-t335.dtb, ramdisk.img, rootfs.tar.bz2, am335x-sbc-t335.dtb, zImage-cm-t335
Admolition note.png The partition has to be formatted with either ext2/3/4 or FAT16/32 file system.
  • 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 # load usb 0:1 $loadaddr kernel.img && load usb 0:1 0x81000000 ramdisk.img && load usb 0:1 0x83000000 am335x-sbc-t335.dtb
CM-T335 # setenv bootargs "root=/dev/ram0 rw ramdisk_size=16384 console=ttyO0,115200"
CM-T335 # bootz $loadaddr 0x81000000 0x83000000

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, am335x-sbc-t335.dtb and ramdisk.img from Linux package for CM-T335 to a location accessible by the TFTP server:
    - On Windows machine: copy kernel.img, am335x-sbc-t335.dtb and ramdisk.img to the same folder and point the TFTP server to that folder
    - On Linux machine: copy kernel.img, am335x-sbc-t335.dtb 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 $loadaddr kernel.img && tftpboot 0x81000000 ramdisk.img && tftpboot 0x83000000 am335x-sbc-t335.dtb
CM-T335 # bootz $loadaddr 0x81000000 0x83000000

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. Any one of the following media can be used as a source for installation:

Mount an MMC/SD Card

  • Insert the MMC/SD card into the SD socket (P23) on the SB-T335.
Admolition note.png The SB-T335 does not have an SD card detect functionality and therefore the micro SD card must be plugged in before the Linux boot process starts.

If Linux has already booted before the SD card has been plugged in, then please repeat the Boot into the installation environment section.

  • 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

  • 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 rootfs.tar.bz2, am335x-sbc-t335.dtb and the zImage-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 rootfs.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/zImage-cm-t335
  • Format the NAND flash device tree partition and write the device tree image onto it:
root@compulab:~# flash_erase /dev/mtd3 0 0
root@compulab:~# nandwrite -p /dev/mtd3 /mount/point/am335x-sbc-t335.dtb
  • 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 rootfs.tar.bz2 onto the /media/rootfs:
root@compulab:~# tar --numeric-owner -xpf /mount/point/rootfs.tar.bz2 -C /media/rootfs && sync
  • Unmount the ubi volume:
root@compulab:~# umount /media/rootfs
  • Reboot the CM-T335 Evaluation system.

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.
  • Select video output.
    • To enable LCD video output:
      CM-T335 # setenv set_display 'fdt rm /panel/display-timings/dvi; fdt rm /panel/display-timings/lvds'

    • To enable LVDS video output:
      CM-T335 # setenv set_display 'fdt rm /panel/display-timings/dvi; fdt rm /panel/display-timings/lcd'

    • To enable DVI video output:
      CM-T335 # setenv set_display 'fdt rm /panel/display-timings/lcd; fdt rm /panel/display-timings/lvds'

  • Select Bluetooth or can bus.
    • To enable Bluetooth:
      CM-T335 # setenv set_blue_can 'fdt rm d_can0; fdt rm d_can1'

    • To enable CAN bus:
      CM-T335 # setenv set_blue_can 'fdt set serial1 status disab; fdt rm /ocp/spi/wlcore'

  • Set the initial environment variables:
CM-T335 # setenv loadimage 'nand read ${loadaddr} 900000 400000 && nand read 83000000 400000 10000'
CM-T335 # setenv update_fdt 'fdt addr 83000000; run set_display; run set_blue_can'
CM-T335 # setenv bootcmd 'run loadimage && run update_fdt; bootz ${loadaddr} - 83000000'
CM-T335 # saveenv
  • To boot Linux, type:
CM-T335 # boot

See also