-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dkwo
committed
Dec 1, 2022
1 parent
f3f3403
commit 0ae5e7b
Showing
4 changed files
with
67 additions
and
11 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/sh | ||
# | ||
# Kernel hook for m1n1, | ||
# taken from update-m1n1 and efibootmgr. | ||
# | ||
# Arguments passed to this script: $1 pkgname, $2 version. | ||
|
||
set -e | ||
|
||
PKGNAME="$1" | ||
VERSION="$2" | ||
|
||
. "${ROOTDIR}/etc/default/m1n1-kernel-hook" | ||
|
||
m1n1config=/run/m1n1.conf | ||
>"$m1n1config" | ||
|
||
if [ -e "$CONFIG" ]; then | ||
echo "Reading m1n1 config from $CONFIG:" | ||
while read line; do | ||
case "$line" in | ||
"") ;; | ||
\#*) ;; | ||
chosen.*=*|display=*) | ||
echo "$line" >> "$m1n1config" | ||
echo "Option: $line" | ||
;; | ||
*) | ||
echo "Ignoring unknown option: $line" | ||
;; | ||
esac | ||
done <$CONFIG | ||
fi | ||
|
||
if [ "$PAYLOAD" -eq 1 ]; then | ||
cat "${M1N1}" $m1n1config >"${TARGET}.new" | ||
cat ${DTBS} >>"${TARGET}.new" | ||
gzip -c "${BOOT}/initramfs-${VERSION}.img" >>"${TARGET}.new" | ||
gzip -c "${BOOT}/vmlinux-${VERSION}" >>"${TARGET}.new" | ||
echo "Payload: m1n1 config dtbs initram kernel" | ||
fi | ||
if [ "$PAYLOAD" -eq 2 ]; then | ||
cat "${M1N1}" ${DTBS} >"${TARGET}.new" | ||
gzip -c "${U_BOOT}" >>"${TARGET}.new" | ||
cat $m1n1config >>"${TARGET}.new" | ||
echo "Payload: m1n1 dtbs uboot config" | ||
fi | ||
|
||
[ -e "$TARGET" ] && mv -f "$TARGET" "${TARGET}.old" | ||
mv -f "${TARGET}.new" "$TARGET" | ||
|
||
echo "m1n1 updated at ${TARGET}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# can be either 1=kernel or 2=uboot | ||
PAYLOAD=1 | ||
U_BOOT=/usr/lib/asahi-boot/u-boot-nodtb.bin | ||
M1N1=/usr/lib/asahi-boot/m1n1.bin | ||
# the location where m1n1 payload is put | ||
TARGET=/boot/m1n1/boot.bin | ||
DTBS=/boot/dtbs/"dtbs-${VERSION}"/apple/*.dtb | ||
CONFIG=/etc/m1n1.conf | ||
# the location where kernel and initramfs are located | ||
BOOT=/boot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters