Skip to content

Commit b8fb47d

Browse files
committed
lacpi: Loader compilation
These bindings have two conditions: (1) Must be built on `amd64` (2) Must be building `loader_lua` If these conditions are met: - Add liblua as a subdir in EFI - Include liblua/acpi/include in loader/Makefile - Add set_lua_acpi_modules to the loader compile set - Add 'lacpi.h' to loader/main.c and reference the bindings
1 parent 1a20a35 commit b8fb47d

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

stand/efi/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ SUBDIR.${MK_LOADER_IA32}+= libefi32
77
SUBDIR.${MK_FDT}+= fdt
88
SUBDIR.yes+= libacpi
99
SUBDIR.${MK_LOADER_IA32}+= libacpi32
10+
SUBDIR.yes+= ../liblua
1011
SUBDIR.yes+= .WAIT
1112

1213
SUBDIR.yes+= boot1 gptboot

stand/efi/loader/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ CFLAGS+= -DEFI
7272

7373
.if ${MACHINE} == "amd64" && ${DO32:U0} == 0
7474
CFLAGS+= -I${EFISRC}/libacpi/acpi/include
75+
CFLAGS+= -I${EFISRC}/../liblua/acpi/include
7576
.endif
7677

7778
.if defined(HAVE_FDT) && ${MK_FDT} != "no"
@@ -127,6 +128,20 @@ LDFLAGS+= -Wl,--threads=1
127128

128129
CLEANFILES+= ${LOADER}.efi
129130

131+
# ACPI Lua bindings compile set
132+
.if ${__arch} == "amd64" && ${DO32:U0} == 0 && ${LOADER} == "loader_lua"
133+
LACPI_COMPILE_SET= -j set_lua_acpi_modules
134+
.else
135+
LACPI_COMPILE_SET=
136+
.endif
137+
138+
# To protect ACPI init and lua bindings
139+
.if ${LOADER} == "loader_lua"
140+
CFLAGS+= -DLACPI=1
141+
.else
142+
CFLAGS+= -DLACPI=0
143+
.endif
144+
130145
${LOADER}.efi: ${PROG}
131146
@if ${NM} ${.ALLSRC} | grep ' U '; then \
132147
echo "Undefined symbols in ${.ALLSRC}"; \
@@ -137,6 +152,7 @@ ${LOADER}.efi: ${PROG}
137152
-j .dynamic -j .dynsym -j .rel.dyn \
138153
-j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \
139154
-j set_X${LOADER_INTERP}_compile_set \
155+
${LACPI_COMPILE_SET} \
140156
--output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET}
141157

142158
LIBEFI= ${BOOTOBJ}/efi/libefi/libefi.a

stand/efi/loader/main.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@
6767
#include "acconfig.h"
6868
#define ACPI_SYSTEM_XFACE
6969

70-
#if defined(__amd64__)
70+
#if defined(__amd64__) && LACPI
7171
#include <init_acpi.h>
72+
#include <lacpi.h>
7273
#else
7374
#include <acpi.h>
7475
#endif
@@ -1235,11 +1236,13 @@ main(int argc, CHAR16 *argv[])
12351236

12361237
devinit();
12371238

1238-
#if defined(__amd64__)
1239+
#if defined(__amd64__) && LACPI
12391240
/* Initialize ACPI Subsystem and Tables. */
12401241
if ((ret = init_acpi()) != 0) {
12411242
printf("Failed to initialize ACPI\n.");
12421243
}
1244+
1245+
lacpi_interp_ref();
12431246
#endif
12441247

12451248
/*

0 commit comments

Comments
 (0)