Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
abbeca1c
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
大约 1 年 前同步成功
通知
456
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看板
提交
abbeca1c
编写于
6月 29, 2021
作者:
O
openharmony_ci
提交者:
Gitee
6月 29, 2021
浏览文件
操作
浏览文件
下载
差异文件
!359 sysroot和CPU架构参数通过BUILD.gn传递给Make
Merge pull request !359 from Caoruihong/sysroot
上级
50c8abc5
9e45086d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
83 addition
and
48 deletion
+83
-48
BUILD.gn
BUILD.gn
+3
-2
Makefile
Makefile
+9
-2
apps/config.mk
apps/config.mk
+1
-1
apps/mksh/Makefile
apps/mksh/Makefile
+3
-3
apps/toybox/Makefile
apps/toybox/Makefile
+2
-2
arch/arm/arm.mk
arch/arm/arm.mk
+1
-1
build.sh
build.sh
+63
-36
kernel/extended/vdso/usr/Makefile
kernel/extended/vdso/usr/Makefile
+1
-1
未找到文件。
BUILD.gn
浏览文件 @
abbeca1c
...
...
@@ -77,7 +77,8 @@ build_ext_component("make") {
if (board_name == "hi3516dv300" && enable_tee_ree) {
tee_enable = "tee"
}
prebuilts = "sh build.sh ${board_name} ${ohos_build_compiler} ${root_build_dir} ${ohos_build_type} ${tee_enable} \"${device_company}\" \"${product_path}\""
outdir = rebase_path(get_path_info(".", "out_dir"))
command = "make clean OUTDIR=$outdir PRODUCT_PATH=\"${product_path}\" && make rootfs VERSION=\"${ohos_version}\" PRODUCT_PATH=\"${product_path}\" -j 16 OUTDIR=$outdir"
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} \"${device_company}\" \"${product_path}\" $outdir \"${ohos_version}\" ${sysroot_path} \"${arch_cflags}\""
}
Makefile
浏览文件 @
abbeca1c
...
...
@@ -82,6 +82,9 @@ ROOTFS_DIR = $(OUT)/rootfs
ROOTFS_ZIP
=
$(OUT)
/rootfs.zip
VERSION
=
SYSROOT_PATH
?=
$(LITEOSTOPDIR)
/../../prebuilts/lite/sysroot
export
SYSROOT_PATH
all
:
$(OUT) $(BUILD) $(LITEOS_TARGET) $(APPS)
lib
:
$(OUT) $(BUILD) $(LITEOS_LIBS_TARGET)
...
...
@@ -165,11 +168,15 @@ $(LITEOS_TARGET): $(__LIBS)
$(APPS)
:
$(LITEOS_TARGET)
$(HIDE)$(MAKE)
-C
apps all
ifeq
($(LOSCFG_COMPILER_CLANG_LLVM), y)
MULTILIB
:=
$(
patsubst
$(
shell
$(CC)
--target
=
$(LLVM_TARGET)
$(ARCH_CFLAGS)
-print-file-name
=
lib/
$(LLVM_TARGET)
/
)
%,%,
$(
dir
$(
shell
$(CC)
--target
=
$(LLVM_TARGET)
$(ARCH_CFLAGS)
-print-libgcc-file-name
)))
endif
prepare
:
$(HIDE)
mkdir
-p
$(OUT)
/musl
ifeq
($(LOSCFG_COMPILER_CLANG_LLVM), y)
$(HIDE)
cp
-f
$(
LITEOSTOPDIR)
/../../prebuilts/lite/sysroot/usr/lib/
$(LLVM_TARGET)
/a7_softfp_neon-vfpv4
/libc.so
$(OUT)
/musl
$(HIDE)
cp
-f
$(LITEOS_COMPILER_PATH)
/lib/
$(LLVM_TARGET)
/c++/
a7_softfp_neon-vfpv4
/libc++.so
$(OUT)
/musl
$(HIDE)
cp
-f
$(
SYSROOT_PATH)
/usr/lib/
$(LLVM_TARGET)
/
$(MULTILIB)
/libc.so
$(OUT)
/musl
$(HIDE)
cp
-f
$(LITEOS_COMPILER_PATH)
/lib/
$(LLVM_TARGET)
/c++/
$(MULTILIB)
/libc++.so
$(OUT)
/musl
else
$(HIDE)
cp
-f
$(LITEOS_COMPILER_PATH)
/target/usr/lib/libc.so
$(OUT)
/musl
$(HIDE)
cp
-f
$(LITEOS_COMPILER_PATH)
/arm-linux-musleabi/lib/libstdc++.so.6
$(OUT)
/musl
...
...
apps/config.mk
浏览文件 @
abbeca1c
...
...
@@ -44,7 +44,7 @@ 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
=
$(
LITEOSTOPDIR)
/../../prebuilts/lite/sysroot/
LLVM_SYSROOT
:=
--sysroot
=
$(
SYSROOT_PATH)
$(ARCH_CFLAGS)
LDCXXFLGS
:=
-lc
++
-lc
++abi
-lc
else
BASE_OPTS
+=
-Wl
,-z,relro,-z,now
...
...
apps/mksh/Makefile
浏览文件 @
abbeca1c
...
...
@@ -38,11 +38,11 @@ BUILD_DIR := $(MKSH_DIR)/build
BUILD_LOG
:=
$(MKSH_DIR)
/build.log
TARGET_OS
:=
OpenHarmony
LOCAL_CFLAGS
:=
-flto
-fdata-sections
-ffunction-sections
-Oz
-fstack-protector-strong
-D_FORTIFY_SOURCE
=
2
-mcpu
=
cortex-a7
-mfloat-abi
=
softfp
-mfpu
=
neon-vfpv4
LOCAL_CFLAGS
+=
--target
=
arm-liteos
--sysroot
=
$(LITEOSTOPDIR)
/../../prebuilts/lite/sysroot/
LOCAL_CFLAGS
:=
-flto
-fdata-sections
-ffunction-sections
-Oz
-fstack-protector-strong
-D_FORTIFY_SOURCE
=
2
LOCAL_CFLAGS
+=
--target
=
arm-liteos
$(LLVM_SYSROOT)
LOCAL_CFLAGS
+=
-DMKSH_DISABLE_TTY_WARNING
-DMKSH_SMALL
=
1
-DMKSH_ASSUME_UTF8
=
1
-DMKSH_SMALL_BUT_FAST
=
0
-DMKSH_S_NOVI
=
1
-DHAVE_CAN_FSTACKPROTECTORSTRONG
=
1
LOCAL_CFLAGS
+=
-DMKSH_LESS_CMDLINE_EDITING
-DMKSH_LESS_BUILDINS
-DMKSH_NO_INITCOMS
-DADAPT_FOR_LITEOS_A
LOCAL_LDFLAGS
:=
-Wl
,--gc-sections
-flto
-O2
LOCAL_LDFLAGS
:=
-Wl
,--gc-sections
-flto
-O2
--target
=
arm-liteos
$(LLVM_SYSROOT)
all
:
$(MKSH)
...
...
apps/toybox/Makefile
浏览文件 @
abbeca1c
...
...
@@ -46,8 +46,8 @@ else
$(HIDE)$(CP)
$(LITEOSTHIRDPARTY)
/
$(TOYBOX)
/.
$(BUILD_DIR)
$(HIDE)$(CP)
-p
$(LITEOSTHIRDPARTY)
/
$(TOYBOX)
/porting/liteos_a/.
$(BUILD_DIR)
endif
$(HIDE)CFLAGS
=
"-D_FORTIFY_SOURCE=2 -fstack-protector-strong --target=arm-liteos
\
--sysroot=
$(LITEOSTOPDIR)
/../../prebuilts/lite/sysroot/"
CC
=
"
$(CC)
"
OUTNAME
=
$(OUTNAME)
\
$(HIDE)CFLAGS
=
"-D_FORTIFY_SOURCE=2 -fstack-protector-strong --target=arm-liteos
$(LLVM_SYSROOT)
"
CC
=
"
$(CC)
"
OUTNAME
=
$(OUTNAME)
\
LDFLAGS
=
"--target=arm-liteos
$(LLVM_SYSROOT)
"
\
make
-C
$(BUILD_DIR)
toybox
-j
>
$(BUILD_LOG)
2>&1
$(HIDE)$(CP)
$(BUILD_DIR)
/
$(TOYBOX)
.
$(HIDE)$(STRIP)
$(TOYBOX)
...
...
arch/arm/arm.mk
浏览文件 @
abbeca1c
...
...
@@ -65,7 +65,7 @@ LITEOS_FPU_OPTS := -mfpu=$(LOSCFG_ARCH_FPU)
LITEOS_GCCLIB
:=
$(
subst
cortex-,,
$(LOSCFG_ARCH_CPU)
)
_softfp_
$(LOSCFG_ARCH_FPU)
endif
LITEOS_CORE_COPTS
=
$(
LITEOS_CPU_OPTS)
$(LITEOS_FLOAT_OPTS)
$(LITEOS_FPU_OPTS
)
LITEOS_CORE_COPTS
=
$(
or
$(ARCH_CFLAGS)
,
$(LITEOS_CPU_OPTS)
$(LITEOS_FLOAT_OPTS)
$(LITEOS_FPU_OPTS)
)
LITEOS_INTERWORK
+=
$(LITEOS_CORE_COPTS)
LITEOS_NODEBUG
+=
$(LITEOS_CORE_COPTS)
LITEOS_ASOPTS
+=
$(LITEOS_CPU_OPTS)
...
...
build.sh
浏览文件 @
abbeca1c
...
...
@@ -30,44 +30,71 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set
-e
echo
"sh param:
$1
,
$2
,
$3
,
$4
,
$5
,
$6
,
$7
"
destination
=
".config"
config_file
=
""
tee
=
""
outdir
=
"../..
$3
/test_info/gen/kernel/test"
if
[
"
$5
"
=
"tee"
]
;
then
tee
=
"_tee"
fi
product_name
=
"
$(
basename
$7
)
"
source
=
"tools/build/config/
${
product_name
}
_release.config"
if
[
"
$2
"
=
"clang"
]
;
then
if
[
"
$4
"
=
"debug"
]
;
then
config_file
=
"
${
product_name
}
_
$2$tee
.config"
source
=
"tools/build/config/debug/
$config_file
"
else
config_file
=
"
${
product_name
}
_
$2_release$tee
.config"
source
=
"tools/build/config/
$config_file
"
board_name
=
${
1
}
ohos_build_compiler
=
${
2
}
root_build_dir
=
${
3
}
ohos_build_type
=
${
4
}
tee_enable
=
${
5
}
device_company
=
${
6
}
product_path
=
${
7
}
outdir
=
${
8
}
ohos_version
=
${
9
}
sysroot_path
=
${
10
}
arch_cflags
=
${
11
}
echo
"
${
board_name
}
"
"
${
device_company
}
"
echo
"sh param:"
"
$@
"
function
main
()
{
destination
=
".config"
config_file
=
""
tee
=
""
if
[
"
${
tee_enable
}
"
=
"tee"
]
;
then
tee
=
"_tee"
fi
elif
[
"
$2
"
=
"gcc"
]
;
then
if
[
"
$4
"
=
"debug"
]
;
then
config_file
=
"
${
product_name
}
_debug_shell
$tee
.config"
source
=
"tools/build/config/
$config_file
"
else
config_file
=
"
${
product_name
}
_release
$tee
.config"
source
=
"tools/build/config/
$config_file
"
product_name
=
$(
basename
"
${
product_path
}
"
)
source
=
"tools/build/config/
${
product_name
}
_release.config"
if
[
"
${
ohos_build_compiler
}
"
=
"clang"
]
;
then
if
[
"
${
ohos_build_type
}
"
=
"debug"
]
;
then
config_file
=
"
${
product_name
}
_
${
ohos_build_compiler
}${
tee
}
.config"
source
=
"tools/build/config/debug/
${
config_file
}
"
else
config_file
=
"
${
product_name
}
_
${
ohos_build_compiler
}
_release
${
tee
}
.config"
source
=
"tools/build/config/
${
config_file
}
"
fi
elif
[
"
${
ohos_build_compiler
}
"
=
"gcc"
]
;
then
if
[
"
${
ohos_build_type
}
"
=
"debug"
]
;
then
config_file
=
"
${
product_name
}
_debug_shell
${
tee
}
.config"
source
=
"tools/build/config/
${
config_file
}
"
else
config_file
=
"
${
product_name
}
_release
${
tee
}
.config"
source
=
"tools/build/config/
${
config_file
}
"
fi
fi
if
[
-d
"./out"
]
;
then
rm
-rf
./out
fi
if
[
-f
"
${
destination
}
"
]
;
then
rm
-rf
${
destination
}
fi
if
[
!
-f
"
${
source
}
"
]
;
then
source
=
"
${
product_path
}
/config/sys/
${
config_file
}
"
fi
cp
"
${
source
}
"
${
destination
}
test_info_outdir
=
"../..
${
root_build_dir
}
/test_info/gen/kernel/test"
mkdir
-p
"
${
test_info_outdir
}
"
cp
kernel_test.sources
"
${
test_info_outdir
}
"
}
if
[
"x"
!=
"x
${
sysroot_path
}
"
]
;
then
export
SYSROOT_PATH
=
${
sysroot_path
}
fi
if
[
-d
"./out"
]
;
then
rm
-rf
./out
fi
if
[
-f
"
$destination
"
]
;
then
rm
-rf
$destination
fi
if
[
!
-f
"
$source
"
]
;
then
source
=
"
$7
/config/sys/
$config_file
"
fi
cp
$source
$destination
mkdir
-p
$outdir
cp
kernel_test.sources
$outdir
if
[
"x"
!=
"x
${
arch_cflags
}
"
]
;
then
export
ARCH_CFLAGS
=
"
${
arch_cflags
}
"
fi
main
&&
\
make clean
OUTDIR
=
"
${
outdir
}
"
PRODUCT_PATH
=
"
${
product_path
}
"
&&
\
make
-j
rootfs
VERSION
=
"
${
ohos_version
}
"
OUTDIR
=
"
${
outdir
}
"
PRODUCT_PATH
=
"
${
product_path
}
"
kernel/extended/vdso/usr/Makefile
浏览文件 @
abbeca1c
...
...
@@ -40,7 +40,7 @@ VDSO_INCLUDE := -I $(LITEOSTOPDIR)/kernel/extended/vdso/include \
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
=
$(
LITEOSTOPDIR)
/../../prebuilts/lite/sysroot/
VDSO_CCFLAGS
+=
$(LLVM_EXTRA_OPTS)
--sysroot
=
$(
SYSROOT_PATH)
$(ARCH_CFLAGS)
endif
VDSO_LDFLAGS
:=
-shared
-s
-Bsymbolic
-T
los_vdso.ld
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录