diff --git a/BUILD.gn b/BUILD.gn index 5e2e10fa92564a0d1ad37d4717f8fd39eb742d0b..393afcc0885fcabe5174e960a7bd72fee2282572 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -12,20 +12,20 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . if (defined(ohos_lite)) { - import("//build/lite/config/component/lite_component.gni") + import("//build/lite/config/component/lite_component.gni") } else { - import("//build/ohos.gni") - import("//build/config/clang/clang.gni") + import("//build/config/clang/clang.gni") + import("//build/ohos.gni") } import("//build/ohos/kernel/kernel.gni") if (defined(ohos_lite)) { - build_ext_component("linux_kernel") { + build_ext_component("linux_kernel") { exec_path = rebase_path(".", root_build_dir) outdir = rebase_path("$root_out_dir") clang_dir = "" if (ohos_build_compiler_dir != "") { - clang_dir = rebase_path("${ohos_build_compiler_dir}") + clang_dir = rebase_path("${ohos_build_compiler_dir}") } build_type = "small" product_path_rebase = rebase_path(product_path, ohos_root_path) @@ -33,31 +33,34 @@ if (defined(ohos_lite)) { deps = [ "//build/lite:mark_as_prebuilts" ] } } else { - kernel_build_script_dir = "//kernel/linux/build" - kernel_source_dir = "//kernel/linux/$linux_kernel_version" + kernel_build_script_dir = "//kernel/linux/build" + kernel_source_dir = "//kernel/linux/$linux_kernel_version" - action("build_kernel") { - script = "build_kernel.sh" - sources = [ kernel_source_dir ] + action("build_kernel") { + script = "build_kernel.sh" + sources = [ kernel_source_dir ] - product_path="vendor/$product_company/$product_name" - build_type = "standard" - outputs = [ "$root_build_dir/packages/phone/images/uImage" ] - args = [ - rebase_path(kernel_build_script_dir, root_build_dir), - rebase_path("$root_out_dir/../KERNEL_OBJ"), - rebase_path("$root_build_dir/packages/phone/images"), - build_type, - rebase_path("$clang_base_path"), - product_path, - device_name, - linux_kernel_version - ] - } + product_path = "vendor/$product_company/$product_name" + build_type = "standard" + outputs = [ "$root_build_dir/packages/phone/images/uImage" ] + args = [ + rebase_path(kernel_build_script_dir, root_build_dir), + rebase_path("$root_out_dir/../KERNEL_OBJ"), + rebase_path("$root_build_dir/packages/phone/images"), + build_type, + rebase_path("$clang_base_path"), + product_path, + device_name, + linux_kernel_version, + ] + } - group("linux_kernel") { - deps = [ - ":build_kernel", - ] - } + ohos_copy("zImage-dtb") { + sources = [ "$root_out_dir/../KERNEL_OBJ/kernel/OBJ/$linux_kernel_version/arch/arm/boot/zImage-dtb" ] + outputs = [ "$root_build_dir/zImage-dtb" ] + } + + group("linux_kernel") { + deps = [ ":build_kernel" ] + } } diff --git a/build_kernel.sh b/build_kernel.sh index 8c146fdf51d4cfe184ed47ac9a4b743120b41288..91720fcdb53bd9f2a7f02c722fa54d541643a2aa 100755 --- a/build_kernel.sh +++ b/build_kernel.sh @@ -24,5 +24,4 @@ pushd ${1} ./kernel_module_build.sh ${2} ${4} ${5} ${6} ${7} ${8} mkdir -p ${3} cp ${2}/kernel/OBJ/${8}/arch/arm/boot/uImage ${3}/uImage -cp ${2}/kernel/OBJ/${8}/arch/arm/boot/zImage-dtb ${3}/zImage-dtb popd