forked from M-Labs/nix-servo
cleanup
This commit is contained in:
parent
ae4d4c97b6
commit
ac4d1dfdce
17
flake.lock
generated
17
flake.lock
generated
@ -17,22 +17,6 @@
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"lastModified": 1700794826,
|
||||
"narHash": "sha256-RyJTnTNKhO0yqRpDISk03I/4A67/dp96YRxc86YOPgU=",
|
||||
@ -72,7 +56,6 @@
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"not-os": "not-os"
|
||||
}
|
||||
}
|
||||
|
84
flake.nix
84
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-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
|
||||
inputs.not-os.url = github:cleverca22/not-os;
|
||||
inputs.not-os.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable, not-os }:
|
||||
outputs = { self, nixpkgs, not-os }:
|
||||
let
|
||||
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";
|
||||
|
||||
@ -178,63 +175,54 @@
|
||||
dontFixup = true;
|
||||
};
|
||||
|
||||
# U-boot needs the recent patch in master to fix cross-compile issues.
|
||||
# See https://github.com/NixOS/nixpkgs/pull/265411.
|
||||
u-boot = pkgs-unstable.pkgsCross.armv7l-hf-multiplatform.buildUBoot {
|
||||
u-boot = { board ? "zc706" }: pkgs.pkgsCross.armv7l-hf-multiplatform.buildUBoot {
|
||||
defconfig = "xilinx_zynq_virt_defconfig";
|
||||
preConfigure = ''
|
||||
export DEVICE_TREE=zynq-zc706
|
||||
export DEVICE_TREE=zynq-${board}
|
||||
'';
|
||||
extraMeta.platforms = ["armv7l-linux"];
|
||||
filesToInstall = ["u-boot.elf"];
|
||||
};
|
||||
|
||||
build = { target ? "zc706" }: let
|
||||
fsblDrv = fsbl { board = "zc706"; };
|
||||
u-bootDrv = u-boot;
|
||||
|
||||
bootimage = pkgs.runCommand "${target}-bootimage"
|
||||
bootimage = { board ? "zc706" }: pkgs.runCommand "${board}-bootimage"
|
||||
{
|
||||
buildInputs = [ mkbootimage ];
|
||||
}
|
||||
''
|
||||
bifdir=`mktemp -d`
|
||||
cd $bifdir
|
||||
ln -s ${fsbl { inherit board; }}/fsbl.elf fsbl.elf
|
||||
ln -s ${u-boot { inherit board; }}/u-boot.elf u-boot.elf
|
||||
cat > boot.bif << EOF
|
||||
the_ROM_image:
|
||||
{
|
||||
buildInputs = [ mkbootimage ];
|
||||
[bootloader]fsbl.elf
|
||||
u-boot.elf
|
||||
}
|
||||
''
|
||||
bifdir=`mktemp -d`
|
||||
cd $bifdir
|
||||
ln -s ${fsblDrv}/fsbl.elf fsbl.elf
|
||||
ln -s ${u-bootDrv}/u-boot.elf u-boot.elf
|
||||
cat > boot.bif << EOF
|
||||
the_ROM_image:
|
||||
{
|
||||
[bootloader]fsbl.elf
|
||||
u-boot.elf
|
||||
}
|
||||
EOF
|
||||
mkdir $out $out/nix-support
|
||||
mkbootimage boot.bif $out/boot.bin
|
||||
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"; });
|
||||
EOF
|
||||
mkdir $out $out/nix-support
|
||||
mkbootimage boot.bif $out/boot.bin
|
||||
echo file binary-dist $out/boot.bin >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
|
||||
packages.armv7l-linux = let
|
||||
platforms = (import not-os.inputs.nixpkgs { config = {}; }).platforms;
|
||||
eval = (import "${not-os}" {
|
||||
not-os-configured = (import "${not-os}" {
|
||||
inherit nixpkgs;
|
||||
extraModules = [
|
||||
"${not-os}/zynq_image.nix"
|
||||
];
|
||||
platform = system: platforms.armv7l-hf-multiplatform;
|
||||
platform = system: (import nixpkgs { config = {}; }).platforms.armv7l-hf-multiplatform;
|
||||
system = "x86_64-linux";
|
||||
crossSystem.system = "armv7l-linux";
|
||||
inherit (not-os.inputs) nixpkgs;
|
||||
});
|
||||
in {
|
||||
zynq_image = eval.config.system.build.zynq_image;
|
||||
in {
|
||||
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
Block a user