提交 aaa9018a 编写于 作者: O openharmony_ci 提交者: Gitee

!455 内核二进制生成到target_out_dir中,避免误打包到rootfs中

Merge pull request !455 from Caoruihong/target_out_dir
......@@ -160,7 +160,15 @@ config("public") {
]
}
config("los_config") {
config("los_nostdinc") {
cflags = [ "-nostdinc" ]
}
config("los_nostdlib") {
ldflags = [ "-nostdlib" ]
}
config("los_common") {
cflags = [
"-imacros",
"$LITEOS_MENUCONFIG_H",
......@@ -168,16 +176,11 @@ config("los_config") {
defines = [ "__LITEOS__" ]
configs = [ ":arch_config" ]
ldflags = [ "-nostdlib" ]
cflags_c = [ "-std=c99" ]
cflags += [
"-fno-pic",
"-fno-builtin",
"-nostdinc",
"-Wall",
"-Werror",
"-fms-extensions",
......@@ -250,6 +253,15 @@ config("los_config") {
asmflags = cflags
}
config("los_config") {
configs = [
":los_common",
":arch_config",
":los_nostdinc",
":los_nostdlib",
]
}
liteos_name = "liteos2"
liteos_out = rebase_path("$target_out_dir/$liteos_name")
executable(liteos_name) {
......@@ -267,12 +279,14 @@ executable(liteos_name) {
libgcc = exec_script("//build/lite/run_shell_cmd.py", [ "$cc -print-libgcc-file-name" ], "trim string")
libs = [ libgcc ]
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
libs += [ "tools/build/liteos_llvm.ld" ]
ldflags += [ "-Wl,-T" + rebase_path("tools/build/liteos_llvm.ld", root_build_dir) ]
} else {
libs += [ "tools/build/liteos.ld" ]
ldflags += [ "-Wl,-T" + rebase_path("tools/build/liteos.ld", root_build_dir) ]
ldflags += [ "-nostartfiles" ]
}
output_dir = target_out_dir
deps = [
":modules",
]
......@@ -285,7 +299,7 @@ build_ext_component("build_liteos_bin") {
objcopy = "${compile_prefix}objcopy$toolchain_cmd_suffix"
objdump = "${compile_prefix}objdump$toolchain_cmd_suffix"
liteos = rebase_path("$root_out_dir/unstripped/bin/$liteos_name")
liteos = rebase_path("$target_out_dir/unstripped/bin/$liteos_name")
command = "$objcopy -O binary $liteos $liteos_out.bin"
command += " && sh -c '$objdump -t $liteos | sort >$liteos_out.sym.sorted'"
......
......@@ -44,5 +44,6 @@ config("public") {
"base:public",
"common:public",
"extended:public",
"user:public",
]
}
......@@ -48,6 +48,6 @@ config("public") {
copy("copy_ohos_vdso") {
deps = [ "usr:OHOS-vdso" ]
sources = [ "$root_out_dir/libOHOS-vdso.so" ]
sources = [ get_path_info("usr/", "out_dir") + "/libOHOS-vdso.so" ]
outputs = [ "$root_out_dir/OHOS-vdso.so" ]
}
......@@ -40,15 +40,23 @@ shared_library("OHOS-vdso") {
]
cflags = [
"-nostdlib",
"-fPIC",
"-fno-common",
"-fno-strict-aliasing",
]
configs = []
configs += [ "$LITEOSTOPDIR:los_common" ]
configs += [ "$LITEOSTOPDIR:los_nostdlib" ]
configs += [ "$LITEOSTOPDIR:arch_config" ]
defines = [ "_XOPEN_SOURCE=700" ]
ldflags = [
"-s",
"-Bsymbolic",
"-Tlos_vdso.ld",
"-Wl,-s",
"-Wl,-Bsymbolic",
"-Wl,-T" + rebase_path("los_vdso.ld", root_build_dir),
]
output_dir = target_out_dir
}
......@@ -30,7 +30,7 @@
import("//kernel/liteos_a/liteos.gni")
module_name = "userinit"
shared_library(module_name) {
executable(module_name) {
sources = [ "src/los_user_init.c" ]
include_dirs = [
......@@ -46,12 +46,18 @@ shared_library(module_name) {
ldflags = [
"-static",
"-r",
"-Wl,-r",
]
output_dir = target_out_dir
output_name = "lib$module_name"
output_extension = "O"
}
group("user") {
public_deps = [ ":$module_name" ]
}
config("public") {
lib_dirs = [ "$target_out_dir/unstripped/bin" ]
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册