📜 ⬆️ ⬇️

Mac OS X in a QEMU emulator under Linux

Hello habrovchane. Recently, I had to write on Objective-C under Mac OS X. I don’t have the right hardware for any builds, and religion doesn’t allow sitting completely in this OS. I decided to put Mac OS X in a Qemu virtual machine in Linux.

Here is a list of everything I used:

- Gentoo Linux 64 bit
- Qemu 0.10.5
- KVM (Kernel-based Virtual Machine) 88-r1
- KVM support in the Linux kernel
- Processor with support for Intel Virtualization Technology (in my case, this is Core2Duo E6400 )
- Linux kernel> = 2.6.20
- Build Mac OS X iATKOS v7 (Leopard 10.5.7)

Go to the settings, in the kernel you need to add KVM. Download source, unpack, run make menuconfig :
Processor type and features-> Paravirtualized guest support
We note:
- KVM paravirtualized clock
- KVM Guest support
- Paravirtualization layer for spinlocks
')
Further, in the root of the kernel settings, a new option appears Virtualization
Go there and note:
- Kernel-based Virtual Machine (KVM) support
- KVM for Intel processors support
- KVM trace support
- PCI driver for virtio devices
- Virtio balloon driver

We collect, install, and reboot with a new kernel.
Now install Qemu with KVM support, and KVM itself
USE = "kvm" emerge qemu
emerge kvm

Now go to the shamanism with a virtual machine.
Create a virtual hard disk:
qemu-img create -f raw macos.disk 30G

If we are going to run non-root Qemu, you must give other users read / write permissions to the / dev / kvm device:
chmod 0666 / dev / kvm

Run:
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 path to our virtual hard disk
-cdrom let to the image
-no-shutdown -no-reboot is needed so that in case of an error the emulator window “freezes” and you can read the error
-net nic, model = rtl8139 emulate Realtek 8139 network card
-net tap for the guest system to see the host needs a TAP device

-m 900 amount of memory given to the guest system
-boot d boot from sidir
-usb USB support
-cpu core2duo Core2Duo processor emulation

Ship the disk. We mark the hard disk with Disk Utility (choose from the menu above).

Customize drivers.
Before clicking the Install button, pay attention to the Customize button.

Things that we need to choose:
x86 ACPI
Disabler
OHR
Remove TyMCE
CardBus
USB
Intel SATA / IDE
Kernels
Apple PS / 2

You can install. We are waiting for about 30 minutes.
Mac OS X installed, customizable.
Now, in the prompt to start, change -boot d to -boot c to boot from the hard disk.
Loading. Now you have to come up with something with the network.
We search PCGenRTL8139Ethernet.kext on the Internet, install it, it is very easy to install using the kextinstaller program. While there is no network, the necessary files can be transferred to the system via a USB flash drive, for example, adding -hdb / dev / sdb (the path to the USB flash drive device)
Restart guest OS.
Now, in order for the network to work in Mac OS X, you need to go into network management, select the Ethernet device, turn it off (Off), and then turn on and configure the desired IP (for example, 192.168.1.1), and configure the tap0 device in the host system:
ifconfig tap0 192.168.1.2

That's all that's all.

image

UPD. The author of the post appeared on vinnishtein Habré

Source: https://habr.com/ru/post/68489/


All Articles