From d96a8f66c5fe2fac79073cc40e6f57f04c5bb4f1 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Thu, 10 Mar 2005 11:27:00 -0700 Subject: [PATCH] Imported Debian patch 0.5.1-1 --- AUTHORS | 4 +++ Makefile | 4 +-- debian/changelog | 6 ++++ debian/copyright | 2 +- doc/ChangeLog | 7 ++++ efibootmgr.spec | 10 ++++-- src/efibootmgr/efibootmgr.c | 66 +++++++++++++++++++++++++++++-------- src/lib/efi.c | 14 +++++--- 8 files changed, 89 insertions(+), 24 deletions(-) diff --git a/AUTHORS b/AUTHORS index bd8127d..40dd425 100644 --- a/AUTHORS +++ b/AUTHORS @@ -16,3 +16,7 @@ dann frazier Joshua Giles - walk the PCI path inserting parent bridge device path components for network boot and EDD30 entries. + +Alex Williamson +- Patch to efi.c and efibootmgr.c for handling BootXXXX values + using uppercase hex rather than lowercase, per EFI 1.10 spec. diff --git a/Makefile b/Makefile index 854277e..23bc9d8 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ default: all - RELEASE_DATE := "26-Aug-2004" + RELEASE_DATE := "08-Mar-2005" RELEASE_MAJOR := 0 RELEASE_MINOR := 5 - RELEASE_SUBLEVEL := 0 + RELEASE_SUBLEVEL := 1 RELEASE_EXTRALEVEL := RELEASE_NAME := efibootmgr RELEASE_STRING := $(RELEASE_NAME)-$(RELEASE_MAJOR).$(RELEASE_MINOR).$(RELEASE_SUBLEVEL)$(RELEASE_EXTRALEVEL) diff --git a/debian/changelog b/debian/changelog index a7025e5..1ceec3d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +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 diff --git a/debian/copyright b/debian/copyright index 3844600..c074f19 100644 --- a/debian/copyright +++ b/debian/copyright @@ -7,7 +7,7 @@ Upstream Author: Matt Domsch Copyright: - Copyright (C) 2001-2003 Dell Computer Corporation + Copyright (C) 2001-2005 Dell Computer Corporation efibootmgr is distributed under the GPL. diff --git a/doc/ChangeLog b/doc/ChangeLog index 906bc6f..2780443 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,10 @@ +* Tue Mar 08 2005 Matt Domsch +- applied patch from Alex Williamson for handling BootXXXX values + using uppercase hex rather than lowercase, per EFI 1.10 spec. +- this also allows the full 65k boot entries, rather than requiring all + entries to begin with a zero. +- v0.5.1 released + * Thu Aug 26 2004 Matt Domsch - v0.5.0-test4 released as v0.5.0 with no code changes diff --git a/efibootmgr.spec b/efibootmgr.spec index 45627e9..5a8b832 100644 --- a/efibootmgr.spec +++ b/efibootmgr.spec @@ -1,14 +1,15 @@ Summary: EFI Boot Manager Name: efibootmgr -Version: 0.4.1 +Version: 0.5.0 Release: 0 Group: System Environment/Base Copyright: GPL -Vendor: Dell Computer Corporation www.dell.com +Vendor: Dell linux.dell.com Packager: Matt Domsch -Source0: http://domsch.com/linux/ia64/efibootmgr/efibootmgr-%{version}.tar.gz +Source0: http://linux.dell.com/efibootmgr/permalink/efibootmgr-%{version}.tar.gz +Source1: http://linux.dell.com/efibootmgr/permalink/efibootmgr-%{version}.tar.gz.sign %description efibootmgr displays and allows the user to edit the Intel Extensible @@ -32,5 +33,8 @@ install --group=root --owner=root --mode 444 src/man/man8/efibootmgr.8 $RPM_BUIL %changelog +* Thu Aug 24 2004 Matt Domsch +- new home linux.dell.com + * Fri May 18 2001 Matt Domsch - See doc/ChangeLog diff --git a/src/efibootmgr/efibootmgr.c b/src/efibootmgr/efibootmgr.c index 1aa3595..5058f92 100644 --- a/src/efibootmgr/efibootmgr.c +++ b/src/efibootmgr/efibootmgr.c @@ -32,6 +32,7 @@ #define _GNU_SOURCE +#include #include #include #include @@ -215,8 +216,8 @@ warn_duplicate_name(list_t *boot_list) boot->var_data.Data; if (!efichar_char_strcmp(opts.label, load_option->description)) { - fprintf(stderr, "** Warning ** : Boot%04x has same label %s\n", - boot->num, + fprintf(stderr, "** Warning ** : %.8s has same label %s\n", + boot->name->d_name, opts.label); } } @@ -228,9 +229,21 @@ make_boot_var(list_t *boot_list) { var_entry_t *boot; int free_number; + list_t *pos; - if (opts.bootnum == -1) free_number = find_free_boot_var(boot_list); - else free_number = opts.bootnum; + if (opts.bootnum == -1) + free_number = find_free_boot_var(boot_list); + else { + list_for_each(pos, boot_list) { + boot = list_entry(pos, var_entry_t, list); + if (boot->num == opts.bootnum) { + fprintf(stderr, "** Warning ** : bootnum %04X " + "already exists\n", opts.bootnum); + return NULL; + } + } + free_number = opts.bootnum; + } if (free_number == -1) return NULL; @@ -398,13 +411,20 @@ delete_boot_var(uint16_t num) list_t *pos, *n; var_entry_t *boot; - snprintf(name, sizeof(name), "Boot%04x", num); + snprintf(name, sizeof(name), "Boot%04X", num); memset(&var, 0, sizeof(var)); fill_var(&var, name); status = delete_variable(&var); - if (status) return status; + /* For backwards compatibility, try to delete abcdef entries as well */ + if (status) { + snprintf(name, sizeof(name), "Boot%04x", num); + memset(&var, 0, sizeof(var)); + fill_var(&var, name); + status = delete_variable(&var); + } + if (status) return status; list_for_each_safe(pos, n, &boot_entry_list) { boot = list_entry(pos, var_entry_t, list); if (boot->num == num) { @@ -424,11 +444,27 @@ set_var_nums(const char *pattern, list_t *list) list_t *pos; var_entry_t *var; int num=0, rc; + char *name; + int warn=0; list_for_each(pos, list) { var = list_entry(pos, var_entry_t, list); rc = sscanf(var->name->d_name, pattern, &num); - if (rc == 1) var->num = num; + if (rc == 1) { + var->num = num; + name = var->name->d_name; /* shorter name */ + if ((isalpha(name[4]) && islower(name[4])) || + (isalpha(name[5]) && islower(name[5])) || + (isalpha(name[6]) && islower(name[6])) || + (isalpha(name[7]) && islower(name[7]))) { + fprintf(stderr, "** Warning ** : %.8s is not " + "EFI 1.10 compliant (lowercase hex in name)\n", name); + warn++; + } + } + } + if (warn) { + fprintf(stderr, "** Warning ** : please recreate these using efibootmgr to remove this warning.\n"); } } @@ -528,7 +564,7 @@ unparse_boot_order(uint16_t *order, int length) int i; printf("BootOrder: "); for (i=0; idescription, sizeof(description)); memset(text_path, 0, sizeof(text_path)); path = load_option_path(load_option); - printf("Boot%04x", boot->num); + if (boot->name) + printf("%.8s", boot->name->d_name); + else + printf("Boot%04X", boot->num); + if (load_option->attributes & LOAD_OPTION_ACTIVE) printf("* "); else printf(" "); @@ -790,7 +830,7 @@ parse_opts(int argc, char **argv) opts.delete_boot = 1; break; case 'b': - rc = sscanf(optarg, "%x", &num); + rc = sscanf(optarg, "%X", &num); if (rc == 1) opts.bootnum = num; break; case 'c': @@ -920,7 +960,7 @@ main(int argc, char **argv) if (!opts.testfile) { num_boot_names = read_boot_var_names(&boot_names); read_vars(boot_names, num_boot_names, &boot_entry_list); - set_var_nums("Boot%04x-%*s", &boot_entry_list); + set_var_nums("Boot%04X-%*s", &boot_entry_list); if (opts.delete_boot) { if (opts.bootnum == -1) @@ -972,11 +1012,11 @@ main(int argc, char **argv) if (!opts.quiet) { num = read_boot_u16("BootNext"); if (num != -1 ) { - printf("BootNext: %04x\n", num); + printf("BootNext: %04X\n", num); } num = read_boot_u16("BootCurrent"); if (num != -1) { - printf("BootCurrent: %04x\n", num); + printf("BootCurrent: %04X\n", num); } num = read_boot_u16("Timeout"); if (num != -1) { diff --git a/src/lib/efi.c b/src/lib/efi.c index 26c144a..ac782c9 100644 --- a/src/lib/efi.c +++ b/src/lib/efi.c @@ -20,8 +20,9 @@ #define _FILE_OFFSET_BITS 64 -typedef unsigned long long u64; /* hack to allow include of ethtool.h */ +typedef unsigned long long u64; /* hack to allow include of ethtool.h */ +#include #include #include #include @@ -173,9 +174,12 @@ create_or_edit_variable(efi_variable_t *var) static int select_boot_var_names(const struct dirent *d) { - int num, rc; - rc = sscanf(d->d_name, "Boot0%03x-%*s", &num); - return rc; + if (!strncmp(d->d_name, "Boot", 4) && + isxdigit(d->d_name[4]) && isxdigit(d->d_name[5]) && + isxdigit(d->d_name[6]) && isxdigit(d->d_name[7]) && + d->d_name[8] == '-') + return 1; + return 0; } int @@ -718,7 +722,7 @@ make_linux_efi_variable(efi_variable_t *var, memset(buffer, 0, sizeof(buffer)); /* VariableName needs to be BootXXXX */ - sprintf(buffer, "Boot%04x", free_number); + sprintf(buffer, "Boot%04X", free_number); efichar_from_char(var->VariableName, buffer, 1024); -- 2.30.2