From nobody Tue Apr 16 20:12:53 2024 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VJwFd6M5dz5H0Qd; Tue, 16 Apr 2024 20:12:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VJwFd40WQz4t4f; Tue, 16 Apr 2024 20:12:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713298373; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5/zk9KC8Q4RsaQHAVzD+y/Kpr3yMqsv0BaBqQ6uGnnE=; b=XJbEdiHpdtyXpACisVut+ULBkbeOATsZ0RmwwGdGpKi4E/ItLAe/bpMPDP4zzdrTTt9m3R AiwdhzYlJnQ6wgPOj0OGH5sVjeieSoUSbbUmOVCk+u9ucwoCPD0DeXnD2amX2gicRn6NMW pjubVDkXfQ59R47ukBfVvnSWLuHsOPGjOX74NXRY/247JQ0Ce38FSE449NqUfO4fyeeCzm 8hIR08BtYYY8w9XVbAhI06pk/zGXH+kzS7n3o3NtYXx3G/4775BdkUBqUNa90L51ZxIFq6 bnZN1mbmW/K7zDTFiFprWbY9hgiHXOfd1Y3ljNhOFx+eKRs34h7VpUupw8NiVQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713298373; a=rsa-sha256; cv=none; b=u4hx7/t+c6KcizNJisv0JlR5IhmCFobxfWnhE9AOHZW1cReaYeBxVhGgQaudZ2wqHmIymY H4UJt+PL+PChWsZEF3HvVT58EOdHo+xXsHOWWBjp14lnuUKhbOndtI5l4bGpPhTLzekXb2 gxNxY92k5Vtbn6Omgbo/gZg8KYRZR+RhLoOSiJJL41B9hAWygd0L+UGTrRC97Wvyj4uXTY yb6KusgdQYBr3VTMNQi/8g8FU5V7aBX/rlp1zwIKAx8HIc4iA+TMrcB2TajqUGzunEXTxX mE4/UZrdOOJ+CU/HGEoNhjgYKCE3gzXEROslgipvJ9RSX4A6+ieDhsngriOtnQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713298373; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5/zk9KC8Q4RsaQHAVzD+y/Kpr3yMqsv0BaBqQ6uGnnE=; b=cq5H06Rnx8HNZbviDuMHzCef56mbvWwHhRHIURCy9iiR9WiLF8zCd+n16UusUrLThvDVHe now0boBVwiThP6l9V270sauu1FLt9Bl4kUeFxXgIGbsoflMlVtByJ6EPh0WdvK8WU9dqT5 rp8gT7l6Wn9TYCxFZED8NWUnx/nJ53zXHPtbZJpdvaM4pbyvmYiGDIspJKf95vUuVV6jWV zsjzb/zFAecjLgf6oRUfFPPhLHmGfme0ulbCIK8fOhesh/C14vB2pYSP0gFcrL2bUErOvw tbwXi5PQB4hTSOV+VOpxptUmQMCn8gFCAf/Gio2afaUajP+sXZT9TY0eYTua/A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VJwFd3ZszzxY2; Tue, 16 Apr 2024 20:12:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43GKCr6N038156; Tue, 16 Apr 2024 20:12:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43GKCrP5038153; Tue, 16 Apr 2024 20:12:53 GMT (envelope-from git) Date: Tue, 16 Apr 2024 20:12:53 GMT Message-Id: <202404162012.43GKCrP5038153@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 78f5850093c5 - stable/14 - kboot: Add our own lua bindings List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 78f5850093c5afe2a710903b2422dfc9857e401d Auto-Submitted: auto-generated The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=78f5850093c5afe2a710903b2422dfc9857e401d commit 78f5850093c5afe2a710903b2422dfc9857e401d Author: Warner Losh AuthorDate: 2024-02-16 03:54:55 +0000 Commit: Warner Losh 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 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