Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
9888185f
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
大约 2 年 前同步成功
通知
475
Star
414
Fork
55
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel Liteos A
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9888185f
编写于
8月 31, 2021
作者:
O
openharmony_ci
提交者:
Gitee
8月 31, 2021
浏览文件
操作
浏览文件
下载
差异文件
!590 优化编译脚本,将LTO选项做成可配置
Merge pull request !590 from Caoruihong/lto
上级
c26ca519
055295b6
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
42 addition
and
90 deletion
+42
-90
BUILD.gn
BUILD.gn
+15
-11
Kconfig
Kconfig
+8
-0
Makefile
Makefile
+1
-1
kernel/common/patchfs/BUILD.gn
kernel/common/patchfs/BUILD.gn
+0
-1
kernel/common/patchfs/Makefile
kernel/common/patchfs/Makefile
+0
-6
liteos.gni
liteos.gni
+0
-3
platform/BUILD.gn
platform/BUILD.gn
+4
-11
platform/Makefile
platform/Makefile
+2
-19
platform/bsp.mk
platform/bsp.mk
+1
-19
tools/build/mk/los_config.mk
tools/build/mk/los_config.mk
+11
-19
未找到文件。
BUILD.gn
浏览文件 @
9888185f
...
@@ -88,6 +88,10 @@ exec_script("//build/lite/run_shell_cmd.py",
...
@@ -88,6 +88,10 @@ exec_script("//build/lite/run_shell_cmd.py",
import("liteos.gni")
import("liteos.gni")
assert(ARCH != "", "ARCH not set!")
assert(ARCH == arch, "ARCH not match! details: $ARCH != $arch")
assert(tee_enable == defined(LOSCFG_TEE_ENABLE), "TEE switch not match!")
generate_notice_file("kernel_notice_file") {
generate_notice_file("kernel_notice_file") {
module_name = "kernel"
module_name = "kernel"
module_source_dir_list = [
module_source_dir_list = [
...
@@ -200,7 +204,13 @@ config("optimize_config") {
...
@@ -200,7 +204,13 @@ config("optimize_config") {
} else {
} else {
optimization_cflag = "-Os"
optimization_cflag = "-Os"
}
}
cflags += [ "-flto" ]
}
if (defined(LOSCFG_COMPILE_LTO)) {
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
cflags += [ "-flto=thin" ]
} else {
cflags += [ "-flto" ]
}
}
}
cflags += [ optimization_cflag ]
cflags += [ optimization_cflag ]
asmflags = cflags
asmflags = cflags
...
@@ -223,11 +233,6 @@ config("warn_config") {
...
@@ -223,11 +233,6 @@ config("warn_config") {
"-Winvalid-pch",
"-Winvalid-pch",
"-Wno-address-of-packed-member",
"-Wno-address-of-packed-member",
]
]
if (defined(LOSCFG_QUICK_START)) {
cflags -= [ "-Werror" ]
}
asmflags = cflags
asmflags = cflags
}
}
...
@@ -279,7 +284,7 @@ config("los_config") {
...
@@ -279,7 +284,7 @@ config("los_config") {
executable("liteos") {
executable("liteos") {
configs = [] # clear default configs
configs = [] # clear default configs
configs += [ ":
los
_config" ]
configs += [ ":
arch
_config" ]
configs += [ ":public" ]
configs += [ ":public" ]
ldflags = [
ldflags = [
...
@@ -304,18 +309,17 @@ executable("liteos") {
...
@@ -304,18 +309,17 @@ executable("liteos") {
inputs += [ "$root_out_dir/board.ld" ]
inputs += [ "$root_out_dir/board.ld" ]
output_dir = target_out_dir
output_dir = target_out_dir
output_name = liteos_name
deps = [
deps = [
"platform:board.ld",
"platform:
copy_
board.ld",
":modules",
":modules",
]
]
}
}
copy("copy_liteos") {
copy("copy_liteos") {
deps = [ ":liteos" ]
deps = [ ":liteos" ]
sources = [ "$target_out_dir/unstripped/bin/
$liteos_name
" ]
sources = [ "$target_out_dir/unstripped/bin/
liteos
" ]
outputs = [ "$root_out_dir/
{{source_file_part}}
" ]
outputs = [ "$root_out_dir/
$liteos_name
" ]
}
}
build_ext_component("build_kernel_image") {
build_ext_component("build_kernel_image") {
...
...
Kconfig
浏览文件 @
9888185f
...
@@ -74,6 +74,14 @@ config COMPILE_OPTIMIZE_SIZE
...
@@ -74,6 +74,14 @@ config COMPILE_OPTIMIZE_SIZE
help
help
Answer Y to add optimization options for small code size.
Answer Y to add optimization options for small code size.
The final binary size will be smaller.
The final binary size will be smaller.
But the compile time may be a bit longer.
config COMPILE_LTO
bool "Enable link time optimization (LTO)" if COMPILE_OPTIMIZE_SIZE
default y
help
Answer Y to add lto options for more smaller code size.
The final binary size will be smaller.
But the compile time may be much longer.
But the compile time may be much longer.
endmenu
endmenu
...
...
Makefile
浏览文件 @
9888185f
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
LITEOSTOPDIR
:=
$(
realpath
$(
dir
$(
fir
stword
$(MAKEFILE_LIST)
)))
LITEOSTOPDIR
:=
$(
realpath
$(
dir
$(
la
stword
$(MAKEFILE_LIST)
)))
export
LITEOSTOPDIR
export
LITEOSTOPDIR
APPS
=
apps
APPS
=
apps
...
...
kernel/common/patchfs/BUILD.gn
浏览文件 @
9888185f
...
@@ -40,5 +40,4 @@ kernel_module(module_name) {
...
@@ -40,5 +40,4 @@ kernel_module(module_name) {
}
}
config("public") {
config("public") {
include_dirs = [ "." ]
}
}
kernel/common/patchfs/Makefile
浏览文件 @
9888185f
...
@@ -4,10 +4,4 @@ MODULE_NAME := $(notdir $(shell pwd))
...
@@ -4,10 +4,4 @@ MODULE_NAME := $(notdir $(shell pwd))
LOCAL_SRCS
:=
$(
wildcard
*
.c
)
LOCAL_SRCS
:=
$(
wildcard
*
.c
)
LOCAL_INCLUDE
:=
\
-I
$(LITEOSTOPDIR)
/kernel/common
\
-I
$(LITEOSTOPDIR)
/kernel/common/patchfs
\
LOCAL_FLAGS
:=
$(LOCAL_INCLUDE)
$(LITEOS_GCOV_OPTS)
include
$(MODULE)
include
$(MODULE)
liteos.gni
浏览文件 @
9888185f
...
@@ -40,9 +40,6 @@ if (defined(LOSCFG_ARCH_ARM_AARCH32)) {
...
@@ -40,9 +40,6 @@ if (defined(LOSCFG_ARCH_ARM_AARCH32)) {
ARCH = "aarch64"
ARCH = "aarch64"
}
}
assert(ARCH != "", "ARCH not set!")
assert(ARCH == arch, "ARCH not match! details: $ARCH != $arch")
template("kernel_module") {
template("kernel_module") {
current_dir_name = get_path_info(rebase_path("."), "file")
current_dir_name = get_path_info(rebase_path("."), "file")
if (target_name != current_dir_name) {
if (target_name != current_dir_name) {
...
...
platform/BUILD.gn
浏览文件 @
9888185f
...
@@ -66,23 +66,16 @@ config("public") {
...
@@ -66,23 +66,16 @@ config("public") {
include_dirs = [ "." ]
include_dirs = [ "." ]
}
}
source_set("boar
d") {
kernel_module("board.l
d") {
sources = [ "board.ld.S" ]
sources = [ "board.ld.S" ]
configs = []
configs += [
"$LITEOSTOPDIR:los_config",
"$LITEOSTOPDIR:public",
]
asmflags = [
asmflags = [
"-P",
"-P",
"-E",
"-E",
]
]
}
}
copy("board.ld") {
copy("
copy_
board.ld") {
deps = [ ":board" ]
deps = [ ":board
.ld
" ]
sources = [ "$target_out_dir/board.board.ld.o" ]
sources = [ "$target_out_dir/board.
ld.
board.ld.o" ]
outputs = [ "$root_out_dir/board.ld" ]
outputs = [ "$root_out_dir/board.ld" ]
}
}
platform/Makefile
浏览文件 @
9888185f
...
@@ -44,22 +44,6 @@ ifneq ($(LOSCFG_BASE_CORE_HILOG), y)
...
@@ -44,22 +44,6 @@ ifneq ($(LOSCFG_BASE_CORE_HILOG), y)
LOCAL_SRCS
:=
$(
filter-out
los_hilog.c,
$(LOCAL_SRCS)
)
LOCAL_SRCS
:=
$(
filter-out
los_hilog.c,
$(LOCAL_SRCS)
)
endif
endif
ifeq
($(LOSCFG_KERNEL_TICKLESS), y)
LOCAL_INCLUDE
+=
-I
$(LITEOSTOPDIR)
/kernel/extended/include
endif
ifeq
($(LOSCFG_KERNEL_TRACE), y)
LOCAL_INCLUDE
+=
-I
$(LITEOSTOPDIR)
/kernel/extended/include
endif
ifeq
($(LOSCFG_KERNEL_CPUP), y)
LOCAL_INCLUDE
+=
-I
$(LITEOSTOPDIR)
/kernel/extended/include
endif
ifeq
($(LOSCFG_KERNEL_VDSO), y)
LOCAL_INCLUDE
+=
-I
$(LITEOSTOPDIR)
/kernel/extended/vdso/include
endif
ALL_ASSRCS
:=
$(
wildcard
*
.S
)
ALL_ASSRCS
:=
$(
wildcard
*
.S
)
ASSRCS
:=
$(
filter-out
board.ld.S,
$(ALL_ASSRCS)
)
ASSRCS
:=
$(
filter-out
board.ld.S,
$(ALL_ASSRCS)
)
...
@@ -68,9 +52,8 @@ LOCAL_SRCS += $(ASSRCS)
...
@@ -68,9 +52,8 @@ LOCAL_SRCS += $(ASSRCS)
LOCAL_FLAGS
:=
$(LOCAL_INCLUDE)
$(LITEOS_GCOV_OPTS)
LOCAL_FLAGS
:=
$(LOCAL_INCLUDE)
$(LITEOS_GCOV_OPTS)
BOARD_LD
=
$(OUT)
/lib/board.ld
BOARD_LD
=
$(OUT)
/lib/board.ld
$(BOARD_LD)
:
board.ld.S $(LITEOS_MENUCONFIG_H)
$(BOARD_LD)
:
board.ld.S
$(HIDE)$(CC)
-I
$(LITEOSTOPDIR)
/kernel/base/include
-I
$(LITEOSTOPDIR)
/../../
$(LOSCFG_BOARD_CONFIG_PATH)
-I
.
\
$(HIDE)$(CC)
$(LITEOS_CFLAGS)
-P
-E
$<
-o
$@
-imacros
$(LITEOS_MENUCONFIG_H)
-P
-E
$<
-o
$@
.PHONY
:
rm_board_ld
.PHONY
:
rm_board_ld
rm_board_ld
:
rm_board_ld
:
...
...
platform/bsp.mk
浏览文件 @
9888185f
...
@@ -27,31 +27,13 @@
...
@@ -27,31 +27,13 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
############################# SRCs #################################
HWI_SRC
:=
MMU_SRC
:=
NET_SRC
:=
TIMER_SRC
:=
HRTIMER_SRC
:=
USB_SRC
:=
############################# HI3516DV300 Options#################################
########################## HI3518EV300 Options##############################
########################## Qemu ARM Virt Options##############################
LITEOS_BASELIB
+=
-lbsp
-lbsp_config
LITEOS_BASELIB
+=
-lbsp
-lbsp_config
PLATFORM_BSP_BASE
:=
$(LITEOSTOPDIR)
/platform
PLATFORM_BSP_BASE
:=
$(LITEOSTOPDIR)
/platform
PLATFORM_INCLUDE
:=
-I
$(LITEOSTOPDIR)
/../../
$(LOSCFG_BOARD_CONFIG_PATH)
\
PLATFORM_INCLUDE
:=
-I
$(LITEOSTOPDIR)
/../../
$(LOSCFG_BOARD_CONFIG_PATH)
\
-I
$(LITEOSTOPDIR)
/../../
$(LOSCFG_BOARD_CONFIG_PATH)
/include
\
-I
$(LITEOSTOPDIR)
/../../
$(LOSCFG_BOARD_CONFIG_PATH)
/include
\
-I
$(PLATFORM_BSP_BASE)
/../kernel/common/rootfs
\
-I
$(PLATFORM_BSP_BASE)
-I
$(PLATFORM_BSP_BASE)
\
-I
$(PLATFORM_BSP_BASE)
/../../../drivers/liteos/platform/pm
\
-I
$(PLATFORM_BSP_BASE)
/hw/include
\
-I
$(PLATFORM_BSP_BASE)
/include
LIB_SUBDIRS
+=
$(PLATFORM_BSP_BASE)
$(LITEOSTOPDIR)
/../../
$(LOSCFG_BOARD_CONFIG_PATH)
LIB_SUBDIRS
+=
$(PLATFORM_BSP_BASE)
$(LITEOSTOPDIR)
/../../
$(LOSCFG_BOARD_CONFIG_PATH)
LITEOS_PLATFORM_INCLUDE
+=
$(PLATFORM_INCLUDE)
LITEOS_PLATFORM_INCLUDE
+=
$(PLATFORM_INCLUDE)
tools/build/mk/los_config.mk
浏览文件 @
9888185f
...
@@ -30,16 +30,6 @@
...
@@ -30,16 +30,6 @@
-include
$(LITEOS_CONFIG_FILE)
-include
$(LITEOS_CONFIG_FILE)
HIDE
:=
@
HIDE
:=
@
CC
:=
AS
:=
AR
:=
LD
:=
GPP
:=
OBJCOPY
:=
OBJDUMP
:=
SIZE
:=
NM
:=
MKDIR
=
mkdir
OBJ_MKDIR
=
if
[
!
-d
$(
dir
$@
)
]
;
then
mkdir
-p
$(
dir
$@
)
;
fi
OBJ_MKDIR
=
if
[
!
-d
$(
dir
$@
)
]
;
then
mkdir
-p
$(
dir
$@
)
;
fi
RM
=
-rm
-rf
RM
=
-rm
-rf
ifeq
($(OS),)
ifeq
($(OS),)
...
@@ -121,12 +111,6 @@ MODULE = $(LITEOSTOPDIR)/tools/build/mk/module.mk
...
@@ -121,12 +111,6 @@ MODULE = $(LITEOSTOPDIR)/tools/build/mk/module.mk
LITEOS_CMACRO
+=
-D__LITEOS__
-DSECUREC_IN_KERNEL
=
0
LITEOS_CMACRO
+=
-D__LITEOS__
-DSECUREC_IN_KERNEL
=
0
AS_OBJS_LIBC_FLAGS
=
-D__ASSEMBLY__
AS_OBJS_LIBC_FLAGS
=
-D__ASSEMBLY__
ifeq
($(LOSCFG_QUICK_START), y)
WARNING_AS_ERROR
:=
-Wall
else
WARNING_AS_ERROR
:=
-Wall
-Werror
endif
####################################### CPU Option Begin #########################################
####################################### CPU Option Begin #########################################
include
$(LITEOSTOPDIR)/arch/cpu.mk
include
$(LITEOSTOPDIR)/arch/cpu.mk
####################################### CPU Option End #########################################
####################################### CPU Option End #########################################
...
@@ -137,6 +121,7 @@ include $(LITEOSTOPDIR)/platform/bsp.mk
...
@@ -137,6 +121,7 @@ include $(LITEOSTOPDIR)/platform/bsp.mk
ifeq
($(LOSCFG_PLATFORM_ROOTFS), y)
ifeq
($(LOSCFG_PLATFORM_ROOTFS), y)
LITEOS_BASELIB
+=
-lrootfs
LITEOS_BASELIB
+=
-lrootfs
LIB_SUBDIRS
+=
$(LITEOSTOPDIR)
/kernel/common/rootfs
LIB_SUBDIRS
+=
$(LITEOSTOPDIR)
/kernel/common/rootfs
LITEOS_PLATFORM_INCLUDE
+=
-I
$(LITEOSTOPDIR)
/kernel/common/rootfs
endif
endif
ifeq
($(LOSCFG_PLATFORM_PATCHFS), y)
ifeq
($(LOSCFG_PLATFORM_PATCHFS), y)
...
@@ -440,9 +425,16 @@ ifeq ($(LOSCFG_COMPILE_OPTIMIZE), y)
...
@@ -440,9 +425,16 @@ ifeq ($(LOSCFG_COMPILE_OPTIMIZE), y)
endif
endif
ifeq
($(LOSCFG_COMPILE_OPTIMIZE_SIZE), y)
ifeq
($(LOSCFG_COMPILE_OPTIMIZE_SIZE), y)
ifeq
($(LOSCFG_COMPILER_CLANG_LLVM), y)
ifeq
($(LOSCFG_COMPILER_CLANG_LLVM), y)
LITEOS_COPTS_OPTIMIZE
=
-Oz
-flto
LITEOS_COPTS_OPTIMIZE
=
-Oz
else
LITEOS_COPTS_OPTIMIZE
=
-Os
endif
endif
ifeq
($(LOSCFG_COMPILE_LTO), y)
ifeq
($(LOSCFG_COMPILER_CLANG_LLVM), y)
LITEOS_COPTS_OPTIMIZE
+=
-flto
=
thin
else
else
LITEOS_COPTS_OPTIMIZE
=
-Os
-flto
LITEOS_COPTS_OPTIMIZE
+=
-flto
endif
endif
endif
endif
LITEOS_COPTS_DEBUG
+=
$(LITEOS_COPTS_OPTION)
$(LITEOS_COPTS_OPTIMIZE)
LITEOS_COPTS_DEBUG
+=
$(LITEOS_COPTS_OPTION)
$(LITEOS_COPTS_OPTIMIZE)
...
@@ -556,7 +548,7 @@ LITEOS_SECURITY_INCLUDE := $(LITEOS_SECURITY_CAP_INC) $(LITEOS_SECURITY_VID_I
...
@@ -556,7 +548,7 @@ LITEOS_SECURITY_INCLUDE := $(LITEOS_SECURITY_CAP_INC) $(LITEOS_SECURITY_VID_I
LOSCFG_TOOLS_DEBUG_INCLUDE
:=
$(LITEOS_SHELL_INCLUDE)
$(LITEOS_UART_INCLUDE)
\
LOSCFG_TOOLS_DEBUG_INCLUDE
:=
$(LITEOS_SHELL_INCLUDE)
$(LITEOS_UART_INCLUDE)
\
$(LITEOS_TELNET_INCLUDE)
$(LITEOS_TELNET_INCLUDE)
LITEOS_COMMON_OPTS
:=
-fno-pic
-fno-builtin
-nostdinc
-nostdlib
$(WARNING_AS_ERROR)
-fms-extensions
-fno-omit-frame-pointer
-Wno-address-of-packed-member
-Winvalid-pch
LITEOS_COMMON_OPTS
:=
-fno-pic
-fno-builtin
-nostdinc
-nostdlib
-Wall
-Werror
-fms-extensions
-fno-omit-frame-pointer
-Wno-address-of-packed-member
-Winvalid-pch
LITEOS_CXXOPTS_BASE
+=
$(LITEOS_COMMON_OPTS)
-std
=
c++11
-nostdinc
++
-fexceptions
-fpermissive
-fno-use-cxa-atexit
-frtti
LITEOS_CXXOPTS_BASE
+=
$(LITEOS_COMMON_OPTS)
-std
=
c++11
-nostdinc
++
-fexceptions
-fpermissive
-fno-use-cxa-atexit
-frtti
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录