GRUB2 not finding grub.cfg, doesn't provide memory map

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 not finding grub.cfg, doesn't provide memory map

Post by zhiayang »

GRUB problems. So I finally managed to get both a working GRUB2 disk image, and have it mount in OS X.

BUT. GRUB2 boots up fine, it's 2.00 from the FTP. I installed GRUB with this command:

Code: Select all

grub-install --modules="part_msdos multiboot fat help configfile biosdisk" disk.img
It seems that I would have the modules I need (namely biosdisk, part_msdos and fat)... But it doesn't work. I have the GRUB config file in the right place, but it doesn't find it. I have a hypothesis:

Once in the root prompt, root=(hd0)
However, <ls> shows a (hd0,msdos1) that is the actual partition with the files on it.
I need either need to specify (hd0,msdos1) or set root=(hd0,msdos1). Only then, will configfile /boot/grub/grub.cfg find the file.


I (obviously) need to do this automatically; any ideas?




Next: GRUB2 apparently doesn't set the flags properly.

Code: Select all

if(!(MBTStruct->flags & (1 << 6)))
returns false.


I'm using multiboot1 to boot my kernel.

Help?
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: GRUB2 not finding grub.cfg, doesn't provide memory map

Post by egos »

grub-install isn't capable to install into partition of disk.img. Search with "grub-install, disk image/disk.img".

Edited. Alternatively you can use modified GRUB 2 after installing stage 0 and stage 1 into disk image by Yoda's boot.

Edited. Show your core.img from the disk image. I can check it.
If you have seen bad English in my words, tell me what's wrong, please.
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Re: GRUB2 not finding grub.cfg, doesn't provide memory map

Post by zhiayang »

Well this is futile. I don't even know why they decided to put the multiboot info after the kernel... Honestly lower memory was fine.

I appear to be trashing it, and I really can't be bothered anymore.
I've got the disk image and installed Grub legacy on it. Works better anyway.


Thanks egos and sorry for wasting your precious time.
User avatar
xenos
Member
Member
Posts: 1121
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: GRUB2 not finding grub.cfg, doesn't provide memory map

Post by xenos »

Yes, GRUB2 seems to prefer higher memory locations. I had the same problem, trashing the multiboot info. Finally I solved it by reserving all memory that is needed before reading the multiboot info in the .bss section, so GRUB2 won't put anything there.
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: GRUB2 not finding grub.cfg, doesn't provide memory map

Post by Mikemk »

egos wrote:grub-install isn't capable to install into partition of disk.img. Search with "grub-install, disk image/disk.img"
Actually, i have a method for doing so.
Create a blank image using dd or similiar. Then download a linux live iso with a partition editor and grub-install. After that, simply do the usb instructions inside of an emulator
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: GRUB2 not finding grub.cfg, doesn't provide memory map

Post by egos »

XenOS wrote:Yes, GRUB2 seems to prefer higher memory locations. I had the same problem, trashing the multiboot info. Finally I solved it by reserving all memory that is needed before reading the multiboot info in the .bss section, so GRUB2 won't put anything there.
Yes, I use same method to reserve space for additional module which is used if the module initially was loaded into base memory (it should be a final location). I use this technique instead of memmove (that works correctly with overlapped buffers). I read all required multiboot info before using any "outside" memory.
m12 wrote:Actually, i have a method for doing so.
It's a good approach, but it isn't always convenient/suitable.
If you have seen bad English in my words, tell me what's wrong, please.
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: GRUB2 not finding grub.cfg, doesn't provide memory map

Post by Mikemk »

egos wrote:
m12 wrote:Actually, i have a method for doing so.
It's a good approach, but it isn't always convenient/suitable.
First, I'll agree that it's not convenient. Second, until an actual way of installing grub 2 to a disk image becomes available, it's about the only reliable option.
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
Post Reply