aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilan Pässler <milan@petabyte.dev>2020-10-10 20:42:11 +0200
committerMilan Pässler <milan@petabyte.dev>2020-10-10 20:42:11 +0200
commitd78a2422911b3c0674418cbda9c3e9e18c3f610f (patch)
treed2ca921d4816499c709e3f653a8ffaea5457ee6a
parentb0ae9e89f047a1fef88c41a64131c26c594b1eba (diff)
.
-rw-r--r--modules/coreboot/default.nix18
-rw-r--r--modules/grub2/default.nix17
-rw-r--r--modules/grub2/files/background.pngbin0 -> 390630 bytes
-rw-r--r--modules/grub2/files/grub.cfg (renamed from grub.cfg)9
4 files changed, 35 insertions, 9 deletions
diff --git a/modules/coreboot/default.nix b/modules/coreboot/default.nix
index a4ae0f675c3f..b49c8a7d871e 100644
--- a/modules/coreboot/default.nix
+++ b/modules/coreboot/default.nix
@@ -37,12 +37,18 @@ in {
filteredFiles = filterAttrs (k: v: v != null) cfg.extraFiles;
filesList = mapAttrsToList (k: v: v // { name = k; }) filteredFiles;
- installCommands = concatMapStringsSep "\n" (file: ''
- cbfstool $out/coreboot.rom add \
- -f "${file.src}" \
- -n "${file.name}" \
- -t "${file.type}"
- '') filesList;
+ installCommands = concatMapStringsSep "\n" (file:
+ if file.type == "payload" then ''
+ cbfstool $out/coreboot.rom add-payload \
+ -f "${file.src}" \
+ -n "${file.name}" \
+ '' else ''
+ cbfstool $out/coreboot.rom add \
+ -f "${file.src}" \
+ -n "${file.name}" \
+ -t "${file.type}"
+ ''
+ ) filesList;
in pkgs.runCommand "coreboot-rom" {
buildInputs = with pkgs; [ cbfstool ];
diff --git a/modules/grub2/default.nix b/modules/grub2/default.nix
index c1993f2ea518..e07b2987bb0c 100644
--- a/modules/grub2/default.nix
+++ b/modules/grub2/default.nix
@@ -7,16 +7,27 @@ let
in {
options.grub2 = {
enable = mkEnableOption "grub2 coreboot primary payload";
+
+ font = mkOption {
+ type = types.path;
+ default = "${pkgs.unifont}/share/fonts/truetype/unifont.ttf";
+ };
};
config = lib.mkIf cfg.enable {
coreboot.extraFiles = {
"fallback/payload" = {
- type = "simple elf";
+ type = "payload";
src = "${pkgs.coreboot-payload-grub2}/default_payload.elf";
};
- "grub.cfg" = {
- src = ../../grub.cfg;
+ "etc/grub.cfg".src = ./files/grub.cfg;
+ "etc/background.png".src = ./files/background.png;
+ "font.pf2" = {
+ src = pkgs.runCommand "font.pf2" {
+ buildInputs = with pkgs; [ grub2 ];
+ } ''
+ grub-mkfont -o $out ${cfg.font}
+ '';
};
};
};
diff --git a/modules/grub2/files/background.png b/modules/grub2/files/background.png
new file mode 100644
index 000000000000..29275058f283
--- /dev/null
+++ b/modules/grub2/files/background.png
Binary files differ
diff --git a/grub.cfg b/modules/grub2/files/grub.cfg
index 9962c3e24115..5ed7fff569b8 100644
--- a/grub.cfg
+++ b/modules/grub2/files/grub.cfg
@@ -98,6 +98,15 @@ for x in (ahci*,*) ; do
fi
done
+for x in (usb*,*) ; do
+ if [ -f "$x/netbsd" ] ; then
+ menuentry "Load NetBSD from $x" $x {
+ root=$2
+ knetbsd /netbsd
+ }
+ fi
+done
+
for x in (ahci*,*) ; do
if [ -f "$x/grub/grub.cfg" ] ; then
menuentry "Load Config from $x" $x {