common:packkernelimg: Add support for appending selected dtb's

We now support the appending of only a subset of the dtb's present
in the dt directory. We do this based on a optional flag containing
a list of blobs we actually want to append.

Change-Id: I5b18e0d8d718b6ac463385d6321160390cfb863d
This commit is contained in:
Ameya Thakur 2016-06-30 18:59:32 -07:00
parent ae0d9758f3
commit 3e93ae608a
1 changed files with 6 additions and 0 deletions

View File

@ -37,6 +37,7 @@ def parse_cmdline():
parser = ArgumentParser() parser = ArgumentParser()
parser.add_argument('--kernel', help='Path to UNCOMPRESSED kernel image',required=True) parser.add_argument('--kernel', help='Path to UNCOMPRESSED kernel image',required=True)
parser.add_argument('--dt', help='Path to device tree files', required=True) parser.add_argument('--dt', help='Path to device tree files', required=True)
parser.add_argument('--dt_list', help='List of device tree files to pick up', required=False)
return parser.parse_args() return parser.parse_args()
def main(): def main():
@ -44,6 +45,8 @@ def main():
KERNEL_TYPE = 'UNCOMPRESSED_IMG'.encode() KERNEL_TYPE = 'UNCOMPRESSED_IMG'.encode()
kernel = open(args.kernel, 'rb') kernel = open(args.kernel, 'rb')
str = kernel.readline() str = kernel.readline()
if args.dt_list is not None:
dtb_list = args.dt_list.split()
if str.startswith('UNCOMPRESSED_IMG'): if str.startswith('UNCOMPRESSED_IMG'):
print("File already patched") print("File already patched")
exit(0) exit(0)
@ -58,6 +61,9 @@ def main():
for root, directories, files in os.walk(args.dt): for root, directories, files in os.walk(args.dt):
for filename in files: for filename in files:
if filename.endswith('.dtb'): if filename.endswith('.dtb'):
if args.dt_list is not None:
if filename not in dtb_list:
continue
print("Processing file %s" % filename) print("Processing file %s" % filename)
filepath = os.path.join(root, filename) filepath = os.path.join(root, filename)
with open(filepath) as dtb_file: with open(filepath) as dtb_file: