[parted-devel] [PATCH 4/4] tests: add test for GPT PMBR legacy_boot flag

bcl at redhat.com bcl at redhat.com
Sat Jan 28 00:59:05 UTC 2012


* tests/t0208-gpt-legacy_boot.sh: New test
* tests/Makefile.am: Add new test
* NEWS: Add information about the GPT PMBR legacy_boot flag
---
 NEWS                           |   17 +++++++++++++++++
 tests/Makefile.am              |    1 +
 tests/t0208-gpt-legacy_boot.sh |   38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+), 0 deletions(-)
 create mode 100755 tests/t0208-gpt-legacy_boot.sh

diff --git a/NEWS b/NEWS
index e8ffed5..af4488b 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,23 @@ GNU parted NEWS                                    -*- outline -*-
 
 ** Changes in behavior
 
+  Add the ability to set the boot flag on the GPT PMBR. This is needed
+  for some BIOS systems that refuse to boot from GPT unless this is set.
+  disk_set and disk_toggle commands can be used to set the legacy_boot
+  flag on the disk.
+
+  The flag is also displayed in a new line, 'Disk Flags:' like this:
+
+  Model:  (file)
+  Disk /home/bcl/disk.img: 4295MB
+  Sector size (logical/physical): 512B/512B
+  Partition Table: gpt
+  Disk Flags: legacy_boot
+
+  Using -m the flags are added after the model name field:
+
+  /root/disk.img:4295MB:file:512:512:gpt::legacy_boot;
+
   Remove all FS-related (file system-related) sub-commands; these commands
   are no longer recognized because they were all dependent on parted "knowing"
   too much about file system: mkpartfs, mkfs, cp, move, check, resize.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2218a2c..adfd57d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -15,6 +15,7 @@ TESTS = \
   t0205-gpt-list-clobbers-pmbr.sh \
   t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh \
   t0207-IEC-binary-notation.sh \
+  t0208-gpt-legacy_boot.sh \
   t0220-gpt-msftres.sh \
   t0250-gpt.sh \
   t0280-gpt-corrupt.sh \
diff --git a/tests/t0208-gpt-legacy_boot.sh b/tests/t0208-gpt-legacy_boot.sh
new file mode 100755
index 0000000..f186466
--- /dev/null
+++ b/tests/t0208-gpt-legacy_boot.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+# Ensure that legacy_boot flag can be set
+
+# Copyright (C) 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
+
+N=2M
+dev=loop-file
+# create a file large enough to hold a GPT partition table
+dd if=/dev/null of=$dev bs=1 seek=$N || framework_failure
+
+# create a GPT partition table
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare out /dev/null || fail=1
+
+# Set the legacy_boot flag on the PMBR
+parted -s $dev disk_set legacy_boot on
+
+# Check to see if the flag is set
+parted -m -s $dev u s p > out 2> err || fail=1
+grep "$dev:.*:gpt::legacy_boot;" out || { cat out; fail=1; }
+
+Exit $fail
-- 
1.7.6.5




More information about the parted-devel mailing list