查看原文
其他

ndk配置内核交叉编译环境(1)

云天实验室 哆啦安全 2022-05-24

nexus5 Android7.1.2

查看cpu信息、内核版本


goldfish的内核代码主分支

https://android.googlesource.com/kernel/goldfishhttps://android.googlesource.com/kernel/msm.gitgit clone https://android.googlesource.com/kernel/goldfish -b android-goldfish-3.4git clone https://aosp.tuna.tsinghua.edu.cn/kernel/goldfish -b android-goldfish-3.4 android-goldfish-3.4git clone https://aosp.tuna.tsinghua.edu.cn/kernel/goldfish -b android-goldfish-3.10 android-goldfish-3.10


ndk下载

https://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip



编译3.4内核

git clone https://aosp.tuna.tsinghua.edu.cn/kernel/goldfish -b android-goldfish-3.4 android-goldfish-3.4


sudo vim ~/.bashrc

export ARCH=x86export PATH=$PATH:~/gyp/android-ndk-r10e/toolchains/x86-4.9/prebuilt/linux-x86_64/binexport CROSS_COMPILE=i686-linux-android-
export ARCH=armexport PATH=$PATH:~/gyp/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/binexport CROSS_COMPILE=arm-linux-androideabi-
export ARCH=arm64export PATH=$PATH:~/gyp/android-ndk-r10e/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/binexport CROSS_COMPILE=aarch64-linux-android-


source ~/.bashrc


make goldfish_defconfig

make -j4



编译3.10内核

git clone https://aosp.tuna.tsinghua.edu.cn/kernel/goldfish -b android-goldfish-3.10 android-goldfish-3.10


sudo vim ~/.bashrc

export ARCH=x86export PATH=$PATH:~/gyp/android-ndk-r10e/toolchains/x86-4.9/prebuilt/linux-x86_64/binexport CROSS_COMPILE=i686-linux-android-
export ARCH=armexport PATH=$PATH:~/gyp/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/binexport CROSS_COMPILE=arm-linux-androideabi-
export ARCH=arm64export PATH=$PATH:~/gyp/android-ndk-r10e/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/binexport CROSS_COMPILE=aarch64-linux-android-

source ~/.bashrc


make i386_qemu_defconfig

make -j4


编译nexus5 hammerhead内核




oneplus内核编译成功




使用Docker编译Android系统内核

Android Linux内核编译调试


您可能也对以下帖子感兴趣

文章有问题?点此查看未经处理的缓存