forked from arunkumarneelam511/device
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHow-To-Compile
More file actions
executable file
·39 lines (30 loc) · 2.02 KB
/
How-To-Compile
File metadata and controls
executable file
·39 lines (30 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
1.install toolchain and make tools for build kernel
(1)mkdir -p ~/workspace/source; cd ~/workspace/source;
(2)git clone kernel;
(3)mkdir prebuild;
git clone https://android.googlesource.com/platform/prebuilts/build-tools;
git clone https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86;
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9.1
(4) add toolchain path to PATH environment variable
2. export some environment variable and build the kernel and dtb ,mobile model RMX3085 use oppo6785;RMX3191,RM3192,RMX3193 use oppo6768 instead of oppo6785,RMX3195,RMX3197,RMX3430 use oppo6769 instead of oppo6785 below
export SOURCE_ROOT=~/workspace/source
export DEFCONFIG=oppo6785_defconfig
export COMPILE_PLATFORM=oppo6785
export OPPO_COMPILE_PLATFORM=oppo6785
export PATH=${SOURCE_ROOT}/prebuilts/clang/host/linux-x86/clang-r383902b/bin:${SOURCE_ROOT}/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin:/usr/bin:/bin:$PATH
export MAKE_PATH=${SOURCE_ROOT}/prebuilts/build-tools/linux-x86/bin/
export CROSS_COMPILE=${SOURCE_ROOT}/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9.1/bin/aarch64-linux-androidkernel-
export KERNEL_ARCH=arm64
export KERNEL_DIR=${SOURCE_ROOT}/kernel-4.14
export KERNEL_OUT=${KERNEL_DIR}/../kernel_out
export KERNEL_SRC=${KERNEL_OUT}
export CLANG_TRIPLE=aarch64-linux-gnu-
export OUT_DIR=${KERNEL_OUT}
export ARCH=${KERNEL_ARCH}
export TARGET_INCLUDES=${TARGET_KERNEL_MAKE_CFLAGS}
export TARGET_LINCLUDES=${TARGET_KERNEL_MAKE_LDFLAGS}
export TARGET_KERNEL_MAKE_ENV+="LD=ld.lld NM=llvm-nm OBJCOPY=llvm-objcopy CC=${SOURCE_ROOT}/prebuilts/clang/host/linux-x86/clang-r383902b/bin/clang"
cd ${KERNEL_DIR} && \
${MAKE_PATH}make O=${OUT_DIR} ${TARGET_KERNEL_MAKE_ENV} HOSTLDFLAGS="${TARGET_LINCLUDES}" ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} ${DEFCONFIG}
cd ${OUT_DIR} && \
${MAKE_PATH}make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} HOSTCFLAGS="${TARGET_INCLUDES}" HOSTLDFLAGS="${TARGET_LINCLUDES}" O=${OUT_DIR} ${TARGET_KERNEL_MAKE_ENV}