So I'm working on some lock screen stuff in frameworks/base/policy/src/com/android/internal/policy/impl/ for CyanogenMod 9, and I was wondering how I would go about compiling it? Would I just run something like `make -j4 impl`, like I would for something like SystemUI? Then how would I go about applying it to my device?
Sorry for the noob question, but thanks for the help!
Chiggins said:
So I'm working on some lock screen stuff in frameworks/base/policy/src/com/android/internal/policy/impl/ for CyanogenMod 9, and I was wondering how I would go about compiling it? Would I just run something like `make -j4 impl`, like I would for something like SystemUI? Then how would I go about applying it to my device?
Sorry for the noob question, but thanks for the help!
Click to expand...
Click to collapse
If you look here:
https://github.com/CyanogenMod/android_frameworks_base/tree/gingerbread/policy
You will see Android.mk
Code:
LOCAL_PATH:= $(call my-dir)
# the library
# ============================================================
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_MODULE := android.policy
include $(BUILD_JAVA_LIBRARY)
# additionally, build unit tests in a separate .apk
include $(call all-makefiles-under,$(LOCAL_PATH))
The local module you will need to call this is "android.policy"
It will build what it needs to. When it finishes compiling you will see a list of "Install:" Push those to your phone.
Code:
make -j$ android.policy
So to my understanding, if something that I'm working on has an Android.mk by it, I could build JUST that thing using the name defined by LOCAL_MODULE, right?
Chiggins said:
So to my understanding, if something that I'm working on has an Android.mk by it, I could build JUST that thing using the name defined by LOCAL_MODULE, right?
Click to expand...
Click to collapse
Yup just about. There might be issues at some point... but I have never had issues testing bits like this.
Alright sweet deal, thanks mate!
Hi everyone I'm trying to build Android 4.3.1 AOSP For galaxy tab 2 7.0 GT-P3113 but i got the following error
make: *** No rule to make target `out/target/product/p3113/kernel', needed by `out/target/product/p3113/boot.img'. Stop.
Click to expand...
Click to collapse
However i have a prebuilt kernel in my device tree (samsung/p3113/kernel)
and added entries in my device.mk
# Prebuilt Kernel And Modules
ifeq ($(TARGET_PREBUILT_KERNEL),)
LOCAL_KERNEL := device/samsung/p3113/kernel
else
LOCAL_KERNEL := $(TARGET_PREBUILT_KERNEL)
endif
PRODUCT_COPY_FILES := \
$(LOCAL_KERNEL):kernel \
$(LOCAL_PATH)/system/lib/modules/scsi_wait_scan.ko \
$(LOCAL_PATH)/system/lib/modules/dhd.ko
Click to expand...
Click to collapse
Click to expand...
Click to collapse
I don't know what to do now please Help me
Hi, so i've tried to compile TWRP inside CM14 source and i've been struggling with linking error for a while
Code:
system/core/adb/adb_auth_client.cpp:94: error: undefined reference to 'android_pubkey_decode'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[ 80% 4855/6059] target C: libminzip ...ootable/recovery-twrp/minzip/SysUtil.c
ninja: build stopped: subcommand failed.
build/core/ninja.mk:151: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
#### make failed to build some targets (04:34 (mm:ss)) ####
It's basicly CM14 not changed at all. What i discovered is that in OUT folder inside static libraries there is no libcrypto-utils build. In fact there is a folder but just with export-includes.txt
Here is part of system/core/adb/Android.mk
Code:
include $(CLEAR_VARS)
LOCAL_CLANG := true
LOCAL_MODULE := libadbd
LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=0
LOCAL_SRC_FILES := \
$(LIBADB_SRC_FILES) \
adb_auth_client.cpp \
jdwp_service.cpp \
usb_linux_client.cpp \
LOCAL_SANITIZE := $(adb_target_sanitize)
# Even though we're building a static library (and thus there's no link step for
# this to take effect), this adds the includes to our path.
LOCAL_STATIC_LIBRARIES := libcrypto_utils_static libcrypto_static libbase
include $(BUILD_STATIC_LIBRARY)
And part of libcrypto_utils/Android.mk
Code:
include $(CLEAR_VARS)
LOCAL_MODULE := libcrypto_utils_static
LOCAL_SRC_FILES := android_pubkey.c
LOCAL_CFLAGS := -Wall -Werror -Wextra -std=c99
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
LOCAL_STATIC_LIBRARIES := libcrypto_static
include $(BUILD_STATIC_LIBRARY)
Also header file is included in adb_auth_client.cpp
Code:
#include <crypto_utils/android_pubkey.h>
What am i doing wrong?
Have you fixed this? I have same problem and i do not know how to fix it ..
_______________SOLVED____________________
https://github.com/discipuloosho/an...mmit/22801f5f78b5b996b163d54cf5c886a2d6db81c7
Anyone got a fix for this?
HaoZeke said:
Anyone got a fix for this?
Click to expand...
Click to collapse
Have you searched/posted this question within the the following thread that's a guide to performing this?
[GUIDE][NOOB FRIENDLY]How to compile TWRP from source step by step by Hacker432
Good Luck!
~~~~~~~~~~~~~~~
I Am The Egg Man,
They Are The Egg Men.
I Am The Walrus!
Coo Coo Cachoo!
I DO NOT PROVIDE SUPPORT VIA PM UNLESS ASKED/REQUESTED BY MYSELF.
PLEASE KEEP IT IN THE THREADS WHERE EVERYONE CAN SHARE
build fails with the following error
[ 69% 65628/93948] //vendor/lineage/build/soong:generated_kernel_includes generate
FAILED: /home/skoar/android/lineageos/out/soong/.intermediates/vendor/lineage/build/soong/generated_kernel_includes/gen/.dummy_dep
/home/skoar/android/lineageos/out/soong/host/linux-x86/bin/sbox --sandbox-path /home/skoar/android/lineageos/out/soong/.temp --output-root /home/skoar/android/lineageos/out/soong/.intermediates/vendor/lineage/build/soong/generated_kernel_includes/gen --copy-all-output -c 'make -j CFLAGS_MODULE="-fno-pic" -C O=__SBOX_OUT_DIR__ ARCH=arm64 CROSS_COMPILE="/usr/bin/ccache aarch64-linux-androidkernel-" CROSS_COMPILE_ARM32="arm-linux-androideabi-" headers_install' && touch /home/skoar/android/lineageos/out/soong/.intermediates/vendor/lineage/build/soong/generated_kernel_includes/gen/.dummy_dep
make: *** O=/home/skoar/android/lineageos/out/soong/.temp/sbox985711399: No such file or directory. Stop.
sbox command (make -j CFLAGS_MODULE="-fno-pic" -C O=/home/skoar/android/lineageos/out/soong/.temp/sbox985711399 ARCH=arm64 CROSS_COMPILE="/usr/bin/ccache aarch64-linux-androidkernel-" CROSS_COMPILE_ARM32="arm-linux-androideabi-" headers_install) failed with err "exit status 2"
[ 69% 65635/93948] //frameworks/base:gen-platform-proto-constants generate
ninja: build stopped: subcommand failed.
11:35:26 ninja failed with: exit status 1
p.s. I'm using prebuilt kernel
Three questions:
1. What device are you building for?
2. Does your device have any working Pie ROM?
3. Did you make the changes in the source needed for using the pre-built kernel?
Nitin
nitin.chobhe said:
Three questions:
1. What device are you building for?
2. Does your device have any working Pie ROM?
3. Did you make the changes in the source needed for using the pre-built kernel?
Nitin
Click to expand...
Click to collapse
1. Lenovo tab4 10 (X304L)
2. No I'm trying to do a bringup
3. Yes added TARGET_PREBUILT_KERNEL in boardconfig and
added the required PRODUCT_COPY_FILES in device.mk
skoar said:
1. Lenovo tab4 10 (X304L)
2. No I'm trying to do a bringup
3. Yes added TARGET_PREBUILT_KERNEL in boardconfig and
added the required PRODUCT_COPY_FILES in device.mk
Click to expand...
Click to collapse
Ok! As far as I understand it, adding just the TARGET_PREBUILT_KERNEL in boardconfig and a change in device make file will not help you. Lineage team (and other ROMs) has done a lot of changes (thousands of commits) in the android/build (and some other) repos as can be seen here:
https://github.com/LineageOS/android_build/commits/lineage-16.0/core/Makefile
So, I would suggest you to build the kernel inline; that would save a lot of your efforts.
Nitin
Introduction :
I'm not an expert in kernel development, but would like to share the steps that I followed to build my kernel. If any of other kernel developers out there would like to add on some tips or correct something, please do!
Pre-requisites :
Ubuntu or any other Linux based OS
Stable Internet Connection
Patience
Step 1 : Setup Build Environment
Open the terminal and enter the following :
Code:
sudo apt-get install git ccache automake flex lzop bison \
gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 \
g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev \
libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush \
schedtool dpkg-dev liblz4-tool make optipng maven libssl-dev \
pwgen libswitch-perl policycoreutils minicom libxml-sax-base-perl \
libxml-simple-perl bc libc6-dev-i386 lib32ncurses5-dev \
x11proto-core-dev libx11-dev lib32z-dev libgl1-mesa-dev xsltproc unzip
Step 2 : Download Required Files
Download device source :
Code:
git clone --depth=1 https://github.com/MiCode/Xiaomi_Kernel_OpenSource.git -b raphael-p-oss raphael-p-oss
Download a compatible GCC toolchain (Using AOSP's GCC for this guide) :
Code:
cd raphael-p-oss
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9 toolchain
Download a compatible CLANG toolchain (Using AOSP's CLANG for this guide) : Download
Move the downloaded file in the raphael-p-oss folder manually and then extract using the following command :
Code:
tar vxzf linux-x86-android-9.0.0_r48-clang-4691093.tar.gz
Download the device-tree-compiler attached below and place it in /usr/bin
Step 3 : Make device specific changes
Make these changes in the /kernel/module.c file.
If you are not familiar with github, you can check out many github guides available on XDA, for now you can just download the module.c file attached to this thread and replace the one in /kernel folder with the downloaded one!
Now, browse back to raphael-p-oss directory, and open the raphael_user_defconfig located in \arch\arm64\configs
Add the following lines :
Code:
CONFIG_BUILD_ARM64_DT_OVERLAY=y
CONFIG_MODULE_FORCE_LOAD=y
WIFI & Audio won't work if you don't make these changes, apparently Xiaomi decided to skip wlan & audio drivers in pie sources.
Step 4 : Building The Kernel
Code:
cd raphael-p-oss
rm -rf out
mkdir out
export ARCH=arm64
export SUBARCH=arm64
export DTC_EXT=dtc
make O=out ARCH=arm64 raphael_user_defconfig
PATH="${PWD}/bin:${PWD}/toolchain/bin:${PATH}" \
make -j$(nproc --all) O=out \
ARCH=arm64 \
CC=clang \
CLANG_TRIPLE=aarch64-linux-gnu- \
CROSS_COMPILE=aarch64-linux-android- | tee kernel.log
Step 5 : How To Get Help If You Encounter Errors
A kernel.log file will be generated in raphael-p-oss folder, find the line which says error.
If you can't figure out the solution, attach the kernel.log in your reply to this thread.
Step 6 : Booting The Kernel
Once you're done with Step 4, browse to /out/arch/arm64/boot & you'll find the Image-dtb file (compiled zImage)
Download the anykernel template for raphael from attachments and add your Image-dtb file to the archive.
Boot in TWRP, backup your stock kernel & flash the anykernel zip.
References :
Information on compiling Android kernels with Clang by nathanchance
How to compile kernel standalone by Xiaomi
Kernel Builder Virtual Machine & device specific changes by mslezak
AnyKernel3 Template by osm0sis
Wahoo Kernel Tools by frap129
Regards,
acervenky
Using QCom Clang To Compile Kernel [Xiaomi's Guide]
Step 1 : Setup Build Environment
Open the terminal and enter the following :
Code:
sudo apt-get install git ccache automake flex lzop bison \
gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 \
g++-multilib python-networkx libxml2-utils bzip2 libbz2-dev \
libbz2-1.0 libghc-bzlib-dev squashfs-tools pngcrush \
schedtool dpkg-dev liblz4-tool make optipng maven libssl-dev \
pwgen libswitch-perl policycoreutils minicom libxml-sax-base-perl \
libxml-simple-perl bc libc6-dev-i386 lib32ncurses5-dev \
x11proto-core-dev libx11-dev lib32z-dev libgl1-mesa-dev xsltproc unzip
Step 2 : Download Required Files
Download device source :
Code:
git clone --depth=1 https://github.com/MiCode/Xiaomi_Kernel_OpenSource.git -b raphael-p-oss raphael-p-oss
Download a compatible GCC toolchain (Using AOSP's GCC for this guide) :
Code:
cd raphael-p-oss
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9 toolchain
Download a Qcom CLANG : Download
Move the downloaded file in the raphael-p-oss folder manually and then extract using the following command :
Code:
tar vxzf snapdragon-llvm-compiler-android-linux64-609.tar.gz
Download the device-tree-compiler attached below and place it in /usr/bin
Step 3 : Make device specific changes
Make these changes in the /kernel/module.c file.
If you are not familiar with github, you can check out many github guides available on XDA, for now you can just download the module.c file attached to this thread and replace the one in /kernel folder with the downloaded one!
Now, browse back to raphael-p-oss directory, and open the raphael_user_defconfig located in \arch\arm64\configs
Add the following lines :
Code:
CONFIG_BUILD_ARM64_DT_OVERLAY=y
CONFIG_MODULE_FORCE_LOAD=y
WIFI & Audio won't work if you don't make these changes, apparently Xiaomi decided to skip wlan & audio drivers in pie sources.
Step 4 : Building The Kernel
Code:
cd raphael-p-oss
rm -rf out
mkdir out
export ARCH=arm64
export SUBARCH=arm64
export DTC_EXT=dtc
export CROSS_COMPILE=${PWD}/toolchain/bin/aarch64-linux-android-
make O=out REAL_CC=${PWD}/toolchains/llvm-Snapdragon_LLVM_for_Android_6.0/prebuilt/linux-x86_64/bin/clang CLANG_TRIPLE=aarch64-linux-gnu- raphael_user_defconfig
make -j$(nproc) O=out REAL_CC=${PWD}/toolchains/llvm-Snapdragon_LLVM_for_Android_6.0/prebuilt/linux-x86_64/bin/clang CLANG_TRIPLE=aarch64-linux-gnu- 2>&1 | tee kernel.log
Step 5 : How To Get Help If You Encounter Errors
A kernel.log file will be generated in raphael-p-oss folder, find the line which says error.
If you can't figure out the solution, attach the kernel.log in your reply to this thread.
Step 6 : Booting The Kernel
Once you're done with Step 4, browse to /out/arch/arm64/boot & you'll find the Image-dtb file (compiled zImage)
Download the anykernel template for raphael from attachments and add your Image-dtb file to the archive.
Boot in TWRP, backup your stock kernel & flash the anykernel zip.
This method is mentioned in Xiaomi's Wiki, you can choose any according to your preference!
Regards,
acervenky
How To Compile Custom DTBO
DTBO files have been used on our device primarily to change the refresh rates.
Pre-requisites :
Compiled kernel without any errors
Step 1 : Download Required Files
Download libufdt utils from this link.
Open the terminal in the downloaded file's location.
Code:
tar vxzf libufdt-master-utils.tar.gz
Step 2 : Compile dtbo.img
Code:
cd libufdt-master-utils/src
python mkdtboimg.py create /home/user/raphael-p-oss/out/arch/arm64/boot/dtbo.img /home/user/raphael-p-oss/out/arch/arm64/boot/dts/qcom/*.dtbo
Step 3 : Flash The Compiled dtbo.img
The compiled dtbo.img file will be located in /raphael-p-oss/out/arch/arm64/boot/ (same output folder of zImage)
Backup your stock dtbo.img and flash the newly compiled dtbo.img
References :
Kernel Builder by mslezak
Regards,
acervenky
reserved3
Nice guide bro...
acervenky said:
Introduction :
I'm not an expert in kernel development, but would like to share the steps that I followed to build my kernel. If any of other kernel developers out there would like to add on some tips or correct something, please do!
Regards,
acervenky
Click to expand...
Click to collapse
awesome guide bro. I will try with my free time. Thanks
Quick question, would the same procedure work for Mi 9T Pro EEA?
I'd like to take a look in that DTBO.img
The phone runs the European Rom and the device ID is the Raphael_EEA.
Thanks in advance!!
acervenky said:
DTBO files have been used on our device primarily to change the refresh rates.
Pre-requisites :
Compiled kernel without any errors
Step 1 : Download Required Files
Download libufdt utils from this link.
Open the terminal in the downloaded file's location.
Step 2 : Compile dtbo.img
Step 3 : Flash The Compiled dtbo.img
The compiled dtbo.img file will be located in /raphael-p-oss/out/arch/arm64/boot/ (same output folder of zImage)
Backup your stock dtbo.img and flash the newly compiled dtbo.img
References :
Kernel Builder by mslezak
Regards,
acervenky
Click to expand...
Click to collapse
Do you have any idea how the display OC mod was done? If you understand it, it would be great if you shared that information, the more people know, more chances of improving it
Build failed
Made no modification, followed your steps exactly, after about 7-10mins of compiling I got this error in terminal:
Code:
make[1]: Leaving directory '/home/rituj/raphael-p-oos/out'
make: *** [sub-make] Error 2
Makefile:146: recipe for target 'sub-make' failed
After searching "error" it only returned a couple of modules that had "error" in their names.
attached the kernel.log
rituj_b said:
Made no modification, followed your steps exactly, after about 7-10mins of compiling I got this error in terminal:
Code:
make[1]: Leaving directory '/home/rituj/raphael-p-oos/out'
make: *** [sub-make] Error 2
Makefile:146: recipe for target 'sub-make' failed
After searching "error" it only returned a couple of modules that had "error" in their names.
attached the kernel.log
Click to expand...
Click to collapse
DTC Compile error, uninstall any pre-installed DTC and use the one provided in attachments!
Regards,
acervenky
acervenky said:
DTC Compile error, uninstall any pre-installed DTC and use the one provided in attachments!
Regards,
acervenky
Click to expand...
Click to collapse
Replaced dtc file with attached in post. Got the same error. Kernel.log in attachment
nevermind, changed permissions on dtc in /usr/bin
Build finished with this log
pemaster said:
Replaced dtc file with attached in post. Got the same error. Kernel.log in attachment
nevermind, changed permissions on dtc in /usr/bin
Build finished with this log
Click to expand...
Click to collapse
Got it to boot?
Regards,
acervenky
acervenky said:
Got it to boot?
Regards,
acervenky
Click to expand...
Click to collapse
Not yet. Need to flash pie miui first because I am on q now.
Hey acervenky I saw you used my same defconfig for F2FS and the same F2FS zip on your repo, but I compiled for a buddy of mine (Mi9T Pro EEA) and it refuses to boot F2FS? Did you change anything else? Head scratching here why it works on a Mi9 and your QUAX but not when I build this way. Thanks.
mslezak said:
Hey acervenky I saw you used my same defconfig for F2FS and the same F2FS zip on your repo, but I compiled for a buddy of mine (Mi9T Pro EEA) and it refuses to boot F2FS? Did you change anything else? Head scratching here why it works on a Mi9 and your QUAX but not when I build this way. Thanks.
Click to expand...
Click to collapse
Upstreamed F2FS, arter has a post dedicated to this maybe you can check that out?
Regards,
acervenky
after compile i found some error on kernel.log
DTC arch/arm64/boot/dts/qcom/apq8016-sbc.dtb
scripts/Makefile.lib:325: recipe for target 'arch/arm64/boot/dts/qcom/apq8016-sbc.dtb' failed
../scripts/Makefile.build:678: recipe for target 'arch/arm64/boot/dts/qcom' failed
arch/arm64/Makefile:184: recipe for target 'dtbs' failed
CC lib/iomap_copy.o
Xeniel768 said:
after compile i found some error on kernel.log
DTC arch/arm64/boot/dts/qcom/apq8016-sbc.dtb
scripts/Makefile.lib:325: recipe for target 'arch/arm64/boot/dts/qcom/apq8016-sbc.dtb' failed
../scripts/Makefile.build:678: recipe for target 'arch/arm64/boot/dts/qcom' failed
arch/arm64/Makefile:184: recipe for target 'dtbs' failed
CC lib/iomap_copy.o
Click to expand...
Click to collapse
Did you use the DTC attached to the OP?
If you're still facing issues try changing the permissions to 755 & try again.
Regards,
acervenky
acervenky said:
Did you use the DTC attached to the OP?
If you're still facing issues try changing the permissions to 755 & try again.
Regards,
acervenky
Click to expand...
Click to collapse
yea, i use dtc from attachment but still error
i already upload some log and screenshot link below
*drive.google*com/open?id=1YRZ912cDuWCGNlyfQXQKyfnEpl_2eJNi
Xeniel768 said:
yea, i use dtc from attachment but still error
i already upload some log and screenshot link below
*drive.google*com/open?id=1YRZ912cDuWCGNlyfQXQKyfnEpl_2eJNi
Click to expand...
Click to collapse
Checked out your screenshots, seems like you placed the dtc inside the source folder.
Placing it in root/usr/bin will fix your error!
Regards,
acervenky
nice guide.