[U-Boot-Users] Re: mkimage multi file use?

Wolfgang Denk wd at denx.de
Mon Aug 18 20:19:26 CEST 2003


Dear Tom,

in message <3F4112FD.6080204 at san.rr.com> you wrote:
>
> now on the SoureForge page!  Is there any place I can dowload the archives?

Sorry,  I  have  no  idea.  If  really  needed,  I  can  arrange   to
(temporarily) put a copy of the U-Boot archive on our FTP server (the
bzip2ed tarball for U-Boot-Users is 22 MB, and 40 MB for PPCBoot).


> I haven't been successful referencing the include/image.h file on how to 
> use "mkimage -T multi".  Any examples out there?  Basically I just want 
> to create an U-Boot image of a gzipped kernel and ramdisk.

"mkimage" will print a help message when called without arguments:

	bash$ mkimage
	Usage: mkimage -l image
		  -l ==> list image header information
	       mkimage -A arch -O os -T type -C comp -a addr -e ep -n name -d data_file[:data_file...] image
		  -A ==> set architecture to 'arch'
		  -O ==> set operating system to 'os'
		  -T ==> set image type to 'type'
		  -C ==> set compression type 'comp'
		  -a ==> set load address to 'addr' (hex)
		  -e ==> set entry point to 'ep' (hex)
		  -n ==> set image name to 'name'
		  -d ==> use image data from 'datafile'


So try:

	bash$ mkimage -T multi -C gzip -a 0 -e 0 -n 'test multifile' \
	-d /path/to/kernel_image:/path/to/ramdisk_image uMulti


> Also, I received some pointers on how to extract the U-Boot header from 
> an image (thanks Wolfgang and Marc Singer!).  Now I'm going to want to 
> see if I can extract the kernel from a multi-file image.  I think this 
> will be similar to the header extract but any pointers are greatly 
> appreciated. Fightin the clock on this one!

See the README (section "More About U-Boot Image Types") for the file
format. This explains that with a mutlifile image with a kernel and a
ramdisk you will  have  to  skip  a  total  of  76  bytes  of  header
information (64 for U-Boot header + 4 for kernel size + 4 for ramdisk
size + 4 for terminating null).

So I recommend a three step approach:

	bash$ mkimage -l uMulti
	Image Name:   Linux-2.4.4-2003-04-05 Multiboot
	Created:      Sun Apr  6 12:44:18 2003
	Image Type:   PowerPC Linux Multi-File Image (gzip compressed)
	Data Size:    2610664 Bytes = 2549.48 kB = 2.49 MB
	Load Address: 0x00000000
	Entry Point:  0x00000000
	Contents:
	   Image 0:   715859 Bytes =  699 kB = 0 MB
	   Image 1:  1894792 Bytes = 1850 kB = 1 MB

	bash$ dd if=uMulti bs=76 skip=1 of=foo
	34350+1 records in
	34350+1 records out
	bash$ dd if=foo of=kernel.gz bs=715859 count=1
	1+0 records in
	1+0 records out
	bash$ gzip -vt kernel.gz 
	kernel.gz:       OK

The "bs=715859" uses the kernel data size as printed by the  "mkimage
-l" command.

Hope this helps.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
White dwarf seeks red giant for binary relationship.




More information about the U-Boot mailing list