Commit Graph

73 Commits

Author SHA1 Message Date
micky387
a8b479083d envsetup.sh: Export LLVM_AOSP_PREBUILTS_VERSION with the current clang version from soong
Needed for KERNEL_CLANG_VERSION if TARGET_KERNEL_CLANG_VERSION hasn't been set by the device config

It's boring to change it on each Google change ...

Change-Id: I1d682611cbf6c60d7ae6227b0b5afde591adf471
2025-06-26 22:04:16 +01:00
Michael Bestas
8fffe25133 kernel: Update default clang version to clang-r536225
Change-Id: I3235780e4f657075f46048205f8450972f1fc1f8
2025-03-21 21:37:24 +00:00
Yumi Yukimura
1241611c87 kernel: Use libc sysroot from host for 6.11+
Linux kernel 6.11 has removed support for old libc versions by commit
[1]. The commit message implies it's done as part of retiring
RHEL/CentOS 7, CentOS 7 includes glibc 2.17, All glibc available from
AOSP are NOT newer than that version.

Before there's a better solution, use libc sysroot from host.

[1]: 3914cdde89

Change-Id: I9210a9b4742304214d90f7d319b06167f0508052
2025-03-18 19:15:22 +00:00
voidanix
292ca28a2e kernel: Block HIP detection through HIP_PATH=none
The issue of the multi-lined, wrongly expanded LINUX_COMPILER macro is
back (at least for kernel 4.14).

Funnily enough, setting "--hip-path=/dev/null", or using any other file
or directory that exists, would still make clang happy and give a
message stating that it detected HIP anyways:

  Found HIP installation: /dev/null, version 3.5.0

To get around this issue, without doing monumental backports and
avoiding warnings from "-Wunused-command-line-argument", set
"HIP_PATH=none", where "none" simply indicates a non-existing
file/directory.

Change-Id: Ia97d69425716d28208ba344bde79a910e5f75c84
Signed-off-by: voidanix <voidanix@keyedlimepie.org>
2024-12-27 01:00:34 +01:00
Michael Bestas
a9e1b5ef77 kernel: Update default clang version to clang-r530567
Change-Id: I09b226998307b65e0d82c74258f3fb4b0a3857d4
2024-12-19 23:28:24 +00:00
Aaron Kling
6bdd84760c Revert "kernel: Use CPATH for including host headers"
This reverts commit 2baeb4fb8b.

CPATH is used for both host and target. Meaning that system headers
will be used for target compilation. It is also a higher priority than
isystem, which is used for the compiler include paths, making this
override the compiler headers.

Change-Id: I4d836698f25d2d97d917d323a22ee359b937fcb4
2024-11-22 03:06:39 +00:00
Aaron Kling
3d33aaeee6 kernel: Add rust prebuilts to path
Starting with android common kernel 6.6, rust is enabled for arm64 gki.
It currently looks for rust version 1.73.0, so that was selected as the
default. This was only added for the clang compile path as gki requires
clang.

Change-Id: Ie7b57568d74cfb4a28a94c8dc8f4b5c622044317
2024-10-21 23:26:39 +00:00
Michael Bestas
76c539efe2 kernel: Update default clang version to r522817
The default build system version was updated for 15.

Change-Id: I177d01d98ba5dcdc2582372d2c61f7facfd41451
2024-10-19 01:10:12 +02:00
Aaron Kling
d2d4e46340 kernel: Default to no gcc on kernel 6.x
Current logic defaults to no gcc if kernel major version is greater than
or equal to 5 and kernel minor version is greater than or equal to 10.
Meaning kernel version 6.1 does not qualify because 1 is less than 10.
So additionally check if kernel major version is greater than or equal
to 6 and ignore minor version for that case.

Change-Id: Id72cb9e100c6fed014d696f4a3a88f6cafcd3932
2024-01-03 16:09:59 +00:00
basamaryan
110a25a2c8 config: Update clang version to clang-r487747c
* This is the default clang version for Android U release

Change-Id: I6a44012250470eeeb2e0f6993eb4e98308eec390
2023-10-20 09:55:48 +01:00
LuK1337
589f0cad77 kernel: Use lz4 from Google prebuilts
Fixes: "lz4" is not allowed to be used.

Test: breakfast tangorpro && m bootimage
Change-Id: I62cfe131f457117cb3745b91f5e43c085e87b611
2023-10-06 09:37:51 +00:00
Bruno Martins
231338af58 kernel: Use pahole from Google prebuilts
This fixes the following warnings:

  13:04:54 Disallowed PATH tool "pahole" used: []string{"pahole", "--version"}
  13:04:54 See https://android.googlesource.com/platform/build/+/master/Changes.md#PATH_Tools for more information.
  "pahole" is not allowed to be used. See https://android.googlesource.com/platform/build/+/master/Changes.md#PATH_Tools for more information.
  /home/bgcngm/android/lineage/kernel/oneplus/sm8550/scripts/pahole-flags.sh: 12: [: Illegal number:
  /home/bgcngm/android/lineage/kernel/oneplus/sm8550/scripts/pahole-flags.sh: 16: [: Illegal number:
  /home/bgcngm/android/lineage/kernel/oneplus/sm8550/scripts/pahole-flags.sh: 20: [: Illegal number:

Change-Id: Ice2a3753301a7b7782037fd35544e2831b258650
2023-09-19 16:17:27 +01:00
LuK1337
eb934e66c4 kernel: Don't try to do math on empty kernel version
Fixes the following error message when compiling target w/o kernel src:
expr: syntax error: unexpected argument ‘5’

Test: lunch lineage_sdk_phone_x86_64-eng
Change-Id: Ib3ec41d9dc2b59ddc9ee3c0c8e3813c4defcfc3e
2023-08-01 20:04:09 +02:00
Michael Bestas
57a063cff7 kernel: Restore TARGET_KERNEL_VERSION
This is used in a bunch of QCOM HALs

Change-Id: I5bb76c47ad33e9fb1b81d1d23f78b2dbf390473a
2023-05-26 21:33:48 +03:00
Bruno Martins
2a7b321d51 kernel: Go full LLVM build on 5.10+ kernels
Make the conditions accurately reflect the comment:
"5.10+ can fully compile without GCC by default".

Change-Id: Ia9070871c23a710ba5b461ad522db241183e34d1
2023-05-24 11:31:08 +01:00
Michael Bestas
41abb0b970 kernel: Allow devices to opt-in for full LLVM build
android11-5.4 kernel can fully compile with LLVM with a few cherrypicks
from android12-5.4 and android12-5.10

Change-Id: Ib71935d284ad78f1c23d039c15bfc5e0314a19eb
2022-11-14 19:20:23 +02:00
Michael Bestas
0693b10516 kernel: Remove darwin support
Darwin kernel build is not supported for >=5.10
and non-standard clang versions.
Another side effect is that it causes LD_LIBRARY_PATH
to get overwritten, which breaks certain configurations.
Let's just get rid of it since AOSP darwin build is no longer supported.

Change-Id: I9ac642996b90937bd9c52138fb06bf1eff901c8b
2022-11-01 17:15:13 +02:00
Michael Bestas
69e7a49d95 kernel: Fix clang version override
Change-Id: I18fceeeeab5426f55a73d0cb8d72abd5f40c67ec
2022-11-01 15:55:18 +02:00
Alexander Koskovich
70b1bf3812 lineage: kernel: Use getconf instead of nproc
Change-Id: Id8215f290a88ddf3a6bc1764d9ef9a09f6aa810d
2022-10-02 17:47:00 +02:00
Michael Bestas
0d450dd954 kernel: Changes for 5.10 build without GCC
Change-Id: Id6e09467937e60e6b00a30a246ba0a4a8d71687b
2022-10-01 00:46:45 +03:00
Michael Bestas
c80ca08861 kernel: Slightly reorder config
Prepare for 5.10 kernel build changes

Change-Id: I79ecf0655f9adc894091c4f26de337ebe03e3ca2
2022-10-01 00:41:24 +03:00
Michael Bestas
728eff7557 kernel: Use consistent spacing
Change-Id: Ia01336f14599ec8d767d88ad3b76f7bb97153848
2022-10-01 00:39:11 +03:00
Michael Bestas
bca38c6f68 kernel: Use LLVM binutils by default
* GCC has been completely removed in AOSP but we keep it
  for compatibility reasons with older kernels until they
  are adapted to remove all the dependencies to GCC.
* Most updated 4.19+ kernels should be able to use LLVM
  binutils out of the box. 4.14 is possible with a few patches
  and 4.9 with even more patches.
* Make this the default and allow devices opting out by using
  TARGET_KERNEL_LLVM_BINUTILS := false

Change-Id: I569cf290b41aaf2dc16ff9cc4cc6dc461f0d504e
2022-09-13 14:37:09 +02:00
Alexander Koskovich
9ec1fed30b kernel: Drop -fuse-ld=lld from CFLAGS
clang-14: error: argument unused during compilation:
'-fuse-ld=lld' [-Werror,-Wunused-command-line-argument]

Change-Id: Ic863e8707e4c57c7d03183b6cb6d3cd38e919bcb
2022-09-11 11:48:25 +01:00
Michael Bestas
18dd1748df kernel: Changes for LLVM binutils
* Remove KERNEL_LD from kernel.mk, we simply set LD in BoardConfigKernel
* Add llvm-ar in path allowlist (used by LTO)

Change-Id: I76addb6f9d8d413edb1832dba23082ffb6d5ebc3
2022-09-08 04:39:49 +03:00
Arian
1c470ddb20 config: Update clang version to clang-r450784d
This is the default clang version on android-13.0.0_r1

Change-Id: Iaecec88ce0a462403d0a3cf705ce794c230e6bd9
2022-08-23 02:02:20 +03:00
Neel Chauhan
fadfdbf4f5 kernel.mk: Allow building external kernel modules
Here, we introduce the TARGET_EXTERNAL_KERNEL_MODULES variable
for the list of external modules.

Change-Id: I1f8b7a48e66bb0c9efbc396692e5a7159f0b835c
2022-08-11 18:34:23 +03:00
Michael Bestas
98447383e4 kernel: Allow overriding dtb target
On some devices we might want to build just the *.dtb files
that we actually need instead of the every dtb that exists.

Change-Id: Id7a152499d4ee1dd08f79d34cc34bfe959313515
2022-08-11 18:34:23 +03:00
Michael Bestas
7e054e52ac kernel: Allow setting dtbo target path prefix
gs101 uses DTBO_OBJ/arch/arm64/boot/dts/google/dtbo.img
vs DTBO_OBJ/arch/arm/boot/dtbo.img on previous devices.

Change-Id: I945d31cb093fae97385cf84c273088ee7a4edf0b
2022-08-11 18:34:23 +03:00
Michael Bestas
12b812b4c9 kernel: Allow overriding dtbo target name
gs101 kernel uses google/dtbo.img target for dtbo.img

Change-Id: Ib03f35c0035f56d303771de9399bcce3d02c0775
2022-08-11 18:34:23 +03:00
Michael Bestas
eaf4a49adf config: Use LLVM binutils for 5.10 as well
Change-Id: I14afa17d710778403cd7fecf842c952c569c0c35
2022-08-11 18:34:23 +03:00
Jason Wojcik
92b2067a53 lineage: config: Use $(abspath .) instead of $(shell pwd)
Change-Id: I7fec28b7cb507918b1b55dd368a74c927a8fc1d2
2022-07-14 18:49:45 +02:00
Chirayu Desai
15770b25c9 kernel: Don't print grep error messages when checking version
Avoids:
$ lunch lineage_sdk_phone_x86
grep: build/make/target/board/emulator_x86/Makefile: No such file or directory (x4)

Change-Id: Ie803d5ca93e6e7ae94625e7ee3ab0bf337e0515d
2022-07-08 16:04:46 +02:00
Alexander Koskovich
a78681c09c kernel: Move TARGET_KERNEL_ADDITIONAL_FLAGS to kernel task
* Currently, because DTC_EXT make flag is in the
   kernel task the only way to override it is to
   have TARGET_KERNEL_ADDITIONAL_FLAGS come after.

Change-Id: If62ed979581dc07eafd4628ce2b2d799388d3704
2022-06-24 14:23:06 +03:00
Alexander Koskovich
d807db71bc lineage: config: Don't pass CFLAGS_MODULE="-fno-pic" if using LLVM
* Seemingly not an issue for kernels compiled with
   LLVM, tested with kernel versions 4.4 -> 5.4.

Change-Id: I00adee2e10e99a540099b5e1a6a1ab9be0b99050
2022-06-24 14:23:05 +03:00
Alexander Koskovich
09a874fe75 kernel: Use LLVM's substitutes for GNU binutils if possible
Co-authored-by: LuK1337 <priv.luk@gmail.com>
Change-Id: I06884fb774b6548aad68942f1ce659384521c62a
2022-06-24 14:23:05 +03:00
Alexander Koskovich
6d88852d2e lineage: config: Make LLVM kernel compile the default
* GCC was deprecated awhile ago, the large majority
   of devices should now be using this. Clang should
   be opt out as opposed to opt in.

Change-Id: Ie388aff8eca189663f2f615f7d059e47eaf2dce3
2022-03-10 11:06:43 +01:00
Alessandro Astone
174ee28d0f Revert "Revert "kernel: fix KERNEL_TOOLCHAIN_PATH_gcc and usage""
The fix was correct...

This reverts commit 168fd231b6.

Change-Id: If550fd44f32b801553b8ac23cb2a91d3f29df557
2022-01-06 16:41:05 +01:00
LuK1337
3786aa43a0 kernel: Add 32-bit GCC to PATH for vdso32
Change-Id: Ifff495069ab33d9b1346971a21f380f0c23ebf48
2021-10-27 00:26:52 +02:00
Arian
aca64b083a config: Update clang version to clang-r416183b1
* That's the default clang version on android-12.0.0_r1

Change-Id: I528d9a6aa497f7c9a0f53b0e778d0eeefaac0e9d
2021-10-07 11:43:23 +02:00
LibXZR
d5b4b59b64 kernel: Fix vdso32 building for 4.19+ kernels
This flag has been renamed in 4.19 kernels
https://android.googlesource.com/kernel/common/+/refs/heads/android-4.19-stable/arch/arm64/kernel/vdso32/Makefile#13

Change-Id: I92db29aa124da7c9fc63454d9443373bdc2e16e7
2021-08-23 18:05:25 +02:00
Sebastiano Barezzi
c86a1a8128 kernel: Add TARGET_FORCE_PREBUILT_KERNEL flag
* TARGET_FORCE_PREBUILT_KERNEL should be useful when you don't have ready kernel sources (OEM releasing broken sources or releasing them lately)
* It lets you use kernel sources for userspace generated headers (generated_kernel_headers) while keeping using prebuilt kernel
* Keep in mind that generated kernel headers may not align with the ABI of kernel you're including
* This commit also partially revert commit a836d79, where TARGET_KERNEL_SOURCE would have been unset if TARGET_PREBUILT_KERNEL was defined (we already check in kernel.mk if kernel sources are present anyway)

Change-Id: I84acae890dabb5b9dbd48143ad58f6420c0cef75
2021-06-24 11:50:07 +02:00
Alessandro Astone
d11ff7c5ab kernel: Add prebuilt m4 to build environment
* android-11 removed M4 from the Allowed list, and provided a
   prebuilt binary in prebuilts/build-tools

Change-Id: I83d033ecd35a0e2318210e47309fcc010843347f
2020-09-24 16:21:42 +02:00
LuK1337
a413b6ee55 kernel: Use Clang as HOST_{CC,CXX}
GCC was deprecated upstream, so switch to Clang.

Change-Id: I8a6c9d6b763db0055189d83f9037ccb0c50a23ea
2020-09-24 11:59:52 +01:00
dianlujitao
2c62140d3d kernel: Use nproc from prebuilts
Change-Id: I1d7a33dac57cbba9ce1a92f81d74709146e92968
2020-09-24 11:58:50 +01:00
Bruno Martins
c3ad8b5c54 lineage: Use $(HOST_PREBUILT_TAG) where possible
Change-Id: If211d23ce72b3404368cd723cbb9ea801e61802c
2020-09-24 11:56:08 +01:00
LuK1337
2baeb4fb8b kernel: Use CPATH for including host headers
* Fixes build on distros where CAP_LAST_CAP @ /usr/include/linux/capability.h
  doesn't match target device kernel src.

Change-Id: Iafdf9694fd165c83b22bd95df95e940ecceb0fdd
2020-09-02 19:44:54 +02:00
Luca Stefani
fe00ea90c9 kernel: Rework how DTB/DTBO are built
* Remove the separate dtbo.mk task and merge it
  in kernel.mk
* Merge in-kernel and separated DTBO image generation

Change-Id: I2cae84095cbd3d68abbe1899a9cae34c8a1e5fc9
2020-08-22 20:26:13 +02:00
dianlujitao
a24144faf2 kernel: Add bison and flex to build environment
* Required since Linux 4.16

Change-Id: I107ea1b097d72a7b5251273c8c7e33ad6585b59c
Signed-off-by: Jesse Chan <jc@lineageos.org>
2020-05-29 17:31:10 +02:00
Rashed Abdel-Tawab
e3c319a271 kernel: Move our dtb.img logic here
Our build/make changes break incremenetal builds with prebuilt dtb dir
(see discussion here: https://android-review.googlesource.com/c/platform/build/+/1134337/1/core/Makefile )

Instead of using the AOSP recipe, just define our own and use it by not defining
BOARD_PREBUILT_DTBIMAGE_DIR

Change-Id: If579b1670db447557b6f76ca79ecec22661c4080
2019-10-07 14:46:06 -04:00