Headers doesn't always occupy 1 page
This commit is contained in:
parent
0632b146b8
commit
02ea3ca525
@ -294,7 +294,7 @@ void boot_img::parse_image(uint8_t *addr, format_t type) {
|
|||||||
|
|
||||||
hdr->print();
|
hdr->print();
|
||||||
|
|
||||||
size_t off = hdr->page_size();
|
size_t off = hdr->hdr_space();
|
||||||
hdr_addr = addr;
|
hdr_addr = addr;
|
||||||
get_block(kernel);
|
get_block(kernel);
|
||||||
get_block(ramdisk);
|
get_block(ramdisk);
|
||||||
@ -474,9 +474,9 @@ void repack(const char* src_img, const char* out_img, bool skip_comp) {
|
|||||||
restore_buf(fd, boot.map_addr, ACCLAIM_PRE_HEADER_SZ);
|
restore_buf(fd, boot.map_addr, ACCLAIM_PRE_HEADER_SZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy a page for header
|
// Copy header
|
||||||
off.header = lseek(fd, 0, SEEK_CUR);
|
off.header = lseek(fd, 0, SEEK_CUR);
|
||||||
restore_buf(fd, boot.hdr_addr, boot.hdr->page_size());
|
restore_buf(fd, boot.hdr_addr, boot.hdr->hdr_space());
|
||||||
|
|
||||||
// kernel
|
// kernel
|
||||||
off.kernel = lseek(fd, 0, SEEK_CUR);
|
off.kernel = lseek(fd, 0, SEEK_CUR);
|
||||||
|
@ -243,6 +243,7 @@ struct dyn_img_hdr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual size_t hdr_size() = 0;
|
virtual size_t hdr_size() = 0;
|
||||||
|
virtual size_t hdr_space() { return page_size(); }
|
||||||
|
|
||||||
const void *raw_hdr() const { return raw; }
|
const void *raw_hdr() const { return raw; }
|
||||||
void print();
|
void print();
|
||||||
@ -367,6 +368,8 @@ struct dyn_img_vnd_v3 : public dyn_img_hdr {
|
|||||||
impl_val(header_size)
|
impl_val(header_size)
|
||||||
impl_val(dtb_size)
|
impl_val(dtb_size)
|
||||||
|
|
||||||
|
size_t hdr_space() override { auto sz = page_size(); return do_align(hdr_size(), sz); }
|
||||||
|
|
||||||
// Make API compatible
|
// Make API compatible
|
||||||
char *extra_cmdline() override { return &vnd->cmdline[BOOT_ARGS_SIZE]; }
|
char *extra_cmdline() override { return &vnd->cmdline[BOOT_ARGS_SIZE]; }
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user