You are not logged in.
Pages: 1
Hey guys, I am trying to learn android kernel compiling and I want to learn it with Arch, since it has been my favorite Linux distribution.
My problem is, that I can't setup up the proton clang toolchain properly.
I used this one:
https://aur.archlinux.org/packages/llvm-proton-bin/ (which is a fork of https://github.com/kdrag0n/proton-clang)
Readme:
Make sure you have this toolchain in your PATH:
export PATH="$HOME/toolchains/proton-clang/bin:$PATH" //*1
For an AArch64 cross-compilation setup, you must set the following variables. Some of them can be environment variables, but some must be passed directly to make as a command-line argument. It is recommended to pass all of them as make arguments to avoid confusing errors:
CC=clang (must be passed directly to make) //*2
CROSS_COMPILE=aarch64-linux-gnu-
If your kernel has a 32-bit vDSO: CROSS_COMPILE_ARM32=arm-linux-gnueabi-Optionally, you can also choose to use as many LLVM tools as possible to reduce reliance on binutils. All of these must be passed directly to make:
AR=llvm-ar
NM=llvm-nm
OBJCOPY=llvm-objcopy
OBJDUMP=llvm-objdump
STRIP=llvm-stripNote, however, that additional kernel patches may be required for these LLVM tools to work. It is also possible to replace the binutils linkers (lf.bfd and ld.gold) with lld and use Clang's integrated assembler for inline assembly in C code, but that will require many more kernel patches and it is currently impossible to use the integrated assembler for all assembly code in the kernel.
*1) Where do I save this?
*2) I am reading out that I have to pass it to make directly, which is for me something like this "make --cc=clang ..." but I didn't find anything reliable about passing commands to make.
I also tried to install the normal clang package from the repos, but I don't know how to setup any of this toolchains.
When I try make CC=clang it gives me:
2 errors generated.
make[1]: *** [Kbuild:58: arch/x86/kernel/asm-offsets.s] Error 1
make: *** [Makefile:1268: prepare0] Error 2
Makefile:1268 refers to:
prepare0: archprepare gcc-plugins
$(Q)$(MAKE) $(build)=.
Linux kernel compiling works flawlessly for me.
Last edited by ViralWizard (2020-09-07 19:34:34)
Offline
That aur package is not a fork, but a package that installs a pre-compiled version of the full proton clang toolchain.
There doesn't appear to be a package to build that toolchain from source and compilers are usually hard to package.
No idea how to build an adroid kernel, but there is a wiki article I think you'll find interesting : https://wiki.archlinux.org/index.php/Android
For more info about AUR & archlinux packages , check https://wiki.archlinux.org/index.php/Ar … Repository.
Make sure to follow the links on the page.
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
it gets more complicated when you throw clang into the mix, it complains about more that regular old gcc doesn't, there are patches to make the kernel behave though, as well as command line examples here, heres a gcc based aarch64 cross toolchain, though a bit old, (gcc-4.9, which for whatever reason is the ancient gcc version usually used with android, though newer versions often work with android kernels as well),
there are others out there that can be used from any directory as well, including some linked in the xda forum thread below
Offline
Pages: 1