From 2ab4495bf95105ab62b7cae63bd1190b996c9093 Mon Sep 17 00:00:00 2001 From: gaoyang3513 Date: Mon, 30 Oct 2023 22:26:28 +0800 Subject: [PATCH] [Add] Build.sh --- Makefile | 40 ++++++++-------------------------------- build.sh | 32 ++++++++++++++++++++++++++++++++ src/main.c | 8 ++++++++ 3 files changed, 48 insertions(+), 32 deletions(-) create mode 100755 build.sh create mode 100644 src/main.c diff --git a/Makefile b/Makefile index 9fe908b..f55597e 100755 --- a/Makefile +++ b/Makefile @@ -14,12 +14,10 @@ INSTALL_DIR ?= $(LOCAL_DIR)/__install # Variables #******************************************************************************* # target -TARGET ?= demo_rf +TARGET ?= demo_hello -PRODUCT ?= T673 -PLATFORM_F1 := T340 T343 T673 T641A -PLATFORM_AI := T641 T680 -PLATFORM_A2 := T681 +PRODUCT ?= LBC2 +PLATFORM_RK3568 := LBC2 #******************************************************************************* # Functions @@ -32,45 +30,23 @@ sources = $(subst $(LOCAL_DIR)/,,$(shell find $(SOURCE_DIR) -name " #$(info sources=$(sources)) filter_out_files := -filter_out_dirs := src/core +filter_out_dirs := sources_out := $(foreach dir,$(filter_out_dirs),$(shell find $(dir) -name "*.c")) #$(info sources_out=$(sources_out)) sources := $(filter-out $(sources_out),$(sources)) sources := $(foreach file,$(sources),$(if $(filter $(subst $(LOCAL_DIR)/,,$(strip $(patsubst %/,%,$(sort $(dir $(file)))))),$(filter_out_dirs)),,$(file))) objects = $(addprefix $(OUTPUT_DIR)/,$(patsubst %.c,%.o,$(sources))) -#$(info sources=$(sources)) -#$(info objects=$(objects)) +$(info objects=$(objects)) #******************************************************************************* # Compile configure #******************************************************************************* ARCH := arm -ifneq ($(filter $(PRODUCT),$(PLATFORM_A2)),) -PLATFORM := A2 -KERNEL_CONFIG := rockchip_defconfig -CROSS_COMPILE := aarch64-linux-android- -else ifneq ($(filter $(PRODUCT),$(PLATFORM_A2S)),) -PLATFORM := A2S -KERNEL_CONFIG := rockchip_defconfig rk356x_evb.config android-11.config -KERNEL_OPTION := BOOT_IMG=$(OUTPUT_DIR)/boot.img TS3672.img +ifneq ($(filter $(PRODUCT),$(PLATFORM_RK3568)),) ARCH := arm64 -CROSS_COMPILE := $(HOME)/Workspaces/03-Toolschain/A2S_gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- -else ifneq ($(filter $(PRODUCT),$(PLATFORM_F1)),) -PLATFORM := F1 -KERNEL_CONFIG := bsp_f1x_defconfig -CROSS_COMPILE := arm-ca9-linux-gnueabihf- -LIBS_F1 := pthread -else ifneq ($(filter $(PRODUCT),$(PLATFORM_F3)),) -PLATFORM := F3 -KERNEL_CONFIG := bsp_f3_defconfig -CROSS_COMPILE := arm-ca9-linux-uclibcgnueabihf- -else ifneq ($(filter $(PRODUCT),$(PLATFORM_AI)),) -PLATFORM := AI -CROSS_COMPILE := arm-ca53-linux-gnueabihf- -else -PLATFORM := H10 -CROSS_COMPILE := arm-hisiv500-linux- +#CROSS_COMPILE := $(HOME)/Workspaces/Toolchains/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- +CROSS_COMPILE := $(HOME)/Workspaces/Toolchains/aarch64/aarch64-linux-android-4.9/ endif CC := $(CROSS_COMPILE)gcc diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..ecf94ec --- /dev/null +++ b/build.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +LOCAL_DIR=`pwd` +#---------------------------------- +OUTPUT_DIR=${LOCAL_DIR}/output +INSTALL_DIR=${LOCAL_DIR}/install + +NDK=${HOME}/Workspaces/ndk/android-ndk-r21e + +# Only choose one of these, depending on your build machine... +#export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/darwin-x86_64 +export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64 + +# Only choose one of these, depending on your device... +export TARGET=aarch64-linux-android +#export TARGET=armv7a-linux-androideabi +#export TARGET=i686-linux-android +#export TARGET=x86_64-linux-android + +# Set this to your minSdkVersion. +export API=30 + +# Configure and build. +export AR=$TOOLCHAIN/bin/llvm-ar +export CC=$TOOLCHAIN/bin/$TARGET$API-clang +export AS=$CC +export CXX=$TOOLCHAIN/bin/$TARGET$API-clang++ +export LD=$TOOLCHAIN/bin/ld +export RANLIB=$TOOLCHAIN/bin/llvm-ranlib +export STRIP=$TOOLCHAIN/bin/llvm-strip + +make diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..ea687fb --- /dev/null +++ b/src/main.c @@ -0,0 +1,8 @@ +#include + +int main(void) +{ + printf("Hello, Lubancat2\n"); + + return 0; +}