add not-os disk image builder and qemu #10

Merged
sb10q merged 1 commits from fsagbuya/nix-servo:sdimage into master 2024-08-17 17:37:24 +08:00
2 changed files with 13 additions and 3 deletions

View File

@ -229,6 +229,15 @@
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
''; '';
# Pinned qemu version due to networking errors in recent version 8.2.0
qemu = pkgs.qemu.overrideAttrs (oldAttrs: rec {
version = "8.1.3";
src = pkgs.fetchurl {
url = "https://download.qemu.org/qemu-${version}.tar.xz";
hash = "sha256-Q8wXaAQQVYb3T5A5jzTp+FeH3/QA07ZA2B93efviZbs=";
};
});
not-os-configured = (import patched-not-os { not-os-configured = (import patched-not-os {
inherit nixpkgs; inherit nixpkgs;
extraModules = [ extraModules = [
@ -241,7 +250,7 @@
not-os-qemu = { board ? "zc706" }: let not-os-qemu = { board ? "zc706" }: let
qemuScript = '' qemuScript = ''
#!/bin/bash #!/bin/bash
export PATH=${pkgs.qemu}/bin:$PATH export PATH=${qemu}/bin:$PATH
IMGDIR=$(mktemp -d /tmp/not-os-qemu-XXXXXX) IMGDIR=$(mktemp -d /tmp/not-os-qemu-XXXXXX)
BASE=$(realpath $(dirname $0)) BASE=$(realpath $(dirname $0))
qemu-img create -F raw -f qcow2 -b $BASE/sd-image.img $IMGDIR/sd-overlay.qcow2 512M qemu-img create -F raw -f qcow2 -b $BASE/sd-image.img $IMGDIR/sd-overlay.qcow2 512M

View File

@ -66,10 +66,10 @@ index c61f9d6..4e30d4b 100644
config = { config = {
system.build.bootStage2 = pkgs.substituteAll { system.build.bootStage2 = pkgs.substituteAll {
diff --git a/zynq_image.nix b/zynq_image.nix diff --git a/zynq_image.nix b/zynq_image.nix
index 3fa23ab..484a063 100644 index 3fa23ab..695d876 100644
--- a/zynq_image.nix --- a/zynq_image.nix
+++ b/zynq_image.nix +++ b/zynq_image.nix
@@ -1,66 +1,62 @@ @@ -1,66 +1,63 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let let
@ -136,6 +136,7 @@ index 3fa23ab..484a063 100644
- passAsFile = [ "qemuScript" ]; - passAsFile = [ "qemuScript" ];
+ networking.hostName = "zynq"; + networking.hostName = "zynq";
+ not-os.sd = true; + not-os.sd = true;
+ not-os.simpleStaticIp = true;
+ system.build.zynq_image = pkgs.runCommand "zynq_image" { + system.build.zynq_image = pkgs.runCommand "zynq_image" {
preferLocalBuild = true; preferLocalBuild = true;
} '' } ''