NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

How to boot OMAP-L138 LCDK from SD card

From Texas Instruments Wiki
Jump to: navigation, search

The default dip switch settings for the OMAP-L138 LCDK is NAND boot mode. What this means is the OMAP-L138 processor will load U-Boot pre-programmed in the NAND flash which in turn loads the Linux kernel from the provided SD card.

For some reason if the flashed U-Boot in NAND got erased or corrupted, you can restore it using the steps outlined in the "Restoring U-Boot on a bricked LCDK". Alternately, you can prepare a bootable SD card that includes U-Boot, Linux Kernel and Filesystem using the following steps.

Summary of Steps:[edit]

  1. Build U-Boot for SD/MMC boot.
  2. Generate AIS version of U-Boot using AISGen.
  3. Create SD card with 2 partitions for Linux kernel and filesystem.
  4. Flashing u-boot.ais to the SD card.
  5. Settings DIP switches to SD/MMC boot mode.
  6. Setting Bootargs and Bootcmd.

Detail Procedure[edit]

Build U-Boot for SD/MMC boot[edit]

The following 2 sections include steps on how to create an AIS formatted U-Boot binary for MMC/SD boot for the LCDK.  Prebuilt images (uflash and u-boot-mmc.ais) are included here for convenience. 

NOTE

The released U-boot package requires a patch to be integrated. Find the patch here

Unzip the uflash.zip and copy the patch to the linux host where u-boot source is located. Follow below command to integrate it:

cd ti-sdk-omapl138-lcdk-01.00.00/board-support/u-boot-2010.12-psp03.21.00.04.lcdk/
patch -p1 < 0001-uflash-Add-support-to-write-ubl-to-MMC-SD-in-OMAPL13.patch 

This patch adds the required support to write u-boot binary to the SD/MMC card.




The u-boot package is under the 'board-support' directory. Untar it with the below command,

host $ tar jxf $TI_SDK_PATH/board-support/u-boot-2010.12-psp03.21.00.04.lcdk.bz2

Go to the U-Boot directory when the above extraction is done. Run the below command to build U-Boot
It is assumed that arago tool chain is already present in the $PATH variable. If not, use this link to add it.

host $ make distclean CROSS_COMPILE=arm-arago-linux-gnueabi-
host $ make omapl138_lcdk_config CROSS_COMPILE=arm-arago-linux-gnueabi-
host $ make all CROSS_COMPILE=arm-arago-linux-gnueabi-

Generate AIS version of U-Boot using AISGen[edit]

RBL expects boot loader binary in the ais format. So the built u-boot.bin needs to be converted into ais format.

  1. Download and install the AIS converter tool from here. Note it is a MS-Windows (tm) install.
  2. Download the LCDK configuration file for the AIS converter tool from here.
  3. Load the configuration in AISgen by going to File -> Load Configuration.
  4. Copy your u-boot image to your PC. Having it accessible by Windows through a network share is suggested to make this easier.
  5. If you're not using the LCDK then be sure to adjust the Clock source and associated speed to match your hardware.
  6. If your version of u-boot does not expect to be loaded and run from 0xC1080000 then change the Entrypoint as needed. The u-boot from the MCSDK expects to be at that address.
  7. For "ARM Application File" you should select your u-boot.bin file. Be sure to modify the @<address> to be at 0xC1080000. This should match the entry point you specified. It defaults to 0x80000000 so be sure to change it!
  8. Choose a location for the AIS Output File. The first screen should now look something like this:
    LCDK MMC AISgen3.jpg
  9. The peripheral clock sets the MMC/SD clock to 25 MHz. Not all SD cards can support high speed mode (50 MHz), but 25 MHz is always safe.
  10. For the DDR tab these values should be calculated for your hardware using the spreadsheet on this page.
  11. For the PSC tab you may want to enable all the peripherals/domains. Do NOT enable SATA as that cannot be enabled by the ROM. Once you have everything working you could remove a few.
  12. Click "Generate AIS" to create your output binary that is now in the AIS format expected by the boot ROM.

Create SD card with 2 partitions for Linux kernel and filesystem[edit]

The RBL searches for the first stage boot loader image in 1st to 25th sector of the SD card. Sector 0 is used for storing DOS partition information. Hence the u-boot descriptor is stored from sectors 1 till 24. The descriptor is 512 bytes in size and is replicated in each of these sectors. The SD card shall be re-partitioned and formatted to create some room for storing u-boot and another two partition to store uImage and filesystem. Use fdisk utility in the host pc (as super user) to delete the existing partitions and create another two partitions with vfat and ext2 filesystem.

 
fdisk /dev/mmcblk0 (device name might change if USB card reader is used)

Device name can be found by running dmesg command.

Follow below procedure to create the partitions

  • Run the fdisk command (as shown above with the sudo permission).
  • Delete all the existing partition with 'd' command. 'p' will print the existing partitions, make sure all the partitions are deleted.
  • Create a new partition with the 'n' command followed by 'p' (primary partition).
  • Mark the first cylinder as 20. Typical cylinder size is 32KB. So starting the first cylinder at 20 provides us about 600KB for storing u-boot. If the fdisk utility displays a different cylinder size, make sure that you are leaving at least 500KB space before the first partition.
  • Enter +10M for the message 'Last sector, +sectors or +size{K,M,G}'. This will allocate 10MB for the first partition. This partition is used to store uImage.
  • Create another partition for filesystem. This can be done by entering 'n' followed by 'p'. Set the First and Last sector to its default value.
  • Save and exit with 'w' command.
  • Once the above procedure is done, two SD device nodes will be created. For example: /dev/mmcblk0p1 and /dev/mmcblk0p2. This might be different depending upon how its connected.
  • Format the first partition with the vfat fs.
mkfs.vfat /dev/mmcblk0p1
  • Format the second partition with ext2 fs.
mkfs.ext2 /dev/mmcblk0p2
  • Mount the first partition and copy uImage there.
  • Mount the second partition and copy LCDK fs. Once the copying is done, unmount both the partitions safely.

Also, you can refer to the following TI E2E post which has every steps for formatting the SD card in right format.

http://e2e.ti.com/support/dsp/omap_applications_processors/f/42/p/327704/1141451#1141451

Flashing AIS U-Boot image to the SD card[edit]

uflash is the utility which is used to flash boot loader to the SD card. uflash is part of u-boot source and is present in the tools/uflash directory. It will get built with U-Boot source. Keep the uflash and u-boot.ais in the available location and run the below command from the host PC.

NOTE: 
Make sure that the device node which is given to uflash is that of the MMC/SD. Also make sure that MMC/SD device node is provided
not the MMC/SD's partition device nodes.
./uflash -d <SD device node> -u <u-boot-ais-image> -p OMAPL138 -vv
example:
./uflash -d /dev/mmcblk0 -u u-boot_mmc.ais -p OMAPL138 -vv

Settings DIP switches to SD/MMC boot mode[edit]

Insert the micro-SD card to the LCDK board. Make sure micro-SD card is flashed properly with the u-boot image. Set the boot pins as below to boot from the SD card,

Pin# 1 2 3 4
Position OFF OFF OFF ON

Setting Bootargs and Bootcmd[edit]

Bootcmd should be set to copy and boot uImage from the first partition of the micro-SD card. The bootargs should be set to take root filesystem from the second partition of the micro-SD card.

setenv bootargs 'mem=32M console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootwait ip=off'
setenv bootcmd 'mmc rescan 0;fatload mmc 0 0xc0700000 uImage; bootm c0700000;'
E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article How to boot OMAP-L138 LCDK from SD card here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article How to boot OMAP-L138 LCDK from SD card here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article How to boot OMAP-L138 LCDK from SD card here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article How to boot OMAP-L138 LCDK from SD card here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article How to boot OMAP-L138 LCDK from SD card here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article How to boot OMAP-L138 LCDK from SD card here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article How to boot OMAP-L138 LCDK from SD card here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article How to boot OMAP-L138 LCDK from SD card here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article How to boot OMAP-L138 LCDK from SD card here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity