diff options
author | Maciej Krüger <mkg20001@gmail.com> | 2022-01-07 22:14:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-07 22:14:05 +0100 |
commit | 801d832872a11a867b297d54cafd5ba34c5e41ae (patch) | |
tree | aa9e8cae766018d1a550bbbae13faa65dd15981f /nixos/modules/installer | |
parent | 5034c5c27ff4a2fac20e703abc0951c90489fed2 (diff) | |
parent | 048cb042d61d00543d8b03985dd7d0128d85469c (diff) | |
download | nixlib-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.nix | 32 | ||||
-rw-r--r-- | nixos/modules/installer/sd-card/sd-image-x86_64.nix | 27 | ||||
-rw-r--r-- | nixos/modules/installer/sd-card/sd-image.nix | 2 |
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 |