iT邦幫忙

第 11 屆 iThome 鐵人賽

DAY 18
1
DevOps

Oops Step ( Home lab of a kind ) 系列 第 18

Hackintosh (黑金塔)

  • 分享至 

  • twitterImage
  •  

當年通用汽車反揶揄微軟,說如果造車工業像你微軟,那Apple將製造一輛由太陽供電的車,可靠、速度五倍、駕駛容易,但只能在百分之五的道路上行駛。
我其實從Mac OS 7就跟朋友一起接觸了,當時台灣用Macintosh的不多,就大概是5%的市佔率吧。
然而個人最吐槽的一點

Yes

就是Apple叫你Think Different

Yes

Because, you are all the same.

不可否認的是,自從MacOS吸收了BSD/Darwin的優良體質,產生OS X這優良的雜種新生代,把市佔率大大的提高到12%。而改良之餘,也沒有背棄設計族群。是的,凡是搞設計的,沒有道理不用macOS ~~為了一個 潮 ~~ 。 所以在LAB裡面,一定會有人提出:我要macOS。如果設計沒有先開這一槍說沒有測safari會被扣錢,後面做CI的也會補槍 哀嚎 ,說要用Xcode編譯但他沒有環境,然後APP不能簽署上架之類的求爺爺告奶奶的話。所以最終你一定會被推到櫃臺前 買一台Mac Book Air犒賞員工/images/emoticon/emoticon14.gif但你買了,員工晚上帶回家,白天才叫你編譯。

今天在台灣,只是小小的編譯環境需求,我們打假球虛擬的就好了。而且是合法的。Thanks to Kholia & Apple. 在專案https://github.com/kholia/OSX-KVM 其實有詳細描述,但我今天很快馬馬虎虎帶過。

# MSRs https://en.wikipedia.org/wiki/Model-specific_register
echo 1 > /sys/module/kvm/parameters/ignore_msrs
sudo cp kvm.conf /etc/modprobe.d/kvm.conf
sudo apt-get -y install qemu uml-utilities virt-manager dmg2img git wget
cd ~ && git clone https://github.com/kholia/OSX-KVM.git && cd OSX-KVM && ./fetch-macOS.py

https://ithelp.ithome.com.tw/upload/images/20190917/20094403KHZvpz1eih.png
把開機碟轉檔

dmg2img BaseSystem.dmg /var/lib/libvirt/images/BaseSystem.img

創造一個KVM虛擬碟,格式用qcow2

cd /var/lib/libvirt/images/ && qemu-img create -f qcow2 mac_hdd_ng.img 100G
# 複製磁碟映像檔,集中管理
cd ~
cp OSX-KVM/OVMF_CODE.fd /var/lib/libvirt/images/
cp OSX-KVM/Mojave/CloverNG.qcow2 /var/lib/libvirt/images/ #Mojave/
cp OSX-KVM/OVMF_VARS*.fd /var/lib/libvirt/images/
修改全體位址  & br0
sed -i "s/\/home\/CHANGEME\/OSX-KVM/\/var\/lib\/libvirt\/images/g" macOS-libvirt-NG.xml
# sed -i "s/virbr0/br0/g" macOS-libvirt-NG.xml

確認ok後

virt-xml-validate macOS-libvirt-NG.xml && virsh define macOS-libvirt-NG.xml

https://ithelp.ithome.com.tw/upload/images/20190917/200944035XJhFkxcyC.png

接下來會發生什麼事?很恐怖,不能說。

https://ithelp.ithome.com.tw/upload/images/20190917/200944034111FqVagh.png

https://ithelp.ithome.com.tw/upload/images/20190917/20094403qGRFk3vKHn.png

https://ithelp.ithome.com.tw/upload/images/20190917/20094403j6sdzhfCop.png

https://ithelp.ithome.com.tw/upload/images/20190917/200944039DQkH92kkd.png

https://ithelp.ithome.com.tw/upload/images/20190917/20094403eLsBSTiJ9s.png
假裝靜默安裝要自己格式化硬碟啦
https://ithelp.ithome.com.tw/upload/images/20190917/20094403kA2yr4Sj74.png

https://ithelp.ithome.com.tw/upload/images/20190917/20094403YEx9y1uo6a.png

https://ithelp.ithome.com.tw/upload/images/20190917/200944037h5IA8oviX.png

https://ithelp.ithome.com.tw/upload/images/20190917/200944037Pqj6TyATR.png

https://ithelp.ithome.com.tw/upload/images/20190917/20094403gyrWzSDs84.png

https://ithelp.ithome.com.tw/upload/images/20190917/20094403S2U9pSjk4U.png

https://ithelp.ithome.com.tw/upload/images/20190917/20094403Zld2XhbtJq.png

https://ithelp.ithome.com.tw/upload/images/20190917/200944035pgT38P2jK.png

https://ithelp.ithome.com.tw/upload/images/20190917/20094403zr31d81qsx.png

https://ithelp.ithome.com.tw/upload/images/20190917/20094403YQJ423ioIL.png

以上,就是黑金塔的製作,接下來你就可以/images/emoticon/emoticon28.gif弄好剩下的編譯環境、給測試一個safari,總之,虛擬機的保存上比真的買一台好。


上一篇
Xpenology (黑群暉)
下一篇
What else, KVM & QEMU?
系列文
Oops Step ( Home lab of a kind ) 34
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言