--- 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 --- efibootmgr-0.5.4.orig/src/include/disk.h +++ efibootmgr-0.5.4/src/include/disk.h @@ -65,6 +65,9 @@ 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, --- efibootmgr-0.5.4.orig/src/lib/disk.c +++ efibootmgr-0.5.4/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 @@ -420,6 +420,27 @@ 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 @@ 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 @@ } } error_free_mbr: - free(mbr_unaligned); + free(mbr_sector); + error: return rc; } --- efibootmgr-0.5.4.orig/src/lib/gpt.c +++ efibootmgr-0.5.4/src/lib/gpt.c @@ -215,26 +215,24 @@ 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; + void *iobuf; + size_t iobuf_size; + int rc; - if (bytes % sector_size) - return EINVAL; + iobuf_size = lcm(bytes, sector_size); + rc = posix_memalign(&iobuf, sector_size, iobuf_size); + if (rc) + return rc; + memset(iobuf, 0, bytes); - unaligned = malloc(bytes+sector_size-1); - aligned = (void *) - (((unsigned long)unaligned + sector_size - 1) & - ~(unsigned long)(sector_size-1)); - memset(aligned, 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. --- efibootmgr-0.5.4.orig/debian/changelog +++ efibootmgr-0.5.4/debian/changelog @@ -0,0 +1,243 @@ +efibootmgr (0.5.4-3ubuntu2) raring; urgency=low + + * Apply Fedora patch (efibootmgr-0.5.4-support-4k-sectors.patch) to + support non-512-byte logical sectors (LP: #1065281). + + -- Colin Watson Wed, 23 Jan 2013 12:41:28 +0000 + +efibootmgr (0.5.4-3ubuntu1) raring; urgency=low + + [ Oussama Bounaim ] + * Merge from debian. Remaining changes: + - Fix implementation of -w option to match documentation by leaving an + existing unique MBR signature intact (LP: #1065261). + + [ Colin Watson ] + * Dropped changes: + - Build packages for lpia as well. (Ubuntu no longer has an lpia + architecture.) + + -- Colin Watson Fri, 16 Nov 2012 13:37:39 +0000 + +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-2ubuntu2) quantal; urgency=low + + * Fix implementation of -w option to match documentation by leaving an + existing unique MBR signature intact (LP: #1065261). + + -- Colin Watson Wed, 10 Oct 2012 23:25:29 +0100 + +efibootmgr (0.5.4-2ubuntu1) intrepid; urgency=low + + * Merge from debian unstable, remaining changes: + - Build packages for lpia as well. + - Set Ubuntu maintainer + + -- Bryce Harrington Mon, 09 Jun 2008 14:05:32 -0700 + +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-3ubuntu1) hardy; urgency=low + + * Merge from debian unstable, remaining changes: + - Build packages for lpia as well. + - Set Ubuntu maintainer + + -- Bryce Harrington Wed, 12 Dec 2007 18:07:03 -0800 + +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-2ubuntu2) gutsy; urgency=low + + * Build packages for lpia as well. + + -- Adam Conrad Wed, 15 Aug 2007 23:50:29 +1000 + +efibootmgr (0.5.3-2ubuntu1) feisty; urgency=low + + * Add -lz to src/efibootmgr/module.mk since pciutils now uses zlib. + Fixes FTBFS. + + -- Tollef Fog Heen Wed, 14 Mar 2007 12:08:06 +0100 + +efibootmgr (0.5.3-2build1) feisty; urgency=low + + * Rebuild for changes in the amd64 toolchain. + + -- Matthias Klose Mon, 5 Mar 2007 01:15:22 +0000 + +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 --- efibootmgr-0.5.4.orig/debian/rules +++ efibootmgr-0.5.4/debian/rules @@ -0,0 +1,8 @@ +#!/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 $@ --- efibootmgr-0.5.4.orig/debian/efibootmgr.dirs +++ efibootmgr-0.5.4/debian/efibootmgr.dirs @@ -0,0 +1 @@ +bin --- efibootmgr-0.5.4.orig/debian/efibootmgr.docs +++ efibootmgr-0.5.4/debian/efibootmgr.docs @@ -0,0 +1,2 @@ +README +doc/TODO --- efibootmgr-0.5.4.orig/debian/efibootmgr.install +++ efibootmgr-0.5.4/debian/efibootmgr.install @@ -0,0 +1 @@ +src/efibootmgr/efibootmgr bin --- efibootmgr-0.5.4.orig/debian/compat +++ efibootmgr-0.5.4/debian/compat @@ -0,0 +1 @@ +9 --- efibootmgr-0.5.4.orig/debian/control +++ efibootmgr-0.5.4/debian/control @@ -0,0 +1,24 @@ +Source: efibootmgr +Section: admin +Priority: optional +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Bdale Garbee +Build-Depends: debhelper (>> 9), docbook-to-man, libpci-dev, zlib1g-dev +Standards-Version: 3.9.3 +Vcs-Git: git://git.gag.com/debian/efibootmgr +Vcs-Browser: http://git.gag.com/?p=debian/efibootmgr + +Package: efibootmgr +Architecture: amd64 i386 ia64 +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. --- efibootmgr-0.5.4.orig/debian/copyright +++ efibootmgr-0.5.4/debian/copyright @@ -0,0 +1,16 @@ +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'. + --- efibootmgr-0.5.4.orig/debian/efibootmgr.manpages +++ efibootmgr-0.5.4/debian/efibootmgr.manpages @@ -0,0 +1 @@ +src/man/man8/efibootmgr.8