From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id iM16JV4mxV61bAAA0tVLHw (envelope-from ) for ; Wed, 20 May 2020 12:45:18 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id EDdbIV4mxV4MCAAAB5/wlQ (envelope-from ) for ; Wed, 20 May 2020 12:45:18 +0000 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 3A03D940308 for ; Wed, 20 May 2020 12:45:18 +0000 (UTC) Received: from localhost ([::1]:45122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbO61-000427-4u for larch@yhetil.org; Wed, 20 May 2020 08:45:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbO5m-0003p7-IE for guix-patches@gnu.org; Wed, 20 May 2020 08:45:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:40971) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jbO5m-0001PS-7d for guix-patches@gnu.org; Wed, 20 May 2020 08:45:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jbO5m-0008E6-6l for guix-patches@gnu.org; Wed, 20 May 2020 08:45:02 -0400 Subject: bug#37305: [PATCH v3] Allow booting from a Btrfs subvolume Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-To: guix-patches@gnu.org Resent-Date: Wed, 20 May 2020 12:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 37305 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: Pierre Neidhardt , 37305-done@debbugs.gnu.org Mail-Followup-To: 37305@debbugs.gnu.org, maxim.cournoyer@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 37305-done@debbugs.gnu.org id=D37305.158997866231511 (code D ref 37305); Wed, 20 May 2020 12:45:01 +0000 Received: (at 37305-done) by debbugs.gnu.org; 20 May 2020 12:44:22 +0000 Received: from localhost ([127.0.0.1]:52514 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jbO57-0008CA-SN for submit@debbugs.gnu.org; Wed, 20 May 2020 08:44:22 -0400 Received: from mail-qk1-f193.google.com ([209.85.222.193]:35775) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jbO56-0008Bu-T2 for 37305-done@debbugs.gnu.org; Wed, 20 May 2020 08:44:21 -0400 Received: by mail-qk1-f193.google.com with SMTP id f13so3368889qkh.2 for <37305-done@debbugs.gnu.org>; Wed, 20 May 2020 05:44:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-transfer-encoding; bh=sTISLovVsZGcdfTiehcDDmUCB1x4SnoUxZMfVOdtTRQ=; b=BA2gbkItbEWfqb9/e3fAfEhYetFyAb2fu40pasdL3YA9Rg+yua2scOLxAVCr2WOUrg RvP3ePHytbhdnMACUzglQGnFUoW1BNzMs2FoqC2nNAoRlvJhlY182fZPtuSI3UkV8KgU Hk7KEnA9FM+tNBIlmCLckLhVmCoeoZXeUZnrnp3AoMthaMO8J+wL7SyS2aSEJw1/DDQt T2s1fLLyPDqFUma/MFTywSnU7858f9l597MvfFrFszuZSIUpGMIU7g2h3P1NQPIhyggT rBj4BiDgrbmnpR3y9/szqjZCybHdkZMEIUGkdK/t7fju9SYfYyyLErPyXu0TK4OXsMSh kh1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-transfer-encoding; bh=sTISLovVsZGcdfTiehcDDmUCB1x4SnoUxZMfVOdtTRQ=; b=T5a0xCRxgZSZU7fgEqZj3747IT1lilB0jazuQO84r5tswQ/936gNrN+kkPpqRfG6Ht AuTXj+nJIYY8vt4ldK692C3UfKbJZW/QrhpgGlFIRa4qB00OMkiUaJCNQAnWUVVUVW3i +8CJQtmyJNrCEdLNW0vQgfR1kpjI/Nuy63fMTHOpIiCZ7Cef89mk3z/BZT/55Oi862GX P+cUgnzUkKLzGwNnXc0ZcAYczwS2Tfn2g0O0/x2ZJxmgc/vDg/moKQzYFt9nnio7YU1t AjefA0c4CSi9I5ZoX4OsWpDzihLSxkPsfVemmkz4KCexNkXTaBxV/QTibW7gLEgbC/AC xk+A== X-Gm-Message-State: AOAM53188TJdfqWatL7miIb3UlbCwzfzJVEPZbSEiKrg0DWAepJxOlug Q7/PxNvFF3Orj1nw/XKgQuSPG913E8o= X-Google-Smtp-Source: ABdhPJyuCXc+r56Fq5BBLT7OUJ9noaW3EU3LQ3pDSnN6SUoVzd5pUxLYYUu70nwPtqWe8UUGDQUPEw== X-Received: by 2002:a05:620a:1184:: with SMTP id b4mr4242078qkk.364.1589978655183; Wed, 20 May 2020 05:44:15 -0700 (PDT) Received: from hurd (dsl-10-130-184.b2b2c.ca. [72.10.130.184]) by smtp.gmail.com with ESMTPSA id x14sm868218qkb.67.2020.05.20.05.44.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2020 05:44:14 -0700 (PDT) From: Maxim Cournoyer In-Reply-To: <87y2pohpqx.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Mon, 18 May 2020 23:55:50 +0200") References: <875zg2xtsb.fsf@gmail.com> <87lfoxbn2e.fsf@gnu.org> <87v9n1pts1.fsf@raisin.i-did-not-set--mail-host-address--so-tickle-me> <87o8qmheqm.fsf@ambrevar.xyz> <874ksebkup.fsf_-_@gmail.com> <87y2pohpqx.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Date: Wed, 20 May 2020 08:44:13 -0400 Message-ID: <87v9kqpyhu.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=BA2gbkIt; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: z/5idR7gaZ9J Hi Ludovic! Ludovic Court=C3=A8s writes: > Hi Maxim, > > Sorry for dropping the ball for sooo long. No worries :-) > Maxim Cournoyer skribis: [...] >> +++ b/gnu/build/linux-boot.scm >> @@ -498,25 +498,13 @@ upon error." >> (define (root-mount-point? fs) >> (string=3D? (file-system-mount-point fs) "/")) >>=20=20 >> - (define root-fs-type >> - (or (any (lambda (fs) >> - (and (root-mount-point? fs) >> - (file-system-type fs))) >> - mounts) >> - "ext4")) >> - >> - (define root-fs-flags >> - (mount-flags->bit-mask (or (any (lambda (fs) >> - (and (root-mount-point? fs) >> - (file-system-flags fs))) >> - mounts) >> - '()))) >> - >> - (define root-fs-options >> - (any (lambda (fs) >> - (and (root-mount-point? fs) >> - (file-system-options fs))) >> - mounts)) > > [...] > >> + (root-fs (find root-mount-point? mounts)) >> + (root-fs-type (or (and=3D> root-fs file-system-type) >> + "ext4")) >> + (root-fs-device (and=3D> root-fs file-system-device)) >> + (root-fs-flags (mount-flags->bit-mask >> + (or (and=3D> root-fs file-system-flags) >> + '()))) >> + (root-options (if root-fs >> + (file-system-options root-fs) >> + #f)) > > I would tend to keep these as defines to make the =E2=80=98let*=E2=80=99 = less > intimidating, but it=E2=80=99s a detail. It would only *appear* less intimidating ;-). I personally prefer the let* versions as the logic is more succinctly expressed (there is no need for 'any' + lambdas, for example). >> + ;; XXX: Importing (guix utils) and using &fix-hint causes the >> + ;; following error when booting the init RAM disk: "ERROR: In >> + ;; procedure dynamic-func:\nIn procedure dynamic-pointer: Symbo= l not >> + ;; found: strverscmp", so we just embed the hint in the message. > > I think it should just be =E2=80=9CFIXME: Use &fix-hint once it no longer= pulls > in (guix utils).=E2=80=9D Done! >>>>From 082934db68964890ebd2a2118fb44d66911844d3 Mon Sep 17 00:00:00 2001 >> From: Maxim Cournoyer >> Date: Sun, 14 Jul 2019 20:50:23 +0900 >> Subject: [PATCH 4/4] bootloader: grub: Allow booting from a Btrfs subvol= ume. >> >> * gnu/bootloader/grub.scm (strip-mount-point): Remove procedure. >> (normalize-file): Add procedure. >> (grub-configuration-file): New BTRFS-SUBVOLUME-FILE-NAME parameter. When >> defined, prepend its value to the kernel and initrd file names, using the >> NORMALIZE-FILE procedure. Adjust the call to EYE-CANDY to pass the >> BTRFS-SUBVOLUME-FILE-NAME argument. Normalize the KEYMAP file as well. >> (eye-candy): Add a BTRFS-SUBVOLUME-FILE-NAME parameter, and use it, alon= g with >> the NORMALIZE-FILE procedure, to normalize the FONT-FILE and IMAGE nested >> variables. Adjust doc. >> * gnu/bootloader/depthcharge.scm (depthcharge-configuration-file): Adapt. >> * gnu/bootloader/extlinux.scm (extlinux-configuration-file): Likewise. >> * gnu/system/file-systems.scm (btrfs-subvolume?) >> (btrfs-store-subvolume-file-name): New procedures. >> * gnu/system.scm (operating-system-bootcfg): Specify the Btrfs >> subvolume file name the store resides on to the >> `operating-system-bootcfg' procedure, using the new >> BTRFS-SUBVOLUME-FILE-NAME argument. >> * doc/guix.texi (File Systems): Add a Btrfs subsection to document the u= se of >> subvolumes. >> * gnu/tests/install.scm: Add test "btrfs-root-on-subvolume-os". > > Please list the entities added to =E2=80=98install.scm=E2=80=99. Done! >> (define* (eye-candy config store-device store-mount-point >> + btrfs-store-subvolume-file-name >> #:key system port) > > I think =E2=80=98btrfs-store-subvolume-file-name=E2=80=99 should be a key= word argument. Done! >> (define* (grub-configuration-file config entries >> #:key >> (system (%current-system)) >> - (old-entries '())) >> + (old-entries '()) >> + btrfs-subvolume-file-name) > > I wonder if we should just call it =E2=80=98store-directory-prefix=E2=80= =99 or similar > since, after all, it=E2=80=99s just about prepending a prefix, which could > perhaps be useful for file systems other than Btrfs. > > Thoughts? Perhaps, but given it's not yet clear whether another file system will require similar support from GRUB, I'd rather keep things as explicit as possible for now. > Anyway, that=E2=80=99s great work, so I=E2=80=99ll be happy to finally se= e it committed > in the coming days! Thanks for the great words and for having a last look :-). I've added a news entry and pushed to master as: --8<---------------cut here---------------start------------->8--- 489699c456 allow-booting-from-btrfs-subvolume news: Add entry for Btrfs sub= volume boot support. b460ba7992 bootloader: grub: Allow booting from a Btrfs subvolume. fa35fb58c8 file-systems: Add helpers for parsing the options string into an= alist. 281d80d8e5 linux-boot: Refactor boot-system. --8<---------------cut here---------------end--------------->8--- Closing! Thanks to Pierre and Ludovic for testing and reviewing. Maxim