[OpenBIOS] Starting linux aint much easy ?

Ronald G. Minnich rminnich at lanl.gov
Tue Feb 15 18:13:06 CET 2000


On Tue, 15 Feb 2000, Attarian, Gary wrote:

> One last question though, did you say you were loading a vmlinux image
> (uncompressed) into memory?  If so, head.S assumes the image is compressed
> and trys to uncompress it.  

you can even bypass this step. Openbios very nicely will do the gunzip for
you. So here is what james hendricks and dale webster cooked up to build
an NVRAM 'image':

#!/bin/bash


# Let's use variable to make the size dynamic
# Enter in the image size in kbytes
export BIOS_SIZE=512


# Well, we don't need kB, we need bytes minus 64kB
export FILLER=`echo 1024*\($BIOS_SIZE-64\) | bc`


# Setup done, let's rock & roll :)
echo Reading in \'vmlinux\' and \'rom.bin\'


# Strip and Zip the linux kernel
echo Stripping and compressing the kernel...
objcopy -O binary -R .note -R .comment -S vmlinux /tmp/$$-tmp-linux
gzip -f -3 /tmp/$$-tmp-linux


# Make a filler file
echo Making a ${BIOS_SIZE}k BIOS image...
dd if=/dev/zero of=/tmp/$$-tmp-filler bs=1 \
count=`ls -l /tmp/$$-tmp-linux.gz | awk '{print "'$FILLER' - " $5}' | bc`
\
>& /dev/null


# Put it all together   
echo Outputting bios.img...
cat /tmp/$$-tmp-linux.gz /tmp/$$-tmp-filler rom.bin > bios.img


# Eventually we could dynamically setup ldbios.asm and the other stuff.
# nasm ldbios.asm -f bin -o ldbios.com
# (cd start32; make)


# Remove temp files
echo Cleaning up...
rm /tmp/$$-tmp-filler /tmp/$$-tmp-linux.gz

echo All done.
------------------------------------------------


The key step in there you can see is taking the vmlinux image and gzip'ing
it. openbios gunzips linux to 0x100000 and jumps to the 'right place', and
away you go. This means you don't need all of arch/i386/boot and you can
even skip linking the gunzip code into the kernel. Very nice.

ron

-
To unsubscribe: send mail to majordomo at freiburg.linux.de
with 'unsubscribe openbios' in the body of the message



More information about the openbios mailing list