Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## macOS Mojave 10.14.1 on VirtualBox without Mac devices, without kext files, and without Clover bootloader
- ############################################################################################################
- ## NOT A SCRIPT
- ###############
- ## PLEASE READ, COPY AND PASTE LINES MANUALLY
- #############################################
- ## Requirements:
- ## 33.5GB available storage for temporary files (1.5GB) and virtual disk images of base system (2GB), installation (8GB), and target (22GB)
- ## The following has to be installed manually:
- ## VirtualBox
- ## dmg2img (from package manager for Linux or http://vu1tur.eu.org/tools/dmg2img-1.6.6-win32.zip for Windows)
- ## curl (from package manager for Linux or https://bintray.com/artifact/download/vszakats/generic/curl-7.62.0-win64-mingw.zip for Windows)
- ## On Windows: Place dmg2img executable and curl executable and dll in working directory
- ## After the first part of the installation, EFI drivers will have to be downloaded manually with Safari
- ## The following will be downloaded automatically:
- ## macOS Mojave 10.14.1 BaseSystem.dmg from Apple - on the host, to bootstrap the VM
- ## macOS Mojave 10.14.1 BaseSystem.chunklist InstallInfo.plist AppleDiagnostics.dmg AppleDiagnostics.chunklist BaseSystem.dmg InstallESDDmg.pkg from Apple - on the VM
- # On the host terminal, create a VirtualBox virtual machine:
- vmname="Mojave"
- VBoxManage createvm --name "${vmname}" --ostype MacOS_64 --register
- # Create the macOS base system virtual disk image:
- curl 'http://swcdn.apple.com/content/downloads/35/53/091-93471/ff5kp0aiow1d87t494xp5twbugymnlvz16/BaseSystem.dmg' -o BaseSystem.dmg
- dmg2img BaseSystem.dmg BaseSystem.img
- VBoxManage convertfromraw --format VDI BaseSystem.img BaseSystem.vdi
- # Create the target virtual disk image:
- storagesize=22000 # minimum 22000
- VBoxManage createmedium --size="${storagesize}" --filename "${vmname}.vdi" --variant fixed
- # Create the installation media virtual disk image:
- installsize=8000
- VBoxManage createmedium --size="${installsize}" --filename "Install ${vmname}.vdi" --variant fixed
- # Configure the VM
- cpucount=4 # minimum 2
- memorysize=8192 # minimum 2048
- gpuvram=128 # minimum 34
- resolution=1280x800
- VBoxManage modifyvm "${vmname}" --cpus "${cpucount}" --memory "${memorysize}" --vram "${gpuvram}" --pae on --boot1 dvd --boot2 disk --boot3 none --boot4 none --firmware efi --rtcuseutc on --usbxhci on --chipset ich9 --mouse usb --keyboard usb
- VBoxManage storagectl "${vmname}" --add sata --name SATA --hostiocache on
- VBoxManage setextradata "${vmname}" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "MacBookPro11,3"
- VBoxManage setextradata "${vmname}" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
- VBoxManage setextradata "${vmname}" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Mac-2BD1B31983FE1663"
- VBoxManage setextradata "${vmname}" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
- VBoxManage setextradata "${vmname}" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
- VBoxManage setextradata "${vmname}" "VBoxInternal2/EfiGraphicsResolution" "${resolution}"
- # Attach the target virtual disk image, the EFI drivers, and the base system in the virtual machine:
- VBoxManage storageattach "${vmname}" --storagectl SATA --port 0 --type hdd --nonrotational on --medium "${vmname}.vdi"
- VBoxManage storageattach "${vmname}" --storagectl SATA --port 1 --type hdd --nonrotational on --medium "Install ${vmname}.vdi"
- VBoxManage storageattach "${vmname}" --storagectl SATA --port 2 --type hdd --nonrotational on --medium BaseSystem.vdi
- # Start the virtual machine. This should take a couple of minutes.
- VBoxManage startvm "${vmname}"
- # Continue on the VM
- echo "If this is running as a script, stop."
- echo "Download the next part of the instructions from the macOS Terminal:"
- read -p "curl http://pastebin.com/raw/ETa8CBv1"
- exit
- ## RUN THE FOLLOWING PART ON THE VIRTUAL MACHINE
- ################################################
- # Start Terminal
- # Partition the virtual disk images:
- vmname="Mojave"
- diskutil partitionDisk /dev/disk0 1 GPT APFS "${vmname}" R
- diskutil partitionDisk /dev/disk1 1 GPT HFS "Install" R
- # Download macOS Mojave 10.14.1 installer
- urlpath="http://swcdn.apple.com/content/downloads/35/53/091-93471/ff5kp0aiow1d87t494xp5twbugymnlvz16/"
- for filename in BaseSystem.chunklist InstallInfo.plist AppleDiagnostics.dmg AppleDiagnostics.chunklist BaseSystem.dmg InstallESDDmg.pkg
- do curl "${urlpath}${filename}" -o "/Volumes/${vmname}/${filename}"
- done
- # Create secondary base system
- asr restore --source /Volumes/${vmname}/BaseSystem.dmg --target /Volumes/Install
- # Shut down the virtual machine
- shutdown -h now
- ## RUN THE FOLLOWING PART ON THE HOST
- #####################################
- # Detach the original 2GB BaseSystem.vdi
- VBoxManage storageattach "${vmname}" --storagectl SATA --port 2 --medium emptydrive
- # Start the virtual machine again, this time it will boot from the new 8GB base system
- VBoxManage startvm "${vmname}"
- # Continue on the VM
- echo "If this is running as a script, stop."
- echo "Download the next part of the instructions from the macOS Terminal:"
- read -p "curl http://pastebin.com/raw/Q8GSRRk9"
- exit
- ## RUN THE FOLLOWING PART ON THE VIRTUAL MACHINE
- ################################################
- # Start Terminal
- # Make root writable
- mount -rw /
- # Move the installer to the new 8GB base system
- vmname="Mojave"
- installpath="/Install macOS Mojave.app/Contents/SharedSupport/"
- mkdir -p "${installpath}"
- cd "/Volumes/${vmname}/"
- mv *.chunklist *.plist *.dmg *.pkg "${installpath}"
- # Rename InstallESDDmg.pkg to InstallESD.dmg and update InstallInfo.plist
- mv "${installpath}InstallESDDmg.pkg" "${installpath}InstallESD.dmg"
- sed -i.bak -e 's/InstallESDDmg\.pkg/InstallESD.dmg/' -e 's/pkg\.InstallESDDmg/dmg.InstallESD/' "${installpath}InstallInfo.plist"
- sed -i.bak2 -e '/InstallESD\.dmg/{n;N;N;N;d;}' "${installpath}InstallInfo.plist"
- # Start the installer.
- # Manually accept the license ("A" and enter).
- cd "/Install macOS Mojave.app/Contents/Resources/"
- ./startosinstall --volume "/Volumes/${vmname}"
- ## The virtual machine will reboot back into the same base system
- #################################################################
- # Start Safari (Get Help Online)
- # Browse https://github.com/acidanthera/AppleSupportPkg/releases/tag/2.0.4
- # Save AppleSupport-v2.0.4-RELEASE.zip on /Volumes/${vmname}/
- # (This isn't done with curl because the available version doesn't support https)
- # Start the Terminal
- # Mount the target virtual disk image (empty) EFI partition
- vmname="Mojave"
- mkdir -p "/Volumes/${vmname}/mount_efi"
- mount_msdos /dev/disk0s1 "/Volumes/${vmname}/mount_efi"
- # Create directory structure
- mkdir -p "/Volumes/${vmname}/mount_efi/EFI/driver/"
- # Extract and copy drivers
- tar -xf "/Volumes/${vmname}/AppleSupport-v2.0.4-RELEASE.zip"
- cd "/Volumes/${vmname}/Drivers/"
- mv *.efi "/Volumes/${vmname}/mount_efi/EFI/driver/"
- # Download EFI startup script
- cd "/Volumes/${vmname}/mount_efi/"
- curl "http://pastebin.com/raw/RkgZRDyd" -o startup.nsh
- # The commands can be entered manually in the EFI console if the script is not available
- ## echo -off
- ## load fs0:\EFI\driver\AppleImageLoader.efi
- ## load fs0:\EFI\driver\AppleUiSupport.efi
- ## load fs0:\EFI\driver\ApfsDriverLoader.efi
- ## map -r
- ## fs3:
- ## cd "macOS Install Data\Locked Files\Boot Files"
- ## boot.efi
- ## cd "System\Library\CoreServices"
- ## boot.efi
- # Shut down the virtual machine
- shutdown -h now
- ## RUN THE FOLLOWING PART ON THE HOST
- #####################################
- # Detach the 8GB installation base system
- VBoxManage storageattach "${vmname}" --storagectl SATA --port 1 --medium emptydrive
- # Start the virtual machine again.
- # The VM will boot from the target virtual disk image and complete the installation.
- VBoxManage startvm "${vmname}"
- ## RUN THE FOLLOWING PART ON THE VIRTUAL MACHINE
- ################################################
- # macOS Mojave 10.14.1 will start.
- # Set up the system and log in.
- # Run Terminal and change the EFI startup.nsh script
- mkdir -p /tmp/efi
- sudo mount_msdos /dev/disk0s1 /tmp/efi
- nano /tmp/efi/startup.nsh
- # Use the arrow keys to move to the first cd and boot.efi and remove them
- # leaving 'cd "System\Library\Coreservices"' and 'boot.efi'
- ## CLEANUP
- ##########
- # Shut down the virtual machine
- # On the host terminal, erase the temporary files and settings:
- VBoxManage list hdds | grep -B4 "Install\|Base"
- # "close" the UUID of all unused virtual disk images:
- VBoxManage closemedium <UUID-of-BaseSystem.vdi>
- VBoxManage closemedium <UUID-of-Install....vdi>
- rm BaseSystem.dmn BaseSystem.vdi Install*.vdi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement