Richard W.M. Jones
2016-May-22 20:34 UTC
[Libguestfs] [PATCH 0/2] uefi: Add new locations for UEFI files on Fedora.
https://bugzilla.redhat.com/show_bug.cgi?id=1338083 Now that UEFI is fully open source the UEFI firmware can be included in Fedora. The location will be slightly different. These patches do a bit of code rearrangement and add the new paths. Rich.
Richard W.M. Jones
2016-May-22 20:34 UTC
[Libguestfs] [PATCH 1/2] utils: Move UEFI firmware lists to src/uefi.c.
Just code motion, no functional change. --- docs/C_SOURCE_FILES | 1 + src/Makefile.am | 1 + src/guestfs-internal-frontend.h | 1 + src/uefi.c | 68 +++++++++++++++++++++++++++++++++++++++++ src/utils.c | 40 ------------------------ v2v/utils.ml | 2 +- 6 files changed, 72 insertions(+), 41 deletions(-) create mode 100644 src/uefi.c diff --git a/docs/C_SOURCE_FILES b/docs/C_SOURCE_FILES index d60974e..bd55f40 100644 --- a/docs/C_SOURCE_FILES +++ b/docs/C_SOURCE_FILES @@ -261,6 +261,7 @@ src/structs-copy.c src/structs-free.c src/structs-print.c src/tmpdirs.c +src/uefi.c src/umask.c src/unit-tests.c src/utils.c diff --git a/src/Makefile.am b/src/Makefile.am index bdac5e3..d659f8d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -235,6 +235,7 @@ libutils_la_SOURCES = \ structs-cleanup.c \ structs-print.c \ structs-print.h \ + uefi.c \ utils.c libutils_la_CPPFLAGS = $(libguestfs_la_CPPFLAGS) libutils_la_CFLAGS = $(libguestfs_la_CFLAGS) diff --git a/src/guestfs-internal-frontend.h b/src/guestfs-internal-frontend.h index 8ba8a25..1490c6e 100644 --- a/src/guestfs-internal-frontend.h +++ b/src/guestfs-internal-frontend.h @@ -92,6 +92,7 @@ extern void guestfs_int_fadvise_noreuse (int fd); //extern void guestfs_int_fadvise_willneed (int fd); extern char *guestfs_int_shell_unquote (const char *str); +/* uefi.c */ struct uefi_firmware { const char *code; /* code file (NULL = end of list) */ const char *code_debug; /* code file with debugging msgs (may be NULL)*/ diff --git a/src/uefi.c b/src/uefi.c new file mode 100644 index 0000000..0dd2adb --- /dev/null +++ b/src/uefi.c @@ -0,0 +1,68 @@ +/* libguestfs + * Copyright (C) 2009-2016 Red Hat Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * Locations of UEFI files. + */ + +#include <config.h> + +#include <stdio.h> + +/* NB: MUST NOT include "guestfs-internal.h". */ +#include "guestfs-internal-frontend.h" + +/* See src/appliance.c:guestfs_int_get_uefi. */ +struct uefi_firmware +guestfs_int_ovmf_i386_firmware[] = { + { "/usr/share/edk2.git/ovmf-ia32/OVMF_CODE-pure-efi.fd", + NULL, + "/usr/share/edk2.git/ovmf-ia32/OVMF_VARS-pure-efi.fd" }, + + { NULL } +}; + +struct uefi_firmware +guestfs_int_ovmf_x86_64_firmware[] = { + { "/usr/share/OVMF/OVMF_CODE.fd", + NULL, + "/usr/share/OVMF/OVMF_VARS.fd" }, + + { "/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd", + NULL, + "/usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd" }, + + { "/usr/share/qemu/ovmf-x86_64-code.bin", + NULL, + "/usr/share/qemu/ovmf-x86_64-vars.bin" }, + + { NULL } +}; + +struct uefi_firmware +guestfs_int_aavmf_firmware[] = { + { "/usr/share/AAVMF/AAVMF_CODE.fd", + "/usr/share/AAVMF/AAVMF_CODE.verbose.fd", + "/usr/share/AAVMF/AAVMF_VARS.fd" }, + + { "/usr/share/edk2.git/aarch64/QEMU_EFI-pflash.raw", + NULL, + "/usr/share/edk2.git/aarch64/vars-template-pflash.raw" }, + + { NULL } +}; diff --git a/src/utils.c b/src/utils.c index 4faff9e..47ff9f8 100644 --- a/src/utils.c +++ b/src/utils.c @@ -354,46 +354,6 @@ guestfs_int_is_true (const char *str) return -1; } -/* See src/appliance.c:guestfs_int_get_uefi. */ -struct uefi_firmware -guestfs_int_ovmf_i386_firmware[] = { - { "/usr/share/edk2.git/ovmf-ia32/OVMF_CODE-pure-efi.fd", - NULL, - "/usr/share/edk2.git/ovmf-ia32/OVMF_VARS-pure-efi.fd" }, - - { NULL } -}; - -struct uefi_firmware -guestfs_int_ovmf_x86_64_firmware[] = { - { "/usr/share/OVMF/OVMF_CODE.fd", - NULL, - "/usr/share/OVMF/OVMF_VARS.fd" }, - - { "/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd", - NULL, - "/usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd" }, - - { "/usr/share/qemu/ovmf-x86_64-code.bin", - NULL, - "/usr/share/qemu/ovmf-x86_64-vars.bin" }, - - { NULL } -}; - -struct uefi_firmware -guestfs_int_aavmf_firmware[] = { - { "/usr/share/AAVMF/AAVMF_CODE.fd", - "/usr/share/AAVMF/AAVMF_CODE.verbose.fd", - "/usr/share/AAVMF/AAVMF_VARS.fd" }, - - { "/usr/share/edk2.git/aarch64/QEMU_EFI-pflash.raw", - NULL, - "/usr/share/edk2.git/aarch64/vars-template-pflash.raw" }, - - { NULL } -}; - #if 0 /* not used yet */ /** * Hint that we will read or write the file descriptor normally. diff --git a/v2v/utils.ml b/v2v/utils.ml index fc1c502..2dff6aa 100644 --- a/v2v/utils.ml +++ b/v2v/utils.ml @@ -93,7 +93,7 @@ external aavmf_firmware : unit -> uefi_firmware list = "v2v_utils_aavmf_firmware (* Find the UEFI firmware. *) let find_uefi_firmware guest_arch let files - (* The lists of firmware are actually defined in src/utils.c. *) + (* The lists of firmware are actually defined in src/uefi.c. *) match guest_arch with | "i386" | "i486" | "i586" | "i686" -> ovmf_i386_firmware () | "x86_64" -> ovmf_x86_64_firmware () -- 2.7.4
Richard W.M. Jones
2016-May-22 20:34 UTC
[Libguestfs] [PATCH 2/2] uefi: Add new locations for UEFI files on Fedora (RHBZ#1338083).
Now that UEFI is fully open source the UEFI firmware can be included in Fedora. However the location is slightly different from the location that was used by kraxel's out of distro firmware. This commit searches for UEFI files in the new location, falling back to the old location (until the end of this year when we will drop it entirely). Thanks: Cole Robinson, Gerd Hoffmann (kraxel) & Microsoft for relicensing the FAT code. --- src/uefi.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/uefi.c b/src/uefi.c index 0dd2adb..44340fe 100644 --- a/src/uefi.c +++ b/src/uefi.c @@ -30,6 +30,7 @@ /* See src/appliance.c:guestfs_int_get_uefi. */ struct uefi_firmware guestfs_int_ovmf_i386_firmware[] = { + /* kraxel's old repository, these will be removed by end of 2016. */ { "/usr/share/edk2.git/ovmf-ia32/OVMF_CODE-pure-efi.fd", NULL, "/usr/share/edk2.git/ovmf-ia32/OVMF_VARS-pure-efi.fd" }, @@ -43,6 +44,11 @@ guestfs_int_ovmf_x86_64_firmware[] = { NULL, "/usr/share/OVMF/OVMF_VARS.fd" }, + { "/usr/share/edk2/ovmf/OVMF_CODE.fd", + NULL, + "/usr/share/edk2/ovmf/OVMF_VARS.fd" }, + + /* kraxel's old repository, these will be removed by end of 2016. */ { "/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd", NULL, "/usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd" }, @@ -60,6 +66,11 @@ guestfs_int_aavmf_firmware[] = { "/usr/share/AAVMF/AAVMF_CODE.verbose.fd", "/usr/share/AAVMF/AAVMF_VARS.fd" }, + { "/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw", + NULL, + "/usr/share/edk2/aarch64/vars-template-pflash.raw" }, + + /* kraxel's old repository, these will be removed by end of 2016. */ { "/usr/share/edk2.git/aarch64/QEMU_EFI-pflash.raw", NULL, "/usr/share/edk2.git/aarch64/vars-template-pflash.raw" }, -- 2.7.4
Pino Toscano
2016-May-23 09:05 UTC
Re: [Libguestfs] [PATCH 0/2] uefi: Add new locations for UEFI files on Fedora.
On Sunday 22 May 2016 21:34:18 Richard W.M. Jones wrote:> https://bugzilla.redhat.com/show_bug.cgi?id=1338083 > > Now that UEFI is fully open source the UEFI firmware can be included > in Fedora. The location will be slightly different. These patches do > a bit of code rearrangement and add the new paths.LGTM. Thanks, -- Pino Toscano
Maybe Matching Threads
- [PATCH] v2v: Use OVMF secure boot file (RHBZ#1367615).
- [PATCH v2 0/2] v2v: Use OVMF secure boot file (RHBZ#1367615).
- unable to find any master var store for loader error
- Re: unable to find any master var store for loader error
- uefi built from tiancore via edk2 can't persist boot changes