firmware-oneplus-oneplus3: Use pil-squasher to combine segments (MR 2339)

Combine firmware segments using pil-squasher, then install them in the
paths specified in the device trees of oneplus3/3t.
This commit is contained in:
Yassine Oudjana 2021-07-08 20:47:33 +04:00 committed by Clayton Craft
parent 72800777f6
commit e62a879fd2
No known key found for this signature in database
GPG key ID: 7A3461CA187CEA54
2 changed files with 35 additions and 23 deletions

View file

@ -1,4 +1,3 @@
/lib/firmware/qcom/a530_pfp.fw
/lib/firmware/qcom/a530_pm4.fw
/lib/firmware/qcom/a530v3_gpmu.fw2
/lib/firmware/qcom/a530_zap.mdt

View file

@ -1,11 +1,11 @@
pkgname=firmware-oneplus-oneplus3
pkgver=1
pkgver=2
pkgrel=1
pkgdesc="Firmware for OnePlus 3/3T (metapackage)"
url="https://gitlab.com/DrGitX/firmware-oneplus3"
arch="aarch64"
license="proprietary"
depends="mtools"
makedepends="mtools pil-squasher"
options="!check !strip !archcheck"
subpackages="$pkgname-op3 $pkgname-op3t"
_gpufw="https://github.com/TheMuppets/proprietary_vendor_oneplus/raw/lineage-17.1/oneplus3/proprietary/vendor/firmware"
@ -66,49 +66,63 @@ _files="adsp.b00
"
source="modem_op3.bin::$url/-/raw/master/oneplus3/NON-HLOS.bin
modem_op3t.bin::$url/-/raw/master/oneplus3t/NON-HLOS.bin
$_gpufw/a530_pfp.fw
$_gpufw/a530_pm4.fw
$_gpufw/a530v3_gpmu.fw2
$_gpufw/a530_zap.elf
$_gpufw/a530_zap-pro.elf
20-adreno-gpu-firmware.files
"
_mdtnames="adsp modem slpi venus"
_mbns="a530_zap.mbn adsp.mbn mba.mbn modem.mbn slpi.mbn venus.mbn"
unpack() {
mkdir -p $srcdir/oneplus3 $srcdir/oneplus3t
# Extract oneplus3 blobs
for _i in $_files; do
mcopy -v -b -p -n -i $srcdir/modem_op3.bin ::image/$_i $srcdir/oneplus3/$_i
done
# Extract oneplus3t blobs
for _i in $_files; do
mcopy -v -b -p -n -i $srcdir/modem_op3t.bin ::image/$_i $srcdir/oneplus3t/$_i
done
}
package() {
cd "$srcdir"
for _i in a530_pfp.fw a530_pm4.fw a530v3_gpmu.fw2; do
install -Dm644 $_i "$pkgdir/lib/firmware/postmarketos/qcom/$_i"
cd "$srcdir/oneplus3"
# Squash oneplus3 firmware segments into mbns
for _i in $_mdtnames; do
pil-squasher "$_i.mbn" "$_i.mdt"
done
cd "$srcdir/oneplus3t"
# Squash oneplus3t firmware segments into mbns
for _i in $_mdtnames; do
pil-squasher "$_i.mbn" "$_i.mdt"
done
}
_install_fw() {
mkdir -p "$subpkgdir/lib/firmware/postmarketos/qcom"
cd "$srcdir"
# Move zap shader to the same directory as the other mbns
mv "a530_zap$2.elf" "$srcdir/$1/a530_zap.mbn"
cd "$srcdir/$1"
for _i in adsp.* modem.* mba.* slpi.*; do
install -Dm644 $_i "$subpkgdir/lib/firmware/postmarketos/$_i"
# Install mbns
for _i in $_mbns; do
install -Dm644 $_i "$subpkgdir/lib/firmware/qcom/msm8996/$1/$_i"
done
for _i in venus.*; do
install -Dm644 $_i "$subpkgdir/lib/firmware/postmarketos/qcom/venus-4.2/$_i"
done
# Append zap shader path to 20-adreno-gpu-firmware.files
cp "$srcdir/20-adreno-gpu-firmware.files" "$srcdir/20-adreno-gpu-firmware.files-$1"
echo "/lib/firmware/qcom/msm8996/$1/a530_zap.mbn" >> "$srcdir/20-adreno-gpu-firmware.files-$1"
install -Dm644 "$srcdir/a530_zap$2.elf" "$subpkgdir/lib/firmware/postmarketos/qcom/a530_zap.mdt"
install -Dm644 "$srcdir/20-adreno-gpu-firmware.files" \
# Install 20-adreno-gpu-firmware.files
install -Dm644 "$srcdir/20-adreno-gpu-firmware.files-$1" \
"$pkgdir/etc/postmarketos-mkinitfs/files/20-adreno-gpu-firmware.files"
}
@ -126,11 +140,10 @@ op3t() {
_install_fw oneplus3t -pro
}
sha512sums="c0f3f908e237202003d9b2fe4071e2800bdcdae180e8311fbc0671478fcd63aba5a3fe5ab5d297010c12c232501f05f31141fc39a44c5b86ac2b56016f553a7f modem_op3.bin
sha512sums="
c0f3f908e237202003d9b2fe4071e2800bdcdae180e8311fbc0671478fcd63aba5a3fe5ab5d297010c12c232501f05f31141fc39a44c5b86ac2b56016f553a7f modem_op3.bin
3da90f51fc39c3db4f0f39c07eda318b0b1fc85f7fbb8f21bd31a3ae5c73a4b39ba630a9521a7c5ee844e14c24d084f5d42e4c2ffd2bdee541e50ec7b1629b14 modem_op3t.bin
6b3ec037646c5738854137003c35ea0ea4e116f0c8b2483b312400de67609b9525ade5e7d5ce6d06e94b348dec0444165a24cdb21a45d703f55c5e657656e7cd a530_pfp.fw
a9439c0f05a96f28a092f86fd08ff63dd637a43ff764f1eb1b133e78c6876464572b3cf1b90860165dca125c35c359df937fc4318246374269f69bd00c09eb9f a530_pm4.fw
140a288889c49f2e9222f8c1679e394786f7638a0dc8e350d28e0b630ad7ccb9abd1f79a8990208144285eaf95e4bec21be5af0f6e1d07a3624de1010cd89392 a530v3_gpmu.fw2
374ed1606a8c12bd8fb8adb3e0d91603aa53ff9aed175921c9e6b579104407b01274e5f3cf158007b83ecb5aa2c7343c526e360aebc8bca557cd4b9c4c711f98 a530_zap.elf
237c82252f1ff44a454bed5f84a8dcf74e0f6ea6e5674e7d5aa32436fcf20d8c9df5c6edc4b4bc151e5fdce4694c1d14edc8ba0804ceb738f3fb67eff950aeff a530_zap-pro.elf
c7a4e408b29ac245bb6f19e2e5c0b0798ab8e745a79cfb21c85fde1b035dfc969a755fdecba34b32d54b6fca6d3eed0cd14d6f68f10e2235bcbebb476d96d4cd 20-adreno-gpu-firmware.files"
e41812751afa4c05829e40033e8355232f9f775633594f42b82a40156d3c518e53ab4b5086e421576b6f9de17f4cb540a6f85f2da69a66d445b43e0d8f2d4ce7 20-adreno-gpu-firmware.files
"