diff --git a/ohos/images/mkimage/mkcpioimage.py b/ohos/images/mkimage/mkcpioimage.py index 6d0f293f4cd7762a564a9136f3e56d01dbab9851..43091e2c6ced28914e52700f0ffce0a340e4b111 100755 --- a/ohos/images/mkimage/mkcpioimage.py +++ b/ohos/images/mkimage/mkcpioimage.py @@ -67,16 +67,21 @@ def build_run_fitimage(args): index = src_dir.rfind('/') root_dir = src_dir[:index] - if not os.path.exists("./ohos.its"): - print("error there is no configuration file") - return -1 - if not os.path.exists(os.path.join(root_dir, "images", "zImage-dtb")): - print("error there is no kernel image") - return -1 + if BOOT_TYPE == "two_stages": + fit_cmd = \ + [os.path.join(root_dir, "make-boot.sh"), + os.path.join(root_dir, "../../..")] + else: + if not os.path.exists("./ohos.its"): + print("error there is no configuration file") + return -1 + if not os.path.exists(os.path.join(root_dir, "images", "zImage-dtb")): + print("error there is no kernel image") + return -1 - fit_cmd = \ - ["mkimage", '-f', "./ohos.its", - os.path.join(root_dir, "images", "boot.img")] + fit_cmd = \ + ["mkimage", '-f', "./ohos.its", + os.path.join(root_dir, "images", "boot.img")] res = run_cmd(fit_cmd) if res[1] != 0: @@ -107,6 +112,9 @@ def build_run_chmod(args): src_index = src_dir.rfind('/') root_dir = src_dir[:src_index] + if BOOT_TYPE == "two_stages": + return 0 + chmod_cmd = ['chmod', '664', os.path.join(root_dir, "images", "boot.img")] res = run_cmd(chmod_cmd) if res[1] != 0: @@ -123,6 +131,8 @@ def parse_resource_config(resource_config_file_path): """ dtc_419_source_path = "" dtc_510_source_path = "" + global BOOT_TYPE + BOOT_TYPE = "" need_clear_section_target_path_list = [] if os.path.exists(resource_config_file_path): ramdisk_config = configparser.ConfigParser() @@ -140,6 +150,8 @@ def parse_resource_config(resource_config_file_path): need_clear_section_target_path_list.append(target_path) if each_section[0] == DTC_419: dtc_419_source_path = source_path + if each_section[0] == "board": + BOOT_TYPE = section_options.get("boot_type", None) if each_section[0] == DTC_510: dtc_510_source_path = source_path if os.path.exists(source_path):