大型连续剧之拯救变砖黑莓KEY2之第五集—-重新分区

前景提要:之前用官方的autoloader刷入提示cache.img过大,所以还得重新处理分区问题

  于是我对照note3的rom重新构造了分区信息的几个xml文件,不过手工手工处理太麻烦了,于是我写了个python脚本来帮忙

def rebuild_raw_program0(filepath):
    raw_size_dict = {}
    tree = ET.parse(filepath)
    root = tree.getroot()

    start_sector = 40
    for child in root:
        filename = child.get('filename')
        filepath = IMG_PATH + filename
        label = child.get('label')
        size_in_kb = child.get('size_in_KB')
        raw_size_dict[label] = str(int(float(size_in_kb)))

        if len(filename) > 0 and os.path.exists(filepath):
            print(filename)
            file_size = os.path.getsize(filepath)
            print('filesize:' + str(file_size))

        num_partition_sectors = child.get('num_partition_sectors')
        pre_start_sector = start_sector
        start_sector = start_sector + int(num_partition_sectors)
        start_byte_hex = hex(int(start_sector / 2 * 1024))

        if not label.endswith('GPT'):
            child.set('start_byte_hex', str(start_byte_hex))
            child.set('start_sector', str(pre_start_sector))

        print(child.tag, child.attrib)

    tree.write('./files/rawprogram0.xml', encoding='utf-8', xml_declaration=True)

    return raw_size_dict

有了这个脚本我只要填好num_partition_sectors这个值然后重新生成rawprogram0.xml就行了,生成好之后我再次到edl模式下刷机,尽管我对比小米的cache.img文件大小相应扩大了三倍,但是刷入的时候还是提示空间不够,更严重的是刷完之后重启卡在了开机画面死活,无法进入9008模式,插入usb线就自动开机,这要是给维修手机的,估计判定为硬件故障了,回头检查一下刷机脚本,recovery和boot都还没刷入,做事不严谨遭重了。

fastboot %* flash system %~dp0images\system.img || @echo "Flash system error" && exit /B 1
fastboot %* flash cache %~dp0images\cache.img || @echo "Flash cache error" && exit /B 1
fastboot %* flash userdata %~dp0images\userdata.img || @echo "Flash userdata error" && exit /B 1
fastboot %* flash recovery %~dp0images\recovery.img || @echo "Flash recovery error" && exit /B 1
fastboot %* erase sec || @echo "Erase sec error" && exit /B 1
fastboot %* flash oem %~dp0images\oem.img || @echo "Flash cust error" && exit /B 1
fastboot %* flash boot %~dp0images\boot.img || @echo "Flash boot error" && exit /B 1
fastboot %* reboot || @echo "Reboot error" && exit /B 1

继续找解决办法!

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

 桂ICP备15001694号-3