From nobody Fri Feb 16 04:00:33 2024 X-Original-To: dev-commits-src-main@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 4TbdWP6BMLz59ZKP; Fri, 16 Feb 2024 04:00:33 +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 4TbdWP4M91z4HLx; Fri, 16 Feb 2024 04:00:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708056033; 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=WRXo4zfsB6pW0goeaYQ45WTckws3tiwxjhReYHU/yBk=; b=T86jh3nDd5D2EftB1ZC3SEoaPUwJ/079MzzNJxBSygQdF5VXiccTqssuSRrzXV8nkL9DYl 4WM9lnglB5ngbCi+p5TaRcuys0OfGZJ9dBDrfuTZbxvhg8dd5m+xVHf6l75CAdbpGJXwmm VOWf+XRpVtBqmbajmOF3CG4QGjxRVHq4Vq8p572v1KKa6+YIQKa/OOXq3CMLJ5/Ue1sQNY +h4SGt0yILr8HBlOQCWDhTjm7yPNFVL39Z2VWHu7z/pFek9DZ9vSbgXI5f6CxYsii7gm+Y kO6mFqFyHJKIfB60JiXbn3M4Ev3R9/kyX0q7NSIY0SHtHRBTQ3jipu7yFNFBfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708056033; 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=WRXo4zfsB6pW0goeaYQ45WTckws3tiwxjhReYHU/yBk=; b=SCaV+nLqbHsTu0YwcybSbyXajK0ULxw3AGI9t4382luQNswb/GKUidkUuvxsdTpJz+nxW6 CEk84ZlTO3Y4yZEuG+wA5xt7ozpwAAQ8WTQn5hb7fW5EwquGW9FlUIMVDapH7m1NWS6g0b EvJC11NnljSCrpxVt+Z7KbdELk7/cGMC3jVxLcBk8rGe6hjCXkcJ2QwdTiHZF7MMSAu2zL gQ72LCQQlOjmzUgQxScZt13aKxujbCfT+CxVaaKrtuSCJJQh9bso68nIPkhmjSef0L1b6Y Yx500JMp/yzxZccp790/0It5QBvcoaTn0XEAvYtL6/zQswvFNbT0AR75AG4hMg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708056033; a=rsa-sha256; cv=none; b=bwUwYOy95OY99SXSfyCjAmNaXhdDGbgNP7ZspBFj0VRMSy/hInbEgWMIBrt4lwqXUpOLaf TsZLfeHDEZBqnj9tSqx+c3xxCtD4/CYljc0WGRehFZaSKoMalULvr4JdgQVMKrQ01q3Pbi qJPX0Y8oaiulvE5E8X729MA2mSRsCyHLpNw/ammEIuXoF8TtE9tNlyxMDLfugkafLC+o+F grP07l/+b1Xw1yUzy0HR466fyf2xB4vzuIrfQZqfNJz8YfWH6u/ruqzivln7ZuEIwBZUL/ Vm7eY4zH//FfAZbYibICpkuHeyJ+f0eIcW5ZMmukuIx1JhffCCz33+VewRj8LQ== 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 4TbdWP3RLLz18b6; Fri, 16 Feb 2024 04:00:33 +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 41G40X6U019296; Fri, 16 Feb 2024 04:00:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41G40XDY019293; Fri, 16 Feb 2024 04:00:33 GMT (envelope-from git) Date: Fri, 16 Feb 2024 04:00:33 GMT Message-Id: <202402160400.41G40XDY019293@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: e34fd722cafe - main - kboot: Add our own lua bindings List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: e34fd722cafe8639214c72997f08b5f5faa9c21f Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e34fd722cafe8639214c72997f08b5f5faa9c21f commit e34fd722cafe8639214c72997f08b5f5faa9c21f Author: Warner Losh AuthorDate: 2024-02-16 03:54:55 +0000 Commit: Warner Losh CommitDate: 2024-02-16 03:59:23 +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 --- 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