Replying to my own message here ...
I've inserted the netboot stuff into the CVS edition of GNU GRUB and I
almost succeeded in carrying out a network boot. It fetches the files,
at least. Here are some things I encountered along the way:
(1) I had to change 90 to 120 in stage1.S. This is the number of
sectors which stage2 is allowed to occupy. I think it's a shame that
there is no automatic check whether stage2 hasn't turned out larger.
Could this be added to the TODO list, please?
(2) I couldn't get currticks() to work. I quote the code below in case
someone can help make it work. My work-around was to use a loop that
marks time for 1000 ms, increments a private counter and returns the
counter mod 50. (Can anyone confirm that there should be 20 ticks a
second? I read 20 in one place, 18 in another place.)
(3) Fetching compressed files didn't work. I haven't yet investigated.
(4) My modified GRUB failed to boot L4-Linux even off floppy. It loads
the kernel and all the modules, either off floppy or via tftp, starts
to execute the "kernel", then dies. This could be Fiasco/L4-Linux's
fault, of course, because I can't see how my additions could have
broken the existing functionality, unless there is another hard-wired
dependency on the permitted size of stage2. Can anyone thing of why
the change from 90 to 120 (see (1) above) might have broken something
else? I should probably try booting something else ...
Edmund
Here's the function that doesn't work. I have no reference materials
on x86 assembler or BIOS stuff, so it's a hard one for me to fix ...
asm("
.globl _currticks
.globl currticks
currticks:
_currticks:
push %ebp
push %ecx
push %edx
xor %edx,%edx
call prot_to_real
.code16
xor %eax,%eax
int $0x1a
call real_to_prot
.code32
xor %eax,%eax
shl $16,%ecx
mov %edx,%eax
or %ecx,%eax
pop %edx
pop %ecx
pop %ebp
ret
");