[HD2 Android Q&A, Help & Troubleshooting and Genera] HypoTurtle:
Attached is the ramdisk for f2fs extended TWRP. It's minor changes to kokotas just to make it use f2fs instead of nilfs2. Just replace the ramdisk from the file posted in #11 by Robbie P.

I think I have the kernel type check down

## Checking if zImage is for 3.0.x
if [ `hd /tmp/zImage | grep '1f 8b 08' | cut -d ' ' -f '1'` == `'00003f80' || '00003f70'` ]; then
dd if=/dev/zero of=/tmp/6MB bs=1M count=6
fi

It's not perfect - we could extract the actual kernel version from the zImage but it would take several minutes. Or make use of the errors in the kernel:

00003cc0 0a 20 2d 2d 20 53 79 73 74 65 6d 20 68 61 6c 74 |. -- System halt|
00003cd0 65 64 00 41 74 74 65 6d 70 74 69 6e 67 20 64 69 |ed.Attempting di|
00003ce0 76 69 73 69 6f 6e 20 62 79 20 30 21 00 55 6e 63 |vision by 0!.Unc|
00003cf0 6f 6d 70 72 65 73 73 69 6e 67 20 4c 69 6e 75 78 |ompressing Linux|
00003d00 2e 2e 2e 00 64 65 63 6f 6d 70 72 65 73 73 6f 72 |....decompressor|
00003d10 20 72 65 74 75 72 6e 65 64 20 61 6e 20 65 72 72 | returned an err|
00003d20 6f 72 00 20 64 6f 6e 65 2c 20 62 6f 6f 74 69 6e |or. done, bootin|
00003d30 67 20 74 68 65 20 6b 65 72 6e 65 6c 2e 0a 00 69 |g the kernel...i|
00003d40 6e 76 61 6c 69 64 20 64 69 73 74 61 6e 63 65 20 |nvalid distance |
00003d50 74 6f 6f 20 66 61 72 20 62 61 63 6b 00 69 6e 76 |too far back.inv|
00003d60 61 6c 69 64 20 64 69 73 74 61 6e 63 65 20 63 6f |alid distance co|
00003d70 64 65 00 69 6e 76 61 6c 69 64 20 6c 69 74 65 72 |de.invalid liter|
00003d80 61 6c 2f 6c 65 6e 67 74 68 20 63 6f 64 65 00 69 |al/length code.i|
00003d90 6e 63 6f 72 72 65 63 74 20 68 65 61 64 65 72 20 |ncorrect header |
00003da0 63 68 65 63 6b 00 75 6e 6b 6e 6f 77 6e 20 63 6f |check.unknown co|
00003db0 6d 70 72 65 73 73 69 6f 6e 20 6d 65 74 68 6f 64 |mpression method|
00003dc0 00 69 6e 76 61 6c 69 64 20 77 69 6e 64 6f 77 20 |.invalid window |
00003dd0 73 69 7a 65 00 69 6e 76 61 6c 69 64 20 62 6c 6f |size.invalid blo|
00003de0 63 6b 20 74 79 70 65 00 69 6e 76 61 6c 69 64 20 |ck type.invalid |
00003df0 73 74 6f 72 65 64 20 62 6c 6f 63 6b 20 6c 65 6e |stored block len|
00003e00 67 74 68 73 00 74 6f 6f 20 6d 61 6e 79 20 6c 65 |gths.too many le|
00003e10 6e 67 74 68 20 6f 72 20 64 69 73 74 61 6e 63 65 |ngth or distance|
00003e20 20 73 79 6d 62 6f 6c 73 00 69 6e 76 61 6c 69 64 | symbols.invalid|
00003e30 20 63 6f 64 65 20 6c 65 6e 67 74 68 73 20 73 65 | code lengths se|
00003e40 74 00 69 6e 76 61 6c 69 64 20 62 69 74 20 6c 65 |t.invalid bit le|
00003e50 6e 67 74 68 20 72 65 70 65 61 74 00 69 6e 76 61 |ngth repeat.inva|
00003e60 6c 69 64 20 6c 69 74 65 72 61 6c 2f 6c 65 6e 67 |lid literal/leng|
00003e70 74 68 73 20 73 65 74 00 69 6e 76 61 6c 69 64 20 |ths set.invalid |
00003e80 64 69 73 74 61 6e 63 65 73 20 73 65 74 00 69 6e |distances set.in|
00003e90 63 6f 72 72 65 63 74 20 64 61 74 61 20 63 68 65 |correct data che|
00003ea0 63 6b 00 4f 75 74 20 6f 66 20 6d 65 6d 6f 72 79 |ck.Out of memory|
00003eb0 20 77 68 69 6c 65 20 61 6c 6c 6f 63 61 74 69 6e | while allocatin|
00003ec0 67 20 6f 75 74 70 75 74 20 62 75 66 66 65 72 00 |g output buffer.|
00003ed0 4f 75 74 20 6f 66 20 6d 65 6d 6f 72 79 20 77 68 |Out of memory wh|
00003ee0 69 6c 65 20 61 6c 6c 6f 63 61 74 69 6e 67 20 69 |ile allocating i|
00003ef0 6e 70 75 74 20 62 75 66 66 65 72 00 4f 75 74 20 |nput buffer.Out |
00003f00 6f 66 20 6d 65 6d 6f 72 79 20 77 68 69 6c 65 20 |of memory while |
00003f10 61 6c 6c 6f 63 61 74 69 6e 67 20 7a 5f 73 74 72 |allocating z_str|
00003f20 65 61 6d 00 4f 75 74 20 6f 66 20 6d 65 6d 6f 72 |eam.Out of memor|
00003f30 79 20 77 68 69 6c 65 20 61 6c 6c 6f 63 61 74 69 |y while allocati|
00003f40 6e 67 20 77 6f 72 6b 73 70 61 63 65 00 4e 6f 74 |ng workspace.Not|
00003f50 20 61 20 67 7a 69 70 20 66 69 6c 65 00 68 65 61 | a gzip file.hea|
00003f60 64 65 72 20 65 72 72 6f 72 00 72 65 61 64 20 65 |der error.read e|
00003f70 72 72 6f 72 00 75 6e 63 6f 6d 70 72 65 73 73 69 |rror.uncompressi|
00003f80 6f 6e 20 65 72 72 6f 72 00 1f 8b 08 00 00 00 00 |on error........|
is from a 3.0.x kernel
000034f0 0a 0a 00 0a 0a 20 2d 2d 20 53 79 73 74 65 6d 20 |..... -- System |
00003500 68 61 6c 74 65 64 00 72 61 6e 20 6f 75 74 20 6f |halted.ran out o|
00003510 66 20 69 6e 70 75 74 20 64 61 74 61 00 4d 61 6c |f input data.Mal|
00003520 6c 6f 63 20 65 72 72 6f 72 00 4f 75 74 20 6f 66 |loc error.Out of|
00003530 20 6d 65 6d 6f 72 79 00 69 6e 63 6f 6d 70 6c 65 | memory.incomple|
00003540 74 65 20 6c 69 74 65 72 61 6c 20 74 72 65 65 00 |te literal tree.|
00003550 69 6e 63 6f 6d 70 6c 65 74 65 20 64 69 73 74 61 |incomplete dista|
00003560 6e 63 65 20 74 72 65 65 00 62 61 64 20 67 7a 69 |nce tree.bad gzi|
00003570 70 20 6d 61 67 69 63 20 6e 75 6d 62 65 72 73 00 |p magic numbers.|
00003580 69 6e 74 65 72 6e 61 6c 20 65 72 72 6f 72 2c 20 |internal error, |
00003590 69 6e 76 61 6c 69 64 20 6d 65 74 68 6f 64 00 49 |invalid method.I|
000035a0 6e 70 75 74 20 69 73 20 65 6e 63 72 79 70 74 65 |nput is encrypte|
000035b0 64 00 4d 75 6c 74 69 20 70 61 72 74 20 69 6e 70 |d.Multi part inp|
000035c0 75 74 00 49 6e 70 75 74 20 68 61 73 20 69 6e 76 |ut.Input has inv|
000035d0 61 6c 69 64 20 66 6c 61 67 73 00 69 6e 76 61 6c |alid flags.inval|
000035e0 69 64 20 63 6f 6d 70 72 65 73 73 65 64 20 66 6f |id compressed fo|
000035f0 72 6d 61 74 20 28 65 72 72 3d 31 29 00 69 6e 76 |rmat (err=1).inv|
00003600 61 6c 69 64 20 63 6f 6d 70 72 65 73 73 65 64 20 |alid compressed |
00003610 66 6f 72 6d 61 74 20 28 65 72 72 3d 32 29 00 6f |format (err=2).o|
00003620 75 74 20 6f 66 20 6d 65 6d 6f 72 79 00 69 6e 76 |ut of memory.inv|
00003630 61 6c 69 64 20 63 6f 6d 70 72 65 73 73 65 64 20 |alid compressed |
00003640 66 6f 72 6d 61 74 20 28 6f 74 68 65 72 29 00 63 |format (other).c|
00003650 72 63 20 65 72 72 6f 72 00 6c 65 6e 67 74 68 20 |rc error.length |
00003660 65 72 72 6f 72 00 55 6e 63 6f 6d 70 72 65 73 73 |error.Uncompress|
00003670 69 6e 67 20 4c 69 6e 75 78 2e 2e 2e 00 20 64 6f |ing Linux.... do|
00003680 6e 65 2c 20 62 6f 6f 74 69 6e 67 20 74 68 65 20 |ne, booting the |
00003690 6b 65 72 6e 65 6c 2e 0a 00 1f 8b 08 00 48 99 b4 |kernel.......H..|
is from 2.X

Not sure how universal those errors are though.