cross-compilation transferred to crossSystem

This commit is contained in:
Florian Agbuya 2024-03-26 17:50:40 +08:00
parent 0d3f87c5bc
commit 251f65f217
1 changed files with 9 additions and 23 deletions

View File

@ -151,10 +151,10 @@ index c61f9d6..fbdf0fd 100644
};
}
diff --git a/zynq_image.nix b/zynq_image.nix
index 3fa23ab..e2e3871 100644
index 3fa23ab..9d1621e 100644
--- a/zynq_image.nix
+++ b/zynq_image.nix
@@ -1,66 +1,102 @@
@@ -1,66 +1,89 @@
-{ config, pkgs, ... }:
+{ lib, config, pkgs, ... }:
@ -163,22 +163,7 @@ index 3fa23ab..e2e3871 100644
- # dont use overlays for the qemu, it causes a lot of wasted time on recompiles
- x86pkgs = import pkgs.path { system = "x86_64-linux"; };
- customKernel = pkgs.linux.override {
+ crosspkgs = import pkgs.path {
+ system = "x86_64-linux";
+ crossSystem = {
+ system = "armv7l-linux";
+ linux-kernel = {
+ name = "zynq";
+ baseConfig = "multi_v7_defconfig";
+ target = "uImage";
+ installTarget = "uImage";
+ autoModules = false;
+ DTB = true;
+ makeFlags = [ "LOADADDR=0x8000" ];
+ };
+ };
+ };
+ customKernel = (crosspkgs.linux.override {
+ customKernel = (pkgs.linux.override {
extraConfig = ''
OVERLAY_FS y
+ MEDIA_SUPPORT n
@ -195,14 +180,15 @@ index 3fa23ab..e2e3871 100644
+ OF_OVERLAY y
'';
- };
- customKernelPackages = pkgs.linuxPackagesFor customKernel;
+ }).overrideAttrs (oa: {
+ postInstall = ''
+ cp arch/arm/boot/uImage $out
+ if [ -e arch/arm/boot/uImage ]; then
+ cp arch/arm/boot/uImage $out
+ fi
+ ${oa.postInstall}
+ '';
+ });
+ customKernelPackages = crosspkgs.linuxPackagesFor customKernel;
customKernelPackages = pkgs.linuxPackagesFor customKernel;
in {
imports = [ ./arm32-cross-fixes.nix ];
boot.kernelPackages = customKernelPackages;
@ -253,12 +239,12 @@ index 3fa23ab..e2e3871 100644
- chmod +x qemu-script
- patchShebangs qemu-script
- ls -ltrh
'';
- '';
- system.build.rpi_image_tar = pkgs.runCommand "dist.tar" {} ''
- mkdir -p $out/nix-support
- tar -cvf $out/dist.tar ${config.system.build.rpi_image}
- echo "file binary-dist $out/dist.tar" >> $out/nix-support/hydra-build-products
- '';
'';
- environment.systemPackages = [ pkgs.strace ];
- environment.etc."service/getty/run".source = pkgs.writeShellScript "getty" ''
- agetty ttyPS0 115200