Chameleonのビルド

2. Chameleonをビルドする

2.1 Chameleonのソースにパッチを適用

 単一のHDDにOSXとWindows 7をインストールしデュアルブート環境にした場合、Windows 7のシステムパーティションにアクティブマークが付いていないとWindows 7でスリープができなくなる。

 Chameleon 2.0RC-4までは、boot0でMBRを検索してアクティブマークの付いたパーティションのboot1hに処理を移している。そこで、boot0でのMBR検索処理をスキップさせ、GUID情報を参照し起動させるようboot0を修正し、Widowsのシステムパーティションにアクティブマークを残しておけば、Windows 7でもスリープができるようになる。

 本件は既知の問題であるが、Chameleon 2.0RC-4まで修正はされていない。修正対象はboot0のboot0.sであり、ソースに問題回避のパッチをあて、Chameleonを再ビルドする。なお、boot0はChameleon 2.0RC1〜RC4及びnetkas PC EFI v10.2以降で共通である為、修正したboot0はそれらで使用できる。

 ・boot0のWindows 7スリープ修正パッチ (above Chameleon 2.0RC1 or netkas PC EFI v10.2)

$ cd Chameleon-2.0-RC4-r684-src/
$ patch -p0 < boot0_win7fix.diff
patching file i386/boot0/boot0.s

 ・2010/04現在での主なブートローダー

Chalemeon
Chameleon RC4-PC_EFI v10.5 (Offical)
Chameleon RC5pre8R2-PC_EFIv10.5 (Dr Hurt)

netkas
Chameleon RC3-PC_EFI v10.5 (netkas)
Chameleon RC3-PC_EFI v10.6 (netkas)

AsereBLN 1.1.9
Chameleon RC4-PC_EFI v10.5 (AsereBLN)

2.2 Chameleonをテーマ機能付きでビルド

 テーマ機能付きの場合は「make embedtheme」、シンプルなローダーのみので良ければ「make」とする。

$ make embedtheme
================= make embedtheme for i386 =================
/Users/osx86/Desktop/Dev/Chameleon-2.0-RC4-r684-src/obj/i386 /Users/osx86/Desktop/Dev/Chameleon-2.0-RC4-r684-src/sym/i386 /Users/osx86/Desktop/Dev/Chameleon-2.0-RC4-r684-src/dst
ls -l /Users/osx86/Desktop/Dev/Chameleon-2.0-RC4-r684-src/sym/i386/boot
-rw-r--r-- 1 osx86 staff 320320 3 7 22:05 /Users/osx86/Desktop/Dev/Chameleon-2.0-RC4-r684-src/sym/i386/boot
(略)
================= make embedtheme for boot1 =================
/bin/mkdir -p /Users/osx86/Desktop/Dev/Chameleon-2.0-RC4-r684-src/obj/i386/boot1
/Developer/usr/bin/nasm boot1.s -o /Users/osx86/Desktop/Dev/Chameleon-2.0-RC4-r684-src/sym/i386/boot1h
/Developer/usr/bin/nasm boot1hp.s -o /Users/osx86/osx86/Desktop/Dev/Chameleon-2.0-RC4-r684-src/sym/i386/boot1hp
/Developer/usr/bin/nasm boot1he.s -o /Users/osx86/Desktop/Dev/Chameleon-2.0-RC4-r684-src/sym/i386/boot1he
/Developer/usr/bin/nasm boot1f32.s -o /Users/osx86/Desktop/Dev/Chameleon-2.0-RC4-r684-src/sym/i386/boot1f32
================= make embedtheme for boot0 =================
/Developer/usr/bin/nasm boot0.s -o /Users/osx86/Desktop/Dev/Chameleon-2.0-RC4-r684-src/sym/i386/boot0
/Developer/usr/bin/nasm chain0.s -o /Users/osx86/Desktop/Dev/Chameleon-2.0-RC4-r684-src/sym/i386/chain0
================= make embedtheme for cdboot =================
/Developer/usr/bin/nasm cdboot.s -o /Users/osx86/Desktop/Dev/Chameleon-2.0-RC4-r684-src/sym/i386/cdboot
dd if=/Users/osx86/Desktop/Dev/Chameleon-2.0-RC4-r684-src/sym/i386/boot of=/Users/osx86/Desktop/Dev/Chameleon-2.0-RC4-r684-src/sym/i386/cdboot conv=sync bs=2k seek=1
156+1 records in
157+0 records out
321536 bytes transferred in 0.001120 secs (287123639 bytes/sec)
# Update cdboot with boot file size info
stat -f%z /Users/osx86/Desktop/Dev/Chameleon-2.0-RC4-r684-src/sym/i386/boot \
| perl -ane "print pack('V',@F[0]);" \
| dd of=/Users/osx86/Desktop/Dev/Chameleon-2.0-RC4-r684-src/sym/i386/cdboot bs=1 count=4 seek=2044 conv=notrunc
4+0 records in
4+0 records out
4 bytes transferred in 0.149005 secs (27 bytes/sec)
$ cd sym/i386
$ ls -la
total 5280
drwxr-xr-x 17 osx86 staff 578 3 7 22:05 .
drwxr-xr-x 3 osx86 staff 102 3 7 22:05 ..
-rw-r--r-- 1 osx86 staff 1032111 3 7 22:05 art.h
-rw-r--r-- 1 osx86 staff 320320 3 7 22:05 boot
-rwxr-xr-x 1 osx86 staff 392688 3 7 22:05 boot.sys
-rw-r--r-- 1 osx86 staff 512 3 7 22:05 boot0
-rw-r--r-- 1 osx86 staff 512 3 7 22:05 boot1f32
-rw-r--r-- 1 osx86 staff 1024 3 7 22:05 boot1h
-rw-r--r-- 1 osx86 staff 4096 3 7 22:05 boot1he
-rw-r--r-- 1 osx86 staff 512 3 7 22:05 boot1hp
-rw-r--r-- 1 osx86 staff 323584 3 7 22:05 cdboot
-rw-r--r-- 1 osx86 staff 512 3 7 22:05 chain0
-rw-r--r-- 1 osx86 staff 26277 3 7 22:05 embedded.h
-rw-r--r-- 1 osx86 staff 52200 3 7 22:05 libsa.a
-rw-r--r-- 1 osx86 staff 504392 3 7 22:05 libsaio.a
-rwxr-xr-x 1 osx86 staff 10096 3 7 22:05 machOconv
-rw-r--r-- 1 osx86 staff 166 3 7 22:05 vers.h

2.3 Chameleon 2.0RC4-r684のソースに複数のパッチを適用


$ patch -p0 < RC4-r684_patch.diff
patching file Chameleon-2.0-RC4-r684-src/i386/boot0/boot0.s
patching file Chameleon-2.0-RC4-r684-src/i386/libsaio/nvidia.c
patching file Chameleon-2.0-RC4-r684-src/i386/libsaio/pci_setup.c
patching file Chameleon-2.0-RC4-r684-src/i386/libsaio/usb.c
$ make embedtheme

$ patch -p0 < RC4-r684_patch+.diff
patching file Chameleon-2.0-RC4-r684-src/i386/boot0/boot0.s
patching file Chameleon-2.0-RC4-r684-src/i386/libsaio/ati.c
patching file Chameleon-2.0-RC4-r684-src/i386/libsaio/freq_detect.h
patching file Chameleon-2.0-RC4-r684-src/i386/libsaio/nvidia.c
patching file Chameleon-2.0-RC4-r684-src/i386/libsaio/pci_setup.c
patching file Chameleon-2.0-RC4-r684-src/i386/libsaio/usb.c
$ make embedtheme

1. replace boot file
2. add graphics enabler to boot plist
3. if you installed aty_init kext, remove aty_init kext
4. if you have intel platform, you may need video bios ati.rom on extra folder


2.4 Chameleon PreBoot CDを作成する


Download and extract the latest Chameleon (assuming into ~/Downloads)

create a directory in your home folder that contains the folder structure

# mkdir -p ~/bootcd/usr/standalone/i386/ ~/bootcd/Extra/

Copy the cdboot binary into the bootcd folder

# cp -pr ~/Downloads/Chameleon-2.0-RC4-r684-bin/i386/cdboot ~/bootcd/usr/standalone/i386/

Place a com.apple.Boot.plist into the CD

create a Preboot.dmg

# hdiutil create -size 30m -type UDIF -fs HFS -layout SPUD -volname Preboot ~/bootcd/Extra/Preboot.dmg -ov -quiet

Mount the Preboot.dmg

# hdiutil attach -owners on ~/bootcd/Extra/Preboot.dmg

Build the folder structure inside the Preboot.dmg

# mkdir -p /Volumes/Preboot/Extra/Extensions

copy your kexts into the Preboot.dmg

# cp -pr ~/Downloads/fakesmc.kext /Volumes/Preboot/Extra/Extensions/
# cp -pr ~/Downloads/NullCpuPowerManagement.kext /Volumes/Preboot/Extra/Extensions/

Copy your com.apple.Boot.plist into the Preboot.dmg

# cp -pr com.apple.Boot.plist /Volumes/Preboot/Extra/

Copy your smbios.plist into the Preboot.dmg

# cp -pr smbios.plist /Volumes/Preboot/Extra/

**Optional**
copy your DSDT.aml into your boot CD

# cp -pr DSDT.aml /Volumes/Preboot/Extra/

Fix permissions and recreate the kext cache

# sudo chown -R root:wheel /Volumes/Preboot/Extra/Extensions
# sudo chmod -R 755 /Volumes/Preboot/Extra/Extensions
# sudo kextcache -v 1 -a i386 -a x86_64 -m /Volumes/Preboot/Extra/Extensions.mkext /Volumes/Preboot/Extra/Extensions/
# sudo rm -fr /Volumes/Preboot/Extra/Extensions

Eject the Preboot.dmg

# hdiutil detach /Volumes/Preboot/

make Boot CD

# sudo hdiutil makehybrid -o My_Custom_bootcd.iso ~/bootcd/ -iso -hfs -joliet -eltorito-boot ~/bootcd/usr/standalone/i386/cdboot -no-emul-boot -hfs-volume-name "My Custom Bootcd" -joliet-volume-name "My Custom Bootcd"

burn that to a CD and you have your very own bootable cd.

2.4 CPUタイプを判別する(SMcputype)

HEX DEC Strings Remarks
0x101 257 Core 2 Solo
0x201 513 Core Solo
0x301 769 Core 2 Duo
0x401 1025 ?
0x501 1281 Dual/Quad/Six-Core Xeon
0x601 1537 Core i5 10.6.2 later
0x701 1793 Core i7 10.6.2 later
0x801 2049 ?
0x901 2305 Core i3 10.6.5 later




戻る 
最終更新:2010年11月23日 16:12