Skip to content

Commit 933dd15

Browse files
stormcjan-kiszka
authored andcommitted
Fix version parsing and checks to also support gnu-efi >= 4.0
The current mechanism to parse gnu-efi's version is restricted to gnu-efi 3.x series. Improve the calculation to also account for gnu-efi 4.x series (and beyond). Reported-by: Andreas Tobler <[email protected]> Signed-off-by: Christian Storm <[email protected]> Signed-off-by: Jan Kiszka <[email protected]>
1 parent f094a14 commit 933dd15

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

configure.ac

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ AC_PROG_CC
4040
AC_CHECK_TOOL(LD, ld)
4141
AC_CHECK_TOOL(OBJCOPY, objcopy)
4242
AC_CHECK_TOOL(GREP, grep)
43-
AC_CHECK_TOOL(TR, tr)
43+
AC_CHECK_TOOL(AWK, awk)
4444

4545
dnl Dont try to use things like -std=c99 for efi compilation
4646
GNUEFI_CC=$CC
@@ -232,9 +232,9 @@ if test "x$PKG_CONFIG" = "xno"; then
232232
fi
233233

234234
# Note: gnu-efi introduced pkg-config with version 3.0.16
235-
# GNU_EFI_VERSION resolves to gnu-efi's version without dots, e.g., GNU_EFI_VERSION=3016
235+
# GNU_EFI_VERSION resolves to gnu-efi's version without dots, e.g., GNU_EFI_VERSION=3000016
236236
# gnu-efi versions < 3.0.16 resolve to GNU_EFI_VERSION=0
237-
AC_SUBST([GNU_EFI_VERSION], [$( ($PKG_CONFIG --modversion "gnu-efi" 2>/dev/null || echo 0) | $TR -d '.' )])
237+
AC_SUBST([GNU_EFI_VERSION], [$( ($PKG_CONFIG --modversion "gnu-efi" 2>/dev/null || echo 0) | $AWK -F. '{print $1*1000000 + $2*1000 + $3}' )])
238238
AC_DEFINE_UNQUOTED([GNU_EFI_VERSION], [${GNU_EFI_VERSION}], [gnu-efi version])
239239

240240
AC_SUBST([OBJCOPY_HAS_EFI_APP_TARGET], [$($OBJCOPY --info | $GREP -q pei- 2>/dev/null && echo "true")])

drivers/watchdog/wdfuncs_end.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* SPDX-License-Identifier: GPL-2.0-only
1313
*/
1414

15-
#if GNU_EFI_VERSION < 3016
15+
#if GNU_EFI_VERSION < 3000016
1616

1717
#include <efi.h>
1818
#include "utils.h"

drivers/watchdog/wdfuncs_start.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* SPDX-License-Identifier: GPL-2.0-only
1313
*/
1414

15-
#if GNU_EFI_VERSION < 3016
15+
#if GNU_EFI_VERSION < 3000016
1616

1717
#include <efi.h>
1818
#include "utils.h"

main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ VOID register_watchdog(WATCHDOG_DRIVER *driver)
4545

4646
static EFI_STATUS probe_watchdogs(UINTN timeout)
4747
{
48-
#if GNU_EFI_VERSION < 3016
48+
#if GNU_EFI_VERSION < 3000016
4949
const unsigned long *entry = wdfuncs_start;
5050
for (entry++; entry < wdfuncs_end; entry++) {
5151
((void (*)(void))*entry)();

0 commit comments

Comments
 (0)