Working vim 8.0.133 install script + binary for android - Android Software/Hacking General [Developers Only]

Hi guys,
I've created a working vim install script for android devices. need root. The vim binary comes from Lineage os that compiled it. To install vim, you have to extract the zip file attached below and run in a root shell install.sh.
To uninstall, run uninstall.sh
REQUIREMENTS :
You need busybox, root access and optionnaly rate this thread 5 stars.
Download link : https://drive.google.com/file/d/163u3GjVSbovic07MaVlfSORqMeAjvgjQ/view?usp=drivesdk
PS : Don't hesitate to thanks every xda members who helped you. Thanks for understanding.

Reserved

Not working on android 5
Error message:
PHP:
127|[email protected]:/data/data/com.termux/files/home # vim
WARNING: linker: vim: unused DT entry: type 0x6ffffef5 arg 0x1458
WARNING: linker: vim: unused DT entry: type 0x6ffffffe arg 0x161c
WARNING: linker: vim: unused DT entry: type 0x6fffffff arg 0x2
CANNOT LINK EXECUTABLE: empty/missing DT_HASH in "vim" (built with --hash-style=gnu?)
And where should one have the vim files, it seems to be a bit unfinished project.
Os : Android Lollipop 5.1.1 sdk22, arch ARMv7 32 mode.

Related

Got agcc, got Android source compiled, got Hello, World to work. How to do bash?

How do I port bash? DO I just export CC=~/bin/agcc and run make?
Is this the same with any console application I wish to port onto Android?
Where I'm at:
I got Hello, world! to work. The a.out binary gave this output warning during ld linkage - but the a.out binary ran on my Android phone under console emulation for sure!
Code:
[email protected]:~/mydroid/xdev$ cat hello.c
#include <stdio.h>
int main() {
printf("Hello, world!\n");
}
[email protected]:~/mydroid/xdev$ agcc hello.c
/home/kinesis/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/../../../../arm-eabi/bin/ld: warning: /tmp/ccpQIsji.o uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail
[email protected]:~/mydroid/xdev$ file a.out
a.out: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
[email protected]:~/mydroid/xdev$
I can confirm that bash will work using this guide and the CodeSourcery G++ toolkit.
http://www.kbrandt.com/2009/06/how-to-cross-compile-the-bash-shell-for-android-15.html
The joy one feels after executing their own ARM bash binary is priceless.

[Q] executing self-compiled c/c++ code in connectbot: Syntax error: word unexpected

Hi all,
(see at the end for setup and device info)
(remove spaces in URLs since I am not allowed to post real URLs yet)
I am trying to compile my own c/c++ code and run it on my android phone.
I got the android toolchain and the program (hello world, "test" binary) compiles:
./agcc -c -o test hello.cpp
file test
test: ELF 32-bit LSB relocatable, ARM, version 1 (SYSV), not stripped
The program executable is "test". I copy it to my android to /data (since other folders apparently do not have execution permission yielding the "permission denied" error when trying to execute) and do "chmod a+x test"
When I start connectbot on my phone, navigate to /data and do "./test" then I get the error: Syntax error: word unexpected (expecting ")")
As if connectbot would try to execute this binary as a shell script.
In principle, a step-by-step manual how to compile and run c/c++ code on android would be here:
"http: //www . hytherion.com/beattidp/comput/android/linux-on-android.html"
But I get this strange error mentioned above.
any ideas?
setup:
=====
Phone: Samsung Galaxy S2
Android: 2.3.4
Kernel: GINGERBREAD.XWKI4 (rooted, works all fine)
Crosscompile Toolchain: from: ./repo init -u https: // android.googlesource.com/platform/manifest
Using acc script from "http: // plausible.org/andy/agcc"
Exporting: export PATH=[PathToToolchain]/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH
Hello World example:
// hello.cpp
#include <stdio.h>
int main()
{
int a=1;
printf("hello %d",a);
return 0;
}
compiling with: ./agcc -c -o test hello.cpp
bump bump?

[GUIDE] Building a Kernel - Step by step

As requested by many people I decided to make this guide. Unfortunately I want everyone to know that you HAVE to do this in Linux(Ubuntu 12.04 in this case). You could do this in Cygwin but you have to look for other guides for that as I have never used it and don't know much about it.
Happy building~~!
Requirements
64bit Ubuntu
Python 2.4--2.7
Code:
sudo apt-get install python
Git 1.7 or newer
Code:
sudo apt-get install git-core
Installing Android SDK
Download the SDK here: http://developer.android.com/sdk/index.html
Extract the SDK and place it in your home directory.
I renamed my SDK to android-sdk to make it easier to navigate to.
Go to your home folder, press Ctrl+H to show hidden files, and open up your .bashrc file.
Add these lines at the bottom of the file(Change path according to your SDK dir):
Code:
# Android tools
export PATH=${PATH}:~/android-sdk/tools
export PATH=${PATH}:~/android-sdk/platform-tools
export PATH=${PATH}:~/bin
Find your .profile file and add this at the bottom of the file:
Code:
PATH="$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools:$PATH"
Check for updates by entering this in terminal:
Code:
android
Install required packages(12.04)
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 lib32ncurses5-dev x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Toolchain and Source
Open your terminal and type :
Code:
mkdir android
cd android
mkdir kernel
Type this to get your toolchains. I used the linaro toolchain in my kernel using DooMLoRD's great prebuilt toolchains.
Code:
git clone git://github.com/DooMLoRD/android_prebuilt_toolchains.git toolchains
Git clone your kernel repo of choice into android/kernel. I shall use arco's 3.0.x kernel repo as reference.
Code:
git clone git://github.com/arco/samsung-kernel-msm7x30.git -b ics-3.0
Any modifications you wish to do should be done here. Like changing cpu frequency, adding governors, patching the kernel etc... I might add some examples later on. Till then please google how to do this.
Click to expand...
Click to collapse
Building The Kernel
Part A. Pre-build Steps
A. Open terminal and change to the root of your kernel directory
B. Type "export ARCH=arm"
C. Type "export CROSS_COMPILE=~/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-"
Part B. The First Build
A. Type "make ariesve_defconfig"
B. Type "make menuconfig" and make the required changes to use any modules you added or similar changes.
C. Type "make -j<maximum number of jobs>"
Part C. Re-Builds
A. Type "make clean"
B. Type "make oldconfig"
C. Type "make -j<maximum number of jobs>"
Part D. Building Modules
You have two options:
A. Type "make modules"
B. Type "make path/to/your/module.ko"
Explanation of all parts :
Part A.(These steps are required every time you close your terminal and re-open it to build again.)
A. Ok shouldn’t need to explain this.
B. This command sets your target architecture.
C. Defines the path to the toolchain we are going to use to compile our kernel. You can change this to point towards whatever toolchain you have downloaded or feel like using, the way it is currently configured it will use the Linaro toolchain that we downloaded above.
Part B.(These only need to be run the first time you build a kernel.)
A. Load's your configuration file.
B. Open up a menu to configure your kernel. It will use the config file you loaded in the previous step as a base.
C. Viola start the build. I typically allow 1 job per core, so on my quad core machine I put "make -j5". Just raising that number will not make your build faster, your processor needs to be able to support the number of jobs you are assigning it.
Part C. (Use the command's when you are building any-time outside of the first)
A. This command gets rid of any old/outdated binaries or modules you compiled before, and let's start fresh. I like to run it every time I build unless my changes are really small and localized.
B. A very awesome command, it parses through what has changed and only prompts you about new options.
C. See the explanation for the above "Part C.".
Part D.(Use these for just building kernel modules.)
A. This will re-build all modules.
B. Will rebuild just the module you need. Very useful when you need to rebuild a WiFi module.
Making the boot.img
Make sure that you got the .ko files that were listed when your kernel got built. These are the modules like the WiFi module that are needed. If you didn't really take notice of where those files are and just want to do it a bit more easily you can use these commands(thanks to Recognized Dev Hacre)
Code:
A. Open a terminal
B. Change to your root kernel directory
C. Type "mkdir ../<your_kernel>_output"
D. Type "cp arch/arm/boot/zImage ../<your_kernel>_output/zImage"
E. Type "find . -name "*.ko" -exec cp {} ../<your_kernel>_output \;"
Normally we would need to do many stuff with mkbootimg but this utility by koush is much easier for you guys. Later on try to learn the normal way though . http://forum.xda-developers.com/showthread.php?t=748106
After flashing the kernel to your device and it boots properly you can now use "adb push" to push the earlier .ko files to system/lib/modules/. Of course, make sure your device is plugged in and has adb debugging on. For example:
Code:
adb push dhd.ko system/lib/modules/dhd.ko
Another way of doing this would be to add a system/lib/modules folder in your kernels flashable zip which in my opinion is easier.
Click to expand...
Click to collapse
Andddd that is it . Pretty easy really even if it might be a bit time consuming. Kernels aren't really an expertise of mine so I probably won't be able to help much but please ask any questions you might need below with your error in a pastebin link ^_^.
Credits:
arco68 for his source
ivendor also for the source
thewadegeek for his kernel tutorial I based on
DooMLoRD for his toolchain
Everyone who requested this tutorial
This tutorial was based off of thewadegeek's tutorial : http://forum.xda-developers.com/showthread.php?t=1748297
Very awesome!
Sick!
Nice tutorial! Add it to the wiki ^^
broodplank1337 said:
Nice tutorial! Add it to the wiki ^^
Click to expand...
Click to collapse
Added to the useful dev guides ^_^ Also threw my CM10 guide in there. Thanks for reminding me.
Very good
Why this error?
david @ david: ~ $ make ariesve_defconfig
make: *** No rule to make target 'ariesve_defconfig. "Alto.
davidteri91 said:
Why this error?
david @ david: ~ $ make ariesve_defconfig
make: *** No rule to make target 'ariesve_defconfig. "Alto.
Click to expand...
Click to collapse
Make sure you are in the correct dir. You should be in android/kernel/(your kernel dir)/
Sent from my GT-I9001 using xda premium
and this error
david @ david-desktop: ~ / $ make-j2 android/kernel/samsung-kernel-msm7x30
scripts / kconfig / conf - silentoldconfig kconfig
*** Error during update of the configuration.
make [2]: *** [silentoldconfig] Error 1
make [1]: *** [silentoldconfig] Error 2
make: *** No rule to make target 'include / config / auto.conf "necessary to" include / config / kernel.release'. Stop.
davidteri91 said:
and this error
david @ david-desktop: ~ / $ make-j2 android/kernel/samsung-kernel-msm7x30
scripts / kconfig / conf - silentoldconfig kconfig
*** Error during update of the configuration.
make [2]: *** [silentoldconfig] Error 1
make [1]: *** [silentoldconfig] Error 2
make: *** No rule to make target 'include / config / auto.conf "necessary to" include / config / kernel.release'. Stop.
Click to expand...
Click to collapse
you are not in your kernel dir i think
Sent from my GT-I9001 using xda app-developers app
EternalFame said:
you are not in your kernel dir i think
Sent from my GT-I9001 using xda app-developers app
Click to expand...
Click to collapse
root @ david-desktop :/ # export home/david/android/kernel/samsung-kernel-msm7x30 ARCH = arm
root @ david-desktop :/ # export home/david/android/kernel/samsung-kernel-msm7x30 CROSS_COMPILE = ~ / android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-
root @ david-desktop :/ # make ariesve_defconfig home/david/android/kernel/samsung-kernel-msm7x30
#
# Configuration written to. Config
#
root @ david-desktop :/ # make-j3 home/david/android/kernel/samsung-kernel-msm7x30
make: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: program not found
scripts / kconfig / conf - silentoldconfig kconfig
make: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: program not found
CHK include / linux / version.h
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 25: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 26: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 25: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 26: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
CHK include / generated / utsrelease.h
HOSTCC scripts / kallsyms
CC scripts / mod / empty.o
/ Bin / sh: 1: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: not found
make [2]: *** [scripts / mod / empty.o] Error 127
make [1]: *** [scripts / mod] Error 2
make [1]: *** is expected to finish other tasks ....
make [1]: "include / generated / mach-types.h 'is up to date.
CC kernel / bounds.s
/ Bin / sh: 1: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: not found
make [1]: *** [kernel / bounds.s] Error 127
make: *** [prepare0] Error 2
make: *** is expected to finish other tasks ....
make: *** [scripts] Error 2
did you install the linaro toolchain?
Sent from my GT-I9001 using xda app-developers app
EternalFame said:
did you install the linaro toolchain?
Sent from my GT-I9001 using xda app-developers app
Click to expand...
Click to collapse
yes
davidteri91 said:
yes
Click to expand...
Click to collapse
Did you make sure you set its path correctly? If it still doesn't work, add this to your .bashrc file in your home dir.(after pressing ctrl+h to see hidden files)
Code:
#Android Toolchain PATH
export ARCH=arm
export CCOMPILE=$CROSS_COMPILE
export CROSS_COMPILE=arm-eabi-
export PATH=$PATH:/home/david/android/kernel/toolchains/linux-x86/toolchain/arm-eabi-linaro-4.6.2/bin
Xistance said:
Did you make sure you set its path correctly? If it still doesn't work, add this to your .bashrc file in your home dir.(after pressing ctrl+h to see hidden files)
Code:
#Android Toolchain PATH
export ARCH=arm
export CCOMPILE=$CROSS_COMPILE
export CROSS_COMPILE=arm-eabi-
export PATH=$PATH:/home/david/android/kernel/toolchains/linux-x86/toolchain/arm-eabi-linaro-4.6.2/bin
Click to expand...
Click to collapse
Nothing
root @ david-desktop :/ # export home/david/android/kernel/samsung-kernel-msm7x30 ARCH = arm
root @ david-desktop :/ # export home/david/android/kernel/samsung-kernel-msm7x30 CROSS_COMPILE = ~ / android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-
root @ david-desktop :/ # make ariesve_defconfig home/david/android/kernel/samsung-kernel-msm7x30
HOSTCC scripts / basic / fixdep
HOSTCC scripts / kconfig / conf.o
SHIPPED scripts / kconfig / zconf.tab.c
SHIPPED scripts / kconfig / lex.zconf.c
SHIPPED scripts / kconfig / zconf.hash.c
HOSTCC scripts / kconfig / zconf.tab.o
HOSTLD scripts / kconfig / conf
#
# Configuration written to. Config
#
root @ david-desktop :/ # make-j2 home/david/android/kernel/samsung-kernel-msm7x30
make: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: program not found
scripts / kconfig / conf - silentoldconfig kconfig
make: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: program not found
CHK include / linux / version.h
UPD include / linux / version.h
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 25: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 26: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 25: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 26: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
CHK include / generated / utsrelease.h
UPD include / generated / utsrelease.h
HOSTCC scripts / genksyms / genksyms.o
SHIPPED scripts / genksyms / lex.c
SHIPPED scripts / genksyms / parse.h
SHIPPED scripts / genksyms / keywords.c
SHIPPED scripts / genksyms / parse.c
HOSTCC scripts / genksyms / lex.o
CC scripts / mod / empty.o
/ Bin / sh: 1: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: not found
make [2]: *** [scripts / mod / empty.o] Error 127
make [1]: *** [scripts / mod] Error 2
make [1]: *** is expected to finish other tasks ....
Generating include / generated / mach-types.h
CC kernel / bounds.s
/ Bin / sh: 1: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: not found
make [1]: *** [kernel / bounds.s] Error 127
make: *** [prepare0] Error 2
make: *** is expected to finish other tasks ....
HOSTCC scripts / genksyms / parse.o
HOSTLD scripts / genksyms / genksyms
make: *** [scripts] Error 2
davidteri91 said:
Nothing
root @ david-desktop :/ # export home/david/android/kernel/samsung-kernel-msm7x30 ARCH = arm
root @ david-desktop :/ # export home/david/android/kernel/samsung-kernel-msm7x30 CROSS_COMPILE = ~ / android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-
root @ david-desktop :/ # make ariesve_defconfig home/david/android/kernel/samsung-kernel-msm7x30
HOSTCC scripts / basic / fixdep
HOSTCC scripts / kconfig / conf.o
SHIPPED scripts / kconfig / zconf.tab.c
SHIPPED scripts / kconfig / lex.zconf.c
SHIPPED scripts / kconfig / zconf.hash.c
HOSTCC scripts / kconfig / zconf.tab.o
HOSTLD scripts / kconfig / conf
#
# Configuration written to. Config
#
root @ david-desktop :/ # make-j2 home/david/android/kernel/samsung-kernel-msm7x30
make: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: program not found
scripts / kconfig / conf - silentoldconfig kconfig
make: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: program not found
CHK include / linux / version.h
UPD include / linux / version.h
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 25: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 26: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 25: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 26: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
CHK include / generated / utsrelease.h
UPD include / generated / utsrelease.h
HOSTCC scripts / genksyms / genksyms.o
SHIPPED scripts / genksyms / lex.c
SHIPPED scripts / genksyms / parse.h
SHIPPED scripts / genksyms / keywords.c
SHIPPED scripts / genksyms / parse.c
HOSTCC scripts / genksyms / lex.o
CC scripts / mod / empty.o
/ Bin / sh: 1: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: not found
make [2]: *** [scripts / mod / empty.o] Error 127
make [1]: *** [scripts / mod] Error 2
make [1]: *** is expected to finish other tasks ....
Generating include / generated / mach-types.h
CC kernel / bounds.s
/ Bin / sh: 1: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: not found
make [1]: *** [kernel / bounds.s] Error 127
make: *** [prepare0] Error 2
make: *** is expected to finish other tasks ....
HOSTCC scripts / genksyms / parse.o
HOSTLD scripts / genksyms / genksyms
make: *** [scripts] Error 2
Click to expand...
Click to collapse
Do you mind PM'ing me the steps you took?
when you say...
"Part A. Pre-build Steps
A. Open terminal and change to the root of your kernel directory"
which directory do you mean exactly? the folder we have created named "kernel"?
It cant be that, so...
and the rest of steps are done over that same directory, right?
i get error at step B if i choose the kernel folder (empty)
Code:
make: *** No rule to make target `ariesv_defconfig'. Stop.
jaggyjags said:
when you say...
"Part A. Pre-build Steps
A. Open terminal and change to the root of your kernel directory"
which directory do you mean exactly? the folder we have created named "kernel"?
It cant be that, so...
and the rest of steps are done over that same directory, right?
i get error at step B if i choose the kernel folder (empty)
Code:
make: *** No rule to make target `ariesv_defconfig'. Stop.
Click to expand...
Click to collapse
Yeah, sorry for the confusion. You are supposed to be in the kernel repo folder(the folder with msm7x30 in its name). Since that folder in necessarily the "kernel" itself I just called it that without thinking about the folders name.
Sent from my GT-I9001 using xda premium
what do mean in line C. Type "make -j<maximum number of jobs>, with maximum number of jobs?
jjaacckk94 said:
what do mean in line C. Type "make -j<maximum number of jobs>, with maximum number of jobs?
Click to expand...
Click to collapse
It means 1-2x the threads your CPU can handle. If you don't know how many just do -j(CPU cores + 1)
Sent from my GT-I9001 using xda premium

backupTA not working on Xperia Z5 Compact

Hi everyone! I posted this in the ask any question thread, but I wonder if I was being timid. So, my first thread! What follows is heartlessly copy/pasted.
I'm going through the process of rooting my Xperia Z5 Compact per these instructions, which requires the use of backupTA.
backupTA is not working, I wish I could post there but I guess I'm not allowed to yet? I'm not 100% sure what adb access is, but running "adb devices" properly finds the phone without error. The phone is downgraded to Android 5.1.1.
running backupTA gives:
Code:
Picking 64-bit version
Running on E5803 on 64-bit platform
Pushing files
Pushing files/dirtycow64 to /data/local/tmp/dirtycow
812 KB/s (9984 bytes in 0.012s)
Pushing files/run-as64 to /data/local/tmp/run-as
990 KB/s (6088 bytes in 0.006s)
Pushing files/exploitta64 to /data/local/tmp/exploitta
1549 KB/s (14280 bytes in 0.009s)
Pushing files/dumpta64 to /data/local/tmp/dumpta
1243 KB/s (10184 bytes in 0.008s)
Pushing files/checkta64 to /data/local/tmp/checkta
1104 KB/s (10184 bytes in 0.009s)
pushing push files/backupTA.sh /data/local/tmp/backupTA.sh
213 KB/s (1094 bytes in 0.005s)
Running scripts to dump ta to "TA_E5803_CB5A29G5P9_2017-11-28950-2901.img" on device
Overwriting run-as
Attempting to dirtycow
Done dirtycowing
Overwriting secondary payload (screenrecord)
Attempting to dirtycow
Attempting to dirtycow
Done dirtycowing
WARNING: linker: /system/bin/run-as: unused DT entry: type 0x6ffffef5 arg 0x288
WARNING: linker: /system/bin/run-as: unused DT entry: type 0x6ffffffe arg 0x6c0
WARNING: linker: /system/bin/run-as: unused DT entry: type 0x6fffffff arg 0x1
CANNOT LINK EXECUTABLE: empty/missing DT_HASH in "/system/bin/run-as" (built with --hash-style=gnu?)
Dumped TA as TA_E5803_CB5A29G5P9_2017-11-28950-2901.img
WARNING: linker: /data/local/tmp/checkta: unused DT entry: type 0x6ffffef5 arg 0x288
WARNING: linker: /data/local/tmp/checkta: unused DT entry: type 0x6ffffffe arg 0x760
WARNING: linker: /data/local/tmp/checkta: unused DT entry: type 0x6fffffff arg 0x1
CANNOT LINK EXECUTABLE: empty/missing DT_HASH in "/data/local/tmp/checkta" (built with --hash-style=gnu?)
Pulling image
Cleaning up
TA Successfully pulled to TA_E5803_CB5A29G5P9_2017-11-28950-2901.img
Press any key to continue . . .
The image file is empty. I've rerun it many times in between several phone restarts, and tried two different Lollipop firmwares (specifically, E5803_Commercial and Journalists_1296-8840_32.0.A.6.152_R4B and E5803_StoreFront_1299-8255_32.0.A.6.200_R2B).
Help?
ben_pcc said:
Hi everyone! I posted this in the ask any question thread, but I wonder if I was being timid. So, my first thread! What follows is heartlessly copy/pasted...
Click to expand...
Click to collapse
I don't have this device but, the following area of the forum is specific to your device.
https://forum.xda-developers.com/z5-compact
With that stated...
The following thread may be helpful to you.
https://forum.xda-developers.com/showthread.php?t=3479532
Good Luck!
~~~~~~~~~~~~~~~
I DO NOT PROVIDE SUPPORT VIA PM UNLESS ASKED/REQUESTED BY MYSELF.
PLEASE KEEP IT IN THE THREADS WHERE EVERYONE CAN SHARE

[GUIDE][Build|Mod|Update][kernel-ranchu][goldfish][5.4][5.10][GKI][ramdisk.img][modules][rootAVD][Android 11(R) 12(S)][AVD][Google Play Store API]

Hello Fellows,
with this Guide I would like to show you a much more easier and reliable way,
on how to build, mod and update your AVDs Kernel with its modules.
By using the official AOSP Build ENV.
The "classic" guide will remain at the end of this thread within a spoiler.
The Development Environment:
Apple Macbook Pro 2015 Dualboot
Linux Mint 19
Android Studio 4.1.3 (Mac OS/Darwin)
Android emulator version 30.5.4.0 (build_id 7243153)
Android SDK Platform-Tools (revision: 31.0.2)
AVDs:
Android 10 (Q) API 29 Google Apis Play Store x86_64 r08 Darwin/MacOS Production Build
Kernel 4.14.112+ -> 4.14.175
Android 11 (R) API 30 Google Apis Play Store x86_64 r10 Darwin/MacOS Production Build
Kernel 5.4.61 -> 5.4.113
Android 12 (S) API 30 Google Apis Play Store x86_64 r02 Darwin/MacOS Production Build
Kernel 5.10.15 -> 5.10.31
rootAVD - To install Magisk and the Kernels Modules into the ramdisk.img
Spoiler: dependencies and repo
Bash:
#############################################|#############################################
###### Build an AVD Kernel and its Ramdisk Modules ######
###### with the official AOSP Build ENV ######
#############################################|#############################################
#############################################|#############################################
###### Install build dependencies, libs and tools ######
#############################################|#############################################
sudo apt-get install -y build-essential libssl-dev kernel-package libncurses5-dev bzip2 \
lib32z1 bison flex libelf-dev qt5-default qttools5-dev-tools qttools5-dev meld geany \
gtk+-2.0 libgtk-3-dev libwebkit2gtk-4.0-dev autogen libgtk2.0-dev libglade2-dev
#############################################|#############################################
###### Get the AOSP repo bin ######
#############################################|#############################################
sudo wget https://storage.googleapis.com/git-repo-downloads/repo -O /usr/bin/repo
sudo chmod a+x /usr/bin/repo
Spoiler: Android 10 (Q) Kernel 4.14
Bash:
#############################################|#############################################
##### Android 10 (Q) Kernel 4.14 #####
##### BRANCH=q-goldfish-android-goldfish-4.14-dev #####
#############################################|#############################################
#############################################|#############################################
### Download Sources, Toolchain, Buildtools etc. (approx. 17GB) ###
#############################################|#############################################
BRANCH=q-goldfish-android-goldfish-4.14-dev
ROOTDIR=AVD-kernel-$BRANCH
mkdir $ROOTDIR && cd $ROOTDIR
repo init --depth=1 -u https://android.googlesource.com/kernel/manifest -b $BRANCH
repo sync --force-sync --no-clone-bundle --no-tags -j$(nproc)
#############################################|#############################################
### Make changes and enable features via the Menuconfig ###
### changes will be saved into the gki_defconfig ###
### i.e. USB 3.0, UHCI HCD for USB-Serial Adapters ###
### or USB Block Devices like /dev/block/sda1 ###
### Device Drivers -> USB support -> <*> xHCI HCD (USB 3.0) support ###
### -*- Generic xHCI driver for a platform device ###
### <*> UHCI HCD (most Intel and VIA) support ###
### <*> USB Mass Storage support ###
### <*> USB Attached SCSI ###
#############################################|#############################################
BUILD_CONFIG=goldfish/build.config.goldfish.x86_64 \
build/config.sh
#############################################|#############################################
### 1st run ###
### Building the Kernel (bzImage) ###
#############################################|#############################################
BUILD_CONFIG=goldfish/build.config.goldfish.x86_64 \
SKIP_CP_KERNEL_HDR=1 \
build/build.sh -j$(nproc)
Files copied to /home/newbit/workdir/AVD-kernel-q-goldfish-android-goldfish-4.14-dev/out/x86_64/dist
#############################################|#############################################
### (1+n)th Build run ###
### Building only changes, not everything ###
#############################################|#############################################
BUILD_CONFIG=goldfish/build.config.goldfish.x86_64 \
SKIP_CP_KERNEL_HDR=1 \
SKIP_MRPROPER=1 \
build/build.sh -j$(nproc)
#############################################|#############################################
### Copy bzImage as kernel-ranchu into the AVDs directory ###
#############################################|#############################################
mv ~/path-to-avd-system-images/android-29/kernel-ranchu ~/path-to-avd-system-images/android-29/kernel-ranchu.backup
cp out/x86_64/dist/bzImage ~/path-to-avd-system-images/android-29/kernel-ranchu
#############################################|#############################################
### Install Magisk with the rootAVD script, ###
### download the USB HOST Permissions Module Zip ###
### patch the fstab.ranchu to automount Block Devices like /dev/block/sda1 ###
#############################################|#############################################
./rootAVD.sh ~/Android/Sdk/system-images/android-29/google_apis_playstore/x86_64/ramdisk.img GetUSBHPmodZ PATCHFSTAB
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Spoiler: Android 11 (R) Kernel 5.4
Bash:
#############################################|#############################################
##### Android 11 (R) Kernel 5.4 #####
##### BRANCH=common-android11-5.4-lts #####
#############################################|#############################################
#############################################|#############################################
### Download Sources, Toolchain, Buildtools etc. (approx. 22GB) ###
#############################################|#############################################
BRANCH=common-android11-5.4-lts
ROOTDIR=AVD-kernel-$BRANCH
mkdir $ROOTDIR && cd $ROOTDIR
repo init --depth=1 -u https://android.googlesource.com/kernel/manifest -b $BRANCH
repo sync --force-sync --no-clone-bundle --no-tags -j$(nproc)
#############################################|#############################################
### Preparing and modding the build.config ###
### add these lines to the BUILD_CONFIG file ###
### common-modules/virtual-device/build.config.goldfish.x86_64 ###
#############################################|#############################################
BUILD_INITRAMFS=1
LZ4_RAMDISK=1
SKIP_CP_KERNEL_HDR=1
#############################################|#############################################
### Make changes and enable features via the Menuconfig ###
### changes will be saved into the gki_defconfig ###
### i.e. USB 3.0 or UHCI HCD for USB-Serial Adapters ###
### Device Drivers -> USB support -> <*> xHCI HCD (USB 3.0) support ###
### -*- Generic xHCI driver for a platform device ###
### <*> UHCI HCD (most Intel and VIA) support ###
#############################################|#############################################
BUILD_CONFIG=common-modules/virtual-device/build.config.goldfish.x86_64 \
FRAGMENT_CONFIG=common/arch/x86/configs/gki_defconfig \
build/config.sh
#############################################|#############################################
### 1st run ###
### Building the Modules and Kernel ###
#############################################|#############################################
BUILD_CONFIG=common-modules/virtual-device/build.config.goldfish.x86_64 \
build/build.sh -j$(nproc)
Files copied to ~/workdir/AVD-kernel-common-android11-5.4-lts/out/android11-5.4/dist
#############################################|#############################################
### Copy bzImage & initramfs.img into the rootAVD directory ###
### and run rootAVD ###
#############################################|#############################################
cp out/android11-5.4/dist/initramfs.img ~/rootAVD/
cp out/android11-5.4/dist/bzImage ~/rootAVD/
./rootAVD.sh ~/path-to-avd-system-images/android-30/ramdisk.img InstallKernelModules
[!] Installing new Kernel Modules
[*] Copy initramfs.img /data/data/com.android.shell/Magisk/tmp/initramfs
[-] Extracting Modules from initramfs.img
Detected format: [lz4_legacy]
Decompressing to [initramfs.cpio]
[*] Removing Stock Modules from ramdisk.img
[!] 5.4.61-android11-2-00064-g4271ad6e8ade-ab6991359
[!] Android (6443078 based on r383902)
[-] Installing new Modules into ramdisk.img
[!] 5.4.113-android11-2-g926c4200b8fc-dirty
[!] Android (7211189, based on r416183)
[*] Adjusting modules.load and modules.dep
[*] Repacking ramdisk ..
#############################################|#############################################
### (1+n)th Build run ###
### Building only changes, not everything ###
#############################################|#############################################
BUILD_CONFIG=common-modules/virtual-device/build.config.goldfish.x86_64 \
SKIP_MRPROPER=1 \
build/build.sh -j$(nproc)
#############################################|#############################################
### Copy bzImage as kernel-ranchu into the AVDs directory ###
### Once the modules are installed, just the kernel is needed ###
#############################################|#############################################
cp out/android11-5.4/dist/bzImage ~/path-to-avd-system-images/android-30/kernel-ranchu
Spoiler: Android 12 (S) Kernel 5.10
Bash:
#############################################|#############################################
##### Android 12 (S) Kernel 5.10 #####
##### BRANCH=common-android12-5.10-lts #####
#############################################|#############################################
#############################################|#############################################
### Download Sources, Toolchain, Buildtools etc. (approx. 22GB) ###
#############################################|#############################################
BRANCH=common-android12-5.10-lts
ROOTDIR=AVD-kernel-$BRANCH
mkdir $ROOTDIR && cd $ROOTDIR
repo init --depth=1 -u https://android.googlesource.com/kernel/manifest -b $BRANCH
repo sync --force-sync --no-clone-bundle --no-tags -j$(nproc)
#############################################|#############################################
### Preparing and modding the build.config ###
### add these lines to the BUILD_CONFIG file ###
### common-modules/virtual-device/build.config.virtual_device.x86_64 ###
#############################################|#############################################
SKIP_CP_KERNEL_HDR=1
FILES="
arch/x86/boot/bzImage
vmlinux
System.map
"
MAKE_GOALS="
bzImage
modules
"
#############################################|#############################################
### Open the Menuconfig, make changes and enable features ###
### changes will be saved into the gki_defconfig ###
### i.e. UHCI HCD for USB-Serial Adapters ###
### USB 3.0 is finally standard built in the ranchu-kernel since Android 12 (S) ###
### Device Drivers -> USB support -> <*> UHCI HCD (most Intel and VIA) support ###
#############################################|#############################################
BUILD_CONFIG=common-modules/virtual-device/build.config.virtual_device.x86_64 \
FRAGMENT_CONFIG=common/arch/x86/configs/gki_defconfig \
build/config.sh
#############################################|#############################################
### 1st Build run ###
### Building the modules and kernel ###
#############################################|#############################################
time BUILD_CONFIG=common-modules/virtual-device/build.config.virtual_device.x86_64 \
build/build.sh -j$(nproc)
Files copied to ~/workdir/AVD-kernel-common-android12-5.10-lts/out/android12-5.10/dist
real 33m16,742s
user 79m12,894s
sys 11m33,474s
#############################################|#############################################
### Copy bzImage & initramfs.img into the rootAVD directory ###
### and run rootAVD ###
### the AVD is running with the new Kernel and Modules ###
### complete the Magisk installation with EnvFixTask ###
#############################################|#############################################
cp out/android12-5.10/dist/initramfs.img ~/rootAVD/
cp out/android12-5.10/dist/bzImage ~/rootAVD/
./rootAVD.sh ~/path-to-avd-system-images/android-S/ramdisk.img InstallKernelModules
[!] Installing new Kernel Modules
[*] Copy initramfs.img /data/data/com.android.shell/Magisk/tmp/initramfs
[-] Extracting Modules from initramfs.img
Detected format: [lz4_legacy]
Decompressing to [initramfs.cpio]
[*] Removing Stock Modules from ramdisk.img
[!] 5.10.15-android12-0-00490-gfca78df78ef2-ab7137072
[!] Android (7037181, based on r407598)
[-] Installing new Modules into ramdisk.img
[!] 5.10.31-android12-1-gb0c3c31639b2-dirty
[!] Android (7211189, based on r416183)
[*] Adjusting modules.load and modules.dep
[*] Repacking ramdisk ..
./rootAVD.sh EnvFixTask
#############################################|#############################################
### (1+n)th Build run ###
### Building only changes, not everything ###
#############################################|#############################################
time BUILD_CONFIG=common-modules/virtual-device/build.config.virtual_device.x86_64 \
SKIP_MRPROPER=1 \
build/build.sh -j$(nproc)
#############################################|#############################################
### Copy bzImage as kernel-ranchu into the AVDs directory ###
### Once the modules are installed, just the kernel is needed ###
#############################################|#############################################
cp out/android12-5.10/dist/bzImage ~/path-to-avd-system-images/android-S/kernel-ranchu
Spoiler: "classic" Guide
with this Guide I would like to show some steps on how to build your own Kernel for an Android Studio Device with CLANG.
The Development Environment:
Apple Macbook Pro 2011 Dualboot
Linux Mint 20 Ulyana
Android Studio 4.1.1 (Software Manager)
KVM -> Cosmic (18.10) or later
Android emulator version 30.3.5.0 (build_id 7033400)
Android SDK Platform-Tools (revision: 30.0.5)
AVD: Android 11 (R) API 30 Google Apis Play Store x86_64 Linux Production Build (revision: 10)
Target: Kernel 5.4.61
### Install the following tools to work with and to build the kernel
Bash:
sudo apt-get install -y build-essential libssl-dev kernel-package libncurses5-dev bzip2 lib32z1 bison flex
sudo apt-get install -y libelf-dev libelf-devel or elfutils-libelf-dev
sudo apt-get install -y qt5-default qttools5-dev-tools qttools5-dev
sudo apt-get install -y geany git
### Gathering Informations about the Target Kernel
By starting the AVD over the command line, we can append some kernel and verbose options:
emulator -netdelay none -netspeed full -no-snapstorage -avd Pixel_4_API_30 -show-kernel -verbose
The terminal will show the kernel information which are important:
Code:
[ 0.000000] Linux version 5.4.61-android11-2-00064-g4271ad6e8ade-ab6991359 ([email protected]) (Android (6443078 based on r383902) clang version 11.0.1 (https://android.googlesource.com/toolchain/llvm-project b397f81060ce6d701042b782172ed13bee898b79), LLD 11.0.1 (/buildbot/tmp/tmp6_m7QH b397f81060ce6d701042b782172ed13bee898b79)) #1 SMP PREEMPT Mon Nov 23 17:45:44 UTC 2020
ValueMeaningLinux version 5.4.61​Kernel VERSION.PATCHLEVEL.SUBLEVEL​android11-2​retagged Kernel branch and KMI generation number -> android11-5.4​-g4271ad6e8ade​Local Version String (very important to avoid: disagrees about version of symbol module_layout)​-ab6991359​Automatically append version information to the version string​build-user​KBUILD_BUILD_USER​build-host​KBUILD_BUILD_HOST​Android (6443078 based on r383902) clang version 11.0.1​Android Clang/LLVM Prebuilt Version r383902​
### Gathering more Informations about what is needed to build the kernel
To figure out what we need to build the kernel, one just needs to look into the build.config file inside the kernel source.
https://android.googlesource.com/kernel/common/+/refs/heads/android11-5.4
build.config.gki.x86_64
build.config.common
build.config.x86_64
build.config.gki
Inside the three build.config files we will find what we need to know.
Makefile:
BRANCH=android11-5.4
KMI_GENERATION=2
CC=clang
LD=ld.lld
NM=llvm-nm
OBJCOPY=llvm-objcopy
DEPMOD=depmod
CLANG_PREBUILT_BIN=prebuilts-master/clang/host/linux-x86/clang-r383902/bin
BUILDTOOLS_PREBUILT_BIN=build/build-tools/path/linux-x86
EXTRA_CMDS=''
STOP_SHIP_TRACEPRINTK=1
IN_KERNEL_MODULES=1
DO_NOT_STRIP_MODULES=1
Makefile:
ARCH=x86_64
CLANG_TRIPLE=x86_64-linux-gnu-
CROSS_COMPILE=x86_64-linux-androidkernel-
LINUX_GCC_CROSS_COMPILE_PREBUILTS_BIN=prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin
FILES="arch/x86/boot/bzImage
vmlinux
System.map"
Makefile:
DEFCONFIG=gki_defconfig
POST_DEFCONFIG_CMDS="check_defconfig"
Apparently we don't need the build.config.gki
Without further ado, the gathered informations from above will eventually lead up to:
### Download the kernel source, CLANG toolchain, Buildtools and GCC
Bash:
mkdir avdkernel5.4compile && cd avdkernel5.4compile
git clone -b android11-5.4 --single-branch https://android.googlesource.com/kernel/common
mkdir clang-r383902 && cd clang-r383902
wget https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+archive/android-11.0.0_r28/clang-r383902.tar.gz
tar -xzf clang-r383902.tar.gz && cd ..
git clone https://android.googlesource.com/kernel/prebuilts/build-tools
git clone \
-b android-11.0.0_r28 \
--single-branch https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9
### Pull the Kernel .config from the AVD
Bash:
adb pull /proc/config.gz
gunzip -k config.gz
### Exports: (must be done in kernel-source directory)
Bash:
cd common
export ARCH=x86_64
export CLANG_TRIPLE=x86_64-linux-gnu-
export CROSS_COMPILE=x86_64-linux-androidkernel-
export LINUX_GCC_CROSS_COMPILE_PREBUILTS_BIN=$(pwd)/../x86_64-linux-android-4.9/bin
export CLANG_PREBUILT_BIN=$(pwd)/../clang-r383902/bin
export BUILDTOOLS_PREBUILT_BIN=$(pwd)/../build-tools/linux-x86/bin
DEVEXPS="CC=clang LD=ld.lld NM=llvm-nm OBJCOPY=llvm-objcopy DEPMOD=depmod EXTRA_CMDS='' STOP_SHIP_TRACEPRINTK=1 DO_NOT_STRIP_MODULES=1"
export KBUILD_BUILD_USER=build-user
export KBUILD_BUILD_HOST=build-host
export PATH=$LINUX_GCC_CROSS_COMPILE_PREBUILTS_BIN:$CLANG_PREBUILT_BIN:$BUILDTOOLS_PREBUILT_BIN:$PATH
make $DEVEXPS mrproper
cp ../config .config
### add -g4271ad6e8ade to LOCALVERSION -> otherwise modules won't load => module xy disagrees about version of symbol module_layout
Bash:
make $DEVEXPS xconfig
If you come back here later, this is the right place to mod your kernel.
I like the GUI Interface because you have a better overview and a search function.
### build it
Bash:
time make $DEVEXPS -j$(nproc)
### Boot the AVD ...
#### ... from the command line
Bash:
emulator -netdelay none -netspeed full -no-snapstorage -avd Pixel_4_API_30 \
-no-snapshot-load \
-show-kernel \
-verbose \
-ranchu \
-kernel ~/avdkernel5.4compile/common/arch/x86/boot/bzImage
#### ... by replacing the stock kernel-ranchu
Code:
mv ~/Android/Sdk/system-images/android-30/google_apis_playstore/x86_64/kernel-ranchu \
~/Android/Sdk/system-images/android-30/google_apis_playstore/x86_64/kernel-ranchu-backup
cp ~/avdkernel5.4compile/common/arch/x86/boot/bzImage \
~/Android/Sdk/system-images/android-30/google_apis_playstore/x86_64/kernel-ranchu
### Compare the Kernel Verbose Messages
Code:
[ 0.000000] Linux version 5.4.61-g4271ad6e8ade-00014-g158eae717346 ([email protected]) (Android (6443078 based on r383902) clang version 11.0.1 (https://android.googlesource.com/toolchain/llvm-project b397f81060ce6d701042b782172ed13bee898b79), LLD 11.0.1 (/buildbot/tmp/tmp6_m7QH b397f81060ce6d701042b782172ed13bee898b79)) #1 SMP PREEMPT Mon Jan 11 12:58:18 CET 2021
Thanks for reading
Cheers NewBit
Thanks and Credits to @nathanchance, for his wonderful
[REFERENCE] How to compile an Android kernel
brought me a lot of ideas and inspirations
Hello newbit,
I am currently following your guide but when I try to run
Bash:
make $DEVEXPS xconfig
and it resulted in the following error
Bash:
clang: error: no such file or directory: 'LD=ld.lld'
clang: error: no such file or directory: 'NM=llvm-nm'
clang: error: no such file or directory: 'OBJCOPY=llvm-objcopy'
clang: error: no such file or directory: 'DEPMOD=depmod'
clang: error: no such file or directory: 'EXTRA_CMDS='
clang: error: no such file or directory: 'STOP_SHIP_TRACEPRINTK=1'
clang: error: no such file or directory: 'DO_NOT_STRIP_MODULES=1'
clang: error: no such file or directory: 'LD=ld.lld'
clang: error: no such file or directory: 'NM=llvm-nm'
clang: error: no such file or directory: 'OBJCOPY=llvm-objcopy'
clang: error: no such file or directory: 'DEPMOD=depmod'
clang: error: no such file or directory: 'EXTRA_CMDS='
clang: error: no such file or directory: 'STOP_SHIP_TRACEPRINTK=1'
clang: error: no such file or directory: 'DO_NOT_STRIP_MODULES=1'
clang: error: no such file or directory: 'LD=ld.lld'
clang: error: no such file or directory: 'NM=llvm-nm'
clang: error: no such file or directory: 'OBJCOPY=llvm-objcopy'
clang: error: no such file or directory: 'DEPMOD=depmod'
clang: error: no such file or directory: 'EXTRA_CMDS='
clang: error: no such file or directory: 'STOP_SHIP_TRACEPRINTK=1'
clang: error: no such file or directory: 'DO_NOT_STRIP_MODULES=1'
clang: error: no such file or directory: 'LD=ld.lld'
clang: error: no such file or directory: 'NM=llvm-nm'
clang: error: no such file or directory: 'OBJCOPY=llvm-objcopy'
clang: error: no such file or directory: 'DEPMOD=depmod'
clang: error: no such file or directory: 'EXTRA_CMDS='
clang: error: no such file or directory: 'STOP_SHIP_TRACEPRINTK=1'
clang: error: no such file or directory: 'DO_NOT_STRIP_MODULES=1'
clang: error: no such file or directory: 'LD=ld.lld'
clang: error: no such file or directory: 'NM=llvm-nm'
clang: error: no such file or directory: 'OBJCOPY=llvm-objcopy'
clang: error: no such file or directory: 'DEPMOD=depmod'
clang: error: no such file or directory: 'EXTRA_CMDS='
clang: error: no such file or directory: 'STOP_SHIP_TRACEPRINTK=1'
clang: error: no such file or directory: 'DO_NOT_STRIP_MODULES=1'
clang: error: no such file or directory: 'LD=ld.lld'
clang: error: no such file or directory: 'NM=llvm-nm'
clang: error: no such file or directory: 'OBJCOPY=llvm-objcopy'
clang: error: no such file or directory: 'DEPMOD=depmod'
clang: error: no such file or directory: 'EXTRA_CMDS='
clang: error: no such file or directory: 'STOP_SHIP_TRACEPRINTK=1'
clang: error: no such file or directory: 'DO_NOT_STRIP_MODULES=1'
clang: error: no such file or directory: 'LD=ld.lld'
clang: error: no such file or directory: 'NM=llvm-nm'
clang: error: no such file or directory: 'OBJCOPY=llvm-objcopy'
clang: error: no such file or directory: 'DEPMOD=depmod'
clang: error: no such file or directory: 'EXTRA_CMDS='
clang: error: no such file or directory: 'STOP_SHIP_TRACEPRINTK=1'
clang: error: no such file or directory: 'DO_NOT_STRIP_MODULES=1'
clang: error: no such file or directory: 'LD=ld.lld'
clang: error: no such file or directory: 'NM=llvm-nm'
clang: error: no such file or directory: 'OBJCOPY=llvm-objcopy'
clang: error: no such file or directory: 'DEPMOD=depmod'
clang: error: no such file or directory: 'EXTRA_CMDS='
clang: error: no such file or directory: 'STOP_SHIP_TRACEPRINTK=1'
clang: error: no such file or directory: 'DO_NOT_STRIP_MODULES=1'
clang: error: no such file or directory: 'LD=ld.lld'
clang: error: no such file or directory: 'NM=llvm-nm'
clang: error: no such file or directory: 'OBJCOPY=llvm-objcopy'
clang: error: no such file or directory: 'DEPMOD=depmod'
clang: error: no such file or directory: 'EXTRA_CMDS='
clang: error: no such file or directory: 'STOP_SHIP_TRACEPRINTK=1'
clang: error: no such file or directory: 'DO_NOT_STRIP_MODULES=1'
init/Kconfig:34:warning: 'GCC_VERSION': number is invalid
init/Kconfig:45:warning: 'CLANG_VERSION': number is invalid
did you encounter this?
reeferman said:
Hello newbit,
I am currently following your guide but when I try to run
Bash:
make $DEVEXPS xconfig
and it resulted in the following error
Bash:
clang: error: no such file or directory: 'LD=ld.lld'
clang: error: no such file or directory: 'NM=llvm-nm'
clang: error: no such file or directory: 'OBJCOPY=llvm-objcopy'
clang: error: no such file or directory: 'DEPMOD=depmod'
clang: error: no such file or directory: 'EXTRA_CMDS='
clang: error: no such file or directory: 'STOP_SHIP_TRACEPRINTK=1'
clang: error: no such file or directory: 'DO_NOT_STRIP_MODULES=1'
...
init/Kconfig:34:warning: 'GCC_VERSION': number is invalid
init/Kconfig:45:warning: 'CLANG_VERSION': number is invalid
did you encounter this?
Click to expand...
Click to collapse
Hmm, looks weird. No I didn't. Also it is a bit taken out of context. It seems that your $DEVEXPS content gets repeated many times.
Do you have more background infos for me? Like your development environment and If you did change little things? Maybe a typo in the $PATH?
Pretty weird, but I was using kali to do it before and when I switched Linux Mint eveerything worked!
Hi newbit!
Thanks for some great tutorials, unfortunately for me I can't get it to work properly. Hopefully, you're able to help me
I'm trying to build and install a custom kernel in an AOSP built emulator. I've been trying out the "official" guide at https://source.android.com/setup/build/building-kernels#customize-build, your rootAVD guide for Android 11 and the "classic" guide for Android 11. All of the guides give me the same result:
Code:
[ 0.610588] Run /init as init process
[ 0.611985] init: init first stage started!
[ 0.612930] init: Loading module /lib/modules/dummy-cpufreq.ko with args ""
[ 0.613579] dummy_cpufreq: disagrees about version of symbol module_layout
[ 0.614170] init: Failed to insmod '/lib/modules/dummy-cpufreq.ko' with args ''
[ 0.614793] init: LoadWithAliases was unable to load dummy_cpufreq
[ 0.615366] init: [libfs_mgr]ReadFstabFromDt(): failed to read fstab from dt
[ 0.616164] init: Using Android DT directory /proc/device-tree/firmware/android/
[ 0.629196] init: bool android::init::BlockDevInitializer::InitDevices(std::set<std::string>): partition(s) not found in /sys, waiting for their uevent(s): metadata, super, vbmeta
After that, the emulator hangs for a short while and the it reboots to try again..
In your "classic" guide, you're warning about this:
### add -g4271ad6e8ade to LOCALVERSION -> otherwise modules won't load => module xy disagrees about version of symbol module_layout
Click to expand...
Click to collapse
When I checked the version of my running emulator i got this:
Code:
Linux version 5.4.50-01145-g056684c0d252-ab6656030 ([email protected]) (Android (6443078 based on r383902) clang version 11.0.1 (https://android.googlesource.com/toolchain/llvm-project b397f81060ce6d701042b782172ed13bee898b79), LLD 11.0.1 (/buildbot/tmp/tmp6_m7QH b397f81060ce6d701042b782172ed13bee898b79)) #1 SMP PREEMPT Mon Jul 6 18:09:10 UTC 2020
So I used xconfig to add the "-g056684c0d252" string and also made sure to use the r383902 clang toolchain to compile, but no luck.. After compilation and running with the new kernel, I get this version print:
Code:
[ 0.000000] Linux version 5.4.162-g056684c0d252-android11-2-00102-gfe0ed45e42fe-dirty ([email protected]) (Android (6443078 based on r383902) clang version 11.0.1 (https://android.googlesource.com/toolchain/llvm-project b397f81060ce6d701042b782172ed13bee898b79), LLD 11.0.1 (/buildbot/tmp/tmp6_m7QH b397f81060ce6d701042b782172ed13bee898b79)) #1 SMP PREEMPT Fri Nov 26 10:38:38 UTC 2021
Can you see anything obvious from that?
When I tried with rootAVD, I'm getting this output when running the script:
Code:
./rootAVD.sh /aosp/out/target/product/myproduct/ramdisk.img InstallKernelModules
[!] and we are NOT in an emulator shell
[*] Set Directorys
[-] Test if ADB SHELL is working
[-] In any AVD via ADB, you can execute code without root in /data/data/com.android.shell
[-] Magisk installer Zip exists already
[*] Cleaning up the ADB working space
[*] Creating the ADB working space
[*] Push Magisk.zip into /data/data/com.android.shell/Magisk
[-] ./Magisk.zip: 1 file pushed, 0 skipped. 254.4 MB/s (6874374 bytes in 0.026s)
[*] create Backup File of ramdisk.img
[*] Push ramdisk.img into /data/data/com.android.shell/Magisk
[-] /ramdisk.img: 1 file pushed, 0 skipped. 1006.6 MB/s (903723 bytes in 0.001s)
[*] Push initramfs.img into /data/data/com.android.shell/Magisk
[-] ./initramfs.img: 1 file pushed, 0 skipped. 299.9 MB/s (2256062 bytes in 0.007s)
[*] Push rootAVD.sh into /data/data/com.android.shell/Magisk
[-] rootAVD.sh: 1 file pushed, 0 skipped. 243.4 MB/s (7826127 bytes in 0.031s)
[-] run the actually Boot/Ramdisk/Kernel Image Patch Script
[*] from Magisk by topjohnwu and modded by NewBit XDA
[!] We are in an emulator shell
[-] Api Level Arch Detect
[-] Device Platform: x64
[-] ARCH32 x86
[-] Device SDK API: 30
[-] First API Level: 28
[-] Switch to the location of the script file
[*] Extracting busybox and Magisk.zip ...
[-] Checking AVDs Internet connection...
[!] AVD is offline
[*] Re-Run rootAVD in Magisk Busybox STANDALONE (D)ASH
[!] We are in an emulator shell
[-] We are now in Magisk Busybox STANDALONE (D)ASH
[*] rootAVD with Magisk '23.0' Installer
[-] Get Flags
[*] System-as-root, keep dm/avb-verity
[-] Encrypted data, keep forceencrypt
[*] RECOVERYMODE=false
[-] KEEPVERITY=true
[*] KEEPFORCEENCRYPT=true
[*] No 64-Bit Binarys found, please consider Magisk Alpha
[-] copy all x86 files from /data/data/com.android.shell/Magisk/lib/x86 to /data/data/com.android.shell/Magisk
[*] Detecting ramdisk.img compression
[!] Ramdisk.img uses gzip compression
[-] taken from shakalaca's MagiskOnEmulator/process.sh
[*] executing ramdisk splitting / extraction / repacking
[-] API level greater then 30
[*] Check if we need to repack ramdisk before patching ..
[*] After decompressing ramdisk.img, magiskboot will work
Detected format: [gzip]
[-] Test patch status and do restore
[-] Checking ramdisk status
[-] STATUS=0
[-] Stock boot image detected
[-] Patching ramdisk
[*] adding overlay.d/sbin folders to ramdisk
Loading cpio: [ramdisk.cpio]
Create directory [overlay.d] (0750)
Create directory [overlay.d/sbin] (0750)
Dump cpio: [ramdisk.cpio]
[!] PATCHFSTAB=false
[!] Skipping fstab.ranchu patch with /dev/block/sda
[?] If you want fstab.ranchu patched, Call rootAVD with PATCHFSTAB
[!] AddRCscripts=false
[!] Skip adding *.rc scripts into ramdisk.img/sbin/*.rc
[?] If you want *.rc scripts added into ramdisk.img/sbin/*.rc, Call rootAVD with AddRCscripts
[!] patching the ramdisk with Magisk Init
Loading cpio: [ramdisk.cpio]
Add entry [init] (0750)
Add entry [overlay.d/sbin/magisk32.xz] (0644)
Add entry [overlay.d/sbin/magisk64.xz] (0644)
Patch with flag KEEPVERITY=[true] KEEPFORCEENCRYPT=[true]
Loading cpio: [ramdisk.cpio.orig]
Backup mismatch entry: [init] -> [.backup/init]
Record new entry: [overlay.d] -> [.backup/.rmlist]
Record new entry: [overlay.d/sbin] -> [.backup/.rmlist]
Record new entry: [overlay.d/sbin/magisk32.xz] -> [.backup/.rmlist]
Record new entry: [overlay.d/sbin/magisk64.xz] -> [.backup/.rmlist]
Create directory [.backup] (0000)
Add entry [.backup/.magisk] (0000)
Dump cpio: [ramdisk.cpio]
[*] repacking back to ramdisk.img format
[!] Rename Magisk.zip to Magisk.apk
[*] Pull ramdiskpatched4AVD.img into ramdisk.img
[-] /data/data/com.android.shell/Magisk/ramdiskpatched4AVD.img: 1 file pulled, 0 skipped. 294.3 MB/s (1270228 bytes in 0.004s)
[*] Pull Magisk.apk into
[-] /data/data/com.android.shell/Magisk/Magisk.apk: 1 file pulled, 0 skipped. 358.8 MB/s (6342346 bytes in 0.017s)
[*] create Backup File of kernel-ranchu
[*] Copy ./bzImage (Kernel) into kernel-ranchu
[-] Clean up the ADB working space
[-] Install all APKs placed in the Apps folder
[*] Trying to install Apps/Magisk.apk
[*] Performing Streamed Install
[*] Success
[-] Shut-Down & Reboot (Cold Boot Now) the AVD and see if it worked
[-] Root and Su with Magisk for Android Studio AVDs
[-] Modded by NewBit XDA - Jan. 2021
[!] Huge Credits and big Thanks to topjohnwu, shakalaca and vvb2060
[-] Trying to shut down the AVD
[!] If the AVD doesn't shut down, try it manually!
Which is not the same as the one you're showing in the rootAVD guide. Is it anything I'm doing incorrect here or has the prints just changed?
Would be really awesome if you're able to help in any way let me know if you need more info!
I was a little quick on asking questions Got it working! It was the Linux version that was off, the one running in the emulator was 5.4.50 while I was compiling 5.4.162.
When I checked out the commit that had 5.4.50, it all worked like a charm doing it with your "classic" guide!
Thanks again for the awesome guides!
rkull said:
I was a little quick on asking questions Got it working! It was the Linux version that was off, the one running in the emulator was 5.4.50 while I was compiling 5.4.162.
When I checked out the commit that had 5.4.50, it all worked like a charm doing it with your "classic" guide!
Thanks again for the awesome guides!
Click to expand...
Click to collapse
I am glade it worked for you. Sometimes you need some luck. I had quite some issues with the module versions, even If I added the local version right. So the best solutions so far is, to build the modules as well.
I see that your AVD is offline, make sure the Magisk Version is compatible with your AVD API Level.
Occasionally, even with the module versions right, the AVD boot looped, and I had to wipe the AVD and then
it worked. I don't have an explanation for this, just my observations.
Yeah I'm building/installing a custom kernel for an AOSP build, so I'm not using an AVD. Just running the AOSP emulator build:
Code:
source build/envsetup.sh
lunch
emulator
Not packing the build into an AVD but maybe we'll do that in the future
When you say
So the best solutions so far is, to build the modules as well.
Click to expand...
Click to collapse
How's that done exactly? Do I need to do something more that just running
Code:
make $DEVEXPS -j$(nproc)
Or am I still stuck with version 5.4.50 of the kernel?
Not that I see the need for me to update the version, but it would be fun to know how it could be done
rkull said:
Yeah I'm building/installing a custom kernel for an AOSP build, so I'm not using an AVD. Just running the AOSP emulator build:
Click to expand...
Click to collapse
rkull said:
When you say
How's that done exactly? Do I need to do something more that just running
Code:
make $DEVEXPS -j$(nproc)
Or am I still stuck with version 5.4.50 of the kernel?
Not that I see the need for me to update the version, but it would be fun to know how it could be done
Click to expand...
Click to collapse
With the AOSP Build ENV I had to set
Code:
BUILD_INITRAMFS=1
to get the modules build and packed. Don't know how this is done the classical way. Checkout your output directory if you can find
any modules or initramfs.img
rootAVD provides you an option to download prebuild kernels and its modules from AOSP.
You can try this to get a higher Kernel version.
Thank you very much!good job!

Categories

Resources