[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with writing custom boot-loader configuration

From: Timothy Sample
Subject: Re: Help with writing custom boot-loader configuration
Date: Mon, 03 Jun 2019 20:49:51 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

Hi Raghav,

Raghav Gururajan <address@hidden> writes:

> On Thu, 2019-05-30 at 10:11 +0000, Raghav Gururajan wrote:
>> Hello Guix!
>> If I want to make the "grub-bootloader" to invoke ONLY
>> "grub-mkconfig" and NOT "grub-install", how should I modify the
>> "bootloader" part of "operating-system" section of system
>> configuration (config.scm)? I am looking for exact Guile Scheme Code
>> to achieve the same.
>> Thank you!
>> Regards,
>> RG.
> Hello Ludo and Rekado!
> May be with your expertise in Guile Scheme, can you please help me with the
> above?

Putting together “exact Guile Scheme Code” is a lot to ask, but I can
give you the following.  You will have to adjust it appropriately if,
for example, you are not using EFI.  Note also that this is untested,
but it is certainly close.

What you want to do is create a custom bootloader that behaves just like
GRUB except for the “installer”.  In Guix, each bootloader is defined by
a “bootloader” record.  Part of that record is an “installer” field,
which tells Guix how to install the bootloader onto the system.

In addition to whatever else you use for your config file, you will need
the following modules:

    (use-modules (gnu)
                 (guix gexp))

Now you can make your custom bootloader:

    (define grub-efi-bootloader-sans-install
       (inherit grub-efi-bootloader)
       (installer #~(const #t))))

Here, “(const #t)” tells Guile to create a function that always returns
“#t”, which means “true”.  The “#~” part introduces a G-expression,
which is a handy way to write code that is intended to be run from the
build environment.

Finally, this should work as part of your configuration:

      ;; ...
      (bootloader (bootloader-configuration
                   ;; ...
                   (bootloader grub-efi-bootloader-sans-install))

That is, you need to change your “bootloader-configuration” to use your
new custom bootloader.

I hope that helps!

-- Tim

reply via email to

[Prev in Thread] Current Thread [Next in Thread]