• Home
  • Raw
  • Download

Lines Matching refs:args

55 def get_recovery_dtbo_offset(args):  argument
58 num_kernel_pages = get_number_of_pages(filesize(args.kernel), args.pagesize)
59 num_ramdisk_pages = get_number_of_pages(filesize(args.ramdisk), args.pagesize)
60 num_second_pages = get_number_of_pages(filesize(args.second), args.pagesize)
61 dtbo_offset = args.pagesize * (num_header_pages + num_kernel_pages +
66 def write_header_v3(args): argument
70 args.output.write(pack('8s', BOOT_MAGIC))
71 args.output.write(pack(
73 filesize(args.kernel), # kernel size in bytes
74 filesize(args.ramdisk), # ramdisk size in bytes
75 (args.os_version << 11) | args.os_patch_level, # os version and patch level
78 args.output.write(pack('4I', 0, 0, 0, 0)) # reserved
80 args.output.write(pack('I', args.header_version)) # version of bootimage header
81 args.output.write(pack('1536s', args.cmdline.encode()))
82 pad_file(args.output, BOOT_IMAGE_HEADER_V3_PAGESIZE)
84 def write_vendor_boot_header(args): argument
88 args.vendor_boot.write(pack('8s', BOOT_MAGIC))
89 args.vendor_boot.write(pack(
91 args.header_version, # version of header
92 args.pagesize, # flash page size we assume
93 args.base + args.kernel_offset, # kernel physical load addr
94 args.base + args.ramdisk_offset, # ramdisk physical load addr
95 filesize(args.vendor_ramdisk))) # vendor ramdisk size in bytes
96 args.vendor_boot.write(pack('2048s', args.vendor_cmdline.encode()))
97 args.vendor_boot.write(pack('I', args.base + args.tags_offset)) # physical addr for kernel tags
98 args.vendor_boot.write(pack('16s', args.board.encode())) # asciiz product name
99 args.vendor_boot.write(pack('I', VENDOR_BOOT_IMAGE_HEADER_V3_SIZE)) # header size in bytes
100 if filesize(args.dtb) == 0:
102 args.vendor_boot.write(pack('I', filesize(args.dtb))) # size in bytes
103 args.vendor_boot.write(pack('Q', args.base + args.dtb_offset)) # dtb physical load address
104 pad_file(args.vendor_boot, args.pagesize)
106 def write_header(args): argument
111 if args.header_version > 3:
112 raise ValueError('Boot header version %d not supported' % args.header_version)
113 elif args.header_version == 3:
114 return write_header_v3(args)
116 args.output.write(pack('8s', BOOT_MAGIC))
117 final_ramdisk_offset = (args.base + args.ramdisk_offset) if filesize(args.ramdisk) > 0 else 0
118 final_second_offset = (args.base + args.second_offset) if filesize(args.second) > 0 else 0
119 args.output.write(pack(
121 filesize(args.kernel), # size in bytes
122 args.base + args.kernel_offset, # physical load addr
123 filesize(args.ramdisk), # size in bytes
125 filesize(args.second), # size in bytes
127 args.base + args.tags_offset, # physical addr for kernel tags
128 args.pagesize, # flash page size we assume
129 args.header_version, # version of bootimage header
130 (args.os_version << 11) | args.os_patch_level)) # os version and patch level
131 args.output.write(pack('16s', args.board.encode())) # asciiz product name
132 args.output.write(pack('512s', args.cmdline[:512].encode()))
135 update_sha(sha, args.kernel)
136 update_sha(sha, args.ramdisk)
137 update_sha(sha, args.second)
139 if args.header_version > 0:
140 update_sha(sha, args.recovery_dtbo)
141 if args.header_version > 1:
142 update_sha(sha, args.dtb)
146 args.output.write(img_id)
147 args.output.write(pack('1024s', args.cmdline[512:].encode()))
149 if args.header_version > 0:
150 args.output.write(pack('I', filesize(args.recovery_dtbo))) # size in bytes
151 if args.recovery_dtbo:
152 args.output.write(pack('Q', get_recovery_dtbo_offset(args))) # recovery dtbo offset
154 args.output.write(pack('Q', 0)) # Will be set to 0 for devices without a recovery dtbo
157 if args.header_version == 1:
158 args.output.write(pack('I', BOOT_IMAGE_HEADER_V1_SIZE))
159 elif args.header_version == 2:
160 args.output.write(pack('I', BOOT_IMAGE_HEADER_V2_SIZE))
162 if args.header_version > 1:
167 args.output.write(pack('I', filesize(args.dtb))) # size in bytes
168 args.output.write(pack('Q', args.base + args.dtb_offset)) # dtb physical load address
169 pad_file(args.output, args.pagesize)
273 def write_data(args, pagesize): argument
274 write_padded_file(args.output, args.kernel, pagesize)
275 write_padded_file(args.output, args.ramdisk, pagesize)
276 write_padded_file(args.output, args.second, pagesize)
278 if args.header_version > 0 and args.header_version < 3:
279 write_padded_file(args.output, args.recovery_dtbo, pagesize)
280 if args.header_version == 2:
281 write_padded_file(args.output, args.dtb, pagesize)
284 def write_vendor_boot_data(args): argument
285 write_padded_file(args.vendor_boot, args.vendor_ramdisk, args.pagesize)
286 write_padded_file(args.vendor_boot, args.dtb, args.pagesize)
290 args = parse_cmdline()
291 if args.vendor_boot is not None:
292 if args.header_version < 3:
294 if args.vendor_ramdisk is None:
296 write_vendor_boot_header(args)
297 write_vendor_boot_data(args)
298 if args.output is not None:
299 if args.kernel is None:
301 if args.second is not None and args.header_version > 2:
303 img_id = write_header(args)
304 if args.header_version > 2:
305 write_data(args, BOOT_IMAGE_HEADER_V3_PAGESIZE)
307 write_data(args, args.pagesize)
308 if args.id and img_id is not None: