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