1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-13 12:35:48 +03:00

motorola-addison: Build firmware and enable wcnss

This commit is contained in:
Samuel Dionne-Riel 2020-08-20 00:53:24 -04:00
parent 406e22e84d
commit 509cdbe2f3
3 changed files with 84 additions and 0 deletions

View File

@ -0,0 +1,28 @@
= Motorola Moto Z Play
include::_support/common.inc[]
== Device-specific notes
=== Firmware for Wi-Fi
This particular phone keeps the firmware files on a partition named
`modem`.
To make use of the Wi-Fi capabilities of this phone you will need to
make them available to the firmware derivation.
The files can be acquired through different methods. You can use an
alternate recovery like TWRP, mount the partition (identified using
`blkid`) and copy the files.
Another way is to do it using an installed Mobile NixOS system, where,
too, you mount the partition and copy them:
```
$ sudo mount -o ro /dev/disk/by-partlabel/modem /mnt
$ cp -r /mnt ./modem
$ sudo umount /mnt
```
The copy of the firmware files will be in the modem directory, in the
current working directory, ready to be referred to.

View File

@ -19,6 +19,8 @@
kernel.package = pkgs.callPackage ./kernel { kernelPatches = pkgs.defaultKernelPatches; };
};
mobile.device.firmware = pkgs.callPackage ./firmware {};
mobile.system.android.bootimg = {
dt = "${config.mobile.boot.stage-1.kernel.package}/dtbs/motorola-addison.img";
flash = {
@ -52,4 +54,6 @@
mobile.system.type = "android";
mobile.quirks.qualcomm.fb-notify.enable = true;
mobile.quirks.qualcomm.wcnss-wlan.enable = true;
}

View File

@ -0,0 +1,52 @@
{ lib
, runCommandNoCC
, fetchFromGitHub
, fetchurl
, modem ? builtins.throw ''
Your attention is required:
---------------------------
You will need to provide the content of the modem partition this way:
hardware.firmware = [
(config.mobile.device.firmware.override {
modem = ./path/to/copy/of/modem;
})
];
Refer to the device's documentation page for more details about enabling use of the firmware files.
''
}:
let
# The following files, though required, are not present in the modem
# partition.
cfg = fetchurl {
url = "https://raw.githubusercontent.com/LineageOS/android_device_motorola_addison/f99c3591c83c19da6db096eb3f2e5fb0e0d91eed/wifi/WCNSS_qcom_cfg.ini";
sha256 = "1dkmjm2j5l5c6a4q1xsdjkfqqy8d5aj9qd35al4lz6ma58gcy62y";
};
dict = muppets "/etc/firmware/wlan/prima/WCNSS_wlan_dictionary.dat" "0mjzc2pqn95dkgp3g8ks9qyqzpjc74a7yx1y71hqfnqr7jarbv7f";
nv = muppets "/etc/firmware/wlan/prima/WCNSS_qcom_wlan_nv.bin" "0vrsvbilnjyyqjp2i0xsl4nv3sydzv7dmqfv2j539294la4j7imz";
# Helper to download the proprietary files.
muppets = file: sha256: fetchurl {
url = "https://github.com/TheMuppets/proprietary_vendor_motorola/raw/d04e011847bddb3f92eddaac64453cbfcda9cd32/addison/proprietary${file}";
inherit sha256;
};
in
runCommandNoCC "motorola-addison-firmware" {
inherit modem cfg dict nv;
meta.license = [
# We make no claims that it can be redistributed.
lib.licenses.unfree
];
} ''
fwpath="$out/lib/firmware"
mkdir -p $fwpath
cp -vr $modem/image/* $fwpath/
mkdir -p $fwpath/wlan/prima/
cp -v $cfg $fwpath/wlan/prima/WCNSS_qcom_cfg.ini
cp -v $dict $fwpath/wlan/prima/WCNSS_wlan_dictionary.dat
cp -v $nv $fwpath/wlan/prima/WCNSS_qcom_wlan_nv.bin
''