May 18, 2020

Building my own Recovery ROM for a Samsung J5 2017 (j5y17lte, TWRP)

After several hours of sideloading a custom ROM and flashing a TWRP recovery image i thought the next step is to build a TWRP recovery image on my own.


So how to do that?

My startpoint was
(just search github for your device with TWRP)

But this is not the way to begin.
First you have to follow this page:
and do
repo init -u git://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git -b twrp-7.1
and
repo sync
Then add the j5y17lte.xml to .repo/local_manifests. After that the repo sync works but the
$ lunch omni_j5y17lte-eng
ends up with a warning:

WARNING: device/samsung/j5y17lte/omni.dependencies file not found
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=7.1.2
TARGET_PRODUCT=omni_j5y17lte
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=cortex-a53
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv7-a-neon
TARGET_2ND_CPU_VARIANT=cortex-a53
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.15.0-88-generic-x86_64-with-Ubuntu-18.04-bionic
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=NJH47F
OUT_DIR=/media/schroff/895337b7-c4eb-44a4-9063-00f629e5149f/omni/out
============================================

The good point: just ignore this warning and do the mka recoveryimage.

Here i got two errors:

/bin/bash -c "prebuilts/misc/linux-x86/flex/flex-2.5.39 -oout/target/product/generic/obj/STATIC_LIBRARIES/libedify_intermediates/lexer.cpp bootable/recovery/edify/lexer.ll"
flex-2.5.39: loadlocale.c:130: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.
Aborted (core dumped)

Here i followed this hint:
https://groups.google.com/forum/?hl=tr#!topic/android-building/0kzPnw3akxg
and copied the provided flex to "prebuilts/misc/linux-x86"
   cp ~/Downloads/build/flex flex-2.5.39
You have to change the name from flex to flex-2.5.39 and you have to rerun source build/envsetup.sh again.

Then i got the following errors:

bootable/recovery/gui/../twrp-functions.hpp:24:10: fatal error: 'ext4_utils/ext4_crypt.h' file not found
bootable/recovery/gui/../twrp-functions.hpp:24:10: error: 'ext4_utils/ext4_crypt.h' file not found with <angled> include; use "quotes" instead
bootable/recovery/twrp.cpp:49:10: fatal error: 'base/strings.h' file not found
This i could resolve with:

cd bootable/recovery
ln -s ../../system/extras/ext4_utils
vi twrp-functions.hpp # add the quotes!
ln -s ../../system/core/base/include/android-base base

After that the build went through and i got a TWRP image:
-rw-rw-r--  1 schroff schroff 26937344 Mai 17 23:40 recovery.img
This ran without a problem on my J5 after a
heimdall flash --RECOVERY recovery.img



No comments:

Post a Comment