a1ive / grub

Fork of GRUB 2 to add various features.
GNU General Public License v3.0
138 stars 38 forks source link

parttool cannot set partition type of a type 0 MBR partition #54

Closed steve6375 closed 4 years ago

steve6375 commented 4 years ago

image

a1ive commented 4 years ago

Yes. because hd0,2 is not a valid partition if type is 0x00. I'm thinking about how to solve it. Do you have any idea? maybe we could let grub2 'recognize' type 0x00 partition?

steve6375 commented 4 years ago

maybe we could let grub2 'recognize' type 0x00 partition?

I think that would be a bad idea. It may break compatability.

if partition has valid MBR (ends 55 AA) maybe use --force command

parttool (hd0,2) type=0xEF --force

Then it uses dd to write byte?

a1ive commented 4 years ago

parttool module is very complex, needs to be rewritten. dd is a simple workaround.

steve6375 commented 4 years ago

Cant you just test for --force and run separate code to just change the one byte? If not, I will have to use dd.

a1ive commented 4 years ago

grubfmx64.efi.tar.gz

I modified partnew command. usage: partnew --type=0x00 hd0 4 (without --start --length --file options) USE WITH CAUTION!

steve6375 commented 4 years ago

so I can use type=0x00 to set default type or --type=0xEF to set specific type and it will not change other values in the partition table?

a1ive commented 4 years ago

yes. only change part type (and active flag if with --active).

steve6375 commented 4 years ago

image Not detecting type ??

a1ive commented 4 years ago

so I can use type=0x00 to set default type

sorry, no auto-detection for 0x00 or 0x10

steve6375 commented 4 years ago

So auto-detect for type 0 only works when file or start length params used?

a1ive commented 4 years ago

yes.

steve6375 commented 4 years ago

OK - seems to work. 👍 Can help for partnew be updated?

image

written?