Skip to contentSkip to conversation

mkimage multi file use?

U-Boot-Users Tom Guilliams 2 participants 4 messages Aug 18, 2003

lore
Share & tools
lore
#0 lore raw

I know this has been addressed before but I no longer have access to my U-Boot list archive on my PC and finding on the SourceForge list has proved troublesome such as it keeps telling me it's not accessible right now on the SoureForge page! Is there any place I can dowload the archives?

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.

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!

Tom

#1 lore raw

Dear Tom,

Quoted 2 lines · in message <[email protected]> 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).

Quoted 3 lines

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
Quoted 5 lines

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

Signature · 3 lines
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.
#2 lore raw
Quoted 4 lines · Wolfgang Denk

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).

OK, well I may take you up on that but I'll get back to you. I hate having to ask questions I know have been answered already.

Quoted 5 lines

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

Hmmm... include/image.h talks about having byte counts in there as well. Maybe I'm just confused. I'll recheck it.

Quoted 6 lines

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).

Thank you. Very helpful. Can't believe I missed the README reference! Ugh!

Quoted 23 lines

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
Quoted 4 lines

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

Very much appreciated. Thanks again!

Tom

#3 lore raw

Dear Tom,

Quoted 3 lines · in message <[email protected]> you wrote:

OK, well I may take you up on that but I'll get back to you. I hate having to ask questions I know have been answered already.

I am dissatisfied with the availability and efficiency of the search options at SF, too.

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

Hmmm... include/image.h talks about having byte counts in there as well. Maybe I'm just confused. I'll recheck it.

The byte counts are generated and inserted by the mkimage tool.

Quoted 2 lines

Thank you. Very helpful. Can't believe I missed the README reference! Ugh!

That text was added less than 6 months ago, so you might have missed it when you read an older version of the README.

Quoted 1 line

Very much appreciated. Thanks again!

You are welcome.

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
Fascinating is a word I use for the unexpected.
	-- Spock, "The Squire of Gothos", stardate 2124.5