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

From Compulab Mediawiki
Jump to: navigation, search
(See also)
 
(Boot from NAND)
Line 14: Line 14:
 
== Boot into the installation environment (ramdisk) ==
 
== Boot into the installation environment (ramdisk) ==
 
The first step in CM-T43 Linux installation is starting the installation environment (Linux kernel and Ramdisk image).  
 
The first step in CM-T43 Linux installation is starting the installation environment (Linux kernel and Ramdisk image).  
This can be done using the following media:
+
This can be done using one of 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 from USB storage device|USB storage device]]
 
* [[#Using installation environment from USB storage device|USB storage device]]
Line 81: Line 81:
 
==== Mount the installation source media ====
 
==== Mount the installation source media ====
  
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.
 +
One of 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 a USB Storage Device|USB storage device]]
Line 117: Line 118:
 
</pre>
 
</pre>
  
==== Install Images on eMMC ====
+
==== Install Images ====
 
* 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/mmcblk0pY}} if an MMC/SD card is used, where Y is the partition number.
 
** {{filename|/media/mmcblk0pY}} if an MMC/SD card is used, where Y 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.
 
** {{filename|/media/sdXY}} if USB storage is used, where X is the USB drive letter and Y is the partition number.
 +
 +
===== Install Images on eMMC =====
 
* Create two partitions for the Linux kernel (FAT32 100M) and root file system (EXT4 the rest of the disk) on the eMMC.
 
* Create two partitions for the Linux kernel (FAT32 100M) and root file system (EXT4 the rest of the disk) on the eMMC.
 
*: {{note|If an SD-Card is inserted in the SD card socket, eMMC will be enumerated as /dev/mmcblk1.<br>If an SD-Card is not inserted in the SD card socket, eMMC will be enumerated as /dev/mmcblk0. In the following instructions /dev/mmcblkX(p1,p2) refers to the eMMC.}}
 
*: {{note|If an SD-Card is inserted in the SD card socket, eMMC will be enumerated as /dev/mmcblk1.<br>If an SD-Card is not inserted in the SD card socket, eMMC will be enumerated as /dev/mmcblk0. In the following instructions /dev/mmcblkX(p1,p2) refers to the eMMC.}}
Line 153: Line 156:
 
</pre>
 
</pre>
 
* Remove MMC/SD card from SB-SOM-T43 MMC/SD card socket (if used for installation) and reboot the module.
 
* Remove MMC/SD card from SB-SOM-T43 MMC/SD card socket (if used for installation) and reboot the module.
 +
 +
===== Install Images on NAND =====
 +
* Format the NAND flash kernel partition and write the kernel image onto it:
 +
<pre>
 +
root@compulab:~# flash_erase /dev/mtd3 0 0
 +
root@compulab:~# nandwrite -p /dev/mtd3 /mount/point/zImage-cm-t43
 +
</pre>
 +
* Format the NAND flash dtb partition and write the device tree image onto it:
 +
<pre>
 +
root@compulab:~# flash_erase /dev/mtd4 0 0
 +
root@compulab:~# nandwrite -p /dev/mtd4 /mount/point/am437x-sb-som-t43.dtb
 +
</pre>
 +
* Format the NAND flash root filesystem partition:
 +
<pre>
 +
root@compulab:~# ubiformat /dev/mtd5
 +
</pre>
 +
* Attach the NAND flash root filesystem partition:
 +
<pre>
 +
root@compulab:~# ubiattach -m 5 -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 --numeric-owner -xpf /mount/point/debian-image.tar.bz2 -C /media/rootfs && sync
 +
</pre>
 +
* Unmount the ubi volume:
 +
<pre>
 +
root@compulab:~# umount /media/rootfs
 +
</pre>
 +
* Reboot the CM-T43 Evaluation system.
  
 
== After Installation ==
 
== After Installation ==
Line 160: Line 200:
 
<pre>
 
<pre>
 
CM-T43 # setenv bootargs "root=/dev/mmcblkXp2 rw rootfstype=ext4 rootwait console=ttyO0"
 
CM-T43 # setenv bootargs "root=/dev/mmcblkXp2 rw rootfstype=ext4 rootwait console=ttyO0"
 +
</pre>
 +
* Set the {{parameter|bootcmd}} environment variable and save the environment:
 +
<pre>
 +
CM-T43 # setenv bootcmd 'mmc dev 1 && mmc rescan && load mmc 1 ${loadaddr} zimage-cm-t43 && load mmc 1 ${fdtaddr} am437x-sb-som-t43.dtb && bootz ${loadaddr} - ${fdtaddr}'
 +
CM-T43 # saveenv
 
</pre>
 
</pre>
 
* To boot Linux, type:
 
* To boot Linux, type:
 
<pre>
 
<pre>
CM-T43 # setenv bootdelay 3
+
CM-T43 # boot
CM-T43 # setenv bootcmd 'mmc dev 1 && mmc rescan && load mmc 1 ${loadaddr} zimage-cm-t43 && load mmc 1 ${fdtaddr} am437x-sb-som-t43.dtb && bootz ${loadaddr} - ${fdtaddr}'
+
</pre>
 +
 
 +
=== Boot from NAND ===
 +
* Set the {{parameter|bootargs}} environment variable:
 +
<pre>
 +
CM-T43 # setenv bootargs "console=ttyO0,115200n8 root=ubi0:rootfs rw rootfstype=ubifs ubi.mtd=rootfs"
 +
</pre>
 +
* Set the {{parameter|bootcmd}} environment variable and save the environment:
 +
<pre>
 +
CM-T43 # setenv bootcmd 'nand read ${loadaddr} 0 980000 && nand read ${fdtaddr} 980000 80000 && bootz ${loadaddr} - ${fdtaddr}'
 
CM-T43 # saveenv
 
CM-T43 # saveenv
 +
</pre>
 +
* To boot Linux, type:
 +
<pre>
 
CM-T43 # boot
 
CM-T43 # boot
 
</pre>
 
</pre>

Revision as of 17:29, 6 July 2015

Introduction

This article provides an introduction on how to install the Debian example root filesystem image on the CompuLab CM-T43 System-on-Module / Computer-on-Module eMMC internal storage.

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

Boot into the installation environment (ramdisk)

The first step in CM-T43 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 kernel.img, am437x-sb-som-t43.dtb, ramdisk.img and bootscr.img from Linux package for CM-T43 to the root directory on the first partition of the MMC/SD card.
  • Insert the MMC/SD card into the MMC/SD socket (P9) on the SB-SOM-T43 baseboard.

Use the following U-Boot commands to start installation environment boot:

CM-T43 # mmc dev 0
CM-T43 # mmc rescan
CM-T43 # load mmc 0 0x82000000 bootscr.img
CM-T43 # source 0x82000000

Using installation environment from USB storage device

  • Copy kernel.img, am437x-sb-som-t43.dtb, ramdisk.img and bootscr.img from Linux package for CM-T43 to the root directory on the first partition of the USB storage device.
  • Insert USB storage device into SB-SOM-T43 USB port (P6 or P26).
  • Remove MMC/SD card from the MMC/SD socket (P9) on the SB-SOM-T43 baseboard.
  • Use the following U-Boot commands to start installation environment boot:
CM-T43 # usb start
CM-T43 # load usb 0 0x88000000 am437x-sb-som-t43.dtb
CM-T43 # load usb 0 0x82000000 kernel.img
CM-T43 # load usb 0 0x88080000 ramdisk.img
CM-T43 # setenv bootargs "root=/dev/ram0 rw ramdisk_size=16384 console=ttyO0,115200n8 vram=16M ip=dhcp"
CM-T43 # bootz 0x82000000 0x88080000 0x88000000

Using installation environment from TFTP server

  • Connect the SB-SOM-T43 Ethernet port (P21) to your local network.
  • Put kernel.img, am437x-sb-som-t43.dtb, and ramdisk.img from Linux package for CM-T43 to a location accessible by the TFTP server:
    - On Windows machine: copy kernel.img, am437x-sb-som-t43.dtb, and ramdisk.img to the same folder and point the TFTP server to that folder.
    - On Linux machine: copy kernel.img, am437x-sb-som-t43.dtb, and ramdisk.img to TFTP server root directory, usually /tftpboot or /tftproot.
  • You can use U-Boot dhcp command to obtain IP address
CM-T43 # dhcp
or manually set ipaddr environment variable:
CM-T43 # setenv ipaddr <CM-T43 ip address>
  • Use the following U-Boot commands to start installation environment boot:
CM-T43 # setenv bootargs "root=/dev/ram0 rw ramdisk_size=16384 console=ttyO0,115200n8 vram=16M ip=dhcp"
CM-T43 # tftpboot 0x88000000 am437x-sb-som-t43.dtb
CM-T43 # tftpboot 0x82000000 kernel.img
CM-T43 # tftpboot 0x88080000 ramdisk.img
CM-T43 # bootz 0x82000000 0x88080000 0x88000000

Install Kernel and Debian 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 kernel and Debian Linux images. One of the following media can be used as a source for installation:

Mount an MMC/SD Card
  • Copy the zImage-cm-t43, am437x-sb-som-t43.dtb and the debian-image.tar.bz2 from the Linux package for CM-T43 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.
  • Insert the MMC/SD card into the SD socket (P9) on the SB-SOM-T43.
  • 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 zImage-cm-t43, am437x-sb-som-t43.dtb and the debian-image.tar.bz2 from Linux package for CM-T43 to the root directory of any partition on the USB storage device.
  • Plug the USB storage device to any USB host port (P6 or P26) on the SB-SOM-T43.
  • 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 SB-SOM-T43 Ethernet port (P21) to your local network.
  • Copy the zImage-cm-t43, am437x-sb-som-t43.dtb and the debian-image.tar.bz2 from the Linux package for CM-T43 to a directory exported through NFS.
  • During Ramdisk image booting the CM-T43 attempts to obtain an IP address using DHCP. If from some reason the IP address has not been obtained, use the following commands to obtain IP address for the CM-T43:
    • Obtain IP using DHCP:
      root@compulab:~# ifup eth0
    • If there is no DHCP server on the network, you can set a static IP address using ifconfig:
      root@compulab:~# ifconfig eth0 <ip address>
  • Mount the NFS share containing the zImage-cm-t43, am437x-sb-som-t43.dtb and the debian-image.tar.bz2 files:
root@compulab:~# mount -o nolock <host ip>:/path/to/nfs/share /mnt/net

Install Images

  • In this subsection the term /mount/point can be:
    • /mnt/net if NFS is used
    • /media/mmcblk0pY if an MMC/SD card is used, where Y is the partition number.
    • /media/sdXY if USB storage is used, where X is the USB drive letter and Y is the partition number.
Install Images on eMMC
  • Create two partitions for the Linux kernel (FAT32 100M) and root file system (EXT4 the rest of the disk) on the eMMC.
Admolition note.png If an SD-Card is inserted in the SD card socket, eMMC will be enumerated as /dev/mmcblk1.
If an SD-Card is not inserted in the SD card socket, eMMC will be enumerated as /dev/mmcblk0. In the following instructions /dev/mmcblkX(p1,p2) refers to the eMMC.
root@compulab:~# echo -e "n\np\n1\n2048\n204800\na\n1\nt\nc\nn\np\n2\n204801\n\nw\neof\n" | fdisk -u /dev/mmcblkX
  • Refresh the device nodes:
root@compulab:~# mdev -s && umount /dev/mmcblkXp1 && umount /dev/mmcblkXp2
  • Format the first partition with FAT32 file system:
root@compulab:~# mkfs.vfat -n boot /dev/mmcblkXp1
  • Format the second partition with EXT4 file system:
root@compulab:~# mkfs.ext4 /dev/mmcblkXp2
  • Mount both partitions:
root@compulab:~# mkdir -p /media/mmcblkXp1 && mount /dev/mmcblkXp1 /media/mmcblkXp1
root@compulab:~# mkdir -p /media/mmcblkXp2 && mount /dev/mmcblkXp2 /media/mmcblkXp2
  • Copy the zImage-cm-t43 and the am437x-sb-som-t43.dtb to the first (FAT) partition:
root@compulab:~# cp /mount/point/zImage-cm-t43 /mount/point/am437x-sb-som-t43.dtb /media/mmcblkXp1 && sync
  • Extract the content of debian-image.tar.bz2 onto the second partition:
root@compulab:~# tar --numeric-owner -xvpjf /mount/point/debian-image.tar.bz2 -C /media/mmcblkXp2 && sync
  • Remove MMC/SD card from SB-SOM-T43 MMC/SD card socket (if used for installation) and reboot the module.
Install Images on NAND
  • 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/zImage-cm-t43
  • Format the NAND flash dtb partition and write the device tree image onto it:
root@compulab:~# flash_erase /dev/mtd4 0 0
root@compulab:~# nandwrite -p /dev/mtd4 /mount/point/am437x-sb-som-t43.dtb
  • Format the NAND flash root filesystem partition:
root@compulab:~# ubiformat /dev/mtd5
  • Attach the NAND flash root filesystem partition:
root@compulab:~# ubiattach -m 5 -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
  • Reboot the CM-T43 Evaluation system.

After Installation

Boot from eMMC

  • Set the bootargs environment variable:
CM-T43 # setenv bootargs "root=/dev/mmcblkXp2 rw rootfstype=ext4 rootwait console=ttyO0"
  • Set the bootcmd environment variable and save the environment:
CM-T43 # setenv bootcmd 'mmc dev 1 && mmc rescan && load mmc 1 ${loadaddr} zimage-cm-t43 && load mmc 1 ${fdtaddr} am437x-sb-som-t43.dtb && bootz ${loadaddr} - ${fdtaddr}'
CM-T43 # saveenv
  • To boot Linux, type:
CM-T43 # boot

Boot from NAND

  • Set the bootargs environment variable:
CM-T43 # setenv bootargs "console=ttyO0,115200n8 root=ubi0:rootfs rw rootfstype=ubifs ubi.mtd=rootfs"
  • Set the bootcmd environment variable and save the environment:
CM-T43 # setenv bootcmd 'nand read ${loadaddr} 0 980000 && nand read ${fdtaddr} 980000 80000 && bootz ${loadaddr} - ${fdtaddr}'
CM-T43 # saveenv
  • To boot Linux, type:
CM-T43 # boot

See also