[Android Q&A, Help & Troubleshooting] morfikov:
I'm interested in build TWRP for my smartfone Neffos Y5. It's not rooted yet, and that's why I want to build the recovery image. So far I found out that I have to create a dir under device/tp-link/neffos_y5/ in the omni source. So I downloaded the source via the following commands[1]:

mkdir omni && cd omni
repo init -u https://github.com/omnirom/android.git -b android-6.0--depth=1
repo sync --current-branch --jobs=4 --no-clone-bundle

I didn't change much because I don't really know what I should change, so I left everything in its default state.

I created the aforementioned device/tp-link/neffos_y5/ directory, and downloaded these files[2].. My device has the same SoC (snapdragon 210, msm8909), but some other stuff is different (for instance the flash size). After I downloaded the files I was trying to change some of them. And the question is how to get all the needed information so I could put them in the files?

I was trying to find a complete TWRP recovery image, but unfortunately I couldn't, so that's why I'm trying to build my own. I don't really know what to do next. Based on the files in the above link I created the BoardConfig.mk which looks like this[3].

I don't know all the options here, but I think the Platform section is valid for my device.

The values in the Kernel section were different, but I've manned to acquire them using the original Neffos Y5 firmware. In that firmware there was a boot.img file. There wasn't any recovery.img, so I don't know whether I can build TWRP recovery, or I should build something else instead. Anyways I used these scripts [4]to unpack the boot.img file. I got some output in the terminal window while the process was taking place, and I just put the appropriate values in the right variables.

The only problem in the Kernel section is the dt.img file . I don't know how or where to get it. The recovery files I was looking at so far had this file included inside of their images, but in the case of my original boot.img file, there was no such file after unpacking it. So I don't know what to do about it now. Should I use the old dt.img or should I remove it completely, or maybe I get it from somewhere or generate it somehow?

In the Init section, there's TARGET_PLATFORM_DEVICE_BASE variable. I don't know how to get its value. Is there a way to figure it out? I left that as it was.

In the Partition sizes section all the values I got were from the /proc/partitions file. I just used the ADB tool, and I cat the file. Some of the values in that section were in decimal notation, but I converted them to hex. I don't know whether the numbers should be in decimal or hex because originally there were mixed.

The Recovery section has a TARGET_RECOVERY_FSTAB variable where the fstab file is defined. So based on the original file and some information from /proc/partitions and the diskinfo smartphone app I've managed to create the full fstab file. I know that probably not all of the entries are required, but because I don't know which one should be there, I've added all of them anyway.. Here's the content of the fstab.qcom file:

# mmcblk0p1 (modem)
/firmware vfat /dev/block/bootdevice/by-name/modem flags=display="Firmware";mounttodecrypt;backup=1
# mmcblk0p2 (sbl1)
/sbl1 emmc /dev/block/bootdevice/by-name/sbl1 flags=display="sbl1";backup=1
# mmcblk0p3 (sbl1bak)
/sbl1bak emmc /dev/block/bootdevice/by-name/sbl1bak flags=display="sbl1bak";backup=1
# mmcblk0p4 (aboot)
/aboot emmc /dev/block/bootdevice/by-name/aboot flags=display="aboot";backup=1
# mmcblk0p5 (abootbak)
/abootbak emmc /dev/block/bootdevice/by-name/abootbak flags=display="abootbak";backup=1
# mmcblk0p6 (rpm)
/rpm emmc /dev/block/bootdevice/by-name/rpm flags=display="rpm";backup=1
# mmcblk0p7 (rpmbak)
/rpmbak emmc /dev/block/bootdevice/by-name/rpmbak flags=display="rpmbak";backup=1
# mmcblk0p8 (tz)
/tz emmc /dev/block/bootdevice/by-name/tz flags=display="tz";backup=1
# mmcblk0p9 (tzbak)
/tzbak emmc /dev/block/bootdevice/by-name/tzbak flags=display="tzbak";backup=1
# mmcblk0p10 (tzbak)
/pad emmc /dev/block/bootdevice/by-name/pad flags=display="pad";backup=1
# mmcblk0p11 (modemst1)
/efs1 emmc /dev/block/bootdevice/by-name/modemst1 flags=display="EFS";backup=1
# mmcblk0p12 (modemst2)
/efs2 emmc /dev/block/bootdevice/by-name/modemst2 flags=backup=1;subpartitionof=/efs1
# mmcblk0p13 (misc)
/misc emmc /dev/block/bootdevice/by-name/misc flags=display="Misc";backup=1
# mmcblk0p14 (fsc)
/fsc emmc /dev/block/bootdevice/by-name/fsc flags=display="fsc";backup=1
# mmcblk0p15 (ssd)
/ssd emmc /dev/block/bootdevice/by-name/ssd flags=display="ssd";backup=1
# mmcblk0p16 (splash)
/splash emmc /dev/block/bootdevice/by-name/splash flags=display="splash";backup=1
# mmcblk0p17 (DDR)
/ddr emmc /dev/block/bootdevice/by-name/DDR flags=display="DDR";backup=1
# mmcblk0p18 (fsg)
/fsg emmc /dev/block/bootdevice/by-name/fsg flags=display="fsg";backup=1
# mmcblk0p19 (sec)
/sec emmc /dev/block/bootdevice/by-name/sec flags=display="sec";backup=1
# mmcblk0p20 (boot)
/boot emmc /dev/block/bootdevice/by-name/boot flags=display="Boot";backup=1
# mmcblk0p21 (System)
/system ext4 /dev/block/bootdevice/by-name/system flags=display="System";backup=1;wipeingui
# mmcblk0p22 (persist)
/persist ext4 /dev/block/bootdevice/by-name/persist flags=display="Persist";backup=1
# mmcblk0p23 (Cache)
/cache ext4 /dev/block/bootdevice/by-name/cache flags=display="Cache";backup=1;wipeingui;wipeduringfactoryreset
# mmcblk0p24 (recovery)
/recovery emmc /dev/block/bootdevice/by-name/recovery flags=display="Recovery";backup=1
# mmcblk0p25 (devinfo)
/devinfo emmc /dev/block/bootdevice/by-name/devinfo flags=display="devinfo";backup=1
# mmcblk0p26 (keystore)
/keystore emmc /dev/block/bootdevice/by-name/keystore flags=display="keystore";backup=1
# mmcblk0p27 (oem)
/oem emmc /dev/block/bootdevice/by-name/oem flags=display="oem";backup=1
# mmcblk0p28 (config)
/config emmc /dev/block/bootdevice/by-name/config flags=display="config";backup=1
# mmcblk0p29 (Data)
/data ext4 /dev/block/bootdevice/by-name/userdata flags=display="Data";backup=1;length=-16384;wipeingui;wipeduringfactoryreset
# mmcblk0rpmb
/mmcblk0rpmb emmc /dev/block/bootdevice/by-name/mmcblk0rpmb flags=display="mmcblk0rpmb";backup=1
# mmcblk1p1
/sdcard1 auto /dev/block/mmcblk1p1 flags=display="MicroSD";storage;wipeingui;removable
# otg
/usb-otg auto /dev/block/sda1 flags=display="USBOTG";storage;wipeingui;removable

In the TWRP section I just used the default values, but I've managed to check the paths. I've also set portrait_hdpi because the smartphone's display resolution is 720x1280 px..

Looking at the other device files, there was the device.mk file where the PRODUCT_COPY_FILES variable was defined. Its purpose is to copy old kernel file. I've put here the stock/split_img/recovery.img-zImage file that I got after unpacking the original boot.img from the Neffos Y5 firmware. Is this the file that has go here?

The last thing is the omni.dependencies file which was missing. I don't know how to make one. They say here[5] that I should create some dependencies, but I don't know what to put in this file. Any suggestions?

I would appreciate any info on this matter.

[1] hxxps://docs.omnirom.org/Setting_Up_A_Compile_Environment#Get_the_Omni_code

[2] hxxps://drive.google.com/file/d/0B1Qcauy1ptiSVnVpenl1bDBINjg4WXZpbUFVN0ttMU1yamp3/view

[3] hxxp://pastebin.com/1uPCscK3

[4] hxxps://github.com/ndrancs/AIK-Linux-x32-x64/

[5] hxxps://docs.omnirom.org/Porting_Omni_To_Your_Device#Introduction

Sorry for the links, but I can't add them. I don't know why the security mechanisms didn't want to accept the BoardConfig.mk file, so I uploaded it on pastebin. If someone put this post together and added the links in the right place, it would be nice.