Commit Graph

105 Commits

Author SHA1 Message Date
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
Tim Schumacher 0e721b6a4e 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
2022-07-30 14:25:10 +00:00
Nebrassy a811a5bd19 Merge "kernel: Add TARGET_FORCE_PREBUILT_KERNEL flag" into android-12.1 2022-07-30 14:24:35 +00:00
Sebastiano Barezzi 9d4bb8e43c 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
2022-07-30 14:24:30 +00:00
Nebrassy cd1c21c4ae Merge "Revert "Revert "kernel: fix KERNEL_TOOLCHAIN_PATH_gcc and usage""" into android-12.1 2022-07-30 14:24:19 +00:00
Alessandro Astone c84395eada Revert "Revert "kernel: fix KERNEL_TOOLCHAIN_PATH_gcc and usage""
The fix was correct...

This reverts commit 168fd231b65f3bd575529984f552354f4c5e3e8b.

Change-Id: If550fd44f32b801553b8ac23cb2a91d3f29df557
2022-07-30 14:24:09 +00:00
Nebrassy 99ceb62934 Merge "lineage: config: Make LLVM kernel compile the default" into android-12.1 2022-07-30 14:23:53 +00:00
Alexander Koskovich ea442ffb45 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-07-30 14:23:42 +00:00
bigbiff 7a23f9e986 Merge "envsetup: Import cout() function from LineageOS" into android-12.1 2022-07-29 13:02:24 +00:00
me-cafebabe 4900ceb008 envsetup: Import cout() function from LineageOS
From commit 3952f6cb0d701223f0b60a52c9f10554a898e564 "Import CM build additions"

Change-Id: I0aaa1fde311fe7e477dde7e139ea37548429e5bb
2022-07-29 20:55:32 +08:00
Alexander Winkowski 73c3867f21 makevars: Add TW_FRAMERATE
Change-Id: I907b52cf2629bf3e2d9de6a78047dd8f51ce1fff
2022-06-25 18:59:04 +00:00
bigbiff 17c8ca6f58 Merge "soong: Add TARGET_LEGACY_HW_DISK_ENCRYPTION conditional" into android-12.1 2022-06-21 23:19:14 +00:00
Nolen Johnson 0e23dae5b8 soong: Add TARGET_LEGACY_HW_DISK_ENCRYPTION conditional
[cafebabe: Move to TWRP soong config namespace]

Change-Id: I2c67fe632d415353273839493a86cdd75bd93b23
2022-06-21 23:19:08 +00:00
bigbiff 32a95a6c97 Merge "soong: Allow to specify device specific cryptfs_hw module" into android-12.1 2022-06-21 23:18:40 +00:00
me-cafebabe bf884c9089 soong: Allow to specify device specific cryptfs_hw module
Change-Id: Ia0a00afd6952caadfcf0f276277569510faba7b6
2022-06-21 23:18:27 +00:00