Jump to content
i am oz

Scriptable Utility to Create a Mountain Lion USB Installer

3 posts in this topic

Recommended Posts

Mountain Lion USB Installer Creator

 

Creates a USB installer for OS X Mountain Lion.

 

Must be run as root.

 

User is required to supply the path to InstallESD.dmg or have

Install OS X Mountain Lion.app sitting in /Applications.

 

Default kernel is vanilla, use '-c amd' to install AnV RC4 amd_kernel as

mach_kernel.

 

You can modify the kit or use '-k <path>' to customize the installer:

- Chameleon can be updated by replacing the files in Chameleon/i386.

 

- /Extra is copied over from Chameleon/Extra, so files added or changed there

will be copied to the new system for you.

 

- Extensions get copied to /System/Library/Extensions from the Extensions

folder.

 

- Launch daemons are installed from LaunchDaemons to /Library/LaunchDaemons.

 

- Custom actions can be executed at the end of the installation by modifying the

bash script postinstall.sh. The script is sourced by bless, so the

environment includes the log function and various useful variables. See the

script for more information.

 

- If you use the option to install an AMD kernel, you can replace amd_kernel

in the kit and it will get installed as mach_kernel on the installer and the

installed system. That way you can use some other legacy kernel instead

of the stock default.

 

- usr gets copied to /usr on the installer, but not the installed system.

This can still be useful if you want to use a utility in Terminal that

isn't available on the installer by default.

 

- The whole kit gets copied to /opt/kit on the installer. Again, probably only

useful to advanced users.

 

The '-y' option is great when you don't want to sit around watching for any

prompts that might pop up ;) (also for scripts)

 

The '-v' option gives lots of nice progress reporting while copying files,

for those that get paranoid when a utility sits with no output for a while.

 

Give your USB volume a fancy custom label with the '-l' option.

 

Ozlog is some ridiculous display of jumping through hoops to monitor the

bless hijack on the installer, and probably doesn't deserve to be included

with this utility. It may be useful to someone, but consider these options

seriously advanced. It should be harmless, but is generally useless. If you

want to use it, run `netcat -l 1234' on the host specified by '-a' to see

the log. It is only used when bless is called, at the very end of the

install process. Check out the log function at the top of usr/sbin/bless for

an example of how to use the installer side.

 

So, why would you want to monitor bless? Bless is what screws up some

other installer utilities and causes them to say "Installation Failed" at the

end, even though the system is still installed successfully. If you look in

the kit at usr/sbin/, you'll see that there is a bash script there called bless.

This script is the bless hijack, and it tricks the installer into succeeding!

It also installs Chameleon, /Extra, ensures the amd_kernel replaces

mach_kernel, copies over kexts, etc. This script replaces the stock bless

and therefore gets called at the end of the installation. If you had something

special you wanted your installer to do, you could put it in kit/ and modify

bless to call your script or whatever else you can imagine would be neat.

 

Bonus tip: You can use the following command to create a blank dmg.

hdiutil create -size 5g -format UDWR -attach installer.dmg

The output will list a device (like /dev/disk1) that you can use as the

argument to this utility. Then you'll have a .dmg you can keep, and restore

to a USB drive whenever you need it, instead of having to rebuild it with

this program.

 

hack:~ oz$ sudo ./mlusbcreator
Usage: mlusbcreator [-h]
mlusbcreator [-vy] [-k KIT] [-e ESD] [-l LABEL] [-c amd|intel] [-o -a ADDRESS [-p PORT]] target

Options:
-h, --help show this help message and exit
-v, --verbose display more info when copying files
-y, --yes automatically answer yes to all questions (useful for scripting)
-k KIT, --kit=KIT custom path to the hack kit (default: ./kit)
-e ESD, --esd=ESD custom path to InstallESD.dmg (default: /Applications/Install OS X Mountain Lion.app/SharedSupport/InstallESD.dmg)
-l LABEL, --label=LABEL custom label for the USB volume (default: Mountain Lion USB Installer)
-o, --ozlogd enable remote logging of bless hijack, requires -a and -p
-a ADDRESS, --address=ADDRESS ip address to send log messages to
-p PORT, --port=PORT custom port to sent log messages to (default: 1234)
-c CPU, --cpu=CPU explicitly set cpu type of target system (default: intel)

Brought to you by oz and SS01

 

Example usage:

hack:~ oz$ sudo ./mlusbcreator -y --verbose --esd=InstallESD.dmg --cpu=amd /dev/disk1

 

Get the latest version at http://oz.freqlabs.com/osx86/mlusb.zip

Edited by i am oz

Share this post


Link to post
Share on other sites
Advertisement

Congratulations, man!

 

Great tool! I tested when you sent me the link on the chat and - sorry not to tell you before, so many thinks occupying my worries these days - i can confirm it works as described, and now i have a fancy USB AMD ML installer. :D

 

Best regards!

Share this post


Link to post
Share on other sites

I'd like to quickly mention a few more things about this software:

 

The mlusbcreater Python script, as well as the bless and ozlogd bash scripts, are open source under the Apache License, Version 2. See http://www.apache.or...ICENSE-2.0.html for the full license.

 

Secondly, I want to highlight some of the possible ways to use this. You can easily build a kit for a specific hardware configuration by simply copying the kexts to kit/Extensions/, then run the script, or zip it back up and share with others. Or you could go even further and use it as the backend to your own application.

 

I wish I could edit the topic title, I would make it less rhetorcal and a bit more descriptive :) Figured out how to do that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Slice
      As I see many novices in the forum ask "How to make my Radeon working? I have bad resolution, no QE/CI...." and so on. They come to the section and have no find an answer here because all Radeons are different and they don't know where else they read about this.
      I want to explain all steps needed for launching the Radeon family of videocards.
       
      Bootloader.
      I will speak about Clover because I maintain this bootloader to know recent hardware and modern OSX. Not sure if you will have the same result with other bootloaders. I am carefully checking the injecting of ATI card and correcting it times to times. I am also accessible for bug reports.
       
      OSX version.
      Older card require older system, newer cards require new system.
      ATIRadeon9000 is possible to launch under Tiger.
      ATIRadeonMobilityX1400 requires 10.5-10.6. See RadeonHD topic.
      As I see RadeonHD3xxx was successful only in 10.5
      For new AMDRadeonHD7xxx there must be 10.8.3+ system.
       
      DeviceID.
      This must be the first question before asking about the card.
      You may know the device-id from Windows->DeviceManger->VideoCard.properties->compatibleIDs
      You may boot into system in safe mode (key -x) and see system profiler
       
      And you may boot into Clover GUI, press F2 and get preboot.log. Find here something like
      2:709 0:000 PCI (00|01:00.00) : 1002 6758 class=030000 2:709 0:000 Found Radeon model=AMD Radeon HD 6670 Series It means my DeviceID=6758 (these are hex numbers)
      Then you must check that Apple's drivers support your DeviceID. If not then add it!
      For example HD7850 has DeviceID=6819. If we look into ATI7000Controller (AMD7000... in new systems) we find 6818 here but no 6819!
       
       
      I show you how to do this with terminal commands. Launch /Application/Utilities/Terminal.app. Type in opened window:
       
      cp /System/Library/Extensions/ATI7000Controller.kext/Contents/Info.plist ~/Desktop So you get a copy of the Info.plist on Desktop. Edit it with TextEdit. Change 68181002 -> 68191002.
      Don't edit this file directly in the system folder! 
      Then copy back by terminal. Don't use finder to copy kexts! They will have wrong permissions in this case.
      sudo cp ~/Desktop/Info.plist /System/Library/Extensions/ATI7000Controller.kext/Contents/ sudo rm -r -v /System/Library/Caches/com.apple.kext.caches/* Second command make sure next reboot the kext will use your edited info.plist.
      The same operation you must do with a kext AMDRadeonAccelerator or ATIRadeonX2000 or other one. Check all candidates if they contain such list of possible IDs and choose closest to you.
       
      FakeID
      Since Clover revision 1971+ you may just inject new DeviceID into DSDT instead of correcting kexts. See instruction here.
       
      GraphicsEnabler or Injector
      OSX needs to know some properties (Model name, Family, etc...) that must be somehow injected at boot time. Yes, also real Macs got DeviceProperties string from firmware.
      Alternatives:
      1. Set InjectATI=Yes in Clover (same as GE=y in Chameleon).
      2. Use custom string made with gfxutil. For whom who knows.
      3. Write _DSM into DSDT. You should know what to write.
      4. Use some kext like ATY_init.kext or Natit.kext. If you are sure that the kext is for your card namely.
      I want to say that all this methods make the same thing. Differencies in their tuning.
      The Clover do this automatically for most known cards at this moment.
       
      Connectors.
      As you may see to start HD5000-7000 some strange names used: Pithecia, Orangutan, Elodea... What are they?
      They are configs for framebuffer. Predefined configs how connectors are solded for cards used in real Macs. Strange but these configs rear coincide with PC card. Usually gurus make advice "choose a framebuffer that most appropriate for your card". The chances 1:10. In most cases you may find a FB name that gives you main monitor working. Or nothing at all.
      Great respect to bcc9 who gives us a method to correct one of config to be exactly for you. See here.
      My retelling for Clover is here
      Success example in the thread in posts 44-52
       
      Radeon Mobility
      I tested Clover's methods with two users having Mobility Radeon HD5470 and HD5650M. We found that full memory and QE/CI will be achieved if we set in Clover's config
      LoadVBios=Yes
      even thou no file with bios is provided. This is the key to make Radeon Mobility working!
      Other problem is bad gradients or artifacts. For this case Clover accept the key
      InjectEDID=Yes
      and sometimes you also need to inject CustomEDID.
      See Clover instructions for details.
       
      And my results.
      Gigabyte Radeon HD6670
      <key>Graphics</key> <dict> <key>GraphicsInjector</key> <true/> <key>InjectEDID</key> <true/> <key>FBName</key> <string>Ipomoea</string> <key>LoadVBios</key> <false/> <key>VideoPorts</key> <integer>3</integer> <key>PatchVBios</key> <true/> </dict> <key>KernelAndKextPatches</key> <dict> <key>KernelCpu</key> <false/> <key>ATIConnectorsController</key> <string>6000</string> <key>ATIConnectorsData</key> <string>000400000403000000010000120401050008000004020000000100001102040310000000100000000001000000000002</string> <key>ATIConnectorsPatch</key> <string>040000000403000000010000100001061000000010000000000100000000000100080000040200000001000012040403</string> VTX Radeon HD5570
      <key>Graphics</key> <dict> <key>PatchVBios</key> <false/> <key>FBName</key> <string>Baboon</string> <key>VideoPorts</key> <string>3</string> <key>GraphicsInjector</key> <string>Yes</string> <key>LoadVBios</key> <string>No</string> </dict> <key>KernelAndKextPatches</key> <dict> <key>Debug</key> <false/> <key>KernelCpu</key> <false/> <key>ATIConnectorsController</key> <string>5000</string> <key>ATIConnectorsData</key> <string>040000001400000000010000010201030008000000020000007100002205020110000000100000000001000000100002</string> <key>AppleRTC</key> <true/> <key>ATIConnectorsPatch</key> <string>040000001400000000010000010001040008000000020000007100002200020510000000100000000001000000000002</string> <key>AsusAICPUPM</key> <false/> <key>KextsToPatch</key> <array> <dict> <key>Name</key> <string>AppleAHCIPort</string> <key>Find</key> <data>RXh0ZXJuYWw=</data> <key>Replace</key> <data>SW50ZXJuYWw=</data> </dict> </array> </dict> See PatchVBios=No
      for this card "yes" leads to black screen. Use with precautions.
       
      A sample for Radeon R7 240
       
      UPDATE for ElCapitan.
      It seems has more problems. My HD6670 is not working in ElCapitan OOB unlike Mavericks.
      I had to set FakeID=0x67401002 as correspond to real iMac12,2 and set this model in SMBIOS section.
      It related to GraphicsPM or GraphicsControl.
      Look these kexts to decide what you can do for your configuration.
       
      HighSierra requires change these kexts by version from Sierra 10.12.6
      for Radeon HD6xxx
      AMDRadeonX3000.kext AMDRadeonX3000GLDriver.bundle IOAccelerator2D.plugin IOAcceleratorFamily2.kext .  for Radeon HD7xxx and up AMDRadeonX4000.kext AMDRadeonX4000GLDriver.bundle IOAccelerator2D.plugin IOAcceleratorFamily2.kext .    Black screen after wake problem resolved by follow method radeon_bios_decode.0.2.zip
      ati-personality.pl.0.15.zip
      ati-personality.pl.0.15a.zip
    • By chummdoggin
      A setup with an IVY bridge e5430 dell worked fine. but now seems the XHC device
      is a hardware issue. There is no bios setting to enable disable. Only enable/disable boot/external.USB in general.
      All set to enable. Also just mention of USB in power settings wake on USB.
       
      Did show up when I set up the ports w/USBINJECTALL, then was working on imessage isssue when the DSDT
      stopped loading after updating clover. I had two versions of MAcIasl. One with iasl 6. and one had 6.2a. Kept
      the 6.2a, was RM's most recent. One problem Im confused by is it compiles fine but after saved if its opened,
      the error that was repaired comes back.
       
      This part:
       
                      If (LEqual (PM6H, One))
                      {
                          CreateBitField (BUF0, \_SB.PCI0._Y0C._RW, ECRW)  // _RW_: Read-Write Status
                          Store (Zero, ECRW (If (PM0H)
                                  {
                                      CreateDWordField (BUF0, \_SB.PCI0._Y0D._LEN, F0LN)  // _LEN: Length
                                      Store (Zero, F0LN)
                                  }))
                      }
       
      Loads with the error but not sure what happened on the original that worked.
       
      Any Idea?
       
      Going over the boot log, The XHC device is there under the PCI readings dont think hardware issue... 1e31 Just seems the saved DSDT should not
      have errors after saved, but using the other version of Maciasl, the DSDT would save without errors and open without but it would not load.
      acted like there was no FakeSMC... 
       
      Edit: Seems all the saved DSDT have that error when re-opened using that version  RM's Maciasl w/iasl v.6.2a but seems to load fine.

       
      debug_8785.zip
    • By susteve
      Hello, I am new here, so I apologize if I've chosen the wrong subforum for this question. 
       
      I am scratching my head a bit on an issue with a clients MacBook pro.  He was having USB connection issues and claimed the laptop wasn't detecting any USB connected to it. 
       
      Figuring it was a failed USB port, I took it in but ended up just feeling more confused after doing some diagnostics. 
       
      It came in loaded with Catalina, a recent upgrade spurned the beginning of the issues the client told me. 
       
      I decided to revert it back to the default OS in the base recovery image, which is Yosemite. 
       
      Upon finishing the install, I found that the USB port was in fact working again. Figuring I had resolved the issue, I updated it back to Catalina just to be met with the same issue upon reinstalling. 
       
      SMH 
       
      Tried nvram, pram, and smc reset each to no avail.  
       
      One thing to note is that during boot, the USB is getting power as it lights up when connected during boot up. 
       
      But the ports are dead as soon as it boots into the operating system. 
       
      I have a strong feeling that this is a driver issue. I tried unloading and reloading the USB IO kext, with no noticable change. 
       
      Is anyone here familiar with this issue? Would there be any other kext related troubleshooting i can perform ? Is it possible to revert to the kext used in Yosemite on catalina ?
       
      One last thing to note, on Yosemite the USB was functioning 100%. But I did get a strange notification that the USB ports were using power even when there wasn't any connected to it. Either way, I find it very very odd that it works perfectly in Yosemite. 
       
      Thanks in advance
       
      Steve 
    • By jdorz
      Hello all,

      I have successfully gotten my Hackintosh working 99 percent. The remaining issue that I am running into is that my system will randomly kernel panic upon a user issued shutdown or reboot WHEN I have either a usb sound card or usb headset plugged into any of my USB ports (both 2.0 and 3.0). If I remove the headset, it will power down with no issues. Does anyone have any suggestions?

      My system is as follows:
      MacOS 10.14 Mojave
      Gigabyte H370 HD3
      8400 i5 Coffee Lake
      Radeon RX 580 sound card

      Fixed
       
      Solution
       
      Use this folder for serie 100/200/300
      https://olarila.com/forum/viewtopic.php?f=28&t=8222
       
      reboot and extract one send_me for full dsdt patch by MaLd0n
      --Run_Me
      RunMe.app
       
       
       
    • By WeBeRiO
      Hi all! I have a Asus h110s1 with a i5-7400 working.

      Only no wake up from sleep, screen black and reboot.

      Is posible fix this problem? No is the model UHD.

      Thank U.-
×