OSDev.org

The Place to Start for Operating System Developers
It is currently Mon May 13, 2024 5:02 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: FAT32 and GRUB
PostPosted: Sun Jan 20, 2013 6:33 pm 
Offline

Joined: Sun Jan 20, 2013 6:27 pm
Posts: 21
I'm trying to create a bootable GRUB image with FAT32 on it. For some reason, Ubuntu can mount the image but GRUB can't. This is the process I used to create it:
Code:
sudo dd if=/dev/zero of=kernel.img bs=1M count=100
sudo fdisk kernel.img
o
n
a
p
w
sudo losetup -o1048576 /dev/loop0 kernel.img
sudo mkdosfs -F32 /dev/loop0
sudo mount /dev/loop0 /mnt/hdd
sudo mkdir /mnt/hdd/boot
sudo mkdir /mnt/hdd/boot/grub
cp ~/Downloads/fat* ~/Downloads/stage* /mnt/hdd/boot/grub
sudo umount /dev/loop0
sudo losetup -d /dev/loop0


This all runs flawlessly. The issue is when I get to this part:

Code:
grub --device-map=/dev/null
>device (hd0) kernel.img

>root (hd0,0)

>setup (hd0)

Error 17: Cannot mount selected partition


Top
 Profile  
 
 Post subject: Re: FAT32 and GRUB
PostPosted: Mon Jan 21, 2013 2:01 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4598
Location: Chichester, UK
Have a look at the procedure here: http://www.sidebranch.com/papers/How%20 ... 0image.pdf


Top
 Profile  
 
 Post subject: Re: FAT32 and GRUB
PostPosted: Thu Jan 31, 2013 7:28 am 
Offline

Joined: Sun Jan 20, 2013 6:27 pm
Posts: 21
OK, it seems to be working now. I forgot to change the partition's system ID, so I think that that was the problem, although many tutorials I read didn't tell me to do that. I also used the -c=dos flag for fdisk, so that partition one would start at sector 63, not 2048. Finally, I included argument specifying the cylinders, heads, and sectors per track to fdisk.

Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot], Kaius and 32 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group