- Mac OS X в эмуляторе QEMU под Linux
- Mac os qemu image
- Latest commit
- Git stats
- Files
- README.md
- About
- Install macOS Big Sur 11.0.1 RC2 in a VM (QEMU)
- Dave Jansen
- Prerequisites
- No physical Mac needed
- Python
- Build tools
- Other utilities
- Check out the OSX-KVM repo
- Download the Big Sur installer file
- Download & build XAR
- Download & build darling-dmg
- Extract & prepare the installer image
- Step 1: Extract InstallAssistant.pkg
- Step 2: Mount SharedSupport.dmg
- Step 3: Extract BaseSystem.dmg
- Step 4: Convert BaseSystem.dmg
- Starting up the VM
- Method 1: For quick testing, momentary curiosity, or for use as a starting point
- Closing thoughts
- Sign up for more like this.
- Manage docker without needing sudo on your Synology NAS
- Automatically schedule a photos re-index on your Synology NAS to add missing images
- Add custom resolution and refresh rate when using Wayland/Gnome
Mac OS X в эмуляторе QEMU под Linux
Здравствуйте хабровчане. Недавно понадобилось писать на Objective C под Mac OS X. Железо у меня не самое подходящее для всяких сборок, да и сидеть полностью в этой ОС религия не позволяет. Решил поставить Mac OS X в на виртуальную машину Qemu в Linux.
Вот список всего, что я использовал:
—Gentoo Linux 64 bit
—Qemu 0.10.5
—KVM (Kernel-based Virtual Machine) 88-r1
—Поддержка KVM в ядре Linux
—Процессор с поддержкой Intel Virtualization Technology (в моем случае это Core2Duo E6400)
—Linux kernel>=2.6.20
-Сборка Mac OS X iATKOS v7 (Leopard 10.5.7)
Переходим к настройке, в ядре необходимо добавить KVM. Качаем исходники, распаковываем, запускаем make menuconfig:
Processor type and features->Paravirtualized guest support
Отмечаем:
—KVM paravirtualized clock
—KVM Guest support
—Paravirtualization layer for spinlocks
Далее в корне настройки ядра появляется новая опция Virtualization
Переходим туда и отмечаем:
—Kernel-based Virtual Machine (KVM) support
—KVM for Intel processors support
—KVM trace support
—PCI driver for virtio devices
—Virtio balloon driver
Собираем, устанавливаем, и перезагружаемся с новым ядром.
Теперь устанавливаем Qemu с поддержкой KVM, и сам KVM
USE=«kvm» emerge qemu
emerge kvm
Теперь переходим к шаманствам с виртуальной машиной.
Создаем виртуальный жесткий диск:
qemu-img create -f raw macos.disk 30G
Если собираемся запускать Qemu не от рута, необходимо дать прав другим пользователям на чтение/запись на устройство /dev/kvm:
chmod 0666 /dev/kvm
Запускаем:
kvm -boot d -hda macos.disk -m 900 -net nic,model=rtl8139 -net tap -usb -no-reboot -no-shutdown -vga std -cpu core2duo -cdrom 10.5.7.iso
-hda путь к нашему виртуальному жесткому диску
-cdrom пусть к образу
-no-shutdown -no-reboot необходимы для того чтобы в случае ошибки окно эмулятора «замораживалось» и можно было прочитать ошибку
-net nic,model=rtl8139 эмулируем сетевую карту Realtek 8139
-net tap чтобы гостевая система видела по сети хостящую необходим TAP девайс
-m 900 количество памяти отдаваемое гостевой системе
-boot d грузимся с сидирома
-usb поддержка USB
-cpu core2duo эмуляция процессора Core2Duo
Грузим диск. Размечаем жесктий диск при помощи Disk Utility (выбираем из меню сверху).
Настройка драйверов.
Перед тем как нажать кнопку Install обратите вниманине на кнопку Customize
Вещи которые нам необходимо выбрать:
x86 ACPI
Disabler
OHR
Remove TyMCE
CardBus
USB
Intel SATA/IDE
Kernels
Apple PS/2
Можно устанавливать. Ждем примерно 30 минут.
Mac OS X установлена, настраиваем.
Теперь в строке для запуска меняем -boot d на -boot c чтобы грузится с жесткого диска.
Загружаемся. Теперь надо придумать чтонибудь с сетью.
Ищем в интернете PCGenRTL8139Ethernet.kext, устанавливаем его, очень легко установить с помощью программы kextinstaller. Пока нету сети необходимые файлы передавать в систему можно через флешку например, добавляем -hdb /dev/sdb (путь к устройству флешки)
Перезагржаем гостевую ОС.
Теперь чтобы сеть в Mac OS X заработала необходимо зайти в управление сетью, выбрать Ethernet девайс, выключить его (Off), а затем включить и настроить нужный IP (например 192.168.1.1), а в хостящей системе настроить девайс tap0:
ifconfig tap0 192.168.1.2
Вот вообщем то и все.
UPD. Автор поста появился на хабре vinnishtein
Источник
Mac os qemu image
Run macOS on QEMU/KVM. With OpenCore + Big Sur support now! Only commercial (paid) support is available now to avoid spammy issues.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
This README.md documents the process of creating a Virtual Hackintosh system.
Note: All blobs and resources included in this repository are re-derivable (all instructions are included!).
💚 Looking for commercial support with this stuff? I am available over email for a chat for commercial support options only.
Working with Proxmox and macOS? See Nick’s blog for sure.
Yes, we support offline macOS installations now 🎉
This project can always use your help, time and attention. I am looking for help (pull-requests!) with the following work items:
Documentation around running macOS on popular cloud providers (Hetzner, GCP, AWS). See the Is This Legal? section and associated references.
Document (share) how you use this project to build + test open-source projects / get your stuff done.
Document how to use this project for XNU kernel debugging and development.
Document the process to launch a bunch of headless macOS VMs (build farm).
Document usage of munki to deploy software to such a build farm .
Enable VNC + SSH support out of the box or more easily.
Robustness improvements are always welcome!
(Not so) crazy idea — automate the macOS installation via OpenCV.
A modern Linux distribution. E.g. Ubuntu 20.04 LTS 64-bit or later.
A CPU with Intel VT-x / AMD SVM support is required ( grep -e vmx -e svm /proc/cpuinfo )
A CPU with SSE4.1 support is required for >= macOS Sierra
A CPU with AVX2 support is required for >= macOS Mojave
Note: Older AMD CPU(s) are known to be problematic. AMD FX-8350 works but Phenom II X3 720 does not. Ryzen processors work just fine.
KVM may need the following tweak on the host machine to work.
To make this change permanent, you may use the following command.
Install QEMU and other packages.
This step may need to be adapted for your Linux distribution.
Add user to the kvm group (might be needed).
Clone this repository on your QEMU system. Files from this repository are used in the following steps.
Fetch macOS installer.
You can choose your desired macOS version here. After executing this step, you should have the BaseSystem.dmg file in the current folder.
ATTENTION: Let the Big Sur setup sit at the Country Selection screen, and other similar places for a while if things are being slow. The initial macOS setup wizard will eventually succeed.
Note: Modern NVIDIA GPUs are supported on HighSierra but not on later versions.
Convert the downloaded BaseSystem.dmg file into the BaseSystem.img file.
Create a virtual HDD image where macOS will be installed. If you change the name of the disk image from mac_hdd.img to something else, the boot scripts will need to be updated to point to the new image name.
NOTE: Create this HDD image file on a fast SSD/NVMe disk for best results.
Now you are ready to install macOS 🚀
CLI method (primary). Just run the OpenCore-Boot.sh script to start the installation process.
Note: This same script works for Big Sur, Catalina, Mojave, and High Sierra.
You are all set! 🙌
(OPTIONAL) Use this macOS VM disk with libvirt (virt-manager / virsh stuff).
Edit macOS-libvirt-Catalina.xml file and change the various file paths (search for CHANGEME strings in that file). The following command should do the trick usually.
Create a VM by running the following command.
Launch virt-manager and start the macOS virtual machine.
Note: You may need to run sudo ip link delete tap0 command before virt-manager is able to start the macOS VM.
Setting Expectations Right
Nice job on setting up a Virtual Hackintosh system! Such a system can be used for a variety of purposes (e.g. software builds, testing, reversing work), and it may be all you need, along with some tweaks documented in this repository.
However, such a system lacks graphical acceleration, a reliable sound sub-system, USB (3) functionality and other similar things. To enable these things, take a look at our notes. We would like to resume our testing and documentation work around this area. Please reach out to us if you are able to fund this area of work.
It is possible to have ‘beyond-native-apple-hw’ performance but it does require work, patience, and a bit of luck (perhaps?).
See networking notes to setup guest networking.
I have the following commands present in /etc/rc.local .
This has been enough for me so far.
Note: You may need to enable the rc.local functionality manually on modern Ubuntu versions. Check out the notes included in this repository for details.
To passthrough GPUs and other devices, see these notes.
Need a different resolution? Check out the notes included in this repository.
Trouble with iMessage? Check out the notes included in this repository.
The «secret» Apple OSK string is widely available on the Internet. It is also included in a public court document available here. I am not a lawyer but it seems that Apple’s attempt(s) to get the OSK string treated as a trade secret did not work out. Due to these reasons, the OSK string is freely included in this repository.
Gabriel Somlo also has some thoughts on the legal aspects involved in running macOS under QEMU/KVM.
My aim is to enable macOS based educational tasks, builds + testing, kernel debugging, reversing, and macOS security research in an easy, reproducible manner without getting ‘invested’ in Apple’s closed ecosystem (too heavily).
These Virtual Hackintosh systems are not intended to replace the genuine physical macOS systems.
Personally speaking, this repository has been a way for me to ‘exit’ the Apple ecosystem. It has helped me to test and compare the interoperability of Canon CanoScan LiDE 120 scanner, and Brother HL-2250DN laser printer. And these devices now work decently enough on modern versions of Ubuntu (Yay for free software). Also, a long time back, I had to completely wipe my (then) brand new MacBook Pro (Retina, 15-inch, Late 2013) and install Xubuntu on it — as the OS X kernel kept crashing on it!
Backstory: I was a (poor) student in Canada in a previous life and Apple made my work on cracking Apple Keychains a lot harder than it needed to be. This is how I got interested in Hackintosh systems.
About
Run macOS on QEMU/KVM. With OpenCore + Big Sur support now! Only commercial (paid) support is available now to avoid spammy issues.
Источник
Install macOS Big Sur 11.0.1 RC2 in a VM (QEMU)
Dave Jansen
A new macOS release is nearing release, and it’s a big one. So big that this time it’s really, completely and definitely not OS X any longer. With the death of Kexts looming and the transition away from Intel CPUs spelling disaster for Hackintoshers and multi-OS users alike, it’s certainly an interesting time.
Oh, and rounded edges. So many rounded edges. Good golly.
Update 2020-11-13: For the specific steps required to get the Big Sur public release to work, I made a companion post that you can find right here.
Update 2020-11-11: This guide has been updated to support Big Sur 11.0.1 Release Candidate 2 (Beta 3).
Today I’d like to walk you through how to get Big Sur installed and up and running in a virtual machine on your Ubuntu or similar host machine. In this article I’ll focus on steps and commands that are tailored towards Ubuntu 20.04, but I’m sure you’ll be able to tweak things a bit to tailor towards whatever flavor you’re running to get things to work similarly.
As of this writing, Big Sur 11.0.1 Release Candidate 2 (Beta 3) is the recent-most beta release. While the guide should remain useful for all subsequent releases as-well as the eventual full release, the fetch-macOS script might need updating for future beta releases and the eventual full release. Please check the relevant repositories for up-to-date information on this.
Prerequisites
In this guide I’ll assume you have already set up your host machine, including having set up QEMU, virt-manager, etc. As mentioned before, I’m focussing this guide on running Ubuntu 20.04 as the host OS.
No physical Mac needed
You do not need a physical Mac to download anything necessary to create this VM. We’ll be using a few tools to fetch and extract the installer files needed right from your host machine.
Python
Be sure to have Python installed. In my case I already had Python installed but I needed to install an extra package called python-is-python2 to get certain tools to work, but you might also want to make sure python2 is actually installed.
Build tools
We’ll be building a few tools from source, so we’ll need build tools installed for that. To be honest I already had most of these installed, so I am probably going to miss one or two in this list. If one of the build steps later on this guide fails, it’ll tell you what’s missing so you can install it at that point. Please let me know if I did actually miss anything here.
Other utilities
Also be sure to install these tools if you don’t have them already:
What’s happening: We’ll need dmg2img to convert an image file, and while 7zip is optional, it’s a great compression and decompression tool that I highly recommend you keep around as it’s super convenient.
Check out the OSX-KVM repo
Both literally and figuratively. Most of the work has been done by the amazing people who have created and keep this repository up-to-date. There’s a few minor tweaks we’ll make to get Beta 3 to work, which at the time of this writing isn’t yet working out of the box when relying on the original repo (I have submitted a PR for this). Hopefully this’ll get added soon, but for now you can head over to my fork where I’ve already applied the fix needed to get Beta 3 to download. The main repo has since been updated and should automatically fetch the recent-most beta.
Go ahead and download the repo to your local machine.
Download the Big Sur installer file
Open up a Terminal and from the OSX-KVM repo you have just downloaded, and run:
You should see a bunch of things fly by and the tool will start downloading a relatively humongous InstallAssistant.pkg file, clocking in at 12GB.
Note: If you have issues at this step, it is possible an incomplete plist file has been downloaded, or perhaps a complete but now out-of-date version. The tool keeps using an already downloaded file if it exists, so if you get a warning about something related to XML parsing or you’re not getting the version you expect, try deleting the files found in content/catalogs/other and running the tool again.
While this is downloading, let’s set up a few additional things we’ll need once the download is done.
Download & build XAR
Download the XAR repository here, and open another Terminal window/tab and head over to where you have downloaded this repository. Inside, run the following:
What’s happening: We head into the xar sub-directory, run autogen.sh to generate the configure script, and then build the project with make . We’re not installing the tool, so the results stay contained within this folder.
Download & build darling-dmg
Download the darling-dmg repository from here, and head on over to this directory in a Terminal window. Darling-dmg is a part of Darling, a sort of WINE for macOS software, which I didn’t even know was a thing that existed until I was going through this process. Regardless, we don’t need the entire Darling project, so that’s why we’re just pulling in darling-dmg.
If you already have Darling installed on your system, you can skip this step as you should already have darling-dmg available.
From the darling-dmg repository folder, run the following:
What’s happening: We’re just configuring and building darling-dmg here. We’re not installing it, so the results stay contained within this folder. If the build fails, please check the results as this is probably due to a missing library. Simply look through the messages to find the library you’re missing, apt install it, and try again.
Extract & prepare the installer image
By this point the download has hopefully finished, and you should have InstallAssistant.pkg sitting right there in your OSX-KVM folder. We’ll have to take a few steps now to get to the actual installer image file, so let’s do that now.
Make note where the XAR and darling-dmg folders are relative to your OSX-KVM folder, as we’ll have to use these now.
Step 1: Extract InstallAssistant.pkg
Let’s create a folder in which we’ll extract all files to, to keep the repo from getting messy:
In a Terminal window opened to your OSX-KVM folder, let’s now extract the PKG file:
What’s happening: We’re using the xar tool we build just before to extract the file by pointing to it relative to your OSX-KVM folder. The built tool should be at xar/src/xar within the folder where you have checked out the XAR repository. -x tells the tool you want to extract, and with -f filename you specify which file you want to extract from. Lastly, -C ./extracted tells it to extract the files to the specified folder we have created just previously.
After a bit, a few new files should have shown up inside the extracted folder, including SharedSupport.dmg .
Step 2: Mount SharedSupport.dmg
Now we’ll use darwin-dmg to mount SharedSupport.dmg . In Terminal, run:
What’s happening: We’re creating a folder called tmp , which we’ll use to mount the disk image to. We then use darling-dmg by referencing it from the folder we checked out its repository to, and specify we want to mount SharedSupport.dmg to the just-created tmp folder.
If this went well, you should see a few messages in your Terminal, and a newly mounted drive show up in your file manager called tmp . If you want to stick to using Terminal, you should also see these files when cd’ing into it; cd tmp && ls -la .
Step 3: Extract BaseSystem.dmg
With SharedSupport.dmg mounted, we need to extract BaseSystem.dmg , which is located inside a ZIP file. Using 7zip, run this from your OSX-KVM directory:
What’s happening: We’re extracting BaseSystem.dmg from a ZIP file found inside the SharedSupport.dmg image we have just before mounted to ./tmp . The ZIP file is located inside the com_apple_MobileAsset_MacSoftwareUpdate sub-directory, and BaseSystem.dmg is located in AssetData/Restore within that ZIP file. If you like, you can use your favorite file manager and archive tool to extract this directly too. The -o./extracted flag lets 7zip extract to the «extracted» folder we have just before created, to keep our repository directory nice and clean.
Step 4: Convert BaseSystem.dmg
We’ll now use the dmg2img tool to, as the name implies, convert the image to the img format, something that QEMU can actually work with. Simply run:
A moment or two later you should have the macOS Big Sur installation disk image ready to go. Exciting!
We’re now done with both DMG files, so let’s unmount SharedSupport.dmg and remove the tmp dir. You can now also delete both files if you like:
Starting up the VM
The OSX-KVM repository comes with a convenient shell script that you can use to easily launch the VM directly. This file has everything you need pre-configured, though the defaults are probably not ideal if you’re planning to use this VM for anything more than just gazing upon it once or so. For example, only 3GB RAM is allocated to it, which is a tiny amount of course.
If you’re just curious, or if you want to use this script to sort of jump-start the installation of macOS after which you’ll move the disk image with Big Sur installed on it over to a more permanent VM configuration, this might be a handy starting point. Otherwise, you might want to skip ahead to the section on using virt-manager .
Method 1: For quick testing, momentary curiosity, or for use as a starting point
The script is called OpenCore-Boot.sh and assumes you’re launching it from within the repo’s directory, have BaseSystem.img ready to go, have a hard drive disk image created, and have the «default» network adapter all set up and ready to go. We’re two for four here, so let’s go ahead and tackle those last two bits. First, let’s create a disk image we’ll install Big Sur onto:
What’s happening: We’re using the qemu-img tool to create a new disk image called mac_hdd_ng.img that’s 128GB in size. Be sure to customize the size to your liking, in case you need more (or less) space.
Note: If you get a message saying you don’t have qemu-img installed, you probably didn’t install qemu-utils .
Next, let’s set up some basic networking so this VM can actually boot up:
What’s happening: We’re basically setting up and configuring a bridge network connection which VMs can use to connect to the internet. For anything beyond quick testing you’ll probably want to set up a more robust configuration or pass through an actual network adapter if you have multiple, but for now this should at least get you going.
Lastly, as we kept all prepared files in a subdirectory, we should modify the OpenCore-Boot.sh script to point to the right directory. While we’re in there, we might as-well update the RAM allocation, unless 3GB is enough for your specific needs of course.
You can find the reference to $REPO_PATH/BaseSystem.img on line :52 . Simply update it to read $REPO_PATH/extracted/BaseSystem.img and that should be it. If you have created the qemu hard drive image someplace else or used a different name, you can update that reference on line :53 . Lastly, the amount of RAM the VM will use is specified on line :21 in the ALLOCATED_RAM variable. 8192 (8GiB) might be a good choice, or 16384 (16GiB) if you can spare it and are planning to do Mac/iOS development for example.
Now you should be able to boot up the VM for the first time! To start it, just run OpenCore-Boot.sh from a Terminal window, and a QEMU remote viewer screen should show up soon thereafter.
After a brief moment, a familiar screen will show up with a few options. Simply hit enter to boot the first option (called macOS Base System ), which is the installation disk image.
Note: The OpenCore configuration included with this repository has verbose mode enabled, so you’ll be seeing a lot of messages run by as the system (and the installer) boot up. This is normal and intended. You’ll be able to modify the OpenCore configuration file to disable this should you want to, but that’s outside the scope of this already rather lengthy article :).
From here you can proceed as you normally would. Before you start with the installation, be sure to launch into Disk Utility the first time so you can format the disk image.
After selecting and launching Disk Utility from the main menu, select Show All Devices from the sidebar options menu. Then, with the correct disk image selected (you can double check the capacity to make sure you’re looking at the right drive), click Erase, name your drive and select your preferred options (Encrypted or not, Case-sensitive or not), and click Erase.
Note that in my case I was not able to actually start the Big Sur Beta installation on a drive that I formatted using the APFS Encrypted option. I am not sure if it was a limitation of the specific beta I was installing or something else. If you run into the same issue, try re-formatting the drive to non-Encrypted APFS. Your root drive should already be encrypted so it’s probably not the end of the world, and I’m sure the non-beta version will certainly support encrypted drives again.
When you’re done with that, click Done, close Disk Utility, and select Reinstall macOS from the main menu. From there you can follow the steps as you normally would.
Note: As you probably know, at one point during installation the VM will reboot. To let it continue with the installation, at the boot selection screen be sure to select the macOS Install option, as that’s the as-of-yet incomplete installation of macOS on the hard drive.
After about an hour or so of you should be greeted with the welcome stuff, where you can set up your user account and whatnot. And after that, well, get ready for border radii to dazzle you with their roundedness.
Well hello there, Big Sur.
Closing thoughts
At this point you should have a working macOS Big Sur VM. Congrats! But it might not be the most elegant of setups. You’ll have to use OpenCore-Boot.sh to launch the VM every time, and you’ll probably notice that macOS itself feels rather sluggish too. The latter is due to the lack of any form of hardware acceleration, something you can only really fix by passing through a graphics card. That topic and several more might be interesting as a follow-up articles, so if you’d like to see that, please let me know.
I hope this was useful for you and that this guide has helped you get to a working virtual machine. Enjoy, and happy coding!
Sign up for more like this.
Manage docker without needing sudo on your Synology NAS
If you’ve installed and used docker before, you’re probably familiar with adding your computer’s user account to the docker user group to allow you to control docker (and docker-compose) without needing to use sudo. For production setups it might be beneficial to maintain that level of security, but for a
Automatically schedule a photos re-index on your Synology NAS to add missing images
If you’ve been having trouble getting Synology Photos to more consistently show newly added images and videos, this might be of use to you.
Add custom resolution and refresh rate when using Wayland/Gnome
Monitors and/or adapters don’t always return all the supported resolutions and refresh rates to your computer. In those cases you may need to do some finagling to get the right configuration to work. On Windows you can usually rely on your graphics card’s accompanying software to offer such functionality,
Источник