1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-15 11:03:37 +03:00

motorola-rav: Init firmware package

Required at the very least for the touchscreen firmware.
This commit is contained in:
Samuel Dionne-Riel 2021-03-19 01:37:45 -04:00
parent 80dc6ec75d
commit 971e463b10
2 changed files with 34 additions and 0 deletions

View File

@ -19,6 +19,8 @@
kernel.package = pkgs.callPackage ./kernel { };
};
mobile.device.firmware = pkgs.callPackage ./firmware {};
mobile.system.android.device_name = "rav";
mobile.system.android = {
# This device has an A/B partition scheme.

View File

@ -0,0 +1,32 @@
{ lib
, runCommandNoCC
, fetchurl
, fetchgit
, unzip
, android-partition-tools
, e2fsprogs
, simg2img
}:
let
buildTag = "QPJS30.131-61-8";
factoryZip = "XT2045-3_RAV_RETUS_10_${buildTag}_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml.zip";
upstreamImage = fetchurl {
url = "https://archive.org/download/xt-2045-3-rav-retus-10-qpjs-30.131-61-8-subsidy-default-regulatory-default-cfc.xml/${factoryZip}";
sha256 = "0fjrwpazd7p9nlrmbl616n86hsnv1a57piyxsifsnwb3hm90jqhr";
};
in runCommandNoCC "motorola-rav-firmware-${buildTag}" {
nativeBuildInputs = [ unzip e2fsprogs simg2img android-partition-tools ];
meta.license = [
# We make no claims that it can be redistributed.
lib.licenses.unfree
];
} ''
unzip ${upstreamImage}
simg2img super.img_sparsechunk.* super-raw.img
lpunpack -p vendor_a super-raw.img
debugfs vendor_a.img -R "rdump firmware ."
mkdir -p $out/lib
mv firmware $out/lib/firmware
''