Subject: Need method to combine multiple binary images into one. (ld?)

From: S A McConnell <[email-masked]>
Date: Fri, 14 Jul 2000 08:42:00 -0500

I am showing my lack of Linux/Unix experience....

I have five different binary images. To speed and simplify the
loading/Flashing process I would like to combine the images into a
single file placing each image at a set location. ( Image1 @ 0x0, Image2
@ 0x3800, Image3 @ 0x10000....) There will be holes between each image.

The images are all ARM binaries. The command 'file' describes them as
'data' files.

I tried to us arm-linux-ld but it complained about not knowing the
format. I looked in the documentation but did not see a way to tell the
linker to treat it as just data.

$file image1
image1:data

$arm-linux-gcc -Timage.ld image1 image2 image3 image4 image5
image1: file not recognized: File format not recognized
collect2: ld returned 1 exit status

INPUT(image1 image2 image3 image4 image5)

OUTPUT (bigimage)

SECTIONS 
{
	output :
	{
		image1
		. = 0x3800;
		image2
		. = 0x4000;
		image3
		. = 0x1000;
		image4
		. = 0x100000;
		image5
	}
}

-------------------------------
Does anyone have a suggestion about how to do this with or without the
linker?

Thanks,
SAM

unsubscribe: body of `unsubscribe linux-arm' to [email-masked]
++        Please use [email-masked] for           ++
++                        kernel-related discussions.                      ++

---

From: Tom Walsh <[email-masked]>
Date: Fri, 14 Jul 2000 11:20:34 -0400

> INPUT(image1 image2 image3 image4 image5)

Well, you are on the right track if the images were object files which
contained symbolic info identifying segments within the files.  If that
were the case, then you would need to create and 'ld' file that
specified which segment got placed into where.

But, if your file is pure, raw, binary data, I would suggest that you
write a quick program, or script, to append extra bytes to each image,
then cat them together.  Use 'dd' to spec the number & value of the
appended padding.

TomW

-- 
Tom Walsh - WN3L - Embedded Systems Consultant
'www.openhardware.net', 'www.cyberiansoftware.com'
"Windows? No thanks, I have work to do..."

---

From: Nicolas Pitre <[email-masked]>
Date: Fri, 14 Jul 2000 17:07:49 -0400 (EDT)

> @ 0x3800, Image3 @ 0x10000....) There will be holes between each image.

Easily done with:

	dd if=image1 of=result bs=1k
	dd if=image2 of=result bs=1k seek=14
	dd if=image3 of=result bs=1k seek=64
	...

The important thing is to apply each piece in offset order.

Nicolas