[llvmlinux] Cross Compiling Android Kernel

Vinícius Tinti viniciustinti at gmail.com
Fri Mar 6 12:35:01 UTC 2015


On Thu, Mar 5, 2015 at 7:21 PM, Fürst Stefan <dieb.stefan.96 at gmail.com>
wrote:

> Hello guys maybe someone here is able to help me,
>
> I am getting weird errors while cross compiling and android kernel.
>
> I installed clang 3.7 on my ubuntu machine.
>
> This is my github if anyone is interested in:
> https://github.com/DerRomtester/one_plus_one/commits/clang
>
Hi Stefan,

Really nice!

> I think i added all necessary patches to make it working but it does not
> work.
>
> When i cross compile without adding a target to Makefile: to hostcflags
> and hostcxxflags i get these errors:http://pastebin.com/HWSBAYhy
>
> Than i figured out that the target is missing i added to hostcflags and
> hostcxxflags and i get another weird errors:http://pastebin.com/B9fu1P8u
>
> Am i using the wrong target? Or what is the problem related to.
>
I don't think so.

> To compile i used make V=1 ARCH=arm SUBARCH=arm
> CC=/usr/lib/llvm-3.7/bin/clang HOSTCC=clang
>
> How can i solve this? Is there something missing?
>
It is quite standard/simple to use Clang for building a native kernel -
build x86 target on a x86 machine. But it is not so simple to
cross-compile, you need either to use more extra commands or use the
LLVMLinux build system.

Which I recommend at first. It is pretty easy to get one target working.
Just copy and paste 'rpi' target for example and rename some stuff.

If you don't want to use it I don't remember all extra commands by heart
but you can get them this way:

git clone http://git.linuxfoundation.org/llvmlinux.git
cd llvmlinux
cd targets/vexpress
make kernel-shell-for-build

Unfortunately this will perform many of the build systems steps (sorry).
But after that it will print a variable called BUILD_COMMAND which have all
things you need to build outside LLVMLinux build system.

In fact this exports all things you need to give you a shell in which you
can do every kernel command: make kernel/pid.s, make kernel/pid.ll and so.

It is also possible to get BUILD_COMMAND by looking at the Makefile code.
http://git.linuxfoundation.org/?p=llvmlinux.git;a=commitdiff;h=d86559e8fa8be2ea1a36488bfbff7431a27b92d1

We will add a documentation for that since is not the first time someone
asks for the commands to cross-compile.

Let me know if it works,

Regards,
Vinicius

>  Kind regards
>
> Stefan
>
> _______________________________________________
> LLVMLinux mailing list
> LLVMLinux at lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux
>



-- 
Simplicity is the ultimate sophistication
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/llvmlinux/attachments/20150306/5379b0e3/attachment.html>


More information about the LLVMLinux mailing list