myspaghetti / macos-virtualbox

Push-button installer of macOS Catalina, Mojave, and High Sierra guests in Virtualbox on x86 CPUs for Windows, Linux, and macOS
GNU General Public License v2.0
13.5k stars 1.12k forks source link

Pass MLB nvram parameter to virtual machine #76

Closed mikekenyon99 closed 3 years ago

mikekenyon99 commented 5 years ago

Hi, I have set up a few Hackintoshs in the past using Clover and I have just used your new excellent script. It works a treat for VirtualBox. :-)

However to get iMessage to work you need set serial number, boardid and the MLB (Mac Logic Board) this is sometimes referred to as Board Serial Number.

In your documentation you say to post-install put the serial number (for the machine) in:

after the installation with VBoxManage setextradata "${vmname}" "VBoxInternal/Devices/efi/0/Config/DmiSystemSerial" "${serialnumber}".

Therefore, what is the efi/0/Config/xxxxxxxxx reference for the MLB/Board Serial Number?

Mike

myspaghetti commented 5 years ago
VBoxManage setextradata "${vmname}" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "${devicename}"
VBoxManage setextradata "${vmname}" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "${boardid}"
VBoxManage setextradata "${vmname}" "VBoxInternal/Devices/efi/0/Config/DmiSystemSerial" "${serialnumber}"

I'll add this to the readme.

myspaghetti commented 5 years ago

The MLB/UUID can be set with

VBoxManage setextradata "${vmname}" "VBoxInternal/Devices/efi/0/Config/DmiSystemUuid" "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF"

However I'm not sure it's required for iMessage. I'll test this later this week.

mikekenyon99 commented 5 years ago

Hi, I use iMessageDebug2 which you can download from https://www.tonymacx86.com/threads/how-to-fix-imessage.110471/ to check if its not working. Using your script and my values I still have nulls, you can see this in the images here:

From a working physical Hackintosh machine: Working

From the VM created using the script - note the null value in the field: Faulty

Mike

myspaghetti commented 5 years ago

I can't find a way to pass these parameters to the VirtualBox virtual machine. You may pass them by running the virtual machine on VMWare or by installing Clover. I am looking for a version of Clover that boots High Sierra, Mojave, and Catalina on VirtualBox, and will update the readme and script with it if I find one.

mikekenyon99 commented 5 years ago

I have tried several different ways of getting Clover to work on VirtualBox but couldn't get to install properly. Therefore, if you find a way I would be very much interested. I would be keen to know how the people have got iMessage to work using the script on this GitHub site - I can't?

myspaghetti commented 5 years ago

MLB successfully passed in version 0.70.3. iMessage now works with non-genuine Apple parameters.

One parameter, system-id, still escapes me, so you can't use genuine Apple parameters that are copied from a genuine Mac just yet.

mikekenyon99 commented 5 years ago

Thats brilliant, however, Im away for a few days now without access to test rig. Will test next week, and report back. Good work :-)

chestnut-vinegar commented 5 years ago

Apologies for replying to this thread, but I'm not sure where else to post. I have an existing VirtualBox macOS Mojave install and I'm trying to modify the .vbox configuration to add iMessage support. Like mike earlier, using the iMessageDebug script, I too am missing the MLB parameter and it's displaying as null.

Looking at your shell script for ideas, I therefore try to append the following to my .vbox configuration:

<ExtraDataItem name="VBoxInternal/Devices/efi/0/LUN#0/Config/Vars/0000/Name" value="MLB"/>
<ExtraDataItem name="VBoxInternal/Devices/efi/0/LUN#0/Config/Vars/0000/Value" value="C02XXXXXXXXXXXXXX"/>
<ExtraDataItem name="VBoxInternal/Devices/efi/0/LUN#0/Config/Vars/0001/Uuid" value="4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14"/>

Every time I try to start the VM however, VirtualBox throws an error with 'Value no found. (VERR_CFGM_VALUE_NOT_FOUND)'.

I originally added the configuration using "VBoxManage setextradata" via windows command line but I'm not sure what else to try here. Any pointers would be greatly appreciated. Thanks.

mikekenyon99 commented 5 years ago

@chestnut-vinegar I just used the latest script and iMessage worked great this time - thanks! However if your editing a different then it might be different. Good luck!

myspaghetti commented 5 years ago

@chestnut-vinegar There's no problem replying to closed issues or creating new issues; that's what the issues section is for.

TL;DR: install xxd


The script secretly, quietly fails assigning ${ROM} and ${UUID} if the secret dependency xxd is not installed. I'll explain:

The script assigns two different EFI variable in the Vars tree (0000 and 0001) and an EFI UUID. Each EFI variable is given its own 4-digit index (0000, 0001, 0002, and so on) and three values: Name, Value, Uuid. The EFI UUID is placed elsewhere.

The script assigns these values when you run ./macos-guest-virtualbox.sh configure_vm or during a complete installation:

VBoxManage setextradata "${vmname}" "VBoxInternal/Devices/efi/0/LUN#0/Config/Vars/0000/Uuid" "4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14"
VBoxManage setextradata "${vmname}" "VBoxInternal/Devices/efi/0/LUN#0/Config/Vars/0000/Name" "MLB"
VBoxManage setextradata "${vmname}" "VBoxInternal/Devices/efi/0/LUN#0/Config/Vars/0000/Value" "${MLB}"
VBoxManage setextradata "${vmname}" "VBoxInternal/Devices/efi/0/LUN#0/Config/Vars/0001/Uuid" "4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14"
VBoxManage setextradata "${vmname}" "VBoxInternal/Devices/efi/0/LUN#0/Config/Vars/0001/Name" "ROM"
VBoxManage setextradata "${vmname}" "VBoxInternal/Devices/efi/0/LUN#0/Config/Vars/0001/Value" "${ROM}"
VBoxManage setextradata "${vmname}" "VBoxInternal/Devices/efi/0/Config/UUID" "${UUID}"

Crucually, the ${MLB} variable is a base64-encoded string prefixed with the string bytes::

MLB="bytes:$(echo -n "${DmiBoardSerial}" | base64)"

...and the ${ROM} and ${UUID} values are base64-encoded base16 (HEX) values, not strings, prefixed with the string bytes::

# The if statement below converts the Mac output into VBox-readable values
# This is only necessary if you want to run connected Apple applications
# such as iCloud, iMessage, etc.
# Make sure the package xxd is installed, otherwise the conversion will fail.
if [ -n "$(echo -n "aabbccddee" | xxd -r -p 2>/dev/null)" ]; then
    # Apologies for the one-liner below; it convers the mixed-ASCII-and-base16
    # ROM value above into an ASCII string that represents a base16 number.
    ROM_b16="$(for (( i=0; i<${#ROM}; )); do let j=i+1; if [ "${ROM:${i}:1}" == "%" ]; then echo -n "${ROM:${j}:2}"; let i=i+3; else x="$(echo -n "${ROM:${i}:1}" | od -t x1 -An | tr -d ' ')"; echo -n "${x}"; let i=i+1; fi; done)"
    ROM_b64="$(echo -n "${ROM_b16}" | xxd -r -p | base64)"
    ROM="bytes:${ROM_b64}"
    UUID_b64="$(echo -n "${UUID}" | xxd -r -p | base64)"
    UUID="bytes:${UUID_b64}"
else
    ROM="bytes:qiq7Z8zd"                  # base64 of the example ROM
    UUID="bytes:qrvM3e7/ABEiM0RVZneImQ==" # base64 of the example UUID
fi

xxd is not listed as a dependency of the script. Why? Uh...

At any rate that's the story of iCloud and iMessage connectivity and why it fails if you don't have xxd installed.

myspaghetti commented 5 years ago

Made the xxd dependency less secret in version 0.71.5

chestnut-vinegar commented 5 years ago

Thanks for the details myspaghetti.

I'm currently on a Windows environment with VirtualBox and a macOS Mojave guest. After noticing iMessage and iCloud services not working, I stumbled across your shell script and started injecting missing bits of config into the existing macOS VM. I'm doing this by directly editing the .vbox configuration of the machine itself.

Using clover to provide me with UUID, MLB and ROM values, I converted the MLB and UUID values to Base64, then finally the ROM value to Hex and then to Base64 appending the word "bytes:" to the beginning of each value. This got me further and the macOS VM starts without errors but looking at the iMessageDebug script still provided the same null values.

Scratching my head further, I decided to install Windows Subsystem for Linux and execute your script partially from lines 1-66 replacing MLB, ROM and UUID with values of my own (on lines, 37, 39 and 41). I then echo'd these values out and replaced them in my .vbox configuration once more. However, I'm still encountering the same problems where the debug script displays nulls.

I'm concluding this may all be down to incorrect values I'm providing for UUID, MLB and ROM so... may need a bit of cheeky guidance on that. I'm fairly inexperienced when it comes to macOS and Linux for that matter, but I am also deliberating recycle a spare box to execute your script from scratch when I find energy!

myspaghetti commented 5 years ago

In version 0.71.5, you need to supply the MLB in line 36, the ROM in like 39, and the UUID (which doesn't get passed to the virtual machine, so it doesn't really matter) in line 41. If you edited line 37 there might have been a discrepancy between the DmiBoardSerial and MLB. They need to be strings, and the script will convert them to base64 automatically.

Mind that because of the missing Apple parameters such as the UUID, the script can't copy a genuine Mac completely so you can't use genuine serials and other parameters, on, only genuine-like parameters.

I tried using parameters from Macs I own and I got "call customer support" because, among other things, the UUID doesn't get passed to the virtual machine and so there's a mismatch in identification. Using genuine-like (but not genuine) serials and other parameters solves this issue.

You don't have to run the script from scratch to apply the parameters, you can use ./macos-guest-virtualbox.sh configure_vm

myspaghetti commented 5 years ago

Support for the NVRAM parameter system-id added in version 0.73.0

Other interesting NVRAM parameters provided by erikberglund:

4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:AAPL,PathProperties0000
4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:BackgroundClear
4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:BBIF
4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:current-network
4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:FirmwareFeatures
4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:FirmwareFeaturesMask
4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:gfx-saved-config-restore-status
4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:GR_CAUSE
4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:HardwareBootMode
4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:HW_BID
4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:HW_ICT
4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:HW_MLB
4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:HW_ROM
4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:MLB
4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:PickerEntryReason
4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:ROM
4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:security-key
4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:SSN
4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:UIScale
4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:IASInstallPhaseList
4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:IASCurrentInstallPhase
7C436110-AB2A-4BBB-A880-FE41995C9F82:AAPL,PanicInfo0000
7C436110-AB2A-4BBB-A880-FE41995C9F82:AAPL,PanicInfoLog
7C436110-AB2A-4BBB-A880-FE41995C9F82:ALS_Data
7C436110-AB2A-4BBB-A880-FE41995C9F82:backlight-level
7C436110-AB2A-4BBB-A880-FE41995C9F82:bluetoothActiveControllerInfo
7C436110-AB2A-4BBB-A880-FE41995C9F82:bluetoothInternalControllerInfo
7C436110-AB2A-4BBB-A880-FE41995C9F82:BootCampHD
7C436110-AB2A-4BBB-A880-FE41995C9F82:BootCampProcessorPstates
7C436110-AB2A-4BBB-A880-FE41995C9F82:boot-args
7C436110-AB2A-4BBB-A880-FE41995C9F82:boot-gamma
7C436110-AB2A-4BBB-A880-FE41995C9F82:boot-image
7C436110-AB2A-4BBB-A880-FE41995C9F82:boot-switch-vars
7C436110-AB2A-4BBB-A880-FE41995C9F82:boot-signature
7C436110-AB2A-4BBB-A880-FE41995C9F82:csr-active-config
7C436110-AB2A-4BBB-A880-FE41995C9F82:csr-data
7C436110-AB2A-4BBB-A880-FE41995C9F82:efi-apple-recovery
7C436110-AB2A-4BBB-A880-FE41995C9F82:efi-apple-payload#
7C436110-AB2A-4BBB-A880-FE41995C9F82:efi-apple-payload#-data
7C436110-AB2A-4BBB-A880-FE41995C9F82:efi-boot-device
7C436110-AB2A-4BBB-A880-FE41995C9F82:efi-boot-device-data
7C436110-AB2A-4BBB-A880-FE41995C9F82:efi-boot-mkext
7C436110-AB2A-4BBB-A880-FE41995C9F82:efi-boot-next
7C436110-AB2A-4BBB-A880-FE41995C9F82:efi-boot-file
7C436110-AB2A-4BBB-A880-FE41995C9F82:efi-boot-file-data
7C436110-AB2A-4BBB-A880-FE41995C9F82:efi-boot-kernelcache
7C436110-AB2A-4BBB-A880-FE41995C9F82:efi-boot-kernelcache-data
7C436110-AB2A-4BBB-A880-FE41995C9F82:efi-legacy-drive-hint
7C436110-AB2A-4BBB-A880-FE41995C9F82:efi-legacy-drive-hint-data
7C436110-AB2A-4BBB-A880-FE41995C9F82:efiboot-perf-record
7C436110-AB2A-4BBB-A880-FE41995C9F82:EFICapsule_Result
7C436110-AB2A-4BBB-A880-FE41995C9F82:fmm-computer-name
7C436110-AB2A-4BBB-A880-FE41995C9F82:fmm-mobileme-token-FMM
7C436110-AB2A-4BBB-A880-FE41995C9F82:gpu-policy
7C436110-AB2A-4BBB-A880-FE41995C9F82:KTSStatus
7C436110-AB2A-4BBB-A880-FE41995C9F82:KTSPrevious
7C436110-AB2A-4BBB-A880-FE41995C9F82:KTSResult
7C436110-AB2A-4BBB-A880-FE41995C9F82:LocationServicesEnabled
7C436110-AB2A-4BBB-A880-FE41995C9F82:platform-uuid
7C436110-AB2A-4BBB-A880-FE41995C9F82:prev-lang:kbd
7C436110-AB2A-4BBB-A880-FE41995C9F82:recovery-boot-mode
7C436110-AB2A-4BBB-A880-FE41995C9F82:SmcFlasherResult
7C436110-AB2A-4BBB-A880-FE41995C9F82:SystemAudioVolume
7C436110-AB2A-4BBB-A880-FE41995C9F82:SystemAudioVolumeDB
7C436110-AB2A-4BBB-A880-FE41995C9F82:system-id
7C436110-AB2A-4BBB-A880-FE41995C9F82:usb-cr-rec
8D63D4FE-BD3C-4AAD-881D-86FD974BC1DF:boot-info-payload
8D63D4FE-BD3C-4AAD-881D-86FD974BC1DF:last-oslogin-ident
AF9FFD67-EC10-488A-9DFC-6CBF5EE22C2E:AcpiGlobalVariable
8BE4DF61-93CA-11D2-AA0D-00E098032B8C:AuditMode
8BE4DF61-93CA-11D2-AA0D-00E098032B8C:Boot####
8BE4DF61-93CA-11D2-AA0D-00E098032B8C:BootCurrent
8BE4DF61-93CA-11D2-AA0D-00E098032B8C:BootNext
8BE4DF61-93CA-11D2-AA0D-00E098032B8C:BootOrder
8BE4DF61-93CA-11D2-AA0D-00E098032B8C:OsIndications
05299C28-3953-4A5F-B7D8-F6C6A7150B2A:SetupDefaults
4DFBBAAB-1392-4FDE-ABB8-C41CC5AD7D5D:Setup
79941ECD-ED36-49D0-8124-E4C31AC75CD4:AmdAcpiVar
EB704011-1402-11D3-8E77-00A0C969723B:SetupDefaults
myspaghetti commented 5 years ago

Tested with parameters copied from a genuine Mac, iMessage works.

lenninscjay commented 4 years ago

... or by installing Clover. I am looking for a version of Clover that boots High Sierra, Mojave, and Catalina on VirtualBox, and will update the readme and script with it if I find one.

god your script is beautiful. Thanks! I still want to install and thence boot via clover. I've been racking my head on it for the last 3 days (both pre vm install and post) and am having no success. I know it's beyond the scope of this script but if you figured out a way to do it I'd love to hear it!

myspaghetti commented 4 years ago

If you want Clover for the NVRAM parameters that's no longer necessary, you can use the EFI Internal Shell to set them with NVRAM files generated by the NVRAM generator script or use the built-in settings in macos-guest-virtualbox.sh

If you want Clover as a general bootloader then I strongly recommend using OpenCore instead, I believe it is feature-complete with Clover and has many more features and bugfixes.

lenninscjay commented 4 years ago

If you want Clover for the NVRAM parameters that's no longer necessary, you can use the EFI Internal Shell to set them with NVRAM files generated by the NVRAM generator script or use the built-in settings in macos-guest-virtualbox.sh

If you want Clover as a general bootloader then I strongly recommend using OpenCore instead, I believe it is feature-complete with Clover and has many more features and bugfixes.

Thank you, I've successfully passed all the nvram parameters via the script and EFI shell (genius) All my services are working as intended... but I was hoping to get clover installed for more control over NVRAM outside of the script. I had heard of but hadn't considered opencore. I will research it further.

Thanks for the response!

startergo commented 4 years ago

@myspaghetti I am genuinely confused here. If I follow your script:

 DmiBIOSVersion="string:MBP7.89"      # Boot ROM Version
#   ioreg -l | grep -m 1 board-id
DmiBoardProduct="Mac-3CBD00234E554E41"
#   nvram 4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:MLB
DmiBoardSerial="NO_LOGIC_BOARD_SN"
MLB="${DmiBoardSerial}"
#   nvram 4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:ROM
ROM='%aa*%bbg%cc%dd'
#   ioreg -l -p IODeviceTree | grep \"system-id
SYSTEM_UUID="aabbccddeeff00112233445566778899"
#   csrutil status
SYSTEM_INTEGRITY_PROTECTION='10'  # '10' - enabled, '77' - disabled

And put MLB and ROM values extracted from my other machine in the macos_vm_vars_file then the values in the Vbox are different. So if they need to be base64 values isn't it better to update the comments in the script:

#   nvram -x 4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:MLB
#   nvram -x 4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:ROM

We need the base64 values in the setvar() or macos_vm_vars_file , right?

myspaghetti commented 4 years ago

@startergo the values need to be copied exactly as they are in the output on the genuine Apple device. You can see the examples in the script, such as ROM='%aa*%bbg%cc%dd', this is a string that partly represents base-16 nibbles grouped into bytes, for example %aa represents the base-16 number AA, and partly represents ASCII characters of the corresponding base-16 number, for example the ASCII character * represents the base-16 number 2A. Why Apple chose this strange format, I don't know, but if you copy the string exactly as it appears in the output, the script will produce the correct NVRAM parameter. Same for MLB, which is thankfully a simple ASCII string.

After the script generates and copies the NVRAM files and the startup.nsh script to the EFI System Partition, VirtualBox needs to be booted into the EFI Internal Shell where it runs the startup.nsh script that enters the NVRAM parameters into the virtual machine's NVRAM.

This is documented in the Applying the EFI and NVRAM parameters section of the documentation.

startergo commented 4 years ago

but if you copy the string exactly as it appears in the output, the script will produce the correct NVRAM parameter

I must be doing something wrong because after:

./macos-guest-virtualbox.sh set_variables create_nvram_files

I don't see in the generated NVRAM files my ROM and MLB in the macos_vm_vars_file and the lines are:

DmiBoardSerial="whateverserial"  
ROM='wh%8f%at%19%c4'

When I changed the values in the script it generated the NVRAM, but not from the macos_vm_vars_file. Where is my mistake?

myspaghetti commented 4 years ago

ROM='wh%8f%at%19%c4'

t is not a valid base-16 digit. The script silently discards the %at part.

Valid input would be wh%8f%aat%19%c4. That would be entered as follows:

echo '# these are a bunch of bash variable assignments in a plaintext file' > example_vars_file
echo 'vm_name="nvram_example"' >> example_vars_file
echo 'DmiBoardSerial="whateverserial"' >> example_vars_file
echo "ROM='wh%8f%aat%19%c4'" >> example_vars_file
export macos_vm_vars_file=example_vars_file
./macos-guest-virtualbox.sh create_nvram_files create_macos_installation_files_viso

This generates five files: nvram_example_csr-active-config.bin nvram_example_MLB.bin nvram_example_ROM.bin nvram_example_system-id.bin Catalina_Installation_files.viso

Here's the output of xxd nvram_example_ROM.bin:

00000000: 0800 0000 0700 0000 5200 4f00 4d00 0000  ........R.O.M...
00000010: 05de 1e4d c738 6a4a 9cc6 4bcc a8b3 8c14  ...M.8jJ..K.....
00000020: 0700 0000 7768 8faa 7419 c446 c1df fd    ....wh..t..F...

7768 8faa 7419 c4 is the ROM value that was assigned in example_vars_file.

Now we need to copy the NVRAM files to the EFI System Partition. The documentation suggests doing this with a VISO file:

After executing the command, attach the resulting VISO file to the virtual
machine's storage through VirtualBox Manager or VBoxManage. Power up the VM
and boot macOS, then start Terminal and execute the following commands, making
sure to replace "/Volumes/path/to/VISO/" with the correct path:

    mkdir ESP
    sudo su # this will prompt for a password
    diskutil mount -mountPoint ESP disk0s1
    cp -r /Volumes/path/to/VISO/ESP/* ESP/

After copying the files, boot into the EFI Internal Shell as desribed in the
section "Applying the EFI and NVRAM parameters".
startergo commented 4 years ago

./macos-guest-virtualbox.sh create_nvram_files create_macos_installation_files_viso I tried this exact example and my real MLB:

Pn4g1cm.MBQtww...

But the nvram still takes this: image

For some reason it does not like the MLB's

By the way I use easier method for replacing NVRAM files. I use ImDisk to mount the EFI partition of the drive and replace the files inside.

myspaghetti commented 4 years ago

Assign MLB separately from DmiBoardSerial:

echo 'DmiBoardSerial="whateverserial"' >> example_vars_file
echo 'MLB="whateverserial"' >> example_vars_file

DmiBoardSerial assigns the serial in the EFI parameters. MLB assigns the serial in the NVRAM parameters.

startergo commented 4 years ago

Assign MLB separately from DmiBoardSerial:

echo 'DmiBoardSerial="whateverserial"' >> example_vars_file
echo 'MLB="whateverserial"' >> example_vars_file

DmiBoardSerial assigns the serial in the EFI parameters. MLB assigns the serial in the NVRAM parameters.

That works. So apart from the MLB are there any other parameters which need to be generated as an EFI or NVRAM parameter? What is the difference between SYSTEM_UUID and DmiSystemUuid? Are the both representing the hardware UUID in the about this MAC?

ioreg -l -p IODeviceTree | grep \"system-id

returns nothing. Also nothing in the IORegistryexplorer. Is SYSTEM_UUID="" (empty string) acceptable value?

Are these all parameters?

DmiSystemFamily="Apple Device"   
DmiSystemProduct="Vmware7,1"   
DmiSystemSerial="serial"    
DmiSystemUuid="00000000-0000-1000-8000-000DF4555157"   
DmiOEMVBoxVer="string:[MS_VM_CERT/SHA1/27d66596a61c48dd3dc7216fd715126e33f59ae7]"
DmiOEMVBoxRev="string:Welcome to the Virtual Machine"     
DmiBIOSVersion="VMW71.00V.16068103.B64.2004200145"   
DmiBoardProduct="boarID"    
DmiBoardSerial="MLBserial"
MLB="MLBserial"
ROM='GZ%8b%9a%19%d4'
SYSTEM_UUID=""
myspaghetti commented 4 years ago

which need to be generated as an EFI or NVRAM parameter? Are these all parameters?

See the documentation.

SYSTEM_UUID and DmiSystemUuid? Are the both representing the hardware UUID in the about this MAC?

No, one is the hardware UUID and the other is the system ID.

ioreg -l -p IODeviceTree | grep \"system-id returns nothing

See documentation. You're not running this on a genuine Mac but a VMWare instance.

startergo commented 4 years ago

You're not running this on a genuine Mac but a VMWare instance

Have you used a VM with Identical NVRAM parameters as the real machine querying Apple servers alongside the real machine doing the same? Isn't this presenting an issue?

myspaghetti commented 4 years ago

Isn't this presenting an issue?

Not with the script. This issue tracker is for issues with the script, not for general issues with virtualizing macOS.

The documentation doesn't say "execute these commands on a virtual machine." The documentation says:

The comments at the top of the script specify how to view these variables
on a genuine Mac.
startergo commented 4 years ago

Isn't this presenting an issue?

Not with the script. This issue tracker is for issues with the script, not for general issues with virtualizing macOS.

The documentation doesn't say "execute these commands on a virtual machine." The documentation says:

The comments at the top of the script specify how to view these variables
on a genuine Mac.

My question was: Have you used a Virtual Box (OSX guest) with Identical NVRAM parameters as the real machine (real MAC) querying Apple servers alongside the real machine doing the same? Isn't this presenting an issue?

myspaghetti commented 4 years ago

Not with the script. This issue tracker is for issues with the script, not for general issues with virtualizing macOS.

startergo commented 4 years ago

I have installed the virtual machine replacing in the script itself my iMacPro1,1 parameters, but when I query the board-id I get 2 different board-id's:

 ioreg -l | grep "board-id" | awk -F\" '/board-id/{print $(NF-1)}'
Mac-7BA5B2D9E42DDD94
Mac-27AD2F918AE68F61

 ioreg -l | grep -m 1 board-id
    |   "board-id" = <"Mac-7BA5B2D9E42DDD94">

Not sure where Mac-27AD2F918AE68F61 came from? That is from MacPro7,1. I don't see it anywhere in the script.

startergo commented 4 years ago

Here is an example script that can be incorporated in the project for creating macos_vm_vars_file from a genuine Mac.

#!/usr/bin/env zsh

readonly DmiSystemSerial="$(ioreg -c IOPlatformExpertDevice -d 2 | awk -F\" '/IOPlatformSerialNumber/{print $(NF-1)}')"
HOST_ID=$(ioreg -p IODeviceTree -r -n / -d 1 | grep board-id);HOST_ID=${HOST_ID##*<\"};HOST_ID=${HOST_ID%%\">};
readonly SYSTEM_UUID="$(ioreg -l -p IODeviceTree | awk -F"\<|>" '/"system-id"/{print $(NF-1)}')"
readonly DmiSystemFamily="$(system_profiler SPHardwareDataType |  awk -F": " ' /Model Name/ { print $2 } ')"
readonly DmiSystemProduct="$(system_profiler SPHardwareDataType |  awk -F": " ' /Model Identifier/ { print $2 } ')"
readonly DmiSystemUuid="$(system_profiler SPHardwareDataType |  awk -F": " ' /Hardware UUID/ { print $2 } ')"
readonly DmiOEMVBoxRev="$(system_profiler SPHardwareDataType |  awk -F": " ' /Apple ROM Info/ { print $2 } ')"
readonly DmiBIOSVersion="$(system_profiler SPHardwareDataType |  awk -F": " ' /Boot ROM Version/ { print $2 } ')"
readonly DmiBoardSerial="$(system_profiler SPHardwareDataType |  awk -F": " ' /Serial Number/ { print $2 } ')"
readonly ROM="$(nvram 4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:ROM |  awk -F" " ' /ROM/ { print $2 } ')"
readonly MLB="$(nvram 4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:MLB |  awk -F" " ' /MLB/ { print $2 } ')"

Echo DmiSystemSerial="'$DmiSystemSerial'" > macos_vm_vars_file
Echo DmiBoardProduct="'$HOST_ID'" >> macos_vm_vars_file
Echo SYSTEM_UUID="'$SYSTEM_UUID'" >> macos_vm_vars_file
Echo DmiSystemFamily="'$DmiSystemFamily'" >> macos_vm_vars_file
Echo DmiSystemProduct="'$DmiSystemProduct'" >> macos_vm_vars_file
Echo DmiSystemUuid="'$DmiSystemUuid'" >> macos_vm_vars_file
Echo DmiOEMVBoxRev="'$DmiOEMVBoxRev'" >> macos_vm_vars_file
Echo DmiBIOSVersion="'$DmiBIOSVersion'" >> macos_vm_vars_file
Echo DmiBoardSerial="'$DmiBoardSerial'" >> macos_vm_vars_file
echo MLB="'$MLB'" >> macos_vm_vars_file
Echo ROM="'$ROM'" >> macos_vm_vars_file
echo SYSTEM_INTEGRITY_PROTECTION="'77'" >> macos_vm_vars_file
myspaghetti commented 4 years ago

@startergo nice! You can clean up a bit of syntactic noise by putting the entire block of text in a single echo command. Also mind that bash and zsh don't expand variables in single-quotes. echo -n '$MLB' returns $MLB while echo -n "${MLB}" returns the value stored in MLB

startergo commented 4 years ago

I am not sure what you mean about the single quotes, but here is a one-liner. Just copy/paste to terminal and hit enter:

DmiSystemSerial="$(ioreg -c IOPlatformExpertDevice -d 2 | awk -F\" '/IOPlatformSerialNumber/{print $(NF-1)}')";  echo DmiSystemSerial="'$DmiSystemSerial'" > macos_vm_vars_file &&
HOST_ID=$(ioreg -p IODeviceTree -r -n / -d 1 | grep board-id);HOST_ID=${HOST_ID##*<\"};HOST_ID=${HOST_ID%%\">}; echo DmiBoardProduct="'$HOST_ID'" >> macos_vm_vars_file &&
SYSTEM_UUID="$(ioreg -l -p IODeviceTree | awk -F"\<|>" '/"system-id"/{print $(NF-1)}')"; Echo SYSTEM_UUID="'$SYSTEM_UUID'" >> macos_vm_vars_file &&
DmiSystemFamily="$(system_profiler SPHardwareDataType |  awk -F": " ' /Model Name/ { print $2 } ')"; echo DmiSystemFamily="'$DmiSystemFamily'" >> macos_vm_vars_file &&
DmiSystemProduct="$(system_profiler SPHardwareDataType |  awk -F": " ' /Model Identifier/ { print $2 } ')";  echo DmiSystemProduct="'$DmiSystemProduct'" >> macos_vm_vars_file&&
DmiSystemUuid="$(system_profiler SPHardwareDataType |  awk -F": " ' /Hardware UUID/ { print $2 } ')"; echo DmiSystemUuid="'$DmiSystemUuid'" >> macos_vm_vars_file &&
DmiOEMVBoxRev="$(system_profiler SPHardwareDataType |  awk -F": " ' /Apple ROM Info/ { print $2 } ')"; echo DmiOEMVBoxRev="'$DmiOEMVBoxRev'" >> macos_vm_vars_file &&
DmiBIOSVersion="$(system_profiler SPHardwareDataType |  awk -F": " ' /Boot ROM Version/ { print $2 } ')"; echo DmiBIOSVersion="'$DmiBIOSVersion'" >> macos_vm_vars_file &&
DmiBoardSerial="$(nvram 4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:MLB |  awk -F" " ' /MLB/ { print $2 } ')"; echo DmiBoardSerial="'$DmiBoardSerial'" >> macos_vm_vars_file &&
ROM="$(nvram 4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:ROM |  awk -F" " ' /ROM/ { print $2 } ')"; echo ROM="'$ROM'" >> macos_vm_vars_file &&
MLB="$(nvram 4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14:MLB |  awk -F" " ' /MLB/ { print $2 } ')"; echo MLB="'$MLB'" >> macos_vm_vars_file

I tried this on MacBook Pro15,1 and on cMP5,1. I don't know where DmiOEMVBoxRev='' Apple ROM Info is used but it returns empty string on both machines. Also I don't understand the logic in your script for:

DmiOEMVBoxVer="string:1"             # Apple ROM Info
DmiOEMVBoxRev="string:.23456"        # Apple ROM Info

You concatenate these 2 variables, but they can be extracted with a single variable Apple ROM Info when injected to the virtual machine. Anyway which machines have that parameter?

myspaghetti commented 4 years ago

I am not sure what you mean about the single quotes

I was wrong, I thought you quoted variables in single quotes but you didn't.

here is a one-liner

That's even harder to read. I meant using one echo command for outputting the file:


echo "
a='${a}'
b='${b}'
etc='${etc}'
"
myspaghetti commented 4 years ago

Anyway which machines have that parameter?

Apparently old-ish Macs, since you're the second person to report that new-ish MacBook Pros don't have them. I'll update the documentation.

organicdeveloper-net commented 4 years ago

Lol ha ha ha I just got a MacBook pro,,tired of virtual box but love vbox

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10

From: Jackmailto:notifications@github.com Sent: Wednesday, July 15, 2020 8:28 PM To: myspaghetti/macos-virtualboxmailto:macos-virtualbox@noreply.github.com Cc: Subscribedmailto:subscribed@noreply.github.com Subject: Re: [myspaghetti/macos-virtualbox] Pass MLB nvram parameter to virtual machine (#76)

Anyway which machines have that parameter?

Apparently old-ish Macs, since you're the second person to report that new-ish MacBook Pros don't have them. I'll update the documentation.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/myspaghetti/macos-virtualbox/issues/76#issuecomment-659101750, or unsubscribe [removed unsubscribe URL - myspaghetti]

rbreaves commented 3 years ago

Here is an example script that can be incorporated in the project for creating macos_vm_vars_file from a genuine Mac.

I do not believe this thread is mentioned in the readme, but I feel like it really should be.

myspaghetti commented 3 years ago

I guess I'll finally add this feature to the script. @startergo would you mind stating that all your code in this thread is released under the GPL-2.0 License? You said the code "can be incorporated in the project" but I just want to make sure the license is GPL 2.0

myspaghetti commented 3 years ago

Gotta remember to warn not to use iMessage with the same NVRAM parameters as a genuine Mac (or any other device) that is already connected to iMessage.

thispsj commented 3 years ago

Comment by myspaghetti

Can these variables be directly used or they require OpenCore ? Also I'm finding someone who could help me install OpenCore on a Virtualbox VM(although it's out of scope of script) but I'd be glad if someone here could guide me ?

rbreaves commented 3 years ago

OpenCore was not required when I completed this setup, some additional guidance however would have gone a long way to expediating the process. I made a quick outline here for anyone that is interested.

https://github.com/myspaghetti/macos-virtualbox/pull/452#issuecomment-827334021

myspaghetti commented 3 years ago

implemented in version 0.98.7

okontsograda commented 3 years ago

Just wanted to say this is an amazing solution, and it's worked great for me. I've been trying to setup iMessage and get it working for the past couple of days, but I've failed so far at all attempts. I've tried using an outdated macbook pro (2005), and a 2010 macbook air, extracting their serial's, uuid's, etc. yet nothing seems to be working.

I keep seeing mentions of clover and generators for nvram and the config variables that are needed to connect iMessage and be able to use it. How would I go about generating new variables for me to be able to use with the script? I'm a bit new to the mac vm scene, so please forgive me for any dumb questions.

Also, can I use a genuine mac serial (outdate) and generated nvram variables? Or would that set of red flags on apple's side?

startergo commented 3 years ago

I guess I'll finally add this feature to the script. @startergo would you mind stating that all your code in this thread is released under the GPL-2.0 License? You said the code "can be incorporated in the project" but I just want to make sure the license is GPL 2.0

You can you use and modify the code anyway you want.

myspaghetti commented 3 years ago

@okontsograda the "secret" step is booting into the EFI Internal Shell (by pressing esc when the VM powers up) and letting startup.nsh copy the values to NVRAM.

This should work with your old Mac information. Using non-genuine parameters is not supported but it's certainly possible and there are guides elsewhere on the internet.

okontsograda commented 3 years ago

@myspaghetti thanks for the quick feedback, I appreciate it! I'll try what you mentioned above today and will update on how that worked.

From the MB Air I'm not seeing any NVRAM params when trying to get the genuine values from the device. It looks like it might have PRAM configs set, would these still work in place for the NVRAM config values?

myspaghetti commented 3 years ago

If PowerPC Mac PRAM has the same values as an Intel Mac NVRAM, sure. Obviously you can't run this script on a PowerPC machine... I think.