From ea25bc48d7170b8412ccaddc8f7e2a87843abec0 Mon Sep 17 00:00:00 2001 From: "Sicelo A. Mhlongo" Date: Fri, 19 Apr 2024 19:20:03 +0200 Subject: [PATCH] device-nokia-n900: unconditionally fetch wl1251 nvs on each boot (MR 5050) Reading the wl1251 data on each boot can be useful when using the same SD card on different devices, allowing each to fetch its correct calibration data. Additionally, this opens up the possibility to simplify the packaging (in follow-up commit) --- device/community/device-nokia-n900/APKBUILD | 9 ++------ ...e-nokia-n900-nonfree-firmware.post-install | 3 --- ...device-nokia-n900-nonfree-firmware.trigger | 5 ----- .../device-nokia-n900/n900-wlan-data.initd | 20 ------------------ device/community/wl1251-cal/APKBUILD | 21 ++++++++++++++----- .../{n900-update-wl1251 => calibrate-wl1251} | 4 ++-- .../wl1251-cal/wl1251-cal-openrc.post-install | 3 +++ device/community/wl1251-cal/wl1251-cal.initd | 14 +++++++++++++ .../community/wl1251-cal/wl1251-cal.trigger | 5 +++++ 9 files changed, 42 insertions(+), 42 deletions(-) delete mode 100644 device/community/device-nokia-n900/device-nokia-n900-nonfree-firmware.post-install delete mode 100644 device/community/device-nokia-n900/device-nokia-n900-nonfree-firmware.trigger delete mode 100644 device/community/device-nokia-n900/n900-wlan-data.initd rename device/community/wl1251-cal/{n900-update-wl1251 => calibrate-wl1251} (56%) create mode 100644 device/community/wl1251-cal/wl1251-cal-openrc.post-install create mode 100644 device/community/wl1251-cal/wl1251-cal.initd create mode 100644 device/community/wl1251-cal/wl1251-cal.trigger diff --git a/device/community/device-nokia-n900/APKBUILD b/device/community/device-nokia-n900/APKBUILD index fa715da6b..45e857935 100644 --- a/device/community/device-nokia-n900/APKBUILD +++ b/device/community/device-nokia-n900/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Sicelo # Co-Maintainer: Danct12 pkgname=device-nokia-n900 -pkgver=21 +pkgver=23 pkgrel=0 pkgdesc="Nokia N900" url="https://postmarketos.org" @@ -45,7 +45,6 @@ source=" modem-load.conf modem-opts.conf modules.blocklist - n900-wlan-data.initd pointercal proxishot.sh uboot-script.cmd @@ -181,10 +180,7 @@ upower() { nonfree_firmware() { pkgdesc="Wifi firmware" depends="linux-firmware-ti-connectivity wl1251-cal" - install="$subpkgname.post-install" - triggers="$subpkgname.trigger=/lib/firmware/ti-connectivity" - - install -Dm755 "$srcdir/n900-wlan-data.initd" "$subpkgdir/etc/init.d/n900-wlan-data" + mkdir "$subpkgdir" } sha512sums=" @@ -215,7 +211,6 @@ e440ed7a3070c17e003b86b72dbe6d8194d01b577ca8dd56dd066f216b6dda32bb965c780950f178 157b27feebcfddf800a1ffd8c6e369d2b58e5db25b1a44b4443dada8d9fe74abb91d036b9f0e97769bbafbdc72020b5637313682c6932fe7b0bddb9ebebbad42 modem-load.conf 695feac7f69a0ec8c5e007cdb651adcc3492f1c6236e7fd183edec2a5e25cb957d3ace630ea5fdb87fd703e35ac368f1d097c2f881ecb52c9cfd433564db2a6c modem-opts.conf 862ebc7cd2d7a1b3d41b10701b8418308c89eb0732eb99c42ec1091d48e08db9421727f67a3272b7309549798d59afb1b8d7d2fa48d1447b208fcb2329472d4d modules.blocklist -b50e7f37ffb1fa0bb782b117a4e8bcfdb722b6127c3e5d643e90cd901a1f4e65e77a0773ed418673c8195595347482be0c8096f5a723e840315ad61ccd043b66 n900-wlan-data.initd 143c21f0b18a016d37cb44178e9daea09f128a90769b48353c03c3f245cb9b1f7e773b9ccee084973fc78ddd7a18c2642e54888a85bda7c7daecddc9a8c62eff pointercal 134f51d20decc0c63ab08010931a0b410b70d2f85bf6899f2ff137b1680f59f706a6287d01f5fbb41fa5309125df75a430d0783149bd1a6a1bca07d22f4f6a21 proxishot.sh 239a54ae5c5effb53ccf4d658652c0462da57604b16b77a63627a17caa171caf82e3d1769f9c5afea8756415acbbf3b73db9b57715fce6c70ea3f29e5c6ac84a uboot-script.cmd diff --git a/device/community/device-nokia-n900/device-nokia-n900-nonfree-firmware.post-install b/device/community/device-nokia-n900/device-nokia-n900-nonfree-firmware.post-install deleted file mode 100644 index 947a3c7ae..000000000 --- a/device/community/device-nokia-n900/device-nokia-n900-nonfree-firmware.post-install +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -rc-update add n900-wlan-data boot diff --git a/device/community/device-nokia-n900/device-nokia-n900-nonfree-firmware.trigger b/device/community/device-nokia-n900/device-nokia-n900-nonfree-firmware.trigger deleted file mode 100644 index 98c2f77eb..000000000 --- a/device/community/device-nokia-n900/device-nokia-n900-nonfree-firmware.trigger +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -[ -f /lib/firmware/ti-connectivity/wl1251-nvs.bin ] && n900-update-wl1251 - -exit 0 diff --git a/device/community/device-nokia-n900/n900-wlan-data.initd b/device/community/device-nokia-n900/n900-wlan-data.initd deleted file mode 100644 index e69bf3a79..000000000 --- a/device/community/device-nokia-n900/n900-wlan-data.initd +++ /dev/null @@ -1,20 +0,0 @@ -#!/sbin/openrc-run -description="Update N900 WLAN calibration data" - -depend() -{ - before modules - after localmount -} - -start() -{ - if [ ! -f /var/lib/n900_cal/done ] - then - n900-update-wl1251 - mkdir -p /var/lib/n900_cal - touch /var/lib/n900_cal/done - fi - - eend $? -} diff --git a/device/community/wl1251-cal/APKBUILD b/device/community/wl1251-cal/APKBUILD index f14e55233..1f20f87d3 100644 --- a/device/community/wl1251-cal/APKBUILD +++ b/device/community/wl1251-cal/APKBUILD @@ -1,14 +1,17 @@ # Maintainer: Dang Huynh pkgname=wl1251-cal pkgver=1.2 -pkgrel=0 -pkgdesc="Retrieve WiFi data from CAL on the Nokia N900 and feed it to the driver" +pkgrel=1 +pkgdesc="Retrieve wl1251 calibration data from a CAL partition and feed it to the driver" url="https://github.com/maemo-leste/wl1251-cal" arch="armv7" license="LGPL-2.1-only" makedepends="linux-headers" +subpackages="$pkgname-openrc" +triggers="$pkgname.trigger=/lib/firmware/ti-connectivity" source="$pkgname-$pkgver.tar.gz::https://github.com/maemo-leste/wl1251-cal/archive/refs/tags/$pkgver.tar.gz - n900-update-wl1251" + wl1251-cal.initd + calibrate-wl1251" options="!check" # No tests build() { @@ -17,9 +20,17 @@ build() { package() { make install DESTDIR="$pkgdir" - install -Dm755 "$srcdir/n900-update-wl1251" "$pkgdir/usr/bin/n900-update-wl1251" + install -Dm755 "$srcdir/calibrate-wl1251" "$pkgdir/usr/bin/calibrate-wl1251" + install -Dm755 "$srcdir"/wl1251-cal.initd "$pkgdir"/etc/init.d/wl1251-cal } + +openrc() { + default_openrc + install="$subpkgname.post-install" +} + sha512sums=" 1a402553fc98fa8f2d81d34a548f96be91d13bdcb77ec8e9d8373732b27a6e908895f6044aef8e88dbcd9fa6fa04f0a3d62bed877be91ba6207f68440c3ce758 wl1251-cal-1.2.tar.gz -2cb484d8ab64198c97c61691151a19d26d57f340f85c70d39293e9428b5ac790bc1a6de5894a2a9a3886487f450fd09b21513add3f5fa776ac5289985e43c63a n900-update-wl1251 +1793a4d09ce3c4f2af7b7b4e171ed04e4d5e70d3e40f365ef169879d2431bd1f7abe8702a422efb4d86449a2800b53c531af7353d4e4c2563985c97030cbd99b wl1251-cal.initd +0d843727da4d2f3e2fe76ff80c68e67b85fa1e4797ba822d323f3b005df853ec5206c812a9e0caed96aff2bf5f353df79b20f1970c6382d90e02dc664411d0b4 calibrate-wl1251 " diff --git a/device/community/wl1251-cal/n900-update-wl1251 b/device/community/wl1251-cal/calibrate-wl1251 similarity index 56% rename from device/community/wl1251-cal/n900-update-wl1251 rename to device/community/wl1251-cal/calibrate-wl1251 index 02184fc4b..82533a138 100644 --- a/device/community/wl1251-cal/n900-update-wl1251 +++ b/device/community/wl1251-cal/calibrate-wl1251 @@ -1,10 +1,10 @@ #!/bin/sh -e if [ -e /in-pmbootstrap ]; then - echo "Skipping update of N900 WLAN calibration data (running in pmbootstrap)" + echo "Skipping update of wl1251 calibration data (running in pmbootstrap)" exit 0 fi -echo "Updating N900's WLAN calibration data.." +echo "Updating wl1251 calibration data.." wl1251-cal --nvs-loading=/dev/null --nvs-push-data=/lib/firmware/ti-connectivity/wl1251-nvs.bin echo "Done" diff --git a/device/community/wl1251-cal/wl1251-cal-openrc.post-install b/device/community/wl1251-cal/wl1251-cal-openrc.post-install new file mode 100644 index 000000000..a919e0f2b --- /dev/null +++ b/device/community/wl1251-cal/wl1251-cal-openrc.post-install @@ -0,0 +1,3 @@ +#!/bin/sh + +rc-update add wl1251-cal boot diff --git a/device/community/wl1251-cal/wl1251-cal.initd b/device/community/wl1251-cal/wl1251-cal.initd new file mode 100644 index 000000000..c385f6521 --- /dev/null +++ b/device/community/wl1251-cal/wl1251-cal.initd @@ -0,0 +1,14 @@ +#!/sbin/openrc-run +description="Update wl1251 calibration data" + +depend() +{ + before modules + after localmount +} + +start() +{ + calibrate-wl1251 + eend $? +} diff --git a/device/community/wl1251-cal/wl1251-cal.trigger b/device/community/wl1251-cal/wl1251-cal.trigger new file mode 100644 index 000000000..65f7cbd5e --- /dev/null +++ b/device/community/wl1251-cal/wl1251-cal.trigger @@ -0,0 +1,5 @@ +#!/bin/sh + +[ -f /lib/firmware/ti-connectivity/wl1251-nvs.bin ] && calibrate-wl1251 + +exit 0