kernel presentation at ILUG on Sat.

Charles Steinkuehler charles at steinkuehler.net
Mon May 5 18:36:25 CDT 2003


Jason Clinton wrote:
> Charles Steinkuehler wrote:
> 
>> objcopy -O binary -R .note -R .comment -S 
>> /home/usr/src/linux-2.4.21-rc1-ac3/vmlinux $tmppiggy; >> gzip -f -9 < $tmppiggy > $tmppiggy.gz; 
>> echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - 
>> input_data) input_data = .; *(.data) input_data_end = .; }}" > 
>> $tmppiggy.lnk; >> ld -m elf_i386 -r -o piggy.o -b binary $tmppiggy.gz -b elf32-i386 -T 
>> $tmppiggy.lnk; >> rm -f $tmppiggy $tmppiggy.gz $tmppiggy.lnk
>> ld -m elf_i386 -Ttext 0x100000 -e startup_32 -o bvmlinux head.o misc.o 
>> piggy.o
>> make[2]: Leaving directory 
>> `/home/usr/src/linux-2.4.21-rc1-ac3/arch/i386/boot/compressed'
>> objcopy -O binary -R .note -R .comment -S compressed/bvmlinux 
>> compressed/bvmlinux.out
>> tools/build -b bbootsect bsetup compressed/bvmlinux.out CURRENT > bzImage
>> Root device is (9, 1)
>> Boot sector 512 bytes.
>> Setup is 4789 bytes.
>> System is 862 kB
>> make[1]: Leaving directory 
>> `/home/usr/src/linux-2.4.21-rc1-ac3/arch/i386/boot'
>> [root at localhost linux-2.4.21-rc1-ac3]#
> 
> Also, is this (realatively) how one might go about creating a 
> self-extracting ELF binary?

You'd go through a similar process.  A good example would be the UPX 
code referred to previously:

http://upx.sourceforge.net/

-- 
Charles Steinkuehler
charles at steinkuehler.net




More information about the Kclug mailing list