debian/0000755000000000000000000000000012307612055007167 5ustar debian/efibootmgr.dirs0000644000000000000000000000000412142741164012202 0ustar bin debian/rules0000755000000000000000000000131312142752710010245 0ustar #!/usr/bin/make -f # rules file for the efibootmgr package, requires debhelper / dh # copyright 2012 by Bdale Garbee, GPLv2 or later export DH_VERBOSE=1 %: dh $@ override_dh_installman: (cd src/man/man8 ; docbook-to-man efibootmgr.8.docbook > efibootmgr.8) dh_installman override_dh_clean: rm -f src/man/man8/efibootmgr.8 dh_clean override_dh_install: # Re-add the mention of efibootmgr.8 to filelist-rpm that's # caused by the removal in the clean step above. filelist-rpm # shouldn't really be in the upstream tarball as it's # generated each time... :-( if (! grep -q efibootmgr.8 filelist-rpm) ; then echo " %attr(0444,root,root) /usr/share/man/man8/efibootmgr.8" >> filelist-rpm; fi dh_install debian/copyright0000644000000000000000000000067512142742532011133 0ustar This package was constructed by Bdale Garbee , using source downloaded from http://linux.dell.com/efibootmgr/ Upstream Author: Matt Domsch Copyright: Copyright (C) 2001-2005 Dell Computer Corporation efibootmgr is distributed under the GPL. On Debian GNU/Linux systems, the complete text of the GNU General Public License can be found in `/usr/share/common-licenses/GPL'. debian/source/0000755000000000000000000000000012142741164010470 5ustar debian/source/format0000644000000000000000000000001412142741164011676 0ustar 3.0 (quilt) debian/patches/0000755000000000000000000000000012307612010010605 5ustar debian/patches/ldflags.patch0000644000000000000000000000047412142741164013261 0ustar --- 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 debian/patches/w-keep-existing-mbr-signature.patch0000644000000000000000000000124112166521442017434 0ustar Description: Fix -w option to leave an existing unique MBR signature intact This makes the implementation match the documentation. Author: Colin Watson 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 debian/patches/efibootmgr-0.5.4-support-4k-sectors.patch0000644000000000000000000001347312142741164020155 0ustar 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 ; 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 ; 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 ; 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 To: Matt Domsch Cc: Peter Jones , Stuart Hayes 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 debian/patches/series0000644000000000000000000000024012307611667012037 0ustar ldflags.patch docbook-fixes.patch efibootmgr-0.5.4-support-4k-sectors.patch w-keep-existing-mbr-signature.patch remove-device-path-padding-on-non-itanium.patch debian/patches/docbook-fixes.patch0000644000000000000000000000135412142741164014377 0ustar 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 @@ Displaying the current settings (must be root). - + [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 - + This shows: debian/patches/remove-device-path-padding-on-non-itanium.patch0000644000000000000000000000133412307612010021565 0ustar Description: Remove device path padding on non-Itanium This improves spec conformance. Author: Matthew Garrett Origin: backport, https://github.com/vathpela/efibootmgr/commit/de0ca446e7e5439306f7f54806d1a15310588426 Bug-Debian: https://bugs.debian.org/741235 Bug-Ubuntu: https://launchpad.net/bugs/1272664 Last-Update: 2014-03-11 Index: b/src/include/efi.h =================================================================== --- a/src/include/efi.h +++ b/src/include/efi.h @@ -294,7 +294,9 @@ 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 { debian/compat0000644000000000000000000000000212142741164010366 0ustar 9 debian/efibootmgr.install0000644000000000000000000000003612142741164012714 0ustar src/efibootmgr/efibootmgr bin debian/control0000644000000000000000000000210312307612074010567 0ustar Source: efibootmgr Section: admin Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Steve McIntyre <93sam@debian.org> Build-Depends: debhelper (>> 9), docbook-to-man, libpci-dev, zlib1g-dev Standards-Version: 3.9.4 Vcs-Git: git://git.debian.org/git/collab-maint/efibootmgr.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/efibootmgr.git Package: efibootmgr Architecture: amd64 i386 ia64 armhf Depends: ${shlibs:Depends}, ${misc:Depends} Description: Interact with the EFI Boot Manager This is a Linux user-space application to modify the Intel Extensible Firmware Interface (EFI) Boot Manager configuration. This application can create and destroy boot entries, change the boot order, change the next running boot option, and more. . Details on the EFI Boot Manager are available from the EFI Specification, v1.02 or above, available from http://developer.intel.com. . Note: efibootmgr requires that the kernel module efivars be loaded prior to use. 'modprobe efivars' should do the trick. debian/efibootmgr.docs0000644000000000000000000000002012142741164012167 0ustar README doc/TODO debian/changelog0000644000000000000000000001661312307612055011050 0ustar efibootmgr (0.5.4-7ubuntu1) trusty; urgency=medium * Remove device path padding on non-Itanium (LP: #1272664). -- Colin Watson Tue, 11 Mar 2014 13:48:08 +0000 efibootmgr (0.5.4-7) unstable; urgency=low * Add armhf to the architecture list. Closes: #715140 * Fix -w option to leave an existing unique MBR signature intact. Thanks to Colin Watson for the patch (#708554) -- Steve McIntyre <93sam@debian.org> Mon, 08 July 2013 12:21:10 +0100 efibootmgr (0.5.4-6) unstable; urgency=low * New maintainer. Thanks to Bdale for his sterling work so far! Closes: #707113 * Git repo now hosted using collab-maint at alioth, update debian/control to point there. * Add extra handling for filelist-rpm so that clean/install works reliably and we can build twice in a row. -- Steve McIntyre <93sam@debian.org> Thu, 09 May 2013 16:43:12 +0100 efibootmgr (0.5.4-5) unstable; urgency=low * orphaning this package as I no longer use it myself -- Bdale Garbee Tue, 07 May 2013 09:34:15 -0600 efibootmgr (0.5.4-4) unstable; urgency=low * move to 3.0 (quilt) package source format * incorporate Fedora patch for sector size > 512 bytes at Colin Watson's suggestion, closes: #698773 * change computeroutput to programlisting to fix man page formatting issue, update rules to use docbook source for man page, closes: #680716 -- Bdale Garbee Wed, 23 Jan 2013 09:55:27 -0700 efibootmgr (0.5.4-3) unstable; urgency=low * add Vcs entries to the control file * update standards version * move to dh -- Bdale Garbee Fri, 29 Jun 2012 08:18:06 -0600 efibootmgr (0.5.4-2) unstable; urgency=low * build depend on libpci-dev instead of pcituils-dev, closes: #478374 -- Bdale Garbee Mon, 28 Apr 2008 18:12:40 -0700 efibootmgr (0.5.4-1) unstable; urgency=low * new upstream version -- Bdale Garbee Sun, 24 Feb 2008 17:30:01 -0700 efibootmgr (0.5.3-3) unstable; urgency=low * fix FTBFS, closes: #450448 * clean up a couple lintian warnings -- Bdale Garbee Tue, 11 Dec 2007 23:04:09 -0700 efibootmgr (0.5.3-2) unstable; urgency=low * merge patch from Sam Hocevar (thanks!), closes: #389923 -- Bdale Garbee Fri, 20 Oct 2006 07:36:12 -0600 efibootmgr (0.5.3-1.1) unstable; urgency=medium * Non-maintainer upload. * src/include/gpt.h: + Fix GPT_HEADER_SIGNATURE declaration on 32bit architectures. * src/lib/efi.c: + Remove questionable "hack to allow include of ethtool.h". + Include asm/types.h so that proper types are defined (Closes: #389923). * debian/control: + Set policy to 3.7.2. + Uncapitalised short description. -- Sam Hocevar (Debian packages) Sun, 8 Oct 2006 14:21:38 +0200 efibootmgr (0.5.3-1) unstable; urgency=low * new upstream version, closes: #357884 -- Bdale Garbee Sat, 1 Apr 2006 22:00:02 -0800 efibootmgr (0.5.1-1) unstable; urgency=low * new upstream version. -- Bdale Garbee Thu, 10 Mar 2005 11:27:00 -0700 efibootmgr (0.5.0-1) unstable; urgency=low * new upstream version. No code changes from 0.5.0-test4, which I called 0.4.9 to avoid an epoch roll at this release... this upload just gets us back in version sync with the official release from upstream. -- Bdale Garbee Sat, 28 Aug 2004 11:51:02 -0600 efibootmgr (0.4.9-0.sarge.2) testing; urgency=high * Base dependencies are frozen; this release reverts the portion of the test4 changes that added a dependency on pciutils. Thanks to Dann Frazier for figuring this out and providing a suitable patch. Closes: #268490 -- Bdale Garbee Fri, 27 Aug 2004 23:12:38 -0600 efibootmgr (0.4.9-0.sarge.1) testing; urgency=high * build 0.4.9-1 in testing chroot for sarge * new upstream version. This is actually 0.5.0-test4, renumbered to avoid nastiness when 0.5.0 is released. Upstream says 0.5.0 will be this code with a documentation change. Closes: #258838, #235227 * add pciutils-dev to build dependencies since we need libpci now * hack in a typedef to get a u64 definition for ethtool.h * urgency high because previous version fails with current 2.6 kernels -- Bdale Garbee Wed, 18 Aug 2004 09:47:21 -0600 efibootmgr (0.4.9-1) unstable; urgency=high * new upstream version. This is actually 0.5.0-test4, renumbered to avoid nastiness when 0.5.0 is released. Upstream says 0.5.0 will be this code with a documentation change. Closes: #258838, #235227 * add pciutils-dev to build dependencies since we need libpci now * hack in a typedef to get a u64 definition for ethtool.h * urgency high because previous version fails with current 2.6 kernels -- Bdale Garbee Wed, 18 Aug 2004 08:59:03 -0600 efibootmgr (0.4.2-4) unstable; urgency=low * add amd64 to the list of architectures to build on, closes: #249988 -- Bdale Garbee Sat, 22 May 2004 23:50:58 -0600 efibootmgr (0.4.2-3) unstable; urgency=low * patch from upstream to solve compilation problem, closes: #223146 -- Bdale Garbee Tue, 13 Jan 2004 11:20:20 +1030 efibootmgr (0.4.2-2) unstable; urgency=low * add i386 to list of supported architectures, since elilo depends on this package to support various options of the elilo shell script. note that efibootmgr requires associated kernel support which probably isn't in standard Debian kernels yet, but we'll deal with that when we get access to a real i386 system using EFI firmware... -- Bdale Garbee Sat, 25 Oct 2003 15:23:59 -0600 efibootmgr (0.4.2-1) unstable; urgency=low * new upstream version -- Bdale Garbee Thu, 4 Sep 2003 15:38:46 -0600 efibootmgr (0.4.1-1) unstable; urgency=low * new upstream version, closes: #165956 * this version can run non-root, closes: #163447 * this version checks if boot option was specified, closes: #163450 * remove local copy of man page source and related processing now that man page is integrated with upstream release -- Bdale Garbee Wed, 23 Oct 2002 16:05:53 -0600 efibootmgr (0.4.0-1) unstable; urgency=low * new upstream version, closes: #146544 * updated man page from Dann Frazier , closes: #157213 -- Bdale Garbee Sun, 18 Aug 2002 20:40:48 -0600 efibootmgr (0.3.4-3) unstable; urgency=low * add man page from Dann Frazier , closes: #140514 -- Bdale Garbee Sat, 30 Mar 2002 13:53:32 -0700 efibootmgr (0.3.4-2) unstable; urgency=medium * apply patch from Alex Williamson so we work with EFI 1.1 too * cosmetic cleanups to packaging -- Bdale Garbee Wed, 30 Jan 2002 10:45:42 -0700 efibootmgr (0.3.4-1) unstable; urgency=low * new upstream version -- Bdale Garbee Fri, 10 Aug 2001 13:15:19 -0600 efibootmgr (0.3.3-2) unstable; urgency=medium * patch from Richard Hirst to fix a buffer size problem -- Bdale Garbee Wed, 8 Aug 2001 01:21:03 -0600 efibootmgr (0.3.3-1) unstable; urgency=low * new upstream release * fix lintian complaint about naming of upstream changelog -- Bdale Garbee Fri, 3 Aug 2001 17:08:24 -0600 efibootmgr (0.3.2-1) unstable; urgency=low * Initial Release. -- Bdale Garbee Tue, 10 Jul 2001 15:37:11 -0600 debian/efibootmgr.manpages0000644000000000000000000000003212142741164013035 0ustar src/man/man8/efibootmgr.8