if platform_name == "bxtp_abl": image_platform = "image_m_bxt" if platform_name == "gordon_peak": ram_value = fastboot_utils.get_bxt_ram(serial=serial) if ram_value == "2g": image_platform = "image_o_bxt_2g" if ram_value == "4g": image_platform = "image_o_bxt_4g" if ram_value == "8g": image_platform = "image_o_bxt_4g" vendor_corrupted_block_path = config.get(image_platform, "vendor_corrupted_block") vendor_corrupted_block_name = vendor_corrupted_block_path.split("/")[-1] fastboot_utils.download_file( url=fastboot_path + vendor_corrupted_block_path, local_filename="./temp/image/n/img/" + vendor_corrupted_block_name) adb_steps.reboot(command="fastboot", reboot_timeout=300, serial=serial)() fastboot_steps.flash_image(partition_name="vendor", file_name="./temp/image/n/img/" + vendor_corrupted_block_name, lock_dut=True, serial=serial)() fastboot_steps.continue_to_adb(serial=serial)() time.sleep(60) local_steps.wait_for_adb(timeout=300, serial=serial)() fastboot_utils.flash_bxt(zip_file=flash_files, serial=serial) os.system("sudo rm -rf ./temp") except: fastboot_utils.flash_bxt(zip_file=flash_files, serial=serial) os.system("sudo rm -rf ./temp") raise ##### test end #####
if platform_name == "gordon_peak": ram_value = fastboot_utils.get_bxt_ram(serial=serial) if ram_value == "2g": image_platform = "image_o_bxt_2g" if ram_value == "4g": image_platform = "image_o_bxt_4g" if ram_value == "8g": image_platform = "image_o_bxt_4g" system_corrupted_verity_path = config.get(image_platform, "system_corrupted_verity") system_corrupted_verity_name = system_corrupted_verity_path.split("/")[-1] fastboot_utils.download_file( url=fastboot_path + system_corrupted_verity_path, local_filename="./temp/image/n/img/" + system_corrupted_verity_name) adb_steps.reboot(command="fastboot", reboot_timeout=300, serial=serial)() fastboot_steps.flash_image(partition_name="system", file_name="./temp/image/n/img/" + system_corrupted_verity_name, lock_dut=True, serial=serial)() check_point1 = False check_point2 = False fastboot_utils.start_minicom(serial=serial) os.system("fastboot reboot > /dev/null 2>&1") time.sleep(60) fastboot_utils.to_fastboot_by_script(serial=serial) fastboot_utils.kill_minicom() file_path = "./temp/files/minicom_result.txt"
vbmeta_corrupted_system_metadata_path = config.get( image_platform, "vbmeta_corrupted_system_metadata") vbmeta_corrupted_system_metadata_name = vbmeta_corrupted_system_metadata_path.split( "/")[-1] fastboot_utils.download_file(url=fastboot_path + vbmeta_corrupted_system_metadata_path, local_filename="./temp/image/n/img/" + vbmeta_corrupted_system_metadata_name) adb_steps.reboot(command="fastboot", reboot_timeout=300, serial=serial)() fastboot_steps.fastboot_erase_partition(partition_name="vbmeta", reboot=False, serial=serial)() fastboot_steps.flash_image(partition_name="vbmeta", file_name="./temp/image/n/img/" + vbmeta_corrupted_system_metadata_name, lock_dut=True, serial=serial)() check_point1 = False check_point2 = False fastboot_utils.start_minicom(serial=serial) os.system("fastboot reboot > /dev/null 2>&1") time.sleep(60) fastboot_utils.to_fastboot_by_script(serial=serial) fastboot_utils.kill_minicom() file_path = "./temp/files/minicom_result.txt"
if zip_name == "r0_bxtp_abl": fastboot_utils.flash_bxt_m_fused( eb_user_patch_flashfiles_zip_name= eb_user_patch_flashfiles_zip_name, eb_userdebug_patch_flashfiles_zip_name= eb_userdebug_patch_flashfiles_zip_name, support_flash=True, serial=serial) adb_steps.reboot(command="fastboot", reboot_timeout=300, serial=serial)() fastboot_steps.fastboot_erase_partition(partition_name="boot", reboot=False, serial=serial)() fastboot_steps.flash_image(partition_name="boot", file_name="./temp/image/eb/img/" + eb_img_user_signed_corrupted_boot_name, lock_dut=True, serial=serial)() fastboot_utils.flash_bxt(flash_ioc="False", flash_ifwi="True", flash_android="False", zip_file="./temp/image/eb/user/" + eb_user_patch_flashfiles_zip_name, serial=serial, sleep_time=30, wait_for_adb=False) fastboot_utils.to_fastboot_by_script(serial=serial) time.sleep(30) local_steps.wait_for_fastboot(timeout=300, serial=serial)()
config.read("./temp/fastboot.conf") fastboot_path = config.get("fastboot", "path") platform_name = fastboot_utils.get_platform_name(serial=serial) if platform_name == "bxtp_abl": image_platform = "image_m_bxt" if platform_name == "gordon_peak": ram_value = fastboot_utils.get_bxt_ram(serial=serial) if ram_value == "2g": image_platform = "image_o_bxt_2g" if ram_value == "4g": image_platform = "image_o_bxt_4g" if ram_value == "8g": image_platform = "image_o_bxt_4g" n_1_flashfiles_zip_path = config.get(image_platform, "n_1_flashfiles_zip") n_1_flashfiles_zip_name = n_1_flashfiles_zip_path.split("/")[-1] fastboot_utils.download_file(url = fastboot_path + n_1_flashfiles_zip_path, local_filename = "./temp/image/n-1/" + n_1_flashfiles_zip_name) fastboot_utils.flash_bxt(zip_file="./temp/image/n-1/"+n_1_flashfiles_zip_name, serial=serial) fastboot_utils.unpack_the_zip(file_name = flash_files, temp_path = r"./temp/image/n/flashfiles") adb_steps.reboot(command = "fastboot", reboot_timeout = 300, serial = serial)() fastboot_steps.flash_image(partition_name = partition_name, file_name = "./temp/image/n/flashfiles/"+file_name, serial = serial)() fastboot_steps.continue_to_adb(serial=serial)() time.sleep(60) local_steps.wait_for_adb(timeout = 300, serial=serial)() fastboot_utils.flash_bxt(zip_file=flash_files, serial=serial) os.system("sudo rm -rf ./temp") except: fastboot_utils.flash_bxt(zip_file=flash_files, serial=serial) os.system("sudo rm -rf ./temp") raise ##### test end #####
if ram_value == "4g": image_platform = "image_o_bxt_4g" if ram_value == "8g": image_platform = "image_o_bxt_4g" user_signed_corrupted_boot_path = config.get(image_platform, "user_signed_corrupted_boot") user_signed_corrupted_boot_name = user_signed_corrupted_boot_path.split( "/")[-1] fastboot_utils.download_file( url=fastboot_path + user_signed_corrupted_boot_path, local_filename="./temp/image/n/img/" + user_signed_corrupted_boot_name) adb_steps.reboot(command="fastboot", reboot_timeout=300, serial=serial)() fastboot_steps.fastboot_erase_partition(partition_name="boot", reboot=False, serial=serial)() fastboot_steps.flash_image(partition_name="boot", file_name="./temp/image/n/img/" + user_signed_corrupted_boot_name, serial=serial)() fastboot_steps.format_partition(partition_name="data", lock_dut=True, serial=serial)() check_point1 = False fastboot_utils.start_minicom(serial=serial) os.system("fastboot reboot > /dev/null 2>&1") time.sleep(60) fastboot_utils.to_fastboot_by_script(serial=serial) fastboot_utils.kill_minicom()
temp_path=r"./temp/image/n/flashfiles") fastboot_utils.flash_bxt(flash_ioc="True", flash_ifwi="True", flash_android="False", zip_file=flash_files, serial=serial, sleep_time=30, wait_for_adb=False) fastboot_utils.to_fastboot_by_script(serial=serial) local_steps.wait_for_fastboot(timeout=300, serial=serial)() img_path = "./temp/image/n/flashfiles/" fastboot_steps.flash_image(partition_name="gpt", file_name=img_path + "gpt_gr_mrb_b1.bin", unlock_dut=True, lock_dut=False, serial=serial)() fastboot_steps.fastboot_erase_partition(partition_name="teedata", unlock_dut=False, lock_dut=False, reboot=False, serial=serial)() fastboot_steps.fastboot_erase_partition(partition_name="misc", unlock_dut=False, lock_dut=False, reboot=False, serial=serial)() fastboot_steps.fastboot_erase_partition(partition_name="persistent", unlock_dut=False, lock_dut=False,
eb_userdebug_patch_flashfiles_zip_name = eb_userdebug_patch_flashfiles_zip_path.split("/")[-1] fastboot_utils.download_file(url=fastboot_path+eb_userdebug_patch_flashfiles_zip_path, local_filename="./temp/image/eb/userdebug/"+eb_userdebug_patch_flashfiles_zip_name) eb_img_multiboot_corrupted_c_path = config.get(image_platform, eb_img_multiboot_corrupted_c) eb_img_multiboot_corrupted_c_name = eb_img_multiboot_corrupted_c_path.split("/")[-1] fastboot_utils.download_file(url=fastboot_path+eb_img_multiboot_corrupted_c_path, local_filename="./temp/image/eb/img/"+eb_img_multiboot_corrupted_c_name) if platform_name == "bxtp_abl": fastboot_utils.flash_bxt_m_fused(eb_user_patch_flashfiles_zip_name=eb_user_patch_flashfiles_zip_name, eb_userdebug_patch_flashfiles_zip_name=eb_userdebug_patch_flashfiles_zip_name, support_flash=True, serial=serial) if platform_name == "gordon_peak": zip_name = fastboot_utils.get_zip_name(zip_path=flash_files) if zip_name == "r0_bxtp_abl": fastboot_utils.flash_bxt_m_fused(eb_user_patch_flashfiles_zip_name=eb_user_patch_flashfiles_zip_name, eb_userdebug_patch_flashfiles_zip_name=eb_userdebug_patch_flashfiles_zip_name, support_flash=True, serial=serial) if zip_name == "gordon_peak": fastboot_utils.flash_bxt(zip_file="./temp/image/eb/userdebug/"+eb_userdebug_patch_flashfiles_zip_name, serial=serial) adb_steps.reboot(command="fastboot", reboot_timeout=300, serial=serial)() fastboot_steps.fastboot_erase_partition(partition_name="multiboot", reboot=False, serial=serial)() fastboot_steps.flash_image(partition_name="multiboot", file_name="./temp/image/eb/img"+eb_img_multiboot_corrupted_c_name, lock_dut=True, serial=serial)() os.system("fastboot reboot > /dev/null 2>&1") time.sleep(60) local_steps.wait_for_fastboot(timeout = 300, serial = serial)() fastboot_utils.flash_bxt(zip_file=flash_files, serial=serial) os.system("sudo rm -rf ./temp") except: fastboot_utils.flash_bxt(zip_file=flash_files, serial=serial) os.system("sudo rm -rf ./temp") raise ##### test end #####
local_filename="./temp/image/eb/testos/" + testos_img_name) fastboot_utils.make_the_zip(dir_name="./temp/image/eb/testos/", file_name="./temp/image/eb/flashfiles.zip") fastboot_utils.flash_bxt(flash_ioc="False", flash_ifwi="True", flash_android="False", zip_file="./temp/image/eb/flashfiles.zip", serial=serial, sleep_time=60, wait_for_adb=False) fastboot_utils.to_fastboot_by_script(serial=serial) local_steps.wait_for_fastboot(timeout=300, serial=serial)() fastboot_steps.flash_image(partition_name="boot", file_name="./temp/image/eb/testos/" + testos_img_name, serial=serial)() fastboot_steps.continue_to_adb(serial=serial)() time.sleep(60) local_steps.wait_for_adb(timeout=300, serial=serial)() return_result = fastboot_utils.adb_command_process_exists(serial=serial) if return_result: raise Exception("The test result did not achieve the desired results") fastboot_utils.flash_bxt(zip_file=flash_files, serial=serial) os.system("sudo rm -rf ./temp") except: fastboot_utils.flash_bxt(zip_file=flash_files, serial=serial) os.system("sudo rm -rf ./temp")
fastboot_utils.download_file(url=fastboot_path + vbmeta_v1_path, local_filename="./temp/image/n/img/" + vbmeta_v1_name) vbmeta_v2_path = config.get(image_platform, "vbmeta_v2") vbmeta_v2_name = vbmeta_v2_path.split("/")[-1] fastboot_utils.download_file(url=fastboot_path + vbmeta_v2_path, local_filename="./temp/image/n/img/" + vbmeta_v2_name) adb_steps.reboot(command="fastboot", reboot_timeout=300, serial=serial)() fastboot_steps.fastboot_erase_partition(partition_name="vbmeta", reboot=False, serial=serial)() fastboot_steps.flash_image(partition_name="vbmeta", file_name="./temp/image/n/img/" + vbmeta_v2_name, lock_dut=True, serial=serial)() fastboot_steps.continue_to_adb(serial=serial)() time.sleep(60) local_steps.wait_for_adb(timeout=300, serial=serial)() adb_steps.reboot(command="fastboot", reboot_timeout=300, serial=serial)() fastboot_steps.fastboot_erase_partition(partition_name="vbmeta", reboot=False, serial=serial)() fastboot_steps.flash_image(partition_name="vbmeta", file_name="./temp/image/n/img/" + vbmeta_v1_name, lock_dut=True, serial=serial)()