{B,C}LFS State of Things (was Re: SVN-20070706: ...)

Joe Ciccone jciccone at gmail.com
Sat Jul 21 06:43:21 PDT 2007

Bryan Kadzban wrote:
> Hash: RIPEMD160
> Luca wrote:
>> Grub-0.9x is old Grub legacy and no-more maintained.
> According to their site, it is maintained, just no new features are
> being added.  (Though I'm not sure what sense of the word "maintained"
> they're using then... but whatever.  Presumably it just means they'd
> still fix bugs if there are any.)
>> Grub-1.x is new one [...] I tried it only x86 but there was a similar
>> discussion in Debian for x86-64 arch support.
> Here's where I'm a bit confused.  Why should grub need to switch the
> processor into long mode?  For one, the kernel already does that --
> IIRC, Linux expects to start in real mode.  (I'm not sure if there are
> any provisions to start in protected mode, for grub2, or not.  I'm
> pretty sure grub2 switches into protected mode, so if that's true and it
> works, then there probably is some protocol to make it work.)
Grub legacy sets up protected mode. Yes, the linux kernel can startup in 
protected mode, but any kernel that grub loads needs to setup protected 
mode. If the kernel doesn't setup protected modem you have the 
possibility of a triple fault (reboot). Grub sets up a GDT. If the 
kernel being loaded by grub overwrites the GDT created by grub before 
setting up one of it's own you'll get a triple fault. I learned that the 
hard way.
> But for two, isn't 4G of virtual address space way more than enough for
> grub to do whatever it needs to do?  I mean, all it has to do is load up
> a file or two off the host FS and jump to an address inside the memory
> image of one of the files.  That's not nearly complicated enough to
> require more than 4G of memory.
Without setting up protected mode you can't access more then 1mb of 
physical memory, without pulling your hair out.
> In short, I'm not sure the bootloader needs to be 64-bit.
> Now I can see making the grub shell (and other programs on the host) be
> 64-bit.  Even if that's way overkill IMO too, it would be necessary if
> you're trying to do a pure64 system (because you won't have the 32-bit
> ld.so).  Is that all that's being discussed when people talk about
> "x86-64 arch support"?
The bootloader doesn't need to be 64bit, actually, 32bit would be ideal. 
The problem with grub legacy is that stage2 gets linked into the grub 
shell. stage2 can be compiled as a 32bit binary. But the grub shell 
would need to be 64bit, specifically because it requires a 64bit libc 
and optionally a 64bit libncurses (Can use a text interface). Grub 
legacy's design makes it virtually impossible to use on 64bit.
> (Not that a pure64 system is all that useful if you need -- or want --
> to use Flash, but that's a different issue.)
> In any case, I had planned on doing some grub2 testing today, so
> hopefully I'll be able to get it to work.  I really do need to make and
> test a bootable floppy first, though.  :-)
Grub2 should be able to work. I just compiled 1.95 with 64bit binaries 
and 32bit modules. Now all I would like to do is compile a pure64 system 
and try this.

More information about the lfs-dev mailing list