Jump to content

Booting installation DVD using PC EFI


satan_himself
 Share

71 posts in this topic

Recommended Posts

http://rapidshare.com/files/73797359/mkboot.zip.html

 

This script will prepare a bootable DVD disc image using the PC EFI boot loader, so you can create an installer using the unmodified kernel and extensions.

There are some variables you need to set in the script, i.e:

 

installer="/Volumes/Mac OS X Install DVD"	# either /dev/diskXsY or /Volumes/SomeName
size=4481					# resulting image size in megabytes
volname="Mac OS X Install DVD"			# volume name
imgname="$volname"				# output image file name
loader="pc_efi_v80/boot_v8"			# path to PC EFI boot_vXx file

 

Note that the script does not modify the files at $installer in any way, so you need to perform any modifications (OSInstall.mpkg, add/remove kexts) yourself. (Not exactly easy to use.) Personally, I simply replaced OSInstall.mpkg and removed AppleIntelCPUPowerManagement. That was enough for a working install (on a Core 2 Duo).

Link to comment
Share on other sites

I can confirm this indeed makes a pc efi install disc without doing all the brazilmac stuff.

 

(I stopped short of actually burning a dual layer DVD with it, and instead dumped it to my small install partition, worked nps).

 

Oh yeah, spose I should point out that I did modify the size parameter to 7680 before I did anything with it because I didn't want to delete all the other stuff from the install source...

Link to comment
Share on other sites

Err I used the BrazilMac one. The unmodified OSInstall refuses to put the system onto an MBR formatted drive. Maybe it would work unmodified if the drive had a GPT partition table, but I didn't want to try a GPT table at this time.If you have XCode Tools or xar you can modify the package yourself. I recall seeing some instructions around the net.

 

http://www.macosxhints.com/article.php?sto...071026083746346

 

http://forum.osx86scene.com/viewtopic.php?f=16&t=1661

 

In case you're wondering, source for the cdstub file is available from Apple:

http://www.opensource.apple.com/darwinsource/10.4.8.x86/

 

boot-1.32in the cdboot subdir.

Link to comment
Share on other sites

Considering you are just doing a restore from a mounted "Mac OS X Install DVD" Volume by creating a empty image and creating the partition similar to brazilmac and adding efi to boot instead.

you could just as easily insert code at the beginning to do the file replacement using same thing as brazilmac script

 

It should work the same and replace files easily... you could remove and add any files you want this or even drop the size to 4482 this way.

 

I will try it a little later once I get a chance to see if everything works out this way.

 

 

#modify the following lines with location of image and main files. layout is same as brazilmac
APDIR=/Users/XXX/Desktop
DMG="/Users/XXX/Desktop/osx-leopard105.dmg"
installer="/Volumes/osx86dvd2"    # either /dev/diskXsY or /Volumes/SomeName
size=7680                    # resulting image size in megabytes
volname="osx86dvd"                # volume name
imgname="$volname"                # output image file name
loader="pc_efi_v80/boot_v8"            # path to PC EFI boot_vXx file

cpfix () 
{
   cp -r ./files/$1 $2
   chown -R root:wheel $2
   chmod -R 755 $2
}
cd $APDIR

echo Converting DMG to editable image...
hdiutil convert $DMG -format UDTO -o $APDIR/leopard.iso

echo Mounting new ISO read-write...
hdiutil attach -readwrite $APDIR/leopard.iso.cdr -owners on

echo Waiting for leopard.iso to be mounted...
sleep 5

echo Renaming image to osx86dvd2...
diskutil rename /Volumes/Mac\ OS\ X\ Install\ DVD/ osx86dvd2

##### Remove old files #####

echo Removing OSInstall...
rm -rf /Volumes/osx86dvd2/System/Installation/Packages/OSInstall.mpkg

echo Removing Extensions...
rm -rf /Volumes/osx86dvd2/System/Library/Extensions.mkext
rm -rf /Volumes/osx86dvd2/System/Library/Extensions/AppleSMBIOS.kext
rm -rf /Volumes/osx86dvd2/System/Library/Extensions/AppleHWSensor.kext

echo Removing files Needed for kernels without power_management_init called
rm -rf /Volumes/osx86dvd2/System/Library/Extensions/AppleIntelCPUPowerManagement.kext 

##### Adding necessary files #####
echo Replacing OSInstall.mpkg...
cpfix OSInstall.mpkg /Volumes/osx86dvd2/System/Installation/Packages/OSInstall.mpkg

echo Replacing extensions...
for kext in `ls files/Extensions`; do
cpfix Extensions/$kext /Volumes/osx86dvd2/System/Library/Extensions/
done

echo ALL PATCHES APPLIED !!!

echo Begin image processing

cp -f "$loader" boot/boot
cp -f cdstub boot/cdboot
dd if=boot/boot of=boot/cdboot bs=2048 seek=1 conv=sync

rm -f boot/.DS_Store

./mkisofs -V "$volname" -no-emul-boot -boot-load-size 4 -c boot.cat -b cdboot -o boot.iso boot

bblocks=`hdiutil pmap boot.iso | awk '/Apple_ISO/ { print $5 }'`
blocks=$(( $size * 2048 ))

# change type to UDIF if you want an iso image (just rename the resulting dmg)
img=`hdiutil create -sectors $blocks -type SPARSE -layout NONE -ov "$imgname" | awk '{ print $2 }'`
dev=`hdiutil attach -readwrite -nomount "$img"`
rdev=`echo $dev | sed s/disk/rdisk/`

pdisk $rdev -initialize
slice=`pdisk $rdev -createPartition "$volname" Apple_HFS $bblocks $(( $blocks - $bblocks ))`

dd if=boot.iso of=$rdev skip=64 seek=64 bs=512
rm boot.iso

vol=${rdev}s${slice}

echo Removing files and useless stuff
rm -rf "$APDIR"/leopard.iso.cdr
asr restore --source "$installer" --target $vol --erase --noprompt

echo ALL Done !!

Link to comment
Share on other sites

hey mWMA, i'm going to build a DVD using your suggestion (special thanks to Satan !!!!)

my question is... what is the bare minimum i need to remove/replace from the retail DVD to get a working leopard EFI boot DVD installer ?

i want to be as close to original leopard dvd as possible including xcode, language file etc...

Link to comment
Share on other sites

hey guys,

created a dvd using mWMA's script as a base and added the needed kexts for my setup (dsmos,AppleSMBIOS,NVinject,IONetwork fix and of course removed AppleIntelCPU..). the dvd booted up fine, install ran without errors. i did not replace OSInstall because i'm running guid. Two things needed after install: apply pc efi v80 and replace the aforementioned kexts in the installed volume.

 

one thing though, i thought that replaceingthe kexts (using the script) on the dvd was that those same kexts are install on the volume, i guess that is not the case and these kexts are stored in a seperate package. can anyone provide some insight.

thanks.

Link to comment
Share on other sites

Exactly, no matter which kext are you using on the DVD to boot they will not installed. BaseSystem packacge has the kexts to be installed, if you want more or differnte kext to be installed you need to creat your own package, but the best way is to include a post installation script tha unpack or copy specific kexts. that is how Jas, TubGirl and some other DVD works.

Link to comment
Share on other sites

Considering you are just doing a restore from a mounted "Mac OS X Install DVD" Volume by creating a empty image and creating the partition similar to brazilmac and adding efi to boot instead.

you could just as easily insert code at the beginning to do the file replacement using same thing as brazilmac script

 

It should work the same and replace files easily... you could remove and add any files you want this or even drop the size to 4482 this way.

 

I will try it a little later once I get a chance to see if everything works out this way.

#modify the following lines with location of image and main files. layout is same as brazilmac
APDIR=/Users/XXX/Desktop
DMG="/Users/XXX/Desktop/osx-leopard105.dmg"
installer="/Volumes/osx86dvd2"    # either /dev/diskXsY or /Volumes/SomeName
size=7680                    # resulting image size in megabytes
volname="osx86dvd"                # volume name
imgname="$volname"                # output image file name
loader="pc_efi_v80/boot_v8"            # path to PC EFI boot_vXx file

cpfix () 
{
   cp -r ./files/$1 $2
   chown -R root:wheel $2
   chmod -R 755 $2
}
cd $APDIR

echo Converting DMG to editable image...
hdiutil convert $DMG -format UDTO -o $APDIR/leopard.iso

echo Mounting new ISO read-write...
hdiutil attach -readwrite $APDIR/leopard.iso.cdr -owners on

echo Waiting for leopard.iso to be mounted...
sleep 5

echo Renaming image to osx86dvd2...
diskutil rename /Volumes/Mac\ OS\ X\ Install\ DVD/ osx86dvd2

##### Remove old files #####

echo Removing OSInstall...
rm -rf /Volumes/osx86dvd2/System/Installation/Packages/OSInstall.mpkg

echo Removing Extensions...
rm -rf /Volumes/osx86dvd2/System/Library/Extensions.mkext
rm -rf /Volumes/osx86dvd2/System/Library/Extensions/AppleSMBIOS.kext
rm -rf /Volumes/osx86dvd2/System/Library/Extensions/AppleHWSensor.kext

echo Removing files Needed for kernels without power_management_init called
rm -rf /Volumes/osx86dvd2/System/Library/Extensions/AppleIntelCPUPowerManagement.kext 

##### Adding necessary files #####
echo Replacing OSInstall.mpkg...
cpfix OSInstall.mpkg /Volumes/osx86dvd2/System/Installation/Packages/OSInstall.mpkg

echo Replacing extensions...
for kext in `ls files/Extensions`; do
cpfix Extensions/$kext /Volumes/osx86dvd2/System/Library/Extensions/
done

echo ALL PATCHES APPLIED !!!

echo Begin image processing

cp -f "$loader" boot/boot
cp -f cdstub boot/cdboot
dd if=boot/boot of=boot/cdboot bs=2048 seek=1 conv=sync

rm -f boot/.DS_Store

./mkisofs -V "$volname" -no-emul-boot -boot-load-size 4 -c boot.cat -b cdboot -o boot.iso boot

bblocks=`hdiutil pmap boot.iso | awk '/Apple_ISO/ { print $5 }'`
blocks=$(( $size * 2048 ))

# change type to UDIF if you want an iso image (just rename the resulting dmg)
img=`hdiutil create -sectors $blocks -type SPARSE -layout NONE -ov "$imgname" | awk '{ print $2 }'`
dev=`hdiutil attach -readwrite -nomount "$img"`
rdev=`echo $dev | sed s/disk/rdisk/`

pdisk $rdev -initialize
slice=`pdisk $rdev -createPartition "$volname" Apple_HFS $bblocks $(( $blocks - $bblocks ))`

dd if=boot.iso of=$rdev skip=64 seek=64 bs=512
rm boot.iso

vol=${rdev}s${slice}

echo Removing files and useless stuff
rm -rf "$APDIR"/leopard.iso.cdr
asr restore --source "$installer" --target $vol --erase --noprompt

echo ALL Done !!

 

 

 

I can confirm that the combination of "satan_himself" script and "mWMA" suggestion builds a bootable EFI patched Leopard DVD !!! :-)

All you need is an original Leopard iso, which is easily found via BT

 

Edit: no sata support ;-(

Link to comment
Share on other sites

Considering you are just doing a restore from a mounted "Mac OS X Install DVD" Volume by creating a empty image and creating the partition similar to brazilmac and adding efi to boot instead.

you could just as easily insert code at the beginning to do the file replacement using same thing as brazilmac script

 

It should work the same and replace files easily... you could remove and add any files you want this or even drop the size to 4482 this way.

 

I will try it a little later once I get a chance to see if everything works out this way.

 

 

#modify the following lines with location of image and main files. layout is same as brazilmac
APDIR=/Users/XXX/Desktop
DMG="/Users/XXX/Desktop/osx-leopard105.dmg"
installer="/Volumes/osx86dvd2"    # either /dev/diskXsY or /Volumes/SomeName
size=7680                    # resulting image size in megabytes
volname="osx86dvd"                # volume name
imgname="$volname"                # output image file name
loader="pc_efi_v80/boot_v8"            # path to PC EFI boot_vXx file

cpfix () 
{
   cp -r ./files/$1 $2
   chown -R root:wheel $2
   chmod -R 755 $2
}
cd $APDIR

echo Converting DMG to editable image...
hdiutil convert $DMG -format UDTO -o $APDIR/leopard.iso

echo Mounting new ISO read-write...
hdiutil attach -readwrite $APDIR/leopard.iso.cdr -owners on

echo Waiting for leopard.iso to be mounted...
sleep 5

echo Renaming image to osx86dvd2...
diskutil rename /Volumes/Mac\ OS\ X\ Install\ DVD/ osx86dvd2

##### Remove old files #####

echo Removing OSInstall...
rm -rf /Volumes/osx86dvd2/System/Installation/Packages/OSInstall.mpkg

echo Removing Extensions...
rm -rf /Volumes/osx86dvd2/System/Library/Extensions.mkext
rm -rf /Volumes/osx86dvd2/System/Library/Extensions/AppleSMBIOS.kext
rm -rf /Volumes/osx86dvd2/System/Library/Extensions/AppleHWSensor.kext

echo Removing files Needed for kernels without power_management_init called
rm -rf /Volumes/osx86dvd2/System/Library/Extensions/AppleIntelCPUPowerManagement.kext 

##### Adding necessary files #####
echo Replacing OSInstall.mpkg...
cpfix OSInstall.mpkg /Volumes/osx86dvd2/System/Installation/Packages/OSInstall.mpkg

echo Replacing extensions...
for kext in `ls files/Extensions`; do
cpfix Extensions/$kext /Volumes/osx86dvd2/System/Library/Extensions/
done

echo ALL PATCHES APPLIED !!!

echo Begin image processing

cp -f "$loader" boot/boot
cp -f cdstub boot/cdboot
dd if=boot/boot of=boot/cdboot bs=2048 seek=1 conv=sync

rm -f boot/.DS_Store

./mkisofs -V "$volname" -no-emul-boot -boot-load-size 4 -c boot.cat -b cdboot -o boot.iso boot

bblocks=`hdiutil pmap boot.iso | awk '/Apple_ISO/ { print $5 }'`
blocks=$(( $size * 2048 ))

# change type to UDIF if you want an iso image (just rename the resulting dmg)
img=`hdiutil create -sectors $blocks -type SPARSE -layout NONE -ov "$imgname" | awk '{ print $2 }'`
dev=`hdiutil attach -readwrite -nomount "$img"`
rdev=`echo $dev | sed s/disk/rdisk/`

pdisk $rdev -initialize
slice=`pdisk $rdev -createPartition "$volname" Apple_HFS $bblocks $(( $blocks - $bblocks ))`

dd if=boot.iso of=$rdev skip=64 seek=64 bs=512
rm boot.iso

vol=${rdev}s${slice}

echo Removing files and useless stuff
rm -rf "$APDIR"/leopard.iso.cdr
asr restore --source "$installer" --target $vol --erase --noprompt

echo ALL Done !!

 

I've some problem with this script, I would like to remove language package and X11 pack, I've add this command on #remove OLD file# command line:

 

echo Removing OSInstall...

rm -rf /Volumes/osx86dvd2/System/Installation/Packages/OSInstall.mpkg

rm -rf /Volumes/osx86dvd2/System/Installation/Packages/X11user.pkg

rm -rf /Volumes/osx86dvd2/System/Installation/Packages/Dutch.pkg

rm -rf /Volumes/osx86dvd2/System/Installation/Packages/Danish.pkg

rm -rf /Volumes/osx86dvd2/System/Installation/Packages/Finnish.pkg

rm -rf /Volumes/osx86dvd2/System/Installation/Packages/Polish.pkg

rm -rf /Volumes/osx86dvd2/System/Installation/Packages/Russian.pkg

rm -rf /Volumes/osx86dvd2/System/Installation/Packages/Swedish.pkg

 

echo Removing Extensions...

rm -rf /Volumes/osx86dvd2/System/Library/Extensions.mkext

rm -rf /Volumes/osx86dvd2/System/Library/Extensions/AppleSMBIOS.kext

rm -rf /Volumes/osx86dvd2/System/Library/Extensions/AppleHWSensor.kext

 

echo Removing printer packages...

rm -rf /Volumes/osx86dvd2/System/Installation/Packages/*Printer*

 

echo Removing files Needed for kernels without power_management_init called

rm -rf /Volumes/osx86dvd2/System/Library/Extensions/AppleIntelCPUPowerManagement.kext

rm -rf /Volumes/osx86dvd2/System/Library/Extensions/AppleEFIRuntime.kext

 

 

I've set the image size to 4482 but I've only 7.3 GB for the final image, and an error (not enought free space etc...). Can anyone help me?

in attachment the complete command list

mkimage.txt

Link to comment
Share on other sites

satan_himself:

 

a few of us over on netkas' forum are disucssing the possibility of a legal darwin-based ISO which could prepare a PC for Leopard installation (by setting the disk as GPT, creating the correct partitions, installing PC-EFI etc) which would then ask for the Leopard GM media and perform full installation.

 

the beauty of this is that if we can build the disc using all open-source and freely-distributable software, then it is legal to distribute. it would allow joe public to buy retail Leopard and 'just install it' on his PC.

 

i'd be very interested to hear your thoughts on this approach.

Link to comment
Share on other sites

satan_himself:

 

a few of us over on netkas' forum are disucssing the possibility of a legal darwin-based ISO which could prepare a PC for Leopard installation (by setting the disk as GPT, creating the correct partitions, installing PC-EFI etc) which would then ask for the Leopard GM media and perform full installation.

 

the beauty of this is that if we can build the disc using all open-source and freely-distributable software, then it is legal to distribute. it would allow joe public to buy retail Leopard and 'just install it' on his PC.

 

i'd be very interested to hear your thoughts on this approach.

 

That is an awesome idea!

Link to comment
Share on other sites

Darwin wouldn't be able to run the Mac OS X Installer directly.

 

It should be possible to create a CD wich would allow to to boot the OS X DVD, and offer an option to perform some pre and post-installation steps. I'll have to take a look how the Darwin boot loader works.

 

If not, it would definitely be possible to make a CD wich would copy the OS X DVD to a spare partition, perform the needed fixup and reboot the system off that partition.

Link to comment
Share on other sites

yeah, the temp partition thing would be an option. especially since, with GPT, you could have this kind of disk layout:

 

[=EFI=|===Target Partition=====|Install Partition]

 

where Install Partition is the partition we use as a temp space for installation.

 

post-install you could then delete the install partition and non-destructively grow the target partition into the free space :D

Link to comment
Share on other sites

 Share

×
×
  • Create New...