#3 Add asahi-fwextract subpackage
Merged 2 years ago by dcavalca. Opened 2 years ago by dcavalca.
rpms/ dcavalca/asahi-scripts fwextract  into  rawhide

file added
+23
@@ -0,0 +1,23 @@ 

+ From c7a0c4596c301953e721cda1099f862b601a7730 Mon Sep 17 00:00:00 2001

+ From: Davide Cavalca <dcavalca@fedoraproject.org>

+ Date: Mon, 19 Sep 2022 10:07:50 +0200

+ Subject: [PATCH] update-vendor-firmware: explicitly overwrite files

+ 

+ Signed-off-by: Davide Cavalca <dcavalca@fedoraproject.org>

+ ---

+  update-vendor-firmware | 2 +-

+  1 file changed, 1 insertion(+), 1 deletion(-)

+ 

+ diff --git a/update-vendor-firmware b/update-vendor-firmware

+ index 541d947..0631a3c 100755

+ --- a/update-vendor-firmware

+ +++ b/update-vendor-firmware

+ @@ -57,7 +57,7 @@ if [ -e "$TARGET_MANIFEST" ]; then

+  fi

+  

+  echo "Extracting updated vendor firmware..."

+ -tar xf "$VENDORFW/firmware.tar"

+ +tar -x --overwrite -f "$VENDORFW/firmware.tar"

+  

+  if [ -e "$TARGET_MANIFEST" ]; then

+      echo "Cleaning up obsolete firmware..."

file added
+77
@@ -0,0 +1,77 @@ 

+ From 1f654cbeab3050cc37cb9a9390ed6fd8ec2b91bf Mon Sep 17 00:00:00 2001

+ From: Davide Cavalca <dcavalca@fedoraproject.org>

+ Date: Mon, 19 Sep 2022 14:09:57 +0200

+ Subject: [PATCH] Add asahi-fwextract script

+ 

+ Signed-off-by: Davide Cavalca <dcavalca@fedoraproject.org>

+ ---

+  Makefile        |  2 +-

+  asahi-fwextract | 46 ++++++++++++++++++++++++++++++++++++++++++++++

+  2 files changed, 47 insertions(+), 1 deletion(-)

+  create mode 100755 asahi-fwextract

+ 

+ diff --git a/Makefile b/Makefile

+ index 8d2eba0..30c707d 100644

+ --- a/Makefile

+ +++ b/Makefile

+ @@ -1,7 +1,7 @@

+  PREFIX=/usr/local

+  CONFIG_DIR=/etc/default

+  BIN_DIR=$(PREFIX)/bin

+ -SCRIPTS=update-vendor-firmware update-m1n1

+ +SCRIPTS=asahi-fwextract update-vendor-firmware update-m1n1

+  ARCH_SCRIPTS=update-grub first-boot

+  UNITS=first-boot.service

+  MULTI_USER_WANTS=first-boot.service

+ diff --git a/asahi-fwextract b/asahi-fwextract

+ new file mode 100755

+ index 0000000..112f58e

+ --- /dev/null

+ +++ b/asahi-fwextract

+ @@ -0,0 +1,46 @@

+ +#!/bin/sh

+ +# SPDX-License-Identifier: MIT

+ +

+ +set -eu

+ +

+ +[ -e /etc/default/asahi-fwextract ] && . /etc/default/asahi-fwextract

+ +

+ +: "${ASAHIFW:=}"

+ +: "${VENDORFW:=}"

+ +: "${PYTHON:=python3}"

+ +

+ +if [ -e "$(dirname "$0")"/functions.sh ]; then

+ +    . "$(dirname "$0")"/functions.sh

+ +else

+ +    . /usr/share/asahi-scripts/functions.sh

+ +fi

+ +

+ +umount=false

+ +

+ +if [ -z "$ASAHIFW" ] && [ -z "$VENDORFW" ]; then

+ +    mount_sys_esp /run/.system-efi

+ +    ASAHIFW="/run/.system-efi/asahi/"

+ +    VENDORFW="/run/.system-efi/vendorfw/"

+ +    umount=true

+ +fi

+ +

+ +if [ ! -e "${ASAHIFW}/all_firmware.tar.gz" ]; then

+ +    echo "No firmware tarball found, skipping extraction"

+ +    exit 0

+ +fi

+ +

+ +if [ ! -d "$VENDORFW" ]; then

+ +  mkdir -p "$VENDORFW"

+ +fi

+ +

+ +echo "Upgrading vendor firmware package"

+ +"$PYTHON" -m asahi_firmware.update \

+ +    "$ASAHIFW" \

+ +    "${VENDORFW}/firmware.tar.new" \

+ +    "${VENDORFW}/manifest.txt.new"

+ +mv -f "${VENDORFW}/manifest.txt.new" "${VENDORFW}/manifest.txt"

+ +mv -f "${VENDORFW}/firmware.tar.new" "${VENDORFW}/firmware.tar"

+ +echo "Firmware upgraded"

+ +

+ +$umount && umount /run/.system-efi

+ +true

file modified
+4 -4
@@ -84,9 +84,9 @@ 

  -.PHONY: clean install install-arch install-fedora uninstall uninstall-arch uninstall-fedora

  +.PHONY: clean install install-mkinitcpio install-dracut install-arch install-fedora uninstall uninstall-mkinitcpio uninstall-dracut uninstall-arch uninstall-fedora

  

- From 6f4cd713a36fedca166e2896a1f0f81e03ce200b Mon Sep 17 00:00:00 2001

+ From b8458cffb078daaf12af39fa5b20fb1fce1f212c Mon Sep 17 00:00:00 2001

  From: Neal Gompa <ngompa@fedoraproject.org>

- Date: Sun, 18 Sep 2022 11:50:08 -0400

+ Date: Mon, 19 Sep 2022 08:37:13 -0400

  Subject: [PATCH 2/2] dracut: Add firmware loading module

  

  This implements the logic for loading Apple firmware on Asahi systems
@@ -195,7 +195,7 @@ 

  +

  diff --git a/dracut/modules.d/99asahi-firmware/module-setup.sh b/dracut/modules.d/99asahi-firmware/module-setup.sh

  new file mode 100755

- index 0000000..21c8552

+ index 0000000..896082c

  --- /dev/null

  +++ b/dracut/modules.d/99asahi-firmware/module-setup.sh

  @@ -0,0 +1,34 @@
@@ -229,7 +229,7 @@ 

  +    asahiscriptsdir="/usr/share/asahi-scripts"

  +    inst_dir $asahiscriptsdir

  +    $DRACUT_CP -R -L -t "${initdir}/${asahiscriptsdir}" "${dracutsysrootdir}${asahiscriptsdir}"/*

- +    inst_multiple comm modprobe seq sleep update-vendor-firmware

+ +    inst_multiple comm cut dirname modprobe seq sha1sum sleep tar update-vendor-firmware

  +    inst_hook pre-udev 10 "${moddir}/load-asahi-firmware.sh"

  +    inst_hook pre-pivot 90 "${moddir}/install-asahi-firmware.sh"

  +}

file modified
+18 -1
@@ -9,8 +9,12 @@ 

  Source:         update-m1n1.sysconfig

  # PR#8: Various makefile fixes for Fedora

  Patch:          %{url}/pull/8.patch

- # PR#9:  Add dracut module

+ # PR#9: Add dracut module

  Patch:          %{url}/pull/9.patch

+ # PR#10: update-vendor-firmware: explicitly overwrite files

+ Patch:          %{url}/pull/10.patch

+ # PR#11: Add asahi-fwextract script

+ Patch:          %{url}/pull/11.patch

  

  BuildArch:      noarch

  
@@ -26,6 +30,15 @@ 

  This package contains miscellaneous admin scripts for the Asahi Linux reference

  distro.

  

+ %package -n     asahi-fwextract

+ Summary:        Asahi Linux firmware extractor

+ 

+ Requires:       %{name} = %{version}-%{release}

+ Requires:       python3dist(asahi-firmware)

+ 

+ %description -n asahi-fwextract

+ Asahi Linux firmware extractor.

+ 

  %package -n     dracut-asahi

  Summary:        Dracut config for Apple Silicon Macs

  
@@ -85,6 +98,10 @@ 

  %license LICENSE

  %{_datadir}/%{name}/

  

+ %files -n asahi-fwextract

+ %license LICENSE

+ %{_sbindir}/asahi-fwextract

+ 

  %files -n dracut-asahi

  %license LICENSE

  %{_prefix}/lib/dracut/dracut.conf.d/10-asahi.conf

Backport a couple of upstream PRs and add asahi-fwextract

@ngompa I'm getting

Error: 
 Problem: package asahi-fwextract-20220918.2-7.fc38.noarch requires python3dist(asahi-firmware), but none of the providers can be installed
  - conflicting requests
  - nothing provides liblzfse.so.1()(%{__isa_bits}bit) needed by python3-asahi_firmware-0.5pre1-1.fc38.noarch

Did I do something wrong in https://src.fedoraproject.org/rpms/asahi-installer/blob/rawhide/f/asahi-installer.spec ?

Pull-Request has been merged by dcavalca

2 years ago