[LG G2 Mini] powermetza:
[MENTION=4768771]HoaPham98[/MENTION] , [MENTION=4623180]Zaaap72[/MENTION] , [MENTION=1828795]invaderjohn[/MENTION] , [MENTION=5725382]siracuervo[/MENTION] and other devs

In the last few days I tried to compile TWRP 2.8.3.0 for D620 without success. What I managed to compile, is not working; when I try to enter in recovery the phone enter in fastboot.

My environment was installed like here.

Then I deleted /bootable/recovery (CWM recovery) and I used this command to download TWRP recovery:

git clone git:/github.com/omnirom/android_bootable_recovery.git -b android-4.4 /bootable/recovery

The next thing I did was to download Zaaap72 sources:

git clone git://github.com/Zaaap/android_device_lge_d620.git -b master device/lge/d620
git clone git://github.com/Zaaap/android_vendor_lge_d620.git -b master vendor/lge/d620
git clone git://github.com/Zaaap/android_kernel_lge_d620.git -b master kernel/lge/d620

Next I used the next command:

.build/tools/device/makerecoveries.sh cm_D620r-eng

source build/envsetup.sh

lunch cm_d620-eng

And to compile the recovery I used:

make clobber - I used this every time I modified BoardConfig.mk

sudo make clean && make -j5 recoveryimage

In the first tests, I had a lot off errors, and I had do delete Zaaap72 Kernel source and I used TARGET_PREBUILT_KERNEL := device/lge/d620/kernel in BoardConfig.mk.

Next, if the settings bellow were set in BoardConfig.mk the compile stop every time and it given me the next error:

make: *** No rule to make target '/home/amd/android/system/out/host/linux-x86/bin/dtbToolCM', needed by '/home/amd/android/system/out/target/product/d620/dt.img'. Stop.

BOARD_CUSTOM_BOOTIMG_MK := device/lge/d620/mkbootimg.mk
BOARD_KERNEL_CMDLINE := console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 user_debug=31 msm_rtb.filter=0x37 androidboot.hardware=g2m
BOARD_KERNEL_BASE := 0x00000000
BOARD_KERNEL_PAGESIZE := 2048
BOARD_KERNEL_OFFSET := 0x00008000
BOARD_MKBOOTIMG_ARGS := --ramdisk_offset 0x01000000 --tags_offset 0x01e00000

If I disabled the settings, the compile was OK, but recovery.img is not booting.

I decompile the recovery.img and the first thing I saw was the missing off twrp.fstab from etc folder.

Next I tried to repack the recovery.img with the next commands:

./unmkbootimg recovery.img > output.txt - unpack recovery.img
gunzip -c ../initramfs.cpio.gz | cpio -i - unpack ramdisk
mkbootfs ramdisk | gzip > ramdisk-new.gz -repack ramdisk with mkbootfs
or
find . | cpio -o -H newc | gzip > ../newramdisk.cpio.gz - repack ramdisk

and the command to repack recovery.img

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x1dfff00 --cmdline 'console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 user_debug=31 msm_rtb.filter=0x37 androidboot.hardware=g2m' -o new_boot1.img
mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x0 --cmdline 'console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 user_debug=31 msm_rtb.filter=0x37 androidboot.hardware=g2m' -o new_boot2.img
mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x0 --pagesize 2048 --ramdisk_offset 0x01000000 --tags_offset 0x01e00000 --cmdline 'console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 user_debug=31 msm_rtb.filter=0x37 androidboot.hardware=g2m' -o new_boot3.img
mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x0 --pagesize 2048 --kernel_offset 0x00008000 --ramdisk_offset 0x01000000 --tags_offset 0x01e00000 --cmdline 'console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 user_debug=31 msm_rtb.filter=0x37 androidboot.hardware=g2m' -o new_boot5.img

All the recovery repack give me the same result, fastboot instead of recovery.

I tested another thing, because I believe the pack of recovery is the problem. I tried to unpack and repack TWRP recovery made by Zaaap72 , and none of my test recovery files are working.

So I think the problem with compilation is with the pack of recovery and I don't know how to fix it, and my method to unpack and repack is not working. I attached my test BoardConfig.mk file.

Can anyone help me with the compile of TWRP 2.8.3.0.