mac on linux,building Linux kernel on Mac OS X

Compile Kernel using AOSP's prebuilts

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:

Missing Linux headers: gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8

Cross compiler: gcc/darwin-x86/arm/arm-eabi-4.8/

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.

Install the missing headers

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.

install_headers.sh:

#!/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

Build the kernel

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

Voila:

Kernel: arch/arm/boot/zImage-dtb is ready

My configuration

macOS Sierra 10.12.3

XCode: using MacOSX10.11.sdk, which allows building AOSP on mac

Target device: N6/shamu

AOSP branch: Marshmallow (updated mac_version.mk in build to allow using 10.12.3 sdk)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值