Add su and busybox to my aosp 4.0.3 - Android

Hello
i've built AOSP from source with no issues for my Maguro. bumped all the proprietary binaries for GPS, BlueTooth, Camera. Everything is working but i am having trouble to add su and busybox.
this is what i am doing in order to add su and busybox
1. git cloned SuperUser in $TOP
Code:
git clone git://github.com/ChainsDD/Superuser.git packages/apps/Superuser
2. copied su and busybox binaries from apex ROM and put them in $TOP/device/samsung/maguro/prebuilt/xbin
3. edited $TOP/device/samsung/maguro/full_maguro.mk
Code:
[email protected]:~$ cat $TOP/device/samsung/maguro/full_maguro.mk
# Copyright (C) 2011 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This file is the build configuration for a full Android
# build for maguro hardware. This cleanly combines a set of
# device-specific aspects (drivers) with a device-agnostic
# product configuration (apps). Except for a few implementation
# details, it only fundamentally contains two inherit-product
# lines, full and maguro, hence its name.
#
# Get the long list of APNs
PRODUCT_COPY_FILES := device/sample/etc/apns-full-conf.xml:system/etc/apns-conf.xml
# Camera
PRODUCT_PACKAGES := \
Camera
# Tell compiler where our prebuilt folder is
DEVICE_PREBUILT := device/samsung/maguro/prebuilt
# Tell compiler to build Superuser.apk
PRODUCT_PACKAGES := \
Superuser
# Include busybox and su binaries
PRODUCT_COPY_FILES += \
$(DEVICE_PREBUILT)/xbin/busybox:system/xbin/busybox \
$(DEVICE_PREBUILT)/xbin/su:system/xbin/su
# This is a script to automatically symlink busybox and su binaries on boot (the code for 91-busybox_linkage.sh is below)
PRODUCT_COPY_FILES += \
$(DEVICE_PREBUILT)/etc/init.d/91-busybox_linkage.sh:system/etc/inti.d/91-busybox_linkage.sh
# Inherit from those products. Most specific first.
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk)
# This is where we'd set a backup provider if we had one
#$(call inherit-product, device/sample/products/backup_overlay.mk)
# Inherit from maguro device
$(call inherit-product, device/samsung/maguro/device.mk)
# Set those variables here to overwrite the inherited values.
PRODUCT_NAME := full_maguro
PRODUCT_DEVICE := maguro
PRODUCT_BRAND := Android
PRODUCT_MODEL := Full AOSP on Maguro
4. created 91-busybox_linkage.sh in $TOP/device/samsung/maguro/prebuilt/etc/init.d
Code:
[email protected]:~$ cat $TOP/device/samsung/maguro/prebuilt/etc/init.d/91-busybox_linkage.sh
for cmd in $(busybox --list);do ln -s /system/xbin/$cmd $cmd; done; ln -s /system/xbin/su su;
5. set permissions for 91-busybix_linkage.sh
Code:
[email protected]:~/myAOSP/device/samsung/maguro/prebuilt/etc/init.d$ ls -l
total 4 -rwxrwxrwx 1 rascarlo rascarlo 94 2012-02-14 13:52 91-busybox_linkage.sh
6. added https://github.com/C...eruser.x509.pem and https://github.com/C...y/superuser.pk8 in $TOP/build/target/product/security
then i make installclean, make clean, make clobber and then i run make otapackage -j8
but it won't build. i get this as last line in terminal:
Code:
'out/target/common/obj/APPS/Settings_intermediates/classes.dex' as 'classes.dex'...
[email protected]:~/myAOSP$
and scrolling up in terminal i see this error :
Code:
make: *** [out/target/product/maguro/obj/APPS/Superuser_intermediates/package.apk] Error 1
where am i wrong?
can anybody help?
thank you

quite interested in this, as I have a maguro also
Greets!

Maybe you should compile the build first.....then use dsixda's Android Kitchen to add root
Herpderp Defy.

EmoBoiix3 said:
Maybe you should compile the build first.....then use dsixda's Android Kitchen to add root
Herpderp Defy.
Click to expand...
Click to collapse
i compiled the buiild just fine and i would like to not use the kitchen

You need to add the source to packages/apps, then add it to either build/target/product/core.mk or device/*/*/device.mk
would be device/samsung/tuna/device_base.mk for u (yes i know u r building for maguro)
You also need to add the su binary sources to system/su
And for busybox, you might add busybox to external and the compile it

thank you for your reply. let me see i am getting this right.
cdesai said:
You need to add the source to packages/apps....
Click to expand...
Click to collapse
that is
Code:
cd $TOP
git clone git://github.com/ChainsDD/Superuser.git packages/apps/Superuser
... then add it to either build/target/product/core.mk or device/*/*/device.mk
Click to expand...
Click to collapse
that for me would mean add to device/samsung/maguro/device.mk this text?
Code:
# Tell compiler to build Superuser.apk
PRODUCT_PACKAGES := \
Superuser
would be device/samsung/tuna/device_base.mk for u (yes i know u r building for maguro)
Click to expand...
Click to collapse
i have not such file in device/samsung/tuna. and why if i am compiling for maguro?
You also need to add the su binary sources to system/su
Click to expand...
Click to collapse
that is
Code:
cd $TOP
git clone https://github.com/ChainsDD/su-binary.git system/su
And for busybox, you might add busybox to external and the compile it
Click to expand...
Click to collapse

Ok. The su in system/extras gives compile errors so I had to delete it. Superuser.apk compiled without any problems but su isn't in the xbin folder. I think this is giving it errors
LOCAL_MODULE_TAGS := debug, eng
Can anyone help me out?

unstable. Forced Close on a lot of apps.

Related

[Question] post #4: Include Stk.apk in full_passion_eng make...

question #1 regarding if "make -jx otapackage" update.zip flashes new recovery over custom recovery...
when building froyo from aosp for passion, i have been taking the out/target/product/passion boot.img and system.img and using dsixda kitchen to output a flashable update.zip... no issues. i just started also ending the compile with "make -jx otapackage". pulling apart the .zip i see there is a "recovery" file folder. does this flash a new recovery that would replace any custom recovery already on device???
thanks to anyone willing to throw me an answer.
lpasq said:
when building froyo from aosp for passion, i have been taking the out/target/product/passion boot.img and system.img and using dsixda kitchen to output a flashable update.zip... no issues. i just started also ending the compile with "make -jx otapackage". pulling apart the .zip i see there is a "recovery" file folder. does this flash a new recovery that would replace any custom recovery already one device???
thanks to anyone willing to throw me an answer.
Click to expand...
Click to collapse
It's my understanding that as long as there's nothing in the update-script that will flash the recovery image, then you are ok. I've encountered this once, and I just deleted the recovery folder and anything in the update-script. (And then zipped and resigned the ROM.) When I flashed the ROM, there was no recovery image flashed. Just double-check everything.
gnarlyc said:
It's my understanding that as long as there's nothing in the update-script that will flash the recovery image, then you are ok. I've encountered this once, and I just deleted the recovery folder and anything in the update-script. (And then zipped and resigned the ROM.) When I flashed the ROM, there was no recovery image flashed. Just double-check everything.
Click to expand...
Click to collapse
Understood and appreciated.
Sent from my Nexus One using XDA App
[Question] Including Stk.apk in full_passion_eng make...
When I lunch full_passion_eng, the Stk.apk is not included in my compiled build. How do I add it for inclusion in the build?
My build.sh is as follows:
PHP:
#!/bin/bash
#clean out prior compiled files
make installclean
make clean
#update AOSP froyo source files
repo init -u git://android.git.kernel.org/platform/manifest.git -b froyo
cd ~
repo sync
#setup compiling environment and build
cd ~
. build/envsetup.sh
lunch
#USB connect N1 and initiate ADB
cd ~
adb devices
#ADB pull needed device files
cd ~
cd device
cd htc
cd passion
./extract-files.sh
#build the Passion *.img's
cd ~
make -j3
#view compiled folder's new boot.img/system.img/userdata.img
cd ~
cd out
cd target
cd product
cd passion
echo 'see flashable files:'
ls *.img
#create update.zip
cd ~
make -j3 otapackage
This is the Android.mk in /packages/apps/Stk. Am I to modify this or am I really off?
PHP:
# Copyright 2007-2008 The Android Open Source Project
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_PACKAGE_NAME := Stk
LOCAL_CERTIFICATE := platform
include $(BUILD_PACKAGE)
Thank you.

Help with compiling / porting MultiRom / TWRP for Aquaris E5?

I would like to have a dual boot (Android / Ubuntu Touch) on an Aquaris E5 HD phone ( the Ubuntu Touch variant can be flashed with stock Android and vice versa, see mibqyyo.com/en-articles/2015/09/16/ubuntu-android-installation-process-for-bq-aquaris-e4-5-and-e5 ). ((sorry for the links, new user))
Unfortunately, the instructions from wiki.ubuntu.com/Touch/DualBootInstallation do not work with this phone anymore: it seems that the software in those instructions relies on the device having custom ClockworkMod (CWM) recovery -- and, it seems ClockworkMod does not support this device anymore, if it ever did ( see askubuntu.com/questions/666070/cant-install-ubuntu-touch-dual-boot-on-mobile-stuck-in-waiting-for-device/776357 ).
The only other option I could see for dual boot is MultiROM Manager, unfortunately it fails with "This is unsupported device (Aquaris_E5_HD)!"
However, it is possible to root this phone using a TeamWin Recovery Project (TWRP) custom recovery image ( v3.0.2-0, see mibqyyo.com/comunidad/discussion/77467/how-to-root-a-bq-aquaris-e5-hd-phone ), which seemingly does support this phone. Furthermore, from twrp.me/devices/bqaquarise5hd.html there is a reference to:
Device Tree / files: github.com/TeamWin/android_device_bq_vegetahd - and from there:
Kernel source available on: github.com/bq/aquaris-E5
So, I thought - maybe it would be possible to port / build MultiROM from source, with support for this device? I tried something, and maybe I even got part of the way - unfortunately I cannot get the build to complete, so I hope I can get some assistance here. I will outline the steps I did below. First of all, I use this as my PC:
Code:
$ uname -a
Linux MYPC 4.2.0-38-generic #45~14.04.1-Ubuntu SMP Thu Jun 9 09:27:51 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/issue
Ubuntu 14.04.4 LTS \n \l
Then I looked at github.com/Tasssadar/multirom/wiki/Porting-MultiROM:
Prerequisites
* Android 4.1+ tree
* TWRP ported to your device. There are guides on the internet on how to do that.
* Kernel sources
Downloading sources
Just clone TWRP, MultiROM and libbootimg repos into your Android Tree, the commands would look something like this: [...]
Click to expand...
Click to collapse
I was somewhat puzzled about what this "Android Tree" is, but eventually I guessed it is the Android Open Source Project (AOSP) source code. So, I looked and did this:
source.android.com/source/initializing.html
(Note: http removed from links in code below, because I'm a new user and cannot post links):
Code:
cd /tmp
wget archive.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jre-headless_8u45-b14-1_amd64.deb
wget archive.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jre_8u45-b14-1_amd64.deb
wget archive.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jdk_8u45-b14-1_amd64.deb
sudo dpkg -i openjdk-8-jre-headless_8u45-b14-1_amd64.deb
sudo dpkg -i openjdk-8-jre_8u45-b14-1_amd64.deb
sudo dpkg -i openjdk-8-jdk_8u45-b14-1_amd64.deb
sudo apt-get -f install
# already have libgl1-mesa-dev-lts-wily mesa-common-dev-lts-wily
# so removed libgl1-mesa-dev from list below:
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libxml2-utils xsltproc unzip
sudo apt-get autoremove --purge
wget -S -O - source.android.com/source/51-android.rules | sed "s/<username>/$USER/" | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules
# for the aquaris:
echo "SUBSYSTEM==\"usb\", ATTRidVendor==\"2a47\", ATTRidProduct==\"201d\", MODE=\"0600\", OWNER=\"$USER\"" \
| sudo tee -a /etc/udev/rules.d/51-android.rules
sudo udevadm control --reload-rules
then
source.android.com/source/downloading.html
Code:
mkdir ~/bin
PATH=~/bin:$PATH
curl storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
cd /path/to/src
mkdir AOSP
cd AOSP
repo init -u android.googlesource.com/platform/manifest -b android-4.1.2_r2.1 2>&1 | tee repo.log
repo sync
Note that here, I took the `4.1+` requirement quite literally, so just chose to checkout the last 4.1 branch, `4.1.2_r2.1`.
Also, repo sync took 14+ hours to complete, for my PC+Internet connection combo (!)
With that done, I have this in the directory:
Code:
AOSP$ ls
abi cts docs hardware ndk prebuilts
bionic dalvik external libcore packages repo.log
bootable development frameworks libnativehelper pdk sdk
build device gdk Makefile prebuilt system
Now, at this point, we should be running build/envsetup.sh and lunch; however, that will cause only the default Google devices (Nexus etc) to be recognized. So, here I did cloned the "device tree" (I guess) into the "Android tree":
Code:
AOSP$ mkdir device/bq
AOSP$ git clone github.com/TeamWin/android_device_bq_vegetahd device/bq/vegetahd
AOSP$ chmod +x device/bq/vegetahd/vendorsetup.sh
AOSP$ ls device/bq/vegetahd/
AndroidBoard.mk BoardConfig.mk kernel omni_vegetahd.mk recovery
AndroidProducts.mk device.mk mkbootimg.mk README.md vendorsetup.sh
AOSP$ ls device/samsung/crespo # for comparison
Android.mk full_crespo.mk libsensors recovery
AndroidProducts.mk gps.conf libstagefrighthw recovery.fstab [...]
vendorsetup.sh
and also cloned the Omnirom TWRP recovery sources (note that if you just mv bootable/recovery bootable/old.recovery, then the builds process may also pick some of those files up, so that directory should be deleted, as guides elsewhere recommend):
Code:
AOSP$ rm -rf bootable/recovery
cd bootable
git clone https://github.com/omnirom/android_bootable_recovery.git recovery-twrp
cd ..
Since build/envsetup.sh should be running the vendorsetup.sh when it finds them, after running it, the Aquaris device should be visible:
Code:
AOSP$ source build/envsetup.sh
including device/asus/grouper/vendorsetup.sh
including device/bq/vegetahd/vendorsetup.sh # ***
including device/generic/armv7-a-neon/vendorsetup.sh
including device/generic/armv7-a/vendorsetup.sh
including device/moto/wingray/vendorsetup.sh
including device/samsung/crespo/vendorsetup.sh
including device/samsung/maguro/vendorsetup.sh
including device/ti/panda/vendorsetup.sh
including sdk/bash_completion/adb.bash
AOSP$ lunch
You're building on Linux
Lunch menu... pick a combo:
1. full-eng
2. full_x86-eng
3. vbox_x86-eng
4. full_grouper-userdebug
5. omni_vegetahd-eng # ***
6. mini_armv7a_neon-userdebug
7. mini_armv7a-userdebug
8. full_wingray-userdebug
9. full_crespo-userdebug
10. full_maguro-userdebug
11. full_panda-userdebug
Which would you like? [full-eng] 5
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.1.2
TARGET_PRODUCT=omni_vegetahd
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
HOST_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.2.0-38-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_BUILD_TYPE=release
BUILD_ID=JZO54M
OUT_DIR=out
============================================
Now, it seems that for such an old version like 4.1.2_r2.1, there is no mka command (not found), which should otherwise be ran at this point - however, I can run make instead of it.
Also because it's so old, I get "You are attempting to build with the incorrect version of java. Your version is: openjdk version "1.8.0_45-internal". The correct version is: Java SE 1.6.", which it so happens, I have - but I have to set environment variables. So here I run:
Code:
AOSP$ export RECOVERY_VARIANT=twrp
AOSP$ ANDROID_PRE_BUILD_PATHS=/path/to/jdk1.6.0_45/bin \
ANDROID_JAVA_TOOLCHAIN=/path/to/jdk1.6.0_45/bin \
JAVA_HOME=/path/to/jdk1.6.0_45 \
PATH=/path/to/jdk1.6.0_45/bin:$PATH \
make -j3 recoveryimage
...
target thumb C: adbd <= system/core/adb/log_service.c
make: *** No rule to make target `out/target/product/vegetahd/obj/EXECUTABLES/recovery_intermediates/recovery', needed by `out/target/product/vegetahd/recovery.img'. Stop.
make: *** Waiting for unfinished jobs....
target thumb C: adbd <= system/core/adb/utils.c
... but as you can see, it fails. This was for the Omnirom sources of TWRP recovery.
Then I thought of going back to the Multirom porting, and so did this:
Code:
AOSP$ rm -r bootable/recovery-twrp
git clone github.com/Tasssadar/Team-Win-Recovery-Project.git bootable/recovery
git clone github.com/Tasssadar/multirom.git system/extras/multirom
git clone github.com/Tasssadar/libbootimg.git system/extras/libbootimg
cd system/extras/multirom
git submodule update --init
cd ../../..
Then I checked the touchpad from adb shell as root:
Code:
cat /proc/bus/input/devices
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="mtk-tpd"
P: Phys=
S: Sysfs=/devices/virtual/input/input3
U: Uniq=
H: Handlers=mouse0 event3 cpufreq
B: PROP=2
B: EV=b
B: KEY=10 0 0 0 0 0 0 0 400 0 0 0 0 1000 40000000 100000 0 0 0
B: ABS=6630000 1000003
... so definitely "type b"; then by doing `find /sys | grep uevent` and comparing as in the porting guide, I put together this file as device/bq/vegetahd/mr_init_devices.c:
Code:
#include <stdlib.h>
// These are paths to folders in /sys which contain "uevent" file
// need to init this device.
// MultiROM needs to init framebuffer, mmc blocks, input devices,
// some ADB-related stuff and USB drives, if OTG is supported
// You can use * at the end to init this folder and all its subfolders
const char *mr_init_devices[] =
{
"/sys/devices/platform/mtkfb.0/graphics/fb0",
"/sys/devices/platform/mtkfb.0",
"/sys/devices/platform/mtk-msdc.0",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0boot0",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0boot1",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0rpmb",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p1",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p2",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p3",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p4",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p5",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p6",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p7",
"/sys/devices/platform/mtk-msdc.1",
"/sys/devices/platform/mtk-msdc.1/mmc_host/mmc1",
"/sys/devices/platform/mtk-msdc.1/mmc_host/mmc1/mmc1:0007",
"/sys/devices/platform/mtk-msdc.1/mmc_host/mmc1/mmc1:0007/block/mmcblk1/mmcblk1p1",
"/sys/devices/platform/mtk-msdc.1/mmc_host/mmc1/mmc1:0007/block/mmcblk1",
"/sys/bus/mmc/uevent",
"/sys/bus/mmc/drivers/mmcblk/uevent",
"/sys/bus/sdio/uevent",
"/sys/devices/virtual/input/*",
"/sys/devices/virtual/misc/uinput",
"/sys/devices/platform/mtk-tpd",
"/sys/devices/platform/mtk-kpd",
"/sys/devices/platform/mtk-kpd/input/input0",
"/sys/devices/platform/mtk-kpd/input/input0/event0",
"/sys/devices/platform/mtk-kpd/misc/mtk-kpd",
// for adb
"/sys/devices/virtual/tty/ptmx",
"/sys/devices/virtual/misc/android_adb",
"/sys/devices/virtual/android_usb/android0/f_adb",
"/sys/bus/usb",
NULL // must be NULL-terminated
}
Then I inspected boot.img of the stock Android firmware:
Code:
$ /path/to/bootimg_tools/boot_info /path/to/bq/2.1.0_20151104-0859_E5HD_bq-FW/boot.img
Page size: 2048 (0x00000800)
Kernel size: 3747904 (0x00393040)
Ramdisk size: 615529 (0x00096469)
Second size: 0 (0x00000000)
Board name: fbcdadc
Command line: ''
Base address: 2147483648 (0x80000000)
... and also did:
Code:
mkdir device/bq/vegetahd/mrom-infos/
wget raw.githubusercontent.com/Tasssadar/device_asus_grouper/cm-10.2-mrom/mrom_infos/ubuntu_touch.txt -O device/bq/vegetahd/mrom-infos/ubuntu_touch.txt
... and confirmed paths, and could finally add this to device/bq/vegetahd/BoardConfig.mk :
Code:
#MultiROM config. MultiROM also uses parts of TWRP config
MR_INPUT_TYPE := type_b
MR_INIT_DEVICES := device/bq/vegetahd/mr_init_devices.c
MR_RD_ADDR := 0x82500000
MR_DPI := hdpi
MR_DPI_FONT := 216
MR_FSTAB := device/bq/vegetahd/recovery/etc/twrp.fstab
MR_KEXEC_MEM_MIN := 0x85000000
MR_INFOS := device/bq/vegetahd/mrom_infos
Here, if I run ... make ... (after first exiting the old terminal shell, and repeating envsetup.sh / lunch in a new one), I get "build/core/base_rules.mk:103: *** user tag detected on new module - user tags are only supported on legacy modules. Stop." So, I did these changes:
Code:
# bootable/recovery/Android.mk:
LOCAL_MODULE := recovery
LOCAL_MODULE_TAGS := optional # add
# bootable/recovery/tests/Android.mk:
LOCAL_MODULE := asn1_decoder_test
LOCAL_MODULE_TAGS := optional # add
Then, a ... make ... at this point fails with: "make: *** No rule to make target `out/target/product/vegetahd/system/xbin/busybox', needed by `out/target/product/vegetahd/obj/SHARED_LIBRARIES/libbmlutils_intermediates/teamwin'. Stop.".
Here I found "[DEV]How to compile TWRP touch recovery - Pg. 150 | Android Development and Hacking" ( forum.xda-developers.com/showthread.php?p=65556586 ), and I downloaded busybox.zip from that page - and did:
Code:
AOSP$ unzip busybox.zip
AOSP$ mv busybox external/
Now, the ... make ... at this point is a bit funny, because it will exit not reporting an error, as if it finished:
Code:
AOSP$ ANDROID_PRE_BUILD_PATHS=/path/to/jdk1.6.0_45/bin \
ANDROID_JAVA_TOOLCHAIN=/path/to/jdk1.6.0_45/bin \
JAVA_HOME=/path/to/jdk1.6.0_45 \
PATH=/path/to/jdk1.6.0_45/bin:$PATH \
make -j3 recoveryimage
...
GEN include/usage_compressed.h
GEN include/applet_tables.h
HOSTCC applets/usage_pod
GEN include/bbconfigopts.h
CC applets/applets.o
LD applets/built-in.o
make[1]: Leaving directory `/media/Data1/src/AOSP/external/busybox'
AOSP$
But here it is apparently just done with applets in busybox! So, I try running ... make ... again, and get:
Code:
external/busybox/android/librpc/bindresvport.c:41:13: error: conflicting types for '__set_errno'
bionic/libc/include/errno.h:45:15: note: previous declaration of '__set_errno' was here
This I fix by changing external/selinux/libsepol/include to external/libsepol/include in:
Code:
# external/busybox/Android.mk:
BUSYBOX_C_INCLUDES = \
$(BB_PATH)/include $(BB_PATH)/libbb \
bionic/libc/private \
bionic/libm/include \
bionic/libc \
bionic/libm \
libc/kernel/common \
external/libselinux/include \
external/libsepol/include \
...
... and at this point, ... make ... will fail with:
Code:
external/busybox/android/librpc/pmap_rmt.c:235:8: warning: implicit declaration of function 'inet_makeaddr' [-Wimplicit-function-declaration]
external/busybox/android/librpc/pmap_rmt.c:238:8: warning: implicit declaration of function 'inet_netof' [-Wimplicit-function-declaration]
external/busybox/android/librpc/pmap_rmt.c:235:19: error: incompatible types when assigning to type 'struct in_addr' from type 'int'
Here I found stackoverflow.com/questions/27762475/incompatible-types-when-assigning-to-type-struct-in-addr-from-type-int/27763398, which notes:
The error message is misleading, the function is simply missing from earlier versions of the NDK.
Click to expand...
Click to collapse
So, as a final try, I tried forcing a newer NDK through an environment variable, as in:
Code:
NDK_HOME=/path/to/android-ndk-r10e \
ANDROID_PRE_BUILD_PATHS=/path/to/jdk1.6.0_45/bin \
ANDROID_JAVA_TOOLCHAIN=/path/to/jdk1.6.0_45/bin \
JAVA_HOME=/path/to/jdk1.6.0_45 \
PATH=/path/to/jdk1.6.0_45/bin:$PATH \
make -j3 recoveryimage
... but this fails in exactly the same manner (with "implicit declaration of function 'inet_makeaddr'", etc).
At this point, I really don't know what I should do... Should I:
Try to use the BQ Kernel sources for this device (even if mentioned above, I haven't used them anywhere yet) somewhere (say clone them in the Android tree)? If so - where?
Try to find a busybox for AOSP 4.1.2? If so - what version is OK, and where do I find it?
Try to bump the AOSP repo version up from 4.1.2? If so, what would be the minimum version required so this builds - and would I have to wait 14+ hours again?
... or is there anything else I could try?
Again, I'm mostly interested in building MultiROM and the recovery image (TWRP?) required for it on the Aquaris E5 - but it would be nice to know how to build TWRP proper recovery image as well...
Thanks in advance for any hints...
Me too
I am planning on doing almost the exact same thing you're trying! But I have a few questions:
Have you tried adding --depth 1 to your repo command to reduce the download time?
Have you seen https://forum.xda-developers.com/showthread.php?t=2329228 ? Mainly the local manifest, also to reduce download time
Why do you want to use the lowest version possible? The TWRP device tree is for Android 5.1, so I'll be using that version.

Upstream arm64 kernel for Raspberry Pi 3

Hi all
If you just need Raspberry Pi 3 to run headless linux and unleash its full 64bit power then you can compile vanilla kernel (kernel.org) for Raspberry Pi 3 using this tutorial.
YOU NEED TO USE THIS WITH ARM64 LINUX DISTRIBUTION
I don't know if it's my custom distribution's fault or kernel fault but when I use arm64 kernel on Raspberry Pi's Github then it's panic because fs driver on heavy load.
This tutorial doesn't use u-boot for booting the kernel, instead I use the firmware as it is.
This tutorial has been tested on Ubuntu 16.10, 17.04 host and you just need to copy and paste, it will work.
First of all, you need to setup build environment by using command below (maybe not all of these are necessary but this is how I usually setup my Android build environment and it's work for kernel build too):
Code:
sudo apt update
sudo apt install -y bison bc build-essential flex git-core gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libxml2 libxml2-utils lzop schedtool xsltproc zlib1g-dev g++-multilib gcc-multilib lib32ncurses5-dev lib32z1-dev
Now you need to get the aarch64 toolchain, here I'll use Linaro because it will somewhat improve performance but you can use the gcc-aarch64-linux-gnu if you want.
This code will download Linaro 6.3.1 and extract it to /opt/ for use later on:
Code:
wget http://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz
sudo tar -xvf gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz -C /opt/
Now you need to clone kernel source code, this will takes some time on slow connection even though I did make it only clone the latest commit (shadow clone) but without clone the whole history:
Code:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git --depth=1 -b linux-4.10.y
You can change the linux-4.10.y to another branch if you want, this branch clone will give you the latest version of that particular kernel version (4.10).
Now start the compilation, here I'm using a build machine with 14 cores, you can replace -j14 with your CPU core number for faster build, don't set it to higher than your real CPU core or it will slow your machine down:
Code:
cd linux-stable
mkdir MODULES BOOT
#
# Export necessary variable
#
export CROSS_COMPILE=/opt/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
export ARCH=arm64
#
# Make arm64 default defconfig
#
make defconfig -j14
#
# You must enable FB_SIMPLE or it will not boot
#
sed -i 's/# CONFIG_FB_SIMPLE is not set/CONFIG_FB_SIMPLE=y/g' .config
#
# Here I enable ethernet driver as built-in because you'll need it in some situation like kernel module not loaded
#
sed -i 's/CONFIG_USB_USBNET=m/CONFIG_USB_USBNET=y/g' .config
sed -i 's/CONFIG_USB_NET_SMSC95XX=m/CONFIG_USB_NET_SMSC95XX=y/g' .config
#
# Disable these heavy module which we will not use it at all
#
sed -i 's/CONFIG_DRM_NOUVEAU=m/# CONFIG_DRM_NOUVEAU is not set/g' .config
sed -i 's/CONFIG_DRM_TEGRA=m/# CONFIG_DRM_TEGRA is not set/g' .config
#
# Making the modules, copy it to ./MODULES
#
make modules -j14
make modules_install -j14 INSTALL_MOD_PATH=MODULES/
#
# Making the kernel and dtbs
#
make Image dtbs -j14
#
# It's compiled, copy it to ./BOOT for easy to work with
#
cp ./arch/arm64/boot/Image ./BOOT/Image
cp ./arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dtb ./BOOT/
You should have all the necessary file from build kernel in 2 directory (BOOT, MODULES) if nothing wrong happens.
[INSTALL KERNEL]
Plug the MicroSDcard of Raspberry Pi 3 to your computer and copy ./BOOT/Image and ./BOOT/bcm2837-rpi-3-b.dtb to partition #1 (vfat)
Edit the config.txt and add lines below, edit if already exist, this will: active arm64 mode, use device_tree for boot kernel, use kernel named Image:
Code:
arm_control=0x200
device_tree=bcm2837-rpi-3-b.dtb
kernel=Image
[INSTALL MODULES]
Now you have to mount the Raspberry Pi 3 Linux OS partition (usually is partition #2) to your system to copy file into it
Make backup and delete every directory in /lib/modules/ of OS partition
Copy ./MODULES/lib/modules/* to /lib/modules/ of OS partition using root
Now it's basically done, unmount/safely eject the sdcard and plug it to your Raspberry Pi 3, boot it up.
Modules might not loaded automatically, run this command on Raspberry Pi 3 shell:
Code:
sudo find "/lib/modules" -mindepth 1 -maxdepth 1 -type d | while read DIR; do echo ${DIR}; BASEDIR=$(basename "${DIR}"); echo " *** depmod ${BASEDIR}"; depmod -b "/" -a "${BASEDIR}"; done
Now modules should be loaded and will be loaded automatically on next boot.
Disclaimer:
- Only Kernel 4.9 and above are supported Raspberry Pi 3 AArch64
- Wifi/Bluetooth will not work since driver still haven't implemented
- Other function might not work
Tested/working:
- USB
- Ethernet
- HDMI
- UART
- GPU acceleration

Help including SuperSU and su binaries in stock ROM.

I would like some help in modifying my stock rom to include the SuperSU apk and all five su binaries (su, daemonsu, sukernel, supolicy and suinit).
I am aware that there are multiple tutorials out there for this kind of thing but what I'm trying to do requires the system be repacked into a sparse image to flash through fastboot as the phone has no TWRP build available.
Thank You.
Bythos73 said:
I would like some help in modifying my stock rom to include the SuperSU apk and all five su binaries (su, daemonsu, sukernel, supolicy and suinit).
I am aware that there are multiple tutorials out there for this kind of thing but what I'm trying to do requires the system be repacked into a sparse image to flash through fastboot as the phone has no TWRP build available.
Thank You.
Click to expand...
Click to collapse
Hello, you can unzip the flashable SuperSu zip and take a look at the update-binary script, this will shed some light on how the installation works, for example this is an excerpt taken from version 2.82:
Code:
#!/sbin/sh
#
# SuperSU installer ZIP
# Copyright (c) 2012-2017 - Chainfire, CCMT
#
# ----- GENERIC INFO ------
#
# The following su binary versions are included in the full package. Each
# should be installed only if the system has the same or newer API level
# as listed. The script may fall back to a different binary on older API
# levels. supolicy are all ndk/pie/19+ for 32 bit, ndk/pie/20+ for 64 bit.
#
# binary ARCH/path build type API
#
# arm-v5te arm ndk non-pie 7+
# x86 x86 ndk non-pie 7+
#
# x86 x86 ndk pie 17+ (su.pie, naming exception)
# arm-v7a armv7 ndk pie 17+
# mips mips ndk pie 17+
#
# arm64-v8a arm64 ndk pie 20+
# mips64 mips64 ndk pie 20+
# x86_64 x64 ndk pie 20+
#
# Non-static binaries are supported to be PIE (Position Independent
# Executable) from API level 16, and required from API level 20 (which will
# refuse to execute non-static non-PIE).
#
# The script performs several actions in various ways, sometimes
# multiple times, due to different recoveries and firmwares behaving
# differently, and it thus being required for the correct result.
#
# Overridable variables (shell):
# BIN - Location of architecture specific files (native folder)
# COM - Location of common files (APK folder)
# LESSLOGGING - Reduce ui_print logging (true/false)
# NOOVERRIDE - Do not read variables from /system/.supersu or
# /data/.supersu
#
# Overridable variables (shell, /system/.supersu, /cache/.supersu,
# /data/.supersu):
# SYSTEMLESS - Do a system-less install? (true/false, 6.0+ only)
# PATCHBOOTIMAGE - Automatically patch boot image? (true/false,
# SYSTEMLESS only)
# BOOTIMAGE - Boot image location (PATCHBOOTIMAGE only)
# STOCKBOOTIMAGE - Stock boot image location (PATCHBOOTIMAGE only)
# BINDSYSTEMXBIN - Poor man's overlay on /system/xbin (true/false,
# SYSTEMLESS only)
# PERMISSIVE - Set sepolicy to fake-permissive (true/false, PATCHBOOTIMAGE
# only)
# KEEPVERITY - Do not remove dm-verity (true/false, PATCHBOOTIMAGE only)
# KEEPFORCEENCRYPT - Do not replace forceencrypt with encryptable (true/
# false, PATCHBOOTIMAGE only)
# REMOVEENCRYPTABLE - Remove the encryptable flag, needed on newer
# Samsung devices to disable forced encryption
# (true/false, PATCHBOOTIMAGE only)
# FRP - Place files in boot image that allow root to survive a factory
# reset (true/false, PATCHBOOTIMAGE only). Reverts to su binaries
# from the time the ZIP was originall flashed, updates are lost.
# Shell overrides all, /data/.supersu overrides /cache/.supersu overrides
# /system/.supersu
#
# Note that if SELinux is set to enforcing, the daemonsu binary expects
# to be run at startup (usually from install-recovery.sh, 99SuperSUDaemon,
# app_process, or init.supersu.rc) from u:r:supersu:s0 (7.0+), u:r:init:s0 or
# u:r:kernel:s0 contexts. Depending on the current policies, it can also
# deal with u:r:init_shell:s0 and u:r:toolbox:s0 contexts. Any other context
# will lead to issues eventually.
#
# ----- "SYSTEM" INSTALL -----
#
# "System" install puts all the files needed in /system and does not need
# any boot image modifications. Default install method pre-Android-6.0
# (excluding Samsung-5.1).
#
# Even on Android-6.0+, the script attempts to detect if the current
# firmware is compatible with a system-only installation (see the
# "detect_systemless_required" function), and will prefer that
# (unless the SYSTEMLESS variable is set) if so. This will catch the
# case of several custom ROMs that users like to use custom boot images
# with - SuperSU will not need to patch these. It can also catch some
# locked bootloader cases that do allow security policy updates.
#
# To install SuperSU properly, aside from cleaning old versions and
# other superuser-type apps from the system, the following files need to
# be installed:
#
# API source target chmod chcon required
#
# 7-19 common/Superuser.apk /system/app/Superuser.apk 0644 u:object_r:system_file:s0 gui
# 20+ common/Superuser.apk /system/app/SuperSU/SuperSU.apk 0644 u:object_r:system_file:s0 gui
#
# 17+ common/install-recovery.sh /system/etc/install-recovery.sh 0755 *1 required
# 17+ /system/bin/install-recovery.sh (symlink to /system/etc/...) required
# *1: same as /system/bin/toolbox: u:object_r:system_file:s0 if API < 20, u:object_r:toolbox_exec:s0 if API >= 20
#
# 7+ ARCH/su *2 /system/xbin/su *3 u:object_r:system_file:s0 required
# 7+ /system/bin/.ext/.su *3 u:object_r:system_file:s0 gui
# 17+ /system/xbin/daemonsu 0755 u:object_r:system_file:s0 required
# *2: su.pie for 17+ x86(_32) only
# *3: 06755 if API < 18, 0755 if API >= 18
#
# 19+ ARCH/supolicy /system/xbin/supolicy 0755 u:object_r:system_file:s0 required
# 19+ ARCH/libsupol.so /system/lib(64)/libsupol.so 0644 u:object_r:system_file:s0 required
#
# 21+ /system/bin/app_process32 *5 /system/bin/app_process32_original 0755 u:object_r:zygote_exec:s0 required
# 21+ /system/bin/app_process64 *5 /system/bin/app_process64_original 0755 u:object_r:zygote_exec:s0 required
# 21+ /system/bin/app_processXX *5 /system/bin/app_process_init 0755 u:object_r:system_file:s0 required
# 21+ /system/bin/app_process (symlink to /system/xbin/daemonsu) required
# 21+ *5 /system/bin/app_process32 (symlink to /system/xbin/daemonsu) required
# 21+ *5 /system/bin/app_process64 (symlink to /system/xbin/daemonsu) required
# *5: Only do this for the relevant bits. On a 64 bits system, leave the 32 bits files alone, or dynamic linker errors
# will prevent the system from fully working in subtle ways. The bits of the su binary must also match!
#
# 17+ common/99SuperSUDaemon *6 /system/etc/init.d/99SuperSUDaemon 0755 u:object_r:system_file:s0 optional
# *6: only place this file if /system/etc/init.d is present
#
# 17+ 'echo 1 >' or 'touch' *7 /system/etc/.installed_su_daemon 0644 u:object_r:system_file:s0 optional
# *7: the file just needs to exist or some recoveries will nag you. Even with it there, it may still happen.
#
# It may seem some files are installed multiple times needlessly, but
# it only seems that way. Installing files differently or symlinking
# instead of copying (unless specified) will lead to issues eventually.
#
# After installation, run '/system/xbin/su --install', which may need to
# perform some additional installation steps. Ideally, at one point,
# a lot of this script will be moved there.
#
# The included chattr(.pie) binaries are used to remove ext2's immutable
# flag on some files. This flag is no longer set by SuperSU's OTA
# survival since API level 18, so there is no need for the 64 bit versions.
# Note that chattr does not need to be installed to the system, it's just
# used by this script, and not supported by the busybox used in older
# recoveries.
#
# ----- "SYSTEM-LESS" INSTALL -----
#
# "System-less" install requires a modified boot image (the script can patch
# many boot images on-the-fly), but does not touch /system at all. Instead
# it keeps all the needed files in an image (/data/su.img) which is mounted
# to /su. Default install method on all Android-6.0+ and Samsung-5.1+
# devices.
#
# Note that even on 6.0+, system compatibility is checked. See the "SYSTEM"
# install section above.
#
# An ext4 image is created as /data/su.img, or /cache/su.img if /data could
# not be mounted. Similarly, the APK is placed as either /data/SuperSU.apk
# or /cache/SuperSU.apk. This is so we are not dependent on /data decryption
# working in recovery, which in the past has proved an issue on brand-new
# Android versions and devices.
#
# /sbin/launch_daemonsu.sh, which is added a service to init.rc, will mount
# the image at /su, and launch daemonsu from /su/bin/daemonsu. But before it
# does that, it will try to merge /data/su.img and /cache/su.img (leading),
# if both are present. It will also try to install the SuperSU APK.
#
# Files are expected at the following places (/su being the mountpoint of
# the ext4 image):
#
# API source target chmod chcon required
#
# 22+ common/Superuser.apk /[data|cache]/SuperSU.apk 0644 u:object_r:system_file:s0 gui
#
# 22+ ARCH/su *1 /su/bin/su 0755 u:object_r:system_file:s0 required
# 22+ /su/bin/daemonsu 0755 u:object_r:system_file:s0 required
# *1: su.pie for 17+ x86(_32) only
#
# 22+ ARCH/supolicy /su/bin/supolicy_wrapped 0755 u:object_r:system_file:s0 required
# 22+ /su/bin/su (symlink) *2 /su/bin/supolicy 0755 u:object_r:system_file:s0 required
# 22+ ARCH/libsupol.so /su/lib/libsupol.so 0644 u:object_r:system_file:s0 required
# *2: when called this way, su sets the correct LD_LIBRARY_PATH and calls supolicy_wrapped
#
# 22+ ARCH/sukernel /su/bin/sukernel 0755 u:object_r:system_file:s0 required
#
# These files are automatically created on launch by daemonsu as needed:
# 22+ /system/bin/sh /su/bin/sush 0755 u:object_r:system_file:s0 required
# 22+ /system/bin/app_process[64] /su/bin/app_process 0755 u:object_r:system_file:s0 required
#
# These files are injected into the boot image ramdisk:
# 22+ common/launch_daemonsu.sh /sbin/launch_daemonsu.sh 0700 u:object_r:rootfs:s0 required
#
# On devices where / is in the system partition:
# 22+ ARCH/suinit /init 0750 u:object_r:rootfs:s0 required
#
# The automated boot image patcher included makes the following modifications
# to the ramdisk:
#
# - Uses the supolicy tool to patch the sepolicy file
# - Injects /sbin/launch_daemon.sh
# - Creates /su
# - Removes /verity_key
# - Patches /*fstab*
# --- Removes support_scfs and verify flags
# --- Changes forceencrypt/forcefdeorfbe into encryptable
# --- Set ro mounts to use noatime
# - Patches /init.rc
# --- Removes 'setprop selinux.reload_policy' occurences
# --- Adds a SuperSU:PATCH marker with the version of the sukernel tool
# --- Adds a SuperSU:STOCK marker listed the SHA1 of the original boot image
# - Adds /init.supersu.rc
# --- Adds a sukernel.mount property trigger that mounts /data/su.img to /su
# --- Adds the daemonsu service that launches /sbin/launch_daemon.sh
# --- Adds exec /sbin/launch_daemonsu.sh on post-fs-data
# - Patches /init.environ.rc
# --- Adds PATH variable if it does not exist
# --- Prepends /su/bin to the PATH variable
# - Patches /*.rc
# --- Adds a seclabel to services and execs that are missing one
# - In case the device has the root directory inside the system partition:
# --- /system_root contents are copied to /boot
# --- All files mentioned above are modified in /boot instead of /
# --- /boot/*fstab* is modified to mount / to /system_root, and
# bind-mount /system to /system_root/system
# --- Kernel binary is patched to load from initramfs instead of system
#
# In case this documentation becomes outdated, please note that the sukernel
# tool is very chatty, and its output tells you exactly what it is doing
# and how. In TWRP, you can view this output by catting /tmp/recovery.log
# after flashing the ZIP.
#
# The boot image patcher creates a backup of the boot image it patches, for
# future restoration. It cannot re-patch a patched boot image, it will restore
# the previous boot image first. /[data|cache]/stock_boot_*.gz
#
# The boot image patcher currently only supports GZIP compressed ramdisks, and
# boot images in the standard Android boot image format.
#
# During boot image patch, /data/custom_ramdisk_patch.sh will be called,
# with the name of the ramdisk cpio file as parameter. The script must
# replace the input file and return a 0 exit code.
#
# Just before flashing, the boot image patcher will call
# /data/custom_boot_image_patch.sh with the name of the patched boot image
# as parameter. A device-specific patcher can further patch the boot image
# if needed. It must replace the input file and return a 0 exit code.
OUTFD=$2
ZIP=$3
getvar() {
local VARNAME=$1
local VALUE=$(eval echo \$"$VARNAME");
for FILE in /data/.supersu /cache/.supersu /system/.supersu; do
if [ -z "$VALUE" ]; then
LINE=$(cat $FILE 2>/dev/null | grep "$VARNAME=")
if [ ! -z "$LINE" ]; then
VALUE=${LINE#*=}
fi
fi
done
eval $VARNAME=\$VALUE
}
readlink /proc/$$/fd/$OUTFD 2>/dev/null | grep /tmp >/dev/null
if [ "$?" -eq "0" ]; then
# rerouted to log file, we don't want our ui_print commands going there
OUTFD=0
# we are probably running in embedded mode, see if we can find the right fd
# we know the fd is a pipe and that the parent updater may have been started as
# 'update-binary 3 fd zipfile'
for FD in `ls /proc/$$/fd`; do
readlink /proc/$$/fd/$FD 2>/dev/null | grep pipe >/dev/null
if [ "$?" -eq "0" ]; then
ps | grep " 3 $FD " | grep -v grep >/dev/null
if [ "$?" -eq "0" ]; then
OUTFD=$FD
break
fi
fi
done
fi
ui_print_always() {
echo -n -e "ui_print $1\n" >> /proc/self/fd/$OUTFD
echo -n -e "ui_print\n" >> /proc/self/fd/$OUTFD
}
if [ -z "$LESSLOGGING" ]; then
LESSLOGGING=false
fi
UI_PRINT_LAST=""
ui_print() {
if (! $LESSLOGGING); then
UI_PRINT_LAST="$1"
ui_print_always "$1"
fi
}
ui_print_less() {
if ($LESSLOGGING); then
ui_print_always "$1"
fi
}
ch_con() {
LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toybox chcon -h u:object_r:system_file:s0 $1 1>/dev/null 2>/dev/null
LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox chcon -h u:object_r:system_file:s0 $1 1>/dev/null 2>/dev/null
LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toolbox chcon -h u:object_r:system_file:s0 $1 1>/dev/null 2>/dev/null
chcon -h u:object_r:system_file:s0 $1 1>/dev/null 2>/dev/null
LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toybox chcon u:object_r:system_file:s0 $1 1>/dev/null 2>/dev/null
LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox chcon u:object_r:system_file:s0 $1 1>/dev/null 2>/dev/null
LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toolbox chcon u:object_r:system_file:s0 $1 1>/dev/null 2>/dev/null
chcon u:object_r:system_file:s0 $1 1>/dev/null 2>/dev/null
}
ch_con_ext() {
LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toybox chcon $2 $1 1>/dev/null 2>/dev/null
LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox chcon $2 $1 1>/dev/null 2>/dev/null
LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toolbox chcon $2 $1 1>/dev/null 2>/dev/null
chcon $2 $1 1>/dev/null 2>/dev/null
}
Thanks for the quick response. I have attempted to copy some of the files stated in excerpt to my system image but it seems that I might have missed a few. But I see it stating some chcon commands so I'm just wondering if it'd be possible to chcon the files needed on a linux pc and have it work.
Bythos73 said:
Thanks for the quick response. I have attempted to copy some of the files stated in excerpt to my system image but it seems that I might have missed a few. But I see it stating some chcon commands so I'm just wondering if it'd be possible to chcon the files needed on a linux pc and have it work.
Click to expand...
Click to collapse
I'm not sure what will happen if you run those chcon commands, what happened when you tried it?
Yup, this manual way may be a bit tricky
http://su.chainfire.eu/#embed said:
6. Embedding
6.1. Files
All the files you need are in the latest SuperSU flashable ZIP. The latest 'stable' build can always be retrieved from my server, for the latest 'beta' release you need to check the beta thread in the SuperSU forums.
The installation script inside the ZIP is META-INF/com/google/android/update-binary. This is not a binary as the name suggests, but a shell script, and the standard update ZIP's updater-script file is just a dummy.
This script has comments which document which files go where on which API level, and what their file permissions, ownerhips, and security labels must be. If you have done this exactly right, SuperSU will not complain when you open the app after booting.
6.2. Custom ROMs
It is non-trivial to include SuperSU exactly right on your own. It is therefore often easiest to include the latest SuperSU ZIP inside your own flashable ZIP, and chain its installation.
Click to expand...
Click to collapse
Can you tell us a bit more about your device model & android version, and which files you copied/commands you ran so far?
What errors if any do you get after flashing your modified img?
I secretly hope a custom recovery exists for your device, or porting one proves easier :fingers-crossed:
I'm repacking the image now using img2simg for my first boot attempt.
I have an Alcatel 3 5052A, Device CodeName A3A running Android Oreo 8.1.0. So far I don't believe I can get a custom recovery for this device as the line of devices that this phone was released with seem to have a bootloader which doesn't boot unsigned images, nevermind the fact that it's impossible to flash any partition other than system through fastboot. It's a real pain. Thankfully it does boot GSIs like Phh-Treble so not all hope is lost on that front.
I've copied the su and supolicy binaries, I got daemonsu by copying the su bin, I also copied the SuperSU apk and the libsupol.so library into all of their respective directories.
It has booted but no su, and SuperSU was not in the Launcher so I'm gonna retry it.
Don't give up! there are lots of avenues yet to explore if you want to give the manual method a rest for a while.
What do you get when you try unlocking the bootloader from fastboot?
Are you familiar with SP Flash tools? This is an alternative way to flash images onto various MTK devices.

General Guide for building TWRP

TWRP for a12s
=============
Mod Edit: TG link removed.
git config --global user.email "your email"
git config --global user.name "your name"
Basic Device Tree
==================
mkdir TWRP
cd TWRP
git init
git clone https://github.com/twrpdtgen/twrpdtgen
pip3 install twrpdtgen
sudo apt install cpio
copy stock recovery.img to ~/TWRP/twrpdtgen
cd twrpdtgen
python3 -m twrpdtgen recovery.img
rename ~/TWRP/twrpdtgen/output/samsung/a12s/omni_a12s.mk to twrp_a12s.mk
delete vendorsetup.sh
Make a copy of recovery.fstab and rename to twrp.flags
Move both files recovery.fstab and twrp.flags to recovery/root/system/etc
(create these folders)
open twrp_a12s.mk and
1. delete the 3 lines below # Inherit from those products, Most specific first.
replace those 3 lines with this
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base.mk)
2. delete $(call inherit-product, vendor/omni/config/gsm.mk)
3. change omni to twrp (2 places)
open AndroidProducts.mk
change omni to twrp (4 spots)
Optional Extras
==================
To add extra options to recovery you can add theses lines to
boardconfig.mk
• # remove TrueType fonts
• TW_DISABLE_TTF:= true
• # exclude mtp from twrp (disable if you are not able to fix it device/kernel side, saves some space)
• TW_EXCLUDE_MTP := true
• # screen will stay awake
• TW_NO_SCREEN_TIMEOUT := true
• # needed on devices without a recovery partition (some devices have recovery included in boot.img)
• TW_HAS_NO_RECOVERY_PARTITION := true
• # removes the reboot option to boot into bootloader, needed e.g. on samsung devices which use Download mode instead
• TW_NO_REBOOT_BOOTLOADER := true
• # add an option in reboot menu to reboot into Download Mode
• TW_HAS_DOWNLOAD_MODE := true
• # some devices don't have a temp sensor, disable in such case to stop spamming recovery.log
• TW_NO_CPU_TEMP := true
• # recursive delete by default instead fotmatting (available optional inside recovery settings too)
• TW_ALWAYS_RMRF := true
• # system won't be unmounted,
• TW_NEVER_UNMOUNT_SYSTEM := true
• # don't blank screen (available optional inside recovery settings too)
• TW_NO_SCREEN_BLANK := true
• # ToyBox (disables busybox?)
• TW_USE_TOOLBOX := true
• # include f2fs support (make sure your kernel supports f2fs!)
• TARGET_USERIMAGES_USE_F2FS := true
• TW_DEVICE_VERSION : = Your Nikname or else
Establish Android Building Environment
=======================================
cd ~
sudo apt install git aria2 -y
git clone https://gitlab.com/OrangeFox/misc/scripts
cd scripts
sudo bash setup/android_build_env.sh
sudo bash setup/install_android_sdk.sh
• Make a directory called ~/a12s-twrp
cd ~/a12s-twrp
repo init --depth=1 -u https://github.com/minimal-manifest-twrp/platform_manifest_twrp_aosp.git -b twrp-11
repo sync -c --no-clone-bundle --no-tags --optimized-fetch --prune --force-sync -j4
copy ~/TWRP/twrpdtgen/output/samsung to /a12s-twrp/device
Building
========
. build/envsetup.sh
lunch twrp_a12s-eng
mka recoveryimage –j4
Recovery.img at out/Samsung/a12s/...img
Note: This LastPart Failed For Me For Lack Of RAM In My VB
To Add Things To Your Twrp, You Can Find Them On Experienced Dev's Githubs.
For Example
topser9 - Overview
Kernels for Exynos 7884B | 7904 | 9610 | 9611. topser9 has 16 repositories available. Follow their code on GitHub.
github.com
mohammad92 - Overview
mohammad92 has 172 repositories available. Follow their code on GitHub.
github.com
crazo7924 - Overview
Android developer. crazo7924 has 47 repositories available. Follow their code on GitHub.
github.com
Hello! Even though this tutorial is for a specific device (I think, please correct me if i"m wrong), will this work for basically any device? And will this work for devices running Android 11 and 12?
SM-A032F / DS

Categories

Resources