rockchip: update make_idb.py
make_idb.py only support RK3288 before, add chip parameter, so we can support RK3399 either. Change-Id: I6811acb7f0cdaf1930af9942a70db54765d544d5 Signed-off-by: huang lin <hl@rock-chips.com> Reviewed-on: https://review.coreboot.org/13913 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
parent
1a1515b949
commit
1129f7f636
|
@ -74,6 +74,6 @@ CPPFLAGS_common += -Isrc/soc/rockchip/rk3288/include/
|
||||||
$(objcbfs)/bootblock.bin: $(objcbfs)/bootblock.raw.bin
|
$(objcbfs)/bootblock.bin: $(objcbfs)/bootblock.raw.bin
|
||||||
@printf "Generating: $(subst $(obj)/,,$(@))\n"
|
@printf "Generating: $(subst $(obj)/,,$(@))\n"
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
@$(IDBTOOL) --from=$< --to=$@ --enable-align
|
@$(IDBTOOL) --from=$< --to=$@ --enable-align --chip=RK32
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -29,7 +29,7 @@ class IDBTool:
|
||||||
k = (S[i] + S[j]) % 256
|
k = (S[i] + S[j]) % 256
|
||||||
buf[x] = struct.pack('B', ord(buf[x]) ^ S[k])
|
buf[x] = struct.pack('B', ord(buf[x]) ^ S[k])
|
||||||
|
|
||||||
def makeIDB(self, from_file, to_file, rc4_flag = False, align_flag = False):
|
def makeIDB(self, chip, from_file, to_file, rc4_flag = False, align_flag = False):
|
||||||
try:
|
try:
|
||||||
fin = open(from_file, 'rb')
|
fin = open(from_file, 'rb')
|
||||||
except:
|
except:
|
||||||
|
@ -52,7 +52,7 @@ class IDBTool:
|
||||||
sectors = pages * PAGE_ALIGN;
|
sectors = pages * PAGE_ALIGN;
|
||||||
|
|
||||||
buf = [B'\0'] * sectors * SECTOR_SIZE
|
buf = [B'\0'] * sectors * SECTOR_SIZE
|
||||||
buf[:4] = "RK32"
|
buf[:4] = chip
|
||||||
buf[4 : 4+data_len] = data
|
buf[4 : 4+data_len] = data
|
||||||
|
|
||||||
idblock = [B'\0'] * 4 * SECTOR_SIZE
|
idblock = [B'\0'] * 4 * SECTOR_SIZE
|
||||||
|
@ -95,11 +95,13 @@ class IDBTool:
|
||||||
print "DONE"
|
print "DONE"
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print "Usage: make_idb.py [--enable-rc4] [--enable-align] [--to=out] --from=in"
|
print "Usage: make_idb.py [--chip=RKXX] [--enable-rc4] [--enable-align] [--to=out] --from=in"
|
||||||
|
print " --chip: default is RK32"
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
rc4_flag = align_flag = False
|
rc4_flag = align_flag = False
|
||||||
to_file = "IDBlock.bin"
|
to_file = "IDBlock.bin"
|
||||||
|
chip = "RK32"
|
||||||
|
|
||||||
for para in sys.argv[1:]:
|
for para in sys.argv[1:]:
|
||||||
if (para == "--enable-rc4"):
|
if (para == "--enable-rc4"):
|
||||||
|
@ -110,6 +112,8 @@ if __name__ == '__main__':
|
||||||
to_file = para.split('=')[1]
|
to_file = para.split('=')[1]
|
||||||
elif (para.startswith("--from=")):
|
elif (para.startswith("--from=")):
|
||||||
from_file = para.split('=')[1]
|
from_file = para.split('=')[1]
|
||||||
|
elif (para.startswith("--chip=")):
|
||||||
|
chip = para.split('=')[1]
|
||||||
elif (para == "--help" or para == "-h"):
|
elif (para == "--help" or para == "-h"):
|
||||||
usage()
|
usage()
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
@ -121,4 +125,4 @@ if __name__ == '__main__':
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
idbtool = IDBTool()
|
idbtool = IDBTool()
|
||||||
idbtool.makeIDB(from_file, to_file, rc4_flag, align_flag)
|
idbtool.makeIDB(chip, from_file, to_file, rc4_flag, align_flag)
|
||||||
|
|
Loading…
Reference in New Issue