bugGNU GRUB - Bugs: bug #17963, [PATCH] - Make GRUB recognize and...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #17963: [PATCH] - Make GRUB recognize and boot an x86_64 elf image

Submitted by:  mcnster <mcnster>
Submitted on:  Tue 10 Oct 2006 04:53:49 PM UTC  
 
Category: NoneSeverity: Major
Priority: 5 - NormalItem Group: None
Status: NonePrivacy: Public
Assigned to: NoneOriginator Name: 
Open/Closed: ClosedRelease: 0.97
Release: NoneReproducibility: None
Planned Release: None

Sat 15 Dec 2007 09:29:59 PM UTC, comment #2:

We've moved to GRUB 2 as a development platform. Please can you check if this bug still applies there, and if it does, reopen it?

Thanks

Robert Millan <robertmh>
Project Administrator
Wed 24 Oct 2007 04:36:05 AM UTC, comment #1:

Please apply this patch. I'm in need of precisely this functionality.

Ryan Stutsman <rstutsman>
Tue 10 Oct 2006 04:53:49 PM UTC, original submission:

Patch file attached.

From the file grub-0.97/docs/x86_64.doc:

----------------------------------------------------------------
[PATCH] - Make GRUB recognize and boot an x86_64 elf image

HOW IT WORKS
------------

  • Grub interface is unchanged.
  • Upon passing an elf-x86_64 file via "kernel=", GRUB will load and parse it correctly.
  • Upon the "boot" directive, GRUB will switch from protected 32-bit mode to long 64-bit mode and transfer control to the image's entrypoint.

INSTALL
-------
cd grub-0.97
patch -p1 < grub-x86_64-elf.patch
./configure
make
su -c "make install"

Note: You do not need to re-install your bootsectors, but you WILL need to copy the modified stage2 file(s) from /usr/share/grub to your actual boot filesystem (usually /boot/grub for GNU/Linux).

WHY?


Because in our world, all elves and elf images are created equal, and have been endowed with the ability to be bootable. :-)

THE NITTY GRITTY - GRUB SIDE
----------------------------

  • Since paging is manditory in 64-bit long mode, the first 4GB of physical memory (whether present or not) is identity mapped into the linear address space using 2MB pages.
  • Paging data structures are written to physical 0x70000-0x75fff in the same area reserved for the raw device buffer. This happens after the "boot" command is issued so the raw device buffer won't mind. Paging can be relocated and reconfigured after the kernel is running.
  • Header files have been added to describe the x86_64 elf image structure.

THE NITTY GRITTY - KERNEL SIDE
------------------------------

  • Parameters passed to the assembly entrypoint are unchanged including magic number and pointer to multiboot info structure.
  • The assembly entrypoint should be designated as ".code64".
  • The Global Descriptor Table (GDT) shared by the GRUB and KERNEL sides has been expanded to include 3 additional 64-bit ('L' bit set) segments: 0x28 (code) and 0x30 (data).
  • An updated "multiboot.h" file is provided to reflect the difference in "unsigned long" sizes between i386 and x86_64 architectures for use by the client kernel.

CAVEATS
-------
Possible collisions with existing GRUB patch sets are unknown. Use "darcs" and worry not.

http://abridgegame.org/darcs

(An intelligent alternative to cvs and greying hair in the distributed post-mainframe age.)

DOCUMENTATION CHANGES
---------------------
This is it. Sorry, stuff to do.

APOLOGIES TO GRUB2
------------------
We would have liked to use GRUB2 for this, but needed it today for our kernel. Of course there is probably no technical reason why this functionality cannot be in included in GRUB2 at a future time. Thank you for a way cool bootloader and may all your boots be bogon (and Vogon) free.

<mcnster@gmail.com>
October 10, 2006

mcnster <mcnster>

 

Attached Files
file #10940:  grub-0.97-x86_64.patch.bz2 added by mcnster (7KiB - application/x-bzip2 - [PATCH] - Make GRUB recognize and boot an x86_64 elf image)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by robertmh (Posted a comment)
  • -unavailable- added by rstutsman (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 15 Dec 2007 09:29:59 PM UTCrobertmhOpen/ClosedOpen=>Closed
    Tue 10 Oct 2006 04:53:49 PM UTCmcnsterAttached File-=>Added grub-0.97-x86_64.patch.bz2, #10940

    Back to the top


    Powered by Savane 3.1-cleanup1