diff --git a/main/msm-firmware-loader/APKBUILD b/main/msm-firmware-loader/APKBUILD index 59c20a1fc..9c03b343c 100644 --- a/main/msm-firmware-loader/APKBUILD +++ b/main/msm-firmware-loader/APKBUILD @@ -1,6 +1,6 @@ pkgname=msm-firmware-loader -pkgver=1 -pkgrel=2 +pkgver=1.0 +pkgrel=3 pkgdesc="Set of init services to automatically load firmware from device partitions" url="https://postmarketos.org/" subpackages="$pkgname-wcnss" @@ -8,9 +8,8 @@ arch="armhf armv7 aarch64" license="MIT" install="$pkgname.post-install" source=" - msm-firmware-loader.sh + https://gitlab.com/postmarketOS/msm-firmware-loader/-/archive/$pkgver/msm-firmware-loader-$pkgver.tar.gz msm-firmware-loader.initd - msm-firmware-loader-unpack.sh msm-firmware-loader-unpack.initd " options="!check" @@ -26,9 +25,9 @@ package() { # Create mountpoint for the scripts mkdir -p "$pkgdir/lib/firmware/msm-firmware-loader" - install -Dm755 "$srcdir/msm-firmware-loader.sh" \ + install -Dm755 msm-firmware-loader.sh \ "$pkgdir/usr/sbin/msm-firmware-loader.sh" - install -Dm755 "$srcdir/msm-firmware-loader-unpack.sh" \ + install -Dm755 msm-firmware-loader-unpack.sh \ "$pkgdir/usr/sbin/msm-firmware-loader-unpack.sh" } @@ -42,8 +41,7 @@ wcnss() { } sha512sums=" -e311f589c55670974f300f821a49baf54f4966ab5617dbaeef43389be013f1139490b8cfdc7ef4e3c59b6f0013ea1b2c50b37487c6d22104f8dc6d287c158fac msm-firmware-loader.sh +499379fdf61bac862860f4bc2f4be00061e8283a95f197918d8214ed931afe1e1b05e59783710b2fad294f866b0d735f768d52e2bf4f5fc6a02c1495b6eb636b msm-firmware-loader-1.0.tar.gz d9ad3b21564de9a4970a8923b8598fb46a54543ac9f1494676a6833800bc68c64f230737b308fec54aae09c2cf635794e8f1abc46253b0386260b4580587483d msm-firmware-loader.initd -93063f24b64206f4e6115ca0276d47bb65e1c510fc56fe1a939030d09d3b63cf07f001fb789309bb317f787cbe687906258bb5eb961a9ea90568f672378e86ea msm-firmware-loader-unpack.sh 616a28c3a65a45bb65f798989d93daacdeea08a90a9a8538b5bac2d73b2c8b135554ecaf49b4084829f88af760a144802adcd89b50f46bc267d6b04c9c733ff8 msm-firmware-loader-unpack.initd " diff --git a/main/msm-firmware-loader/msm-firmware-loader-unpack.sh b/main/msm-firmware-loader/msm-firmware-loader-unpack.sh deleted file mode 100644 index 641528931..000000000 --- a/main/msm-firmware-loader/msm-firmware-loader-unpack.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: MIT - -# -# Some devices have their modem firmware packaged as .gz blobs. -# Those needs to be unpacked as Kernel can't handle .gz packed -# firmware at this time. -# - -BASEDIR="/lib/firmware/msm-firmware-loader/target" - -for blob in "$BASEDIR"/*.gz -do - if ! [ -e "$blob" ] - then - exit - else - break - fi -done - -UNPACKDIR="$(mktemp -td "unpacked_fw.XXXXXX")" - -for blob in "$BASEDIR"/*.gz -do - blob_name="$(basename "${blob%.gz}")" - gzip -d < "$blob" > "$UNPACKDIR/$blob_name" - rm "$blob" - ln -s "$UNPACKDIR/$blob_name" "$BASEDIR/$blob_name" -done - diff --git a/main/msm-firmware-loader/msm-firmware-loader.sh b/main/msm-firmware-loader/msm-firmware-loader.sh deleted file mode 100644 index c891c8f0e..000000000 --- a/main/msm-firmware-loader/msm-firmware-loader.sh +++ /dev/null @@ -1,131 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: MIT - -# -# This script is responsible for loading firmware blobs from firmware -# partitions on qcom devices. It will make a dir in tmp, mount all of the -# interesting partitions there and then symlink blobs to a single dir that can -# be then provided to the kernel. (At this time only single additional -# directory can be provided) -# -# This script attempts to load everything at runtime and be as generic -# as possible between the target devices: It should allow a single rootfs -# to be used on multiple different devices as long as all the blobs -# are present on dedicated partitions. -# (Usually the case, Samsung devices ship all blobs, other devices may miss -# venus but that still allows for WiFi and modem to work) -# - -# Configurations: - -# List of partitions to be mounted and inspected for blobs. -FW_PARTITIONS=" - apnhlos - modem -" - -# Base dirrectory to be used to unfold the partitions into. -BASEDIR="/lib/firmware/msm-firmware-loader" - -# Preparations: - -# This script is intended to run before udev. This means that writeable fs -# May not be available yet. Since this script only creates symlinks, it -# uses tmpfs to work around the early-run limitations as well as to reduce -# disk wear slightly. -mount -o mode=755,nodev,noexec,nosuid -t tmpfs none "$BASEDIR" - -mkdir "$BASEDIR/mnt" -mkdir "$BASEDIR/target" - -# Scanning and mounting partitions we're interested in: - -# /dev/disk/by-partlabel symlinks don't exist yet, scan sysfs for names instead -for part in /sys/block/mmcblk*/mmcblk*p* -do - DEVNAME="$(grep DEVNAME "$part"/uevent | sed 's/DEVNAME=//g')" - PARTNAME="$(grep PARTNAME "$part"/uevent | sed 's/PARTNAME=//g')" - - if [ -z "${FW_PARTITIONS##*"$PARTNAME"*}" ] && [ -n "$PARTNAME" ] - then - mkdir "$BASEDIR/mnt/$PARTNAME" - mount -o ro,nodev,noexec,nosuid \ - "/dev/$DEVNAME" "$BASEDIR/mnt/$PARTNAME" - fi -done - -# Linking blobs from all partitions: - -# Backup the preselected path, link all of the installed blobs. -# This is needed for devices that require blobs either not present -# on the partitions (e.g. venus on many msm8916 devices) or if -# the device has secure-boot disabled and can run newer blobs. -EXTRA_PATH="$(cat /sys/module/firmware_class/parameters/path)" - -if [ -d "$EXTRA_PATH" ] -then - for blob in "$EXTRA_PATH"/* - do - if ! [ -e "$blob" ]; then break; fi - ln -s "$blob" "$BASEDIR/target/$(basename "$blob")" - done -fi - -# Scan through mounted partitions and symlink all of the blobs. -# This loop ignores blobs with names already present in the -# target to allow preinstalled blobs to override ones in the partitions. -for blob in "$BASEDIR"/mnt/*/image/* -do - BLOBBASE="${blob##*/}" - BLOBBASE="${BLOBBASE%.*}" - - # Skip blob prefix if it's already present. - for prefix in "$BASEDIR/target/$BLOBBASE."* - do - if [ -e "$prefix" ]; then continue 2; fi - done - - for part in "$BASEDIR"/mnt/*/image/"$BLOBBASE"* - do - ln -s "$part" "$BASEDIR/target/$(basename "$part")" - done -done - -# Fixup the directory structure: - -# venus (video encoder/decoder) blobs are expected to be in a subdir. -# Re-link the blobs if the venus firmware wasn't already preinstalled. -# Different platforms expect firmware in different subdirs -# (as in linux-firmware-qcom) so the venus dir is duplicated multiple times -# under possible names for the scritpt to be generic without complex detection. - -if [ -f "$BASEDIR/target/venus.mdt" ] && ! [ -d "$BASEDIR/target/qcom" ] -then - mkdir -p "$BASEDIR/target/qcom/venus-x" - for part in "$BASEDIR"/target/venus.* - do - ln -s "$part" "$BASEDIR/target/qcom/venus-x/$(basename "$part")" - done -fi - -VENUS_DIRS=" - venus-1.8 - venus-4.2 - venus-5.2 - venus-5.4 - vpu-1.0 - vpu-2.0 -" - -for vdir in $VENUS_DIRS -do - if ! [ -d "$BASEDIR/target/qcom/$vdir" ] && [ -f "$BASEDIR/target/venus.mdt" ] - then - ln -s "$BASEDIR/target/qcom/venus-x" \ - "$BASEDIR/target/qcom/$vdir" - fi -done - -# Set the new custom firmware path: -printf "%s" "$BASEDIR/target" > /sys/module/firmware_class/parameters/path -