openwrt/target/linux/generic/files/drivers/mtd/mtdsplit
Sander Vanheule 3f7047db7a kernel: mtdsplit: support ELF loader splitting
To parse the ELF kernel loader, a small ELF parser is used that can
handle both ELF32 or ELF64 class loaders. The splitter assumes that the
kernel is always located before the rootfs, whether it is embedded in
the loader or not. If the kernel is located after the rootfs on the
firmware partition, then the rootfs splitter will include it in the
dynamically created rootfs_data partition and the kernel will be
corrupted.

The kernel image is preferably embedded inside the ELF loader, so the
end of the loader equals the end of the kernel partition. This is due to
the way mtd_find_rootfs_from searches for the the rootfs:
- if the kernel image is embedded in the loader, the appended rootfs may
  follow the loader immediately, within the same erase block.
- if the kernel image is not embedded in the loader, but placed at some
  offset behind the loader (OKLI-style loader), the rootfs must be
  aligned to an erase-block after the loader and kernel image.

In case section header table is empty, determine the elf loader size by
finding the end of the last segment, as defined by the program header
table.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
2020-09-09 20:41:50 +03:00
..
Kconfig kernel: mtdsplit: support ELF loader splitting 2020-09-09 20:41:50 +03:00
Makefile kernel: mtdsplit: support ELF loader splitting 2020-09-09 20:41:50 +03:00
mtdsplit_bcm_wfi.c kernel: mtdsplit: bcm_wfi: always add img partitions 2020-06-03 18:50:58 +02:00
mtdsplit_brnimage.c kernel: update mtdsplit for linux 4.9 2017-02-03 12:35:44 +01:00
mtdsplit_elf.c kernel: mtdsplit: support ELF loader splitting 2020-09-09 20:41:50 +03:00
mtdsplit_eva.c kernel: Add missing includes mtdsplit_*.c 2019-07-07 17:37:26 +02:00
mtdsplit_fit.c kernel: Fix off-by-one error in FIT mtd partition search. 2019-10-09 14:45:25 +02:00
mtdsplit_jimage.c kernel: Add missing includes mtdsplit_*.c 2019-07-07 17:37:26 +02:00
mtdsplit_lzma.c kernel: Add missing includes mtdsplit_*.c 2019-07-07 17:37:26 +02:00
mtdsplit_minor.c kernel: Add missing includes mtdsplit_*.c 2019-07-07 17:37:26 +02:00
mtdsplit_seama.c kernel: Add missing includes mtdsplit_*.c 2019-07-07 17:37:26 +02:00
mtdsplit_squashfs.c kernel: update mtdsplit for linux 4.9 2017-02-03 12:35:44 +01:00
mtdsplit_tplink.c kernel: Add missing includes mtdsplit_*.c 2019-07-07 17:37:26 +02:00
mtdsplit_trx.c kernel: Add missing includes mtdsplit_*.c 2019-07-07 17:37:26 +02:00
mtdsplit_uimage.c kernel: mtdsplit_uimage: add SGE parser 2020-07-13 22:45:04 +02:00
mtdsplit_wrgg.c kernel: Add missing includes mtdsplit_*.c 2019-07-07 17:37:26 +02:00
mtdsplit.c treewide: replace nbd@openwrt.org with nbd@nbd.name 2016-06-07 08:58:42 +02:00
mtdsplit.h treewide: replace nbd@openwrt.org with nbd@nbd.name 2016-06-07 08:58:42 +02:00