* Reproducible grub-install @ 2019-10-21 14:30 Miguel Arruga Vivas 2019-10-23 9:09 ` Daniel Kiper 0 siblings, 1 reply; 3+ messages in thread From: Miguel Arruga Vivas @ 2019-10-21 14:30 UTC (permalink / raw) To: guix-devel; +Cc: grub-devel Hi, everybody! After taking a deeper look into our (guix's) grub installation procedure, I have the thought that it could be a neat idea to make the boot directory an actual derivation instead something of the global status. From what I currently understand: - boot.img/core.img and load.cfg: The written images must be replaced on each installation. This is one task performed by grub-install. - /boot/grub/*: The contents of these folders should be reproducible, such as the modules or the localization binaries, as currently grub.cfg is. This is the other task performed by grub-install. - /boot/grub/grubenv: IIUC, this file must be writable by grub. This should not be on the store, and not sharing the path may be the main problem right now to implement this. AFAIK, the grubenv problem requires a modification of the grub code if we try to use a different path for this kind-of-modifiable file, so this would require modify grub to being able to lookup for that file somewhere else. This way the global state can be made explicit. The image installation into the device is a separate issue from the binaries installation, that could be separated into two separate binaries, or two steps/flags for grub-install, one for binaries installation into ${boot-directory}/grub and the other one for load.cfg generation and core/boot.img installation. To everyone: Are you aware of any other way to achieve this? What do you think? To grub-devel: I'd be able to send patches for the latter if you think it is a good idea without help, but I guess that the first kind of modification would need some and deeper study of grub code. To guix-devel: Even though the procedure I have in mind needs changes in grub, there are alternative ways to achieve this with the current tools, as copying the files and using the installation as an "implicit" guix-challenge, but they are not as neat an clean as the split between reproducible binaries installation and global state, which includes the disk preparation for the load of the bootloader. Happy hacking to all! Miguel _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Reproducible grub-install 2019-10-21 14:30 Reproducible grub-install Miguel Arruga Vivas @ 2019-10-23 9:09 ` Daniel Kiper 2019-10-28 11:25 ` Granularity of grub-install (was Re: Reproducibility of grub-install) Miguel Arruga Vivas 0 siblings, 1 reply; 3+ messages in thread From: Daniel Kiper @ 2019-10-23 9:09 UTC (permalink / raw) To: Miguel Arruga Vivas; +Cc: guix-devel, grub-devel On Mon, Oct 21, 2019 at 04:30:21PM +0200, Miguel Arruga Vivas wrote: > Hi, everybody! > > After taking a deeper look into our (guix's) grub installation > procedure, I have the thought that it could be a neat idea to make the > boot directory an actual derivation instead something of the global > status. I do not understand what you mean by "make the boot directory an actual derivation instead something of the global status". Could you elaborate more about that? > From what I currently understand: > > - boot.img/core.img and load.cfg: The written images must be replaced > on each installation. This is one task performed by grub-install. Yep. > - /boot/grub/*: The contents of these folders should be reproducible, > such as the modules or the localization binaries, as currently > grub.cfg is. This is the other task performed by grub-install. I am not sure why grub.cfg have to be reproducible. OK, to some extent it has but... > > - /boot/grub/grubenv: IIUC, this file must be writable by grub. This > should not be on the store, and not sharing the path may be the > main problem right now to implement this. I do not understand this. > AFAIK, the grubenv problem requires a modification of the grub code if > we try to use a different path for this kind-of-modifiable file, so this > would require modify grub to being able to lookup for that file > somewhere else. This way the global state can be made explicit. What do you mean by "This way the global state can be made explicit."? > The image installation into the device is a separate issue from the > binaries installation, that could be separated into two separate > binaries, or two steps/flags for grub-install, one for binaries > installation into ${boot-directory}/grub and the other one for load.cfg > generation and core/boot.img installation. Why do you need to separate this thing into two steps? > To everyone: Are you aware of any other way to achieve this? What do > you think? > > To grub-devel: I'd be able to send patches for the latter if you think Patches are always welcome... > it is a good idea without help, but I guess that the first kind of > modification would need some and deeper study of grub code. > Yep... Daniel _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel ^ permalink raw reply [flat|nested] 3+ messages in thread
* Granularity of grub-install (was Re: Reproducibility of grub-install) 2019-10-23 9:09 ` Daniel Kiper @ 2019-10-28 11:25 ` Miguel Arruga Vivas 0 siblings, 0 replies; 3+ messages in thread From: Miguel Arruga Vivas @ 2019-10-28 11:25 UTC (permalink / raw) To: Daniel Kiper; +Cc: guix-devel, grub-devel Hi, First of all, thank you for your comments. My answers are inline, although the bad subject was a main issue of misunderstanding. I changed it, as I think it reflects better my current idea. I'm sorry for the confusion it certainly caused. Wed, 23 Oct 2019 11:09:07 +0200 Daniel Kiper <dkiper@net-space.pl> wrote: > On Mon, Oct 21, 2019 at 04:30:21PM +0200, Miguel Arruga Vivas wrote: > > Hi, everybody! > > > > After taking a deeper look into our (guix's) grub installation > > procedure, I have the thought that it could be a neat idea to make > > the boot directory an actual derivation instead something of the > > global status. > > I do not understand what you mean by "make the boot directory an > actual derivation instead something of the global status". Could you > elaborate more about that? Currently, the /boot directory is partially a system-wide directory, even though most of its contents are direct copies of the ones from grub's installation prefix: /usr/... in most distributions including BSD world, /{nix,gnu}/store/<hash>-grub-2.04 in Nix/Guix. Most of its contents don't depend at all on the actual machine and that can be shared between machine-dependent boot-sector/efi-variables "activations". These contents include all grub modules and message object files. On the other hand, the task of the platform-specific installation cannot be "shared", as it must be performed directly "on the metal". And there is a third task between these two: the generation of the raw image, that depends on the hardware configuration through the provided configuration file *and* the binary installation. > (...) > I am not sure why grub.cfg have to be reproducible. OK, to some extent > it has but... Guix doesn't generate grub.cfg through grub-mkconfig, as each kernel is also associated with the configuration for the init system too--GNU Shepherd in Guix--, and one kernel may boot up different systems, so it is generated with Guile scripts. My understanding is that grub-mkconfig is a portable tool, not only intended for this case, whose output is system dependant. I mixed up concepts here, sorry. > > > > - /boot/grub/grubenv: IIUC, this file must be writable by grub. > > This should not be on the store, and not sharing the path may be the > > main problem right now to implement this. > > I do not understand this. > > > AFAIK, the grubenv problem requires a modification of the grub code > > if we try to use a different path for this kind-of-modifiable file, > > so this would require modify grub to being able to lookup for that > > file somewhere else. This way the global state can be made > > explicit. > > What do you mean by "This way the global state can be made explicit."? Sorry again. We do not use load_env nor save_env in our configuration. I misunderstood the creation in grub-install.c as a hidden requirement for it, but I'd just had to read the manual. That global state already is explicit enough. I think now that its creation should be optional, even though it's created by default as grub-mkconfig makes use of it. Should I send a patch for it? > > The image installation into the device is a separate issue from the > > binaries installation, that could be separated into two separate > > binaries, or two steps/flags for grub-install, one for binaries > > installation into ${boot-directory}/grub and the other one for > > load.cfg generation and core/boot.img installation. > > Why do you need to separate this thing into two steps? I'd like being able to have different grub /boot-like folders, maybe through unions in the file system (as hard links) of the shared contents and the physical system dependencies, and activate them selectively without writing into them any more. This is intended for Guix's store[1], but other use cases are possible, in order to roll-back to a previous generation of the system by only writing core.img/grub.efi/etc. into platform-dependant locations. As I said before, I see them now as three steps. The middle one is already there with grub-mkimage. The bios-like installation can be performed with grub-setup, but EFI systems need grub-install to copy the image and activate it, the reason behind grub-setup deprecation if I understand the code correctly. And the copy of the correct files to the boot-directory needs no modification at all of grub-install. > > To grub-devel: I'd be able to send patches for the latter if you > > think > > Patches are always welcome... I'll send just to grub-devel following this mail a patch for a minor problem I've found reading the code. The code for an --only-platform-installation flag (the name I'm using right now) needs more work but I'll send it as soon as I have something I've tested on x86 BIOS and x86_64 EFI. From my current understanding it would replace completely grub-setup, wouldn't it? Happy hacking! Miguel [1] https://guix.gnu.org/manual/en/html_node/Features.html ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-28 11:28 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-10-21 14:30 Reproducible grub-install Miguel Arruga Vivas 2019-10-23 9:09 ` Daniel Kiper 2019-10-28 11:25 ` Granularity of grub-install (was Re: Reproducibility of grub-install) Miguel Arruga Vivas
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/guix.git 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 read-only IMAP folder(s) and NNTP newsgroup(s).