public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [i386 BOOT CODE] kernel bootable again
@ 2005-09-13 13:46 Pascal Bellard
  2005-09-13 19:04 ` Frank Sorenson
  0 siblings, 1 reply; 12+ messages in thread
From: Pascal Bellard @ 2005-09-13 13:46 UTC (permalink / raw)
  To: Riley; +Cc: Linux-Kernel

[-- Attachment #1: Type: text/plain, Size: 869 bytes --]

Hello,

Please find attached a patch to build i386/x86_64 kernel directly
bootable. It may be usefull for rescue floppies and installation
floppies.

System sector count is updated by tools/bluid.c at offset 495. The
system could be up to 32 Mb long.

-- support any drive geometry --

Disk geometry detection assumes that no error raises on first track.
First track is read sector by sector and the first error determinates
the sectors per track count. Next, reads are performed track by track.
Tested on floppy H2/S18 and harddisk H16/S63. Should work on
every exotic drive supporting Int13h CHS.

-- cmdline support --

If ram_size (offset 504) bit 13 is set, the kernel cmdline
is load from the sector following the kernel image.

If Ctrl, Alt, Shift or CapsLock is pressed the kernel cmdline is
prompted until Enter key. BackSpace is supported.

Regards,

-pascal

[-- Attachment #2: linux-2_6_13-bootblock_u.DEFANGED-1 --]
[-- Type: application/DEFANGED-1, Size: 34289 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: [i386 BOOT CODE] kernel bootable again
@ 2005-09-20 17:13 Etienne Lorrain
  0 siblings, 0 replies; 12+ messages in thread
From: Etienne Lorrain @ 2005-09-20 17:13 UTC (permalink / raw)
  To: linux-kernel

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


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2005-09-20 17:13 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-13 13:46 [i386 BOOT CODE] kernel bootable again Pascal Bellard
2005-09-13 19:04 ` Frank Sorenson
2005-09-13 19:42   ` H. Peter Anvin
2005-09-14  9:42     ` Pascal Bellard
2005-09-14  9:55       ` Martin Mares
2005-09-14 16:38       ` H. Peter Anvin
2005-09-17 15:26       ` Giuseppe Bilotta
2005-09-17 15:56         ` Jesper Juhl
2005-09-17 16:19           ` Giuseppe Bilotta
2005-09-19  2:13             ` Coywolf Qi Hunt
2005-09-14  9:52   ` Pascal Bellard
  -- strict thread matches above, loose matches on Subject: below --
2005-09-20 17:13 Etienne Lorrain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox