mirror of
https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git
synced 2025-07-13 11:29:46 +03:00
pmb.parse.bootimg: Add preliminary support for header v2 (MR 2194)
This includes setting header_version="2" as well as dtb_offset according to the input boot.img when header v2 is detected. Also adds the following previously missed deviceinfo_attributes: * "header_version" * "bootimg_custom_args" And fixes failing tests now that header_version is always parsed from boot.img files.
This commit is contained in:
parent
c36e4a43ac
commit
255e69be5e
4 changed files with 21 additions and 8 deletions
|
@ -119,15 +119,15 @@ def bootimg(args, path):
|
|||
working_dir=temp_path)
|
||||
|
||||
output = {}
|
||||
header_version = None
|
||||
header_version = 0
|
||||
# Get base, offsets, pagesize, cmdline and qcdt info
|
||||
# This file does not exist for example for qcdt images
|
||||
if os.path.isfile(f"{bootimg_path}-header_version"):
|
||||
with open(f"{bootimg_path}-header_version", 'r') as f:
|
||||
header_version = int(f.read().replace('\n', ''))
|
||||
output["header_version"] = str(header_version)
|
||||
|
||||
if header_version is not None and header_version >= 3:
|
||||
output["header_version"] = str(header_version)
|
||||
if header_version >= 3:
|
||||
output["pagesize"] = "4096"
|
||||
else:
|
||||
with open(f"{bootimg_path}-base", 'r') as f:
|
||||
|
@ -147,6 +147,11 @@ def bootimg(args, path):
|
|||
with open(f"{bootimg_path}-pagesize", 'r') as f:
|
||||
output["pagesize"] = f.read().replace('\n', '')
|
||||
|
||||
if header_version == 2:
|
||||
with open(f"{bootimg_path}-dtb_offset", 'r') as f:
|
||||
output["dtb_offset"] = ("0x%08x"
|
||||
% int(f.read().replace('\n', ''), 16))
|
||||
|
||||
output["qcdt"] = ("true" if os.path.isfile(f"{bootimg_path}-dt") and
|
||||
os.path.getsize(f"{bootimg_path}-dt") > 0 else "false")
|
||||
output["mtk_mkimage"] = ("true" if check_mtk_bootimg(bootimg_path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue