bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GRUB Hacking Guidance, Adding Xmodem


From: Craig
Subject: GRUB Hacking Guidance, Adding Xmodem
Date: Sat, 19 Feb 2005 21:03:27 -0800 (PST)

I’d like to add Xmodem capability to GRUB “Legacy”
0.95/0.96.  Instead of obtaining a kernel from a tftp
server a la ifconfig, I’d like to have GRUB accept a
kernel via xmodem.  I’ll be doing this over a
null-modem link, but conceivably this could be over a
modem as well.

I’d like affect as little of the existing GRUB code as
possible.  Let’s say I’ve got a function 
        int xmodem_receive(char* file, int maxbytes);
file is a pointer of maxbytes where the contents of
the received kernel or initrd will be written.  The
return value indicates the actual size* of the
received file.  

While I’ve used and configured GRUB many times, I’ve
never touched the GRUB source code before.  About all
I know is that I’ll need to build this into stage2. 
Also, after noticing the memory map in the document
(Hacking GRUB section) I realize malloc is probably
out of the question.  Here are my thoughts/questions
so far:
1.      I’ll need a token similar to (nd) to indicate that
a file is to be received via the console, say
(xmodem).
2.      I’ll need to add to (or identify an existing spot)
in the memory map.  Where does (nd) put the
kernel/initrd?
3.      What functions in GRUB will I need to modify? 
Where should xmodem_receive be called?  It will need
to be called once to obtain a kernel, and a second
time to obtain an initrd.

Thanks!
Craig

And for the curious, here’s some additional background
as to why I’m interested in this:
-       With a brand new head-less, keyboard-less system,
I’d like to be able to pop a GRUB boot CD in the
drive, redirect the console to the serial port, and
upload a linux kernel+initrd image over the serial
line.  Out of the box, GRUB supports all but the
serial upload of a kernel and initrd image.
-       No need to compile GRUB with netboot support. 
Especially useful when neither GRUB nor EtherBoot
supports a given NIC (and the NIC doesn’t support
PXE). 

To keep things simple I’m initially planning on coding
up the xmodem receive myself.  I’m aware of the
shortcomings of xmodem--if this type of functionality
is useful in the GRUB baseline I would consider
leveraging off of the “lrzsz” code to support
X/Y/ZModem (lrzsz is a GPLed branch of rzsz).

* I believe the receive end of Xmodem rounds file
sizes up to within a few bytes--assume this isn’t an
issue for this discussion.




                
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - 250MB free storage. Do more. Manage less. 
http://info.mail.yahoo.com/mail_250




reply via email to

[Prev in Thread] Current Thread [Next in Thread]