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 KCf5B1QmxV5lVAAA0tVLHw (envelope-from ) for ; Wed, 20 May 2020 12:45:08 +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 aGDjA1QmxV6UBwAAB5/wlQ (envelope-from ) for ; Wed, 20 May 2020 12:45:08 +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 2F2049403EA for ; Wed, 20 May 2020 12:45:07 +0000 (UTC) Received: from localhost ([::1]:44622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbO5q-0003pX-5I for larch@yhetil.org; Wed, 20 May 2020 08:45:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41988) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbO5m-0003oe-5B for guix-patches@gnu.org; Wed, 20 May 2020 08:45:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:40968) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jbO5l-0001Ok-PD for guix-patches@gnu.org; Wed, 20 May 2020 08:45:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jbO5l-0008Do-JR for guix-patches@gnu.org; Wed, 20 May 2020 08:45:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#37305] [PATCH v3] Allow booting from a Btrfs subvolume Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: 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: followup 37305 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: Pierre Neidhardt , 37305@debbugs.gnu.org Received: via spool by 37305-submit@debbugs.gnu.org id=B37305.158997865231483 (code B ref 37305); Wed, 20 May 2020 12:45:01 +0000 Received: (at 37305) by debbugs.gnu.org; 20 May 2020 12:44:12 +0000 Received: from localhost ([127.0.0.1]:52511 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jbO4y-0008Bj-Fq for submit@debbugs.gnu.org; Wed, 20 May 2020 08:44:12 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:45071) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jbO4w-0008BX-Lg for 37305@debbugs.gnu.org; Wed, 20 May 2020 08:44:11 -0400 Received: by mail-qk1-f194.google.com with SMTP id i5so3258958qkl.12 for <37305@debbugs.gnu.org>; Wed, 20 May 2020 05:44:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=sTISLovVsZGcdfTiehcDDmUCB1x4SnoUxZMfVOdtTRQ=; b=ek9iC7Ogfue0neQSRsKTnUi4uWSZxvqE+7KcAVuP+x3amYbzm2yQ4DbTPm+vnGyeFg uxAKXqrPEDwgX9bCWJS2kS1Ah3Wwq2ELXWCR3EZqaPNFHJB8ufxlgVYlFGor0cHG6iti kFhWbSjKkS0PU6tlSp3aiNCPcB221aw7xlCNsPRLp3Mz3UQkm/f4oooHup/9P+osn4HO Vt6Ymu11fwOhn8i+x7WCDKjuOQMdFCARl0lQ3jwvQyaAprqbJNuQoK69akYJhrpFEcu7 Ym3kEPBgvVXih236y9n4rLd9Yx7lCVy1/jk+ZJ5sKkLzz191XBMso7CLPQu280w2+7tA 2/tg== 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:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=sTISLovVsZGcdfTiehcDDmUCB1x4SnoUxZMfVOdtTRQ=; b=tvDyuE5CZtGWiAxEJYzl2p+8//0lO4we7Kbg5GXZDfk9bJE/LyibOEn60GNrva963l ygIJmuICloc2ze2eRVgCKeVGhyfPN207/VxxdIKDvHM7gA5RXJBLapi47UYM3gg3MNyY zYLZu7hl7O0Um5OJS5RQocBtq0IGNbIiyeXrrXFeUnNgnlKt4gfAuL92fN0CA7RDIv0s owCkaHEp0gttGY1jQErBkoiZTuNvXB2jAHMn1OEG01W3+DLgjt2rhZAoX7CijPx8Sok7 OvnQCfwI0IgvYWAYS3pI5ZBuaqP5fJDLWQQw6WS5TX3S2Z8VxjG08GH8eRVywJZAPPI4 AHPw== X-Gm-Message-State: AOAM531rmwrIyUmBVGzsFpnLqF1n5Pwa99oq+UhXoPNLZDh3+PBCbPlc oD1YwbdnX6Lb1nYBdSiyOcB8XfNKbD0= X-Google-Smtp-Source: ABdhPJx18TbSt6VxceHsrFUV5/6qKFxuQhJVXemzi+eBj8MZECZJ2sE3egOet9f0qbjqDP4PoTcmEA== X-Received: by 2002:a05:620a:1305:: with SMTP id o5mr4420967qkj.318.1589978644725; Wed, 20 May 2020 05:44:04 -0700 (PDT) Received: from hurd (dsl-10-130-184.b2b2c.ca. [72.10.130.184]) by smtp.gmail.com with ESMTPSA id z185sm2204091qka.79.2020.05.20.05.44.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2020 05:44:04 -0700 (PDT) From: Maxim Cournoyer 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> Date: Wed, 20 May 2020 08:44:02 -0400 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") Message-ID: <87wo56pyi5.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) 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=ek9iC7Og; 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: Ao2au0qKqCtw 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