Page 1 of 1

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

Posted: Sun Jun 02, 2013 9:17 am
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!

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

Posted: Sun Jun 02, 2013 3:34 pm
by sortie
Are you using the very newest GRUB release?

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

Posted: Sun Jun 02, 2013 5:15 pm
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.