cleanup
This commit is contained in:
parent
ae4d4c97b6
commit
ac4d1dfdce
17
flake.lock
17
flake.lock
|
@ -17,22 +17,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
|
||||||
"lastModified": 1701053011,
|
|
||||||
"narHash": "sha256-8QQ7rFbKFqgKgLoaXVJRh7Ik5LtI3pyBBCfOnNOGkF0=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "5b528f99f73c4fad127118a8c1126b5e003b01a9",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixos-23.05",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs-unstable": {
|
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1700794826,
|
"lastModified": 1700794826,
|
||||||
"narHash": "sha256-RyJTnTNKhO0yqRpDISk03I/4A67/dp96YRxc86YOPgU=",
|
"narHash": "sha256-RyJTnTNKhO0yqRpDISk03I/4A67/dp96YRxc86YOPgU=",
|
||||||
|
@ -72,7 +56,6 @@
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
|
||||||
"not-os": "not-os"
|
"not-os": "not-os"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
50
flake.nix
50
flake.nix
|
@ -1,16 +1,13 @@
|
||||||
{
|
{
|
||||||
description = "Not-OS port to the Zynq-7000 platform";
|
description = "Firmware for Sinara Fast-Servo based on Not-OS and Linien";
|
||||||
|
|
||||||
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-23.05;
|
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
|
||||||
inputs.nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
||||||
inputs.not-os.url = github:cleverca22/not-os;
|
inputs.not-os.url = github:cleverca22/not-os;
|
||||||
inputs.not-os.inputs.nixpkgs.follows = "nixpkgs";
|
inputs.not-os.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
outputs = { self, nixpkgs, nixpkgs-unstable, not-os }:
|
outputs = { self, nixpkgs, not-os }:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||||
# To be used for building u-boot.
|
|
||||||
pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; };
|
|
||||||
|
|
||||||
gnu-platform = "arm-none-eabi";
|
gnu-platform = "arm-none-eabi";
|
||||||
|
|
||||||
|
@ -178,30 +175,24 @@
|
||||||
dontFixup = true;
|
dontFixup = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# U-boot needs the recent patch in master to fix cross-compile issues.
|
u-boot = { board ? "zc706" }: pkgs.pkgsCross.armv7l-hf-multiplatform.buildUBoot {
|
||||||
# See https://github.com/NixOS/nixpkgs/pull/265411.
|
|
||||||
u-boot = pkgs-unstable.pkgsCross.armv7l-hf-multiplatform.buildUBoot {
|
|
||||||
defconfig = "xilinx_zynq_virt_defconfig";
|
defconfig = "xilinx_zynq_virt_defconfig";
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
export DEVICE_TREE=zynq-zc706
|
export DEVICE_TREE=zynq-${board}
|
||||||
'';
|
'';
|
||||||
extraMeta.platforms = ["armv7l-linux"];
|
extraMeta.platforms = ["armv7l-linux"];
|
||||||
filesToInstall = ["u-boot.elf"];
|
filesToInstall = ["u-boot.elf"];
|
||||||
};
|
};
|
||||||
|
|
||||||
build = { target ? "zc706" }: let
|
bootimage = { board ? "zc706" }: pkgs.runCommand "${board}-bootimage"
|
||||||
fsblDrv = fsbl { board = "zc706"; };
|
|
||||||
u-bootDrv = u-boot;
|
|
||||||
|
|
||||||
bootimage = pkgs.runCommand "${target}-bootimage"
|
|
||||||
{
|
{
|
||||||
buildInputs = [ mkbootimage ];
|
buildInputs = [ mkbootimage ];
|
||||||
}
|
}
|
||||||
''
|
''
|
||||||
bifdir=`mktemp -d`
|
bifdir=`mktemp -d`
|
||||||
cd $bifdir
|
cd $bifdir
|
||||||
ln -s ${fsblDrv}/fsbl.elf fsbl.elf
|
ln -s ${fsbl { inherit board; }}/fsbl.elf fsbl.elf
|
||||||
ln -s ${u-bootDrv}/u-boot.elf u-boot.elf
|
ln -s ${u-boot { inherit board; }}/u-boot.elf u-boot.elf
|
||||||
cat > boot.bif << EOF
|
cat > boot.bif << EOF
|
||||||
the_ROM_image:
|
the_ROM_image:
|
||||||
{
|
{
|
||||||
|
@ -213,28 +204,25 @@
|
||||||
mkbootimage boot.bif $out/boot.bin
|
mkbootimage boot.bif $out/boot.bin
|
||||||
echo file binary-dist $out/boot.bin >> $out/nix-support/hydra-build-products
|
echo file binary-dist $out/boot.bin >> $out/nix-support/hydra-build-products
|
||||||
'';
|
'';
|
||||||
in {
|
|
||||||
"${target}-bootimage" = bootimage;
|
|
||||||
};
|
|
||||||
in rec {
|
|
||||||
packages.x86_64-linux = {
|
|
||||||
inherit mkbootimage u-boot;
|
|
||||||
zc706-fsbl = fsbl { board = "zc706"; };
|
|
||||||
} // (build { target = "zc706"; });
|
|
||||||
|
|
||||||
packages.armv7l-linux = let
|
not-os-configured = (import "${not-os}" {
|
||||||
platforms = (import not-os.inputs.nixpkgs { config = {}; }).platforms;
|
inherit nixpkgs;
|
||||||
eval = (import "${not-os}" {
|
|
||||||
extraModules = [
|
extraModules = [
|
||||||
"${not-os}/zynq_image.nix"
|
"${not-os}/zynq_image.nix"
|
||||||
];
|
];
|
||||||
platform = system: platforms.armv7l-hf-multiplatform;
|
platform = system: (import nixpkgs { config = {}; }).platforms.armv7l-hf-multiplatform;
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
crossSystem.system = "armv7l-linux";
|
crossSystem.system = "armv7l-linux";
|
||||||
inherit (not-os.inputs) nixpkgs;
|
|
||||||
});
|
});
|
||||||
in {
|
in {
|
||||||
zynq_image = eval.config.system.build.zynq_image;
|
packages.x86_64-linux = {
|
||||||
|
inherit mkbootimage;
|
||||||
|
};
|
||||||
|
packages.armv7l-linux = {
|
||||||
|
zc706-u-boot = u-boot { board = "zc706"; };
|
||||||
|
zc706-fsbl = fsbl { board = "zc706"; };
|
||||||
|
zc706-bootimage = bootimage { board = "zc706"; };
|
||||||
|
zc706-not-os = not-os-configured.config.system.build.zynq_image;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
Loading…
Reference in New Issue