Thanks. How about including hybrid MBR (GPT with modified boot code)? You only need gdisk as an additional tool to convert the GPT to hybrid partition (requred on legacy macs).
You can find the details here
The only additional thing needed is to activate the BCD for MBR boot.
Last edit: Startergo 2024-03-02
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi @Startergo, if you still want to enable legacy boot you may want to try the tool I linked in my post to@sergey-galan below. While I've not yet tried it with hybrid MBR the boot process should work the same way.
👍
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Actually, the hybrid MBR scheme is nothing more than protecting GPT partitions you want to hide from the MBR boot sector. So, the WIndows partition does not see the EFI partition when booted. There is no need for system partition all files are written to the main Windows partition. I looked through your repo and combined with Serhii's tool, which provides NTFS write support can do everything needed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
They banned me on Macrumors, they wrote that I am engaged in advertising. Probably because I was a newcomer there))). But the topic is still on Insanlymac and TonyMacx86.
In the old versions of the program, I used gdisk to obtain a GUID disk. But gdisk for some users refused to work in the script.
BCD for loading UEFI I take ready and create a patch GUID and UUID. What to do with BCD for MBR I do not know. Perhaps there may be enough GUID and UUID, and maybe something else.
Last edit: Serhii 2024-03-06
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi @sergey-galan, if you're interested in implementing support for MBR/BIOS booting in your utility you need to patch the BCD with the Windows Disk Signature from the MBR (found at offset 440 bytes) and the system partition offset in bytes. Also the file paths must have the extensions changed from efi to exe. It's probably better to use a different BCD file for legacy boot.
I have a shell script called BCD-SYS that can do much of what the Microsoft bcdboot command does if you are interested. Let me know if you have questions.
👍
2
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, that should be fine. You'll need to create a BCD for MBR first then patch the disk and partition identifiers. You can use my script or the Windows bcdboot utility to create one.
The equivalent of the disk GUID will be the four byte Windows Disk Signature from the MBR. You may need to create this using signmbr or manually writing four random bytes (maybe using dd from /dev/random ) to the offset mentioned in my previous post. macOS does not automatically create one when partitioning as MBR unlike Linux or Windows.
The equivalent of the partition GUID is the partition offset in bytes which can be found using "diskutil info disk#s#" under "Partition Offset:" then converting the value to hexadecimal in little-endian byte order.
The fields for both items are sixteen bytes in length (size of GUID/UUID) so the remaining unused length must be zeros. You can probably just fill the disk and partition identifiers of the ready-made legacy BCD with a standard value that's easy to find and replace.
👍
2
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi! I'm trying to understand your scripts. To adapt the script, I need to use an old version of bash. Mac uses an outdated version of bash (for licensing reasons). Is the problem only in the readarray, or is there something else?
Last edit: Serhii 2024-04-29
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The problem I ran into with the old bash in macOS was a "bad substitution" error caused by the parameters where I convert the values to lower case (to avoid problems with case sensitivity) as well as the colorizing of warnings and error messages. I don't recall if there was an issue with readarray or other functions or substitutions.
👍
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I studied your scripts, very great and good work. Thank you! For my program, I took and adapted only the creation of BCD and left the choice of UEFI and Bios (for the future).
python3-c'import uuid; print(uuid.uuid4())'
replaced
uuidgen | tr A-Z a-z
hivexregedit and the library could not be made dynamic. And I found a good replacement - reged.
True, reged created a lot of emptiness in the BCD, so it had to be cut off.
head -c 27000 $HOME/BCD-Windows > /Volumes/EFI/EFI/Microsoft/Boot/BCD
head -c 27000 $HOME/BCD-Recovery > /Volumes/EFI/EFI/Microsoft/Recovery/BCD
This is what I added to the main script.
build_BCD(){echo"Build the main BCD store..."sudo-S./scripts/winload"$1""$2">$HOME/winload.txtcp./Templates/BCD-NEW$HOME/BCD-Windowssudo-S./tools/bin/reged-I-C$HOME/BCD-WindowsBCD00000001./Templates/winload.reg./tools/bin/hivexsh-w-f$HOME/winload.txt$HOME/BCD-Windowsif[["$2"=="uefi"]];thenecho"Build the recovery BCD store..."sudo-S./scripts/recovery>$HOME/recovery.txtcp./Templates/BCD-NEW$HOME/BCD-Recoverysudo-S./tools/bin/reged-I-C$HOME/BCD-RecoveryBCD00000001./Templates/recovery.reg./tools/bin/hivexsh-w-f$HOME/recovery.txt$HOME/BCD-Recoveryecho"Copy the BCD hives to the ESP folders..."head-c27000$HOME/BCD-Windows>/Volumes/EFI/EFI/Microsoft/Boot/BCDhead-c27000$HOME/BCD-Recovery>/Volumes/EFI/EFI/Microsoft/Recovery/BCDelif[["$2"=="bios"]];thenecho"Copy the main BCD hive to the boot folder..."head-c27000$tmpdir/BCD-Windows>"$1"/Boot/BCDfirm$HOME/winload.txtrm$HOME/recovery.txtrm$HOME/BCD-Windowsrm$HOME/BCD-Recovery}MountPoint=`diskutilinfodisk"$x"s"$y"|sed-n's/.*Mount Point: *//p'`fwmode="uefi"build_BCD"$MountPoint""$fwmode"
This is what is missing after conversion to hybrid partition of the GPT installation.
you have another tool called ms-sys, which looks more suitable for legacy/hybrid partitions.
Also to clarify hybrid partition cannot see the EFI partition and anything written to the EFI will not be visible from Windows. There is no system partition with Bootcamp (or gdisk). The system partition is the main Windows partition.
Last edit: Startergo 2024-03-25
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The bcd-sys tool does the equivalent of the first three commands (plus builds a new BCD hive) and ms-sys does the equivalent of the bootsect command. So you will need to use both to enable a new Windows installation. I'm currently updating bcd-sys to detect a hybrid MBR configuration since the script gathers device information based on the partition scheme. The version in my repo does not yet work properly in this scenario.
👍
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks if you are using Sierra or earlier when you create a FAT32 partition through disk utility it automatically converts the GPT to Hybrid partition.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks all. I have a suggestion. For the Legacy boot the partition needs to be converted to hybrid partition scheme (with gdisk.exe) from GPT instead of converting the whole disk to MBR.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Now Install Windows (legacy boot) works, but I'm testing on a PC. Can you check if you have an old Mac?
Conditions - the system is not higher than MacOS 12 Monterey and the disk should not be a system one (unless it is a hybrid one and Windows has not been installed before)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Great application! Any options or intentions to include legacy boot?
Unfortunately no.
By the way the application crashes:
Crash report
Previous version works
Thanks for the feedback and report. Corrected, download again.
Thanks. How about including hybrid MBR (GPT with modified boot code)? You only need
gdisk
as an additional tool to convert the GPT to hybrid partition (requred on legacy macs).You can find the details here
The only additional thing needed is to activate the BCD for MBR boot.
Last edit: Startergo 2024-03-02
Hi @Startergo, if you still want to enable legacy boot you may want to try the tool I linked in my post to@sergey-galan below. While I've not yet tried it with hybrid MBR the boot process should work the same way.
Actually, the hybrid MBR scheme is nothing more than protecting GPT partitions you want to hide from the MBR boot sector. So, the WIndows partition does not see the EFI partition when booted. There is no need for system partition all files are written to the main Windows partition. I looked through your repo and combined with Serhii's tool, which provides NTFS write support can do everything needed.
They banned me on Macrumors, they wrote that I am engaged in advertising. Probably because I was a newcomer there))). But the topic is still on Insanlymac and TonyMacx86.
In the old versions of the program, I used gdisk to obtain a GUID disk. But gdisk for some users refused to work in the script.
BCD for loading UEFI I take ready and create a patch GUID and UUID. What to do with BCD for MBR I do not know. Perhaps there may be enough GUID and UUID, and maybe something else.
Last edit: Serhii 2024-03-06
Hi @sergey-galan, if you're interested in implementing support for MBR/BIOS booting in your utility you need to patch the BCD with the Windows Disk Signature from the MBR (found at offset 440 bytes) and the system partition offset in bytes. Also the file paths must have the extensions changed from efi to exe. It's probably better to use a different BCD file for legacy boot.
I have a shell script called BCD-SYS that can do much of what the Microsoft bcdboot command does if you are interested. Let me know if you have questions.
Hello. BCD for UEFI uses a ready-made one and patches the GUID and UUID in it.
Is it enough to just use GUID and UUID patch for BCD MBR?
Yes, that should be fine. You'll need to create a BCD for MBR first then patch the disk and partition identifiers. You can use my script or the Windows bcdboot utility to create one.
The equivalent of the disk GUID will be the four byte Windows Disk Signature from the MBR. You may need to create this using signmbr or manually writing four random bytes (maybe using dd from /dev/random ) to the offset mentioned in my previous post. macOS does not automatically create one when partitioning as MBR unlike Linux or Windows.
The equivalent of the partition GUID is the partition offset in bytes which can be found using "diskutil info disk#s#" under "Partition Offset:" then converting the value to hexadecimal in little-endian byte order.
The fields for both items are sixteen bytes in length (size of GUID/UUID) so the remaining unused length must be zeros. You can probably just fill the disk and partition identifiers of the ready-made legacy BCD with a standard value that's easy to find and replace.
Hi! I'm trying to understand your scripts. To adapt the script, I need to use an old version of bash. Mac uses an outdated version of bash (for licensing reasons). Is the problem only in the readarray, or is there something else?
Last edit: Serhii 2024-04-29
The problem I ran into with the old bash in macOS was a "bad substitution" error caused by the parameters where I convert the values to lower case (to avoid problems with case sensitivity) as well as the colorizing of warnings and error messages. I don't recall if there was an issue with readarray or other functions or substitutions.
I studied your scripts, very great and good work. Thank you! For my program, I took and adapted only the creation of BCD and left the choice of UEFI and Bios (for the future).
replaced
hivexregedit and the library could not be made dynamic. And I found a good replacement - reged.
True, reged created a lot of emptiness in the BCD, so it had to be cut off.
This is what I added to the main script.
winload
recovery
update_device
Last edit: Serhii 2024-05-09
Will bcd-sys be equivalent to these commands:
This is what is missing after conversion to hybrid partition of the GPT installation.
you have another tool called ms-sys, which looks more suitable for legacy/hybrid partitions.
Also to clarify hybrid partition cannot see the EFI partition and anything written to the EFI will not be visible from Windows. There is no system partition with Bootcamp (or gdisk). The system partition is the main Windows partition.
Last edit: Startergo 2024-03-25
The bcd-sys tool does the equivalent of the first three commands (plus builds a new BCD hive) and ms-sys does the equivalent of the bootsect command. So you will need to use both to enable a new Windows installation. I'm currently updating bcd-sys to detect a hybrid MBR configuration since the script gathers device information based on the partition scheme. The version in my repo does not yet work properly in this scenario.
Thanks if you are using Sierra or earlier when you create a FAT32 partition through disk utility it automatically converts the GPT to Hybrid partition.
I saw you updated the BCD-SYS. Does it detect hybrid partitions now?
Last edit: Startergo 2024-04-02
Yes, as well as performs some sanity checks comparing firmware mode and partition schemes.
I did not know they banned you. I thought they only removed the post. Shame on them.
look here
and here
Thanks all. I have a suggestion. For the Legacy boot the partition needs to be converted to hybrid partition scheme (with gdisk.exe) from GPT instead of converting the whole disk to MBR.
Now Install Windows (legacy boot) works, but I'm testing on a PC. Can you check if you have an old Mac?
Conditions - the system is not higher than MacOS 12 Monterey and the disk should not be a system one (unless it is a hybrid one and Windows has not been installed before)