[PATCH] Allow customised xkeyboard-config package in initrd

OpenSubmitted by Maxime Devos.
Details
2 participants
  • henkjan gersen
  • Maxime Devos
Owner
unassigned
Severity
normal
M
M
Maxime Devos wrote on 5 Jan 22:37 +0100
(address . guix-patches@gnu.org)
76bcd66b8a02aff74ad75c506d2d11f62bce09d2.camel@telenet.be
Hi Guix!
This patch *should* allow using a custom xkeyboard-configpackage the initrd. (moesasji was interested in such a thingon January the fourth on #guix)‘make check’ doesn't give any error messages. However, I don'thave any custom xkeyboard-config package to test this with,so I'll leave that to interested people.-- Maxime Devos <maximedevos@telenet.be>PGP Key: C1F3 3EE2 0C52 8FDB 7DD7 011F 49E3 EE22 1917 25EEFreenode handle: mdevos
From 85d509121b95d4da7048b045d41d57a2e71efc8f Mon Sep 17 00:00:00 2001From: Maxime Devos <maximedevos@telenet.be>Date: Tue, 5 Jan 2021 22:20:42 +0100Subject: [PATCH] gnu: Allow custom xkeyboard-config package in initrd
* gnu/system/linux-initrd.scm (raw-initrd): New argument xkeyboard-config.* gnu/system/linux-initrd.scm (base-initrd): Likewise.* doc/contributing.texi (raw-initrd): Document new argument.* doc/contributing.texi (base-initrd): Likewise.--- doc/guix.texi | 13 ++++++++++--- gnu/system/linux-initrd.scm | 17 +++++++++++++++-- 2 files changed, 25 insertions(+), 5 deletions(-)
Toggle diff (131 lines)diff --git a/doc/guix.texi b/doc/guix.texiindex 1081ed26a3..e410ccb141 100644--- a/doc/guix.texi+++ b/doc/guix.texi@@ -86,6 +86,7 @@ Copyright @copyright{} 2020 raingloom@* Copyright @copyright{} 2020 Daniel Brooks@* Copyright @copyright{} 2020 John Soo@* Copyright @copyright{} 2020 Jonathan Brielmaier@*+Copyright @copyright{} 2021 Maxime Devos@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or@@ -30631,7 +30632,7 @@ here is how to use it and customize it further. @cindex initial RAM disk @deffn {Scheme Procedure} raw-initrd @var{file-systems} @ [#:linux-modules '()] [#:mapped-devices '()] @- [#:keyboard-layout #f] @+ [#:keyboard-layout #f] [#:xkeyboard-config xkeyboard-config] @ [#:helper-packages '()] [#:qemu-networking? #f] [#:volatile-root? #f] Return a derivation that builds a raw initrd. @var{file-systems} is a list of file systems to be mounted by the initrd, possibly in addition to@@ -30649,6 +30650,9 @@ are set up and before @var{file-systems} are mounted such that, should the user need to enter a passphrase or use the REPL, this happens using the intended keyboard layout. +When @var{xkeyboard-config} is set, it is the @code{xkeyboard-config} package+where @var{keyboard-layout} will be searched for.+ When @var{qemu-networking?} is true, set up networking with the standard QEMU parameters. When @var{virtio?} is true, load additional modules so that the initrd can be used as a QEMU guest with para-virtualized I/O drivers.@@ -30659,8 +30663,8 @@ to it are lost. @deffn {Scheme Procedure} base-initrd @var{file-systems} @ [#:mapped-devices '()] [#:keyboard-layout #f] @- [#:qemu-networking? #f] [#:volatile-root? #f] @- [#:linux-modules '()]+ [#:xkeyboard-config xkeyboard-config] [#:qemu-networking? #f] @+ [#:volatile-root? #f] [#:linux-modules '()] Return as a file-like object a generic initrd, with kernel modules taken from @var{linux}. @var{file-systems} is a list of file-systems to be mounted by the initrd, possibly in addition to the root file system specified@@ -30673,6 +30677,9 @@ are set up and before @var{file-systems} are mounted such that, should the user need to enter a passphrase or use the REPL, this happens using the intended keyboard layout. +When @var{xkeyboard-config} is set, it is the @code{xkeyboard-config} package+where @var{keyboard-layout} will be searched for.+ @var{qemu-networking?} and @var{volatile-root?} behaves as in @code{raw-initrd}. The initrd is automatically populated with all the kernel modules necessarydiff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scmindex c6ba9bb560..64305e5fa6 100644--- a/gnu/system/linux-initrd.scm+++ b/gnu/system/linux-initrd.scm@@ -4,6 +4,7 @@ ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2017, 2019 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>+;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be> ;;; ;;; This file is part of GNU Guix. ;;;@@ -175,6 +176,7 @@ MODULES and taken from LINUX." (mapped-devices '()) (keyboard-layout #f) (helper-packages '())+ (xkeyboard-config xkeyboard-config) qemu-networking? volatile-root? (on-error 'debug))@@ -192,6 +194,9 @@ console keyboard layout. This is done before MAPPED-DEVICES are set up and before FILE-SYSTEMS are mounted such that, should the user need to enter a passphrase or use the REPL, this happens using the intended keyboard layout. +When XKEYBOARD-CONFIG is set, it is the xkeyboard-config package where+the KEYBOARD-LAYOUT will be searched for.+ When QEMU-NETWORKING? is true, set up networking with the standard QEMU parameters. @@ -213,6 +218,10 @@ upon error." (define kodir (flat-linux-module-directory linux linux-modules)) + (define keymap-file+ (and keyboard-layout+ (keyboard-layout->console-keymap+ keyboard-layout #:xkeyboard-config xkeyboard-config))) (expression->initrd (with-imported-modules (source-module-closure '((gnu build linux-boot)@@ -248,8 +257,7 @@ upon error." (and #$@device-mapping-commands)) #:linux-modules '#$linux-modules #:linux-module-directory '#$kodir- #:keymap-file #+(and=> keyboard-layout- keyboard-layout->console-keymap)+ #:keymap-file #+keymap-file #:qemu-guest-networking? #$qemu-networking? #:volatile-root? '#$volatile-root? #:on-error '#$on-error))))@@ -349,6 +357,7 @@ FILE-SYSTEMS." (linux linux-libre) (linux-modules '()) (mapped-devices '())+ (xkeyboard-config xkeyboard-config) (keyboard-layout #f) qemu-networking? volatile-root?@@ -365,6 +374,9 @@ console keyboard layout. This is done before MAPPED-DEVICES are set up and before FILE-SYSTEMS are mounted such that, should the user need to enter a passphrase or use the REPL, this happens using the intended keyboard layout. +When XKEYBOARD-CONFIG is set, it is the xkeyboard-config package where+the KEYBOARD-LAYOUT will be searched for.+ QEMU-NETWORKING? and VOLATILE-ROOT? behaves as in raw-initrd. The initrd is automatically populated with all the kernel modules necessary@@ -392,6 +404,7 @@ loaded at boot time in the order in which they appear." #:linux-modules linux-modules* #:mapped-devices mapped-devices #:helper-packages helper-packages+ #:xkeyboard-config xkeyboard-config #:keyboard-layout keyboard-layout #:qemu-networking? qemu-networking? #:volatile-root? volatile-root?-- 2.29.2
-----BEGIN PGP SIGNATURE-----
iI0EABYIADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCX/TcAhccbWF4aW1lZGV2b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7uxhAQDzuecTtJdlUTlvZY4wv0HgQIZ5vzHM9OsSXUsi7sebrAEAvyVox2E/ZltsRdsDpMrGblLKhvQbXJ9DiPw4xr72TA8==wU5r-----END PGP SIGNATURE-----

H
H
henkjan gersen wrote on 6 Jan 00:27 +0100
(address . maximedevos@telenet.be)(address . guix-patches@gnu.org)
CAGf6y9h=EH3Nnb+DccVE=A3wPzCyov1ss=7wL0VFQWV5iaSMRw@mail.gmail.com
As I triggered this patch with my question on the chat....
Looking at the patch I don't think it does what is intended as thekeymaps defined in xkeyboard-config are in an xkb format and need tobe converted to the correct format to allow them to be loaded in aninitrd. For the console keymap layout ckbcomp is used in keyboard.scmto do this conversion that is then loaded by loadkeys, which is apretty elegant approach. I actually don't know how the keymaps used inan initrd are defined or whether it is even needed to add them as theywouldn't help for the disk decryption password.
Note that my original question was how I could replacexkeyboard-config for a patched version that has my own customizedkeyboard layout included; this does mean that any patch that addskeyboard layouts to initrd can be tested using the standard keyboardlayouts that are available in the "standard" xkeyboard-config. If itworks for existing layouts included it should also work for additionalkeyboard layouts I add to my version of xkeyboard-config.
?