From patchwork Tue Jan 5 21:37:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: M X-Patchwork-Id: 26233 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 862C127BC0D; Tue, 5 Jan 2021 21:38:10 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6A48C27BC0C for ; Tue, 5 Jan 2021 21:38:09 +0000 (GMT) Received: from localhost ([::1]:58790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwu1o-0004tZ-Gr for patchwork@mira.cbaines.net; Tue, 05 Jan 2021 16:38:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58698) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwu1i-0004tM-Ke for guix-patches@gnu.org; Tue, 05 Jan 2021 16:38:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:59524) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kwu1i-0006XU-DB for guix-patches@gnu.org; Tue, 05 Jan 2021 16:38:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kwu1i-0007mf-8N for guix-patches@gnu.org; Tue, 05 Jan 2021 16:38:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#45680] [PATCH] Allow customised xkeyboard-config package in initrd Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 05 Jan 2021 21:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 45680 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 45680@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.160988266729898 (code B ref -1); Tue, 05 Jan 2021 21:38:02 +0000 Received: (at submit) by debbugs.gnu.org; 5 Jan 2021 21:37:47 +0000 Received: from localhost ([127.0.0.1]:42837 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kwu1T-0007mA-41 for submit@debbugs.gnu.org; Tue, 05 Jan 2021 16:37:47 -0500 Received: from lists.gnu.org ([209.51.188.17]:52936) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kwu1O-0007lz-41 for submit@debbugs.gnu.org; Tue, 05 Jan 2021 16:37:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58646) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwu1N-0004rt-65 for guix-patches@gnu.org; Tue, 05 Jan 2021 16:37:41 -0500 Received: from andre.telenet-ops.be ([2a02:1800:120:4::f00:15]:49696) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kwu1G-0006Q1-DB for guix-patches@gnu.org; Tue, 05 Jan 2021 16:37:40 -0500 Received: from ptr-bvsjgyjmffd7q9timvx.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d]) by andre.telenet-ops.be with bizsmtp id D9dG2400A0mfAB4019dUUU; Tue, 05 Jan 2021 22:37:29 +0100 Message-ID: <76bcd66b8a02aff74ad75c506d2d11f62bce09d2.camel@telenet.be> From: Maxime Devos Date: Tue, 05 Jan 2021 22:37:06 +0100 User-Agent: Evolution 3.34.2 MIME-Version: 1.0 Received-SPF: pass client-ip=2a02:1800:120:4::f00:15; envelope-from=maximedevos@telenet.be; helo=andre.telenet-ops.be X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Hi Guix! This patch *should* allow using a custom xkeyboard-config package the initrd. (moesasji was interested in such a thing on January the fourth on #guix) ‘make check’ doesn't give any error messages. However, I don't have any custom xkeyboard-config package to test this with, so I'll leave that to interested people. From 85d509121b95d4da7048b045d41d57a2e71efc8f Mon Sep 17 00:00:00 2001 From: Maxime Devos Date: Tue, 5 Jan 2021 22:20:42 +0100 Subject: [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(-) diff --git a/doc/guix.texi b/doc/guix.texi index 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 necessary diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm index c6ba9bb560..64305e5fa6 100644 --- a/gnu/system/linux-initrd.scm +++ b/gnu/system/linux-initrd.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2016 Jan Nieuwenhuizen ;;; Copyright © 2017, 2019 Mathieu Othacehe ;;; Copyright © 2019, 2020 Tobias Geerinckx-Rice +;;; Copyright © 2021 Maxime Devos ;;; ;;; 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