deek5 Posted May 6, 2018 Share Posted May 6, 2018 I use grub4dos, little memo for my use of Grub4Dos to launch chameleon or throw chameleon and a Mac OS X system link to a DMG or VHD file, from the boot of Windows. In absolute terms it must implement 7 maneuvers to arrive at the result, but by automating a little, it does with 3 manipulations.The goal is to have the ability to start a Mac os x system on Windows startup, I use it to check that my mac os x backups in dmg or vhd are functional and error-freeI am using Visual BCD to create an opening choice of /Grub4/grub.exe in the Windows BCD (BCD Windows Startup Store).First of all have a DMG system or file from an existing Mac OS X installation. After having at least one HFS partition.It is necessary to create an Iso or a Vhd, mounted under mac os this iso or this vhd or this DMG, intaller chameleon with a folder Extra, in this file we will place the kernel (mach_kernel or kernel) of the desired system, the kernelcache of the same system, the boot.plist (org.chameleon.Boot.plist) containing the options for your boot plus the kernel option for the kernel file, the kernelcache option for the cache to use, the Kernel Flags option - v -s rd = uuid boot-uuid = (the uuid of the hfs partition containing the DMG or Vhd to mount), rp = file: ///MacLion.dmg (the DMG file of the system to be mounted which is on the hfs partition which we gave the UUID), example of a Kernel FlagsKernel Flags String PciRootUID = 0 rd = uuid boot-uuid = B61C6FED-DB6F-3B84-8D39-E933A2DF1312 rp = file: ///MacLion.dmg -v -s npci = 0x2000<key> Kernel Flags </ key><string> PciRootUID = 0 rd = uuid boot-uuid = B61C6FED-DB6F-3B84-8D39-E933A2DF1312 rp = file: ///MacLion.dmg -v -s npci = 0x2000 </ string>.to create an iso under Mac Os X mountable by Grub4Dos, one creates a folder or a dmg (preferably a dmg read and write) where one installs chameleon (if it is a file one copies in this file the file Extra, the file usr, the boot file) we use hdiutil in the terminalwith the following options for a dmg create which bears the name "base.dmg" and which is mountedsudo hdiutil makehybrid -o /base.iso / Volumes / base -iso -hfs -joliet -eltorito-boot / Volumes / base / usr / standalone / i386 / cdboot -no-emul-boot -hfs-volume-name "base" -joliet-volume-name "base" - iso-volume-name "base"the command will create a base.iso file at the root (/base.iso), this file will be created from the mounted.dmg database (/ Volumes / base)with the following option for a folder (this folder is on the desktop) containing chameleon and folders (Extra, usr)sudo hdiutil makehybrid -o /base.iso ~ / Desktop / base -iso -hfs -joliet -eltorito-boot ~ / Desktop / base / usr / standalone / i386 / cdboot -no-emul-boot -hfs-volume-name " baseiso "-joliet-volume-name" base "-iso-volume-name" base "the command will create a base.iso file at the root (/base.iso), this file will be created from ~ / Desktop / base the ~ replaces "/ Users / yourname" (~ / Desktop / base) Once the iso is created, you copy it to a windows partition (ntfs).In the menu.lst of grub4dos (for Yosemite for example)"find --set-root - ignore-floppies - ignore-cd / yos.vhdmap /chamyos.vhd (hd4,0)map --hookmap --harddrives = 4rootnoverify (hd4,0)chainloader (hd4,0) +1boot "or for an Elcapitan iso"title Elcapitanfind --set-root --ignore-floppies --ignore-cd /elcap.isomap --mem /elcap.iso (hd32)map --hookrootnoverify (hd32)chainloader (hd32)boot "After grub4dos, your new "bootloader" "chameleon or Enoch" is displayed, in the choice of start you see your iso or vhd, you select it, the boot of the mac os x is realized after mounting the dmg or vhd until at the mac os x command-line entry (kernel flags -s option), i'm using a modified version of /private/etc/rc.netboot that is present on all mac os x. So once in the command line at the root, you type in "/private/etc/rc.netboot" and then "/ exit" to continue booting your mac os x.you have downloaded a version of Grub4Dos (version 0.4.6a) and install it from Windows (for reminder all this is possible if only if you already have an existing mac os x system, means to read, write and create partitions (volumes) HFS +, NTFS (ex: Paragon NTFS for Mac and Paragon HFS for windows).All that is written above is from the google translation, I apologize if it is badly translated.Maybe you think that all this is not very useful, I understand very well, basically I wanted to boot from windows, it turned out that Apple does not treat virtualization directly for its system. exploitation (unlike window which since windows 7 allows to use vhd as operating system) To start a mac os x system from an iso, the easiest way is to use easybcd under windows rather than grub4dos. Easybcd can create in the bcd the choice to start a system from an iso. To create an easier iso, as it is written above, it is to use the commands of the terminal under mac. Create a folder containing the Extra folder (unavoidable for bootloader with chameleon (or Ermac's Enoch)) a system folder (practically empty just containing a SystemVersion.plist file (which is checked by chameleon at startup (the/System/Library/CoreServices/SystemVersion.plist, a System folder inside a Library folder, inside a CoreServices folder and inside the SystemVersion.plist file), a usr folder containing the standalone folder (create chameleon folder or Enoch, when you install this one on a partition, as a reminder chaméléon is a system bootloader mac os x on a hackintosh) (tree/usr/standalone) /usr/standalone, because in the command I use cdboot which is here/usr/standalone/i386/cdboot, cdboot to make bootable iso. Back to the folder/Extra, it must contain the file "org.chameleon.Boot.plist" which contains all options for chameleon and option for system startup, can be a folder/Extra/Extentions, for extensions of the kernel that does not may not be in the cache (ex: FakeSMC.kext for macos x High Sierra, so any kexts that can not be in the cache), a smbios.plist file that contains the description of your mac (imac, mini, macbook, MacPro) (ex: <Key> SMbiosdate </key> <String> 09/03/13 </string> <Key> SMbiosvendor </key> <string> Apple Inc. </string> <Key> SMbiosversion </key> <String> IM142.88Z.0118.B00.1309031249 </string> <Key> SMboardproduct </key> <String> Mac 27ADBB7B4CEE8E61 </string> <Key> SMexternalclock </key> <string> 100 MHz </string> <Key> SMfamily </key> <String> iMac </string>) you can find smbios.plist files on the net without difficulty. In the Extra folder there is also the kernel file of the system you want to start, originally the kernel file from Yosemite is "/System/Library/Kernels/kernel" once copied to the Extra folder you can name it as you want (eg "macHSker"), you must have the key in org.chameleon.Boot.plist <key> Kernel </key> <String>/extra/macHSker </string> the cache file that according to the systems from Lion to El Capitan was in the folder/System/Library/Caches/com.apple.kext.caches/Startup/kernelcache, and from El Capitan in/System/Library/PrelinkedKernels/prelinkedkernel, the kernelcache (or prelinkedkernel) it is the assembly of the kernel and kernel extensions (kext) it is this file that allows to bypass the loading of all the kexts and the kernel at startup, once the file copied in the folder/Extra you can rename it as you wish (ex: macHSCach) without forgetting the key in org.chameleon.Boot.plist <key> Kernel Cache </key> <String>/extra/macHSCach </string>. and finally the key in org.chameleon.Boot.plist <key> Kernel Flags </key> <string>PciRootUID=0 GraphicsEnabler=yes kext-dev-mode=1 -v -s npci=0x2000 nvda_drv=1 rd=uuid boot-uuid=399520ED-E5A2-3CD7-94DA-C94AE68692EB rp=file:///MacHS.vhd rootless=0 </string> which will allow you to get your vhd and load it or if you want to start your partition containing your mac os x system just use the uuid of the partition. <key> Kernel Flags </key> <string>PciRootUID=0 GraphicsEnabler=yes kext-dev-mode=1 -v -s npci=0x2000 nvda_drv=1 rd=uuid boot-uuid=399520ED-E5A2-3CD7-94DA-C94AE68692EB rootless=0 </string> , the uuid present, it is either the uuid of the partition HFS containing the file vhd or dmg or the uuid of your system partition mac os x (Yosemite, El Capitan, Sierra, High Sierra, etc ...), the boot file will also be copied to the folder, the boot file is chameleon or Enoch. So in the end in the folder that you will convert to iso file and copied to the root of your Windows partition, the tree of this folder will be for example /MacHS /Extra/ /System/ /Usr/ /boot The iso will be realized with the command below in the terminal of the system mac os x sudo hdiutil makehybrid -o/hsiso.iso/Volumes/disk0s3/MacHS -iso -hfs -joliet -eltorito-boot/Volumes/disk0s3/Machs/usr/standalone/i386/cdboot -no-emul-boot-hfs-volume- name "MacHS" -joliet-volume-name "MacHS" -iso-volume-name "MacHS" Once your imagedisk "VHD" or "DMG", mounted by the system, it will be read only (although originally it is "Read & Write") is a choice of Apple.So to replace this situation, after having arrived at the command line following the execution of the "-s" option of the kernel fkags of org.chameleon.Boot.plist we can use "sh / private / etc / rc.netboot init "directly then exit to exit the command line and continue booting. /private/etc/rc.netboot must be modified, to edit it copy it to your desktop, it will be unlocked, below the original version of lines 24,25,26 of the script "/private/etc/rc.netboot ""NETBOOT_MOUNT = / var / netbootNETBOOT_SHADOW = $ {NETBOOT_SHADOW: -NETWORK-}LOCAL_NETBOOT_DIR = private / var / run / com.apple.NetBootX "To create a shadow file you have to modify the line 25 like this "NETBOOT_SHADOW = $ {NETBOOT_SHADOW: -LOCAL_ONLY-}" below the same modified linesNETBOOT_MOUNT = / var / netbootNETBOOT_SHADOW = $ {NETBOOT_SHADOW: -LOCAL-}LOCAL_NETBOOT_DIR = private / var / run / com.apple.NetBootXrc.netboot creates a ramdisk where all write disk accesses will be hijacked as your imagedisk is read-only.attach ramdisk to your root disk imageonce modified rc.netboot you can copy it to / private / etc /.when you are on the command line typing "sh /private/etc/rc.netboot init", if you encounter a "permission denied" problem copy rc.netboot to the root of your imagedisk, command line type keyboard "sh /rc.netboot init" then exitTo make the script executable in the terminal "sudo chmod + x /private/etc/rc.netboot". All these modifications must modify rc.netboot which is on your imagedisk. If you made it on your used disk inct, copy rc.netboot to your imagedisk.I am using a rc.netboot modified by spartango 2008 rc.livebootthat I myself reduced in size, it creates a ramdisk of 2go, below the script of /rc.b that I useto copy if you wish. To use it on the keyboard you type "/rc.b" and exit wait until the end of the execution of "/rc.b" the last sentence that must be written on the screen is "set ComputerName VHD "So he creates a ramdisk of 2go " #!/bin/sh -x ## # Copyright 2002 Apple Computer, Inc. # # This script configures LiveDVD, derived from Netboot # Modded by spartango 2008 # still has remanents of netboot ## . /etc/rc.common # # Define: NETBOOT_SHADOW # Purpose: # To change the behavior of the system when choosing a netboot shadow # to use. # Values: # -NETWORK- Try to use the network for the shadow file, if # that fails, use the local drive # -NETWORK_ONLY- Only use the network, fail if not available # -LOCAL- Use the local drive for the shadow file, if that # fails, use the network # -LOCAL_ONLY- Only use the local drive for the shadow, fail if # not available NETBOOT_MOUNT=/var/netboot NETBOOT_SHADOW=${NETBOOT_SHADOW:-LOCAL-} Failed() { echo rc.netboot: $1 exit 1 } common_start() { netboot_dir=$1 netboot_shadow=$2 if [ "${netboot_dir}" = "" ] ; then Failed "netboot_dir is empty" fi if [ "${netboot_shadow}" = "" ] ; then Failed "netboot_shadow is empty" fi netboot_shadow="${netboot_dir}/${netboot_shadow}" if ! mkdir -p "${netboot_dir}" ; then Failed "create ${netboot_dir} failed" fi chmod 700 "${netboot_dir}" mount -u -o ro / root_device=$(mount | sed -n 's:/dev/\(.*\) on / .*:\1:p') case "${root_device}" in vn*) if ! touch "${netboot_shadow}" ; then Failed "create ${netboot_shadow} failed" fi chmod 600 "${netboot_shadow}" if ! /usr/libexec/vndevice shadow "/dev/r${root_device}" "${netboot_shadow}" ; then Failed "vndevice shadow failed" fi ;; "") Failed "root device unknown" ;; *) if ! touch "${netboot_shadow}" ; then Failed "failed to create shadow ${netboot_shadow}" fi chmod 600 "${netboot_shadow}" if ! /usr/bin/nbdst -recycle "${root_device}" "${netboot_shadow}" ; then Failed "nbdst failed" fi ;; esac } local_mount() { volinfo=`autodiskmount -F 2>/dev/null` RAMDisk "${NETBOOT_MOUNT}" common_start "${NETBOOT_MOUNT}/.com.apple.NetBootX" shadowfile return 0 } do_start() { err=$(local_mount) if [ $? -ne 0 ]; then Failed "${err}" fi } RAMDisk() { mntpt=$1 #rdsize=$2 echo "Creation RAM Disk pour $mntpt" dev=`hdik -drivekey system-image=yes -drivekey eject-upon-logout=no -nomount ram://2000000` if [ $? -eq 0 ] ; then #newfs $dev #hack to init partition table automatically /sbin/newfs_hfs $dev mount -t hfs -o nosuid,nodev $dev $mntpt echo "ramdisk créé et monté OK" fi } #Example: RAMDisk /Volumes 2048 do_init() { # attach the shadow file to the root disk image do_start # make sure the root filesystem is clean fsck -p || fsck -fy || Failed "Could not clean root filesystem" # make it writable mount -uw / # adjust /private/var/vm to point to the writable area (if not diskless) swapdir=/private/var/vm mounted_from=$(mount | sed -n 's:\(.*\) on .*/var/netboot.*:\1:p') case "${mounted_from}" in /dev/*) netboot_dir="${NETBOOT_MOUNT}/.com.apple.NetBootX" if [ -d "${netboot_dir}" ]; then rm -rf "${swapdir}" ln -s "${netboot_dir}" "${swapdir}" echo "Montage par ramdisk miroir !" fi ;; *) ;; esac # set the ComputerName echo " set ComputerName VHD " scutil --set ComputerName VHD } do_init exit 0 " Link to comment Share on other sites More sharing options...
Recommended Posts