Re: Stripped binary insertion with the GNU Linker suggestions (fwd)

Larry McVoy (lm@bitmover.com)
Fri, 11 Jul 2003 08:35:57 -0700


On Fri, Jul 11, 2003 at 04:19:55PM +0100, Jon Masters wrote:
> I have seen other nasty ways to do this involving converting the image to
> byte values in very large arrays or inserting literal byte values in to
> the output file but there just has to be a generic method for inserting
> an image in to the middle of an output file.

No, there isn't, at least I haven't found one. The BK installer does
exactly what you want (and you can have the source if you like, BSD
license) on the platforms listed below. We had to play some nasty
games to make this work, I believe it was HP-UX which "knew" that your
array was full of zeros and did not allocate it, it did it at runtime.
Any sort of predictable pattern it figured out, the following fools it
for now:

unsigned char data_data[3866327] = {
255,
6,
1,
2,
3,
4,
255,
3,
9,
62,
255,
10,
4,
61,
255,
};

platforms that this technique works on:

alpha-glibc22-linux
alpha-osf5.1
arm-glibc21-linux
hppa-glibc22-linux
hppa-hpux
ia64-glibc22-linux
mips-glibc22-linux
mips-irix
mipsel-glibc20-linux
powerpc-aix
powerpc-darwin6.6
powerpc-glibc21-linux
sparc-glibc21-linux
sparc-solaris
x86-freebsd2.2.8
x86-freebsd3.2
x86-freebsd4.1
x86-glibc20-linux
x86-glibc21-linux
x86-glibc22-linux
x86-netbsd
x86-openbsd
x86-sco3.2v5.0.7
x86-solaris

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