chore: output liteos binaries to target_out_dir

liteos binaries no need pack to rootfs.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: Iba650c9d09302902c108760163eca55b4ec40221
This commit is contained in:
Caoruihong 2021-07-22 18:52:24 +08:00
parent 77270dd783
commit 3b5268f02a
5 changed files with 45 additions and 16 deletions

View File

@ -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'"

View File

@ -44,5 +44,6 @@ config("public") {
"base:public",
"common:public",
"extended:public",
"user:public",
]
}

View File

@ -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" ]
}

View File

@ -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
}

View File

@ -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" ]
}