diff --git a/BUILD.gn b/BUILD.gn index e3c2d3ce25168f4b31c023d9489dd1fbc45737d3..31915cb13c7952b1baff49dc0146fb3227507ba7 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -32,6 +32,7 @@ import("//build/lite/config/component/lite_component.gni") declare_args() { tee_enable = false liteos_name = "OHOS_Image" + liteos_skip_make = false } cmd = "if [ -f $device_path/BUILD.gn ]; then echo true; else echo false; fi" @@ -189,6 +190,9 @@ config("los_common") { ] defines = [ "__LITEOS__" ] + if (!defined(LOSCFG_DEBUG_VERSION)) { + defines += [ "NDEBUG" ] + } cflags_c = [ "-std=c99" ] @@ -262,6 +266,11 @@ config("los_common") { "-mthumb", "-Wa,-mimplicit-it=thumb", ] + if (defined(LOSCFG_COMPILER_CLANG_LLVM)) { + # llvm-as do not support "-mimplicit-it=thumb" option currently, + # so we remove it temporary. + cflags -= [ "-Wa,-mimplicit-it=thumb" ] + } } asmflags = cflags @@ -375,7 +384,11 @@ build_ext_component("make") { outdir = rebase_path(get_path_info(".", "out_dir")) sysroot_path = rebase_path(ohos_current_sysroot) arch_cflags = string_join(" ", target_arch_cflags) - command = "./build.sh ${board_name} ${ohos_build_compiler} ${root_build_dir} ${ohos_build_type} \"${tee_enable}\"" - command += " \"${device_company}\" \"${product_path}\" $outdir \"${ohos_version}\" ${sysroot_path} \"${arch_cflags}\"" - command += " \"${device_path}\"" + command = "./build.sh \"$board_name\" \"$ohos_build_compiler\" \"$root_build_dir\" \"$ohos_build_type\" \"$tee_enable\"" + command += " \"$device_company\" \"$product_path\" \"$outdir\" \"$ohos_version\" \"$sysroot_path\" \"$arch_cflags\"" + command += " \"$device_path\" \"$compile_prefix\"" + if (liteos_skip_make) { + print("build_ext_component \"$target_name\" skipped:", command) + command = "true" + } } diff --git a/Kconfig b/Kconfig index 8b8704e870aa4cf6d93e89652f029e4fb6ff458d..ca2bd5802cf49ae69ac4ea880829149484880351 100644 --- a/Kconfig +++ b/Kconfig @@ -193,8 +193,8 @@ config DEBUG_VERSION default n help If you do not select this option that means you enable a release version for LiteOS. - It also means you do not want to use debug modules, like shell,telnet,tftp, - ,nfs,ramfs proc and memory check. + It also means you do not want to use debug modules, like shell,telnet,tftp,nfs and + memory check, etc. If you select this option that means you enable a debug version for LiteOS. That means you want a opposite behaviour compared to release version. diff --git a/Makefile b/Makefile index 20d0bad7996521f79c8fd6d640858f479d542881..e18f8fefabbd8facfdaca4684ccbbd74650b94ff 100644 --- a/Makefile +++ b/Makefile @@ -28,51 +28,26 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. LITEOSTOPDIR := $(realpath $(dir $(firstword $(MAKEFILE_LIST)))) -LITEOSTHIRDPARTY := $(LITEOSTOPDIR)/../../third_party - -export LITEOSTOPDIR -export LITEOSTHIRDPARTY APPS = apps ROOTFS = rootfs LITEOS_TARGET = liteos LITEOS_LIBS_TARGET = libs +KCONFIG_CMDS := $(notdir $(wildcard $(dir $(shell which menuconfig))*config)) -# by the following eval, we would got some variables like these: -# ohos_root_path=/xx -# ohos_board=hispark_taurus -# ohos_kernel=liteos_a -# ohos_product=ipcamera_hispark_taurus -# ohos_product_path=/xx/vendor/hisilicon/hispark_taurus -# ohos_device_path=/xx/device/hisilicon/hispark_taurus/sdk_liteos ohos_kernel ?= liteos_a $(foreach line,$(shell hb env | sed 's/\[OHOS INFO\]/ohos/g;s/ /_/g;s/:_/=/g' || true),$(eval $(line))) - ifneq ($(ohos_kernel),liteos_a) $(error The selected product ($(ohos_product)) is not a liteos_a kernel type product) endif -export CONFIG_=LOSCFG_ -export srctree=$(LITEOSTOPDIR) - -SYSROOT_PATH ?= $(LITEOSTOPDIR)/../../prebuilts/lite/sysroot -export SYSROOT_PATH - -LITEOS_MENUCONFIG_H ?= $(LITEOSTOPDIR)/config.h -export LITEOS_MENUCONFIG_H - -CONFIG_FILE ?= $(LITEOSTOPDIR)/.config -export CONFIG_FILE - ifeq ($(PRODUCT_PATH),) PRODUCT_PATH:=$(ohos_product_path) endif -export PRODUCT_PATH ifeq ($(DEVICE_PATH),) DEVICE_PATH:=$(ohos_device_path) endif -export DEVICE_PATH ifeq ($(TEE:1=y),y) tee = _tee @@ -84,9 +59,25 @@ CONFIG ?= $(PRODUCT_PATH)/kernel_configs/debug$(tee).config endif KCONFIG_CONFIG ?= $(CONFIG) -export KCONFIG_CONFIG +SYSROOT_PATH ?= $(LITEOSTOPDIR)/../../prebuilts/lite/sysroot +LITEOS_MENUCONFIG_H ?= $(LITEOSTOPDIR)/config.h +LITEOS_CONFIG_FILE ?= $(LITEOSTOPDIR)/.config --include $(LITEOSTOPDIR)/tools/build/config.mk +# export los_config.mk related environment variables +export LITEOSTOPDIR +export LITEOS_MENUCONFIG_H +export LITEOS_CONFIG_FILE + +# export subdir Makefile related environment variables +export SYSROOT_PATH +export PRODUCT_PATH +export DEVICE_PATH + +# export kconfig related environment variables +export CONFIG_=LOSCFG_ +export srctree=$(LITEOSTOPDIR) + +include $(LITEOSTOPDIR)/config.mk ifeq ($(LOSCFG_STORAGE_SPINOR), y) FSTYPE = jffs2 @@ -112,16 +103,19 @@ Targets: clean: clean compiled objects cleanall: clean all build outputs all: make liteos kernel image and rootfs image (Default target) - rootfs: make a original rootfs image + $(APPS): build all apps + $(ROOTFS): make a original rootfs image $(LITEOS_LIBS_TARGET): compile all kernel modules (libraries) $(LITEOS_TARGET): make liteos kernel image update_config: update product kernel config (use menuconfig) + xxconfig: invoke xxconfig command of kconfiglib (xxconfig is one of $(KCONFIG_CMDS)) Parameters: FSTYPE: value should be one of (jffs2 vfat yaffs2) TEE: boolean value(1 or y for true), enable tee RELEASE: boolean value(1 or y for true), build release version CONFIG: kernel config file to be use + args: arguments for xxconfig command ------------------------------------------------------- endef export HELP @@ -139,27 +133,22 @@ endif $(HIDE)echo "sysroot:" $(abspath $(SYSROOT_PATH)) endif -KCONFIG_CMDS := $(notdir $(wildcard $(dir $(shell which menuconfig))*config)) $(KCONFIG_CMDS): $(HIDE)$@ $(args) -$(LITEOS_MENUCONFIG_H) $(CONFIG_FILE): $(KCONFIG_CONFIG) - $(HIDE)genconfig --config-out $(CONFIG_FILE) --header-path $(LITEOS_MENUCONFIG_H) $(args) +$(LITEOS_CONFIG_FILE): $(KCONFIG_CONFIG) + $(HIDE)env KCONFIG_CONFIG=$< genconfig --config-out $@ --header-path $(LITEOS_MENUCONFIG_H) update_config: $(HIDE)test -f "$(CONFIG)" && cp -v "$(CONFIG)" .config && menuconfig && savedefconfig --out "$(CONFIG)" -prepare: $(LITEOS_MENUCONFIG_H) - $(HIDE)mkdir -p $(OUT)/musl $(OUT)/lib $(BUILD) - -$(LITEOS_LIBS_TARGET): prepare - $(HIDE)touch $(LOSCFG_ENTRY_SRC) - $(HIDE)for dir in $(LITEOS_SUBDIRS); do $(MAKE) -C $$dir all || exit 1; done +$(LITEOS_LIBS_TARGET): + $(HIDE)for dir in $(LIB_SUBDIRS); do $(MAKE) -C $$dir all || exit 1; done $(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET) $(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).map #$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).objsize -$(LITEOS_TARGET): $(LITEOS_TARGET_DIR)/$(LITEOS_TARGET).bin +$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).bin $(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).sym.sorted $(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).asm #$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).size @@ -169,7 +158,7 @@ $(OUT)/$(LITEOS_TARGET): $(LITEOS_LIBS_TARGET) $(OUT)/$(LITEOS_TARGET).map: $(OUT)/$(LITEOS_TARGET) $(OUT)/$(LITEOS_TARGET).objsize: $(LITEOS_LIBS_TARGET) $(SIZE) -t --common $(OUT)/lib/*.a >$@ -$(LITEOS_TARGET_DIR)/$(LITEOS_TARGET).bin: $(OUT)/$(LITEOS_TARGET) +$(OUT)/$(LITEOS_TARGET).bin: $(OUT)/$(LITEOS_TARGET) $(OBJCOPY) -O binary $< $@ $(OUT)/$(LITEOS_TARGET).sym.sorted: $(OUT)/$(LITEOS_TARGET) $(OBJDUMP) -t $< |sort >$@ @@ -178,10 +167,11 @@ $(OUT)/$(LITEOS_TARGET).asm: $(OUT)/$(LITEOS_TARGET) $(OUT)/$(LITEOS_TARGET).size: $(OUT)/$(LITEOS_TARGET) $(NM) -S --size-sort $< >$@ -$(APPS): prepare +$(APPS): $(HIDE)$(MAKE) -C apps all $(ROOTFS): $(APPS) + $(HIDE)mkdir -p $(OUT)/musl ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) $(HIDE)cp -fp $$($(CC) --target=$(LLVM_TARGET) --sysroot=$(SYSROOT_PATH) $(LITEOS_CFLAGS) -print-file-name=libc.so) $(OUT)/musl $(HIDE)cp -fp $$($(GPP) --target=$(LLVM_TARGET) --sysroot=$(SYSROOT_PATH) $(LITEOS_CXXFLAGS) -print-file-name=libc++.so) $(OUT)/musl @@ -190,23 +180,22 @@ else $(HIDE)cp -fp $$($(CC) $(LITEOS_CFLAGS) -print-file-name=libgcc_s.so.1) $(OUT)/musl $(HIDE)cp -fp $$($(GPP) $(LITEOS_CXXFLAGS) -print-file-name=libstdc++.so.6) $(OUT)/musl endif - $(STRIP) $(OUT)/musl/* - $(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/rootfsdir.sh $(OUT) $(ROOTFS_DIR) $(LITEOS_TARGET_DIR) + $(HIDE)$(STRIP) $(OUT)/musl/* + $(HIDE)$(LITEOS_SCRIPTPATH)/make_rootfs/rootfsdir.sh $(OUT) $(ROOTFS_DIR) ifneq ($(VERSION),) - $(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/releaseinfo.sh "$(VERSION)" $(ROOTFS_DIR) $(LITEOS_TARGET_DIR) + $(HIDE)$(LITEOS_SCRIPTPATH)/make_rootfs/releaseinfo.sh "$(VERSION)" $(ROOTFS_DIR) endif - $(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/rootfsimg.sh $(ROOTFS_DIR) $(FSTYPE) + $(HIDE)$(LITEOS_SCRIPTPATH)/make_rootfs/rootfsimg.sh $(ROOTFS_DIR) $(FSTYPE) $(HIDE)cd $(ROOTFS_DIR)/.. && zip -r $(ROOTFS_ZIP) $(ROOTFS) clean: - $(HIDE)for dir in $(LITEOS_SUBDIRS); do $(MAKE) -C $$dir clean || exit 1; done - $(HIDE)$(MAKE) -C apps clean - $(HIDE)$(RM) $(LITEOS_MENUCONFIG_H) $(CONFIG_FILE) + $(HIDE)for dir in $(LIB_SUBDIRS) apps; do $(MAKE) -C $$dir clean || exit 1; done + $(HIDE)$(RM) $(LITEOS_MENUCONFIG_H) $(HIDE)echo "clean $(LOSCFG_PLATFORM) finish" cleanall: clean - $(HIDE)$(RM) $(LITEOSTOPDIR)/out + $(HIDE)$(RM) $(LITEOSTOPDIR)/out $(LITEOS_CONFIG_FILE) $(HIDE)echo "clean all done" -.PHONY: all clean cleanall prepare sysroot help update_config -.PHONY: $(LITEOS_TARGET) $(ROOTFS) $(APPS) $(KCONFIG_CMDS) $(LITEOS_LIBS_TARGET) +.PHONY: all clean cleanall sysroot help update_config +.PHONY: $(LITEOS_TARGET) $(ROOTFS) $(APPS) $(KCONFIG_CMDS) $(LITEOS_LIBS_TARGET) $(KCONFIG_CONFIG) diff --git a/apps/Makefile b/apps/Makefile index 94fcbb09a255beaede770e5e485fcc3278bdc62e..fd589674ce5b3623e2f3363195ba4abfa29cb4d1 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -27,11 +27,12 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -LITEOSTOPDIR := $(shell pwd)/../ +APPSTOPDIR := $(shell pwd) +LITEOSTOPDIR ?= $(APPSTOPDIR)/.. +export LITEOSTOPDIR +export APPSTOPDIR -include $(LITEOSTOPDIR)/.config -include ./config.mk -include ./module.mk +include $(APPSTOPDIR)/config.mk HIDE := @ APPS := app diff --git a/apps/app.mk b/apps/app.mk new file mode 100644 index 0000000000000000000000000000000000000000..d79f6684288bf9d26aef875e88b5e12f88b02d64 --- /dev/null +++ b/apps/app.mk @@ -0,0 +1,103 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +OBJOUT := $(BUILD)$(dir $(subst $(LITEOSTOPDIR),,$(shell pwd)))$(APP_NAME) + +APP := $(OUT)/bin/$(APP_NAME) + +# create a separate list of objects per source type + +LOCAL_CSRCS := $(filter %.c,$(LOCAL_SRCS)) +LOCAL_CPPSRCS := $(filter %.cpp,$(LOCAL_SRCS)) +LOCAL_ASMSRCS := $(filter %.S,$(LOCAL_SRCS)) +LOCAL_ASMSRCS2 := $(filter %.s,$(LOCAL_SRCS)) +LOCAL_CCSRCS := $(filter %.cc,$(LOCAL_SRCS)) + +LOCAL_COBJS := $(patsubst %.c,$(OBJOUT)/%.o,$(LOCAL_CSRCS)) +LOCAL_CPPOBJS := $(patsubst %.cpp,$(OBJOUT)/%.o,$(LOCAL_CPPSRCS)) +LOCAL_ASMOBJS := $(patsubst %.S,$(OBJOUT)/%.o,$(LOCAL_ASMSRCS)) +LOCAL_ASMOBJS2 := $(patsubst %.s,$(OBJOUT)/%.o,$(LOCAL_ASMSRCS2)) +LOCAL_CCOBJS := $(patsubst %.cc,$(OBJOUT)/%.o,$(LOCAL_CCSRCS)) + +LOCAL_OBJS := $(LOCAL_COBJS) $(LOCAL_CPPOBJS) $(LOCAL_ASMOBJS) $(LOCAL_ASMOBJS2) $(LOCAL_CCOBJS) + +LOCAL_CGCH := $(patsubst %.h,%.h.gch,$(LOCAL_CHS)) +LOCAL_CPPGCH := $(patsubst %.h,%.h.gch,$(LOCAL_CPPHS)) + +all : $(APP) + +$(LOCAL_COBJS): $(OBJOUT)/%.o: %.c + $(HIDE)$(OBJ_MKDIR) + $(HIDE)$(CC) $(CFLAGS) $(LOCAL_FLAGS) $(LOCAL_CFLAGS) -c $< -o $@ + +$(LOCAL_CPPOBJS): $(OBJOUT)/%.o: %.cpp + $(HIDE)$(OBJ_MKDIR) + $(HIDE)$(GPP) $(CXXFLAGS) $(LOCAL_FLAGS) $(LOCAL_CPPFLAGS) -c $< -o $@ + +$(LOCAL_ASMOBJS): $(OBJOUT)/%.o: %.S + $(HIDE)$(OBJ_MKDIR) + $(HIDE)$(CC) $(CFLAGS) $(LOCAL_FLAGS) $(LOCAL_ASFLAGS) -c $< -o $@ + +$(LOCAL_ASMOBJS2): $(OBJOUT)/%.o: %.s + $(HIDE)$(OBJ_MKDIR) + $(HIDE)$(AS) $(ASFLAGS) $(LOCAL_FLAGS) $(LOCAL_ASFLAGS) -c $< -o $@ + +$(LOCAL_CCOBJS): $(OBJOUT)/%.o: %.cc + $(HIDE)$(OBJ_MKDIR) + $(HIDE)$(GPP) $(CXXFLAGS) $(LOCAL_FLAGS) $(LOCAL_CPPFLAGS) -c $< -o $@ + +$(LOCAL_CGCH): %.h.gch : %.h + $(HIDE)$(CC) $(CFLAGS) $(LOCAL_FLAGS) $(LOCAL_CFLAGS) $> $^ + +$(LOCAL_CPPGCH): %.h.gch : %.h + $(HIDE)$(GPP) $(CXXFLAGS) $(LOCAL_FLAGS) $(LOCAL_CPPFLAGS) -x c++-header $> $^ + +LOCAL_GCH := $(LOCAL_CGCH) $(LOCAL_CPPGCH) + +$(LOCAL_OBJS): $(LOCAL_GCH) +$(APP): $(LOCAL_OBJS) + $(HIDE)$(OBJ_MKDIR) + $(HIDE)$(GPP) $(LDFLAGS) $^ -o $@ + +clean: + $(HIDE)$(RM) $(APP) $(OBJOUT) $(LOCAL_GCH) *.bak *~ + +.PHONY: all clean + +# clear some variables we set here +LOCAL_CSRCS := +LOCAL_CPPSRCS := +LOCAL_ASMSRCS := +LOCAL_COBJS := +LOCAL_CPPOBJS := +LOCAL_ASMOBJS := +LOCAL_ASMOBJS2 := + +# LOCAL_OBJS is passed back +#LOCAL_OBJS := diff --git a/apps/config.mk b/apps/config.mk index 417446cbbb7be8a8b3bce76269c1c07b77aab186..dbb4ed58f7d1f610a6ed798c9990d5851d38ff58 100644 --- a/apps/config.mk +++ b/apps/config.mk @@ -27,30 +27,19 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# common dir config include $(LITEOSTOPDIR)/config.mk -# output dir config -OBJOUT := $(APPSTOPDIR)/out -APPSOUT := $(OBJOUT)/apps -LIBSOUT := $(OBJOUT)/libs -IMGOUT := $(OUT) +ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) +LLVM_SYSROOT := --sysroot=$(SYSROOT_PATH) $(ARCH_CFLAGS) +endif # common flags config BASE_OPTS := -ffunction-sections -fdata-sections -fno-omit-frame-pointer -fno-common -fno-strict-aliasing -D_GNU_SOURCE \ - $(LITEOS_SSP) $(LITEOS_CORE_COPTS) $(WARNING_AS_ERROR) $(LLVM_EXTRA_OPTS) $(LITEOS_GCOV_OPTS) + $(LITEOS_SSP) $(LITEOS_CORE_COPTS) $(WARNING_AS_ERROR) $(LLVM_EXTRA_OPTS) $(LLVM_SYSROOT) $(LITEOS_GCOV_OPTS) -CFLAGS := -std=c99 -fno-exceptions $(BASE_OPTS) $(LITEOS_COPTS_OPTMIZE) -CXXFLAGS := -std=c++11 -fexceptions -fpermissive -frtti $(BASE_OPTS) $(LITEOS_COPTS_OPTMIZE) -LDCFLAGS := -lc -ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) -LLVM_SYSROOT := --sysroot=$(SYSROOT_PATH) $(ARCH_CFLAGS) -LDCXXFLGS := -lc++ -lc++abi -lc -else -BASE_OPTS += -Wl,-z,relro,-z,now -LDCXXFLGS := -lstdc++ -lsupc++ -lc -endif -COMMON_INCLUDE := -I $(LITEOSTHIRDPARTY)/bounds_checking_function/include +CFLAGS := -std=c99 -fPIE -fno-exceptions $(BASE_OPTS) $(LITEOS_COPTS_OPTMIZE) +CXXFLAGS := -std=c++11 -fPIE -fexceptions -fpermissive -frtti $(BASE_OPTS) $(LITEOS_COPTS_OPTMIZE) +LDFLAGS := -pie -s -Wl,-z,relro,-z,now $(BASE_OPTS) $(LLVM_EXTRA_LD_OPTS) # alias variable config HIDE := @ @@ -58,3 +47,22 @@ MAKE := make RM := rm -rf CP := cp -rf MV := mv -f + +APP := $(APPSTOPDIR)/app.mk +APP_SUBDIRS := + +##build modules config## + +ifeq ($(LOSCFG_SHELL), y) +APP_SUBDIRS += shell +#APP_SUBDIRS += mksh +#APP_SUBDIRS += toybox +endif + +ifeq ($(LOSCFG_USER_INIT_DEBUG), y) +APP_SUBDIRS += init +endif + +ifeq ($(LOSCFG_NET_LWIP_SACK_TFTP), y) +APP_SUBDIRS += tftp +endif diff --git a/apps/init/Makefile b/apps/init/Makefile index 96eba811382793af81db1ebad894e6b0877440e1..e8567a984b9612e1188b02883e19ed214c3f9382 100644 --- a/apps/init/Makefile +++ b/apps/init/Makefile @@ -27,43 +27,15 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -INIT_DIR := $(dir $(shell pwd))/init/ +include $(APPSTOPDIR)/config.mk -ifeq ($(APPSTOPDIR), ) -APPSTOPDIR := $(shell pwd)/../ -LITEOSTOPDIR = $(APPSTOPDIR)/../ -endif -include $(INIT_DIR)/../config.mk +APP_NAME := $(notdir $(shell pwd)) -APPS_OUT := $(OUT)/bin LOCAL_SRCS := src/init.c -LOCAL_OBJ := src/init.o - -ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) -LOCAL_FLAGS += -Wno-shift-op-parentheses -Wno-bitwise-op-parentheses -Wnonnull $(LLVM_SYSROOT) -LDCFLAGS += $(LLVM_EXTRA_LD_OPTS) $(LLVM_SYSROOT) -endif ifeq ($(LOSCFG_QUICK_START), y) -LDCFLAGS += --static +LDFLAGS += --static CFLAGS += -DLOSCFG_QUICK_START endif -INITNAME := init - -all: $(INITNAME) - -$(LOCAL_OBJ): %.o : %.c - $(HIDE) $(CC) $(CFLAGS) $(LOCAL_FLAGS) -fPIE $(LOCAL_INCLUDE) -c $< -o $@ - -$(INITNAME):$(LOCAL_OBJ) - $(HIDE) $(CC) -pie -s $(LDPATH) $(BASE_OPTS) -o $(INITNAME) $^ $(LDCFLAGS) - $(HIDE) mkdir -p $(APPS_OUT) - $(HIDE) $(MV) $(INITNAME) $(APPS_OUT) - $(HIDE) $(RM) $(LOCAL_OBJ) - -clean: - $(HIDE) $(RM) $(LOCAL_OBJ) - $(HIDE) $(RM) $(INITNAME) - -.PHONY: all $(INITNAME) clean +include $(APP) diff --git a/apps/mksh/Makefile b/apps/mksh/Makefile index 3431dd5c9a6b39a0d7b3e6430ab553e4263dc9eb..406d45d23c4208fcd851a300b10f974ebf1c470d 100755 --- a/apps/mksh/Makefile +++ b/apps/mksh/Makefile @@ -27,11 +27,11 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +include $(APPSTOPDIR)/config.mk + MKSH := mksh MKSH_DIR := $(shell pwd)/ -LITEOSTOPDIR = $(MKSH_DIR)/../../ -include $(MKSH_DIR)/../config.mk APPS_OUT := $(OUT)/bin ETC_OUT := $(OUT)/etc diff --git a/apps/module.mk b/apps/module.mk deleted file mode 100644 index 285a1bc45d29d3ece53ec481bf7779a0d3d88309..0000000000000000000000000000000000000000 --- a/apps/module.mk +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this list of -# conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, this list -# of conditions and the following disclaimer in the documentation and/or other materials -# provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -APP_SUBDIRS := - -##build modules config## - -ifeq ($(LOSCFG_SHELL), y) -APP_SUBDIRS += shell -#APP_SUBDIRS += mksh -#APP_SUBDIRS += toybox -endif - -ifeq ($(LOSCFG_USER_INIT_DEBUG), y) -APP_SUBDIRS += init -endif - -ifeq ($(LOSCFG_NET_LWIP_SACK_TFTP), y) -APP_SUBDIRS += tftp -endif diff --git a/apps/shell/Makefile b/apps/shell/Makefile index 23024cac865c6f7d453e7169569c006879fa3ff9..e281c760d8a1fcc679a97d75d06fb0cd48fe0b3f 100644 --- a/apps/shell/Makefile +++ b/apps/shell/Makefile @@ -27,14 +27,9 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -SHELL_DIR := $(dir $(shell pwd))/shell/ +include $(APPSTOPDIR)/config.mk -ifeq ($(APPSTOPDIR), ) -APPSTOPDIR := $(shell pwd)/../ -LITEOSTOPDIR = $(APPSTOPDIR)/../ -endif -include $(SHELL_DIR)/../config.mk -APPS_OUT := $(OUT)/bin +APP_NAME := $(notdir $(shell pwd)) SECUREC_INCLUDE := $(LITEOSTHIRDPARTY)/bounds_checking_function/include @@ -44,35 +39,11 @@ LOCAL_SRCS = $(wildcard src/main.c)\ $(wildcard src/shcmdparse.c)\ $(wildcard builtin/cd.c) LOCAL_SRCS += $(wildcard $(LITEOSTHIRDPARTY)/bounds_checking_function/src/*.c) -LOCAL_OBJ := $(LOCAL_SRCS:.c=.o) LOCAL_INCLUDE := \ - -I $(SHELL_DIR)/include/ \ + -I include/ \ -I $(SECUREC_INCLUDE)\ -LOCAL_FLAGS += $(CFLAGS) +LOCAL_FLAGS += $(LOCAL_INCLUDE) -LDPATH := -L$(SHELL_DIR)/ -ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) -LOCAL_FLAGS += -Wno-shift-op-parentheses -Wno-bitwise-op-parentheses $(LLVM_SYSROOT) -LDCFLAGS += $(LLVM_EXTRA_LD_OPTS) $(LLVM_SYSROOT) -endif - -SHELLNAME := shell - -all: $(SHELLNAME) - -$(LOCAL_OBJ): %.o : %.c - $(HIDE) $(CC) $(LOCAL_FLAGS) -fPIE $(LOCAL_INCLUDE) -c $< -o $@ - -$(SHELLNAME): $(LOCAL_OBJ) - $(HIDE) $(CC) -pie -s $(LDPATH) $(BASE_OPTS) -o $(SHELLNAME) $^ $(LDCFLAGS) - $(HIDE) mkdir -p $(APPS_OUT) - $(HIDE) $(MV) $(SHELLNAME) $(APPS_OUT) - $(HIDE) $(RM) $(LOCAL_OBJ) - -clean: - $(HIDE) $(RM) $(LOCAL_OBJ) - $(HIDE) $(RM) $(SHELLNAME) - -.PHONY: all $(SHELLNAME) clean +include $(APP) diff --git a/apps/tftp/Makefile b/apps/tftp/Makefile index 37cf594c1123840299d5eabc0bdb9f121c02236b..4690d069a3fcb7871765d22fdca418c64dc70463 100644 --- a/apps/tftp/Makefile +++ b/apps/tftp/Makefile @@ -27,14 +27,9 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -ROOT_DIR := $(dir $(shell pwd))/tftp/ +include $(APPSTOPDIR)/config.mk -ifeq ($(APPSTOPDIR), ) -APPSTOPDIR := $(shell pwd)/../ -LITEOSTOPDIR = $(APPSTOPDIR)/../ -endif -include $(ROOT_DIR)/../config.mk -APPS_OUT := $(OUT)/bin +APP_NAME := $(notdir $(shell pwd)) SECUREC_DIR := $(LITEOSTHIRDPARTY)/bounds_checking_function @@ -43,35 +38,11 @@ LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/strncpy_s.c) LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/memcpy_s.c) LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/memset_s.c) LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/strncat_s.c) -LOCAL_OBJ := $(LOCAL_SRCS:.c=.o) LOCAL_INCLUDE := \ - -I $(ROOT_DIR)/include/ \ + -I include/ \ -I $(SECUREC_DIR)/include/\ -LOCAL_FLAGS += $(CFLAGS) +LOCAL_FLAGS += $(LOCAL_INCLUDE) -LDPATH := -L$(ROOT_DIR)/ -ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) -LOCAL_FLAGS += -Wno-shift-op-parentheses -Wno-bitwise-op-parentheses $(LLVM_SYSROOT) -LDCFLAGS += $(LLVM_EXTRA_LD_OPTS) $(LLVM_SYSROOT) -endif - -TARGETNAME := tftp - -all: $(TARGETNAME) - -$(LOCAL_OBJ): %.o : %.c - $(HIDE) $(CC) $(LOCAL_FLAGS) -fPIE $(LOCAL_INCLUDE) -c $< -o $@ - -$(TARGETNAME): $(LOCAL_OBJ) - $(HIDE) $(CC) -pie -s $(LDPATH) $(BASE_OPTS) -o $(TARGETNAME) $^ $(LDCFLAGS) - $(HIDE) mkdir -p $(APPS_OUT) - $(HIDE) $(MV) $(TARGETNAME) $(APPS_OUT) - $(HIDE) $(RM) $(LOCAL_OBJ) - -clean: - $(HIDE) $(RM) $(LOCAL_OBJ) - $(HIDE) $(RM) $(TARGETNAME) - -.PHONY: all $(TARGETNAME) clean +include $(APP) diff --git a/apps/toybox/Makefile b/apps/toybox/Makefile index 2ca70f2f0add7f0f97603b341f13ef067b377d57..b73dbeabd6d1900787cdea10874a88d070cc5be2 100644 --- a/apps/toybox/Makefile +++ b/apps/toybox/Makefile @@ -27,11 +27,11 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +include $(APPSTOPDIR)/config.mk + TOYBOX:= toybox TOYBOX_DIR := $(shell pwd) -LITEOSTOPDIR = $(TOYBOX_DIR)/../../ -include $(TOYBOX_DIR)/../config.mk APPS_OUT := $(OUT)/bin BUILD_DIR := $(TOYBOX_DIR)/build diff --git a/build.sh b/build.sh index 5afaf6f2efb9cf6af26950577bd24e254e4478af..fad8b51b03b335e1f409cbd37babf27a950463ed 100755 --- a/build.sh +++ b/build.sh @@ -42,17 +42,20 @@ ohos_version=${9} sysroot_path=${10} arch_cflags=${11} device_path=${12} +compile_prefix=${13} echo "${board_name}" "${device_company}" echo "sh param:" "$@" -destination="defconfig" +destination="${outdir}/defconfig" function main() { tee="" if [ "${tee_enable}" = "true" ]; then tee="_tee" fi + mkdir -p "${destination%/*}" + config_file="${product_path}/kernel_configs/${ohos_build_type}${tee}.config" if [ -f "${config_file}" ]; then cp "${config_file}" "${destination}" @@ -88,9 +91,13 @@ fi export PRODUCT_PATH="${product_path}" export DEVICE_PATH="${device_path}" -OUTDIR="${outdir}" -CONFIG="$(realpath ${destination})" +export OUTDIR="${outdir}" +export KCONFIG_CONFIG="${destination}" +export LITEOS_MENUCONFIG_H="${destination%/*}/config.h" +export LITEOS_CONFIG_FILE="${destination%/*}/.config" +export LITEOS_COMPILER_PATH="${compile_prefix%/*}/" +export CROSS_COMPILE="${compile_prefix##*/}" main && \ -make clean CONFIG="$CONFIG" OUTDIR="$OUTDIR" && \ -make -j all VERSION="${ohos_version}" CONFIG="$CONFIG" OUTDIR="$OUTDIR" +make clean && \ +make -j all VERSION="${ohos_version}" diff --git a/config.mk b/config.mk deleted file mode 120000 index 9dcbbc33bd1a113c87e4c8be945c7663d34f270a..0000000000000000000000000000000000000000 --- a/config.mk +++ /dev/null @@ -1 +0,0 @@ -tools/build/config.mk \ No newline at end of file diff --git a/config.mk b/config.mk new file mode 100644 index 0000000000000000000000000000000000000000..2345d71301e22e9f6b9727c90049e3553be11e83 --- /dev/null +++ b/config.mk @@ -0,0 +1,53 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +############### this is a makefile that you can config it ############### +-include $(LITEOSTOPDIR)/tools/build/mk/los_config.mk +##### liteos tables -u ldflags ##### +-include $(LITEOSTOPDIR)/tools/build/mk/liteos_tables_ldflags.mk + +LITEOS_COPTS := $(LITEOS_COPTS_DEBUG) $(LITEOS_COPTS_BASE) \ + $(LITEOS_COPTS_EXTRA) $(LITEOS_CORE_COPTS) +LITEOS_CXXOPTS := $(LITEOS_CXXOPTS_BASE) +LITEOS_INCLUDE := $(LITEOS_KERNEL_INCLUDE) $(LITEOS_EXTKERNEL_INCLUDE) \ + $(LITEOS_COMPAT_INCLUDE) $(LITEOS_FS_INCLUDE) \ + $(LITEOS_NET_INCLUDE) $(LITEOS_LIB_INCLUDE) \ + $(LITEOS_DRIVERS_INCLUDE) $(LOSCFG_TOOLS_DEBUG_INCLUDE) \ + $(LITEOS_PLATFORM_INCLUDE) $(LITEOS_DFX_INCLUDE) \ + $(LITEOS_SECURITY_INCLUDE) +LITEOS_LIBDEP := $(LITEOS_BASELIB) +LITEOS_ASFLAGS := $(LITEOS_ASOPTS) $(LITEOS_INCLUDE) +LITEOS_CFLAGS := $(LITEOS_COPTS) $(LITEOS_CMACRO) \ + $(LITEOS_CMACRO_TEST) $(LITEOS_IMAGE_MACRO) \ + $(LITEOS_INCLUDE) +LITEOS_CXXFLAGS := $(LITEOS_CXXOPTS) $(LITEOS_CXXMACRO) \ + $(LITEOS_CMACRO) $(LITEOS_CXXINCLUDE) +LITEOS_LDFLAGS := $(LITEOS_LD_OPTS) $(LITEOS_LD_PATH) \ + $(LITEOS_LD_SCRIPT) + diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig index f6a58d9e700ce2911499ea7be5e0a45d60a9734b..5665c46c4f738a3cecd67ece9dcf2eca977a0c59 100644 --- a/fs/nfs/Kconfig +++ b/fs/nfs/Kconfig @@ -3,5 +3,6 @@ config FS_NFS default y depends on FS_VFS depends on NET_LWIP_SACK + depends on DEBUG_VERSION help Answer Y to enable LiteOS support nfs filesystem. diff --git a/kernel/extended/vdso/BUILD.gn b/kernel/extended/vdso/BUILD.gn index fd7608f5951a4024610e6e88940e4c6657d93cb8..5df0a1327ec6398f3c801b2410e3329a54c26f81 100644 --- a/kernel/extended/vdso/BUILD.gn +++ b/kernel/extended/vdso/BUILD.gn @@ -46,8 +46,10 @@ config("public") { include_dirs = [ "include" ] } -copy("copy_ohos_vdso") { - deps = [ "usr:OHOS-vdso" ] - sources = [ get_path_info("usr/", "out_dir") + "/libOHOS-vdso.so" ] - outputs = [ "$root_out_dir/OHOS-vdso.so" ] +if (module_switch) { + copy("copy_ohos_vdso") { + deps = [ "usr:OHOS-vdso" ] + sources = [ get_path_info("usr/", "out_dir") + "/libOHOS-vdso.so" ] + outputs = [ "$root_out_dir/OHOS-vdso.so" ] + } } diff --git a/kernel/extended/vdso/src/Makefile b/kernel/extended/vdso/src/Makefile index f5de37eeff047cdf84d58a95bad360004d0f5ffd..eacf8d243fe525cfdcdbf3a99c7199ee7fef4cdd 100644 --- a/kernel/extended/vdso/src/Makefile +++ b/kernel/extended/vdso/src/Makefile @@ -33,8 +33,8 @@ MODULE_NAME := $(notdir $(shell pwd)/../vdso) LOCAL_SRCS := $(wildcard *.c) $(wildcard *.S) -LOCAL_INCLUDE := -I $(LITEOSTOPDIR)/kernel/base/include -I $(LITEOSTOPDIR)/kernel/extended/include -I $(LITEOSTOPDIR)/kernel/extended/vdso/include +LOCAL_INCLUDE := -I $(LITEOSTOPDIR)/kernel/base/include -I ../include -LOCAL_FLAGS := $(LOCAL_INCLUDE) -DOHOS_VDSO_SO=\"../usr/OHOS-vdso.so\" +LOCAL_FLAGS := $(LOCAL_INCLUDE) -DOHOS_VDSO_SO=\"$(OUT)/lib/OHOS-vdso.so\" include $(MODULE) \ No newline at end of file diff --git a/kernel/extended/vdso/usr/BUILD.gn b/kernel/extended/vdso/usr/BUILD.gn index 2c6edf94ca0f07ba761ada50df55eeb9f61b9ffa..fd12801221b408e50de464abab6ac57e7a27b560 100644 --- a/kernel/extended/vdso/usr/BUILD.gn +++ b/kernel/extended/vdso/usr/BUILD.gn @@ -53,7 +53,6 @@ shared_library("OHOS-vdso") { defines = [ "_XOPEN_SOURCE=700" ] ldflags = [ - "-Wl,-s", "-Wl,-Bsymbolic", "-Wl,-T" + rebase_path("los_vdso.ld", root_build_dir), ] diff --git a/kernel/extended/vdso/usr/Makefile b/kernel/extended/vdso/usr/Makefile index 68819e19e731b1dbe83f1e15dc75ad2f1aa03037..0a34e5a5b9ec24d95100a9d7908b7bb54975e786 100644 --- a/kernel/extended/vdso/usr/Makefile +++ b/kernel/extended/vdso/usr/Makefile @@ -29,7 +29,7 @@ include $(LITEOSTOPDIR)/config.mk -VDSO_SO = OHOS-vdso +VDSO_SO = $(OUT)/lib/OHOS-vdso.so VDSO_SRCS := los_vdso_sys.c VDSO_INCLUDE := -I $(LITEOSTOPDIR)/kernel/extended/vdso/include \ @@ -41,14 +41,14 @@ VDSO_CCFLAGS := -nostdlib -fPIC -fno-common -fno-strict-aliasing \ $(LITEOS_SSP) $(LITEOS_CORE_COPTS) $(WARNING_AS_ERROR) $(LITEOS_COPTS_OPTMIZE) ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) VDSO_CCFLAGS += $(LLVM_EXTRA_OPTS) --sysroot=$(SYSROOT_PATH) +VDSO_CCFLAGS += -O2 endif -VDSO_LDFLAGS := -shared -s -Bsymbolic -T los_vdso.ld +VDSO_LDFLAGS := -shared -Wl,-s,-Bsymbolic,-Tlos_vdso.ld all: $(VDSO_SO) -$(VDSO_SO): - $(HIDE)$(CC) $(VDSO_INCLUDE) $(VDSO_CCFLAGS) -c -o $@.o $(VDSO_SRCS) - $(HIDE)$(LD) $(VDSO_LDFLAGS) -o $@.so $@.o +$(VDSO_SO): $(VDSO_SRCS) + $(HIDE)$(CC) $(VDSO_INCLUDE) $(VDSO_CCFLAGS) $(VDSO_LDFLAGS) -o $@ $^ clean: - $(HIDE)$(RM) -rf *.o *.so + $(HIDE)$(RM) $(VDSO_SO) diff --git a/platform/Kconfig b/platform/Kconfig index afe9171d01badfc75bc6511e0286bbaa76bd0605..39357095131fb18ad67397f820457636b98dd4ce 100644 --- a/platform/Kconfig +++ b/platform/Kconfig @@ -45,7 +45,7 @@ config PLATFORM_QEMU_ARM_VIRT_CA7 endchoice choice - prompt "Porduct" + prompt "Product" help Select your target board. @@ -64,15 +64,15 @@ config PRODUCT_QEMU_ARM endchoice config BOARD_CONFIG_PATH - string "BOARD CONFIG PATH" + string "Board config path" default "config/board" config TEE_ENABLE - bool "ENABLE TEE" + bool "Enable TEE" default n depends on PLATFORM_HI3516DV300 help - ENABLE teeos in platform + Enable teeos in platform config HRTIMER_ENABLE bool "HR TIMER enable" diff --git a/platform/bsp.mk b/platform/bsp.mk index 9d13ac327d449f92ada6482907313404d078ac2d..c4ac412024b3d7b73e427d399d2c9962afd1185c 100644 --- a/platform/bsp.mk +++ b/platform/bsp.mk @@ -41,7 +41,7 @@ USB_SRC := ########################## Qemu ARM Virt Options############################## -LITEOS_BASELIB += -lbsp +LITEOS_BASELIB += -lbsp -lbsp_config PLATFORM_BSP_BASE := $(LITEOSTOPDIR)/platform @@ -53,5 +53,5 @@ PLATFORM_INCLUDE := -I $(LITEOSTOPDIR)/../../$(LOSCFG_BOARD_CONFIG_PATH) \ -I $(PLATFORM_BSP_BASE)/hw/include \ -I $(PLATFORM_BSP_BASE)/include -LIB_SUBDIRS += $(PLATFORM_BSP_BASE) +LIB_SUBDIRS += $(PLATFORM_BSP_BASE) $(LITEOSTOPDIR)/../../$(LOSCFG_BOARD_CONFIG_PATH) LITEOS_PLATFORM_INCLUDE += $(PLATFORM_INCLUDE) diff --git a/testsuites/Makefile b/testsuites/Makefile index a50c055237a8ad1aefe11d7bae15504956b527f0..4d79c1002e3a949f11084fa3b8ecb3a077f069fe 100644 --- a/testsuites/Makefile +++ b/testsuites/Makefile @@ -27,17 +27,12 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -LITEOSTESTTOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi) -export OS=$(shell uname -s) -ifneq ($(OS), Linux) -LITEOSTESTTOPDIR := $(shell dirname $(subst \,/,$(LITEOSTESTTOPDIR))/./) -endif - -LITEOSTOPDIR := $(LITEOSTESTTOPDIR)/.. +LITEOSTESTTOPDIR := $(shell pwd) +LITEOSTOPDIR ?= $(LITEOSTESTTOPDIR)/.. export LITEOSTOPDIR export LITEOSTESTTOPDIR --include $(LITEOSTESTTOPDIR)/config.mk +include $(LITEOSTESTTOPDIR)/config.mk RM = -rm -rf MAKE = make @@ -80,7 +75,7 @@ $(TEST_KERNEL): $(LITEOS_TEST_TARGET) $(LITEOS_TEST_TARGET): $(LITEOS_TEST_LIBC) $(LD) $(LITEOS_LDFLAGS) $(LITEOS_TABLES_LDFLAGS) $(LITEOS_DYNLDFLAGS) -Map=$(OUT)/$@.map -o $(OUT)/$@ --start-group $(LITEOS_LIBDEP) --end-group - $(OBJCOPY) -O binary $(OUT)/$@ $(LITEOS_TARGET_DIR)/$@.bin + $(OBJCOPY) -O binary $(OUT)/$@ $(OUT)/$@.bin $(OBJDUMP) -t $(OUT)/$@ |sort >$(OUT)/$@.sym.sorted $(OBJDUMP) -d $(OUT)/$@ >$(OUT)/$@.asm diff --git a/testsuites/config.mk b/testsuites/config.mk index ed3df669dd12992704e580097204664869cf46e2..4a8d9587f3a8e34752514655013b0bf0bcf390af 100644 --- a/testsuites/config.mk +++ b/testsuites/config.mk @@ -28,12 +28,9 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --include $(LITEOSTOPDIR)/tools/build/config.mk --include $(LITEOSTESTTOPDIR)/build/los_test_config.mk -LITEOS_CFLAGS += -I $(LITEOSTOPDIR)/lib/libc/musl/include \ - -I $(LITEOSTOPDIR)/lib/libc/musl/obj/include \ - -I $(LITEOSTOPDIR)/lib/libc/musl/arch/arm \ - -I $(LITEOSTOPDIR)/lib/libc/musl/arch/generic \ +include $(LITEOSTOPDIR)/config.mk +include $(LITEOSTESTTOPDIR)/build/los_test_config.mk +LITEOS_CFLAGS += \ -I $(LITEOSTHIRDPARTY)/bounds_checking_function/include \ -I $(LITEOSTOPDIR)/security/cap/ \ -I $(LITEOSTOPDIR)/security/vid/ \ diff --git a/testsuites/unittest/fs/proc/Makefile b/testsuites/unittest/fs/proc/Makefile deleted file mode 100644 index 17b845f1615b7b49a6f05344e393a02494411b8a..0000000000000000000000000000000000000000 --- a/testsuites/unittest/fs/proc/Makefile +++ /dev/null @@ -1,36 +0,0 @@ - -include $(LITEOSTOPDIR)/config.mk - -MODULE_NAME := $(notdir $(shell pwd))test - -LOCAL_INCLUDE := \ - -I $(LITEOSTOPDIR)/test/kernel/include \ - -I $(LITEOSTOPDIR)/fs/proc/include \ - -I $(LITEOSTOPDIR)/fs/include \ - -I $(LITEOSTOPDIR)/test/kernel/sample/fs/proc - -SRC_MODULES := . - -ifeq ($(LOSCFG_USER_TEST_LLT), y) -LLT_MODULES := llt -endif - -ifeq ($(LOSCFG_USER_TEST_PRESSURE), y) -PRESSURE_MODULES := pressure -endif - -ifeq ($(LOSCFG_USER_TEST_SMOKE), y) -SMOKE_MODULES := smoke -endif - -ifeq ($(LOSCFG_USER_TEST_FULL), y) -FULL_MODULES := full -endif - -LOCAL_MODULES := $(SRC_MODULES) $(LLT_MODULES) $(PRESSURE_MODULES) $(SMOKE_MODULES) $(FULL_MODULES) -LOCAL_SRCS := $(foreach dir,$(LOCAL_MODULES),$(wildcard $(dir)/*.c)) -LOCAL_CHS := $(foreach dir,$(LOCAL_MODULES),$(wildcard $(dir)/*.h)) - -LOCAL_FLAGS := $(LOCAL_INCLUDE) -Wno-error - -include $(MODULE) diff --git a/testsuites/unittest/fs/proc/proc.mk b/testsuites/unittest/fs/proc/proc.mk deleted file mode 100644 index e5f355013d4e0a7d3ab855cebf25f02bc8c596ae..0000000000000000000000000000000000000000 --- a/testsuites/unittest/fs/proc/proc.mk +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this list of -# conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, this list -# of conditions and the following disclaimer in the documentation and/or other materials -# provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -SRC_MODULES := fs/proc - -ifeq ($(LOSCFG_USER_TEST_LLT), y) -LLT_MODULES := fs/proc/llt -endif - -ifeq ($(LOSCFG_USER_TEST_SMOKE), y) -SMOKE_MODULES := fs/proc/smoke -endif - -ifeq ($(LOSCFG_USER_TEST_FULL), y) -FULL_MODULES := fs/proc/full -endif - -ifeq ($(LOSCFG_USER_TEST_PRESSURE), y) -PRESSURE_MODULES := fs/proc/pressure -endif - -LOCAL_MODULES := $(SRC_MODULES) $(LLT_MODULES) $(PRESSURE_MODULES) $(SMOKE_MODULES) $(FULL_MODULES) - -LOCAL_SRCS += $(foreach dir,$(LOCAL_MODULES),$(wildcard $(dir)/*.c)) -LOCAL_CHS += $(foreach dir,$(LOCAL_MODULES),$(wildcard $(dir)/*.h)) - -LOCAL_FLAGS += -I./fs/proc diff --git a/tools/build/config.mk b/tools/build/config.mk deleted file mode 100644 index eb4e6f0ef7b12e7151ede1c349d78469176430ee..0000000000000000000000000000000000000000 --- a/tools/build/config.mk +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this list of -# conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, this list -# of conditions and the following disclaimer in the documentation and/or other materials -# provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -############### this is a makefile that you can config it ############### --include $(LITEOSTOPDIR)/tools/build/mk/los_config.mk - -TOP_LD_PATH = $(LITEOSTOPDIR) -SCRIPTS_PATH = $(LITEOS_SCRIPTPATH) -LITEOS_MK_PATH = $(MK_PATH) -LITEOS_SUBDIRS = $(LIB_SUBDIRS) - -##### liteos tables -u ldflags ##### --include $(LITEOS_MK_PATH)/liteos_tables_ldflags.mk - - -LITEOS_COPTS := $(LITEOS_COPTS_DEBUG) $(LITEOS_COPTS_BASE) \ - $(LITEOS_COPTS_EXTRA) $(LITEOS_CORE_COPTS) -LITEOS_CXXOPTS := $(LITEOS_CXXOPTS_BASE) -LITEOS_INCLUDE := $(LITEOS_KERNEL_INCLUDE) $(LITEOS_EXTKERNEL_INCLUDE) \ - $(LITEOS_COMPAT_INCLUDE) $(LITEOS_FS_INCLUDE) \ - $(LITEOS_NET_INCLUDE) $(LITEOS_LIB_INCLUDE) \ - $(LITEOS_DRIVERS_INCLUDE) $(LOSCFG_TOOLS_DEBUG_INCLUDE) \ - $(LITEOS_PLATFORM_INCLUDE) $(LITEOS_DFX_INCLUDE) \ - $(LITEOS_SECURITY_INCLUDE) -LITEOS_LIBDEP := $(LITEOS_BASELIB) -LITEOS_ASFLAGS := $(LITEOS_ASOPTS) $(LITEOS_INCLUDE) -LITEOS_CFLAGS := $(LITEOS_COPTS) $(LITEOS_CMACRO) \ - $(LITEOS_CMACRO_TEST) $(LITEOS_IMAGE_MACRO) \ - $(LITEOS_INCLUDE) -LITEOS_CXXFLAGS := $(LITEOS_CXXOPTS) $(LITEOS_CXXMACRO) \ - $(LITEOS_CMACRO) $(LITEOS_CXXINCLUDE) -LITEOS_LDFLAGS := $(LITEOS_LD_OPTS) $(LITEOS_LD_PATH) \ - $(LITEOS_LD_SCRIPT) - diff --git a/tools/build/mk/bepbuildtime.conf b/tools/build/mk/bepbuildtime.conf deleted file mode 100644 index c262af18319040a88c08f9fb2e47adcf6baa9ec7..0000000000000000000000000000000000000000 --- a/tools/build/mk/bepbuildtime.conf +++ /dev/null @@ -1,4 +0,0 @@ -[timestamp] -uts=2020-01-04,16:54:14 -second=2020-01-04,16:54:14 -third=2020-01-04,16:54:14 \ No newline at end of file diff --git a/tools/build/mk/dynload.mk b/tools/build/mk/dynload.mk deleted file mode 100644 index 5b802f30e951bd7862bfad399e72fdbce4d3ad7f..0000000000000000000000000000000000000000 --- a/tools/build/mk/dynload.mk +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this list of -# conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, this list -# of conditions and the following disclaimer in the documentation and/or other materials -# provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -DYNLOADTESTDIR := $(LITEOSTOPDIR)/test/kernel/sample/kernel_extend/dynload -export DYNLOADTESTDIR - -##### command to test dynload ##### --include $(DYNLOADTESTDIR)/test_dynload.mk diff --git a/tools/build/mk/get_compiler_path.sh b/tools/build/mk/get_compiler_path.sh deleted file mode 100755 index 191e90462663d72a408b3341bc39235235a5758e..0000000000000000000000000000000000000000 --- a/tools/build/mk/get_compiler_path.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this list of -# conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, this list -# of conditions and the following disclaimer in the documentation and/or other materials -# provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -set -e -declare CROSS_COMPILER="$1" -declare HMOS_TOP_DIR="$2" -declare gcc_path=${HMOS_TOP_DIR}/../../prebuilts/gcc/linux-x86/arm/arm-linux-ohoseabi-gcc -declare windows_gcc_path=${HMOS_TOP_DIR}/../../prebuilts/gcc/win-x86/arm/arm-linux-ohoseabi-gcc -function get_compiler_path() -{ - local system=$(uname -s) - local user_gcc="${CROSS_COMPILER}"gcc - local gcc_install_path=$(which "${user_gcc}") - - if [ "$system" != "Linux" ] ; then - if [ -e "${windows_gcc_path}" ] ; then - gcc_install_path=$windows_gcc_path - else - gcc_install_path=$(dirname $gcc_install_path)/../ - fi - else - if [ -e "${gcc_path}" ] ; then - gcc_install_path=$gcc_path - else - gcc_install_path=$(dirname $gcc_install_path)/../ - fi - fi - - echo "$gcc_install_path" -} -get_compiler_path diff --git a/tools/build/mk/get_llvm_compiler_path.sh b/tools/build/mk/get_llvm_compiler_path.sh deleted file mode 100755 index 243c984bda21209f8a05fe6862da081bf5d70220..0000000000000000000000000000000000000000 --- a/tools/build/mk/get_llvm_compiler_path.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this list of -# conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, this list -# of conditions and the following disclaimer in the documentation and/or other materials -# provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -set -e -declare TEMP="$1" -declare TEMP2="$2" -declare llvm_path_linux=${TEMP2}/../../prebuilts/clang/ohos/linux-x86_64/llvm -declare llvm_path_windows=${TEMP2}/../../prebuilts/clang/ohos/windows-x86_64/llvm -function get_compiler_path() -{ - local system=$(uname -s) - local user_clang=clang - local clang_install_path=$(which "${user_clang}") - if [ "$system" == "Linux" ] ; then - if [ -e "${llvm_path_linux}" ] ; then - echo "${llvm_path_linux}" - elif [ -n "${clang_install_path}" ] ; then - clang_install_path=$(dirname ${clang_install_path})/../ - echo "${clang_install_path}" - else - echo "WARNING:Set llvm/bin path in PATH." - fi - else - if [ -e "${llvm_path_windows}" ] ; then - echo "${llvm_path_windows}" - elif [ -n "${clang_install_path}" ] ; then - clang_install_path=$(dirname ${clang_install_path})/../ - echo "${clang_install_path}" - else - echo "WARNING:Set llvm/bin path in PATH." - fi - fi -} -get_compiler_path diff --git a/tools/build/mk/los_config.mk b/tools/build/mk/los_config.mk index 5cf6b2085d2b1139609c86b25270638bf10a8e95..9386978caf8e11b5889324c0f2db7aa77cf9ee3d 100644 --- a/tools/build/mk/los_config.mk +++ b/tools/build/mk/los_config.mk @@ -27,17 +27,7 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -CONFIG_FILE ?= $(LITEOSTOPDIR)/.config --include $(CONFIG_FILE) -LOSCFG_BOARD_CONFIG_PATH := $(LOSCFG_BOARD_CONFIG_PATH:"%"=%) -ifeq ($(wildcard $(LITEOSTOPDIR)/../../$(LOSCFG_BOARD_CONFIG_PATH) $(LOSCFG_BOARD_CONFIG_PATH)),) -LOSCFG_BOARD_CONFIG_PATH := $(LOSCFG_BOARD_CONFIG_PATH:%/config/board=%/board) -endif -ifeq ($(LOSCFG_COMPILER_HIMIX_32), y) -CROSS_COMPILE := arm-linux-ohoseabi- -else ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) -CROSS_COMPILE := llvm- -endif +-include $(LITEOS_CONFIG_FILE) HIDE := @ CC := @@ -52,13 +42,10 @@ NM := MKDIR = mkdir OBJ_MKDIR = if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi RM = -rm -rf -ECHO = echo ifeq ($(OS),) OS := $(shell uname -s) export OS endif -COMPILE_NAME := $(patsubst %-,%,$(CROSS_COMPILE)) -VERSION_NUM := ARFLAGS := cr @@ -87,7 +74,6 @@ LITEOS_PLATFORM_INCLUDE := LITEOS_CXXINCLUDE := LITEOS_LD_PATH := LITEOS_LD_SCRIPT := -LITEOS_MK_PATH := ## c as cxx ld flags ## LITEOS_ASFLAGS := LITEOS_CFLAGS := @@ -104,26 +90,33 @@ LIB_SUBDIRS := ifeq ($(LITEOSTHIRDPARTY),) LITEOSTHIRDPARTY := $(LITEOSTOPDIR)/../../third_party endif +LOSCFG_BOARD_CONFIG_PATH := $(LOSCFG_BOARD_CONFIG_PATH:"%"=%) +ifeq ($(wildcard $(LITEOSTOPDIR)/../../$(LOSCFG_BOARD_CONFIG_PATH) $(LOSCFG_BOARD_CONFIG_PATH)),) +LOSCFG_BOARD_CONFIG_PATH := $(LOSCFG_BOARD_CONFIG_PATH:%/config/board=%/board) +endif +ifeq ($(LOSCFG_COMPILER_HIMIX_32), y) +CROSS_COMPILE ?= arm-linux-ohoseabi- +LITEOS_COMPILER_PATH ?= $(LITEOSTOPDIR)/../../prebuilts/gcc/linux-x86/arm/arm-linux-ohoseabi-gcc/bin/ +else ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) +CROSS_COMPILE ?= llvm- +LITEOS_COMPILER_PATH ?= $(LITEOSTOPDIR)/../../prebuilts/clang/ohos/linux-x86_64/llvm/bin/ +endif +ifeq ($(wildcard $(LITEOS_COMPILER_PATH)),) +LITEOS_COMPILER_PATH := $(patsubst %/$(CROSS_COMPILE)as,%/,$(shell which $(CROSS_COMPILE)as)) +endif LITEOS_PLATFORM := $(LOSCFG_PLATFORM:"%"=%) ifeq ($(OUTDIR),) -OUT = $(LITEOSTOPDIR)/out/$(LITEOS_PLATFORM) -LITEOS_TARGET_DIR = $(OUT) -KERNEL_COMPILE_ONLY = y +OUT = $(LITEOSTOPDIR)/out/$(LOSCFG_PRODUCT_NAME:"%"=%) else OUT = $(OUTDIR) -LITEOS_TARGET_DIR = $(OUT)/../../../ -KERNEL_COMPILE_ONLY = n endif BUILD = $(OUT)/obj -MK_PATH = $(LITEOSTOPDIR)/tools/build/mk CXX_PATH = $(LITEOSTOPDIR)/lib/cxxstl JFFS_PATH = $(LITEOSTOPDIR)/fs/jffs2 LITEOS_SCRIPTPATH ?= $(LITEOSTOPDIR)/tools/scripts -LITEOS_MENUCONFIG_H ?= $(LITEOSTOPDIR)/config.h -LOSCFG_ENTRY_SRC = $(LITEOSTOPDIR)/platform/los_config.c ### include variable -MODULE = $(MK_PATH)/module.mk +MODULE = $(LITEOSTOPDIR)/tools/build/mk/module.mk LITEOS_CMACRO += -D__LITEOS__ -DSECUREC_IN_KERNEL=0 AS_OBJS_LIBC_FLAGS = -D__ASSEMBLY__ @@ -154,14 +147,8 @@ endif ####################################### Kernel Option Begin ########################################### LITEOS_BASELIB += -lbase LIB_SUBDIRS += kernel/base -LITEOS_KERNEL_INCLUDE := -I $(LITEOSTOPDIR)/kernel/include - -LITEOS_BASELIB += -lbsp_config -LIB_SUBDIRS += $(LITEOSTOPDIR)/../../$(LOSCFG_BOARD_CONFIG_PATH) - -ifeq ($(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7), y) -LITEOS_PLATFORM_INCLUDE += -I $(LITEOSTOPDIR)/../../$(LOSCFG_BOARD_CONFIG_PATH)/include/ -endif +LITEOS_KERNEL_INCLUDE := -I $(LITEOSTOPDIR)/kernel/include \ + -I $(LITEOSTOPDIR)/kernel/base/include ifeq ($(LOSCFG_KERNEL_CPUP), y) LITEOS_BASELIB += -lcpup @@ -510,38 +497,30 @@ endif ############################# Security Option End ############################## ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) -ifeq ($(LITEOS_COMPILER_PATH),) -LITEOS_COMPILER_PATH := $(shell $(LITEOSTOPDIR)/tools/build/mk/get_llvm_compiler_path.sh "$(CROSS_COMPILE)" "$(LITEOSTOPDIR)") -export LITEOS_COMPILER_PATH -endif -CC = $(LITEOS_COMPILER_PATH)/bin/clang -AS = $(LITEOS_COMPILER_PATH)/bin/$(CROSS_COMPILE)as -AR = $(LITEOS_COMPILER_PATH)/bin/$(CROSS_COMPILE)ar -LD = $(LITEOS_COMPILER_PATH)/bin/ld.lld -GPP = $(LITEOS_COMPILER_PATH)/bin/clang++ -OBJCOPY = $(LITEOS_COMPILER_PATH)/bin/$(CROSS_COMPILE)objcopy -R .bss -OBJDUMP = $(LITEOS_COMPILER_PATH)/bin/$(CROSS_COMPILE)objdump -SIZE = $(LITEOS_COMPILER_PATH)/bin/$(CROSS_COMPILE)size -NM = $(LITEOS_COMPILER_PATH)/bin/$(CROSS_COMPILE)nm -STRIP = $(LITEOS_COMPILER_PATH)/bin/$(CROSS_COMPILE)strip +CC = $(LITEOS_COMPILER_PATH)clang +AS = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)as +AR = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)ar +LD = $(LITEOS_COMPILER_PATH)ld.lld +GPP = $(LITEOS_COMPILER_PATH)clang++ +OBJCOPY = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)objcopy -R .bss +OBJDUMP = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)objdump +SIZE = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)size +NM = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)nm +STRIP = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)strip LLVM_TARGET := arm-liteos LLVM_EXTRA_OPTS := -target $(LLVM_TARGET) -fms-extensions -Wno-address-of-packed-member LLVM_EXTRA_LD_OPTS := -fuse-ld=lld --rtlib=compiler-rt else -ifeq ($(LITEOS_COMPILER_PATH),) -LITEOS_COMPILER_PATH := $(shell $(LITEOSTOPDIR)/tools/build/mk/get_compiler_path.sh "$(CROSS_COMPILE)" "$(LITEOSTOPDIR)") -export LITEOS_COMPILER_PATH -endif -CC = $(LITEOS_COMPILER_PATH)/bin/$(CROSS_COMPILE)gcc -AS = $(LITEOS_COMPILER_PATH)/bin/$(CROSS_COMPILE)as -AR = $(LITEOS_COMPILER_PATH)/bin/$(CROSS_COMPILE)ar -LD = $(LITEOS_COMPILER_PATH)/bin/$(CROSS_COMPILE)ld -GPP = $(LITEOS_COMPILER_PATH)/bin/$(CROSS_COMPILE)g++ -OBJCOPY = $(LITEOS_COMPILER_PATH)/bin/$(CROSS_COMPILE)objcopy -OBJDUMP = $(LITEOS_COMPILER_PATH)/bin/$(CROSS_COMPILE)objdump -SIZE = $(LITEOS_COMPILER_PATH)/bin/$(CROSS_COMPILE)size -NM = $(LITEOS_COMPILER_PATH)/bin/$(CROSS_COMPILE)nm -STRIP = $(LITEOS_COMPILER_PATH)/bin/$(CROSS_COMPILE)strip +CC = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)gcc +AS = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)as +AR = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)ar +LD = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)ld +GPP = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)g++ +OBJCOPY = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)objcopy +OBJDUMP = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)objdump +SIZE = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)size +NM = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)nm +STRIP = $(LITEOS_COMPILER_PATH)$(CROSS_COMPILE)strip endif FP = -fno-omit-frame-pointer @@ -552,7 +531,7 @@ LITEOS_CXXOPTS_BASE += -std=c++11 -nostdlib -nostdinc -nostdinc++ -fexceptions LITEOS_EXTKERNEL_INCLUDE := $(LITEOS_CPPSUPPORT_INCLUDE) $(LITEOS_DYNLOAD_INCLUDE) \ $(LITEOS_TICKLESS_INCLUDE) $(LITEOS_TRACE_INCLUDE) \ $(LITEOS_VDSO_INCLUDE) $(LITEOS_LITEIPC_INCLUDE) \ - $(LITEOS_PIPE_INCLUDE) + $(LITEOS_PIPE_INCLUDE) $(LITEOS_CPUP_INCLUDE) LITEOS_COMPAT_INCLUDE := $(LITEOS_POSIX_INCLUDE) $(LITEOS_LINUX_INCLUDE) \ $(LITEOS_BSD_INCLUDE) LITEOS_FS_INCLUDE := $(LITEOS_VFS_INCLUDE) $(LITEOS_FAT_CACHE_INCLUDE) \ @@ -636,12 +615,6 @@ endif LITEOS_BASELIB += $(shell $(_CC) "-print-libgcc-file-name") LITEOS_LIB_INCLUDE += -isystem $(shell $(_CC) "-print-file-name=include") -# temporary -LITEOS_PLATFORM_INCLUDE += \ - -I $(LITEOSTOPDIR)/kernel/base/include \ - -I $(LITEOSTOPDIR)/kernel/extended/cpup \ - -I $(LITEOSTOPDIR)/kernel/extended/trace - LITEOS_CXXINCLUDE = $(LITEOS_INCLUDE) LITEOS_COPTS_NODEBUG := $(LITEOS_NODEBUG) $(LITEOS_COPTS_BASE) $(LITEOS_COPTS_EXTRA) diff --git a/tools/build/mk/module.mk b/tools/build/mk/module.mk index 7391fe0379f827bb69caedf1b645691cd0846d7f..7242087e1f40265131133fc97af0c811550dc7c4 100644 --- a/tools/build/mk/module.mk +++ b/tools/build/mk/module.mk @@ -27,14 +27,7 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -ifeq ($(OS), Linux) OBJOUT := $(BUILD)$(dir $(subst $(LITEOSTOPDIR),,$(shell pwd)))$(MODULE_NAME) -LOCAL_PWD := $(shell pwd) -else -TEMPLITEOSTOPDIR:=$(shell cygpath -u $(LITEOSTOPDIR)) -OBJOUT := $(BUILD)$(dir $(subst $(TEMPLITEOSTOPDIR),,$(shell pwd)))$(MODULE_NAME) -LOCAL_PWD := $(shell cygpath -m $(shell pwd)) -endif ifeq ($(LOCAL_SO), y) LIBSO := $(OUT)/lib/lib$(MODULE_NAME).so @@ -59,7 +52,7 @@ LOCAL_ASMOBJS := $(patsubst %.S,$(OBJOUT)/%.o,$(LOCAL_ASMSRCS)) LOCAL_ASMOBJS2 := $(patsubst %.s,$(OBJOUT)/%.o,$(LOCAL_ASMSRCS2)) LOCAL_CCOBJS := $(patsubst %.cc,$(OBJOUT)/%.o,$(LOCAL_CCSRCS)) -LOCAL_OBJS := $(LOCAL_COBJS) $(LOCAL_CPPOBJS) $(LOCAL_ASMOBJS) $(LOCAL_ASMOBJS2)$(LOCAL_CCOBJS) +LOCAL_OBJS := $(LOCAL_COBJS) $(LOCAL_CPPOBJS) $(LOCAL_ASMOBJS) $(LOCAL_ASMOBJS2) $(LOCAL_CCOBJS) LOCAL_CGCH := $(patsubst %.h,%.h.gch,$(LOCAL_CHS)) LOCAL_CPPGCH := $(patsubst %.h,%.h.gch,$(LOCAL_CPPHS)) diff --git a/tools/scripts/make_rootfs/releaseinfo.sh b/tools/scripts/make_rootfs/releaseinfo.sh index f15bb75d09af9917277f6ce383eec4cfc177e613..6c247303ff544a54aadd6d6af90659e867f9cbf4 100755 --- a/tools/scripts/make_rootfs/releaseinfo.sh +++ b/tools/scripts/make_rootfs/releaseinfo.sh @@ -28,20 +28,10 @@ # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -set -e - -if [ $# -ne 3 ];then - exit 1 -fi VERSION=$1 ROOTFS_DIR=$2 -OUT_DIR=$3 RELEASE_TIME=$(date "+%Y-%m-%d %H:%M:%S") echo VERSION=\"${VERSION}\" > ${ROOTFS_DIR}/etc/os-release echo RELEASE_TIME=\"${RELEASE_TIME}\" >> ${ROOTFS_DIR}/etc/os-release -if [ ! -d ${OUT_DIR}etc ]; then - mkdir -p ${OUT_DIR}etc -fi -cp ${ROOTFS_DIR}/etc/os-release ${OUT_DIR}etc diff --git a/tools/scripts/make_rootfs/rootfsdir.sh b/tools/scripts/make_rootfs/rootfsdir.sh index cb9f260ea2e29388c50a4beb7562cc8890d048fa..eea8604dfa68cbf1cf06dae6124f5da3769e6479 100755 --- a/tools/scripts/make_rootfs/rootfsdir.sh +++ b/tools/scripts/make_rootfs/rootfsdir.sh @@ -32,28 +32,18 @@ set -e OUT=$1 ROOTFS_DIR=$2 -OUT_DIR=$3 BIN_DIR=${OUT}/bin LIB_DIR=${OUT}/musl ETC_DIR=${OUT}/etc -NEED_COPYTO_OUTDIR=(shell toybox mksh tftp) mkdir -p ${ROOTFS_DIR}/bin ${ROOTFS_DIR}/lib ${ROOTFS_DIR}/usr/bin ${ROOTFS_DIR}/usr/lib ${ROOTFS_DIR}/etc \ ${ROOTFS_DIR}/app ${ROOTFS_DIR}/data ${ROOTFS_DIR}/proc ${ROOTFS_DIR}/dev ${ROOTFS_DIR}/data/system ${ROOTFS_DIR}/data/system/param \ -${ROOTFS_DIR}/system ${ROOTFS_DIR}/system/internal ${ROOTFS_DIR}/system/external ${OUT_DIR}/bin ${OUT_DIR}/libs ${OUT_DIR}/etc +${ROOTFS_DIR}/system ${ROOTFS_DIR}/system/internal ${ROOTFS_DIR}/system/external if [ -d "${BIN_DIR}" ] && [ "$(ls -A "${BIN_DIR}")" != "" ]; then cp -f ${BIN_DIR}/* ${ROOTFS_DIR}/bin - for el in ${NEED_COPYTO_OUTDIR[@]} - do - if [ -e ${BIN_DIR}/$el ] && [ "${BIN_DIR}/$el" != "${OUT_DIR}/bin/$el" ]; then - cp -u ${BIN_DIR}/$el ${OUT_DIR}/bin/$el - fi - done fi cp -f ${LIB_DIR}/* ${ROOTFS_DIR}/lib -cp -u ${LIB_DIR}/* ${OUT_DIR}/libs if [ -e ${ETC_DIR}/.mkshrc ]; then cp -f ${ETC_DIR}/.mkshrc ${ROOTFS_DIR}/etc -cp -u ${ETC_DIR}/.mkshrc ${OUT_DIR}/etc fi