Device does not boot to system after flashing boot image I unpacked the boot image from TWRP backup and repacked it without any modifications. but once i flash this image, it only boots to recovery - it fails to boot to android system.
I used the tools from https://github.com/pbatard/bootimg-tools and the following commands to extract and remake the boot image.

# to extract
unmkbootimg -i ../boot.emmc.win
mkdir ./extracted
cd ./extracted &amp;&amp; gunzip -c ../ramdisk.cpio.gz | cpio -i

#to recompress
cd ./extracted &amp;&amp; find . | cpio -o -H newc | gzip &gt; ../ramdisk.cpio.gz
mkbootimg --base 0 --pagesize 2048 --kernel_offset 0x10008000 --ramdisk_offset 0x11000000 --second_offset 0x10f00000 --tags_offset 0x10000100 --cmdline 'androidboot.hardware=tn8' --kernel kernel --ramdisk ramdisk.cpio.gz -o ../boot.emmc.win


The one possible issue I am seeing is that the newly created .emmc.win image is much smaller than the original one and has no trailing zeroes.

I am unsure how to avoid this issue and create a correct boot image.

MiscInfo: Device is Nvidia Shield Tablet, initial kernel/rom is cyanogenmod.
got it! Question is a duplicate of https://stackoverflow.com/questions/15573917/need-help-compiling-mkbootimg-binary-for-android

leaving this answer here for reference.