patches and low-level development discussion
 help / color / mirror / code / Atom feed
* [PATCH 1/2] increase partition sizes
@ 2021-12-12 15:50 Yureka
  2021-12-12 15:50 ` [PATCH 2/2] speed up installer image build Yureka
  0 siblings, 1 reply; 3+ messages in thread
From: Yureka @ 2021-12-12 15:50 UTC (permalink / raw)
  To: devel; +Cc: Yureka

---
 host/initramfs/live.nix | 2 +-
 installer/default.nix   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/host/initramfs/live.nix b/host/initramfs/live.nix
index 6446593..5dc4f87 100644
--- a/host/initramfs/live.nix
+++ b/host/initramfs/live.nix
@@ -29,7 +29,7 @@ let
     nativeBuildInputs = [ dosfstools mtools ];
     passthru = { inherit uki; };
   } ''
-    truncate -s ${toString (100 * 1024 * 1024)} $out
+    truncate -s ${toString (150 * 1024 * 1024)} $out
     mkfs.vfat $out
     mmd -i $out ::/EFI ::/EFI/BOOT
     mcopy -i $out ${uki} ::/EFI/BOOT/BOOTX64.EFI
diff --git a/installer/default.nix b/installer/default.nix
index 0685bdd..39933d9 100644
--- a/installer/default.nix
+++ b/installer/default.nix
@@ -35,7 +35,7 @@ let
   eosimages = vmTools.runInLinuxVM (runCommand "eosimages.img" {
     nativeBuildInputs = [ exfatprogs kmod util-linux ];
   } ''
-    truncate -s 4G "$out"
+    truncate -s 5G "$out"
     mkfs.exfat -L eosimages "$out"
     mkdir /mnt
     modprobe loop
-- 
2.34.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] speed up installer image build
  2021-12-12 15:50 [PATCH 1/2] increase partition sizes Yureka
@ 2021-12-12 15:50 ` Yureka
  2021-12-16  2:38   ` Alyssa Ross
  0 siblings, 1 reply; 3+ messages in thread
From: Yureka @ 2021-12-12 15:50 UTC (permalink / raw)
  To: devel; +Cc: Yureka

---
 installer/default.nix | 33 ++++++++++++++++++++-------------
 installer/grub.cfg.in | 10 ++++++++++
 2 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/installer/default.nix b/installer/default.nix
index 39933d9..8c2a3d0 100644
--- a/installer/default.nix
+++ b/installer/default.nix
@@ -21,6 +21,22 @@ let
     ] ++ config.boot.kernelParams);
   };
 
+  efi = runCommand "efi.img" {
+    nativeBuildInputs = [ grub libfaketime dosfstools mtools ];
+  } ''
+    install -D ${grubCfg} files/grub/grub.cfg
+    cp -r ${grub}/lib/grub/${grub.grubTarget} files/grub/
+    cp ${grub}/share/grub/unicode.pf2 files/grub/
+    grub-mkimage -o grubx64.efi -p "(hd0,gpt1)/grub" -O ${grub.grubTarget} part_gpt fat
+    install -D grubx64.efi files/EFI/BOOT/BOOTX64.EFI
+
+    img=$out
+    truncate -s 15M $img
+    faketime "1970-01-01 00:00:00" mkfs.vfat -i 0x2178694e -n EFI $img
+    (cd files; mcopy -psvm -i $img ./* ::)
+    fsck.vfat -vn $img
+  '';
+
   installer = runCommand "installer.img" {
     nativeBuildInputs = [ squashfs-tools-ng ];
   } ''
@@ -47,7 +63,7 @@ let
   '');
 in
 
-vmTools.runInLinuxVM (runCommand "spectrum-installer" {
+runCommand "spectrum-installer" {
   nativeBuildInputs = [ dosfstools grub jq kmod util-linux systemdMinimal ];
 } ''
   blockSize() {
@@ -60,7 +76,7 @@ vmTools.runInLinuxVM (runCommand "spectrum-installer" {
       dd if="$3" of="$1" seek="$start" count="$size" conv=notrunc
   }
 
-  efiSize=40000
+  efiSize="$(blockSize ${efi})"
   installerSize="$(blockSize ${installer})"
   eosimagesSize="$(blockSize ${eosimages})"
 
@@ -72,16 +88,7 @@ vmTools.runInLinuxVM (runCommand "spectrum-installer" {
   size=$eosimagesSize, type=56a3bbc3-aefa-43d9-a64d-7b3fd59bbc4e
   EOF
 
+  fillPartition $out 0 ${efi}
   fillPartition $out 1 ${installer}
   fillPartition $out 2 ${eosimages}
-
-  modprobe loop
-  loop="$(losetup -P --show -f $out)"
-  mkfs.vfat "$loop"p1
-  mkdir /mnt
-  mount "$loop"p1 /mnt
-  grub-install --target ${grub.grubTarget} --removable \
-      --boot-directory /mnt --efi-directory /mnt "$loop"
-  cp ${grubCfg} /mnt/grub/grub.cfg
-  umount /mnt
-'')
+''
diff --git a/installer/grub.cfg.in b/installer/grub.cfg.in
index 46171ec..e4370f1 100644
--- a/installer/grub.cfg.in
+++ b/installer/grub.cfg.in
@@ -1,6 +1,16 @@
 # SPDX-License-Identifier: EUPL-1.2
 # SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is>
 
+insmod efi_gop
+insmod efi_uga
+insmod font
+loadfont /grub/unicode.pf2
+insmod gfxterm
+set gfxmode=auto
+set gfxpayload=keep
+terminal_output gfxterm
+set timeout=5
+
 menuentry "Try Spectrum" {
   loopback live (hd0,gpt3)/Spectrum-0.0-x86_64-generic.0.Live.img
   chainloader (live,gpt1)/efi/boot/bootx64.efi
-- 
2.34.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] speed up installer image build
  2021-12-12 15:50 ` [PATCH 2/2] speed up installer image build Yureka
@ 2021-12-16  2:38   ` Alyssa Ross
  0 siblings, 0 replies; 3+ messages in thread
From: Alyssa Ross @ 2021-12-16  2:38 UTC (permalink / raw)
  To: Yureka; +Cc: devel

[-- Attachment #1: Type: text/plain, Size: 476 bytes --]

Thanks for the patches!  I've (finally) applied both.  I dropped the
GRUB changes as discussed on IRC, but it looks like efi_gop does make an
error message go away so I'll probably add at least that one back.

Formality: I also added a copyright line (my grant programme is very
keen on me tracking that).  I used the From address of your emails — if
you'd like some other name/email there, or if you're not the copyright
holder, just let me know so I can fix them.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-16  2:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-12 15:50 [PATCH 1/2] increase partition sizes Yureka
2021-12-12 15:50 ` [PATCH 2/2] speed up installer image build Yureka
2021-12-16  2:38   ` 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).