Tricky.
The kernel is typically stored in a dedicated boot partition as a boot.img, details vary by devices.
The system boots with a ramdisk as the boot.img contains not only the kernel but the first phase startup code, and then ultimately the kernel is loaded into ram on a running system.
http://elinux.org/Android_Booting
This gives a taste of the boot.img layout but again - the directions are highly device dependent.
http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images
If "cat /proc/mtd" doesn't work, try -
cat /cache/recovery/last_log | more
... to find the block where /boot is hiding.
Typically, a TWRP restore of /boot should be sufficient to save you - except that can be device dependent as well.
Be prepared to -
fastboot flash boot boot.img
With the boot.img extracted from your current rom.zip and -
Even that is device dependent.
Not every device follows the Android standard model - in fact, not by a long shot, and given Samsung's sales numbers and the stunts they pull anymore, it's impossible to say if even the majority of devices follow the standard model.
They all mostly do, just with some extra proprietary, non-developer friendly mods.
Forget most of the above on anything with a hard bootloader lock - I'm looking at you, LG and ZTE.
You want kernel source along with the build environment from the manufacturer and failing that, some pointers from existing kernel devs for your device.
See /sys or /system/lib for modules and drivers - typically.
Factory data reset clears /cache and /data and therefore the Dalvik (ART) cache.
Hope this helps!