forked from NixOS/mobile-nixos
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] motorola-addison: Build firmware and enable wcnss
TODO: scheme so the end-user provides the files... The bigger problem is that we cannot be sure the files are the exact same! So we can't use `requireFile` as the end-user may be unable to provide the firmware files. Another option could be to make the `modem` an input of the derivation, requiring `.override` to be used by the end-user with a path to a copy of the contents of the modem partition. (With strong discouragement to directly use it?)
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ lib, runCommandNoCC, fetchFromGitHub, fetchurl }: | ||
|
||
let | ||
# FIXME: somehow get the user to provide the contents of the "modem" partition | ||
# sudo blkid | grep -i '"modem"' | ||
# /dev/mmcblk0p19: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="modem" PARTUUID="e9018b02-0068-cb79-4fb4-b0b9027c4c80" | ||
|
||
# Contents of the "modem" partition. | ||
modem = ./modem; | ||
|
||
# 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" "sha256:0mjzc2pqn95dkgp3g8ks9qyqzpjc74a7yx1y71hqfnqr7jarbv7f"; | ||
nv = muppets "/etc/firmware/wlan/prima/WCNSS_qcom_wlan_nv.bin" "sha256: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 | ||
'' |