[Samsung Galaxy J7 Questions & Answers] CoffeeNAndroid:
Im just curious if theses steps still would work the thing is theres no twrp recovery to port off yet.. also would it be possible to make this recovery using windows linux bash shell...

At this stage make sure that you have synced the source, updated it and setup the build environment. Now lets proceed to the actual compiling part.

Step 1 : Open the terminal and change the directory to the top of your source. Then run the command

1

make -j4 otatools

This command will create all the necessary tools and files for the recovery compilation. Here -j# signifies the number of processes to start. It is generally based on the number of processors in your computer. This process generally requires 5-7 minutes on a reasonably fast desktop computer.

Step 2 : Now that the otatools are ready, we need to get a dump of our current boot.img. To do this, use ‘adb shell’ and launch this command

1

dump_image boot /sdcard/boot.img

This command will dump the boot partition as a image file named boot.img to your sdcard. Now pull this image to your local directory using adb pull or any other method.

Step 3 : Now we need to set up the makefiles for this device. Generally this is a long and tedious process. But since we are only compiling a recovery, it will be a lot easier.

From the root of your source directory, run the command

1

. build/envsetup.sh # or # source /build/envsetup.sh

This command will prepare all the necessary files required for compiling (initialize the build environment).

Once it is done, run the command,

1

build/tools/device/mkvendor.sh device_manufacturer_name device_name /your/path/to/the/boot.img

This will open the boot image and extract all the necessary files in the device/manufacturer/device_name path.

Step 4 : Now that we have extracted the files from the boot.img, we need to edit them to suit our device. Generally this shouldn’t be necessary, but we need to be sure about that or else we can brick our devices. The only files which are to be edited are ‘BoardConfig.mk’ and ‘recovery.fstab’. The main things that you will need to add is custom partitions (if your device doesn’t support named partitions).

If you change the contents of the BoardConfig.mk file, you will have to run ‘make clobber’ or the changes won’t get picked.

As the name suggests, BoardConfig.mk contains the config about the board used in your device. This is a very important file and a single error or incorrect value can result in a brick. So be cautious while editing this file

Next file is the recovery.fstab. This file lists all the partitions of a device and its paths. If you see any incorrect partition in this file, please change it. You don’t want your boot.img flashed on the bootloader partition, do you ?

I cannot help you with the actual editing as each device has different partitions and different formats.

Step 5 : Once the files are ready, we start the compiling. Run the following command to prepare the system for a compile.

1

. build/envsetup.sh

Step 6 : Once the system is ready, lets move on to the compile process.

Run the command,

1

lunch full_’device_name’-eng

For e.g : if you have a device names cooper, the command will be,

1

lunch full_cooper-eng

This will prepare the files of cooper for compiling.

Step 7 : Now that we have all files setup, run the command

1

make -j4 recoveryimage

This command builds the recovery in the form of an image file. If you want a fakeflash for testing purpose, then run,

1

make -j4 recoveryzip

The entire building process takes around 15 minutes.

Once complete, you will get the resulting recovery.img in the ‘out/target/product/device’ path. You can flash the recovery using a flashable zip or from adb using flash_image.