def gen_bct(bootloader, bct): bct_config = generated() + "bct.cfg" #./bct_dump ./ac100.bct.orig > bct.cfg res = execute(bct_dump() + " " + bct + " > " + bct_config) if res != 0: return res, None # Add bootloader at the end of bct.cfg res = execute("echo 'BootLoader = " + bootloader + ",0x00108000,0x00108000,Complete;' >> " + bct_config) if res != 0: return res, None new_bct = generated() + "ac100.bct" #./cbootimage -d ./bct.cfg ac100.bct.new res = execute(cbootimage() + " -d " + bct_config + " " + new_bct) if res != 0: return res, None res = execute("truncate " + new_bct + " -s 4080") if res != 0: return res, None return 0, new_bct
def init_externals(): if not os.path.isdir(generated()): os.makedirs(generated()) if os.path.isfile(bct_dump()) and \ os.path.isfile(cbootimage()) and \ os.path.isfile(externals() + "nvflash/nvflash") and \ os.path.isfile(externals() + "gpt_surgeon.py") and \ os.path.isfile(externals() + "uboot-sos.img"): return None print "Initialize externals..." res = execute("./init-externals.sh \"%s\"" % log_file()) if res != 0: print "Failed with code %d.\nLog file is ./generated/init.log" % res quit() print