Skip to content

main/msm-firmware-loader: Add a package to load firmware on msm devices

Nikita Travkin requested to merge TravMurav/pmaports:gt510lte into master

This MR is open to discuss the general approach to firmware on qcom devices.

Unfortunately, packaging firmware provides multiple challenges for us, mainly:

  • We need to somehow obtain, package and distribute binary blobs with unclear license.
  • Once blobs are installed, it's impossible to use the rootfs on other device so this complicates making an "one-size-fits-all" images that otherwise could be possible.
  • Prior also means that if a device has multiple variants that only differ with secure-boot key (so firmware is per-variant signed) we must have somewhat duplicate device packages (a5, a5u and unpackaged a5yz, a5h for example)

The better solution would be to load matching, properly signed blobs from the device when it's possible. This still leaves some blobs like venus (video transcoding core, a fairly small blob is required) and wcnss nvram config file (small, IMO calibration values can't be proprietary) that sometimes aren't present on firmware partitions. For now we can keep them packaged when necessary.

The proposed algorithm is as follows:

  • Load before udev starts but when /sys is available already.
  • Since the rootfs is RO at this point, mount a tmpfs at a packaged mountpoint (/lib/firmware/msm-firmware-loader) We will only put symlinks there and this will also help us slightly reduce emmc wear.
  • Mount firmware partitions in respectively named subdirs as ro
  • Check the extra firmware path that was set prior to us running (e.g. /lib/firmware/postmarketos) and symlink all of the blobs from there to our target dir.
  • Scan mounted partitions for blobs and symlink those if the name of the blob isn't present in the target already (this means that preinstalled firmware takes priority over auto-loaded blobs, this helps with devices that has secure-boot disabled and thus can run newer blobs)
  • Give our target dir path to the kernel
  • With another service, when fs is rw already, unpack .gz packaged modem blobs (Thanks, Motorola) into a tmp dir and re-link to unpacked blobs prior starting modem with rmtfs service.

This MR also contains changes to switch some devices to use more common packages:

  • gt510 and gt58 can use common ports between lte and wifi variants (using -modem kernel selection)
  • a3, a5 and j5 have many many regional variants and also 3g variants, all compatible with the same pmOS ports
  • All other msm8916 devices with variant suffixes were renamed to drop those suffixes

This MR drops/renames some device packages:

Community:

  • samsung-a3lte -> samsung-a3 (lte/3g/all regional variants)
  • samsung-a3ulte -> samsung-a3
  • samsung-a5lte -> samsung-a5
  • samsung-a5ulte -> samsung-a5
  • samsung-serranovelte -> samsung-serranove

Testing:

  • samsung-gt510wifi -> samsung-gt510 (lte/wifi)
  • samsung-gt58lte -> samsung-gt58 (lte/wifi)
  • samsung-j53g -> samsung-j5
  • samsung-j5nlte -> samsung-j5
  • samsung-gprimeltecan -> samsung-gprime
  • samsung-matissevewifi -> samsung-matisseve

TODO:

  • Actually test on Motorola device
  • replace ls | grep with a better snippet
  • Test and switch devices to use the new firmware loading script
    • Switch and drop a5u
    • Switch and drop a3u
  • Add remaining devices (see below)
  • Add provides="device-samsung-old=$pkgver-r$pkgrel" to all renamed packages (also subpackages)
  • Fixup BPO config for changed/dropped devices (build.postmarketos.org!42 (merged))
    • Change a3(u)
    • Change a5(u)
    • Change serranovelte
    • Drop wt86047 kernel flavor
  • Fixup wiki pages for those devices

Devices to be converted:

  • device-alcatel-idol347
  • device-asus-z00l
  • device-asus-z010d
  • device-bq-paella
  • device-huawei-g7 (not needed)
  • device-lenovo-a6000
  • device-lenovo-a6010
  • device-lg-m216
  • device-motorola-harpia
  • device-motorola-osprey
  • device-oppo-a51f (not needed)
  • device-samsung-a3lte
  • device-samsung-a3ulte
  • device-samsung-a5lte
  • device-samsung-a5ulte
  • device-samsung-gprimeltecan (drop ltecan) (no firmware)
  • device-samsung-gt510wifi
  • device-samsung-gt58lte
  • device-samsung-j53g (squash with nlte)
  • device-samsung-j5nlte
  • device-samsung-matissevewifi (drop wifi)
  • device-samsung-serranovelte (drop lte)
  • device-wileyfox-crackling
  • device-xiaomi-wt88047
Edited by Nikita Travkin

Merge request reports