about summary refs log tree commit diff
path: root/nixos/modules/installer
diff options
context:
space:
mode:
authorMaciej Krüger <mkg20001@gmail.com>2022-01-07 22:14:05 +0100
committerGitHub <noreply@github.com>2022-01-07 22:14:05 +0100
commit801d832872a11a867b297d54cafd5ba34c5e41ae (patch)
treeaa9e8cae766018d1a550bbbae13faa65dd15981f /nixos/modules/installer
parent5034c5c27ff4a2fac20e703abc0951c90489fed2 (diff)
parent048cb042d61d00543d8b03985dd7d0128d85469c (diff)
downloadnixlib-801d832872a11a867b297d54cafd5ba34c5e41ae.tar
nixlib-801d832872a11a867b297d54cafd5ba34c5e41ae.tar.gz
nixlib-801d832872a11a867b297d54cafd5ba34c5e41ae.tar.bz2
nixlib-801d832872a11a867b297d54cafd5ba34c5e41ae.tar.lz
nixlib-801d832872a11a867b297d54cafd5ba34c5e41ae.tar.xz
nixlib-801d832872a11a867b297d54cafd5ba34c5e41ae.tar.zst
nixlib-801d832872a11a867b297d54cafd5ba34c5e41ae.zip
Merge pull request #125451 from zhaofengli/qemu-riscv64-sd-image
Diffstat (limited to 'nixos/modules/installer')
-rw-r--r--nixos/modules/installer/sd-card/sd-image-riscv64-qemu.nix32
-rw-r--r--nixos/modules/installer/sd-card/sd-image-x86_64.nix27
-rw-r--r--nixos/modules/installer/sd-card/sd-image.nix2
3 files changed, 60 insertions, 1 deletions
diff --git a/nixos/modules/installer/sd-card/sd-image-riscv64-qemu.nix b/nixos/modules/installer/sd-card/sd-image-riscv64-qemu.nix
new file mode 100644
index 000000000000..a3e30768da45
--- /dev/null
+++ b/nixos/modules/installer/sd-card/sd-image-riscv64-qemu.nix
@@ -0,0 +1,32 @@
+# To build, use:
+# nix-build nixos -I nixos-config=nixos/modules/installer/sd-card/sd-image-riscv64-qemu.nix -A config.system.build.sdImage
+{ config, lib, pkgs, ... }:
+
+{
+  imports = [
+    ../../profiles/base.nix
+    ./sd-image.nix
+  ];
+
+  boot.loader = {
+    grub.enable = false;
+    generic-extlinux-compatible = {
+      enable = true;
+
+      # Don't even specify FDTDIR - We do not have the correct DT
+      # The DTB is generated by QEMU at runtime
+      useGenerationDeviceTree = false;
+    };
+  };
+
+  boot.consoleLogLevel = lib.mkDefault 7;
+  boot.kernelParams = [ "console=tty0" "console=ttyS0,115200n8" ];
+
+  sdImage = {
+    populateFirmwareCommands = "";
+    populateRootCommands = ''
+      mkdir -p ./files/boot
+      ${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
+    '';
+  };
+}
diff --git a/nixos/modules/installer/sd-card/sd-image-x86_64.nix b/nixos/modules/installer/sd-card/sd-image-x86_64.nix
new file mode 100644
index 000000000000..b44c0a4eeca5
--- /dev/null
+++ b/nixos/modules/installer/sd-card/sd-image-x86_64.nix
@@ -0,0 +1,27 @@
+# To build, use:
+# nix-build nixos -I nixos-config=nixos/modules/installer/sd-card/sd-image-x86_64.nix -A config.system.build.sdImage
+
+# This image is primarily used in NixOS tests (boot.nix) to test `boot.loader.generic-extlinux-compatible`.
+{ config, lib, pkgs, ... }:
+
+{
+  imports = [
+    ../../profiles/base.nix
+    ./sd-image.nix
+  ];
+
+  boot.loader = {
+    grub.enable = false;
+    generic-extlinux-compatible.enable = true;
+  };
+
+  boot.consoleLogLevel = lib.mkDefault 7;
+
+  sdImage = {
+    populateFirmwareCommands = "";
+    populateRootCommands = ''
+      mkdir -p ./files/boot
+      ${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
+    '';
+  };
+}
diff --git a/nixos/modules/installer/sd-card/sd-image.nix b/nixos/modules/installer/sd-card/sd-image.nix
index a964cf2d6f85..7560c682517a 100644
--- a/nixos/modules/installer/sd-card/sd-image.nix
+++ b/nixos/modules/installer/sd-card/sd-image.nix
@@ -176,7 +176,7 @@ in
 
       nativeBuildInputs = [ dosfstools e2fsprogs mtools libfaketime util-linux zstd ];
 
-      inherit (config.sdImage) compressImage;
+      inherit (config.sdImage) imageName compressImage;
 
       buildCommand = ''
         mkdir -p $out/nix-support $out/sd-image