Commit Graph

119 Commits

Author SHA1 Message Date
Michael Bestas 80bd054cf2 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
2024-09-07 15:45:38 +02:00
Michael Bestas 1e0d2d457e 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
2024-09-07 15:45:38 +02:00
Michael Bestas be10f65fc4 kernel: Allow overriding dtbo target name
gs101 kernel uses google/dtbo.img target for dtbo.img

Change-Id: Ib03f35c0035f56d303771de9399bcce3d02c0775
2024-09-07 15:45:38 +02:00
Michael Bestas 97bacc9928 config: Use LLVM binutils for 5.10 as well
Change-Id: I14afa17d710778403cd7fecf842c952c569c0c35
2024-09-07 15:45:38 +02:00
Jason Wojcik 4e7956cca3 lineage: config: Use $(abspath .) instead of $(shell pwd)
Change-Id: I7fec28b7cb507918b1b55dd368a74c927a8fc1d2
2024-09-07 15:45:38 +02:00
Chirayu Desai d00f738806 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
2024-09-07 15:45:38 +02:00
Alexander Koskovich fdf7a64db0 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
2024-09-07 15:45:38 +02:00
Alexander Koskovich b31c846f51 kernel: Switch to AOSP DTC instead of using scripts/dtc
Change-Id: I8faf295dfb84ab7481b80d5b7d2add8ed8ddf6d9
2024-09-07 15:45:38 +02:00
Michael Bestas ef5ddc9220 Revert "kernel: Remove unneeded MKDTIMG dependency"
This reverts commit caa3bddf00129c06f35923e43d5e770645da6b99.

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
2024-09-07 15:45:38 +02:00
Michael Bestas 246aae819d kernel: Remove unneeded MKDTIMG dependency
Change-Id: Icc1923e922adb50b02252883aa6814101837adfc
2024-09-07 15:45:38 +02:00
dianlujitao db348597ca 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
2024-09-07 15:45:38 +02:00
dianlujitao b3ec81fe9f kernel: Avoid unnecessary savedefconfig
Change-Id: I5400e549a6574208d67c5d107ca56eee402fa7f2
2024-09-07 15:45:38 +02:00
dianlujitao afbd0df8d3 kernel: Clean up kernel copy recipes
ACP and ALL_PREBUILT are dropped years ago and thus have become no-ops.

Change-Id: Ic317cb4a4fa406cce0dc86555fb8da34d21fb2bf
2024-09-07 15:45:38 +02:00
Alexander Koskovich c0130e0358 lineage: build: Wipe DTB/O OBJs before build
* They can linger and cause problems, e.g. mismatching
   kernel and DTBs.

Change-Id: I4adafe140093ff675fc3f55e3233a754d44d5656
2024-09-07 15:45:38 +02:00
Bruno Martins 4436121e3e kernel: Document TARGET_KERNEL_RECOVERY_CONFIG usage
Change-Id: Idefd38dae5e8beac7d7de797f3f792fea25dacef
2024-09-07 15:45:38 +02:00
Bruno Martins 6e990acb91 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
2024-09-07 15:45:38 +02:00
Bruno Martins c9cdb563ff 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
2024-09-07 15:45:38 +02:00
Sebastiano Barezzi d7dd18649a 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
2024-09-07 15:45:38 +02:00
marcost2 903f535772 Add support for separate kernels for boot and recovery [1/2]
* Either as prebuilts, or with separate defconfigs

Change-Id: Iad877a5fbef095e3e5d792aebb240c230a829552
2024-09-07 15:45:38 +02:00
LuK1337 da4c725f81 kernel: Pass absolute path for KCONFIG_ALLCONFIG
It fails to read relative one, at least on QCOM 4.19 kernel base.

Change-Id: Iacbcadfabfcebb80a7f5934825123fdfa913c63c
2024-09-07 15:45:38 +02:00
Michael Bestas ca1004e860 build: Fix kernelsavedefconfig target
Change-Id: Ie3d9a187693f2435f2555658c833de666848e48e
2024-09-07 15:45:38 +02:00
Alexander Koskovich e46c8a35da 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
2024-09-07 15:45:38 +02:00
Alexander Koskovich 623015e96b kernel: Use LLVM's substitutes for GNU binutils if possible
Co-authored-by: LuK1337 <priv.luk@gmail.com>
Change-Id: I06884fb774b6548aad68942f1ce659384521c62a
2024-09-07 15:45:37 +02:00
LuK1337 6d374e48c1 kernel: Add clean headers script to workaround conflicts with bionic
After the "Avoid multiple definitions of sigaction." change in bionic,
we ought to modify our kernel headers to make sure that sigaction struct
is not present in uapi headers.

Change-Id: I15645480e013e79cbcafaac99253368b646b6b11
2024-09-07 15:45:36 +02:00
bigbiff 2a4ab5c845 Merge "soong: generator: Replace android.SourceDepTag usage with IsSourceDepTagWithOutputTag" into android-14 2023-12-15 00:16:07 +00:00
Arian 6200d85e2d soong: generator: Replace android.SourceDepTag usage with IsSourceDepTagWithOutputTag
Change-Id: Iad5d9a07d06a7efda233cc8d3387e8db5c3b0ab5
(cherry picked from commit 994d8647f5519f6ce107de1e98b0f9130ae47aa2)
2023-12-15 00:15:02 +00:00
Nebrassy cbcba43dbe Merge "vendor: soong: Accept back a value for TARGET_RECOVERY_OVERSCAN_PERCENT" into android-12.1 2023-11-26 09:00:51 +00:00
Col_or 6bc31ffe48 vendor: soong: Accept back a value for TARGET_RECOVERY_OVERSCAN_PERCENT
* If the cflags doesn't have value, it may lead to an incomplete display.

Test:
    Before fixed: I:Scaling theme width 0.981481x and height 1.169271x, offsets x: 0 y: 107 w: 0 h: -107
    After fixed:  I:Scaling theme width 1.000000x and height 1.194271x, offsets x: 0 y: 107 w: 0 h: -107
Change-Id: I267290748f2896662696c781a83e141b771e3e2e
Signed-off-by: Col_or <color597@outlook.com>
2023-11-26 13:36:31 +08:00
Nebrassy 35f41f54f6 Merge "TWRP: export TW_SUPPORT_INPUT_1_2_HAPTICS" into android-12.1 2023-11-24 14:40:13 +00:00
nebrassy 8019caf0c9 TWRP: export TW_SUPPORT_INPUT_1_2_HAPTICS
Change-Id: I7878f4f89e66938430ebddfa5abc814bdd752a29
2023-11-23 16:13:41 +01:00
bigbiff 1514765cb6 Merge "TWRP: move TWRP makevars to BoardConfigSoong 1/2" into android-12.1 2023-11-14 02:09:12 +00:00
nebrassy ac1dfae958 TWRP: move TWRP makevars to BoardConfigSoong 1/2
Change-Id: I8665c1f3b77efd1c91831e46b7ecdb170fe353ba
2023-11-14 02:08:28 +00:00
captainthrowback a33af40e8c Merge "envsetup: export TOP" into android-12.1 2023-10-16 18:41:44 +00:00
Captain Throwback e9182617df envsetup: export TOP
In build systems where OUT_DIR_COMMON_BASE is used,
TOP cannot be identified if the directory is changed.
Exporting TOP when envsetup is run ensures that it
will always be set and croot will work as expected.

Change-Id: I6944ac7d3513ba9504e03baa5f9910bddb126d7c
2023-10-10 13:50:33 -04:00
bigbiff 5d22aab11c Merge "twrp: fscrypt: bypass FS_IOC_[G|S]ET_ENCRYPTION_POLICY" into android-12.1 2023-09-28 23:42:32 +00:00
steadfasterX 33c42f533a twrp: fscrypt: bypass FS_IOC_[G|S]ET_ENCRYPTION_POLICY
my (loooong) debugging sessions reg my decryption issues on FBEv2 revealed the following:

the issue occurs in [fscrypt.cpp](https://cs.android.com/android/platform/superproject/+/android-12.1.0_r27:system/extras/libfscrypt/fscrypt.cpp;l=334-353) - actually by this condition: [here](https://cs.android.com/android/platform/superproject/+/android-12.1.0_r27:system/extras/libfscrypt/fscrypt.cpp;l=337)

so what happens?

1. `ioctl(fd, FS_IOC_GET_ENCRYPTION_POLICY, &policy);` actually gives: `-1` with `errno=17` (i.e. "Invalid argument")!
2. Due to that it will return `EINVAL` which is WRONG as this is the expected errno when a FBE v2 policy has been found! Which is **NOT** the case as the ioctl fails with "invalid argument" instead. This alone is (at least) a design bug as it should be catched and handled differently.
3. anyways due to 2. we now assume it is encrypted (with FBE v2) - see: [fscrypt.cpp](https://cs.android.com/android/platform/superproject/+/android-12.1.0_r27:system/extras/libfscrypt/fscrypt.cpp;l=130)
4. the next design (ihmo) bug is that **REGARDLESS** of the fact if the directory is encrypted (or not) it checks if it can set a policy on it. IMHO this should be done ONLY when an encryption has been found.
5. setting the (constructed) policy on a *non-empty* AND *encrypted directory* [will fail](https://cs.android.com/android/platform/superproject/+/android-12.1.0_r27:system/extras/libfscrypt/fscrypt.cpp;l=340) because the dir is non-empty AND encrypted AND the ioctl to **SET** the policy fails (likely due to the same issue as in 1.)
6. as a result TWRP decryption fails (due to the `break` [here](https://cs.android.com/android/platform/superproject/+/android-12.1.0_r27:system/extras/libfscrypt/fscrypt.cpp;l=340-342))

so what is the bug here actually?

- Is it that the policy TWRP is trying to set (bc of maybe wrong options by me somewhere) is simply different then what Android is setting? I tested and tried a lot to compare the contents of `kern_policy` and `policy` without meaningful success (I am NOT a cpp pro!)
- Is the code in fscrypt.cpp simply useless (for TWRP)? I mean from my point it makes zero sense to add a policy on a directory which is encrypted already (for TWRP). imho it should be even **avoided (!)** as if it would not abort there it means the policy might be changed(!) and that can break Android. imho TWRP should not even try to do that but instead skip the whole part - but that means forking the fscrypt code (dunno if that is smth the devs want to do)

I mean even the comment in fscrypt.cpp states:

> FS_IOC_SET_ENCRYPTION_POLICY will set the policy if the directory is
> unencrypted; otherwise it will verify that the existing policy matches.

which is NOT the (full) truth. it will NOT "otherwise" verify but fail instead - in that specific scenario I encounter here (failing ioctl with invalid argument).

so [this condition](https://cs.android.com/android/platform/superproject/+/android-12.1.0_r27:system/extras/libfscrypt/fscrypt.cpp;l=355) now simply checks for the encryption state, too and all problems (I had) are solved.

I had added debug outputs everywhere (including the kernel) and all leads to the prob "Invalid argument" when the kernel is doin the mentioned ioctl on `FS_IOC_GET_ENCRYPTION_POLICY`.
The reason behind **why** that fails is still nothing I can tell. likely I miss smth in the kernel or kernel config.

ofc the secondary issue with `FS_IOC_SET_ENCRYPTION_POLICY` still could happen due to misconfigured policy options - but that does not explain why the `FS_IOC_GET_ENCRYPTION_POLICY` fails as that one should at least give the current policy (bc it **IS** encrypted). IMHO both GET and SET are related and a general issue within (likely) the kernel.

[FS_IOC_GET_ENCRYPTION_POLICY source/info](https://www.kernel.org/doc/html/latest/filesystems/fscrypt.html#fs-ioc-get-encryption-policy).

so as I do not have any further ideas I patch fscrypt.cpp with vendorsetup.sh on-the-fly (yea dirty as.. ) and get at least a working result.

Change-Id: I59eca3413e75712af3e23b195cd32b96704c0a93
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
2023-09-28 23:42:26 +00:00
bigbiff 359e793742 Merge "twrp: Import libfscrypt from https://android.googlesource.com/platform/system/extras/" into android-12.1 2023-09-28 23:42:15 +00:00
Mohd Faraz 31d9055ff6 twrp: Import libfscrypt from https://android.googlesource.com/platform/system/extras/
Change-Id: I5e5c3395bb67984c90a94010e19712c007a6c312
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
2023-09-13 20:48:55 +05:30
captainthrowback 3b222dfb70 Merge "makevars: Add TW_FRAMERATE" into android-12.1 2023-08-22 17:09:18 +00:00
bigbiff bde6f016cf Merge "makevars: Add TW_NO_FASTBOOT_BOOT" into android-12.1 2022-11-06 18:46:44 +00:00
Sushrut1101 79daea1594 makevars: Add TW_NO_FASTBOOT_BOOT
Signed-off-by: Sushrut1101 <guptasushrut@gmail.com>
Change-Id: Ifc0dcda77bff565436bdb1eb71a6909bddcf8b22
2022-11-06 18:46:31 +00:00
bigbiff a08a99aca8 Merge "Add TW_NO_FASTBOOT_BOOT flag" into android-12.1 2022-11-05 14:33:23 +00:00
Sushrut1101 93b80a8181 Add TW_NO_FASTBOOT_BOOT flag
* Some Devices that do not support hotbooting an image using fastboot
  boot (eg: mtk devices) face issues like battery level detection,
  unable to reboot to system, etc.
  When twrpfastboot is set to 1 in the kernel cmdline. Setting this flag
  to true will not add twrpfastboot=1 in the cmdline and therefore will
  fix those issues.

* Tested on evergo, fixed battery level detection, reboot to system and
  slot changing.

Change-Id: I3f2d0fb3ef71f42904f756b4c7dec1cc51905f40
Signed-off-by: Sushrut1101 <guptasushrut@gmail.com>
2022-11-05 02:14:27 +05:30
bigbiff d4f8738af9 Merge "twrp: makevars: Add TW_SUPPORT_INPUT_AIDL_HAPTICS_FQNAME and TW_SUPPORT_INPUT_AIDL_HAPTICS_FIX_OFF" into android-12.1 2022-10-30 18:33:31 +00:00
sekaiacg ecfd70ae62 twrp: makevars: Add TW_SUPPORT_INPUT_AIDL_HAPTICS_FQNAME and TW_SUPPORT_INPUT_AIDL_HAPTICS_FIX_OFF
Change-Id: I0dc8e6f55f3603329adcd925103752107d6f8bb5
2022-10-30 21:57:46 +05:30
bigbiff 86945ae9b7 Merge "twrp: makevars: Add vars for status bar icon offsets" into android-12.1 2022-08-23 18:11:35 +00:00
Mohd Faraz b0602da746 twrp: makevars: Add vars for status bar icon offsets
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
Signed-off-by: Yillié <yilliee@protonmail.com>
Change-Id: I5b00ec281717540f732789f191188ce8041eb083
(cherry picked from commit acdbc4b70ad3f765e49d72939118bccca61de9c7)
2022-08-23 14:09:59 -04:00
bigbiff 2fcc2a8a12 Merge "makevars: add TW_USE_FSCRYPT_POLICY" into android-12.1 2022-07-31 21:09:42 +00:00
bigbiff 8c929ba02b makevars: add TW_USE_FSCRYPT_POLICY
Change-Id: I88ddfaf3777b1b6c5ef24cdeb918e4243a2ea9e0
2022-07-31 21:09:32 +00:00
Nebrassy f531918c2f Merge "kernel: Fix the check for official builds" into android-12.1 2022-07-30 14:25:20 +00:00