Re: PATCH/RFC: bzImage payload as compressed ELF file.

From: Ian Campbell
Date: Tue Jan 29 2008 - 15:41:25 EST



On Tue, 2008-01-29 at 10:34 -0800, H. Peter Anvin wrote:
> Jeremy Fitzhardinge wrote:
> > H. Peter Anvin wrote:
> >> It's also easy enough to either use objdump -h or nm to extract info
> >> from vmlinux; or for some of the simpler stuff, just parse the ELF
> >> directly (perhaps using libelf).
> >>
> >> There is also the -R option to ld, which imports symbols from one
> >> executable into another.
> >
> > Yes, I used -R, though it was necessary to generate a copy of vmlinux
> > with a filtered symbol list to prevent collisions. But I'm not sure any
> > of this is necessary with Ian's approach.
> >
>
> Probably isn't. He just need the start and possibly length of the
> payload section, which should be objdump -h or equivalently reading the
> ELF section table.

I'm currently using "objcopy --extract-symbol -w -N \* -K input_data" to
create a .o with just the symbol I'm interested in and using -R on that.
There's also an option to add a prefix to all symbols which might be
useful.

I finessed the length issue slightly since it happens that the word
before the payload is the payload's length. I'm mulling a variety of
options:
* declare it compression scheme dependant. At least for gzip it
knows when it has reached the end.
* codify the length followed by data thing we happen to have now
* add a length field to the header, using another 4 bytes (is
there any pressure on the size of the header?).

I'd probably go with the later unless we are pressed for space in the
header.

Ian.
--
Ian Campbell

Man who falls in vat of molten optical glass makes spectacle of self.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/