1# Copyright (c) 2022 Hunan OpenValley Digital Industry Development Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//kernel/liteos_m/liteos.gni") 15 16if (ohos_kernel_type == "liteos_m") { 17 module_name = get_path_info(rebase_path("."), "name") 18 module_group(module_name) { 19 modules = [ "liteos_m" ] 20 } 21} 22 23group("process_after_build") { 24 deps = [ 25 ":copy_bin", 26 ":elf2bin", 27 ] 28} 29 30ESP_SDK_PATH = "//device/soc/esp/esp32/components/" 31import("${ESP_SDK_PATH}sdkconfig.gni") 32build_ext_component("elf2bin") { 33 exec_path = rebase_path(ESP_SDK_PATH) 34 _input_boot_file = rebase_path("$root_out_dir/bin/bootloader.elf") 35 _output_boot_file = rebase_path("$root_out_dir/bin/bootloader.bin") 36 _input_app_file = rebase_path("$root_out_dir/OHOS_Image") 37 _output_app_file = rebase_path("$root_out_dir/OHOS_Image.bin") 38 command = "esptool.py --chip ${CONFIG_IDF_TARGET} elf2image --flash_mode ${CONFIG_ESPTOOLPY_FLASHMODE} --flash_freq ${CONFIG_ESPTOOLPY_FLASHFREQ} --flash_size ${CONFIG_ESPTOOLPY_FLASHSIZE} --min-rev 0 --elf-sha256-offset 0xb0 -o ${_output_app_file} ${_input_app_file} && " 39 command += "esptool.py --chip ${CONFIG_IDF_TARGET} elf2image --flash_mode ${CONFIG_ESPTOOLPY_FLASHMODE} --flash_freq ${CONFIG_ESPTOOLPY_FLASHFREQ} --flash_size ${CONFIG_ESPTOOLPY_FLASHSIZE} -o ${_output_boot_file} ${_input_boot_file}" 40 deps = [ 41 "//build/lite:ohos", 42 "//kernel/liteos_m:build_kernel_image", 43 ] 44} 45 46build_ext_component("copy_bin") { 47 exec_path = rebase_path(".", root_build_dir) 48 _output_dir = rebase_path("$root_out_dir") 49 command = "mkdir -p ${_output_dir}/bin && cp ${_output_dir}/OHOS_Image.bin ${_output_dir}/bin/" 50 deps = [ 51 ":elf2bin", 52 "//build/lite:ohos", 53 "//kernel/liteos_m:build_kernel_image", 54 ] 55} 56