GRUB2 Troubles -- Apparently broken MB tags and grub.cfg

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

GRUB2 Troubles -- Apparently broken MB tags and grub.cfg

Post by zhiayang »

Another GRUB problem... Hello!

I've recently been trying to re-explore GRUB2 and UEFI; if you remember I asked about such things as these before. I don't think the problem was ever solved, so I moved away from GRUB2 -- now I'm back!


After a gruelling afternoon, involving misinterpretation of help (sorry geist), Parallels 8 being a cavity irrigation device and Apple's toolchain being incompetent, I finally managed to build GRUB2, and with some help from Jordan_U on #grub, managed to get a bootx64.efi using

Code: Select all

grub2-mkstandalone --format=x86_64-efi -o bootx64.efi
Now the problems:

1. When it loads my kernel, it apparently provides no memory map -- even using multiboot1. Thus my kernel halts because it cannot find available memory to allocate. I'm pretty sure I've got the flags right:

Code: Select all



// Multiboot 1 Header
.align 4
MultibootHeader:
	.long 0x1BADB002					// Magic Number
	.long 0x00000003					// Flags	(bits 0, 1)
	.long -(0x1BADB002 + 0x00000003)	// Checksum


// Multiboot 2 Header
.align 8
Multiboot2Header:
	// Magic number
	.long	0xE85250D6

	// Architecture: Intel IA-32(e)
	.long	0

	// Length of header:
	.long	Multiboot2HeaderEnd - Multiboot2Header

	// Checksum
	.long	-(0xE85250D6 + 0 + Multiboot2HeaderEnd - Multiboot2Header)



	.word	1
	.word	0
	.long	16
	.long	6

	.word	0
	.word	0
Multiboot2HeaderEnd:
Also, I read the tags using the code from http://download-mirror.savannah.gnu.org ... tiboot.pdf -- what appears to be GNU's own code.

However, I get an endless stream of tags of type=0x03 and size=0x0 -- presumably because there's no end tag.

All I really need is the memory map, as well as a way to either switch the EFI firmware's video mode, or get to a VBE-compatible LFB mode.



2. GRUB seems to not want to load my grub.cfg. I think it's because I need to

Code: Select all

 insmod part_gpt 
before I do the multiboot command, meaning it can't read the disk with the CFG on it before I load the module -- is there a way to modify grub-mkstandalone to include some modules at load time?


Sorry for the long post -- thanks!
Last edited by zhiayang on Mon Jun 03, 2013 12:56 am, edited 1 time in total.
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: GRUB2 Troubles -- Apparently broken MB tags and grub.cfg

Post by sortie »

Are you using the very newest GRUB release?
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Re: GRUB2 Troubles -- Apparently broken MB tags and grub.cfg

Post by zhiayang »

sortie wrote:Are you using the very newest GRUB release?
I'm pretty sure I am -- GRUB 2.00, from http://ftp.gnu.org/gnu/grub/grub-2.00.tar.xz.
Post Reply