The OMAP processor follows a 2 stage boot process. The first stage is loaded into the internal static ram by the ROM code. Because the internal static ram is very small (64k), the first stage loader is needed to initialize memory and enough of the peripheral devices to access and load the second stage loader into main memory. It is the job of the second stage loader to initialize the remaining hardware and prepare the system for kernel boot.
First Stage Boot
The internal ROM Code will attempt to boot from 3 different peripherals in the following order: serial, SD Card, and Nand.
- A simple ID is written out of the serial port. If the host responds correctly within a short window of time, the ROM will will read from the serial port and transfer the data to the internal sram. Control is passed to the start of sram if no errors are detected.
SD Card Boot
- Assuming there was no answer from the host during serial boot, the ROM looks for an SD Card on the first MMC controller. If a card is found, the ROM then looks for the first FAT32 partition within the partition table. Once the partition is found, the root directory is scanned for a special signed file called "MLO". Assuming all is well with the file, it is transfered into the internal sram and control is passed to it.
- Assuming the SD Card boot was unable to complete successfully, the ROM attempts to load the first sector of Nand. If the sector is bad, corrupt, or blank, the ROM will try the next sector (up to 4) before exiting. Once a good sector is found, the ROM transfers the contents to sram and transfers control to it.
Second Stage Boot
The second stage of the boot is done by the x-loader installed from the first stage. There are different versions of the x-loader corresponding to each of the devices that can be loaded from. It is the job of the x-loader to transfer the 2nd stage loader into main memory. Usually you will use the x-loader that corresponds to the type of boot you are attempting - i.e. you would use the serial x-loader for a serial boot and the nand x-loader for a nand boot. However, you don't have to. For example, you could flash the serial x-loader into the nand. The rom will load from nand and transfer control to the x-loader which will wait for the 2nd stage to be downloaded from the serial port.
- The serial x-loader waits for the host to initiate a kermit connection to reliably transfer large files into main memory. Once the file transfer is completed successfully, control is transfered.
SD Card Boot
- The SDCard x-loader looks for a FAT32 partition on the first MMC controller and scans the top level directory for a file named "u-boot.bin". It then transfers the file into main memory and transfers control to it.
- The nand x-loader expects u-boot to be loaded at the 5th sector (offset 0x00800000). It transfers the image from nand into main memory and transfers control to it.
Serial Boot Procedure
Software & Tools
You will need the following software:
- X-loader built to load a 2nd stage bootloader over a serial connection. Instructions found here.
- The u-boot boot-loader for the Zoom. Instruction to build and pre-built images can be found here.
- The serial-boot.pl script from the Zoom support-tools project. Please note that this perl script is dependent on the perl Device::SerialPort? module which may or may not be included in your Linux host distribution. You can download and install the module manually from here or use your Linux host's package manager to install it. For example...
To install this module on a Fedora Host execute:
"yum install perl-Device-SerialPort?"
To install this module on a Debian/Ubuntu execute:
"apt-get install libdevice-serialport-perl"
- Kermit. For this example, we use C-Kermit.
- A Linux host with a serial port that supports the UART Status IOCTL (TIOCSERGETLSR) otherwise the serial-boot.pl script will not work. It was found that some usb-to-serial adaptors do not support this.
Downloading U-boot Over A Serial Connection
- Power-off the Zoom
- Connect the Zoom to the host's serial port.
- Execute the serial-boot.pl script as follows:
./serial-boot.pl -p <serial-device> -s <path>/x-load-serial.binFor example:
./serial-boot.pl -p /dev/ttyS0 -s /home/user/x-load-serial.bin
- Power-on the Zoom and the x-loader download should start.
- Once x-loaded has been downloaded successfully, execute the following command to start the kermit transfer of u-boot.
kermit -C "set line <your serial device>,set speed 115200,set flow-control rts/cts,set carrier-watch off,set prefixing all,send u-boot.bin,connect"For example:
kermit -C "set line /dev/ttyS0,set speed 115200,set flow-control rts/cts,set carrier-watch off,set prefixing all,send u-boot.bin,connect"
- Once the kermit transfer has completed, you should see u-boot start-up. At this point you can follow the nand flashing procedure below to flash an x-loader and u-boot into the nand.
Nand Boot / Flashing Procedure
This procedure assumes you have a working u-boot up and running in memory either via JTAG, the Serial Boot procedure above, SD card boot procedure below or an older version installed in the on-board Nand.
If you haven't already, you will need a u-boot image and the nand xloader image.
Build x-loader (nand version)
Flashing u-boot into nand
First, you will need to get the u-boot image into memory. If you followed the "Serial boot procedure" above, u-boot is already in memory at address 0x80008000
Fetching u-boot via dhcp.
You will need to have a dhcp server on the network and a host running a tftp server with the file u-boot.bin
setenv serverip 220.127.116.11 dhcp 80008000 u-boot.bin
Flashing u-boot into the Nand (be careful with the number of zeros)
nand ecc sw nand unlock 80000 80000 nand erase 80000 80000 nand write 80008000 80000 80000
Fetching x-loader via dhcp
You will need to have a dhcp server on the network and a host running a tftp server with the nand version of the x-loader.
setenv serverip 18.104.22.168 dhcp 80c00000 x-load-nand-signed.bin
Flashing x-loader into the Nand (Note: need to use hw ecc for this)
nand ecc hw nand unlock 0 80000 nand erase 0 80000 nand write 80c00000 0 20000 nand write 80c00000 20000 20000 nand write 80c00000 40000 20000 nand write 80c00000 60000 20000
SD Card Boot Procedure
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
sudo fdisk /dev/sdc Command (m for help): p Disk /dev/sdc: 1018 MB, 993001472 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.
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): <new_cylinders calculated from above>
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.
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.
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. 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.
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
Note: Both partitions may be mounted. The partitions need to be un-mounted prior to continuing. This action can be done by using the following commands (partitions names may vary):
Format the filesystems on the partitions:
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)
Create some mount point to use
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.
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
Assuming the filesystem is in ~/bin/myfs/:
cp –Rfp ~/bin/myfs/* /tmp/mmc2
sudo chmod –R 777 /tmp/mmc2/*
Insert the card into the ZoomII and reboot or hit the reset. x-loader should start and you should see the following message from the x-loader on boot.
Starting OS Bootloader from MMC/SD1 ...
If you see the "from MMC/SD1", then congratulations, you have booted from MMC.
|Item ID||Associated Item||Comment|
|No Associated Items Found|