Jump to content

ErmaC

ErmaC

Member Since 27 Jan 2009
Offline Last Active Private
*****

Topics I've Started

Boot from vanilla Recovery HD, Installation DMG

30 October 2014 - 10:36 PM

I open this new topic to discuss/test (and hopefully improve) the proposed changes made by the user N3 on http://forge.voodooprojects.org

Allows zero-config upgrade or reinstall, with app store downloaded installer app, or fresh install, with installer app or official bootable install media, and create bootable Recovery HD during installation. Patch worked on 10.7->10.8, 10.8->10.9 upgrade, reinstall or fresh install.
Updated for Yosemite.
Tested with 10.9->10.10 upgrade, 10.10 reinstall, and fresh install to external disk from existing 10.10.
(Might still require FileNVRAM)

 
So this code and work is not mine (ErmaC), also I not test it right now.
I recentrly merge on the main trunk project the base icons for the recovery disk made long time ago by blackosx (Many thanks! Finally we can use it!)
 
So let's start with the proposed patch:
 
boot.c
--- trunk/i386/boot2/boot.c    2014-10-30 15:01:44.000000000 +0000
+++ trunk_mod/i386/boot2/boot.c    2014-10-30 22:02:41.000000000 +0000
@@ -318,22 +318,28 @@ long LoadKernelCache(const char* cacheFi
     // If boot from a boot helper partition check the kernel cache file on it
     if (gBootVolume->flags & kBVFlagBooter)
     {
-        snprintf(kernelCachePath, sizeof(kernelCachePath), "com.apple.boot.P%s", kernelCacheFile);
+        snprintf(kernelCachePath, sizeof(kernelCachePath), "/com.apple.boot.P/%s", kernelCacheFile);
         ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
 
         if ((ret == -1) || ((flags & kFileTypeMask) != kFileTypeFlat))
         {
-            snprintf(kernelCachePath, sizeof(kernelCachePath), "com.apple.boot.R%s", kernelCacheFile);
+            snprintf(kernelCachePath, sizeof(kernelCachePath), "/com.apple.boot.R/%s", kernelCacheFile);
             ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
 
             if ((ret == -1) || ((flags & kFileTypeMask) != kFileTypeFlat))
             {
-                snprintf(kernelCachePath, sizeof(kernelCachePath), "com.apple.boot.S%s", kernelCacheFile);
+                snprintf(kernelCachePath, sizeof(kernelCachePath), "/com.apple.boot.S/%s", kernelCacheFile);
                 ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
 
-                if ((flags & kFileTypeMask) != kFileTypeFlat)
+                if ((ret == -1) || ((flags & kFileTypeMask) != kFileTypeFlat))
                 {
-                    ret = -1;
+                    snprintf(kernelCachePath, sizeof(kernelCachePath), "/com.apple.recovery.boot/kernelcache", kernelCacheFile);
+                    ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
+
+                    if ((flags & kFileTypeMask) != kFileTypeFlat)
+                    {
+                        ret = -1;
+                    }
                 }
             }
         }
 
gui.c
--- trunk/i386/boot2/gui.c    2014-10-30 16:41:03.000000000 +0000
+++ trunk_mod/i386/boot2/gui.c    2014-10-30 22:07:31.000000000 +0000
@@ -988,16 +988,14 @@ void drawDeviceIcon(BVRef device, pixmap
         {
             case kPartitionTypeHFS:
             {
-
                 // ErmaC : TODO test needed for recovery icon
-
                 // Use HFSRECOVERY icon.
-//                if (device->flags & kBVFlagBooter)
-//                {
-//                    devicetype = iDeviceHFSRECOVERY;
-//                }
-//                else
-//                {
+                if (device->flags & kBVFlagBooter)
+                {
+                    devicetype = iDeviceHFSRECOVERY;
+                }
+                else
+                {
 
                     // Use HFS or HFSRAID icon depending on bvr flags. Fallbacks are handled by alt_image above.
                     switch (device->OSVersion[3]) {
@@ -1032,7 +1030,7 @@ void drawDeviceIcon(BVRef device, pixmap
                             devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID : iDeviceHFS);
                             break;
                     }
-//                }
+                }
 
                 break;
 
disk.c
--- trunk/i386/libsaio/disk.c    2014-10-30 15:07:54.000000000 +0000
+++ trunk_mod/i386/libsaio/disk.c    2014-10-30 22:03:26.000000000 +0000
@@ -1575,21 +1575,43 @@ static bool getOSVersion(BVRef bvr, char
     config_file_t systemVersion;
     char  dirSpec[512];
 
-    sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/SystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
+    sprintf(dirSpec, "hd(%d,%d)/com.apple.recovery.boot/SystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
 
     if (!loadConfigFile(dirSpec, &systemVersion))
     {
+        bvr->OSisInstaller = true;
         valid = true;
     }
-    else
+
+    if (!valid)
     {
-        sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/ServerVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
+        sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/SystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
 
         if (!loadConfigFile(dirSpec, &systemVersion))
         {
-            bvr->OSisServer = true;
+            bvr->OSisInstaller = true;
             valid = true;
         }
+        else
+        {
+            sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/ServerVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
+
+            if (!loadConfigFile(dirSpec, &systemVersion))
+            {
+                bvr->OSisServer = true;
+                valid = true;
+            }
+/*            else
+            {
+                sprintf(dirSpec, "hd(%d,%d)/.IAProductInfo", BIOS_DEV_UNIT(bvr), bvr->part_no);
+
+                if (!loadConfigFile(dirSpec, &systemVersion))
+                {
+
+                }
+            }
+*/
+        }
     }
 
     if (valid)
@@ -1633,7 +1655,19 @@ static bool getOSVersion(BVRef bvr, char
         }
         else
         {
-            close(fh);
+            sprintf(dirSpec, "hd(%d,%d)/.IAPhysicalMedia", BIOS_DEV_UNIT(bvr), bvr->part_no);
+            fh = open(dirSpec, 0);
+
+            if (fh >= 0)
+            {
+                valid = true;
+                bvr->OSisInstaller = true;
+                strcpy(bvr->OSVersion, "10.9"); // 10.9 +
+            }
+            else
+            {
+                close(fh);
+            }
         }
     }
     return valid;
 
stringTable.c
--- trunk/i386/libsaio/stringTable.c    2014-10-30 15:12:08.000000000 +0000
+++ trunk_mod/i386/libsaio/stringTable.c    2014-10-30 22:04:06.000000000 +0000
@@ -614,8 +614,11 @@ int loadConfigFile (const char *configFi
 int loadSystemConfig(config_file_t *config)
 {
     char *dirspec[] = {
+        "/Mac OS X Install Data/com.apple.Boot.plist",
         "/OS X Install Data/com.apple.Boot.plist",
+        "/.IABootFiles/com.apple.Boot.plist", // OS X Installer
         "/Library/Preferences/SystemConfiguration/com.apple.Boot.plist",
+        "/com.apple.recovery.boot/com.apple.Boot.plist" // OS X Recovery
     };
 
     int i, fd, count, ret=-1;
 
Here the diff file to apply on the current trunk(2456) --> recovery.diff Attached File  recovery.txt   5.15KB   8 downloads (I edit the file extension due to server restriction)

Here the precompiled binaries with the changes included.
Please don't upload it on other servers and don't repack it, thank you.
Attached File  i386_v2456_Recovery_v1.zip   1.19MB   11 downloads
Please don't upload it on other servers and don't repack it, thank you.
 
Credits to N3
 
Cordially
ErmaC

KernelPatcher Source Code

04 July 2014 - 08:13 AM

Hello Everyone,
 
For those of you interested in taking a look at the KernelPatcher module, source code for an upcoming version of the module has been opened into public xZenue svn repository here: http://public.xzenue...e=KernelPatcher
 
If you have any bugs or patches that you'd like to make, we can handle it here and then send to https://public.xzenue.com/bugzilla/
 
Do note that the source code has the same license as the previous KernelPatcher module releases: KernelPatcher is licensed under the Attribution-NonCommercial 3.0 Unported license. A copy of the license file is included in the svn repository.
 
We'd also like to request that forks are not made of the KernelPatcher module, instead, we'd like to integrate any good and useful changes into the official release.

 

 

 

Here the source code. I just adapt it to compile fine with latest Chameleon from the voodoo SVN.

Attached File  KernelPatcher.zip   34.84KB   31 downloads

download it and move the KernelPatcher folder into the trunk/i386/modules/KernelPatcher (remove the existing one)

 

And here the compiled version of that module.

Attached File  KernelPatcher.dylib.zip   11.7KB   29 downloads

 

 

 

 

I hope we can improve that module!

 

Cordially

 

ErmaC

10.10 in arrivo

02 June 2014 - 08:59 PM

Amatissimo staff Italiano.Come ben sapete è in arrivo Yosemite....

 

Ho una mezza idea di creare le rispettive sub sezioni nel foro Italiano...

 

Cosa ne pensate? troppo presto?

Da notare che tali sezioni sono già presenti nella sezione internazionale...

 

A voi l'ardua sentenza.

 

Fabio

© 2015 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy