grub2 netboot : Merging etherboot 5.3.14 with grub2



Code is no longer available for donwload as this project is discontinued.

Testing it

grub2_netboot 23 june 2005

It looks like, this time, the free magic problem has been found. It is documented here


It is now possible to seek in file, for instance, the following works (although it downloads the same file multiple times):
	grub> ifconfig
grub> loopback lo (nd)tfile
grub> ls (lo)/
grub> cat (lo)/file.txt
I have tested three different card: Tulip, e1000, nforce2 as well as three compilers: gcc-2.95, gcc-3.0, gcc-3.3 However, the memory problem is still there, and I have no idea where it comes from. It varies depending on the compiler, the optimization flag, and some very small changes in the code. But it is always possible to find one combination of these for which the problem appears after loading a linux kernel or after the command boot or after a cat of a text file in the loopback device.


The memory problem is gone. Driver for Tulip cards has been ported and tested on a DS21140 chip.
Compilation has been tested on ubuntu 5.04 with gcc 3.3.5 (Debian 1:3.3.5-8ubuntu2) and debian woody with gcc version 2.95.4 . Compilation on ubuntu required the installation of the following packages : libncurses5-dev (not detected by configure) and liblzo-dev.


the memory problem is still there but with the addition of a grub_printf() instruction before freeing the memory, the error message disappears


It is now possible to use commands like:
	cat (nd0,tftp)test
configfile (nd0,tftp)menu.lst
linux (nd0)/linux_24
but it is still broken: It is not yet possible to seek in the file and there is some memory corruption (grub_free: free magic is broken)


./grub-mkimage -v -d . -o core.img _chain _linux boot cat chain cmp configfile default ext2 fat font fshelp grub_pci halt hello help linux loopback ls multiboot normal pc reboot terminal timeout drv_e1000 drv_forcedeth pcimodprobe
dd if=boot.img of=grub_disk bs=512 count=1
dd if=core.img of=grub_disk bs=512 seek=1

dd if=grub_disk of=/dev/fd0
At the grub prompt, type ifconfig, the e1000 card is sucessfully detected. It should be very easy to add more drivers from etherboot. The following message should be printed (if there is a dhcp server reachable)
	grub> ifconfig
Probing pci nic...
[e1000-82540em]Ethernet addr: 0:c0:9f:17:f7:4d
driver name: E1000 (device: e1000-82540em) probe=0
CPU 1873 Mhz
Searching for server (DHCP)
Configuration successfull
Me:, Server:, Gateway:
Unable to load file
The remote files should then be accessible with the following syntax : (nd0,tftp)filename. For instance:
	grub> linux (nd0,tftp)/linux_2.4.24
This part has to be done, the functions to be implemented are in fs/netfs.c. The tftp functions are already there in netboot/*, the netfs functions should just call these functions and return the suitable structures.