unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Timothy Sample <samplet@ngyro.com>
To: Raghav Gururajan <rvgn@disroot.org>
Cc: help-guix@gnu.org
Subject: Re: Help with writing custom boot-loader configuration
Date: Mon, 03 Jun 2019 20:49:51 -0400	[thread overview]
Message-ID: <87v9xmqimo.fsf@ngyro.com> (raw)
In-Reply-To: <34bfe68c4431240cf1ad05c48ecf3d9ae00be787.camel@disroot.org> (Raghav Gururajan's message of "Mon, 03 Jun 2019 19:27:20 -0400")

Hi Raghav,

Raghav Gururajan <rvgn@disroot.org> 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
      (bootloader
       (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:

    (operating-system
      ;; ...
      (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	other threads:[~2019-06-04  0:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30 10:11 Help with writing custom boot-loader configuration Raghav Gururajan
2019-06-03 23:27 ` Raghav Gururajan
2019-06-04  0:49   ` Timothy Sample [this message]
2019-06-04 15:40     ` Raghav Gururajan
2019-06-04  1:15   ` Jack Hill
2019-06-04 15:48     ` Raghav Gururajan
2019-06-05 13:36       ` Timothy Sample
2019-06-05 15:30         ` Raghav Gururajan
2019-06-05 18:01           ` Guix and intrusion detection (was Re: Help with writing custom boot-loader configuration) Giovanni Biscuolo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v9xmqimo.fsf@ngyro.com \
    --to=samplet@ngyro.com \
    --cc=help-guix@gnu.org \
    --cc=rvgn@disroot.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).