I am doing a project to modify the Linux kernel. I have a desktop Linux machine and I have no problem building kernel on it.
However, I am going on a trip and I want to
I've made symlinks to the missing OSX headers from the linux host ones and apparently it worked out well! In my setup I have sync'd the whole AOSP repo, which includes all prebuilts, but the ones that I am actually using to built the kernel are:
Clone them so that the following directory tree is valid:
/prebuilts/
/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/
/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.8/
Make sure you checkout the appropriate branch/tag, according to your Android target version.
Not sure if it's the proper way to do it, but putting the a bunch of linux headers in /usr/local/include
resolves all issues. Don't forget to chmod +x
the script.
#!/bin/sh
PREBUILTS_DIR="/prebuilts" # fill in the path here!
PREBUILT_GCC=$PREBUILTS_DIR"/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8"
KERNEL_HEADERS=$PREBUILT_GCC"/sysroot/usr/include"
HOST_HEADERS="/usr/local/include"
function install_header() {
header=$1
ln -s $KERNEL_HEADERS/$header $HOST_HEADERS/$header
}
# create symlinks for the missing headers
install_header elf.h
install_header features.h
# the following are folders (that contain headers)
install_header bits
install_header gnu
install_header linux
install_header asm
install_header asm-generic
export PATH=/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.8/bin:$PATH
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=arm-eabi-
# in this example it builds for N6
make shamu_defconfig
make -j8
Kernel: arch/arm/boot/zImage-dtb is ready
AOSP
on macmac_version.mk
in build
to allow using 10.12.3 sdk)