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

From: Jim Kasper <[email-masked]>
Date: Fri, 14 Jul 2000 12:19:38 -0400

Sam, 
     I had same problem, and while I am sure there must be a more elegant
way, I ended up doing as Tom suggested. I did a make on the images
seperatly, The boot part set with ld_script to 0x00, the second image set to
a ram location. My little script then checked sizes and combined images.

 #!/bin/sh
# little script gets size of first  from current dir
# and size of second from different source tree
#copies first to a file, pads it out, then adds second

size_boot=`ls -l boot_obj|awk '{print $5}' `
size_top=`ls -l /usr/src/zblob/src/util.obj|awk '{print $5}' `
#copy first object
dd if=boot_obj of=sboot
#pad with zeroes to 64K

dd bs=1c if=/dev/zero of=sboot seek=$size_boot count=$((65536-$size_boot))
# seek to boundry, copy second file
dd bs=1c if=/usr/src/zblob/src/util.obj  of=sboot seek=65536c
count=$size_top

uuencode sboot  freddy > sboot.uu

-----Original Message-----
From: Tom Walsh
To: [email-masked]
Cc: [email-masked]
Sent: 07/14/00 11:20
Subject: Re: Need method to combine multiple binary images into one. (ld?)

S A McConnell wrote:
> 
> 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?

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

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

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

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

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

---

From: Adam 'WeirdArms' Wiggins <[email-masked]>
Date: Sun, 16 Jul 2000 08:56:19 +1000 (EST)

I have a program using libbfd which merges multiple elf (and other
format) executables into a single elf file. Each executable is given its
own program segment. If your interested look at
ftp://ftp.cse.unsw.edu.au/pub/users/awigins it's in the ediot*.tar.gz
archive.

	Cheers Adam