Scenario: You have TWRP recovery on your rooted Moto E first generation phone. You wish to install the latest OTA 5.1 from Motorola, but TWRP and Stock recovery tells you that the build fingerprint is incompatible. The classical solution in this case, is to reflash the stock Motorola ROM, but you lose your data in such case usually. You also lose your recovery. The technique described below shows you how to upgrade your Kitkat Moto E rooted/non rooted rom to the latest Android 5.1 ROM without losing root or recovery.

First, get the latest Android 5.1 Rom for Moto E first generation:
Extract it to D:\phone\motoe [Any convenient location]
Get mfastboot2 tool from
Reboot Moto E to bootloader.

Create a script file install.bat with the following:

mfastboot flash partition gpt.bin
mfastboot flash motoboot motoboot.img
mfastboot flash logo logo.bin
mfastboot flash boot boot.img
#mfastboot flash recovery recovery.img
mfastboot flash system system.img_sparsechunk.0
mfastboot flash system system.img_sparsechunk.1
mfastboot flash system system.img_sparsechunk.2
mfastboot flash system system.img_sparsechunk.3
mfastboot flash modem NON-HLOS.bin
mfastboot erase modemst1 
mfastboot erase modemst2 
mfastboot flash fsg fsg.mbn
mfastboot erase cache 
#mfastboot erase userdata 
mfastboot reboot

If the recovery gets wiped, reinstall TWRP and SuperSU. You may also need to remove the bootloader unlocked warning screen.

Note that I’ve commented out the two lines which erase the userdata, and removes the rooted recovery.