How to modify the kernel.img

emuelec 4.3

gzip  -d unmkbootimg.gz
chmod a+x unmkbootimg
./unmkbootimg kernel.img  

after unmkbootimg the kernel.img, I will get these files:

initramfs.cpio.gz  zImage

then I edit the ramdisk:

mkdir initramfs
cd initramfs
cpio -idmv < ../initramfs.cpio.gz

## do some change  ###########

find . | cpio --create --format='newc' > ../initramfs.cpio.gz
cd ..

and create the new kernel.img

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x0 -o kernel.img

Using the modified kernel.img will not boot, and how the content of kernel.img.md5 is generated

round 2:
I use these content Search · ANDROID_BOOTIMG_OPTIONS · GitHub

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz \
  --base 0x0 --kernel_offset 0x1080000 -o kernel.img

could boot, but will had a kernel-overlay error

Now it can be started, kernel.img.md5 and the problem of this boot error, can anyone answer me?

To be honest, I can’t see any useful info to diagnose the problem. The screenshot only says “Main process exited”, no further info available. I don’t think any one can give you useful suggestions.
I would compile EmuELEC from source code if I were you.

Did you know how the content of kernel.img.md5 is generated

kernel.img.md5 is just the md5 sum of the kernel.img file if I’m not mistaken, and in linux can be generated using in linux:

md5sum FILE.img

how come your modifying the kernel though? The best way would be to change the linux source then re-compile it.

The problem is that you violate the permissions of the content of that cpio archive

If you run cpio directly, no fakeroot, then the packed files will have your user as the owner
Use fakeroot to invoke cpio so the content of the initramfs will have 0:0 as owner
Also, the dev file dev/console should be created with correct major:minor pair