Re: [i386 BOOT CODE] kernel bootable again

From: Etienne Lorrain
Date: Tue Sep 20 2005 - 12:14:06 EST


>>>> So if the "something" knows (or can get to know) the sector/tracks
>>>> layout of the disk it's writing the kernel onto, it could store this
>>>> information in the bootblock (is there space for that?). The bootblock
>>>> code would then just read this info and use it.
>
> Actually, DOS/Windows works that way. FAT filesystem stores the number
> of sectors per track in its boot sector.

Gujin installer creates the filesystem (and the partition table if
needed), the MBR with the disk geometry, and chain a simple bootloader
or a menu based bootloader on the created FAT filesystem when told to
do so.

So if you just want to put a kernel and initrd on a floppy, and the
floppy is big enough, you just do:
$ mkdir tmp
$ cd tmp
$ wget http://heanet.dl.sourceforge.net/sourceforge/gujin/install-1.2.tar.gz
$ tar xvzf install-1.2.tar.gz
$ ./instboot tiny.bin /dev/fd0
$ mcopy /boot/vmlinuz-2.6.13 a:
$ mcopy /boot/initrd-2.6.13 a:
And you reboot with the floppy still inside the drive.

If you want to put them on your USB thumb drive, and your PC can
boot USB flash drives as a floppy (lot of BIOS bugs there), you
just change the line (double check that your USB key is /dev/sda):
$ ./instboot tiny.bin /dev/fd0
by:
$ ./instboot tiny.bin /dev/sda --disk=BIOS:0x00 --geometry=/dev/sda

I personnally better like a partition table on my USB drives, so
I am more used to erase manually the partition table:
$ dd if=/dev/null of=/dev/sda bs=512 count=64 # blank the head of the disk
and then type:
$ ./instboot boot.bin /dev/sda --disk=BIOS:0x00 --geometry=/dev/sda \
--mbr-device=/dev/sda --partition_index=1

When booted from this key, the PC will boot the kernel named vmlinuz*
and load the initrd/initramfs named initrd* (tiny.bin does not contain
the graphic menu management).

I will not say that I tested it lately, but you may also want to put
your kernel and initrd on a bootable CDROM - without having the usual
Gujin menu - then you just do:
$ mkdir tmpdir
$ cp /boot/vmlinuz-2.6.13 tmpdir
$ cp /boot/initrd-2.6.13 tmpdir
$ ./instboot tiny.bin tmpdir/tiny.bcd
$ mkisofs -untranslated-filenames -no-emul-boot -boot-load-size 4 \
-b tiny.bcd tmpdir -o boot.iso
$ cdrecord boot.iso

It is usually better (and will work for all those configuration)
to put the kernel and its initrd inside a directory named "/boot",
but I am highjicking a thread so want to keep it simple...

Etienne.

-
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/