-
Notifications
You must be signed in to change notification settings - Fork 17
/
How-To-Compile
executable file
·39 lines (30 loc) · 1.98 KB
/
How-To-Compile
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 ,oppo6785 instead of oppo6769 follow for mobile model RMX2151 RMX2183 RMX2161 RMX2001 RMX2001 RMX2003 RMX2002 RMX2156
export SOURCE_ROOT=~/workspace/source
export DEFCONFIG=oppo6769_defconfig
export COMPILE_PLATFORM=oppo6769
export OPPO_COMPILE_PLATFORM=oppo6769
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}