Creating filesystems on removable media

From Texas Instruments Wiki
Jump to: navigation, search


This page describes a procedure to create and use removable media (USB pendrives or MMC/SD cards) to boot the OMAP-L137 EVM board. It requires the use of Linux and its tools for partitioning disks.

Introduction

Due to the reduced available flash memory on board and unlike other development boards from TI, OMAP-L137 EVM developers that want to create a standalone Linux-based system have to go through additional steps to accomplish this.

In this case, the use of the common NFS remote booting procedure is not desired since it requires a wired ethernet connection and remote NFS and TFTP servers.

This article describes a method for creating and booting a standalone system using the two removable media storage interfaces available on the OMAP-L137 EVM.

This page is also a good exercise of the flexible OMAP-L137 EVM boot process.

Note: the current Beta SDK does not have a fully featured USB support, therefore be advised the procedure below does not work for all brands of USB pendrives.

This page refers to the following wiki articles:

  1. The boot sequence of OMAP-L137 and useful tips to configure SPI Flash:
    Omapl137_linux_bootup
  2. Example to configure NFS and TFTP servers in a Linux PC for network booting:
    Before_the_Getting_Started_Guide
  3. Teraterm scripts to configure U-boot for OMAP-L137 EVM:
    Teraterm_Scripts#Are_there_any_OMAPL137_examples.3F

And makes extensive use of parted, an open source software used to create the partitions on the disks. Its manual is located at: http://www.gnu.org/software/parted/manual/parted.html

Preparing the U-boot and the Linux kernel to be loaded

MMC/SD preliminary steps

U-Boot does not support reading the Linux kernel from the SD/MMC card. However, the Linux kernel does support SD/MMC so an SD/MMC card can be used for the target root file system as described below.

USB pendrive preliminary steps

  • Enabling USB support in U-boot (MontaVista Linux based SDK)

For the USB pendrive, however, support must be enabled in both U-boot and in the Linux kernel.

The U-boot sources must be installed (unzip file <u-boot-1.3.3.tar.gz>). In <LSP_02.20_OMAP-L137_User_Guide.pdf> check section 2.3 item 5 for its location.

Section 5.4.3 shows the two required changes to the file /OMAPL137_dsp_1_00_00_07/REL_LSP_02_20_00_05/PSP_02_20_00_05/board_utilities/u-boot-1.3.3/include/configs/da8xx_evm.h. The provided U-boot source code already contains these two options enabled:

/*==============================*/
/* U-Boot general configuration */
/*==============================*/
...
#define CONFIG_USB_DA8XX
#define CONFIG_USB_STORAGE
...

After making sure these options are enabled, go to section 4.1 that shows how to build U-boot.

  • Enabling USB support in U-boot (DaVinci GIT based SDK)

U-boot includes support for loading files from USB mass storage devices into memory. This section explains steps for configuring U-Boot to enable USB and mass storage support in U-Boot. It also shows U-Boot commands used for initializing and loading files from mass storage devices connected to USB 2.0 port on the EVM.

The default U-Boot image provided in the with PSP installation has USB MSC support enabled. For instructions on how to build U-Boot, refer to this page

  • Next Steps

Copy the generated U-boot file <u-boot.bin> to a Windows PC with CCS 3.3 installed and follow the procedures to write it to te SPI Flash memory. In this case it will only be necessary to write U-boot and not the DSP UBL or ARM UBL code.

Therefore, while flashing you must type uboot (instead of dspais) and you give the path and the name of the <u-boot.bin> file you just copied to the Windows PC. Everything else should be the same.

  • Enabling USB support in Linux kernel (MontaVista Linux based SDK)

The Linux kernel sources must also be installed. Check the installation procedure in section 3.3.

The note at the end of this section mentions the need to copy the kernel sources to a user defined area. It is suggested to copy it to the directory below: home/<useracct>/workdir/montavista/pro/devkit/lsp/ti-davinci_evm-arm_v5t_le/linux-2.6.18_pro500/

To configure the USB support, you must follow the procedure listed in section 5.2 and 5.2.1 in its entirety, even enabling the support to SCSI devices.

Therefore the entire procedure to rebuild the kernel is: Clear any previous configurations and create a new default configuration for OMAP-L137 EVM

make distclean ARCH=arm CROSS_COMPILE=arm_v5t_le-
make da830_omapl137_defconfig ARCH=arm CROSS_COMPILE=arm_v5t_le-

Then open the interactive configuration to enable the USB support (refer to section 5.2):

make menuconfig ARCH=arm CROSS_COMPILE=arm_v5t_le-

Build the Linux kernel <uImage> and all the modules and install them to your filesystem - make sure you modify the <useracct> with your Linux user account. See below how to install them to the prepared USB pendrive.

make uImage ARCH=arm CROSS_COMPILE=arm_v5t_le-
make modules ARCH=arm CROSS_COMPILE=arm_v5t_le-
make modules modules_install INSTALL_MOD_PATH=/home/<useracct>/workdir/filesys ARCH=arm CROSS_COMPILE=arm_v5t_le-

If you plan to use the NFS boot procedure in the future, you can copy the newly created Linux kernel to your root tftp directory:

sudo cp <lsp_install_dir>/montavista/pro/devkit/lsp/ti-davinci/linux-2.6.18_pro500/arch/arm/boot/uImage /tftpboot
  • Enabling USB support in Linux kernel (DaVinci GIT based SDK)

For instructions on how to enable USB support in Linux Kernel, refer to this page

Creating the removable media

The examples below assume a 2GB media mapped in Linux as /dev/sda

Make sure the media being modified is the correct one! If used without care, Parted can inadvertedly erase the contents of your Hard Disk!

To be sure the correct disk will be modified, use the option print of parted to show the device information:

sudo /sbin/parted /dev/sda print

Take note of the number of partitions in the column Number and the maximum size of the removable media shown in Disk /dev/sda:.

Remove all the existing partitions: (the example below shows the removal of two)

sudo /sbin/parted /dev/sda rm 1
sudo /sbin/parted /dev/sda rm 2

Note: It might be needed to unmount the partitions that will be removed.

MMC/SD card procedure

For the MMC/SD card, only one ext2 partition is needed:

sudo /sbin/parted /dev/sda mkpartfs primary ext2 0 2048M

If the Linux distribution has an automount feature, after running this command additional icons in your desktop and (maybe) file browser screens should appear in the screen. If it does not have the automount feature, the partition(s) must be mounted manually in a previously created directory (the example below assumes disk).

mount -t ext2 /dev/sda1 /media/disk

Now copy the target filesystem to the ext2 partition. Assuming that the target filesystem is at /home/<useracct>/workdir/filesys:

sudo cp -Rf /home/<useracct>/workdir/filesys /media/disk

All modules should be properly copied onto the target filesystem.

MontaVista Linux based SDK
  • If using the default Linux kernel provided with the installation:
sudo cp -Rf /opt/OMAPL137_arm_1_00_00_07/REL_LSP_02_20_00_05/PSP_02_20_00_05/bin/kernel_modules/* /media/disk-1

Or if using a compiled Linux kernel the modules can be installed directly to the target filesystem. Check in the procedure above or in section 5.3 of <LSP_02.20_OMAP-L137_User_Guide.pdf>:

make modules modules_install INSTALL_MOD_PATH=/media/disk-1 ARCH=arm CROSS_COMPILE=arm_v5t_le-
DaVinci GIT based SDK
  • If using the default Linux kernel provided with the installation:
sudo cp -Rf <sdk_install_dir>/images/kernel/omapl1x(7/8)/modules/* /media/disk-1

Or if using a compiled Linux kernel the modules can be installed directly to the target filesystem.

make modules modules_install INSTALL_MOD_PATH=/media/disk-1 ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-

USB pendrive procedure

For the USB pendrive you should create two partitions:

  • a FAT16 that contains the Linux kernel file uImage
  • a ext2 that contains the entire Linux filesystem
sudo /sbin/parted /dev/sda mkpartfs primary fat16 0 30M mkpartfs primary ext2 31M 2048M

If the Linux distribution has an automount feature, after running this command additional icons in your desktop and (maybe) file browser screens should appear in the screen. If it does not have the automount feature, the partition(s) must be mounted manually in a previously created directory (the example below assumes disk and disk-1).

mount -t vfat /dev/sda1 /media/disk
mount -t ext2 /dev/sda2 /media/disk-1

Copy the target filesystem to the ext2 partition.

sudo cp -Rf /home/<useracct>/workdir/filesys /media/disk-1

The <useracct> is your login.

MontaVista Linux based SDK

Copy the Linux kernel file uImage to the first partition

  • If using the default Linux kernel provided with the installation:
sudo cp /opt/OMAPL137_arm_1_00_00_07/REL_LSP_02_20_00_05/PSP_02_20_00_05/bin/uImage /media/disk
  • If using a compiled Linux kernel: (sections 4.2 and 5.3 of <LSP_02.20_OMAP-L137_User_Guide.pdf> and the errata at this page)
sudo cp <lsp_install_dir>/montavista/pro/devkit/lsp/ti-davinci/linux-2.6.18_pro500/arch/arm/boot/uImage /media/disk
DaVinci GIT based SDK

Copy the Linux kernel file uImage to the first partition

  • If using the default Linux kernel provided with the installation:
sudo cp <sdk_install_dir>/images/kernel/omapl1x(7/8)/uImage /media/disk
  • If using a compiled Linux kernel:
sudo cp <sdk_install_dir>/src/kernel/linux-#.#.#.#/arch/arm/boot/uImage /media/disk

Next steps

Booting with MMC/SD card

For the MMC/SD card, one additional step is required to write the Linux kernel to the onboard SPI Flash memory and have a true standalone system. You will need a working TFTP server to upload the <uImage> file to the board. At the U-boot prompt type the following commands:

tftp 0xc0700000 uImage
sf erase 0x1E0000 0x220000
sf write 0xc0700000 0x1E0000 0x220000

NOTE: The value 0x220000 is a byte count denoting the size of uImage and may need to be modified if the size of the Linux kernel increases.

From this point you can use the MMC/SD Teraterm script at this page

Booting with USB Pendrive

For the USB pendrive, the only step needed is to use the USB Pendrive Teraterm script at this page