Create uboot bootable image using mkimage

by 23:36 0 comments
I followed http://wiki.osdev.org/ARM_Beagleboard to create a simple startup program for my beaglebone. In that tutorial, we copy the file to a address using tftp and use "go" command to transfer the control.

But, normally we use a uboot compatible format to boot the images using "bootm" command. To make our image in this format, we use "mkimage" command. You need to download uboot source and build this mkimage

The command we are going to use is

mkimage -A arm -O myARM -T kernel -C none -a 0x80200000 -e 0x80200040 -n kernel -d boot.bin os_uImage

-A -- architecture type

-O -- os type

-T -- type of image

-C -- compression used

-a -- load address

-e -- entry point

-d -- data file to be booted

os_uImage -- resultant uboot compatible image

To boot the image follow the following commands


U-Boot# setenv ipaddr 10.117.83.43
U-Boot# setenv serverip 10.117.83.34
U-Boot# tftp 0x80200000 os_uImage
link up on port 0, speed 100, full duplex
Using cpsw device
TFTP from server 10.117.83.34; our IP address is 10.117.83.43
Filename 'os_uImage'.
Load address: 0x80200000
Loading: #
         44.9 KiB/s
done
Bytes transferred = 92 (5c hex)
U-Boot# bootm
## Booting kernel from Legacy Image at 80200000 ...
   Image Name:   kernel
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    28 Bytes = 28 Bytes
   Load Address: 80200000
   Entry Point:  80200040
   Verifying Checksum ... OK
   XIP Kernel Image ... OK

Starting kernel ...

@@@



I made the image to hang so that we can see the output.

The advantage is we can specify image name and we can do compression on our command. If we use go command it needs to be raw data file. By using bootm command we can use all the facilities provided by uboot.

Initially, my tries failed because I gave load address and entry point to be the same. Then I changed the entry point to load_addr+ 0x40 and boot succeeded.
 This is just a trial and error since the my data file started at that address in the resulting uImage. 0x40 bytes for uboot header I guess. I must check this and confirm if it is okay.

Unknown

Developer

Open Source Ethusiast.

0 comments:

Post a Comment