def backup(): return execute('sudo "%s" -r --rawdeviceread 0 1536 ac100-2.img \ --rawdeviceread 1536 256 ac100-3.img \ --rawdeviceread 1792 1024 ac100-4.img \ --rawdeviceread 2816 2560 ac100-5.img \ --rawdeviceread 5376 4096 ac100-6.img \ --rawdeviceread 9984 153600 ac100-8.img \ --rawdeviceread 163584 204800 ac100-9.img \ --rawdeviceread 368384 1024 ac100-10.img \ --rawdeviceread 369664 632320 ac100-12.img \ --sync' % nvflash())
def restore(): mbr = '' em1 = '' em2 = '' return execute('sudo "%s" -r --rawdevicewrite 0 1536 ac100-2.img \ --rawdevicewrite 1536 256 ac100-3.img \ --rawdevicewrite 1792 1024 ac100-4.img \ --rawdevicewrite 2816 2560 ac100-5.img \ --rawdevicewrite 5376 4096 ac100-6.img \ --rawdevicewrite 9472 512 "%s" \ --rawdevicewrite 477184 256 "%s" \ --rawdevicewrite 2526464 256 "%s" \ --sync' % (nvflash(), mbr, em2, em1))
def get_raw_data(start, size, file): return execute('sudo "%s" -r --rawdeviceread %d %d "%s" --sync' % (nvflash(), start, size, file))
def push_part(id, file): return execute('sudo "%s" -r --download %d "%s" --sync' % (nvflash(), id, file))
def repart(bct, config): return execute('sudo "%s" --bct "%s" --setbct \ --bl "%s" \ --configfile "%s" \ --create \ --sync' % (nvflash(), bct, fastboot(), config))
def backup_partitiontable(partitiontable = 'backup_part_table-`date +%F_%T`.txt'): return execute('sudo "%s" -r --getpartitiontable "%s" --sync' % (nvflash(), partitiontable))
def init(bootloader = fastboot()): return execute('sudo "%s" --bl "%s" --sync' % (nvflash(), bootloader))