Skip to content

Commit 1009a19

Browse files
jannaumarcan
authored andcommitted
Add support for macOS 12.1
macOS 12.1's kmutil parses the custom boot object Mach-O and rejects m1n1.macho. It added support for raw boot objects so use that instead on MacOS 12.1 and later. m1n1.macho for macOS 11.x can still be installed with an old kmutil from the installation recovery image. Signed-off-by: Janne Grunau <[email protected]>
1 parent 98cce11 commit 1009a19

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ echo "Copying files..."
3838

3939
cp -r "$SRC"/* "$PACKAGE/"
4040
cp "$ARTWORK/logos/icns/AsahiLinux_logomark.icns" "$PACKAGE/logo.icns"
41-
cp "$M1N1/build/m1n1.macho" "$PACKAGE"
41+
cp "$M1N1/build/m1n1.macho" "$M1N1/build/m1n1.bin" "$PACKAGE"
4242

4343
echo "Extracting Python framework..."
4444

src/step2.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ echo
2525
read
2626

2727
bputil -nc -v "$VGID"
28-
kmutil configure-boot -c m1n1.macho -v "$system_dir"
28+
29+
if [ -f m1n1.macho ]; then
30+
kmutil configure-boot -c m1n1.macho -v "$system_dir"
31+
else
32+
kmutil configure-boot -c m1n1.bin --raw --entry-point 2048 --lowest-virtual-address 0 -v "$system_dir"
33+
fi
2934

3035
echo
3136
echo "Installation complete! Press enter to reboot."

src/stub.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# SPDX-License-Identifier: MIT
22
import os, plistlib, shutil, sys, stat, subprocess, urlcache, zipfile
33
import osenum
4+
from util import split_ver
45

56
class Installer:
67
def __init__(self, sysinfo, dutil, osinfo, ipsw_info):
78
self.dutil = dutil
89
self.sysinfo = sysinfo
910
self.osinfo = osinfo
11+
self.install_version = ipsw_info.version.split(maxsplit=1)[0]
1012
self.verbose = "-v" in sys.argv
1113

1214
print("Downloading OS package info...")
@@ -182,7 +184,10 @@ def install_files(self, cur_os):
182184
except:
183185
print("Failed to apply extended attributes, logo will not work.")
184186

185-
shutil.copy("m1n1.macho", os.path.join(self.osi.system))
187+
if split_ver(self.install_version) < (12, 1):
188+
shutil.copy("m1n1.macho", os.path.join(self.osi.system))
189+
else:
190+
shutil.copy("m1n1.bin", os.path.join(self.osi.system))
186191
step2_sh = open("step2.sh").read().replace("##VGID##", self.osi.vgid)
187192
step2_sh_dst = os.path.join(self.osi.system, "step2.sh")
188193
with open(step2_sh_dst, "w") as fd:

0 commit comments

Comments
 (0)