[Nexus 5 Android Development] Phil3759:
edit the "system/build/core/Makefile" like below

ifndef BOARD_CUSTOM_BOOTIMG_MK
$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) \
$(recovery_ramdisk) \
$(recovery_kernel)
@echo -e ${CL_CYN}"----- Making recovery image ------"${CL_RST}
[STRIKE]$(hide) [/STRIKE]$(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
$(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw)
@echo -e ${CL_CYN}"Made recovery image: $@"${CL_RST}
endif

Compile recovery:

source build/envsetup.sh
lunch cm_lt03ltexx-userdebug

# compile
mka -j3 recoveryimage

When recovery.img is done, you get something like:

----- Making uncompressed recovery ramdisk ------
/root/Desktop/build_cm10/android_cm-11.0/system/out/host/linux-x86/bin/mkbootfs /root/Desktop/build_cm10/android_cm-11.0/system/out/target/product/lt03ltexx/recovery/root > /root/Desktop/build_cm10/android_cm-11.0/system/out/target/product/lt03ltexx/ramdisk-recovery.cpio

----- Making recovery ramdisk ------
/root/Desktop/build_cm10/android_cm-11.0/system/out/host/linux-x86/bin/minigzip < /root/Desktop/build_cm10/android_cm-11.0/system/out/target/product/lt03ltexx/ramdisk-recovery.cpio > /root/Desktop/build_cm10/android_cm-11.0/system/out/target/product/lt03ltexx/ramdisk-recovery.img

----- Making recovery image ------
/root/Desktop/build_cm10/android_cm-11.0/system/out/host/linux-x86/bin/mkbootimg --kernel /root/Desktop/build_cm10/android_cm-11.0/system/out/target/product/lt03ltexx/kernel --ramdisk /root/Desktop/build_cm10/android_cm-11.0/system/out/target/product/lt03ltexx/ramdisk-recovery.img --cmdline "console=null androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x3F" --base 0x00000000 --pagesize 2048 --ramdisk_offset 0x02000000 --dt device/samsung/lt03ltexx/recovery/dt.img --tags_offset 0x01e00000 --output /root/Desktop/build_cm10/android_cm-11.0/system/out/target/product/lt03ltexx/recovery.img

/root/Desktop/build_cm10/android_cm-11.0/system/out/target/product/lt03ltexx/recovery.img maxsize=10543104 blocksize=135168 total=9562112 reserve=270336
Made recovery image: /root/Desktop/build_cm10/android_cm-11.0/system/out/target/product/lt03ltexx/recovery.img

The 3 commands are basically what you need for your device

In this example:

Put all the ramdisk files and folders under device out folder "out/target/product/lt03ltexx/recovery/root"

The kernel

file

under "out/target/product/lt03ltexx/kernel"

From under your cm install folder, copy paste those 3 commands in exact order

source build/envsetup.sh
lunch cm_lt03ltexx-userdebug

# pack ramdisk folder into cpio
/root/Desktop/build_cm10/android_cm-11.0/system/out/host/linux-x86/bin/mkbootfs /root/Desktop/build_cm10/android_cm-11.0/system/out/target/product/lt03ltexx/recovery/root > /root/Desktop/build_cm10/android_cm-11.0/system/out/target/product/lt03ltexx/ramdisk-recovery.cpio

# compress it to gzip
/root/Desktop/build_cm10/android_cm-11.0/system/out/host/linux-x86/bin/minigzip < /root/Desktop/build_cm10/android_cm-11.0/system/out/target/product/lt03ltexx/ramdisk-recovery.cpio > /root/Desktop/build_cm10/android_cm-11.0/system/out/target/product/lt03ltexx/ramdisk-recovery.img

# create recovery.img with all needed cmdline info for your device
/root/Desktop/build_cm10/android_cm-11.0/system/out/host/linux-x86/bin/mkbootimg --kernel /root/Desktop/build_cm10/android_cm-11.0/system/out/target/product/lt03ltexx/kernel --ramdisk /root/Desktop/build_cm10/android_cm-11.0/system/out/target/product/lt03ltexx/ramdisk-recovery.img --cmdline "console=null androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x3F" --base 0x00000000 --pagesize 2048 --ramdisk_offset 0x02000000 --dt device/samsung/lt03ltexx/recovery/dt.img --tags_offset 0x01e00000 --output /root/Desktop/build_cm10/android_cm-11.0/system/out/target/product/lt03ltexx/recovery.img

You get your repack in a very easy way

Basically, removing the hide command let you see exact needed command line to properly repack

That's for you to start

If you want to repack around stock kernels, you'll have to take care to the exact cmdline arguments that can differ from those used by CM kernel