From 3389fa02de5aad019fc7cb560c0f7c5b1a8627eb Mon Sep 17 00:00:00 2001 From: Alistair Jordan Date: Mon, 4 Dec 2023 19:55:28 +0000 Subject: [PATCH] Add EU region, and start lorawan-bridge --- project/app/lorawan/Makefile | 83 ------------------- sysdrv/cfg/package.mk | 4 + sysdrv/tools/board/Makefile.tools.board.mk | 9 +- sysdrv/tools/board/lorawan-bridge/Makefile | 25 ++++++ .../tools/board/lorawan-bridge/main.c | 0 5 files changed, 37 insertions(+), 84 deletions(-) delete mode 100644 project/app/lorawan/Makefile create mode 100644 sysdrv/tools/board/lorawan-bridge/Makefile rename project/app/lorawan/send.c => sysdrv/tools/board/lorawan-bridge/main.c (100%) diff --git a/project/app/lorawan/Makefile b/project/app/lorawan/Makefile deleted file mode 100644 index 9f151ad5c9..0000000000 --- a/project/app/lorawan/Makefile +++ /dev/null @@ -1,83 +0,0 @@ - -ifeq ($(APP_PARAM), ) - APP_PARAM:=../Makefile.param - include $(APP_PARAM) -endif - -export LC_ALL=C -SHELL:=/bin/bash - -CURRENT_DIR := $(shell pwd) - -PKG_INSTALL_TO_ROOTFS ?= NO -PKG_NAME := lorawan -PKG_BIN ?= out -PKG_BUILD ?= build -PKG_TARBALL := lorawan/lorawan-env-$(RK_APP_ARCH_TYPE) -PKG_TARPATH ?= $(PKG_BIN)/ -# debug: build cmake with more message -# PKG_CONF_OPTS += -DCMAKE_VERBOSE_MAKEFILE=ON -# - -RK_APP_CFLAGS = -I $(RK_APP_MEDIA_INCLUDE_PATH) \ - -I $(CURRENT_DIR)/$(PKG_TARPATH)/include \ - -RK_APP_LDFLAGS = -L $(CURRENT_DIR)/$(PKG_TARPATH)/usr/lib/ - -RK_APP_OPTS += -Wl,-rpath-link,$(RK_APP_MEDIA_LIBS_PATH):$(RK_APP_PATH_LIB_INCLUDE)/root/usr/lib -PKG_CONF_OPTS += -DCMAKE_C_FLAGS="$(RK_APP_CFLAGS) $(RK_APP_LDFLAGS) $(RK_APP_OPTS)" \ - -DCMAKE_CXX_FLAGS="$(RK_APP_CFLAGS) $(RK_APP_LDFLAGS) $(RK_APP_OPTS)" - -# define project/cfg/BoardConfig*.mk -#ifeq ($(RK_APP_LORAWAN),y) -PKG_TARGET := lorawan -#endif - -ifeq ($(PKG_BIN),) -$(error ### $(CURRENT_DIR): PKG_BIN is NULL, Please Check !!!) -endif - -all: $(PKG_TARGET) - @echo "build $(PKG_NAME) done" - -lorawan: - @rm -rf $(PKG_BIN) $(PKG_TARPATH) && mkdir -p $(PKG_TARPATH) $(PKG_BIN) $(PKG_BUILD); - @cp -rfa $(PKG_TARBALL) $(PKG_TARPATH)/; -# @cp -rfa $(PKG_TARBALL)/usr $(PKG_TARPATH)/; - @echo "PKG_TARPATH is $(PKG_TARPATH)"; - pushd $(PKG_BUILD)/; \ - rm -rf CMakeCache.txt; \ - cmake $(CURRENT_DIR)/$(PKG_NAME)/ \ - -DCMAKE_C_COMPILER=$(RK_APP_CROSS)-gcc \ - -DCMAKE_CXX_COMPILER=$(RK_APP_CROSS)-g++ \ - -DCMAKE_INSTALL_PREFIX="$(CURRENT_DIR)/$(PKG_BIN)" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_COLOR_MAKEFILE=OFF \ - -DCMAKE_SYSTEM_NAME=Linux \ - -DUSE_RKIPC=ON \ - $(PKG_CONF_OPTS) ;\ - make -j$(RK_APP_JOBS) || exit -1; \ - make install; \ - popd; - (mkdir -p $(PKG_BIN)/usr;mv $(PKG_BIN)/www $(PKG_BIN)/usr;); - -#ifeq ($(PKG_INSTALL_TO_ROOTFS),YES) - @cp -rfa $(PKG_TARBALL) $(PKG_TARPATH)/; -# @cp -rfa $(PKG_TARBALL)/usr $(PKG_TARPATH)/; -#else -# @cp -rfa $(PKG_TARBALL)/etc4oem $(PKG_TARPATH)/etc -#endif - - @test ! -d $(PKG_BIN)/root/include || mv $(PKG_BIN)/root/include $(PKG_BIN)/; - $(call MAROC_COPY_PKG_TO_APP_OUTPUT, $(RK_APP_OUTPUT), $(PKG_BIN)) - -clean: - @rm -rf $(PKG_BIN) $(PKG_BUILD) $(PKG_TARPATH) - -distclean: clean - -info: -ifeq ($(RK_APP_IPCWEB_BACKEND),y) - @echo -e "$(C_YELLOW)-------------------------------------------------------------------------$(C_NORMAL)" - @echo -e "$(C_YELLOW)-------------------------------------------------------------------------$(C_NORMAL)" -endif diff --git a/sysdrv/cfg/package.mk b/sysdrv/cfg/package.mk index 7b39036270..4d04dd6a3d 100644 --- a/sysdrv/cfg/package.mk +++ b/sysdrv/cfg/package.mk @@ -41,3 +41,7 @@ $(eval $(call MACRO_CHECK_ENABLE_PKG, RK_ENABLE_OTA)) # Enable build strace CONFIG_SYSDRV_ENABLE_STRACE=n $(eval $(call MACRO_CHECK_ENABLE_PKG, RK_ENABLE_STRACE)) + +# Enable build lorawan-bridge +CONFIG_SYSDRV_ENABLE_LORAWAN_BRIDGE=y +$(eval $(call MACRO_CHECK_ENABLE_PKG, RK_ENABLE_LORAWAN_BRIDGE)) \ No newline at end of file diff --git a/sysdrv/tools/board/Makefile.tools.board.mk b/sysdrv/tools/board/Makefile.tools.board.mk index a4bf0eab27..152cb5a08f 100644 --- a/sysdrv/tools/board/Makefile.tools.board.mk +++ b/sysdrv/tools/board/Makefile.tools.board.mk @@ -9,7 +9,8 @@ tools_board-builds: \ board-build-rockchip_test \ board-build-e2fsprogs \ board-build-sysstat \ - board-build-mtd_utils + board-build-mtd_utils \ + board-build-lorawan-bridge @echo "build tools board done" tools_board-clean: @@ -23,6 +24,7 @@ tools_board-clean: $(MAKE) -C $(SYSDRV_DIR)/tools/board/stressapptest distclean $(MAKE) -C $(SYSDRV_DIR)/tools/board/rk_ota distclean $(MAKE) -C $(SYSDRV_DIR)/tools/board/sysstat distclean + $(MAKE) -C $(SYSDRV_DIR)/tools/board/lorawan-bridge distclean board-build-toolkits: $(MAKE) -C $(SYSDRV_DIR)/tools/board/toolkits @@ -78,3 +80,8 @@ board-build-sysstat: ifeq ($(ENABLE_SYSSTAT),y) $(MAKE) -C $(SYSDRV_DIR)/tools/board/sysstat endif + +board-build-lorawan-bridge: +ifeq ($(ENABLE_LORAWAN_BRIDGE),y) + $(MAKE) -C $(SYSDRV_DIR)/tools/board/lorawan-bridge +endif diff --git a/sysdrv/tools/board/lorawan-bridge/Makefile b/sysdrv/tools/board/lorawan-bridge/Makefile new file mode 100644 index 0000000000..2db38913e4 --- /dev/null +++ b/sysdrv/tools/board/lorawan-bridge/Makefile @@ -0,0 +1,25 @@ + +#ifeq ($(SYSDRV_PARAM), ) + LORAWAN_BRIDGE_PARAM:=../../../Makefile.param + include $(LORAWAN_BRIDGE_PARAM) +#endif + +export LC_ALL=C +SHELL:=/bin/bash + +CURRENT_DIR := $(shell pwd) +PKG_NAME := lbr +PKG_BIN := out + +all: + @test -f $(PKG_BIN)/usr/sbin/$(PKG_NAME)_noexist || (\ + mkdir -p $(CURRENT_DIR)/$(PKG_BIN)/usr/sbin; \ + $(SYSDRV_CROSS)-gcc -g main.c -o $(CURRENT_DIR)/$(PKG_BIN)/usr/sbin/$(PKG_NAME); \ + ) + $(call MAROC_COPY_PKG_TO_SYSDRV_OUTPUT, $(SYSDRV_DIR_OUT_ROOTFS), $(PKG_BIN)) +# $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERNEL_DIR) M=$(shell pwd) $@ -j12 + +clean: distclean + +distclean: + -rm -rf $(PKG_NAME) $(PKG_BIN) \ No newline at end of file diff --git a/project/app/lorawan/send.c b/sysdrv/tools/board/lorawan-bridge/main.c similarity index 100% rename from project/app/lorawan/send.c rename to sysdrv/tools/board/lorawan-bridge/main.c