forked from M-Labs/nix-servo
69 lines
2.1 KiB
Nix
69 lines
2.1 KiB
Nix
{
|
|
description = "Not-OS port to the Zynq-7000 platform";
|
|
|
|
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
|
|
inputs.not-os.url = github:cleverca22/not-os;
|
|
inputs.zynq-rs.url = git+https://git.m-labs.hk/m-labs/zynq-rs;
|
|
|
|
outputs = { self, nixpkgs, not-os, zynq-rs }:
|
|
let
|
|
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
|
zynqpkgs = zynq-rs.packages.x86_64-linux;
|
|
|
|
build = { target ? "zc706" }: let
|
|
fsbl = zynqpkgs."${target}-fsbl";
|
|
|
|
u-boot = pkgs.pkgsCross.armv7l-hf-multiplatform.buildUBoot {
|
|
defconfig = "xilinx_zynq_virt_defconfig";
|
|
preConfigure = ''
|
|
export DEVICE_TREE=zynq-zc706
|
|
'';
|
|
extraMeta.platforms = ["armv7l-linux"];
|
|
filesToInstall = ["u-boot.elf"];
|
|
};
|
|
|
|
fsbl-sd = pkgs.runCommand "${target}-fsbl-sd"
|
|
{
|
|
buildInputs = [ zynqpkgs.mkbootimage ];
|
|
}
|
|
''
|
|
bifdir=`mktemp -d`
|
|
cd $bifdir
|
|
ln -s ${fsbl}/fsbl.elf fsbl.elf
|
|
ln -s ${u-boot}/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}-fsbl-sd" = fsbl-sd;
|
|
};
|
|
|
|
in rec {
|
|
packages.x86_64-linux = {
|
|
zc706-fsbl = zynqpkgs.zc706-fsbl;
|
|
} // (build { target = "zc706"; });
|
|
|
|
packages.armv7l-linux = let
|
|
platforms = (import not-os.inputs.nixpkgs { config = {}; }).platforms;
|
|
eval = (import "${not-os}" {
|
|
extraModules = [
|
|
./zynq_image.nix
|
|
];
|
|
platform = system: 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;
|
|
};
|
|
};
|
|
} |