Hello guys,
I made a FAT32 image file with grub2 in Linux and tried to run it on bochs.
As soon as it boots, grub2 enters the rescue mode.
"ls" gives "(hd0)"
And "ls (hd0)" gives "error: unknown filesystem."
The weird thing is that the image file can be correctly mounted in linux but cannot be opened on Windows using disk tools.
The script I used to generate the image is:
==========================================
KERNELIMG=$1
sudo umount /mnt
sudo losetup -d /dev/loop0
sudo losetup -d /dev/loop1
sudo rm $KERNELIMG
sudo dd if=/dev/zero of=$KERNELIMG bs=512 count=131072
echo "n
p
1
2048
a
1
w
" | sudo fdisk $KERNELIMG
sudo losetup /dev/loop0 $KERNELIMG -o 1048576
sudo losetup /dev/loop1 $KERNELIMG
sudo mkdosfs -v -F 32 /dev/loop0
sudo mount /dev/loop0 /mnt
sudo grub-install --root-directory=/mnt --no-floppy /dev/loop1
sudo umount /mnt
sudo losetup -d /dev/loop0
sudo losetup -d /dev/loop1
echo "p
" | sudo fdisk $KERNELIMG
==========================================
Anyone has any ideas?
HELP! FAT32 image not recognized.
-
HyperAssembler
- Member

- Posts: 36
- Joined: Thu Sep 04, 2014 5:24 pm
- Location: !SIGSEGV
- Combuster
- Member

- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: HELP! FAT32 image not recognized.
Don't force a FAT size. That's illegal.
-
HyperAssembler
- Member

- Posts: 36
- Joined: Thu Sep 04, 2014 5:24 pm
- Location: !SIGSEGV
Re: HELP! FAT32 image not recognized.
Thanks for your response but I don't know what you mean.Combuster wrote:Don't force a FAT size. That's illegal.
if you are talking about mkdosfs then the command would be
mkdosfs -f [fat size]. I'm using -F(capital) to specify filesystem.
-
Octocontrabass
- Member

- Posts: 6299
- Joined: Mon Mar 25, 2013 7:01 pm
Re: HELP! FAT32 image not recognized.
HyperAssembler wrote:Thanks for your response but I don't know what you mean.Combuster wrote:Don't force a FAT size. That's illegal.
If you want a valid FAT32 filesystem, you must tell mkdosfs to generate a filesystem with at least 65525 clusters. Using -F to override that limit will create an invalid filesystem.Microsoft wrote:The FAT type—one of FAT12, FAT16, or FAT32—is determined by the count of clusters on the volume and nothing else.
-
HyperAssembler
- Member

- Posts: 36
- Joined: Thu Sep 04, 2014 5:24 pm
- Location: !SIGSEGV
Re: HELP! FAT32 image not recognized.
Thanks for your response.Octocontrabass wrote:HyperAssembler wrote:Thanks for your response but I don't know what you mean.Combuster wrote:Don't force a FAT size. That's illegal.If you want a valid FAT32 filesystem, you must tell mkdosfs to generate a filesystem with at least 65525 clusters. Using -F to override that limit will create an invalid filesystem.Microsoft wrote:The FAT type—one of FAT12, FAT16, or FAT32—is determined by the count of clusters on the volume and nothing else.
According to mkdosfs usage:
If I get rid of -F 32 then it will by default create a FAT16 partition which is not what i want.-F FAT-size
Specifies the type of file allocation tables used (12, 16 or 32 bit). If nothing is specified, mkdosfs will automatically select between 12 and 16 bit, whatever fits better for the filesystem size. 32 bit FAT (FAT32 format) must (still) be selected explicitly if you want it.
Also "file <ImageName>.img" command only shows kernel.img is a x86 boot loader with no info for partition.
In grub rescue, type "ls" and I can only see "(hd0)" without any partitions.
So I'm thinking the way that I partition the image is wrong.
Aside:
I also tried FAT 16 version. Grub2 still complains unknown file system.
-
Octocontrabass
- Member

- Posts: 6299
- Joined: Mon Mar 25, 2013 7:01 pm
Re: HELP! FAT32 image not recognized.
FAT16 requires a minimum of 4085 clusters (and no more than 65524 clusters) and your filesystem does not meet those limits either.HyperAssembler wrote:Aside:
I also tried FAT 16 version. Grub2 still complains unknown file system.