Part 5 - Booting x-Loader and u-Boot from SD-Card

Information all about the Zoom MDK and handling Android on it.

Part 5 - Booting x-Loader and u-Boot from SD-Card

Postby plusminus » Wed Jun 25, 2008 4:34 pm

Part 5 - Booting x-Loader and u-Boot from SD-Card


Time to go "old school" here and remember back to the days where disks used Cylinder, Head, and Sector (CHS) formatting. For the OMAP to find and boot off the SD Card, the first primary partition must contain a FAT32 partition formatted with 255 heads and 63 sectors. It is very specific, but not hard to setup.
Formatting the SD Card
Since putting a Linux file system on a FAT32 partition is problematic, it is recommended to create 2 partitions. The first partition is a boot partition between 64-128 Megabytes and the second partition is a Linux partition consuming the rest of the card.
Plug your SD card into your Linux box - do not mount it. For this example, we will assume the card shows up as /dev/sdc - substitute this for the real device on your specific machine.
Fdisk the drive and print the partition information
Code: Select all
fdisk /dev/sdc
Command (m for help): p
Disk /dev/sdc: 1018 MB, 1018691584 bytes
...<more>...


Look for the size in bytes of the device and calculate the number of cylinders, dropping factions, if we have 255 heads and 63 sectors.

new_cylinders = Size / 8225280 (for this example we will have 993001472 / 8225280 which equals 120.725 or 120 cylinders)

Since we are changing the underlying geometry of the disk, we must clear the partition table before doing it. So delete all partitions using the fdisk 'd' command - yes, you will lose all data on the card. Once that is done, we can set the new geometry in expert mode. We will set the # of heads to 255, # of sectors to 63, and # of cylinders to new_cylinders.
Code: Select all
Command (m for help): x
Expert command (m for help): h
Number of heads (1-256, default 30): 255
Expert command (m for help): s
Number of sectors (1-63, default 29): 63
Warning: setting sector offset for DOS compatiblity
Expert command (m for help): c
Number of cylinders (1-1048576, default 2286): 120


Now we return to the main menu and create our 2 partitions as needed - 1 boot partition of 64Meg and the rest a linux partition.
Code: Select all
Expert command (m for help): r
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-123, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-123, default 123): +64M

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (10-123, default 10):
Using default value 10
Last cylinder or +size or +sizeM or +sizeK (10-123, default 123):
Using default value 123


Set the partition type of the first partition to FAT32 and make it active.
Code: Select all
Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))


* You have to format 1st partitions with vfat32 filesystem.

Code: Select all
Command (m for help): a
Partition number (1-4): 1


The partition table should look something like the following. Notice the heads, sectors, and cylinders. Make sure partition 1 is active and FAT32. If it looks good - write the new partition information out.
Code: Select all
Command (m for help): p
Disk /dev/sdc: 993 MB, 993001472 bytes
255 heads, 63 sectors/track, 120 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 9 72261 c W95 FAT32 (LBA)
/dev/sdc2 10 120 891607+ 83 Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.


Formating the partitions
Format the filesystems on the partitions
Code: Select all
mkfs.vfat -F 32 -n boot /dev/sdc1
mkfs.ext3 /dev/sdc2


Installing the Boot Files
If you haven't already built them, you will need a u-boot image and the signed nand xloader image.
Build x-loader (nand version)
Build UBoot

Create some mount point to use
Code: Select all
mkdir /tmp/mmc1
mkdir /tmp/mmc2
mount /dev/sdc1 /tmp/mmc1



mount /dev/sdc2 /tmp/mmc2


Copy x-loader, u-boot, and kernel images to the boot partition. You can have multiple kernel images and name isn't important. Note: The signed x-loader must be called MLO on the card.
Code: Select all
cp x-load-nand-signed.bin /tmp/mmc1/MLO
cp u-boot.bin /tmp/mmc1/u-boot.bin
cp kernel.uImg /tmp/mmc1/kernel-x.x.uImg
umount /tmp/mmc1
umount /tmp/mmc2


Insert the card into the OmapZoom and reboot or hit the HARDWARE-reset-Button. x-loader should start and you should see the following message from the x-loader on boot.
Code: Select all
Texas Instruments X-Loader? 1.41
Starting OS Bootloader from MMC/SD1 ...


If you see the the following output, then congratulations, you have booted from MMC. :)

Maybe you'll need to add some bootargs to boot from MMC:

Code: Select all
setenv bootargs console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootdelay=1 mem=128M
nand unlock
saveenv


Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Postby ollo » Thu Nov 06, 2008 10:13 pm

When I downloaded the x-loader, uboot and the kernel to the SD card, loading the kernel failed, because the file was not available.

When displaying the content of the first partition with the following command the file was not available:
Code: Select all
mmcinit
fatls mmc 0


To resolve this problem, I formated the partition with FAT 16 and secured, that the kernel name was shorter than 8 characters and as extension I used img instead of uImg, because this are only 3 charactes.
It worked in my case with
Code: Select all
kernel26.img


Hopefully this helps someone with the same problem.

Ollo
ollo
Freshman
Freshman
 
Posts: 8
Joined: Thu Nov 15, 2007 11:38 am

Top

Return to Zoom MDK

Who is online

Users browsing this forum: No registered users and 1 guest