Skip to content

Commit

Permalink
add Huawei Bootloader packed image format (#459)
Browse files Browse the repository at this point in the history
* add Huawei Bootloader packed image format

* huawei boot image: introduce version type, rewrite entries

* android_img_huawei: rename to `android_bootldr_huawei`

... per the same naming convention as used for
#471

* android_bootldr_huawei: shorten commit hash

* android_bootldr_huawei: fix format description, link to samples

* android_bootldr_huawei: fix indentation

* android_bootldr_huawei: take `meta_hdr_sz` into account, rename headers

* android_bootldr_huawei: make `image_version` a string, ASCII enc

* android_bootldr_huawei: parse `body` in `image_hdr_entry`, rename fields

* android_bootldr_huawei: add info where all factory images are

Co-authored-by: Petr Pucil <[email protected]>
  • Loading branch information
armijnhemel and generalmimon authored Sep 2, 2021
1 parent 4c4bfc0 commit a4d5436
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions archive/android_bootldr_huawei.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
meta:
id: android_bootldr_huawei
title: Huawei Bootloader packed image format
file-extension: img
tags:
- archive
- android
license: CC0-1.0
# The `releasetools.py` script is written for Python 2, where the default
# encoding is ASCII.
encoding: ASCII
endian: le
doc: |
Format of `bootloader-*.img` files found in factory images of certain Android devices from Huawei:
* Nexus 6P "angler": [sample][sample-angler] ([other samples][others-angler]),
[releasetools.py](https://android.googlesource.com/device/huawei/angler/+/cf92cd8/releasetools.py#29)
[sample-angler]: https://androidfilehost.com/?fid=11410963190603870158 "bootloader-angler-angler-03.84.img"
[others-angler]: https://androidfilehost.com/?w=search&s=bootloader-angler&type=files
All image versions can be found in factory images at
<https://developers.google.com/android/images> for the specific device. To
avoid having to download an entire ZIP archive when you only need one file
from it, install [remotezip](https://github.com/gtsystem/python-remotezip) and
use its [command line
tool](https://github.com/gtsystem/python-remotezip#command-line-tool) to list
members in the archive and then to download only the file you want.
doc-ref: https://android.googlesource.com/device/huawei/angler/+/673cfb9/releasetools.py
seq:
- id: meta_header
type: meta_hdr
- id: header_ext
size: meta_header.len_meta_header - meta_header._sizeof
- id: image_header
size: meta_header.len_image_header
type: image_hdr
types:
meta_hdr:
seq:
- id: magic
contents: [0x3c, 0xd6, 0x1a, 0xce]
- id: version
type: version
- id: image_version
size: 64
type: strz
- id: len_meta_header
-orig-id: meta_hdr_sz
type: u2
- id: len_image_header
-orig-id: img_hdr_sz
type: u2
version:
seq:
- id: major
type: u2
- id: minor
type: u2
image_hdr:
seq:
- id: entries
type: image_hdr_entry
repeat: eos
image_hdr_entry:
-webide-representation: '{name} - o:{ofs_body}, s:{len_body}'
seq:
- id: name
size: 72
type: strz
doc: partition name
- id: ofs_body
type: u4
- id: len_body
type: u4
instances:
body:
io: _root._io
pos: ofs_body
size: len_body

0 comments on commit a4d5436

Please sign in to comment.