chenall / grub4dos

外部命令和工具源码:https://github.com/chenall/grubutils 下载:
http://grub4dos.chenall.net
GNU General Public License v2.0
646 stars 136 forks source link

problem with get_fstype function in grubinst #41

Open DavidBrenner3 opened 9 years ago

DavidBrenner3 commented 9 years ago

Hi.

Grubinst and grubinst_gui have a problem: when the partitions are created with FE/FF to "force" bioses to use LBA instead of CHS, they report:

Partition table bt h0 s0 c0 fs h1 s1 c1 base leng 80 FE FF FF 0E FE FF FF 800 1FF800 00 FE FF FF 07 FE FF FF 200000 F72C57F grubinst: Bad partition table, if you're sure that the partition list is ok, please run this program again with --skip-mbr-test option.

Such partitions are often used today on USB drives. Other disk utilities don't report this error but they still check the MBR and the partition table for many issues. The file system detection from grubinst should be changed to do this too. This way it will be compatible with Bootice too...

The problem appears in the get_fstype function from utils.c >> chk_mbr function >> probe_mbr function. probe_mbr is returning different error codes (7, 26, ...) >> get_fstype is returning FST_MBR2 type (error) instead of FST_MBR.

The idea is to make sure the file system is MBR and that the MBR and/or the partition table are valid but not showing error for this particular situation.

Could you please modify this function? Thank you.

I made some changes to utils.c and utils.h to add the FST_EXFAT type. Here are the latest versions: https://drive.google.com/file/d/0ByKxAD_t9uvLeUZCOGlaUkQ0WE0/view?usp=sharing The download link is on top of the page, don't click on the name of the files.

Regards, David

steve6375 commented 9 years ago

I also think that it should not fail the check if using FE FF FF for CHS entries.

chenall commented 9 years ago

@DavidBrenner3 I think you can modify yourself.

I made some changes to utils.c and utils.h to add the FST_EXFAT type.

the change has been merged (https://github.com/chenall/grubutils)

DavidBrenner3 commented 9 years ago

Well, I'm not a great programmer like you. I have made some modifications, seems to work, but I can't be sure 100%.

https://drive.google.com/file/d/0ByKxAD_t9uvLeWRqSUpEN0JVLWs/view?usp=sharing