From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1f8JII-0007P1-5e for mharc-grub-devel@gnu.org; Tue, 17 Apr 2018 01:36:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33134) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f8JIE-0007NA-Uy for grub-devel@gnu.org; Tue, 17 Apr 2018 01:36:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f8JID-000705-Ih for grub-devel@gnu.org; Tue, 17 Apr 2018 01:36:38 -0400 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]:39296) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f8JID-0006yU-8y for grub-devel@gnu.org; Tue, 17 Apr 2018 01:36:37 -0400 Received: by mail-pl0-x242.google.com with SMTP id e7-v6so11362763plt.6 for ; Mon, 16 Apr 2018 22:36:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=4stDRFHpz6JjbK0WSqeR1pYQDge6xM6EPxoQ7TsOcmI=; b=sxJbpSNbEyBOH5Tzq9Q85JjQg61oXCtlmZ8FGeNznxKMXyXhI1JA2luhZlyhcfTRoq nZGUQCgUxtRwgJ/jS0AFyvhoOL2N7ZD0tzpLikVmB85gnRuvt7q6TUI41ZJqHmoXhy5Y CEY/FeMA83qSefHvV4K1PhzHo1PKfDENBc2tk8dVk9Kk0VJsIyVWhMS3SVRX3QNDYtY1 jq6DH18K708MrQv0t8AA8D2+zBuPGLma+aX7zDcfH9hxXfH4KCtm4bwmmai5sNYi1ZDN 8+dUYrivoj0TY+xqfu00YacNxyGeZDANHId+2zobtc9wUW2xL/QTeP8mn5WwZVYjZTQQ lejA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=4stDRFHpz6JjbK0WSqeR1pYQDge6xM6EPxoQ7TsOcmI=; b=Z66iyxwCPRjXlpPmNzl2WRJudvvBCvEGPu4fKkpjWOWVDS3n/5AlDgxWWeUkt1H48u XO6DUJIXcLqfL41fw07mSEmwJSTL+29jHBBdcEr/99UF0xBjuwmZ2IC1y7uweTaxzSQr zGbMRpSY2s3ded4zmSCy91PRckd2vSPNoF7WlWMPXJrPEP12Q6jkFWQ64rKl4Zf7OG0Z YjWgFuFuB+PXBjct04czhAOMm90pPERfNqjoczSRxwM/bH1QcUtYAup24CsAkfq1+t+V 6chNL8IIT3rINeatUd9Cv1ndIlCoI7Y3r3eQgYEBNqCsm+kdl9keZiBkG/b+GC3UnOwr Xa6g== X-Gm-Message-State: ALQs6tA1H5Fl4jonmNV09PcgB/sMDFvfHqfaNIawHqCLZzSvzxGBspC1 2NIuaFcHYZzriqpU3EJ4FmP9Rw== X-Google-Smtp-Source: AIpwx4/xezvpVPNB642zDzA+8tCgz3h9MIb3R33ey9WfYnVs8bWoUTPpPPvOJvYPbyic8YwN/S/GrA== X-Received: by 2002:a17:902:be15:: with SMTP id r21-v6mr715316pls.237.1523943395647; Mon, 16 Apr 2018 22:36:35 -0700 (PDT) Received: from localhost.localdomain ([2601:602:9c01:e86a:2ec2:3a19:cd81:76ab]) by smtp.googlemail.com with ESMTPSA id f12sm23022435pgr.37.2018.04.16.22.36.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Apr 2018 22:36:34 -0700 (PDT) From: Nicholas Vinson To: grub-devel@gnu.org Subject: [GRUB PARTUUID PATCH V10 0/4] Add PARTUUID detection support Date: Mon, 16 Apr 2018 22:36:22 -0700 Message-Id: X-Mailer: git-send-email 2.17.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::242 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Apr 2018 05:36:40 -0000 Summary of Changes: - Defined print_gpt_puid() - Updated grub-probe.c to use print_gpt_guid() - Renamed struct grub_gpt_part_type to struct grub_gpt_part_guid. - Updated struct typedef to use grub_gpt_part_guid - Replaced grub_gpt_part_type_t type with grub_gpt_part_guid_t in variable declarations. - Changed grub_gpt_partentry.guid from a 16 byte array to grub_gpt_part_guid. - Added PRINT_PARTUUID enum element to enum defined in util/grub-probe.c. - Added "partuuid" string to targets array defined in util/grub-probe.c. - Defined probe_partuuid() function. - Added GRUB_DISABLE_LINUX_PARTUUID item to docs/grub/texi - Defined GRUB_DEVICE_PARTUUID variable util/grub-mkconfig.in - Updated exports to export GRUB_DEVICE_PARTUUID and GRUB_DISABLE_LINUX_PARATUUID variables. - Updated rootfs detection logic in util/grub.d/10_linux.in to favor partition UUIDs when GRUB_DISABLE_LINUX_PARTUUID is not set to 'true' and no initramfs is found (this also includes cases where GRUB_DISABLE_LINUX_PARTUUID is unset) or when an initramfs is found and GRUB_DISABLE_LINUX_UUID is set to 'true'. - Updated rootfs detection logic in util/grub.d/20_linux_xen.in to favor partition UUIDs when GRUB_DISABLE_LINUX_PARTUUID is not set to 'true' and no initramfs is found (this also includes cases where GRUB_DISABLE_LINUX_PARTUUID is unset) or when an initramfs is found and GRUB_DISABLE_LINUX_UUID is set to 'true'. Changes from Patch v9: - Merged optional patch with updage grub script template files patch - Updated util/grub.d/20_linux_xen.in to use new partuuid logic - Updated documentation on GRUB_DISABLE_LINUX_PARTUUID Changes from Patch v8: - Renamed GRUB_ENABLE_LINUX_PARTUUID to GRUB_DISABLE_LINUX_PARTUUID - Updated the 10_linux logic so GRUB_ENABLE_LINUX_PARTUUID and GRUB_ENABLE_LINUX_UUID would behave more independently. - Documented interactions of GRUB_DISABLE_LINUX_UUID, GRUB_DISABLE_LINUX_PARTUUID, and initramfs detection in commit message. - Added optional patch that sets GRUB_DISABLE_LINUX_PARTUUID to true by default. - Fixed merge conflicts between this patchset and upstream's master branch. Changes from Patch v7: - Changed checks in probe_partuuid() to use the variable 'p' instead of disk->partition - Moved 'disk->partition = p;' assignment to inside the 'p & p->parent == NULL' statement - Moved 'disk->partition = p->parent;' assignment to before partmap name checks. - Fixed formatting issues. - Copied Daniel Kiper's reviewed-by line to unaltered patches. Changes from Patch v6: - Corrected spelling and grammatical errors in description text for GRUB_ENABLE_LINUX_PARTUUID - Moved disk->partition save & restore logic to beginning and end of probe_partuuid() - Fixed formatting errors in probe_partuuid Changes from Patch v5: - Added sign-off by lines - Fixed formatting errors found by Daniel Kiper Changes from Patch v4: - Updated grub.texi to reflect new behavior for GRUB_ENABLE_LINUX_PARTUUID - Updated 10_linux.in logic to favor the PARTUUID when GRUB_ENABLE_LINUX_PARTUUID is enabled and GRUB_DISABLE_LINUX_UUID is disabled. Changes from Patch v3: - Removed flex-2.6.3 compatibility patch - Removed Steve Kenton's patch Changes from Patch v2: - Added flex-2.6.3 compatibility patch - Fixed a GPT partition read error - Added Steve Kenton's patch - Changed struct grub_part_gpt_type name to struct grub_part_gpt_part_guid - Changed grub_part_gpt_type_t typedef name to grub_part_gpt_guid_t - Added sprint_gpt_guid to Steve Kenton's patch - Updated v1 and Steve Kenton's patch to use similar methods when reading partition GUIDs. Changes from Patch v1: - Added GRUB_ENABLE_LINUX_PARTUUID variable description to grub.texi - Removed added gpt_part_guid copy logic from grub_gpt_partition_map_iterate() - Removed added NT disk signature copy logic from grub_partition_msdos_iterate() - Removed modifications to partition number increment logic - Removed added guid union definition. - Added GRUB_ENABLE_LINUX_PARTUUID to grub-mkconfig.in export list - Moved PRINT_GPT_PARTTYPE printing logic to print_gpt_guid() function in grub-probe.c - Updated PRINT_GPT_PARTTYPE case to call print_gpt_guid() function in grub-probe.c. - Created probe_partuuid() function in grub-probe.c - Updated print == PRINT_PARTUUID check logic in probe() to call probe_partuuid(). - Updated UUID logic in 10_linux.in to enable root=PARTUUID feature only if GRUB_DISABLE_LINUX_UUID is not set to true, and GRUB_DEVICE_PARTUUID is not empty, GRUB_ENABLE_LINUX_PARTUUID is set to true. Hello, This is a request to add PARTUUID detection support grub-probe for MBR and GPT partition schemes. The Linux kernel supports mounting the root filesystem by Linux device name or by the Partition [GU]UID. GRUB's mkconfig, however, currently only supports specifying the rootfs in the kernel command-line by Linux device name unless an initramfs is also present. When an initramfs is present GRUB's mkconfig will set the kernel's root parameter value to either the Linux device name or to the filesystem [GU]UID. Therefore, the only way to protect a Linux system from failing to boot when its Linux storage device names change is to either manually edit grub.cfg or /etc/default/grub and append root=PARTUUID=xxx to the command-line or create an initramfs that understands how to mount devices by filesystem [G]UID and let grub-mkconfig pass the filesystem [GU]UID to the initramfs. The goal of this patch set is to enable root=PARTUUID=xxx support in grub-mkconfig, so that users don't have to manually edit /etc/default/grub or grub.cfg, or create an initramfs for the sole purpose of having a robust bootloader configuration for Linux. Thanks, Nicholas Vinson Nicholas Vinson (4): Centralize guid prints Update grub_gpt_partentry Add PARTUUID detection support to grub-probe Update grub script template files docs/grub.texi | 11 ++++++ grub-core/disk/ldm.c | 2 +- grub-core/partmap/gpt.c | 4 +- include/grub/gpt_partition.h | 8 ++-- util/grub-install.c | 2 +- util/grub-mkconfig.in | 3 ++ util/grub-probe.c | 76 +++++++++++++++++++++++++++++------- util/grub.d/10_linux.in | 22 +++++++++-- util/grub.d/20_linux_xen.in | 22 +++++++++-- 9 files changed, 121 insertions(+), 29 deletions(-) -- 2.17.0