Skip to content

Instantly share code, notes, and snippets.

@neutronscott
Last active January 14, 2020 07:04
Show Gist options
  • Save neutronscott/de319214647082fc3f051f2e65fa8787 to your computer and use it in GitHub Desktop.
Save neutronscott/de319214647082fc3f051f2e65fa8787 to your computer and use it in GitHub Desktop.
notes on virtualbox running boot camp partition
1. Create VMDK mimic layout of real HDD.
Slices were readable but raw disk wasn't in macos, so I just wrote down all the "diskutil info disk0s1"
info and converted 4096-byte-sectors to 512 by multiplying by 8. Also I offset disk0s1 by 1 sector.
This allowed me to copy the first sector and manually edit the Bytes/sector, Sector/Cluster, Hidden Sectors,
and Total Sectors in the NTFS BPB. Windows sees it as a RAW partition otherwise, even though Linux has no
problem figuring it out. Finally I recreated the blank space at the end as a writable area since the
alternate GPT is stored there.
# Extent description
#disk start end size
#disk0 0 236978176 236978176
#disk0s1 48 614448 614400
#disk0s2 614448 137334784 136720336
#disk0s3 137334784 236713984 99379200
#2008 missing here
#disk0s4 236715992 236978136 262144
RW 614448 FLAT "disk0-with-s1.raw" 0
RW 136720336 ZERO
# keep NTFS PBR in separate file so can change Bytes/Sector and Sector/Cluster
RW 1 FLAT "disk0s3.pbr" 0
RW 99379199 FLAT "/dev/disk0s3" 1
# extra 2008 sectors due empty space between s3/s4
RW 264152 ZERO
RW 40 FLAT "alt_gpt_area.raw" 0
2. Boot a Linux GParted Live CD or similar to re-create partition table (could copy from real HDD if you
disable SIP or boot into Recovery)
I created fat32 EFI partition (mark ESP) as 100MB even though my original was 300MB. I created empty Microsoft Reserved
partitions over the free space that is ZERO which holds place for MacOS drives.
3. Make some SMBIOS things match so activation stays. I didn't check exactly which were necessary. I did these:
VBoxManage setextradata win10vm "VBoxInternal/Devices/ahci/0/Config/Port0/FirmwareRevision" value="717.60.1"/>
VBoxManage setextradata win10vm "VBoxInternal/Devices/ahci/0/Config/Port0/ModelNumber" value="APPLE SSD AP0128N"/>
VBoxManage setextradata win10vm "VBoxInternal/Devices/ahci/0/Config/Port0/SerialNumber" value="FV992XXXXXXXXXXXX"/>
VBoxManage setextradata win10vm "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" value="Mac-1234567890abcdef"/>
VBoxManage setextradata win10vm "VBoxInternal/Devices/efi/0/Config/DmiSystemFamily" value="MacBook Air"/>
VBoxManage setextradata win10vm "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" value="MacBookAir8,2"/>
VBoxManage setextradata win10vm "VBoxInternal/Devices/efi/0/Config/DmiSystemSerial" value="FVXXXXXXXXXX"/>
VBoxManage setextradata win10vm "VBoxInternal/Devices/efi/0/Config/DmiSystemUuid" value="ae4f1df8-ec7d-d011-a765-00a0c91e6bf6"/>
VBoxManage setextradata win10vm "VBoxInternal/Devices/efi/0/Config/DmiSystemVendor" value="<EMPTY>"/>
VBoxManage setextradata win10vm "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" value="<EMPTY>"/>
Note that Microsoft and VirtualBox treat the Uuid differently. Here is example. You boot into real Windows 10
and run from cmd: wmic csproduct list full
input: f81d4fae-7dec-11d0-a765-00a0c91e6bf6
output: ae4f1df8-ec7d-d011-a765-00a0c91e6bf6
The UUID given in macOS's system information was not the same ...
4. Boot Windows ISO and recreate BCD on EFI partition. Mine was vol 2, after ISO and C:, and had to
be assigned a drive letter.
diskpart
list vol
select vol 2
assign letter=e
quit
E:
bcdboot C:\Windows
5. Boot VM with Windows **installing VBoxGuest tools renders system unable to boot bare metal**
If you go to boot bare metal it will do automatic repair and fail. Can run Command Prompt from Recovery menu
and go to C:\Windows\System32\DRIVERS and rename VBoxGuest.sys to VBoxGuest.sys.bak and restart again.
6. todo - hack up vboxguest.sys
vboxguest.sys fails to load, says corrupted, when booted on bare metal
1400490d5: bb 6c 02 00 c0 mov $0xc000026c,%ebx
(file offset 00036cd5)
of course editing this breaks the digital signature so I need to get SDK to try further
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment