aboutsummaryrefslogtreecommitdiff
path: root/meta-linaro/recipes-extra
diff options
context:
space:
mode:
authorFathi Boudra <fathi.boudra@linaro.org>2013-07-24 09:39:24 +0300
committerFathi Boudra <fathi.boudra@linaro.org>2013-07-24 09:39:24 +0300
commit0505d50fce30c6031a225a7b970f4fdb93f18c0c (patch)
tree99524665e7e891dd0f9aea49d2ee4b8856b9b494 /meta-linaro/recipes-extra
parente2332fdde7e2b7a39b82fb6f5275f6ba8fac02de (diff)
sdk: add efibootmgr
Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
Diffstat (limited to 'meta-linaro/recipes-extra')
-rw-r--r--meta-linaro/recipes-extra/efibootmgr/efibootmgr_0.5.4.bb33
-rw-r--r--meta-linaro/recipes-extra/efibootmgr/files/docbook-fixes.patch22
-rw-r--r--meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-Remove-device-path-padding-on-non-Itanium.patch28
-rw-r--r--meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-Work-around-broken-Apple-firmware.patch30
-rw-r--r--meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-fix-disk-minor-number-discovery.patch29
-rw-r--r--meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-fix-minor-memory-leak.patch29
-rw-r--r--meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-make_boot_var-does-not-check-for-failed-status-with-.patch47
-rw-r--r--meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-support-4k-sectors.patch176
-rw-r--r--meta-linaro/recipes-extra/efibootmgr/files/ldflags.patch11
-rw-r--r--meta-linaro/recipes-extra/efibootmgr/files/w-keep-existing-mbr-signature.patch20
10 files changed, 425 insertions, 0 deletions
diff --git a/meta-linaro/recipes-extra/efibootmgr/efibootmgr_0.5.4.bb b/meta-linaro/recipes-extra/efibootmgr/efibootmgr_0.5.4.bb
new file mode 100644
index 00000000..1b914188
--- /dev/null
+++ b/meta-linaro/recipes-extra/efibootmgr/efibootmgr_0.5.4.bb
@@ -0,0 +1,33 @@
+DESCRIPTION = "Linux user-space application to modify the EFI Boot Manager."
+SUMMARY = "EFI Boot Manager"
+HOMEPAGE = "http://linux.dell.com/efibootmgr/"
+SECTION = "base"
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3"
+DEPENDS = "pciutils \
+ zlib"
+COMPATIBLE_HOST = "(i.86|x86_64|arm|aarch64).*-linux"
+
+PR = "r1"
+
+SRC_URI = "http://linux.dell.com/efibootmgr/permalink/efibootmgr-${PV}.tar.gz \
+ file://ldflags.patch \
+ file://docbook-fixes.patch \
+ file://w-keep-existing-mbr-signature.patch \
+ file://efibootmgr-0.5.4-support-4k-sectors.patch \
+ file://efibootmgr-0.5.4-Work-around-broken-Apple-firmware.patch \
+ file://efibootmgr-0.5.4-Remove-device-path-padding-on-non-Itanium.patch \
+ file://efibootmgr-0.5.4-fix-minor-memory-leak.patch \
+ file://efibootmgr-0.5.4-fix-disk-minor-number-discovery.patch \
+ file://efibootmgr-0.5.4-make_boot_var-does-not-check-for-failed-status-with-.patch"
+
+SRC_URI[md5sum] = "cfcf24752d6461b73f7ba964bbf73169"
+SRC_URI[sha256sum] = "b562a47a4f5327494992f2ee6ae14a75c5aeb9b4a3a78a06749d5cd2917b8e71"
+
+S = "${WORKDIR}/efibootmgr-${PV}"
+
+EXTRA_OEMAKE = "'CC=${CC}' 'CFLAGS=${CFLAGS} -I${S}/src/lib -I${S}/src/include'"
+
+do_install () {
+ install -D -p -m0755 src/efibootmgr/efibootmgr ${D}/${sbindir}/efibootmgr
+}
diff --git a/meta-linaro/recipes-extra/efibootmgr/files/docbook-fixes.patch b/meta-linaro/recipes-extra/efibootmgr/files/docbook-fixes.patch
new file mode 100644
index 00000000..fa711da5
--- /dev/null
+++ b/meta-linaro/recipes-extra/efibootmgr/files/docbook-fixes.patch
@@ -0,0 +1,22 @@
+diff --git a/src/man/man8/efibootmgr.8.docbook b/src/man/man8/efibootmgr.8.docbook
+index aef4444..eb8f266 100644
+--- a/src/man/man8/efibootmgr.8.docbook
++++ b/src/man/man8/efibootmgr.8.docbook
+@@ -302,7 +302,7 @@
+ <title>Displaying the current settings (must be root).</title>
+
+ <para>
+- <computeroutput>
++ <programlisting>
+ [root@localhost ~]# efibootmgr
+ BootCurrent: 0004
+ BootNext: 0003
+@@ -313,7 +313,7 @@
+ Boot0002* Hard Drive(Device:80)/HD(Part1,Sig00112233)
+ Boot0003* PXE Boot: MAC(00D0B7C15D91)
+ Boot0004* Linux
+- </computeroutput>
++ </programlisting>
+ </para>
+ <para>This shows:</para>
+ <itemizedlist>
diff --git a/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-Remove-device-path-padding-on-non-Itanium.patch b/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-Remove-device-path-padding-on-non-Itanium.patch
new file mode 100644
index 00000000..240aa696
--- /dev/null
+++ b/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-Remove-device-path-padding-on-non-Itanium.patch
@@ -0,0 +1,28 @@
+From 2d8f962284f40b918c0fc8385e58fcba219ddc12 Mon Sep 17 00:00:00 2001
+From: Fedora Ninjas <pjones@fedoraproject.org>
+Date: Wed, 28 Nov 2012 17:13:24 -0500
+Subject: [PATCH 2/5] Remove device path padding on non-Itanium
+
+This code predates EFI support on any x86 hardware, and it's a strict
+violation of the specification. Windows doesn't do it either.
+---
+ src/include/efi.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/include/efi.h b/src/include/efi.h
+index be667ae..c2ac853 100644
+--- a/src/include/efi.h
++++ b/src/include/efi.h
+@@ -294,7 +294,9 @@ typedef struct {
+ uint8_t signature[16];
+ uint8_t mbr_type;
+ uint8_t signature_type;
++#ifdef __ia64
+ uint8_t padding[6]; /* Emperically needed */
++#endif
+ } __attribute__((packed)) HARDDRIVE_DEVICE_PATH;
+
+ typedef struct {
+--
+1.8.0
+
diff --git a/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-Work-around-broken-Apple-firmware.patch b/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-Work-around-broken-Apple-firmware.patch
new file mode 100644
index 00000000..a1d9831d
--- /dev/null
+++ b/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-Work-around-broken-Apple-firmware.patch
@@ -0,0 +1,30 @@
+From 6edc3ed5479b575f87eb51e335957b05fdd04fe8 Mon Sep 17 00:00:00 2001
+From: Fedora Ninjas <pjones@fedoraproject.org>
+Date: Wed, 28 Nov 2012 16:49:18 -0500
+Subject: [PATCH 1/5] Work around broken Apple firmware
+
+Alex Murray found that Apple's firmware sets an invalid EFI attribute on
+BootCurrent, which newer versions of the kernel then reject. This patch
+from him simply masks off the extraneous bit.
+---
+ src/lib/efivars_sysfs.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/lib/efivars_sysfs.c b/src/lib/efivars_sysfs.c
+index 182c70f..ea87325 100644
+--- a/src/lib/efivars_sysfs.c
++++ b/src/lib/efivars_sysfs.c
+@@ -55,6 +55,10 @@ sysfs_read_variable(const char *name, efi_variable_t *var)
+ return EFI_INVALID_PARAMETER;
+ }
+ close(fd);
++ /* latest apple firmware sets high bit which appears invalid
++ to the linux kernel if we write it back so lets zero it out
++ if it is set since it would be invalid to set it anyway */
++ var->Attributes = var->Attributes & ~(1 << 31);
+ return var->Status;
+ }
+
+--
+1.8.0
+
diff --git a/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-fix-disk-minor-number-discovery.patch b/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-fix-disk-minor-number-discovery.patch
new file mode 100644
index 00000000..e9b53583
--- /dev/null
+++ b/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-fix-disk-minor-number-discovery.patch
@@ -0,0 +1,29 @@
+From f9f4ee75ad745637a47bf17ed968101b1ffbcc1d Mon Sep 17 00:00:00 2001
+From: Matt Domsch <Matt_Domsch@dell.com>
+Date: Thu, 23 Jul 2009 14:20:19 -0500
+Subject: [PATCH 4/5] fix disk minor number discovery
+
+Raymund Will noted disk_info_from_fd() incorrectly used logical &&
+instead of bitwise & when obtaining the minor number.
+
+Reported in https://bugzilla.novell.com/show_bug.cgi?id=524529#c1
+---
+ src/lib/disk.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/lib/disk.c b/src/lib/disk.c
+index ebfe619..8ad590b 100644
+--- a/src/lib/disk.c
++++ b/src/lib/disk.c
+@@ -55,7 +55,7 @@ disk_info_from_fd(int fd,
+ return 1;
+ }
+ major = buf.st_dev >> 8;
+- minor = buf.st_dev && 0xFF;
++ minor = buf.st_dev & 0xFF;
+
+ /* IDE disks can have up to 64 partitions, or 6 bits worth,
+ * and have one bit for the disk number.
+--
+1.8.0
+
diff --git a/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-fix-minor-memory-leak.patch b/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-fix-minor-memory-leak.patch
new file mode 100644
index 00000000..1ff4ce34
--- /dev/null
+++ b/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-fix-minor-memory-leak.patch
@@ -0,0 +1,29 @@
+From 36c3a19c62cc3b6841e363712c3c78ef5915122d Mon Sep 17 00:00:00 2001
+From: Matt Domsch <Matt_Domsch@dell.com>
+Date: Thu, 23 Jul 2009 14:18:11 -0500
+Subject: [PATCH 3/5] fix minor memory leak
+
+David Binderman noted new_data was being allocated but not freed. Not
+a big deal as the program exits soon thereafter (and is thus freed),
+but worth fixing anyhow.
+
+Fixes https://bugzilla.novell.com/show_bug.cgi?id=524529#c1
+---
+ src/efibootmgr/efibootmgr.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/efibootmgr/efibootmgr.c b/src/efibootmgr/efibootmgr.c
+index b984143..de67af0 100644
+--- a/src/efibootmgr/efibootmgr.c
++++ b/src/efibootmgr/efibootmgr.c
+@@ -328,6 +328,7 @@ add_to_boot_order(uint16_t num)
+ /* Now new_data has what we need */
+ memcpy(&(boot_order.Data), new_data, new_data_size);
+ boot_order.DataSize = new_data_size;
++ free(new_data);
+ return create_or_edit_variable(&boot_order);
+ }
+
+--
+1.8.0
+
diff --git a/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-make_boot_var-does-not-check-for-failed-status-with-.patch b/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-make_boot_var-does-not-check-for-failed-status-with-.patch
new file mode 100644
index 00000000..75374acf
--- /dev/null
+++ b/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-make_boot_var-does-not-check-for-failed-status-with-.patch
@@ -0,0 +1,47 @@
+From 5fcfccb39089febb89945b841f489b5acc7638ce Mon Sep 17 00:00:00 2001
+From: Lane Winner <lane.winner@oracle.com>
+Date: Tue, 24 Apr 2012 12:58:57 -0500
+Subject: [PATCH 5/5] make_boot_var does not check for failed status with
+ create_variable. This can result in a memory leak.
+ Additionally the user should be notified of the
+ problem.
+
+We encounter this issue on one system after filling up the UEFI boot list
+with dummy devices.
+
+The patch fix the problem. It was verified on a Mensa system using RHEL 6.0
+
+Signed-off-by: Yinghai Lu<yinghai@kernel.org>
+---
+ src/efibootmgr/efibootmgr.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/src/efibootmgr/efibootmgr.c b/src/efibootmgr/efibootmgr.c
+index de67af0..236365a 100644
+--- a/src/efibootmgr/efibootmgr.c
++++ b/src/efibootmgr/efibootmgr.c
+@@ -239,6 +239,7 @@ warn_duplicate_name(list_t *boot_list)
+ static var_entry_t *
+ make_boot_var(list_t *boot_list)
+ {
++ efi_status_t status;
+ var_entry_t *boot;
+ int free_number;
+ list_t *pos;
+@@ -271,7 +272,12 @@ make_boot_var(list_t *boot_list)
+ free(boot);
+ return NULL;
+ }
+- create_variable(&boot->var_data);
++
++ status = create_variable(&boot->var_data);
++ if (status != EFI_SUCCESS) {
++ free(boot);
++ return NULL;
++ }
+ list_add_tail(&boot->list, boot_list);
+ return boot;
+ }
+--
+1.8.0
+
diff --git a/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-support-4k-sectors.patch b/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-support-4k-sectors.patch
new file mode 100644
index 00000000..c380c610
--- /dev/null
+++ b/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-support-4k-sectors.patch
@@ -0,0 +1,176 @@
+Return-Path: pjones@redhat.com
+Received: from zmta02.collab.prod.int.phx2.redhat.com (LHLO
+ zmta02.collab.prod.int.phx2.redhat.com) (10.5.5.32) by
+ mail04.corp.redhat.com with LMTP; Wed, 14 Jul 2010 14:25:52 -0400 (EDT)
+Received: from localhost (localhost.localdomain [127.0.0.1])
+ by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id B69C19F152
+ for <pjones@redhat.com>; Wed, 14 Jul 2010 14:25:52 -0400 (EDT)
+Received: from zmta02.collab.prod.int.phx2.redhat.com ([127.0.0.1])
+ by localhost (zmta02.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
+ with ESMTP id jCHcGZehMQ5J for <pjones@redhat.com>;
+ Wed, 14 Jul 2010 14:25:52 -0400 (EDT)
+Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21])
+ by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id A601C9F14C
+ for <pjones@mail.corp.redhat.com>; Wed, 14 Jul 2010 14:25:52 -0400 (EDT)
+Received: from pjones4.install.bos.redhat.com (pjones4.install.bos.redhat.com [10.16.52.154])
+ by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6EIPpGh017771;
+ Wed, 14 Jul 2010 14:25:52 -0400
+From: Peter Jones <pjones@redhat.com>
+To: Matt Domsch <Matt_Domsch@dell.com>
+Cc: Peter Jones <pjones@redhat.com>, Stuart Hayes <stuart_hayes@dell.com>
+Subject: [efibootmgr patch] Handle sector_size != 512.
+Date: Wed, 14 Jul 2010 14:26:49 -0400
+Message-Id: <1279132009-26635-1-git-send-email-pjones@redhat.com>
+In-Reply-To: <1279121617-17961-1-git-send-email-pjones@redhat.com>
+References: <1279121617-17961-1-git-send-email-pjones@redhat.com>
+X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21
+
+Disks can have 4kB sectors now, so don't just bail out when that's the
+case.
+---
+ src/include/disk.h | 3 +++
+ src/lib/disk.c | 43 +++++++++++++++++++++++++++++++++----------
+ src/lib/gpt.c | 30 ++++++++++++++----------------
+ 3 files changed, 50 insertions(+), 26 deletions(-)
+
+diff --git a/src/include/disk.h b/src/include/disk.h
+index eb93d10..8aa37d7 100644
+--- a/src/include/disk.h
++++ b/src/include/disk.h
+@@ -65,6 +65,9 @@ enum _interface_type {interface_type_unknown,
+ ata, atapi, scsi, usb,
+ i1394, fibre, i2o, md};
+
++
++unsigned int lcm(unsigned int x, unsigned int y);
++
+ int disk_get_pci(int fd,
+ unsigned char *bus,
+ unsigned char *device,
+diff --git a/src/lib/disk.c b/src/lib/disk.c
+index 883864f..9c3a878 100644
+--- a/src/lib/disk.c
++++ b/src/lib/disk.c
+@@ -420,6 +420,27 @@ get_sector_size(int filedes)
+ return sector_size;
+ }
+
++/************************************************************
++ * lcm
++ * Requires:
++ * - numbers of which to find the lowest common multiple
++ * Modifies: nothing
++ * Returns:
++ * lowest common multiple of x and y
++ ************************************************************/
++unsigned int
++lcm(unsigned int x, unsigned int y)
++{
++ unsigned int m = x, n = y, o;
++
++ while ((o = m % n)) {
++ m = n;
++ n = o;
++ }
++
++ return (x / n) * y;
++}
++
+ /**
+ * disk_get_partition_info()
+ * @fd - open file descriptor to disk
+@@ -442,26 +463,27 @@ disk_get_partition_info (int fd,
+ uint8_t *mbr_type, uint8_t *signature_type)
+ {
+ legacy_mbr *mbr;
+- void *mbr_unaligned;
++ void *mbr_sector;
++ size_t mbr_size;
+ off_t offset;
+ int this_bytes_read = 0;
+ int gpt_invalid=0, mbr_invalid=0;
+ int rc=0;
+ int sector_size = get_sector_size(fd);
+
+- if (sizeof(*mbr) != sector_size)
+- return 1;
+- mbr_unaligned = malloc(sizeof(*mbr)+sector_size-1);
+- mbr = (legacy_mbr *)
+- (((unsigned long)mbr_unaligned + sector_size - 1) &
+- ~(unsigned long)(sector_size-1));
+- memset(mbr, 0, sizeof(*mbr));
++
++ mbr_size = lcm(sizeof(*mbr), sector_size);
++ if ((rc = posix_memalign(&mbr_sector, sector_size, mbr_size)) != 0)
++ goto error;
++ memset(mbr_sector, '\0', mbr_size);
++
+ offset = lseek(fd, 0, SEEK_SET);
+- this_bytes_read = read(fd, mbr, sizeof(*mbr));
++ this_bytes_read = read(fd, mbr_sector, mbr_size);
+ if (this_bytes_read < sizeof(*mbr)) {
+ rc=1;
+ goto error_free_mbr;
+ }
++ mbr = (legacy_mbr *)mbr_sector;
+ gpt_invalid = gpt_disk_get_partition_info(fd, num,
+ start, size,
+ signature,
+@@ -479,7 +501,8 @@ disk_get_partition_info (int fd,
+ }
+ }
+ error_free_mbr:
+- free(mbr_unaligned);
++ free(mbr_sector);
++ error:
+ return rc;
+ }
+
+diff --git a/src/lib/gpt.c b/src/lib/gpt.c
+index d90ddaf..83e7a94 100644
+--- a/src/lib/gpt.c
++++ b/src/lib/gpt.c
+@@ -215,26 +215,24 @@ read_lastoddsector(int fd, uint64_t lba, void *buffer, size_t count)
+ static ssize_t
+ read_lba(int fd, uint64_t lba, void *buffer, size_t bytes)
+ {
+- int sector_size = get_sector_size(fd);
+- off_t offset = lba * sector_size;
++ int sector_size = get_sector_size(fd);
++ off_t offset = lba * sector_size;
+ ssize_t bytesread;
+- void *aligned;
+- void *unaligned;
+-
+- if (bytes % sector_size)
+- return EINVAL;
++ void *iobuf;
++ size_t iobuf_size;
++ int rc;
+
+- unaligned = malloc(bytes+sector_size-1);
+- aligned = (void *)
+- (((unsigned long)unaligned + sector_size - 1) &
+- ~(unsigned long)(sector_size-1));
+- memset(aligned, 0, bytes);
++ iobuf_size = lcm(bytes, sector_size);
++ rc = posix_memalign(&iobuf, sector_size, iobuf_size);
++ if (rc)
++ return rc;
++ memset(iobuf, 0, bytes);
+
+
+- lseek(fd, offset, SEEK_SET);
+- bytesread = read(fd, aligned, bytes);
+- memcpy(buffer, aligned, bytesread);
+- free(unaligned);
++ lseek(fd, offset, SEEK_SET);
++ bytesread = read(fd, iobuf, iobuf_size);
++ memcpy(buffer, iobuf, bytes);
++ free(iobuf);
+
+ /* Kludge. This is necessary to read/write the last
+ block of an odd-sized disk, until Linux 2.5.x kernel fixes.
+--
+1.7.1.1
+
diff --git a/meta-linaro/recipes-extra/efibootmgr/files/ldflags.patch b/meta-linaro/recipes-extra/efibootmgr/files/ldflags.patch
new file mode 100644
index 00000000..32079205
--- /dev/null
+++ b/meta-linaro/recipes-extra/efibootmgr/files/ldflags.patch
@@ -0,0 +1,11 @@
+--- efibootmgr-0.5.4.orig/Makefile
++++ efibootmgr-0.5.4/Makefile
+@@ -11,6 +11,8 @@
+ CFLAGS = $(EXTRA_CFLAGS) -DEFIBOOTMGR_VERSION=\"$(RELEASE_MAJOR).$(RELEASE_MINOR).$(RELEASE_SUBLEVEL)$(RELEASE_EXTRALEVEL)\" \
+ -Wall -g -D_FILE_OFFSET_BITS=64
+
++ LDFLAGS += -lz
++
+ MODULES := src
+
+ BINDIR := /usr/sbin
diff --git a/meta-linaro/recipes-extra/efibootmgr/files/w-keep-existing-mbr-signature.patch b/meta-linaro/recipes-extra/efibootmgr/files/w-keep-existing-mbr-signature.patch
new file mode 100644
index 00000000..69348080
--- /dev/null
+++ b/meta-linaro/recipes-extra/efibootmgr/files/w-keep-existing-mbr-signature.patch
@@ -0,0 +1,20 @@
+Description: Fix -w option to leave an existing unique MBR signature intact
+ This makes the implementation match the documentation.
+Author: Colin Watson <cjwatson@ubuntu.com>
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1065261
+Forwarded: no
+Last-Update: 2013-02-01
+
+Index: b/src/lib/disk.c
+===================================================================
+--- a/src/lib/disk.c
++++ b/src/lib/disk.c
+@@ -352,7 +352,7 @@
+ printf("******************************************************\n\n");
+
+ }
+- else if (opts.write_signature) {
++ else if (!mbr->unique_mbr_signature && opts.write_signature) {
+
+ /* MBR Signatures must be unique for the
+ EFI Boot Manager