1
0
Fork 0

integrate linien-server to not-os

This commit is contained in:
Florian Agbuya 2024-03-18 15:52:56 +08:00
parent d9a2d60b50
commit c2d38540c0
1 changed files with 27 additions and 22 deletions

View File

@ -11,7 +11,7 @@
outputs = { self, nixpkgs, not-os, src-migen, src-misoc }:
let
pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ crosspkgs-overlay ]; };
not-os-cfg = not-os-configured.config.system;
pkgs-armv7l = pkgs.pkgsCross.zynq-armv7l-linux;
fsbl-support = ./fast-servo/fsbl-support;
patched-not-os = pkgs.applyPatches {
@ -100,18 +100,18 @@
runScript = "vivado";
};
pyrp3 = pkgs.python3Packages.buildPythonPackage rec {
pyrp3 = pkgs-armv7l.python3Packages.buildPythonPackage rec {
pname = "pyrp3";
version = "1.2.0";
pyproject = true;
src = pkgs.fetchFromGitHub {
owner = "linien-org";
repo = "${pname}";
repo = "pyrp3";
rev = "v${version}";
hash = "sha256-43TTlpJ5SMAjQM71bNVvrWQyciRXM3zpuA/Dw41AEgU=";
};
nativeBuildInputs = with pkgs.python3Packages; [ setuptools wheel setuptools-scm ];
propagatedBuildInputs = with pkgs.python3Packages; [
nativeBuildInputs = with pkgs-armv7l.python3Packages; [ setuptools wheel setuptools-scm ];
propagatedBuildInputs = with pkgs-armv7l.python3Packages; [
myhdl
rpyc4
cached-property
@ -119,7 +119,7 @@
];
};
linien-server = pkgs.python3Packages.buildPythonPackage rec {
linien-server = pkgs-armv7l.python3Packages.buildPythonPackage rec {
pname = "linien-server";
pyproject = true;
inherit (pkgs.python3Packages.linien-common) src version;
@ -130,8 +130,8 @@
--replace " stop_nginx()" "" \
--replace " flash_fpga()" ""
'';
nativeBuildInputs = [ pkgs.python3Packages.setuptools ];
propagatedBuildInputs = with pkgs.python3Packages; [
nativeBuildInputs = [ pkgs-armv7l.python3Packages.setuptools ];
propagatedBuildInputs = with pkgs-armv7l.python3Packages; [
appdirs
certifi
click
@ -143,15 +143,6 @@
];
};
not-os-configured = (import patched-not-os {
inherit nixpkgs;
extraModules = [
"${patched-not-os}/zynq_image.nix"
];
system = "x86_64-linux";
inherit crossSystem;
});
fast-servo-gateware = pkgs.stdenv.mkDerivation rec {
name = "fast-servo-gateware";
inherit (pkgs.python3Packages.linien-common) src;
@ -213,6 +204,20 @@
};
board-package-set = { board }: let
not-os-configured = (import patched-not-os {
inherit nixpkgs;
extraModules = [
"${patched-not-os}/zynq_image.nix"
] ++ pkgs.lib.optionals (board == "fast-servo") [
({ config, pkgs, ... }: {
environment.systemPackages = [ linien-server ];
})];
system = "x86_64-linux";
inherit crossSystem;
});
not-os-build = not-os-configured.config.system.build;
fsbl = pkgs.stdenv.mkDerivation {
name = "${board}-fsbl";
src = pkgs.fetchFromGitHub {
@ -251,7 +256,7 @@
dontFixup = true;
};
u-boot = (pkgs.pkgsCross.zynq-armv7l-linux.buildUBoot {
u-boot = (pkgs-armv7l.buildUBoot {
defconfig = "xilinx_zynq_virt_defconfig";
patches = [] ++ pkgs.lib.optional (board == "fast-servo") ./fast-servo/u-boot.patch;
preConfigure = ''
@ -261,7 +266,7 @@
CONFIG_SYS_PROMPT="${board}-boot> "
CONFIG_AUTOBOOT=y
CONFIG_BOOTCOMMAND="${builtins.replaceStrings [ "\n" ] [ "; " ] ''
setenv bootargs 'root=/dev/mmcblk0p2 console=ttyPS0,115200n8 systemConfig=${builtins.unsafeDiscardStringContext not-os-cfg.build.toplevel}'
setenv bootargs 'root=/dev/mmcblk0p2 console=ttyPS0,115200n8 systemConfig=${builtins.unsafeDiscardStringContext not-os-build.toplevel}'
fatload mmc 0 0x6400000 uImage
fatload mmc 0 0x8000000 ${board}.dtb
fatload mmc 0 0xA400000 uRamdisk.image.gz
@ -325,7 +330,7 @@
sd-image = let
rootfsImage = pkgs.callPackage (pkgs.path + "/nixos/lib/make-ext4-fs.nix") {
storePaths = [ not-os-cfg.build.toplevel ];
storePaths = [ not-os-build.toplevel ];
volumeLabel = "ROOT";
};
# Current firmware (kernel, bootimage, etc..) takes ~18MB
@ -366,8 +371,8 @@
mkdir firmware
cp ${bootimage}/boot.bin firmware/
cp ${dtb}/${board}.dtb firmware/
cp ${not-os-cfg.build.kernel}/uImage firmware/
cp ${not-os-cfg.build.uRamdisk}/initrd firmware/uRamdisk.image.gz
cp ${not-os-build.kernel}/uImage firmware/
cp ${not-os-build.uRamdisk}/initrd firmware/uRamdisk.image.gz
(cd firmware; mcopy -psvm -i ../firmware_part.img ./* ::)
dd conv=notrunc if=firmware_part.img of=$img seek=$START count=$SECTORS