From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id aGirGsce82Z1HQAAe85BDQ:P1 (envelope-from ) for ; Tue, 24 Sep 2024 20:19:19 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id aGirGsce82Z1HQAAe85BDQ (envelope-from ) for ; Tue, 24 Sep 2024 22:19:19 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=o9VHFv21; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=O0iyEOT8; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1727209159; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=R3CdBCZGFb2Ww409WdRHIFYp5Y3EjOJkHKH9fBEK9iY=; b=Vgg3KNl7v3cHgwK9RgNNJiRDaps/bDRN59YI+G8TzW0xc2q0Aky/4F2BYhWm+gQyE05nMX /Fti8BX7kToNmOw/FgmTPoaKmdhW6r/YHQGWdBLBsBnfc0EFRHn6zTYzY/Ffh8R6Rzk8Mw TZ3nASuPd1uxapA9WK9tVyYiEqv9gHwe29GVHNoDktOXRIPRldSV0324TzjyTMRA1taxe3 RJ6jy90sO5RRSW+jTcJYnfkJ/wBcMb7XgMxd0N4IJL0WmFwfxBDuhQmBrrnvxfoAgGDnny RshyrgFI3bBJRyYQ86ujo4LDqAnIQvoF1HJVtuAEx/f3JkL8qlHUaONZ7+TzZg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=o9VHFv21; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=O0iyEOT8; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1727209159; a=rsa-sha256; cv=none; b=iYv89X3NV9/xlIgtC9RzMz6Xez2i2oFE4xtD1OlCgzjW7dzQo5y4Pl9KAz4hDBGqGnpbk9 L4q4tMHNrJdVleP/pL+dQyIlgEKGtp0laxAYnEVTs4pRMLUiz3O2SunUklknxVvr1LeMDH NlXZQ4Lnh507bxliBNwNcsyqiyEKPwU0i7P3+5WfTWdZWm3DOFy0LaYBLDOVbzwxFzOBaj ZhnhuY+1AbIkSEVWvNwvFjzJ1kXopRYugNq0pzUSGEH8P35Gz8H93p5PDl9b9UVJAlo/cC 8+O0Az9j67cAU3aI0QsGLvRgBQk3UPBuZD/o3z7+P/aqCOXsIVpkyGX0UM2vig== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 039F06842D for ; Tue, 24 Sep 2024 22:19:19 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stBze-0004AI-Vf; Tue, 24 Sep 2024 16:18:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1stBzd-00043O-H1 for guix-patches@gnu.org; Tue, 24 Sep 2024 16:18:41 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1stBzd-0002k3-5D for guix-patches@gnu.org; Tue, 24 Sep 2024 16:18:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=1hm/xcF+Q2gVrnFqf50qcimdK8Frpa9KuUL0q26pgnA=; b=o9VHFv215/tC9XjX/gDsXeU5X/GTZ22bQis7NXyg+wQNfaUK5tyV12vHER+2dVnhO2St9cmkQbLum+yMAWON/Wrf1rQgzlcX+0jg/HJnb02mix+iEeQSwtTovQssjl3xWZMOe5RJYbeo7gW86fZPCBYCM+3CrtumuhUGU1iGVDNTwNnOSXoZV7Tyk1se2RdmTCApkK7o03ABMNbSc3w25zhW47Jfm6EtoH7FyshPAbIWMtvDg2VuZqfjRGn5b5LHfsOyzIZglcD3BkGrtA/wwP0VXYIiVYj2rxxnd8wIT50wt4ZcvHqLiDutKH62x7FKxbEvP6+eyTstvIzavurthA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stC01-0004mW-TN; Tue, 24 Sep 2024 16:19:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#72457] [PATCH v6 07/12] gnu: bootloader: extlinux: Rewrite completely. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: lilah@lunabee.space, guix-patches@gnu.org Resent-Date: Tue, 24 Sep 2024 20:19:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72457 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 72457@debbugs.gnu.org Cc: Lilah Tascheter , Lilah Tascheter X-Debbugs-Original-Xcc: Lilah Tascheter Received: via spool by 72457-submit@debbugs.gnu.org id=B72457.172720913218294 (code B ref 72457); Tue, 24 Sep 2024 20:19:05 +0000 Received: (at 72457) by debbugs.gnu.org; 24 Sep 2024 20:18:52 +0000 Received: from localhost ([127.0.0.1]:38427 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stBzn-0004ku-Bh for submit@debbugs.gnu.org; Tue, 24 Sep 2024 16:18:51 -0400 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:39007 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stBzc-0004iX-6d for 72457@debbugs.gnu.org; Tue, 24 Sep 2024 16:18:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1727202615; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R3CdBCZGFb2Ww409WdRHIFYp5Y3EjOJkHKH9fBEK9iY=; b=O0iyEOT8CJMvhL7KR6aw4ARsb5t/87X+vHQ8JYRrgc0JUe4WDGab52rGOH2DRuU9dKNkYc AbDO+6H+NTpjn3lrIi3Z3Niu9zvrc1BHkULZzFio93K9qf5CjPmUn6g1q+0DowMxXNDKdb IuXgqwvsDZNjbnPMyeOegznDM7SuTcUEkuvgWnfoLfkVp2cZwyWHUKGaCTNcHfTnQpeZfn 9iT4616Oe0r8DCDiPWq1Hfri8RScfAgONk/5Sf99X7zdGUAkk8g1QS/Lyrd9rmaFYCYHk3 XXrznIOOXF0pXd0a6RyMYTGtHxP/r4zrTdxm7A9D+Mbtl0sOXKpiSmPMijByZg== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id c7df6406 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Tue, 24 Sep 2024 18:30:14 +0000 (UTC) Date: Tue, 24 Sep 2024 20:29:14 +0200 Message-ID: <642e6621c5881c511e7d4263a9fdb9f0183f253e.1727201267.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches From: Herman Rimm via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: 039F06842D X-Migadu-Scanner: mx11.migadu.com X-Spam-Score: -7.02 X-Migadu-Spam-Score: -7.02 X-TUID: yoSPRirz9wMn From: Lilah Tascheter * gnu/bootloader/extlinux.scm (install-extlinux-config): Add procedure. (extlinux-configuration-file): Delete procedure. (install-extlinux): Use install-extlinux-config. (install-extlinux-mbr, install-extlinux-gpt): Delete variables. (extlinux-bootloader): Update to new bootloader record. (extlinux-gpt-bootloader): Update extlinux-bootloader-gpt to this. (extlinux-bootloader-gpt): Deprecate variable. * gnu/tests/install.scm (%minimal-extlinux-os)[bootloader]: Use proper extlinux variable. Change-Id: I3654d160f7306bb45a78b82ea6b249ff4281f739 --- gnu/bootloader/extlinux.scm | 153 ++++++++++++++++++------------------ gnu/tests/install.scm | 2 +- 2 files changed, 76 insertions(+), 79 deletions(-) diff --git a/gnu/bootloader/extlinux.scm b/gnu/bootloader/extlinux.scm index d9b6d8bf8a..d2bf3f2cca 100644 --- a/gnu/bootloader/extlinux.scm +++ b/gnu/bootloader/extlinux.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2017 David Craven ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2022 Reza Alizadeh Majd +;;; Copyright © 2024 Lilah Tascheter ;;; ;;; This file is part of GNU Guix. ;;; @@ -21,112 +22,108 @@ (define-module (gnu bootloader extlinux) #:use-module (gnu bootloader) #:use-module (gnu packages bootloaders) + #:use-module (gnu system boot) #:use-module (guix gexp) + #:use-module (guix deprecation) + #:use-module (guix records) #:use-module (guix utils) - #:export (extlinux-bootloader + #:export (install-extlinux-config ; for u-boot + extlinux-bootloader + extlinux-gpt-bootloader extlinux-bootloader-gpt)) -(define* (extlinux-configuration-file config entries - #:key - (system (%current-system)) - (old-entries '()) - #:allow-other-keys) - "Return the U-Boot configuration file corresponding to CONFIG, a - object, and where the store is available at STORE-FS, a - object. OLD-ENTRIES is taken to be a list of menu entries -corresponding to old generations of the system." - - (define all-entries - (append entries (bootloader-configuration-menu-entries config))) - - (define with-fdtdir? - (bootloader-configuration-device-tree-support? config)) + +;;; +;;; Config procedures. +;;; - (define (menu-entry->gexp entry) - (let ((label (menu-entry-label entry)) - (kernel (menu-entry-linux entry)) - (kernel-arguments (menu-entry-linux-arguments entry)) - (initrd (menu-entry-initrd entry))) - #~(format port "LABEL ~a +(define* (install-extlinux-config #:key bootloader-config + current-boot-alternative + old-boot-alternatives + #:allow-other-keys) + "Installer for the extlinux configuration file, meant to be shared by +all bootloaders that use the format to specify boot options." + (match-bootloader-configuration + bootloader-config + (targets menu-entries device-tree-support? timeout) + (define (menu-entry->gexp entry) + (match-menu-entry entry (label linux linux-arguments initrd) + (let* ((linux (normalize-file entry linux)) + (fdt #~(string-append "FDTDIR " (dirname #$linux) "/lib/dtbs"))) + #~(format port "LABEL ~a MENU LABEL ~a KERNEL ~a ~a INITRD ~a APPEND ~a ~%" - #$label #$label - #$kernel - (if #$with-fdtdir? - (string-append "FDTDIR " (dirname #$kernel) "/lib/dtbs") - "") - #$initrd - (string-join (list #$@kernel-arguments))))) - - (define builder - #~(call-with-output-file #$output - (lambda (port) - (let ((timeout #$(bootloader-configuration-timeout config))) - (format port "# This file was generated from your Guix configuration. Any changes + #$label #$label #$linux + #$(if device-tree-support? fdt "") + #$(normalize-file entry initrd) + (string-join (list #$@linux-arguments)))))) + + (let ((entries (cons (boot-alternative->menu-entry + current-boot-alternative) + (append menu-entries + (map boot-alternative->menu-entry + old-boot-alternatives))))) + (with-targets targets + (('extlinux => (path :path)) + #~(begin + (mkdir-p #$path) + (call-with-output-file #$(string-append path + "/extlinux.conf") + (lambda (port) + (format port "\ +# This file was generated from your Guix configuration. Any changes # will be lost upon reconfiguration. UI menu.c32 MENU TITLE GNU Guix Boot Options PROMPT ~a -TIMEOUT ~a~%" - (if (> timeout 0) 1 0) - ;; timeout is expressed in 1/10s of seconds. - (* 10 timeout)) - #$@(map menu-entry->gexp all-entries) - - #$@(if (pair? old-entries) - #~((format port "~%") - #$@(map menu-entry->gexp old-entries) - (format port "~%")) - #~()))))) - - (computed-file "extlinux.conf" builder - #:options '(#:local-build? #t - #:substitutable? #f))) - +TIMEOUT ~a~%" ; Timeout is expressed in tenths of a second. + #$(if (> timeout 0) 1 0) #$(* 10 timeout)) + #$@(map menu-entry->gexp entries))))))))) - ;;; -;;; Install procedures. +;;; Install procedure. ;;; (define (install-extlinux mbr) - #~(lambda (bootloader device mount-point) - (let ((extlinux (string-append bootloader "/sbin/extlinux")) - (install-dir (string-append mount-point "/boot/extlinux")) - (syslinux-dir (string-append bootloader "/share/syslinux"))) - (for-each (lambda (file) - (install-file file install-dir)) - (find-files syslinux-dir "\\.c32$")) - (invoke/quiet extlinux "--install" install-dir) - (write-file-on-device (string-append syslinux-dir "/" #$mbr) - 440 device 0)))) - -(define install-extlinux-mbr - (install-extlinux "mbr.bin")) + (lambda* (#:key bootloader-config #:allow-other-keys . args) + (with-targets (bootloader-configuration-targets bootloader-config) + (('extlinux => (path :path)) + #~(begin + #$(apply install-extlinux-config args) + (copy-recursively #$(file-append syslinux "/share/syslinux") #$path) + (invoke/quiet #+(file-append syslinux "/sbin/extlinux") + "--install" #$path))) + (('disk => (disk :device)) + #~(write-file-on-device #$(file-append syslinux "/share/syslinux/" mbr) + 440 #$disk 0))))) -(define install-extlinux-gpt - (install-extlinux "gptmbr.bin")) - ;;; ;;; Bootloader definitions. ;;; (define extlinux-bootloader (bootloader - (name 'extlinux) - (package syslinux) - (installer install-extlinux-mbr) - (configuration-file "/boot/extlinux/extlinux.conf") - (configuration-file-generator extlinux-configuration-file))) - -(define extlinux-bootloader-gpt + (name 'extlinux) + (default-targets (list (bootloader-target + (type 'install) + (offset 'root) + (path "boot")) + (bootloader-target + (type 'extlinux) + (offset 'install) + (path "extlinux")))) + (installer (install-extlinux "mbr.bin")))) + +(define extlinux-gpt-bootloader (bootloader - (inherit extlinux-bootloader) - (installer install-extlinux-gpt))) + (inherit extlinux-bootloader) + (installer (install-extlinux "gptmbr.bin")))) + +(define-deprecated/alias extlinux-bootloader-gpt extlinux-gpt-bootloader) diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm index 36dbd9111f..57b2a77414 100644 --- a/gnu/tests/install.scm +++ b/gnu/tests/install.scm @@ -140,7 +140,7 @@ (define-os-with-source (%minimal-extlinux-os (locale "en_US.UTF-8") (bootloader (bootloader-configuration - (bootloader extlinux-bootloader-gpt) + (bootloader extlinux-gpt-bootloader) (targets (list "/dev/vdb")))) (kernel-arguments '("console=ttyS0")) (file-systems (cons (file-system -- 2.45.2