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

@ -228,6 +228,15 @@
mkbootimage boot.bif $out/boot.bin
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 {
inherit nixpkgs;
@ -241,7 +250,7 @@
not-os-qemu = { board ? "zc706" }: let
qemuScript = ''
#!/bin/bash
export PATH=${pkgs.qemu}/bin:$PATH
export PATH=${qemu}/bin:$PATH
IMGDIR=$(mktemp -d /tmp/not-os-qemu-XXXXXX)
BASE=$(realpath $(dirname $0))
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 = {
system.build.bootStage2 = pkgs.substituteAll {
diff --git a/zynq_image.nix b/zynq_image.nix
index 3fa23ab..484a063 100644
index 3fa23ab..695d876 100644
--- a/zynq_image.nix
+++ b/zynq_image.nix
@@ -1,66 +1,62 @@
@@ -1,66 +1,63 @@
{ config, pkgs, ... }:
let
@ -136,6 +136,7 @@ index 3fa23ab..484a063 100644
- passAsFile = [ "qemuScript" ];
+ networking.hostName = "zynq";
+ not-os.sd = true;
+ not-os.simpleStaticIp = true;
+ system.build.zynq_image = pkgs.runCommand "zynq_image" {
preferLocalBuild = true;
} ''