patches and low-level development discussion
 help / color / mirror / code / Atom feed
* [PATCH] installer: more closely match grub-install
@ 2022-01-12 21:31 Alyssa Ross
  0 siblings, 0 replies; only message in thread
From: Alyssa Ross @ 2022-01-12 21:31 UTC (permalink / raw)
  To: devel; +Cc: Yureka

The main motivation here is that I noticed we're installing a lot
of *.module files that grub-install didn't include.

After this change, we're still differing from what grub-install does
in the following ways:

 • Locale files are still not included

 • grub/x86_64-efi/core.efi or grub/x86_64-efi/grub.efi are not
   included.  I'm not sure where those executables come from, but they
   don't seem to be required.

 • We're still not creating a grubenv file, which should be fine
   because there's no data that might need to be persisted anyway.
---
 installer/default.nix | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/installer/default.nix b/installer/default.nix
index 9fc7493..f7e84ac 100644
--- a/installer/default.nix
+++ b/installer/default.nix
@@ -24,10 +24,22 @@ let
 
   esp = runCommand "esp.img" {
     nativeBuildInputs = [ grub libfaketime dosfstools mtools ];
+    # Definition copied from util/grub-install-common.c.
+    # Last checked: GRUB 2.06
+    pkglib_DATA = [
+      "efiemu32.o" "efiemu64.o" "moddep.lst" "command.lst" "fs.lst" "partmap.lst"
+      "parttool.lst" "video.lst" "crypto.lst" "terminal.lst" "modinfo.sh"
+    ];
   } ''
-    install -D ${grubCfg} files/grub/grub.cfg
-    cp -r ${grub}/lib/grub/${grub.grubTarget} files/grub/
-    cp ${grub}/share/grub/unicode.pf2 files/grub/
+    mkdir -p files/grub/${grub.grubTarget}
+    cp ${grubCfg} files/grub/grub.cfg
+    cp ${grub}/lib/grub/${grub.grubTarget}/*.mod files/grub/${grub.grubTarget}
+    for file in $pkglib_DATA; do
+        path="${grub}/lib/grub/${grub.grubTarget}/$file"
+        ! [ -e "$path" ] || cp "$path" files/grub/${grub.grubTarget}
+    done
+
+    install -D ${grub}/share/grub/unicode.pf2 files/grub/fonts/unicode.pf2
     grub-mkimage -o grubx64.efi -p "(hd0,gpt1)/grub" -O ${grub.grubTarget} part_gpt fat
     install -D grubx64.efi files/EFI/BOOT/BOOTX64.EFI
 

base-commit: 907294e4a85e77e5db116a73ecfdf9a406be663b
-- 
2.33.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-12 21:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-12 21:31 [PATCH] installer: more closely match grub-install Alyssa Ross

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).