-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootimg.h
More file actions
45 lines (35 loc) · 1.1 KB
/
bootimg.h
File metadata and controls
45 lines (35 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once
#include "utils.hpp"
struct BootImageInfo {
std::string boot_magic;
uint32_t header_version = 0;
// Common fields
uint32_t kernel_size = 0;
uint32_t ramdisk_size = 0;
uint32_t page_size = 4096;
std::string os_version;
std::string os_patch_level;
std::string cmdline;
// Version <3 fields
uint32_t kernel_load_address = 0;
uint32_t ramdisk_load_address = 0;
uint32_t second_size = 0;
uint32_t second_load_address = 0;
uint32_t tags_load_address = 0;
std::string product_name;
std::string extra_cmdline;
// Version 1-2 fields
uint32_t recovery_dtbo_size = 0;
uint64_t recovery_dtbo_offset = 0;
uint32_t boot_header_size = 0;
// Version 2 fields
uint32_t dtb_size = 0;
uint64_t dtb_load_address = 0;
// Version 4+ fields
uint32_t boot_signature_size = 0;
std::filesystem::path image_dir;
};
BootImageInfo UnpackBootImage(std::ifstream &input,
const std::filesystem::path &output_dir);
std::string FormatPrettyText(const BootImageInfo &info);
std::vector<std::string> FormatMkbootimgArguments(const BootImageInfo &info);