diff --git a/include/image-commands.mk b/include/image-commands.mk index ea21ca2bf0..9611547748 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -530,6 +530,11 @@ define Build/gl-qsdk-factory $(KDIR_TMP)/$(notdir $(BOOT_SCRIPT)) endef +define Build/kernel-pack-npk + sh -c '. $(STAGING_DIR_HOST)/share/npkpy-venv/bin/activate; python $(STAGING_DIR_HOST)/share/npkpy-venv/bin/pack_npk_kernel.py --kernel $@ --output $@.npk' + mv $@.npk $@ +endef + define Build/linksys-image let \ size="$$(stat -c%s $@)" \ diff --git a/tools/Makefile b/tools/Makefile index c2b36361a4..3112c7039f 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -87,6 +87,7 @@ tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USES_MINOR),y) += yafut tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USE_SPARSE),y) += sparse tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USE_LLVM_BUILD),y) += llvm-bpf tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USE_MOLD),y) += mold +tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USES_MINOR),y) += npkpy # builddir dependencies $(curdir)/autoconf/compile := $(curdir)/m4/compile diff --git a/tools/npkpy/Makefile b/tools/npkpy/Makefile new file mode 100644 index 0000000000..c3bd792101 --- /dev/null +++ b/tools/npkpy/Makefile @@ -0,0 +1,33 @@ +# +# Copyright (C) 2023 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +PKG_NAME:=npkpy +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/john-tho/npkpy.git +PKG_SOURCE_DATE:=2023-01-22 +PKG_SOURCE_VERSION:=771dddc5aaaff95a9b4160d6867152cfa1a9255f +PKG_MIRROR_HASH:=4c0596218e8c1f78b38c0583c18a574da18ff4c000ecdd5fbf50c62a62a1fb03 + +include $(INCLUDE_DIR)/host-build.mk + +define Host/Compile + python -m venv $(STAGING_DIR_HOST)/share/npkpy-venv + sh -c '. $(STAGING_DIR_HOST)/share/npkpy-venv/bin/activate; pip install --editable $(HOST_BUILD_DIR)' +endef + +define Host/Install + $(CP) $(HOST_BUILD_DIR)/tools/demo_pack_kernel/poc_pack_kernel.py $(STAGING_DIR_HOST)/share/npkpy-venv/bin/pack_npk_kernel.py +endef + +define Host/Clean + rm -rf $(STAGING_DIR_HOST)/share/npkpy-venv +endef + +$(eval $(call HostBuild))