Date: Tue, 16 Apr 2024 20:12:53 GMT From: Warner Losh <imp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 78f5850093c5 - stable/14 - kboot: Add our own lua bindings Message-ID: <202404162012.43GKCrP5038153@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=78f5850093c5afe2a710903b2422dfc9857e401d commit 78f5850093c5afe2a710903b2422dfc9857e401d Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2024-02-16 03:54:55 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2024-04-16 19:54:24 +0000 kboot: Add our own lua bindings Create a small wrapper around the new flua hash module so we can use it here too. There's no 4th bindings, nor will they be created. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D43874 (cherry picked from commit e34fd722cafe8639214c72997f08b5f5faa9c21f) --- stand/defs.mk | 1 + stand/i386/loader/Makefile | 2 +- stand/kboot/kboot/Makefile | 7 +++++++ stand/kboot/kboot/lua_bindings.c | 19 +++++++++++++++++++ stand/liblua/Makefile | 3 +++ 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/stand/defs.mk b/stand/defs.mk index e8480a8c2b1e..3624b9311161 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -62,6 +62,7 @@ BINDIR?= /boot # LUAPATH is where we search for and install lua scripts. LUAPATH?= /boot/lua FLUASRC?= ${SRCTOP}/libexec/flua +FLUALIB?= ${SRCTOP}/lib/flua LIBSA= ${BOOTOBJ}/libsa/libsa.a .if ${MACHINE} == "i386" diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile index de96e1329b2f..57191b3c8f78 100644 --- a/stand/i386/loader/Makefile +++ b/stand/i386/loader/Makefile @@ -33,7 +33,7 @@ VERSION_FILE= ${.CURDIR}/../loader/version # # will tell you how many kiB of lomem are available. # -LOADERSIZE?= 550000 # Largest known safe size for loader.bin +LOADERSIZE?= 570000 # Largest known safe size for loader.bin .PATH: ${BOOTSRC}/i386/loader diff --git a/stand/kboot/kboot/Makefile b/stand/kboot/kboot/Makefile index 2e68a9ba9214..b571c3acada1 100644 --- a/stand/kboot/kboot/Makefile +++ b/stand/kboot/kboot/Makefile @@ -60,4 +60,11 @@ CFLAGS+= -Wall DPADD= ${LDR_INTERP} ${LIBOFW} ${LIBSAFDT} ${LIBSA} ${LIBKBOOT} LDADD= ${LDR_INTERP} ${LIBOFW} ${LIBSAFDT} ${LIBSA} ${LIBKBOOT} +# Add our own lua bindings until they are universal +.if ${LOADER_INTERP} == "lua" +SRCS+= \ + lua_bindings.c +CFLAGS.lua_bindings.c+= -I${FLUALIB}/libhash +.endif + .include <bsd.prog.mk> diff --git a/stand/kboot/kboot/lua_bindings.c b/stand/kboot/kboot/lua_bindings.c new file mode 100644 index 000000000000..ca5d0253c21f --- /dev/null +++ b/stand/kboot/kboot/lua_bindings.c @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2024 Netflix, Inc. + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include "lua.h" +#include "lauxlib.h" +#include "lutils.h" +#include "lhash.h" + +static void +lua_hash_bindings(lua_State *L) +{ + luaL_requiref(L, "hash", luaopen_hash, 1); + lua_pop(L, 1); /* Remove lib */ +} + +LUA_COMPILE_SET(lua_hash_bindings); diff --git a/stand/liblua/Makefile b/stand/liblua/Makefile index bbfa21e07f53..b0d89bec4f02 100644 --- a/stand/liblua/Makefile +++ b/stand/liblua/Makefile @@ -27,6 +27,8 @@ SRCS+= gfx_utils.c .PATH: ${FLUASRC}/modules SRCS+= lfs.c +.PATH: ${FLUALIB}/libhash +SRCS+= lhash.c WARNS?= 3 @@ -36,6 +38,7 @@ CFLAGS+= -fno-stack-protector -D__BSD_VISIBLE CFLAGS+= -I${BOOTSRC}/include -I${LIBLUASRC} -I${LUASRC} -I${LDRSRC} CFLAGS.gfx_utils.c+= -I${SRCTOP}/sys/teken -I${SRCTOP}/contrib/pnglite +CFLAGS.lhash.c+= -I${FLUALIB}/libhash -I${SRCTOP}/sys/crypto/sha2 .if ${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 0 CFLAGS+= -fPIC
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202404162012.43GKCrP5038153>