Commit graph

154 commits

Author SHA1 Message Date
dianlujitao
62c1374385 kernel: Check HIP support of clang before disabling it
Old clang releases don't support --hip-path, so passing this flag will
break the build.

Change-Id: If36defb0e74893581849700fb67e6aa4617908a8
2023-03-02 20:43:04 +08:00
dianlujitao
ef68678120 kernel: Force disable LLVM HIP
Gets rid of the following from clang -v:

```
Found HIP installation: /opt/rocm, version 5.4.22804
```

Change-Id: Ic58b3fb2dd67d345372bec7f5d2cf023ed2fb34d
2023-03-01 23:07:23 +08:00
Alessandro Astone
ba14020f85 kernel: Force disable LLVM CUDA
The kernel tries to define the LINUX_COMPILER macro from the output
of `$(CC) -v | grep ' version '`, but in clang that might produce
more than one line containing ' version ' when CUDA is installed:

```
Android (8490178, based on r450784d) clang version 14.0.6
Found CUDA installation: /usr/local/cuda, version 11.0
```

That causes the macro to expand into multiple lines, upsetting the
compiler that cannot find the ending double quote.

In upstream linux this is fixed from v5.8

Change-Id: Icde4253e989df1cbbefc0ce98f437d16822fc93b
2023-01-22 19:51:39 +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
bdfc913935
kernel: Support copying modules to vendor_kernel_boot
Test: Build gs201 with source built kernel/modules, boot.
Change-Id: Ie66400ddd44cfd249e1b4710f4d1c4efa32389a4
2022-11-04 02:12:55 +02:00
Michael Bestas
be4730a53e
kernel: Remove TARGET_KERNEL_MODULES error
This has been an error for 3 years now, plus it has not been functional
for even more years.

Change-Id: I8b12e8d08847ba119d2904f90766105367025d9c
2022-11-01 17:15:13 +02:00
Michael Bestas
2adf74c191
kernel: Only add GCC to PATH when using GNU binutils
Change-Id: Ia842ed409145a81a92077dde5d6e9749a057f047
2022-11-01 17:15:13 +02:00
Michael Bestas
19c16dff32
kernel: Override LD_LIBRARY_PATH only on <5.10
5.10 doesn't need LD_LIBRARY_PATH set

Change-Id: I5f6e732610f947d50b47e238d6a42365396b18ad
2022-11-01 15:55:19 +02:00
Michael Bestas
69e7a49d95
kernel: Fix clang version override
Change-Id: I18fceeeeab5426f55a73d0cb8d72abd5f40c67ec
2022-11-01 15:55:18 +02:00
Aaron Kling
50de801adf kernel: Add support for custom dtbimage generation rules
Change-Id: I79d67f9f40ef3f0970d0e29393d00600b57e337b
2022-10-18 00:59:46 +02:00
Tim Zimmermann
bcfa69d705 kernel: Support building dtbimage with mkdtboimg.py config
Change-Id: Ic0efbf0308e334c1cfe0df0493caa71afe27a621
2022-10-02 17:45:12 +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
8ab31cfc01
kernel: add pahole dependency
This is needed for 5.10+ T kernel build.

Change-Id: I0729af39cad5509ea3bc8629fdf1176156be6c08
2022-09-28 22:03:50 +03:00
Luca Stefani
a1af8cb166 kernel: Allow passing empty DTB to mkbootimg via board-flag
* Boot Image header v2 demands a DTB be passed by default.
* We don't /need/ one at all, as we have and use a dedicated
  DTB partition.
* Signing hates trying to find dtb.img anywhere for some magical
  reason, so cheat and introduce a flag to include a blank one.

Change-Id: I889ce3815476a55829870b30de1b9210283a79ae
(cherry picked from commit fa16b42ddd1eb341f201b8d810c717ea12afe1cb)
2022-09-15 23:02:14 +02: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
Michael Bestas
5dfc89a4db
kernel: Always build dtb targets before dtbo.img
Fixes:
error: unable to open output file
'arch/arm64/boot/dts/google/devices/bluejay/google-base/.gs101-b0.dtb.dts.tmp':
'No such file or directory'

Change-Id: I457062e46062fb3553421d196b432de7d06a49ad
2022-08-13 15:16:31 +03:00
Michael Bestas
319d4c4e9a
kernel: Add support for vendor_boot image header version 4
vendor_boot v4 supports packaging multiple "fragmented" vendor ramdisks.
A secondary can be used to store the kernel modules instead of storing
them in the "normal" vendor_ramdisk.

Test: Create a vendor_boot with source built kernel/modules,
      gs101 still boots.
Change-Id: Ic295ccf201c2593e08b9559ae28f80c70a7eb341
2022-08-13 03:02:44 +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
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
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
911b7c47b3
kernel: Switch to AOSP DTC instead of using scripts/dtc
Change-Id: I8faf295dfb84ab7481b80d5b7d2add8ed8ddf6d9
2022-06-24 14:23:05 +03:00
Michael Bestas
87c0acd05e Revert "kernel: Remove unneeded MKDTIMG dependency"
This reverts commit caa3bddf00.

Reason for revert: Breaks pixel dtbo.img build, since kernel depends on
mkdtimg. Add it back so it gets compiled and kernel can pick it up.

Change-Id: I2b9fd0b2b35e0cf2f908516b10f65399780d5c30
2022-06-20 11:51:56 +02:00
Michael Bestas
caa3bddf00 kernel: Remove unneeded MKDTIMG dependency
Change-Id: Icc1923e922adb50b02252883aa6814101837adfc
2022-06-18 10:26:14 +02:00
dianlujitao
709371be5e kernel: Ensure dtb(o) always get rebuilt
* AOSP build system is not aware of dtb(o) source update, and thus
   won't rebuild the images, results in outdated artifact.
 * Convert DTB(O)_OUT to make targets and make the images depend on them
   to address the issue. This makes AOSP build system be aware of
   their timestamp changes and re-execute recipes depending on them.
   Finally, it's up to kernel's build system to decide actions to take.

Test: m dtb(o)image and observe dtb(o).img get rebuilt
Change-Id: I197e7d2d3e013ded0e555fc22bb6a1200d40df9c
2022-06-18 10:26:14 +02:00
dianlujitao
9955cd657b kernel: Avoid unnecessary savedefconfig
Change-Id: I5400e549a6574208d67c5d107ca56eee402fa7f2
2022-06-18 10:26:14 +02:00
dianlujitao
8c6398e9fd kernel: Clean up kernel copy recipes
ACP and ALL_PREBUILT are dropped years ago and thus have become no-ops.

Change-Id: Ic317cb4a4fa406cce0dc86555fb8da34d21fb2bf
2022-06-18 10:26:14 +02:00
Alexander Koskovich
3bab7d780e lineage: build: Wipe DTB/O OBJs before build
* They can linger and cause problems, e.g. mismatching
   kernel and DTBs.

Change-Id: I4adafe140093ff675fc3f55e3233a754d44d5656
2022-05-31 01:37:14 +02:00
Bruno Martins
bf9c45fa42 kernel: Document TARGET_KERNEL_RECOVERY_CONFIG usage
Change-Id: Idefd38dae5e8beac7d7de797f3f792fea25dacef
2022-04-09 14:46:47 +02:00
Bruno Martins
f5023f46f9 kernel: Fix building recovery images
Commit 8ac7d31 introduced this issue.

Test: run `m recoveryimage` and verify that recovery
image is now built.

Change-Id: Iffdd8112db2ba1baff28db7ee4c340dbb5ebd917
2022-04-09 14:46:47 +02:00
Bruno Martins
03f2b69dc7 kernel: Fix kernel rebuilding
Commit 8ac7d31 introduced this issue.

Test: run `m installclean && m bootimage` and observe that
kernel image is built.

Change-Id: I41eb7cd2e5108bae8f4c40c0f9a300a8a3cc95a7
2022-04-09 12:58:09 +02:00
Sebastiano Barezzi
8ac7d31285 build: tasks: kernel: Rework kernel fragments handling
* Since some time you can specify multiple configs when you prepare .config and they'll get merged to main one
* To use it inline:
TARGET_KERNEL_CONFIG := main_defconfig fragment1.config fragment2.config ...
* TARGET_KERNEL_ADDITIONAL_CONFIG has been nuked since it's superseed by this new logic
* kernelsavedefconfig will only use the base defconfig

Change-Id: I479c762a9235ed0ef6fcdc79b53e084d5e2d78a6
2022-04-04 03:54:39 +02:00
Michael Bestas
518ab667f2 build: Fix kernelsavedefconfig target
Change-Id: Ie3d9a187693f2435f2555658c833de666848e48e
2022-03-15 17:21:22 +01: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
Jarl-Penguin
7adc095f6a kernel: INSTALLED_RECOVERY_KERNEL -> INSTALLED_RECOVERY_KERNEL_TARGET
* Make it consistent with the rest of the targets

Signed-off-by: Jarl-Penguin <jarlpenguin@outlook.com>
Change-Id: I869d3d8570b4deb2f1e019efa975526a528ca3e7
2022-02-20 13:26:31 +01:00
Alexander Koskovich
e220ca2625
lineage: tasks: Support copying kernel modules out to /vendor_dlkm.
Change-Id: I84993ba5e0190d310c326da7806e82f627e37a58
2022-01-22 22:39:21 -07:00
Chirayu Desai
d91d695664 kernel: Implement build time LTO choice
Change-Id: I898eb50fadb6bde5beebf46f443c5de7e6acc907
2022-01-13 14:40:31 +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
Julian Veit
cb30d255fb bacon: switch to sha256 checksum
As md5 is not considered as secure since some time, and sha256 is
industry standard, lets switch over here too.

Change-Id: I22015be20126a4348affa5ef97e2c28fbd7b4717
2021-10-07 11:39:17 +02:00
marcost2
fad4142e6e Add support for separate kernels for boot and recovery [1/2]
* Either as prebuilts, or with separate defconfigs

Change-Id: Iad877a5fbef095e3e5d792aebb240c230a829552
2021-09-08 17:16:01 +02:00
Tim Schumacher
cec409ecf8 kernel: Fix the check for official builds
The check for official builds now only affects the case where a prebuilt
kernel was actually used, not the case where a device builds a kernel
from source as normal.

The check has also been turned around so that it only fails the build if
it's actually an official build, not an unofficial one.

Change-Id: I1280b16b90589742c2abe7f3f6f5975a3aaeea03
2021-06-27 11:49:48 +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
LuK1337
cae10f81b0 kernel: Pass absolute path for KCONFIG_ALLCONFIG
It fails to read relative one, at least on QCOM 4.19 kernel base.

Change-Id: Iacbcadfabfcebb80a7f5934825123fdfa913c63c
2021-06-12 21:16:15 +02:00
Alessandro Astone
b9aa311d5a kernel: Support pixel style vendor_boot modules
Mini documentation:
List the names of boot modules in BOOT_KERNEL_MODULES to add them
to vendor_boot.

All modules still end up in their primary location (normally
vendor/lib/modules). Boot modules will be kept here as duplicates.

The list of boot modules is then depmod'ed and copied to the
vendor ramdisk.

The file modules.load is created from
BOARD_$(IMAGE)_KERNEL_MODULES_LOAD as the ordered list of modules
to be loaded form that location, either parsed by a modprobe script
or by init itself (only boot modules)
When using vendor_boot modules, vendor/lib/modules/modules.load
should list all modules but boot modules.

Also don't clear the output directory, because one might want to
push a modules.blocklist there.

Change-Id: I89a4aad42a6585a572812f1d7e89f5d78931e1e6
2021-02-17 20:21:04 +01:00
Michael Bestas
e26ac59843 kernel: Make system/vendor images depend on modules
* We're having a race with the kernel module build and vendor.img
  generation, and sometimes when vendor.img wins it won't include
  any modules in the image, which leads to all sorts of breakage

Change-Id: I2cdde96530aa8e47351cace76352788cde631058
2020-11-22 23:35:38 +01:00
Aayush Gupta
48d0111db6 lineage: Don't enforce specifying image name on prebuilt kernel
- The goal of specifying kernel image name was to whether kernel needs
  appended dtb or not, which is not something required if the kernel is
  prebuilt

Ref:
[0]: Commit edc1cebc2f

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I6b43756a2eac59729a67b5f80dac112f8b6bcc5b
2020-10-28 10:25:37 +01:00
Alessandro Astone
08b2846646 kernel: Import function to install kernel modules from Q
* The new refactored function doesn't work with shell expanded
   variables, like our $$modules.

 * This is the _easy_ fix.
   A proper fix would imply generating the module list into a make variable
   from the shell variable, but with kati that looks unfeasable (to me...)

Change-Id: I8198c62fa93ad94d4b9bf7175fe5eea452c243ea
2020-09-25 21:04:31 +02:00
Bruno Martins
c3ad8b5c54 lineage: Use $(HOST_PREBUILT_TAG) where possible
Change-Id: If211d23ce72b3404368cd723cbb9ea801e61802c
2020-09-24 11:56:08 +01:00
LuK1337
d034c3f7bb lineage: Disable inline kernel building for generic {arm,arm64} targets
Change-Id: I766779a2babc170481174899aaf610cbfeb8d754
2020-09-18 22:37:47 +02:00
Jan Altensen
560ac4a965 bacon: switch to toybox md5sum
* fixes "error: MD5SUM is obsolete."

Change-Id: I38e167e24e9eb5596a1e8e2f2d915f648bc1283c
2020-09-15 13:17:38 +02:00