From ce8f48d28c8d6d99b860e3f6480d9d3a6fc0b301 Mon Sep 17 00:00:00 2001 From: Darren Hart Date: Fri, 26 Jul 2013 13:47:44 -0700 Subject: gummiboot: Add gummiboot recipe gummiboot is a simple UEFI boot manager. It uses configuration files to setup the default boot entry or presents an on-screen menu. Signed-off-by: Darren Hart --- ...c-Add-option-to-disable-configuring-the-B.patch | 39 ++++++++++++++++ ...c-Use-AC_CHECK_HEADER-to-detect-the-efi-i.patch | 48 ++++++++++++++++++++ ...-Allow-for-user-override-of-EFI-include-d.patch | 39 ++++++++++++++++ ...ac-Allow-for-more-than-just-i686-for-ia32.patch | 40 +++++++++++++++++ ...tect-both-x64-and-ia32-boot-.efi-payloads.patch | 33 ++++++++++++++ .../0006-Add-32-bit-compatible-rdtsc-asm.patch | 52 ++++++++++++++++++++++ common/recipes-bsp/gummiboot/gummiboot_git.bb | 32 +++++++++++++ 7 files changed, 283 insertions(+) create mode 100644 common/recipes-bsp/gummiboot/files/0001-configure.ac-Add-option-to-disable-configuring-the-B.patch create mode 100644 common/recipes-bsp/gummiboot/files/0002-configure.ac-Use-AC_CHECK_HEADER-to-detect-the-efi-i.patch create mode 100644 common/recipes-bsp/gummiboot/files/0003-Makefile.am-Allow-for-user-override-of-EFI-include-d.patch create mode 100644 common/recipes-bsp/gummiboot/files/0004-configure.ac-Allow-for-more-than-just-i686-for-ia32.patch create mode 100644 common/recipes-bsp/gummiboot/files/0005-Auto-detect-both-x64-and-ia32-boot-.efi-payloads.patch create mode 100644 common/recipes-bsp/gummiboot/files/0006-Add-32-bit-compatible-rdtsc-asm.patch create mode 100644 common/recipes-bsp/gummiboot/gummiboot_git.bb (limited to 'common') diff --git a/common/recipes-bsp/gummiboot/files/0001-configure.ac-Add-option-to-disable-configuring-the-B.patch b/common/recipes-bsp/gummiboot/files/0001-configure.ac-Add-option-to-disable-configuring-the-B.patch new file mode 100644 index 00000000..9ed0a5e0 --- /dev/null +++ b/common/recipes-bsp/gummiboot/files/0001-configure.ac-Add-option-to-disable-configuring-the-B.patch @@ -0,0 +1,39 @@ +From c72599a7bd46c22d296c59dbd13f138503350d2f Mon Sep 17 00:00:00 2001 +Message-Id: +From: Darren Hart +Date: Tue, 30 Apr 2013 21:11:17 -0700 +Subject: [PATCH 1/4] configure.ac: Add option to disable configuring the BIOS + test + +When cross-compiling, AC_CHECK_FILE aborts configure. Provide a means to +avoid even attempting to configure the BIOS test. + +Signed-off-by: Darren Hart +--- + configure.ac | 10 +++++++--- + 1 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/configure.ac b/configure.ac +index efa0e54..524060c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -66,9 +66,13 @@ AC_SUBST([ARCH]) + AC_SUBST([MACHINE_TYPE_NAME]) + + # test bios +-AC_CHECK_FILE([/usr/lib/qemu-bios], [BIOS=/usr/lib/qemu-bios]) +-AC_CHECK_FILE([/usr/share/qemu-ovmf/bios], [BIOS=/usr/share/qemu-ovmf/bios]) +-AC_SUBST([BIOS]) ++AC_ARG_ENABLE(biostest, AS_HELP_STRING([--disable-biostest], [disable building BIOS test])) ++if test "x$enable_biostest" != "xno"; then ++ AC_CHECK_FILE([/usr/lib/qemu-bios], [BIOS=/usr/lib/qemu-bios]) ++ AC_CHECK_FILE([/usr/share/qemu-ovmf/bios], [BIOS=/usr/share/qemu-ovmf/bios]) ++ AC_SUBST([BIOS]) ++fi ++AM_CONDITIONAL(ENABLE_BIOSTEST, [test "x$enable_biostest" = "xyes"]) + + # ------------------------------------------------------------------------------ + dnl Compile EFI stuff is so tricky that it's probably better to check for the +-- +1.7.5.4 + diff --git a/common/recipes-bsp/gummiboot/files/0002-configure.ac-Use-AC_CHECK_HEADER-to-detect-the-efi-i.patch b/common/recipes-bsp/gummiboot/files/0002-configure.ac-Use-AC_CHECK_HEADER-to-detect-the-efi-i.patch new file mode 100644 index 00000000..478eab82 --- /dev/null +++ b/common/recipes-bsp/gummiboot/files/0002-configure.ac-Use-AC_CHECK_HEADER-to-detect-the-efi-i.patch @@ -0,0 +1,48 @@ +From b4ad8b65a79e2cf8857439271c88bd44f5e9cd05 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: +References: +From: Darren Hart +Date: Tue, 30 Apr 2013 21:13:39 -0700 +Subject: [PATCH 2/4] configure.ac: Use AC_CHECK_HEADER to detect the efi + includes + +While cross-compiling, AC_CHECK_FILE will abort the configure. + +The gnu-efi sources don't use relative paths and require the user to +explicitly include -I/usr/include/efi/${ARCH}. I haven't found a way to +do this with AC_CHECK_HEADER. However, since the existing test was not +testing for usability (conftest.c compilation), we don't lose much by +just not looking for efi.h and assume it exists if we can find and use +efibind.h. + +Signed-off-by: Darren Hart +--- + configure.ac | 11 ++++++----- + 1 files changed, 6 insertions(+), 5 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 524060c..f7c62ea 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -75,11 +75,12 @@ fi + AM_CONDITIONAL(ENABLE_BIOSTEST, [test "x$enable_biostest" = "xyes"]) + + # ------------------------------------------------------------------------------ +-dnl Compile EFI stuff is so tricky that it's probably better to check for the +-dnl include files that try to use AC_CHECK_HEADERS to compile any conftest.c +-AC_CHECK_FILES([/usr/include/efi/efi.h +- /usr/include/efi/${ARCH}/efibind.h], [], +- [AC_MSG_ERROR([*** GNU Efi headers not found])]) ++dnl GNU EFI doesn't use relative paths: efi.h includes efibind.h which is in ++dnl ${ARCH} relative to efi.h. I can't find a way to get AC_CHECK_HEADERS to ++dnl add -I/usr/include/efi/${ARCH} to the conftest.c build. So, just test for ++dnl efibind.h as the chances of efi.h not existing if it does are very low. ++AC_CHECK_HEADER(efi/${ARCH}/efibind.h, [], ++ [AC_MSG_ERROR([*** GNU EFI header efibind.h not found])]) + + efiroot=$(echo $(cd /usr/lib/$(gcc -print-multi-os-directory); pwd)) + GNUEFI_LIBS="-L $efiroot" +-- +1.7.5.4 + diff --git a/common/recipes-bsp/gummiboot/files/0003-Makefile.am-Allow-for-user-override-of-EFI-include-d.patch b/common/recipes-bsp/gummiboot/files/0003-Makefile.am-Allow-for-user-override-of-EFI-include-d.patch new file mode 100644 index 00000000..7a51490c --- /dev/null +++ b/common/recipes-bsp/gummiboot/files/0003-Makefile.am-Allow-for-user-override-of-EFI-include-d.patch @@ -0,0 +1,39 @@ +From 8d1e561ef06889c7dd5943c5be2045c6cf98b14c Mon Sep 17 00:00:00 2001 +Message-Id: <8d1e561ef06889c7dd5943c5be2045c6cf98b14c.1367382591.git.dvhart@linux.intel.com> +In-Reply-To: +References: +From: Darren Hart +Date: Tue, 30 Apr 2013 21:18:51 -0700 +Subject: [PATCH 3/4] Makefile.am: Allow for user override of EFI include dir + +Enable cross-compiling by allowing the user to specify an alternative to +the /usr/include directory for the EFI includes. Add a variable INCDIR +defaulting to /usr/include, but still allowing the user to provide their +own value. + +Signed-off-by: Darren Hart +--- + Makefile.am | 5 +++-- + 1 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 22e314d..2611971 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -72,10 +72,11 @@ CLEANFILES += man/gummiboot.8 + efi_loadername = gummiboot$(MACHINE_TYPE_NAME).efi + efi_sources = src/efi/gummiboot.c + ++INCDIR := /usr/include + efi_cppflags = \ + -I$(top_builddir) -include config.h \ +- -I/usr/include/efi \ +- -I/usr/include/efi/$(ARCH) ++ -I$(INCDIR)/efi \ ++ -I$(INCDIR)/efi/$(ARCH) + + efi_cflags = \ + -Wall \ +-- +1.7.5.4 + diff --git a/common/recipes-bsp/gummiboot/files/0004-configure.ac-Allow-for-more-than-just-i686-for-ia32.patch b/common/recipes-bsp/gummiboot/files/0004-configure.ac-Allow-for-more-than-just-i686-for-ia32.patch new file mode 100644 index 00000000..2f7e0d70 --- /dev/null +++ b/common/recipes-bsp/gummiboot/files/0004-configure.ac-Allow-for-more-than-just-i686-for-ia32.patch @@ -0,0 +1,40 @@ +From 981895439eb0713fa787b4aaf80df98530eb7ea6 Mon Sep 17 00:00:00 2001 +Message-Id: <981895439eb0713fa787b4aaf80df98530eb7ea6.1367382591.git.dvhart@linux.intel.com> +In-Reply-To: +References: +From: Darren Hart +Date: Tue, 30 Apr 2013 21:20:59 -0700 +Subject: [PATCH 4/4] configure.ac: Allow for more than just i686 for ia32 + +Expand the ARCH_I686 to include i*86* (specifically to catch i586). +Rename ARCH_I686 to ARCH_IA32 as that is more accurately what we are +testing for. + +Signed-off-by: Darren Hart +--- + configure.ac | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index f7c62ea..5d3d6ae 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -49,13 +49,13 @@ AC_PATH_PROG([XSLTPROC], [xsltproc]) + AC_PATH_PROG([QEMU_KVM], [qemu-kvm]) + + dnl Define ARCH_ conditionals +-SET_ARCH(I686, i686*) ++SET_ARCH(IA32, i*86*) + SET_ARCH(X86_64, x86_64*) + SET_ARCH(IA64, ia64*) + + ARCH=`echo $host | sed "s/\(-\).*$//"` + +-AM_COND_IF(ARCH_I686, [ ++AM_COND_IF(ARCH_IA32, [ + ARCH=ia32 + MACHINE_TYPE_NAME=ia32]) + +-- +1.7.5.4 + diff --git a/common/recipes-bsp/gummiboot/files/0005-Auto-detect-both-x64-and-ia32-boot-.efi-payloads.patch b/common/recipes-bsp/gummiboot/files/0005-Auto-detect-both-x64-and-ia32-boot-.efi-payloads.patch new file mode 100644 index 00000000..049218d3 --- /dev/null +++ b/common/recipes-bsp/gummiboot/files/0005-Auto-detect-both-x64-and-ia32-boot-.efi-payloads.patch @@ -0,0 +1,33 @@ +From 58204c946ec8f626d1b5997188b17978fcba5c9b Mon Sep 17 00:00:00 2001 +Message-Id: <58204c946ec8f626d1b5997188b17978fcba5c9b.1367616193.git.dvhart@linux.intel.com> +From: Darren Hart +Date: Fri, 3 May 2013 14:21:25 -0700 +Subject: [PATCH] Auto detect both x64 and ia32 boot*.efi payloads + +The EFI specification documents /EFI/BOOT/bootx64.efi for x86_64 +machines and /EFI/BOOT/bootia32.efi for ia32 machines. Update the auto +detection to allow for both. + +Signed-off-by: Darren Hart +--- + src/efi/gummiboot.c | 4 +++- + 1 files changed, 3 insertions(+), 1 deletions(-) + +diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c +index 3013873..ed68934 100644 +--- a/src/efi/gummiboot.c ++++ b/src/efi/gummiboot.c +@@ -1941,7 +1941,9 @@ EFI_STATUS EFIAPI efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { + config_entry_add_loader_auto(&config, loaded_image->DeviceHandle, root_dir, loaded_image_path, + L"auto-efi-shell", L"EFI Shell", L"\\shellx64.efi"); + config_entry_add_loader_auto(&config, loaded_image->DeviceHandle, root_dir, loaded_image_path, +- L"auto-efi-default", L"EFI Default Loader", L"\\EFI\\BOOT\\BOOTX64.EFI"); ++ L"auto-efi-default-64", L"EFI Default Loader (x64)", L"\\EFI\\BOOT\\BOOTX64.EFI"); ++ config_entry_add_loader_auto(&config, loaded_image->DeviceHandle, root_dir, loaded_image_path, ++ L"auto-efi-default-32", L"EFI Default Loader (ia32)", L"\\EFI\\BOOT\\BOOTIA32.EFI"); + config_entry_add_osx(&config); + efivar_set(L"LoaderEntriesAuto", config.entries_auto, FALSE); + +-- +1.7.5.4 + diff --git a/common/recipes-bsp/gummiboot/files/0006-Add-32-bit-compatible-rdtsc-asm.patch b/common/recipes-bsp/gummiboot/files/0006-Add-32-bit-compatible-rdtsc-asm.patch new file mode 100644 index 00000000..e170b695 --- /dev/null +++ b/common/recipes-bsp/gummiboot/files/0006-Add-32-bit-compatible-rdtsc-asm.patch @@ -0,0 +1,52 @@ +From e4711180646eb1fd701c4e5b124e5dc5372d446d Mon Sep 17 00:00:00 2001 +Message-Id: +From: Darren Hart +Date: Fri, 3 May 2013 15:10:43 -0700 +Subject: [PATCH] Add 32 bit compatible rdtsc asm + +Gcc's inline asm constraints have different meanings on x86_64 and ia32. +Include a 32 bit version for the rdtsc function. Drop the empty 32 bit +version of time_usec as it and the cpuid function both function properly +when compiled for 32 bit systems. + +Tested on the following CPU: +Intel(R) Atom(TM) CPU E640 @ 1.00GHz + +A value of 1000000000 was detected. + +Signed-off-by: Darren Hart +--- + src/efi/gummiboot.c | 10 +++++++--- + 1 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c +index 9be8f8e..971e05c 100644 +--- a/src/efi/gummiboot.c ++++ b/src/efi/gummiboot.c +@@ -89,6 +89,13 @@ static UINT64 ticks_read(void) { + __asm__ volatile ("rdtsc" : "=a" (a), "=d" (d)); + return (d << 32) | a; + } ++#else ++static UINT64 ticks_read(void) { ++ UINT64 val; ++ __asm__ volatile ("rdtsc" : "=A" (val)); ++ return val; ++} ++#endif + + static void cpuid_read(UINT32 info, UINT32 *eax, UINT32 *ebx, UINT32 *ecx, UINT32 *edx) { + *eax = info; +@@ -186,9 +193,6 @@ static UINT64 time_usec(void) { + + return 1000 * 1000 * ticks / cpufreq; + } +-#else +-static UINT64 time_usec(void) { return 0; } +-#endif + + static EFI_STATUS efivar_set_raw(const EFI_GUID *vendor, CHAR16 *name, CHAR8 *buf, UINTN size, BOOLEAN persistent) { + UINT32 flags; +-- +1.7.5.4 + diff --git a/common/recipes-bsp/gummiboot/gummiboot_git.bb b/common/recipes-bsp/gummiboot/gummiboot_git.bb new file mode 100644 index 00000000..871a9500 --- /dev/null +++ b/common/recipes-bsp/gummiboot/gummiboot_git.bb @@ -0,0 +1,32 @@ +SUMMARY = "Gummiboot is a simple UEFI boot manager which executes configured EFI images." +HOMEPAGE = "http://freedesktop.org/wiki/Software/gummiboot" + +LICENSE = "LGPLv2.1" +LIC_FILES_CHKSUM = "file://LICENSE;md5=4fbd65380cdd255951079008b364516c" + +DEPENDS = "gnu-efi util-linux" + +inherit autotools +inherit deploy + +PV = "33" +PR = "r0" +SRCREV = "cbc63ae9d6161fe6412f0457e72a276f5acb6e2a" +SRC_URI = "git://anongit.freedesktop.org/gummiboot \ + file://0001-configure.ac-Add-option-to-disable-configuring-the-B.patch \ + file://0002-configure.ac-Use-AC_CHECK_HEADER-to-detect-the-efi-i.patch \ + file://0003-Makefile.am-Allow-for-user-override-of-EFI-include-d.patch \ + file://0004-configure.ac-Allow-for-more-than-just-i686-for-ia32.patch \ + file://0005-Auto-detect-both-x64-and-ia32-boot-.efi-payloads.patch \ + file://0006-Add-32-bit-compatible-rdtsc-asm.patch" + +S = "${WORKDIR}/git" + +EXTRA_OECONF = "--disable-biostest" +EXTRA_OEMAKE = "INCDIR=${STAGING_INCDIR} GNUEFI_LDS_DIR=${STAGING_LIBDIR} \ + GNUEFI_LIBS='-L ${STAGING_LIBDIR}'" + +do_deploy () { + install ${S}/gummiboot*.efi ${DEPLOYDIR}/ +} +addtask deploy before do_build after do_compile -- cgit v1.2.3-54-g00ecf