Created
January 7, 2022 17:32
-
-
Save telent/e4b00f152671198c73e2adae66f9b078 to your computer and use it in GitHub Desktop.
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
diff --git a/support/builders/allwinner-a64/default.nix b/support/builders/allwinner-a64/default.nix | |
index 7ffddc1..e8efef8 100644 | |
--- a/support/builders/allwinner-a64/default.nix | |
+++ b/support/builders/allwinner-a64/default.nix | |
@@ -1,4 +1,4 @@ | |
-{ lib, buildTowBoot, TF-A, imageBuilder, runCommandNoCC, spiInstallerPartitionBuilder }: | |
+{ lib, buildTowBoot, crustFirmware, TF-A, imageBuilder, runCommandNoCC, spiInstallerPartitionBuilder }: | |
# For Allwinner A64 and Allwinner A64 compatible based hardware | |
{ withSPI ? false, ... } @ args: | |
@@ -35,6 +35,7 @@ let | |
firmware' = variant: buildTowBoot ({ | |
meta.platforms = ["aarch64-linux"]; | |
BL31 = "${TF-A}/bl31.bin"; | |
+ SCP = "${crustFirmware}/scp.bin"; | |
installPhase = '' | |
cp -v u-boot-sunxi-with-spl.bin $out/binaries/Tow-Boot.$variant.bin | |
''; | |
diff --git a/support/overlay/crust-firmware/default.nix b/support/overlay/crust-firmware/default.nix | |
new file mode 100644 | |
index 0000000..655ee85 | |
--- /dev/null | |
+++ b/support/overlay/crust-firmware/default.nix | |
@@ -0,0 +1,52 @@ | |
+{ stdenv, lib, fetchFromGitHub | |
+, flex, yacc, or1k-toolchain }: | |
+ | |
+stdenv.mkDerivation rec { | |
+ pname = "crust-firmware"; | |
+ version = "0.4"; | |
+ | |
+ src = fetchFromGitHub { | |
+ owner = "crust-firmware"; | |
+ repo = "crust"; | |
+ rev = "v${version}"; | |
+ sha256 = "19xxp43b6dhdfssahspyl7y15dbby0kfbfqnmhc42vz1hkp7b4q6"; | |
+ }; | |
+ | |
+ depsBuildBuild = [ | |
+ stdenv.cc | |
+ ]; | |
+ | |
+ nativeBuildInputs = [ | |
+ flex | |
+ yacc | |
+ ] ++ (with or1k-toolchain; [ | |
+ binutils | |
+ gcc | |
+ ]); | |
+ | |
+ postPatch = '' | |
+ substituteInPlace Makefile --replace "= lex" '= ${flex}/bin/flex' | |
+ ''; | |
+ | |
+ buildPhase = '' | |
+ export CROSS_COMPILE=or1k-elf- | |
+ export HOST_COMPILE=${stdenv.cc}/bin/${stdenv.cc.bintools.targetPrefix} | |
+ | |
+ make pinephone_defconfig | |
+ make scp | |
+ ''; | |
+ | |
+ installPhase = '' | |
+ mkdir -p $out/bin | |
+ cp -v build/scp/scp.bin $out | |
+ ''; | |
+ | |
+ meta = with lib; { | |
+ description = "Libre SCP firmware for Allwinner sunxi SoCs"; | |
+ homepage = "https://github.com/crust-firmware/crust"; | |
+ license = with licenses; [ bsd3 gpl2Only mit ]; | |
+ maintainers = [ maintainers.noneucat ]; | |
+ platforms = platforms.all; | |
+ }; | |
+} | |
+ | |
diff --git a/support/overlay/overlay.nix b/support/overlay/overlay.nix | |
index c264fd3..6b7d9ec 100644 | |
--- a/support/overlay/overlay.nix | |
+++ b/support/overlay/overlay.nix | |
@@ -59,6 +59,16 @@ in | |
armTrustedFirmwareS905 | |
; | |
+ crustFirmware = final.callPackage ./crust-firmware { | |
+ inherit (final.buildPackages) | |
+ stdenv | |
+ flex | |
+ yacc | |
+ ; | |
+ | |
+ or1k-toolchain = final.pkgsCross.or1k.buildPackages; | |
+ }; | |
+ | |
amlogicFirmware = callPackage ./amlogic-firmware { }; | |
gxlimg = callPackage ./gxlimg { }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment