Diskless Booting: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
Brendan (talk | contribs)
m See also
m Fix up references to GRUB and GRUB legacy
Line 3:
In order to boot up your kernel by network, you need a DHCP server, a TFTP server, and a program acting as client on the other computer.
 
== The GRUB Legacy Way ==
 
First, you have to create a floppy with [[GRUB Legacy]] configured for net support. You can either get a floppy image from http://i30www.ira.uka.de/%7Eud3/mkgrubdisk/ or download a current source release of [[GRUB Legacy]] and <tt>./configure</tt> it with support for your NIC.
 
Although this is the simplest way, GRUB Legacy doesn't seem to support all network cards.
 
== The PXELINUX Way ==
 
Compile syslinux; a <tt>pxelinux.0</tt> file will be created. It is a PXE binary of a simple bootloader-over-tftp, which can be booted by the client computer (not the one with the TFTP server). After setting up DHCP and TFTP accordingly so the file boots, you can use pxelinux to load "memdisk", which comes with syslinux as well.
 
This file is loaded with a <tt>memdisk initrd=grub.ima</tt> syntax, which will cause pxelinux to load memdisk and grub.ima through TFTP. Memdisk will hook interrupt 0x13, and boot the disk image that way. (However, not all [[GRUB Legacy]] disk images seem to access floppies through bios. If you've got such an image you're stuck.)
 
You should get a <tt>pxelinux.0</tt> file, which can be loaded by, for example, etherboot. Many modern computers allow booting from NICs so you only need the TFTP and DHCP server up.
 
At this point, you can make changes to the grub.ima disk image, and put a [[GRUB Legacy]] config file and your kernel's binaries there.
 
Try <tt>mount /tftpboot/grub.ima /mnt/fpy -o loop</tt> under linux, for example.
 
== The gPXE +GRUB2 GRUB Way ==
 
[[GRUB-legacy]] doessince notversion support newer network cards, but if you can use [http://www.gnu.org/software/grub GRUB2] then you2 can piggy-back on [http://www.etherboot.org/wiki/start gPXE]'s network support., unlike GRUB Legacy that does not support newer network cards. The gPXE project is a currently-maintained, open source, free network bootloader. It is easy to get gPXE ISO, disk, or USB disk images from their website, but there is a workaround you need to apply in order to get GRUB2GRUB to successfully load.
 
gPXE supports multiboot, but if it detects a multiboot image then it will not provide PXE services. Unfortunately, it detects your generated GRUB2GRUB image as multiboot, and the only way I found to get around this was to recompile gPXE without multiboot support. Recompiling gPXE is easy: unpack it, <tt>cd src; make</tt>. Before you do that, you will want to edit <tt>src/config/defaults/pcbios.h</tt> and comment out the line that defines <tt>IMAGE_MULTIBOOT</tt>. After compiling you should be left with <tt>bin/gpxe.{dsk,iso,usb}</tt> which you can write to disk or CD.
 
To create a GRUB2GRUB PXE bootable image, you can follow the advice in the [http://www.gnu.org/software/grub/manual/grub.html#Network GRUB manual's Network chapter]. Keep in mind that GRUB2 is in flux, and severalSeveral of the options to <tt>grub-mkimage</tt> did not exist in past versions. and Iyou recommendneed gettingto theupgrade latestif versionthey andaren't compilingsupported. fromIf source,you it'scompile fairlyfrom straightforwardsource, and then you are leftcan withget all the <tt>*.{lst,mod,img}</tt> files you need in the source directory. In the case you compile your own GRUB2GRUB you do not need to install it, just do commands like this:
 
<source lang="text">
Line 46:
</source>
 
and there are other options to explore as well. Now make sure that you take <tt>grub2pxe,*.lst,*.mod</tt> from the grub2GRUB source and put them in <tt>/tftp/boot/grub</tt> or equivalent. Also put your <tt>grub.cfg</tt> file there. The format of that is fairly simple. Here's the essence of what I use:
 
<source lang="text">
Line 74:
===External Links===
*[http://osdev.berlios.de/netboot.html Tutorial on network booting]
*[http://www.gnu.org/software/grub/manual/html_node/Diskless.html#Diskless Official GRUB FAQ]
*[http://home.dei.polimi.it/fornacia/progetto_minazzi/index.html#HOW%20TO%20INSTALL%20A%20TFTP%20SERVER Setting up a TFTP server]
*[http://tftpd32.jounin.net/ TFTP32 server]