chenall / grub4dos

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

grub4efi 2022-11-28 PARTTYPE issue? #389

Open steve6375 opened 1 year ago

steve6375 commented 1 year ago

image

image

steve6375 commented 1 year ago

If hd1 does not exist, then parttype returns 0x07

image

yaya2007 commented 1 year ago

Has been repaired. BOOTX64.rar.txt

steve6375 commented 1 year ago

parttype does not return 0x00 if partition type is 0

e.g. parttype (hd0,3) where ptn 4 is unused - does not return any text output

grub4dos (legacy) does return 0x00

liuzhaoyzz commented 1 year ago

parttype (0,3) ;; set rt=%@RetVal% ;; echo %rt%

steve6375 commented 1 year ago

image

Parttype returns incorrect values for GPT MBR

Does not output 0x00 for type 0 partition

liuzhaoyzz commented 1 year ago

2023-05-20 ,which was compiled with ubuntu20.4, it seemed the result is right?

2023-05-07,the result is right,too. (hd3,0) (hd3,1) is GPT partition

GPT-TEST-2023-05-23-18-41-06 Which version do you test?

steve6375 commented 1 year ago

parttype command should only return the partition type numbers of the 4 Protective MBR partition tables in LBA0. parttype and partnew are only for mbr sector LBA0 use.

So in my example (and yours) only the first partition table entry is EE - all the other 3 table entries are 0.

Some disks have more than one partition table entry in the protective MBR. e.g. Hybrid MBR. Using parttype, how could you tell if the second partition table in protective MBR of a hybrid disk was used and what type was in it? User may want to create hybrid MBR using partnew and check each of the 4 primary tables in Protective MBR.

image image

An EE type in any one of the four tables indicated a GPT disk (or hybrid GPT).

image image

here you see partition type is 7 but EE is reported !

liuzhaoyzz commented 1 year ago

Oh,there is really wrong report for partnew in GPT partition.I found it,too。 GPT partition will show 0xEE,but it should be 0x07(NTFS) or 0x0C(FAT32)

But partnew only can be used for MBR partition now.

Hybird MBR seems only exist in MAC PC?It's too complicated.