QSINIT (Tetris) & iPXE Guide

- Prerequisite

There must be working standard PXE environment (DHCP, TFTP).
This guide does not involve how to set one up, this must already
be in working order and tested. This is because this guide involves
chainloading iPXE from standard PXE environment. Although iPXE
can be flashed into NIC boot ROM, nowadays it's little bit complicated,
as network card is integrated onto motherboard itself and PXE code is
inside BIOS itself. So it's more easy to start iPXE via chainloading
from PXE/TFTP server.

Chainloading involves however one problem - by default it causes endless
loop - TFTP server hands over iPXE code, as it starts it makes another
network request automatically and downloads again its own code. And so
endlessy. This is nicely described here along with some solutions:

https://ipxe.org/howto/chainloading

However it can be breaked very easily - just press CTRL B and you get
iPXE command prompt iPXE>

To chainload iPXE we need iPXE code placed to TFTP server root,
 this can be undionly.kpxe or ipxe.pxe. Always the latest versions can be
downloaded from here: http://boot.ipxe.org/

In principle undionly.kpxe is more universal however it is dead slow
with my NIC so i use ipxe.pxe, however the latter must support your
network card and have appropriate drivers inside it. 
If ipxe.pxe doesn't work, try undionly.kpxe.

So TFTP hands over iPXE code and we press CTRL B quickly and we have
now iPXE prompt. Next step is to configure the network card via DHCP.
For that we enter dhcp command and after that we are ready to load
tetris.

Current working methods to load Tetris involves booting it in floppy or
cdrom ISO images form, either from TFTP or HTTP server


iPXE defaults to TFTP protocol. So i we have disk images in TFTP server
root, and we give just their names even without absolute path, they
are taken from TFTP server root.

To boot tetris images we need memdisk from isolinux package. I use 5.10
version since newer caused some problems. To load tetris floppy image
from TFTP server we issue 3 commands from iPXE command prompt:

kernel memdisk
initrd tetris.img
boot

To start tetris cdrom ISO from TFTP we issue those 2 commands

initrd tetris.iso
chain memdisk iso raw

As we said iPXE default to TFTP, so we didn't specify any protocol,
however we can. So the next two lines are identical to previous one,
considering 10.0.2.1 is our TFTP server IP address

initrd tftp://10.0.2.1/tetris.iso
chain tftp://10.0.2.1/memdisk iso raw


To use http protocol we just place files we need to boot onto www server
and use http:// instead of tftp://

kernel http://10.0.2.2/memdisk
initrd http://10.0.2.2/tetris.img
boot


We can also mix protocols - take memdisk from one server (TFTP for example)
and disk image from another server (www server).



Instead of memdisk we can use also sanboot method that is incorporated
into iPXE, in that case we don't need separate memdisk module however
sanboot method works only with http protocol as TFTP provides no mechanism
for reading only part of a file, and so can not support SAN booting.
This means also that our www server must be able to accept and serve range
requests.

for sanboot we just issue one command.

For floppy image:

sanboot --no-describe --drive 0x00 http://10.0.2.2/tetris.img

For cdrom ISO:

sanboot --no-describe --drive 0xe0 http://10.0.2.2/tetris.iso

Difference with memdisk and sanboot method is that memdisk loads
image fully onto memory while sanboot uses HTTP range-requests to
just load what it needs as needed. Another differce is that image
with memdisk is RW, but with sanboot method image is RO.

One powerful iPXE feature is boot menu. This is pure text file,
and we can start it just via one command : chain menu.txt, assuming
menu.txt is the menu file we created. Very nice and comprehensive
example how to create menu file is located here:

https://gist.github.com/robinsmidsrod/2234639

Another nice feature of iPXE is to chainload into another network
boot environment, like pxeos4 or grldr - just issue the command
chain xxx where xxx is appropriate NBP, for example chain grldr
to load grub4dos.

 (c) lys at #os2/efnet
