Commit Graph

159 Commits

Author SHA1 Message Date
shuixx
732117171d strix 2025-07-14 01:42:42 +00:00
SkyMinus
821a9ddc31 Initial MinusOS Balsam
Signed-off-by: SkyMinus <minus_rav@qq.com>
2025-07-01 21:20:43 +08:00
Nikita Savchenko
722d1ce1be kernel: Report all modules not found at once
Change-Id: Ic46f72989b2dd5de574cc33b7e9f7499323d9bb0
2025-06-07 17:12:21 +00:00
Aaron Kling
67bbe4a32d kernel: Stop warnings for prebuilt kernel platform
If both prebuilt kernel and prebuilt kernel headers are provided, assume
that they match.

Change-Id: I8818659bd4642aa20260ff638d4a0c3f2b56a463
2025-05-31 19:24:17 +00:00
Nolen Johnson
2130319a7f Revert "kernel: Add support for external kernel configs"
This reverts commit 1b1687b456.

Reason: Breaks variant defconfigs.
Change-Id: Ie81301eb5a3376ab969430eed54a432d7d300408
2025-04-22 15:20:41 -04:00
Yumi Yukimura
1b1687b456 kernel: Add support for external kernel configs
For targets that uses mainline kernel, the kernel tree usually only
contains configs on top of the upstream repository.

In such case, if we put the configs in elsewhere, we can simply just
track the upstream kernel repo, without needing to import configs.

Example usage:

TARGET_KERNEL_CONFIG_EXT := \
    $(COMMON_PATH)/kconfig/platform_defconfig \
    $(COMMON_PATH)/kconfig/common-addons.config

TARGET_KERNEL_CONFIG_EXT += \
    $(DEVICE_PATH)/kconfig/device.config

Change-Id: I021ffb76d0c0612343cff7b5c81541c2b88ef7e6
2025-04-15 01:27:38 +00:00
Yumi Yukimura
f171568f8b kernel: Add support to append DTBs to kernel image
* Many Qualcomm targets that uses boot header v0 or v1
  have the DTBs appended to the end of kernel image.

* In downstream msm kernels up to msm-4.19, Appending DTBs
  is handled in the kernel tree. However, on msm-5.4 and
  newer msm kernels, and on mainline kernel, This is not
  supported.

* Normally, DTB processing depends on how the bootloader
  loads it and should not be handled in the kernel tree,
  so we handle it here.

* Instead of appending all DTBs by default, Get the list of
  DTBs that needs to be included from a variable, so that
  we don't need to modify dts Makefile to exclude unwanted
  DTBs, and we could also ensure the DTBs are appended in
  a specific order.

Change-Id: I603d1ebac5ee808bad045b85f9868d572d52cb80
2025-04-15 01:27:38 +00:00
Aaron Kling
16075eab65 kernel: Use correct recovery modules.load variable
Originally, BOARD_RECOVERY_RAMDISK_KERNEL_MODULES_LOAD was used, but
BOARD_RECOVERY_KERNEL_MODULES_LOAD is what build/make uses. Use the
proper variable by default and if it's not set, use the old variable.

Change-Id: I3522e4782ae56f67e49b234236fbb86c8ec65b92
2025-04-06 19:07:29 +00:00
Cosmin Tanislav
ae2f5b65e8 kernel: use DTBS_OUT variable
DTBS_OUT is set to $(DTB_OUT)/out, use it.

Change-Id: Id6ec8b1f32e4b54cd9c463c3af7146711a800d81
2025-04-05 19:47:13 +00:00
dianlujitao
f5b67a8a82 kernel: sign GKI modules
Only signed GKI modules are permitted to export symbols listed in the
android/abi_gki_protected_exports file. Attempting to export these
symbols from an unsigned module will result in the module failing to
load, with a 'Permission denied' error message.

Change-Id: Ie15b00a6c288eda21b319eb0f735cf4f9e6e7933
2025-02-02 22:07:16 +08:00
dianlujitao
0c5ab30c05 kernel: preserve GKI modules in vendor modules.dep
modprobe won't lookup system_dlkm modules.dep when GKI modules are
required by vendor modules, so they'll fail to load.

Fixes: 259906daef ("kernel: consider gki modules when running depmod for vendor modules")
Change-Id: Ia5a77df91d84c78f76a03910178cc86db48724c8
2025-02-02 22:07:16 +08:00
dianlujitao
2f05d48814 kernel: break the build when depmod finds missing symbols
Change-Id: I033590d2309d4e8fbff3ab6b5a73eb903d5b3be9
2025-02-01 17:13:43 +00:00
dianlujitao
259906daef kernel: consider gki modules when running depmod for vendor modules
Change-Id: I6c2367b7d93a866039c15d4ace7baeb937cb490e
2025-02-01 17:13:43 +00:00
dianlujitao
382aba27b7 kernel: reduce the use of find when copying modules
Change-Id: I16879cd3295bbfc16c3d34c4e120dcde6e24a19e
2025-02-01 17:13:41 +00:00
Guru Das Srinagesh
81c8cad9e8 merge_dtbs: Use logging and argparse
Use the logging module to log important information to various log
levels: info, debug, warning and error.
- Modify __str__ representations of classes DeviceTree and
  InnerMergedDeviceTree for readability in debug logs
- Make parse_dt_files() return instead of yield so as to order all the
  filename parsing at one go after the preceding log messages

Use the argparse module to specify script arguments cleanly. Also make
the corresponding change to merge_dtbs.sh to invoke this script with the
correct flags.

Change-Id: Id09d9d7b34cde60eff99876f0c0c4f6643852aee
Signed-off-by: Guru Das Srinagesh <quic_gurus@quicinc.com>
2025-01-30 19:16:33 +08:00
Michael Bestas
dc34f77675 kernel: Nuke --cuda-path/--hip-path
Revert "kernel: Check HIP support of clang before disabling it"

This reverts commit 62c1374385.

Revert "kernel: Force disable LLVM HIP"

This reverts commit ef68678120.

Revert "kernel: Force disable LLVM CUDA"

This reverts commit ba14020f85.

Change-Id: I5cb2b4624eb0ec25dbc8c1b5888708d961ae59d7
2024-10-19 01:10:12 +02:00
Sebastiano Barezzi
f887bc5ac5 kernel: Add {recovery}kernelconfig
This target just builds the `.config` in
`KERNEL_OBJ`/`RECOVERY_KERNEL_OBJ` to quickly check if fragments are
applied properly, not to be used during an actual kernel build

Change-Id: Ic92fe7bd544f6d0f1b3169c1405aceb6702775e0
2024-10-18 12:59:55 +00:00
LuK1337
8ba07c4cfc kernel: Deduplicate file paths in file_list.txt
This is a workaround for broken dirty rebuilds.

Test: breakfast gts4lvwifi && m && m
Change-Id: I2529efd0685f15eace5031df39e226dd5eaca1e8
2024-07-24 17:32:08 +00:00
Han Sol Jin
ed59eaf090 kernel: use systemimage_intermediates on devices with no vendor
Change I8b6040e03589bde2af4e161c891ded237a9bb335 did not account for
devices without a separate vendor partition, causing build to fail with
the following:

FAILED: ninja: '/file_list.txt', needed by 'out/target/product/joan/obj/KERNEL_OBJ/arch/arm64/boot/Image.gz-dtb', missing and no known rule to make it

Use systemimage_intermediates instead on said devices.

Test: m kernel
Co-authored-by: Bruno Martins <bgcngm@gmail.com>
Change-Id: If9eb75a1bef98345e9c137c2463e392d50be239b
2024-07-12 21:05:05 -07:00
Sebastiano Barezzi
3fe68ad58a kernel: Better x86 support
- Mention the right kernel image on documentation
- Build dtbs only when the dts folder exists, Google enables CONFIG_OF
  on x86_64 GKI config, this is also the same check done on Linux
  Makefile

Change-Id: I1b0f7a39b0b00f2a4516d2cff79e591136ee3af8
2024-07-12 03:11:30 +02:00
Aaron Kling
b3f09c69c8 kernel: Add kernel modules to partition file list
This is required to ensure that kernel modules end up on the final
partition images when `BUILD_BROKEN_INCORRECT_PARTITION_IMAGES`
environment variable or board config variable is not set.

See 152cdfab7c
for more information.

Co-authored-by: Bruno Martins <bgcngm@gmail.com>
Change-Id: I8b6040e03589bde2af4e161c891ded237a9bb335
2024-07-11 07:05:32 +00:00
Maitreya25
15bbe27486 kernel: Include OEM DTBs in build
Some OEMs (for example: oplus) push their dtbs to their own folders which causes kernel build to error out, fix this by including non qcom dtbs as well.

Change-Id: I2f51db103475cd2609cd061e0ec66af5accb96ab
2024-05-30 17:18:55 +00:00
Aaron Kling
49c4dd8f86 kernel: Error on duplicate modules
This can happen when an out of tree module target uses a matching module
name from the base kernel. This causes two problems:

1) Depmod gets confused and only pulls symbols from one of the modules
2) Copying the modules to modules_out is not entirely deterministic and
   is based on the first variant to be returned by find, meaning that
   the variant that gets copied to the device could change build to
   build.

To avoid these issues, fail the build if this happens and force the
build target to only generate one copy of each module name.

Change-Id: I2e47ba4e142054feabaa1ab80fbbe0332fd84a62
2024-05-13 20:45:15 +00:00
Aaron Kling
1b0fc0e043 fixup! kernel: Support copying modules to boot ramdisk
Original commit incorrectly added kernel as a dep to the vendor ramdisk
for this path, when instead the dep should be added to the boot ramdisk.

Change-Id: I25a42d403fe2ddb0538b08c2dd8f761eae960810
2024-03-30 06:38:58 +00:00
Aaron Kling
d725e592fe kernel: Support kernel modules via kbuild
TARGET_EXTERNAL_KERNEL_MODULES variable is used for the list of modules,
same as the existing functionality, but is invoked if ':kbuild' is
appended to a module name

Existing external module build calls make in the module directory, which
is a standalone module build. The module makefile may chain to kbuild,
but that depends on the module. This addition invokes the kernel build
system, passing the module directory via the M= param, which is the
kernel standard for building out of tree modules.

Change-Id: I38a582952f79f7155cdbf8a5975cf23074bbdab0
2024-02-07 18:00:28 +00:00
Aaron Kling
2f1c529782 kernel: Support copying modules to boot ramdisk
Android supports loading modules from the boot ramdisk in the case of
vendor ramdisk not existing.

Change-Id: Ide1255b2c37ee262c8a4181d5eb0e380d0488edc
2024-02-07 18:00:28 +00:00
LuK1337
b38fb3a2d2 kernel: Make INTERNAL_VENDOR_RAMDISK_TARGET depend on kernel
This lets us package kernel modules into recovery ramdisk inside
vendor_boot.

Change-Id: I274bc95ce8682e2f13a595174ab279c129866f6a
2023-12-24 21:08:16 +00:00
Bruno Martins
682dd6b689 kernel: Ensure that module load lists are properly formed
Do not allow module load lists to contain unexistent kernel modules
and bail out if that's the case, informing that the list must be
corrected.

The lists can be formed including the full module path and with or
without the file extension, like shown below:

  kernel/drivers/watchdog/softdog.ko
  kernel/net/wireless/cfg80211.ko
  kernel/net/mac80211/mac80211.ko

or simply:

  softdog.ko
  cfg80211.ko
  mac80211.ko

or ultimately:

  softdog
  cfg80211
  mac80211

Either way, the newly generated modules.load file will now only
contain the module name without the extension, which is inline with
modules.alias and modules.blocklist.

Change-Id: I969274f7edf249c98ca241e37b6e41a921d36908
2023-12-14 22:45:39 +00:00
pppig236
f46d0a7a08 kernel: Halt build process if an external module fails to compile
Before:
    mka bootimage
    qcacld failed to compile, but boot.img is generated

After:
    mka bootimage
    qcacld failed to compile and no boot.img is generated

Commit fadfdbf introduced the idea of building external modules,
but it didn't account for the scenario where compilation could fail
while the boot.img is still being built.

Fix this by properly stopping the build process as soon as the external
module fails to compile.

Change-Id: Ifed28825f8e4b78d304fe62a47908e208edfb886
2023-10-29 14:27:00 +00:00
Bruno Martins
e655a1e696 kernel: Replace BOARD_SYSTEM_KERNEL_MODULES with SYSTEM_KERNEL_MODULES
Commit 47931c1 introduced GKI modules handling with the assumption
that using BOARD_SYSTEM_KERNEL_MODULES would still work in Android 14,
but turns out that it conflicts with build/make/core rules.

Change-Id: I9167940c08b8420be254c52698f1faa2e3e7f793
2023-10-28 12:37:43 +01:00
basamaryan
db93a8d621 kernel: Rename mkdtboimg.py
* Changed in https://android-review.googlesource.com/q/topic:%22colefaust_rename_mkdtboimg%22

Change-Id: Idd2ade7035c79207321ecbc70d6a4ddf9f4ed600
2023-10-20 09:55:48 +01:00
Tim Zimmermann
84b975ca23 kernel: Use correct variable name for vendor_kernel_boot modules
* This was missed in bdfc913935
* Aligns the variable name for vendor_kernel_boot modules with AOSP

Change-Id: I8d59f7b5d62e29a0484ca36fadcb74acab4f1859
2023-10-16 16:17:09 +03: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
SGCMarkus
2a0d417971 kernel: Allow to limit the used .dtb files for the final DTB image
On some devices too many .dtb files are generated. Instead of taking
all of them, allow to only take selected .dtb files for the final
DTB image.

Example: Motorola Edge 40 Pro (rtwo, sm8550) generates the following:
obj/DTB_OBJ/out/kaka-rumi.dtb
obj/DTB_OBJ/out/kalama-rtwo-base-kalama-rtwo-evb1-overlay.dtb
obj/DTB_OBJ/out/kalama-rtwo-base-kalama-rtwo-evt1-overlay.dtb
obj/DTB_OBJ/out/kalama-rtwo-base-kalama-rtwo-na-vzw-evt2-overlay.dtb
obj/DTB_OBJ/out/kalama-rtwo-base-kalama-rtwo-prc-dvt1b-overlay.dtb
obj/DTB_OBJ/out/kalama-rtwo-base-kalama-rtwo-prc-pvt-overlay.dtb
obj/DTB_OBJ/out/kalama-rtwo-base-kalama-rtwo-row-dvt1b-overlay.dtb
obj/DTB_OBJ/out/kalama-rtwo-base.dtb
obj/DTB_OBJ/out/kalama-v2-rtwo-base-kalama-rtwo-evb1-overlay.dtb
obj/DTB_OBJ/out/kalama-v2-rtwo-base-kalama-rtwo-evt1-overlay.dtb
obj/DTB_OBJ/out/kalama-v2-rtwo-base-kalama-rtwo-na-vzw-evt2-overlay.dtb
obj/DTB_OBJ/out/kalama-v2-rtwo-base-kalama-rtwo-prc-dvt1b-overlay.dtb
obj/DTB_OBJ/out/kalama-v2-rtwo-base-kalama-rtwo-prc-pvt-overlay.dtb
obj/DTB_OBJ/out/kalama-v2-rtwo-base-kalama-rtwo-row-dvt1b-overlay.dtb
obj/DTB_OBJ/out/kalama-v2-rtwo-base.dtb

with only kalama-rtwo-base.dtb and kalama-v2-rtwo-base.dtb needed.
Disabling compilation of the other kalama.dtb isn't possible, as this
would also disable the compilation of the needed .dtbo files.
Because they are earlier in alphabetical order, and the matching
board ids, the bootloader ends up selecting those, instead of the
correct ones. This results in USB (and possible other things) to
not work.

Change-Id: I486b6ec538a3e4906b5b8aa5ecb355b480b60de7
2023-09-17 17:53:24 +00:00
Bruno Martins
3056928d1c kernel: Include DTBOs from OEM/ODM folder in base DTB
It can be the case where OEM/ODM decided to put the main DTBOs
outside vendor/qcom (e.g. vendor/oplus). Support such usecase
by generically allowing all .dtbo files found in all first-level
subdirs to be moved to base DTB folder.

Change-Id: I154d401b560535d1fa8cd7ed4965dd34a4cf75f2
2023-09-17 17:53:24 +00:00
Bruno Martins
47931c121e kernel: Handle GKI modules
All devices lauching with Android 13 (and above) must include
a system_dlkm partition, where GKI modules should reside.

Android 13 build system only supports providing prebuilt modules,
by pointing BOARD_SYSTEM_DLKM_SRC to the modules source folder.
Google will introduce BOARD_SYSTEM_KERNEL_MODULES for Android 14,
so take a step forward and use that macro to exclude the listed
modules from the usual vendor DLKM partition and place them into
the GKI module partition.

Note that the GKI modules are placed into lib/modules/androidX-Y.Z,
as defined by Google and observed in system_dlkm_modprobe script.

Change-Id: I2b1644479788cb5c9568cac738202b1d55fc28d7
2023-09-17 17:53:24 +00:00
Aaron Kling
3ade73b639 kernel: Support copying modules to recovery
Change-Id: Iac275cfbea368d47f9cc8e756649ab094d9c57c5
2023-08-28 16:23:03 +00:00
Aaron Kling
0d1608e30f kernel: Support Qualcomm merge_dtbs script
Script from clo kernel/build at kernel.lnx.5.10.r1-rel

Change-Id: Ia90975c895644b86d9f861ddd5a18b7cf6ce1470
2023-08-28 19:15:02 +03:00
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