Skip to content

Commit c749cca

Browse files
davide125marcan
authored andcommitted
Add asahi-fwextract script
Signed-off-by: Davide Cavalca <[email protected]>
1 parent c6dce3d commit c749cca

2 files changed

Lines changed: 49 additions & 1 deletion

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PREFIX=/usr/local
22
CONFIG_DIR=/etc/default
33
BIN_DIR=$(PREFIX)/bin
4-
SCRIPTS=update-m1n1
4+
SCRIPTS=asahi-fwextract update-m1n1
55
ARCH_SCRIPTS=update-grub first-boot
66
UNITS=first-boot.service
77
MULTI_USER_WANTS=first-boot.service

asahi-fwextract

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/sh
2+
# SPDX-License-Identifier: MIT
3+
4+
set -eu
5+
6+
[ -e /etc/default/asahi-fwextract ] && . /etc/default/asahi-fwextract
7+
8+
: "${ASAHIFW:=}"
9+
: "${VENDORFW:=}"
10+
: "${VENDORFWTMP:=/run/.vendorfw-tmp}"
11+
: "${PYTHON:=python3}"
12+
13+
if [ -e "$(dirname "$0")"/functions.sh ]; then
14+
. "$(dirname "$0")"/functions.sh
15+
else
16+
. /usr/share/asahi-scripts/functions.sh
17+
fi
18+
19+
umount=false
20+
21+
if [ -z "$ASAHIFW" ] && [ -z "$VENDORFW" ]; then
22+
mount_sys_esp /run/.system-efi
23+
ASAHIFW="/run/.system-efi/asahi/"
24+
VENDORFW="/run/.system-efi/vendorfw/"
25+
umount=true
26+
fi
27+
28+
if [ ! -e "${ASAHIFW}/all_firmware.tar.gz" ]; then
29+
echo "No firmware tarball found, skipping extraction"
30+
exit 0
31+
fi
32+
33+
if [ ! -d "$VENDORFW" ]; then
34+
mkdir -p "$VENDORFW"
35+
fi
36+
37+
if [ ! -d "$VENDORFWTMP" ]; then
38+
mkdir -p "$VENDORFWTMP"
39+
fi
40+
41+
echo "Upgrading vendor firmware package"
42+
"$PYTHON" -m asahi_firmware.update "$ASAHIFW" "$VENDORFWTMP"
43+
mv -f "${VENDORFWTMP}/*" "$VENDORFW"
44+
rmdir "$VENDORFWTMP"
45+
echo "Firmware upgraded"
46+
47+
$umount && umount /run/.system-efi
48+
true

0 commit comments

Comments
 (0)