Is it possible to replace a non-code section inside an ELF file? If so, then how? Is there something I would have to consider before simply replacing the bytes by some other bytes (of course nothing larger)? Maybe some hash or similar?
Note that I'm not interested in modifying code, so the solutions presented in What are the available libraries to statically modify ELF executables? is not what I'm looking for, also many solutions there aren't architecture-agnostic.
(BTW, I would require this for a replacing the initrd/initramfs file system embedded into a kernel image [vmlinux.64
] which is also an ELF file, see https://unix.stackexchange.com/q/342298/117599. This question here is supposed to be more in general.)