diff options
author | Thibaut VARÈNE <hacks@slashdirt.org> | 2017-10-27 20:12:15 +0200 |
---|---|---|
committer | Mathias Kresin <dev@kresin.me> | 2017-11-08 23:18:22 +0100 |
commit | 050fb3b55cde4348f4ed12ab98f451c4c56a695b (patch) | |
tree | f5abff515e7bd64a8fb18044c57a2de734790d56 /target | |
parent | dea3bad84ee89b151bedfd5947ee620384454a3c (diff) | |
download | mtk-20170518-050fb3b55cde4348f4ed12ab98f451c4c56a695b.zip mtk-20170518-050fb3b55cde4348f4ed12ab98f451c4c56a695b.tar.gz mtk-20170518-050fb3b55cde4348f4ed12ab98f451c4c56a695b.tar.bz2 |
tools/firmware-utils: mktplinkfw* fix rootfs offset
With '-a' specified on the command line, the current code:
- computes an aligned _kernel length_ instead of an aligned _rootfs
offset_.
- does not update the rootfs offset after computing the new kernel
length, and instead retains the layout default.
When the kernel length exceeds the available space left with this
fixed offset, the resulting image header contains invalid data, with
the recorded rootfs offset overlapping the kernel area.
This patch ensures that rootfs offset is correctly computed and
reflected in the final image.
Furthermore, the build_fw() function special cases the rootfs_align
option because of the above invalid logic. This is also fixed and
the computed (or command-line provided, or layout-provided) rootfs_ofs
value is used in all cases.
There seems to be no valid reason to extend the kernel length beyond
the actual length of the kernel itself (OFW images don't do it) so this
part of the existing behavior is dropped.
Example image before the patch:
Kernel data offset : 0x00000200 / 512 bytes
Kernel data length : 0x00158438 / 1410104 bytes
Kernel load address : 0x00000080
Kernel entry point : 0x00000080
Rootfs data offset : 0x00140000 / 1310720 bytes
Rootfs data length : 0x001e4f7e / 1986430 bytes
Example image after the patch:
Kernel data offset : 0x00000200 / 512 bytes
Kernel data length : 0x001583fe / 1410046 bytes
Kernel load address : 0x00000080
Kernel entry point : 0x00000080
Rootfs data offset : 0x00158600 / 1410560 bytes
Rootfs data length : 0x001e4e22 / 1986082 bytes
Tested-by: Mathias Kresin <dev@kresin.me>
Tested-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Tested-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
Tested-by: Henryk Heisig <hyniu@o2.pl>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
Diffstat (limited to 'target')
0 files changed, 0 insertions, 0 deletions