summaryrefslogtreecommitdiffstats
path: root/meta-linaro/recipes-extra/efibootmgr/files
diff options
context:
space:
mode:
Diffstat (limited to 'meta-linaro/recipes-extra/efibootmgr/files')
-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
9 files changed, 392 insertions, 0 deletions
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 0000000..fa711da
--- /dev/null
+++ b/meta-linaro/recipes-extra/efibootmgr/files/docbook-fixes.patch
@@ -0,0 +1,22 @@
1diff --git a/src/man/man8/efibootmgr.8.docbook b/src/man/man8/efibootmgr.8.docbook
2index aef4444..eb8f266 100644
3--- a/src/man/man8/efibootmgr.8.docbook
4+++ b/src/man/man8/efibootmgr.8.docbook
5@@ -302,7 +302,7 @@
6 <title>Displaying the current settings (must be root).</title>
7
8 <para>
9- <computeroutput>
10+ <programlisting>
11 [root@localhost ~]# efibootmgr
12 BootCurrent: 0004
13 BootNext: 0003
14@@ -313,7 +313,7 @@
15 Boot0002* Hard Drive(Device:80)/HD(Part1,Sig00112233)
16 Boot0003* PXE Boot: MAC(00D0B7C15D91)
17 Boot0004* Linux
18- </computeroutput>
19+ </programlisting>
20 </para>
21 <para>This shows:</para>
22 <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 0000000..240aa69
--- /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 @@
1From 2d8f962284f40b918c0fc8385e58fcba219ddc12 Mon Sep 17 00:00:00 2001
2From: Fedora Ninjas <pjones@fedoraproject.org>
3Date: Wed, 28 Nov 2012 17:13:24 -0500
4Subject: [PATCH 2/5] Remove device path padding on non-Itanium
5
6This code predates EFI support on any x86 hardware, and it's a strict
7violation of the specification. Windows doesn't do it either.
8---
9 src/include/efi.h | 2 ++
10 1 file changed, 2 insertions(+)
11
12diff --git a/src/include/efi.h b/src/include/efi.h
13index be667ae..c2ac853 100644
14--- a/src/include/efi.h
15+++ b/src/include/efi.h
16@@ -294,7 +294,9 @@ typedef struct {
17 uint8_t signature[16];
18 uint8_t mbr_type;
19 uint8_t signature_type;
20+#ifdef __ia64
21 uint8_t padding[6]; /* Emperically needed */
22+#endif
23 } __attribute__((packed)) HARDDRIVE_DEVICE_PATH;
24
25 typedef struct {
26--
271.8.0
28
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 0000000..a1d9831
--- /dev/null
+++ b/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-Work-around-broken-Apple-firmware.patch
@@ -0,0 +1,30 @@
1From 6edc3ed5479b575f87eb51e335957b05fdd04fe8 Mon Sep 17 00:00:00 2001
2From: Fedora Ninjas <pjones@fedoraproject.org>
3Date: Wed, 28 Nov 2012 16:49:18 -0500
4Subject: [PATCH 1/5] Work around broken Apple firmware
5
6Alex Murray found that Apple's firmware sets an invalid EFI attribute on
7BootCurrent, which newer versions of the kernel then reject. This patch
8from him simply masks off the extraneous bit.
9---
10 src/lib/efivars_sysfs.c | 4 ++++
11 1 file changed, 4 insertions(+)
12
13diff --git a/src/lib/efivars_sysfs.c b/src/lib/efivars_sysfs.c
14index 182c70f..ea87325 100644
15--- a/src/lib/efivars_sysfs.c
16+++ b/src/lib/efivars_sysfs.c
17@@ -55,6 +55,10 @@ sysfs_read_variable(const char *name, efi_variable_t *var)
18 return EFI_INVALID_PARAMETER;
19 }
20 close(fd);
21+ /* latest apple firmware sets high bit which appears invalid
22+ to the linux kernel if we write it back so lets zero it out
23+ if it is set since it would be invalid to set it anyway */
24+ var->Attributes = var->Attributes & ~(1 << 31);
25 return var->Status;
26 }
27
28--
291.8.0
30
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 0000000..e9b5358
--- /dev/null
+++ b/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-fix-disk-minor-number-discovery.patch
@@ -0,0 +1,29 @@
1From f9f4ee75ad745637a47bf17ed968101b1ffbcc1d Mon Sep 17 00:00:00 2001
2From: Matt Domsch <Matt_Domsch@dell.com>
3Date: Thu, 23 Jul 2009 14:20:19 -0500
4Subject: [PATCH 4/5] fix disk minor number discovery
5
6Raymund Will noted disk_info_from_fd() incorrectly used logical &&
7instead of bitwise & when obtaining the minor number.
8
9Reported in https://bugzilla.novell.com/show_bug.cgi?id=524529#c1
10---
11 src/lib/disk.c | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14diff --git a/src/lib/disk.c b/src/lib/disk.c
15index ebfe619..8ad590b 100644
16--- a/src/lib/disk.c
17+++ b/src/lib/disk.c
18@@ -55,7 +55,7 @@ disk_info_from_fd(int fd,
19 return 1;
20 }
21 major = buf.st_dev >> 8;
22- minor = buf.st_dev && 0xFF;
23+ minor = buf.st_dev & 0xFF;
24
25 /* IDE disks can have up to 64 partitions, or 6 bits worth,
26 * and have one bit for the disk number.
27--
281.8.0
29
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 0000000..1ff4ce3
--- /dev/null
+++ b/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-fix-minor-memory-leak.patch
@@ -0,0 +1,29 @@
1From 36c3a19c62cc3b6841e363712c3c78ef5915122d Mon Sep 17 00:00:00 2001
2From: Matt Domsch <Matt_Domsch@dell.com>
3Date: Thu, 23 Jul 2009 14:18:11 -0500
4Subject: [PATCH 3/5] fix minor memory leak
5
6David Binderman noted new_data was being allocated but not freed. Not
7a big deal as the program exits soon thereafter (and is thus freed),
8but worth fixing anyhow.
9
10Fixes https://bugzilla.novell.com/show_bug.cgi?id=524529#c1
11---
12 src/efibootmgr/efibootmgr.c | 1 +
13 1 file changed, 1 insertion(+)
14
15diff --git a/src/efibootmgr/efibootmgr.c b/src/efibootmgr/efibootmgr.c
16index b984143..de67af0 100644
17--- a/src/efibootmgr/efibootmgr.c
18+++ b/src/efibootmgr/efibootmgr.c
19@@ -328,6 +328,7 @@ add_to_boot_order(uint16_t num)
20 /* Now new_data has what we need */
21 memcpy(&(boot_order.Data), new_data, new_data_size);
22 boot_order.DataSize = new_data_size;
23+ free(new_data);
24 return create_or_edit_variable(&boot_order);
25 }
26
27--
281.8.0
29
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 0000000..75374ac
--- /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 @@
1From 5fcfccb39089febb89945b841f489b5acc7638ce Mon Sep 17 00:00:00 2001
2From: Lane Winner <lane.winner@oracle.com>
3Date: Tue, 24 Apr 2012 12:58:57 -0500
4Subject: [PATCH 5/5] make_boot_var does not check for failed status with
5 create_variable. This can result in a memory leak.
6 Additionally the user should be notified of the
7 problem.
8
9We encounter this issue on one system after filling up the UEFI boot list
10with dummy devices.
11
12The patch fix the problem. It was verified on a Mensa system using RHEL 6.0
13
14Signed-off-by: Yinghai Lu<yinghai@kernel.org>
15---
16 src/efibootmgr/efibootmgr.c | 8 +++++++-
17 1 file changed, 7 insertions(+), 1 deletion(-)
18
19diff --git a/src/efibootmgr/efibootmgr.c b/src/efibootmgr/efibootmgr.c
20index de67af0..236365a 100644
21--- a/src/efibootmgr/efibootmgr.c
22+++ b/src/efibootmgr/efibootmgr.c
23@@ -239,6 +239,7 @@ warn_duplicate_name(list_t *boot_list)
24 static var_entry_t *
25 make_boot_var(list_t *boot_list)
26 {
27+ efi_status_t status;
28 var_entry_t *boot;
29 int free_number;
30 list_t *pos;
31@@ -271,7 +272,12 @@ make_boot_var(list_t *boot_list)
32 free(boot);
33 return NULL;
34 }
35- create_variable(&boot->var_data);
36+
37+ status = create_variable(&boot->var_data);
38+ if (status != EFI_SUCCESS) {
39+ free(boot);
40+ return NULL;
41+ }
42 list_add_tail(&boot->list, boot_list);
43 return boot;
44 }
45--
461.8.0
47
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 0000000..c380c61
--- /dev/null
+++ b/meta-linaro/recipes-extra/efibootmgr/files/efibootmgr-0.5.4-support-4k-sectors.patch
@@ -0,0 +1,176 @@
1Return-Path: pjones@redhat.com
2Received: from zmta02.collab.prod.int.phx2.redhat.com (LHLO
3 zmta02.collab.prod.int.phx2.redhat.com) (10.5.5.32) by
4 mail04.corp.redhat.com with LMTP; Wed, 14 Jul 2010 14:25:52 -0400 (EDT)
5Received: from localhost (localhost.localdomain [127.0.0.1])
6 by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id B69C19F152
7 for <pjones@redhat.com>; Wed, 14 Jul 2010 14:25:52 -0400 (EDT)
8Received: from zmta02.collab.prod.int.phx2.redhat.com ([127.0.0.1])
9 by localhost (zmta02.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
10 with ESMTP id jCHcGZehMQ5J for <pjones@redhat.com>;
11 Wed, 14 Jul 2010 14:25:52 -0400 (EDT)
12Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21])
13 by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id A601C9F14C
14 for <pjones@mail.corp.redhat.com>; Wed, 14 Jul 2010 14:25:52 -0400 (EDT)
15Received: from pjones4.install.bos.redhat.com (pjones4.install.bos.redhat.com [10.16.52.154])
16 by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6EIPpGh017771;
17 Wed, 14 Jul 2010 14:25:52 -0400
18From: Peter Jones <pjones@redhat.com>
19To: Matt Domsch <Matt_Domsch@dell.com>
20Cc: Peter Jones <pjones@redhat.com>, Stuart Hayes <stuart_hayes@dell.com>
21Subject: [efibootmgr patch] Handle sector_size != 512.
22Date: Wed, 14 Jul 2010 14:26:49 -0400
23Message-Id: <1279132009-26635-1-git-send-email-pjones@redhat.com>
24In-Reply-To: <1279121617-17961-1-git-send-email-pjones@redhat.com>
25References: <1279121617-17961-1-git-send-email-pjones@redhat.com>
26X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21
27
28Disks can have 4kB sectors now, so don't just bail out when that's the
29case.
30---
31 src/include/disk.h | 3 +++
32 src/lib/disk.c | 43 +++++++++++++++++++++++++++++++++----------
33 src/lib/gpt.c | 30 ++++++++++++++----------------
34 3 files changed, 50 insertions(+), 26 deletions(-)
35
36diff --git a/src/include/disk.h b/src/include/disk.h
37index eb93d10..8aa37d7 100644
38--- a/src/include/disk.h
39+++ b/src/include/disk.h
40@@ -65,6 +65,9 @@ enum _interface_type {interface_type_unknown,
41 ata, atapi, scsi, usb,
42 i1394, fibre, i2o, md};
43
44+
45+unsigned int lcm(unsigned int x, unsigned int y);
46+
47 int disk_get_pci(int fd,
48 unsigned char *bus,
49 unsigned char *device,
50diff --git a/src/lib/disk.c b/src/lib/disk.c
51index 883864f..9c3a878 100644
52--- a/src/lib/disk.c
53+++ b/src/lib/disk.c
54@@ -420,6 +420,27 @@ get_sector_size(int filedes)
55 return sector_size;
56 }
57
58+/************************************************************
59+ * lcm
60+ * Requires:
61+ * - numbers of which to find the lowest common multiple
62+ * Modifies: nothing
63+ * Returns:
64+ * lowest common multiple of x and y
65+ ************************************************************/
66+unsigned int
67+lcm(unsigned int x, unsigned int y)
68+{
69+ unsigned int m = x, n = y, o;
70+
71+ while ((o = m % n)) {
72+ m = n;
73+ n = o;
74+ }
75+
76+ return (x / n) * y;
77+}
78+
79 /**
80 * disk_get_partition_info()
81 * @fd - open file descriptor to disk
82@@ -442,26 +463,27 @@ disk_get_partition_info (int fd,
83 uint8_t *mbr_type, uint8_t *signature_type)
84 {
85 legacy_mbr *mbr;
86- void *mbr_unaligned;
87+ void *mbr_sector;
88+ size_t mbr_size;
89 off_t offset;
90 int this_bytes_read = 0;
91 int gpt_invalid=0, mbr_invalid=0;
92 int rc=0;
93 int sector_size = get_sector_size(fd);
94
95- if (sizeof(*mbr) != sector_size)
96- return 1;
97- mbr_unaligned = malloc(sizeof(*mbr)+sector_size-1);
98- mbr = (legacy_mbr *)
99- (((unsigned long)mbr_unaligned + sector_size - 1) &
100- ~(unsigned long)(sector_size-1));
101- memset(mbr, 0, sizeof(*mbr));
102+
103+ mbr_size = lcm(sizeof(*mbr), sector_size);
104+ if ((rc = posix_memalign(&mbr_sector, sector_size, mbr_size)) != 0)
105+ goto error;
106+ memset(mbr_sector, '\0', mbr_size);
107+
108 offset = lseek(fd, 0, SEEK_SET);
109- this_bytes_read = read(fd, mbr, sizeof(*mbr));
110+ this_bytes_read = read(fd, mbr_sector, mbr_size);
111 if (this_bytes_read < sizeof(*mbr)) {
112 rc=1;
113 goto error_free_mbr;
114 }
115+ mbr = (legacy_mbr *)mbr_sector;
116 gpt_invalid = gpt_disk_get_partition_info(fd, num,
117 start, size,
118 signature,
119@@ -479,7 +501,8 @@ disk_get_partition_info (int fd,
120 }
121 }
122 error_free_mbr:
123- free(mbr_unaligned);
124+ free(mbr_sector);
125+ error:
126 return rc;
127 }
128
129diff --git a/src/lib/gpt.c b/src/lib/gpt.c
130index d90ddaf..83e7a94 100644
131--- a/src/lib/gpt.c
132+++ b/src/lib/gpt.c
133@@ -215,26 +215,24 @@ read_lastoddsector(int fd, uint64_t lba, void *buffer, size_t count)
134 static ssize_t
135 read_lba(int fd, uint64_t lba, void *buffer, size_t bytes)
136 {
137- int sector_size = get_sector_size(fd);
138- off_t offset = lba * sector_size;
139+ int sector_size = get_sector_size(fd);
140+ off_t offset = lba * sector_size;
141 ssize_t bytesread;
142- void *aligned;
143- void *unaligned;
144-
145- if (bytes % sector_size)
146- return EINVAL;
147+ void *iobuf;
148+ size_t iobuf_size;
149+ int rc;
150
151- unaligned = malloc(bytes+sector_size-1);
152- aligned = (void *)
153- (((unsigned long)unaligned + sector_size - 1) &
154- ~(unsigned long)(sector_size-1));
155- memset(aligned, 0, bytes);
156+ iobuf_size = lcm(bytes, sector_size);
157+ rc = posix_memalign(&iobuf, sector_size, iobuf_size);
158+ if (rc)
159+ return rc;
160+ memset(iobuf, 0, bytes);
161
162
163- lseek(fd, offset, SEEK_SET);
164- bytesread = read(fd, aligned, bytes);
165- memcpy(buffer, aligned, bytesread);
166- free(unaligned);
167+ lseek(fd, offset, SEEK_SET);
168+ bytesread = read(fd, iobuf, iobuf_size);
169+ memcpy(buffer, iobuf, bytes);
170+ free(iobuf);
171
172 /* Kludge. This is necessary to read/write the last
173 block of an odd-sized disk, until Linux 2.5.x kernel fixes.
174--
1751.7.1.1
176
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 0000000..3207920
--- /dev/null
+++ b/meta-linaro/recipes-extra/efibootmgr/files/ldflags.patch
@@ -0,0 +1,11 @@
1--- efibootmgr-0.5.4.orig/Makefile
2+++ efibootmgr-0.5.4/Makefile
3@@ -11,6 +11,8 @@
4 CFLAGS = $(EXTRA_CFLAGS) -DEFIBOOTMGR_VERSION=\"$(RELEASE_MAJOR).$(RELEASE_MINOR).$(RELEASE_SUBLEVEL)$(RELEASE_EXTRALEVEL)\" \
5 -Wall -g -D_FILE_OFFSET_BITS=64
6
7+ LDFLAGS += -lz
8+
9 MODULES := src
10
11 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 0000000..6934808
--- /dev/null
+++ b/meta-linaro/recipes-extra/efibootmgr/files/w-keep-existing-mbr-signature.patch
@@ -0,0 +1,20 @@
1Description: Fix -w option to leave an existing unique MBR signature intact
2 This makes the implementation match the documentation.
3Author: Colin Watson <cjwatson@ubuntu.com>
4Bug-Ubuntu: https://bugs.launchpad.net/bugs/1065261
5Forwarded: no
6Last-Update: 2013-02-01
7
8Index: b/src/lib/disk.c
9===================================================================
10--- a/src/lib/disk.c
11+++ b/src/lib/disk.c
12@@ -352,7 +352,7 @@
13 printf("******************************************************\n\n");
14
15 }
16- else if (opts.write_signature) {
17+ else if (!mbr->unique_mbr_signature && opts.write_signature) {
18
19 /* MBR Signatures must be unique for the
20 EFI Boot Manager