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

Submitter:  mcnster <mcnster>
Submitted:  Tue 10 Oct 2006 04:53:49 PM UTC
   
 
Category:  None Severity:  Major
Priority:  5 - Normal Item Group:  None
Status:  None Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Closed Release:  None
Release:  0.97 Reproducibility:  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>
Group 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>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

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
  • -email is unavailable- added by robertmh (Posted a comment)
  • -email is unavailable- added by rstutsman (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-12-15 robertmh Open/ClosedOpen Closed
    2006-10-10 mcnster Attached File- Added grub-0.97-x86_64.patch.bz2, #10940

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code