Linking with binary files
Daris A Nevil
dnevil@snmc.com
Wed Oct 4 06:29:00 GMT 2000
You can link binary files by first converting them to .elf format
(at least for the PPC architecture, not sure about wintel).
Here is a snippet of how this is done, using objcopy. This is
from the QSLinux makefile.
Enjoy,
Daris Nevil
zvmlinux: $(OBJECTS) vmlinux.gz qs850.lds
#
# build the boot loader image and then compute the offset into it
# for the kernel image
# Convert the vmlinux.gz to elf format. Merge the vmlinux.gz kernel
# into the linked boot program. Re-adjust the VMA of the .data section
# to match the LMA, where it is loaded into flash. This allows the
# visionIce 'convert' utility to see it, because 'convert' only seems
# to look at the VMA when loading modules.
# Finally, make a binary image that can be burned into flash by the
# SNMC "ff" program.
#
$(OBJCOPY) --input-target=binary --output-target=elf32-powerpc \
vmlinux.gz vmlinux.gz.elf
$(LD) $(ZLINKFLAGS) -o $@ $(OBJECTS) -T qs850.lds -M \
> zvmlinux.map
$(OBJCOPY) --change-section-vma .data=`sh lma $(OBJDUMP) $@
data` \
$@ $@.elf
cp $@.elf $(TOPDIR)/$@.elf
$(OBJCOPY) --input-target=elf32-powerpc --output-target=binary \
$@.elf $@.bin
cp $@.bin $(TOPDIR)/$@.bin
"Michael K. Elwood" wrote:
>
> Somebody recently asked about linking straight binary files (BDF
> type=binary) into their programs. Somebody else said that LD should be
> able to do this.
>
> My curiosity was sufficiently piqued, so I tried it (using the TARGET
> command and various other schemes), but I can't get it to work. Before I
> wade into the sources, does somebody else out there know how to get this
> to work? A snip of example command file would be great.
>
> Thanks.
>
> MKE
>
> --
> **********************************************************
> Michael K. Elwood mkelwood@qsicorp.com
> QSI Corporation
>
> The fourth(?) Law of Thermodynamics:
> (Work in Theory) <= (Work in Practice)
> **********************************************************
>
> ------
> Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
--
Daris A Nevil
Simple Network Magic Corporation
401 Kentucky Lane
McKinney, TX 75069
214-793-7757
dnevil@snmc.com
www.snmc.com
quickstack.com
qslinux.org
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
More information about the crossgcc
mailing list