Compare commits
No commits in common. "4a93e91faeb562cc709761c0a0cf8576dbf61e1b" and "9bb6f1171ca4366b83c7bc71a765480c2c640d48" have entirely different histories.
4a93e91fae
...
9bb6f1171c
|
@ -1,2 +1 @@
|
|||
result
|
||||
tmp
|
73
flake.lock
73
flake.lock
|
@ -16,39 +16,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"mozilla-overlay": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1695805681,
|
||||
"narHash": "sha256-1ElPLD8eFfnuIk0G52HGGpRtQZ4QPCjChRlEOfkZ5ro=",
|
||||
"owner": "mozilla",
|
||||
"repo": "nixpkgs-mozilla",
|
||||
"rev": "6eabade97bc28d707a8b9d82ad13ef143836736e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "mozilla",
|
||||
"repo": "nixpkgs-mozilla",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1700390070,
|
||||
"narHash": "sha256-de9KYi8rSJpqvBfNwscWdalIJXPo8NjdIZcEJum1mH0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e4ad989506ec7d71f7302cc3067abd82730a4beb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1697730408,
|
||||
"narHash": "sha256-Ww//zzukdTrwTrCUkaJA/NsaLEfUfQpWZXBdXBYfhak=",
|
||||
|
@ -62,26 +30,10 @@
|
|||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1697655685,
|
||||
"narHash": "sha256-79Kuv+QdgsVc+rkibuAgWHnh8IXrLBTOKg5nM0Qvux0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "80c1aab725151632ddc2a20caeb914e76dd0673c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"not-os": {
|
||||
"inputs": {
|
||||
"firmware": "firmware",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1699416673,
|
||||
|
@ -99,28 +51,7 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"not-os": "not-os",
|
||||
"zynq-rs": "zynq-rs"
|
||||
}
|
||||
},
|
||||
"zynq-rs": {
|
||||
"inputs": {
|
||||
"mozilla-overlay": "mozilla-overlay",
|
||||
"nixpkgs": "nixpkgs_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1700454627,
|
||||
"narHash": "sha256-IWfZIlLHYdY6ockkP6QEDpOUU9wqdRXZ5cMqt8FnThU=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "24c804e6f04256cbdd84b496f9022d36f8c5d613",
|
||||
"revCount": 631,
|
||||
"type": "git",
|
||||
"url": "https://git.m-labs.hk/m-labs/zynq-rs"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://git.m-labs.hk/m-labs/zynq-rs"
|
||||
"not-os": "not-os"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
77
flake.nix
77
flake.nix
|
@ -1,69 +1,22 @@
|
|||
{
|
||||
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;
|
||||
};
|
||||
outputs = { self, not-os }: {
|
||||
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;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -5,13 +5,9 @@
|
|||
let
|
||||
# dont use overlays for the qemu, it causes a lot of wasted time on recompiles
|
||||
x86pkgs = import pkgs.path { system = "x86_64-linux"; };
|
||||
build = config.system.build;
|
||||
customKernel = pkgs.linux.override {
|
||||
extraConfig = ''
|
||||
OVERLAY_FS y
|
||||
CORESIGHT_LINKS_AND_SINKS m
|
||||
CORESIGHT_SINK_TPIU m
|
||||
CORESIGHT_SOURCE_ETM3X m
|
||||
'';
|
||||
};
|
||||
customKernelPackages = pkgs.linuxPackagesFor customKernel;
|
||||
|
@ -19,27 +15,26 @@ in {
|
|||
boot.kernelPackages = customKernelPackages;
|
||||
nixpkgs.system = "armv7l-linux";
|
||||
system.build.zynq_image = let
|
||||
cmdline = "root=/dev/mmcblk0 console=ttyPS0,115200n8 systemConfig=${builtins.unsafeDiscardStringContext build.toplevel}";
|
||||
cmdline = "root=/dev/mmcblk0 console=ttyPS0,115200n8 systemConfig=${builtins.unsafeDiscardStringContext config.system.build.toplevel}";
|
||||
qemuScript = ''
|
||||
#!/bin/bash -v
|
||||
export PATH=${x86pkgs.qemu}/bin:$PATH
|
||||
set -x
|
||||
base=$(dirname $0)
|
||||
|
||||
mkdir ./tmp/
|
||||
cp $base/root.squashfs ./tmp/
|
||||
chmod +w ./tmp/root.squashfs
|
||||
truncate -s 64M ./tmp/root.squashfs
|
||||
cp $base/root.squashfs /tmp/
|
||||
chmod +w /tmp/root.squashfs
|
||||
truncate -s 64m /tmp/root.squashfs
|
||||
|
||||
qemu-system-arm \
|
||||
-M xilinx-zynq-a9 \
|
||||
-serial /dev/null \
|
||||
-serial stdio \
|
||||
-display none \
|
||||
-dtb $base/zynq-zc706.dtb \
|
||||
-dtb $base/zynq-zc702.dtb \
|
||||
-kernel $base/zImage \
|
||||
-initrd $base/initrd \
|
||||
-drive file=./tmp/root.squashfs,if=sd,format=raw \
|
||||
-drive file=/tmp/root.squashfs,if=sd,format=raw \
|
||||
-append "${cmdline}"
|
||||
'';
|
||||
in pkgs.runCommand "zynq_image" {
|
||||
|
@ -49,11 +44,11 @@ in {
|
|||
} ''
|
||||
mkdir $out
|
||||
cd $out
|
||||
cp ${build.squashfs} root.squashfs
|
||||
cp ${build.kernel}/*zImage .
|
||||
cp ${build.initialRamdisk}/initrd initrd
|
||||
cp ${build.kernel}/dtbs/zynq-zc706.dtb .
|
||||
ln -sv ${build.toplevel} toplevel
|
||||
cp -s ${config.system.build.squashfs} root.squashfs
|
||||
cp -s ${config.system.build.kernel}/*zImage .
|
||||
cp -s ${config.system.build.initialRamdisk}/initrd initrd
|
||||
cp -s ${config.system.build.kernel}/dtbs/zynq-zc702.dtb .
|
||||
ln -sv ${config.system.build.toplevel} toplevel
|
||||
cp $qemuScriptPath qemu-script
|
||||
chmod +x qemu-script
|
||||
patchShebangs qemu-script
|
||||
|
@ -61,33 +56,33 @@ in {
|
|||
'';
|
||||
system.build.rpi_image_tar = pkgs.runCommand "dist.tar" {} ''
|
||||
mkdir -p $out/nix-support
|
||||
tar -cvf $out/dist.tar ${build.rpi_image}
|
||||
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" ''
|
||||
bash </dev/ttyPS0 >/dev/ttyPS0
|
||||
agetty ttyPS0 115200
|
||||
'';
|
||||
environment.etc."pam.d/other".text = "";
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(self: super: {
|
||||
|
||||
# armv7l cross-compile fixes
|
||||
libuv = super.libuv.overrideAttrs (old: { doCheck = false;});
|
||||
elfutils = super.elfutils.overrideAttrs (old: { doCheck = false; doInstallCheck = false;});
|
||||
libuv = super.libuv.overrideAttrs (old: {
|
||||
doCheck = false;
|
||||
});
|
||||
elfutils = super.elfutils.overrideAttrs (old: {
|
||||
doCheck = false;
|
||||
doInstallCheck = false;
|
||||
});
|
||||
systemd = super.systemd.override { withEfi = false; };
|
||||
procps = super.procps.override { withSystemd = false; };
|
||||
nix = super.nix.override { enableDocumentation = false; };
|
||||
|
||||
# closure size fixes
|
||||
openssh = super.openssh.override { withFIDO = false; withKerberos = false; };
|
||||
util-linux = super.util-linux.override {
|
||||
pamSupport=false;
|
||||
capabilitiesSupport=false;
|
||||
ncursesSupport=false;
|
||||
systemdSupport=false;
|
||||
nlsSupport=false;
|
||||
translateManpages=false; };
|
||||
util-linux = super.util-linux.override { pamSupport=false; capabilitiesSupport=false; ncursesSupport=false; systemdSupport=false; nlsSupport=false; translateManpages=false; };
|
||||
utillinuxCurses = self.util-linux;
|
||||
utillinuxMinimal = self.util-linux;
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue