!475 将toybox和mksh加入到gn编译代替其make编译
Merge pull request !475 from Caoruihong/gn_build_apps
This commit is contained in:
commit
1722aaa80d
7
Makefile
7
Makefile
|
@ -152,8 +152,9 @@ $(LITEOS_LIBS_TARGET): $(__LIBS) sysroot
|
|||
$(HIDE)echo "=============== make lib done ==============="
|
||||
|
||||
##### make menuconfig #####
|
||||
menuconfig:
|
||||
$(HIDE)menuconfig
|
||||
KCONFIG_CMDS = $(notdir $(wildcard $(dir $(shell which menuconfig))*config))
|
||||
$(KCONFIG_CMDS):
|
||||
$(HIDE)$@ $(args)
|
||||
##### menuconfig end #######
|
||||
|
||||
$(LITEOS_MENUCONFIG_H): .config
|
||||
|
@ -229,4 +230,4 @@ update_config:
|
|||
$(HIDE)test -f "$(CONFIG)" && cp -v "$(CONFIG)" .config && menuconfig && savedefconfig --out "$(CONFIG)"
|
||||
|
||||
.PHONY: all lib clean cleanall $(LITEOS_TARGET) debug release help update_all_config update_config
|
||||
.PHONY: prepare sysroot cleanrootfs $(ROOTFS) $(ROOTFSDIR) $(APPS) menuconfig $(LITEOS_LIBS_TARGET) $(__LIBS) $(OUT)
|
||||
.PHONY: prepare sysroot cleanrootfs $(ROOTFS) $(ROOTFSDIR) $(APPS) $(KCONFIG_CMDS) $(LITEOS_LIBS_TARGET) $(__LIBS) $(OUT)
|
||||
|
|
|
@ -35,13 +35,13 @@ group("apps") {
|
|||
if (defined(LOSCFG_SHELL)) {
|
||||
deps += [
|
||||
"shell",
|
||||
#"mksh",
|
||||
#"toybox",
|
||||
"mksh",
|
||||
"toybox",
|
||||
]
|
||||
}
|
||||
|
||||
if (defined(LOSCFG_USER_INIT_DEBUG)) {
|
||||
#deps += [ "init" ]
|
||||
deps += [ "init" ]
|
||||
}
|
||||
|
||||
if (defined(LOSCFG_NET_LWIP_SACK_TFTP)) {
|
||||
|
|
|
@ -34,7 +34,56 @@ group("mksh") {
|
|||
deps = [ ":build_mksh" ]
|
||||
}
|
||||
|
||||
build_ext_component("build_mksh") {
|
||||
exec_path = rebase_path(target_out_dir)
|
||||
command = "make -C $LITEOSTHIRDPARTY/mksh"
|
||||
copy("copy_mksh_src") {
|
||||
sources = [ "$LITEOSTHIRDPARTY/mksh" ]
|
||||
outputs = [ "$target_out_dir/mksh_build" ]
|
||||
}
|
||||
|
||||
build_ext_component("build_mksh") {
|
||||
deps = [ ":copy_mksh_src" ]
|
||||
deps += [ "//prebuilts/lite/sysroot" ]
|
||||
exec_path = rebase_path("$target_out_dir/mksh_build")
|
||||
|
||||
cflags = [
|
||||
"-flto",
|
||||
"-fdata-sections",
|
||||
"-ffunction-sections",
|
||||
"-Oz",
|
||||
"-fstack-protector-strong",
|
||||
"-D_FORTIFY_SOURCE=2",
|
||||
"-DMKSH_DISABLE_TTY_WARNING",
|
||||
"-DMKSH_SMALL=1",
|
||||
"-DMKSH_ASSUME_UTF8=1",
|
||||
"-DMKSH_SMALL_BUT_FAST=0",
|
||||
"-DMKSH_S_NOVI=1",
|
||||
"-DHAVE_CAN_FSTACKPROTECTORSTRONG=1",
|
||||
"-DMKSH_LESS_CMDLINE_EDITING",
|
||||
"-DMKSH_LESS_BUILDINS",
|
||||
"-DMKSH_NO_INITCOMS",
|
||||
"-DADAPT_FOR_LITEOS_A",
|
||||
]
|
||||
cflags = string_join(" ", cflags)
|
||||
|
||||
extra_flags = string_join(" ", target_arch_cflags)
|
||||
if (ohos_build_compiler == "clang") {
|
||||
extra_flags += " --target=$target_triple"
|
||||
extra_flags += " --sysroot=" + rebase_path(ohos_current_sysroot)
|
||||
}
|
||||
|
||||
command = "rm -rf .git && env"
|
||||
command += " CC=\"$ohos_current_cc_command\""
|
||||
command += " TARGET_OS=OpenHarmony"
|
||||
command += " CFLAGS=\"$cflags $extra_flags\""
|
||||
command += " LDFLAGS=\"-Wl,--gc-sections -flto -O2\""
|
||||
command += " sh ./Build.sh -r"
|
||||
|
||||
# copy mksh and .mkshrc to out dir
|
||||
command += " && mkdir -p "
|
||||
command += rebase_path("$root_out_dir/bin", exec_path)
|
||||
command += " "
|
||||
command += rebase_path("$root_out_dir/etc", exec_path)
|
||||
command += " && $ohos_current_strip_command mksh -o "
|
||||
command += rebase_path("$root_out_dir/bin/mksh", exec_path)
|
||||
command += " && cp -f .mkshrc "
|
||||
command += rebase_path("$root_out_dir/etc", exec_path)
|
||||
}
|
||||
|
|
|
@ -33,8 +33,8 @@ APP_SUBDIRS :=
|
|||
|
||||
ifeq ($(LOSCFG_SHELL), y)
|
||||
APP_SUBDIRS += shell
|
||||
APP_SUBDIRS += mksh
|
||||
APP_SUBDIRS += toybox
|
||||
#APP_SUBDIRS += mksh
|
||||
#APP_SUBDIRS += toybox
|
||||
endif
|
||||
|
||||
ifeq ($(LOSCFG_USER_INIT_DEBUG), y)
|
||||
|
|
|
@ -34,7 +34,40 @@ group("toybox") {
|
|||
deps = [ ":build_toybox" ]
|
||||
}
|
||||
|
||||
build_ext_component("build_toybox") {
|
||||
exec_path = rebase_path(target_out_dir)
|
||||
command = "make -C $LITEOSTHIRDPARTY/toybox"
|
||||
copy("copy_toybox_src") {
|
||||
sources = [ "$LITEOSTHIRDPARTY/toybox" ]
|
||||
outputs = [ "$target_out_dir/toybox_build" ]
|
||||
}
|
||||
|
||||
copy("copy_toybox_config") {
|
||||
deps = [ ":copy_toybox_src" ]
|
||||
sources = [ "liteos_a_custom.config" ]
|
||||
outputs = [ "$target_out_dir/{{source_file_part}}" ]
|
||||
}
|
||||
|
||||
build_ext_component("build_toybox") {
|
||||
deps = [ ":copy_toybox_src", ":copy_toybox_config" ]
|
||||
deps += [ "//prebuilts/lite/sysroot" ]
|
||||
exec_path = rebase_path("$target_out_dir/toybox_build")
|
||||
|
||||
cflags = [
|
||||
"-fstack-protector-strong",
|
||||
"-D_FORTIFY_SOURCE=2",
|
||||
]
|
||||
cflags = string_join(" ", cflags)
|
||||
|
||||
extra_flags = string_join(" ", target_arch_cflags)
|
||||
if (ohos_build_compiler == "clang") {
|
||||
extra_flags += " --target=$target_triple"
|
||||
extra_flags += " --sysroot=" + rebase_path(ohos_current_sysroot)
|
||||
}
|
||||
|
||||
command = "rm -rf .git && cp -rfp porting/liteos_a/. . && env"
|
||||
command += " CC=\"$ohos_current_cc_command\""
|
||||
command += " STRIP=\"$ohos_current_strip_command\""
|
||||
command += " OUTNAME=toybox"
|
||||
command += " CFLAGS=\"$cflags $extra_flags\""
|
||||
command += " make toybox"
|
||||
command += " && install -D toybox "
|
||||
command += rebase_path("$root_out_dir/bin/toybox", exec_path)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue