Google added support for LTO + CFI in the Pixel 3 kernel, which requires
not only Clang but a couple of additional binaries, namely llvm-ar and
llvm-dis for IR generation. Google expects these binaries to be in PATH
according to their definitions and the build.config.common file:
https://android.googlesource.com/kernel/msm/+/android-9.0.0_r0.31/Makefile#637https://android.googlesource.com/kernel/msm/+/android-9.0.0_r0.31/build.config.common
However, kernel.mk does not add the LLVM bin directory to PATH so the
build fails because the binaries can't be found. We could add LLVM_AR
and LLVM_DIS to the make commands like CC and CROSS_COMPILE; however,
adding the bin directory to PATH is a more sustainable solution as
Google might require new binaries in the future.
Additionally, LTO needs access to the LLVMgold library so it needs to be
available in LD_LIBRARY_PATH.
Add a PATH_OVERRIDE variable that will set up PATH and LD_LIBRARY_PATH
with the bin and lib64 folders from the requested LLVM toolchain
respectively when building with Clang. This won't affect kernels that
don't use LTO like Wahoo.
Change-Id: Ib16fa0d3180de2f96accb2f7648b07a017f8f98b
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
*) This has been deprecated by the bp mobule
generated_kernel_headers.
*) To build with kernel headers, do this:
LOCAL_HEADER_LIBRARIES += generated_kernel_headers
Or for soong targets:
header_libs: [ "generated_kernel_headers" ],
Change-Id: Idad445709f0ee0ec11b41b40123b14976a0052ad
*) Similar to genrule but can be used to generate content
when the output directory and file structure are not
known ahead of time.
*) An example use case is to build kernel headers.
Change-Id: I10deb7ba8825393b0b5fdbf2d96b12ad37257e12
Kernel source settings should always come at BoardConfig population
time so things that use the variable later don't end up pointing to
an empty or wrong variable.
The following is also squashed in:
Author: Christopher N. Hesse <raymanfx@gmail.com>
Date: Fri Aug 10 00:23:54 2018 +0200
tasks: kernel: Honor prebuilt kernel flag
For devices that want to use a prebuilt kernel, TARGET_KERNEL_SOURCE
would still be set to TARGET_AUTO_KDIR, meaning the build system would
still try to build the kernel if TARGET_AUTO_KDIR was present.
Setting TARGET_PREBUILT_KERNEL indicates this is not wanted, so don't
attempt to do it.
Change-Id: Ic79b3ac1b9c946fd258ada43dce2b08bb74ea0d9
Change-Id: If046b86ff0d18c76898e90295be873a8379f678a
*) Set JAVA_SOURCE_OVERLAYS in a device makefile as follows:
# Java sourcefile overlays (for Android.bp built modules only)
# Format is a whitespace separated set of rules, each of which
# structured as follows:
# modulename|overlay directory|glob pattern within overlay dir
JAVA_SOURCE_OVERLAYS := \
org.lineageos.hardware|$(LOCAL_PATH)/lineagehw|**/*.java
*) As of this commit, java sources overlays are only allowed for
module org.lineageos.hardware.
Change-Id: I6be1c12567081357f5231a84df98ac002c0563b4
* fw/native change I7f4174581e24e361577640b9263514a168ed482d
implemented validation of the buffer description info prior to
creating the descriptor. Some of our legacy devices need to
whitelist additional usage bits to support various functionality.
* The TARGET_ADDITIONAL_GRALLOC_10_USAGE_BITS variable can contain
a singular roll-up value (e.g., 0x02000000U), a left-shifted bit
(e.g., (1 << 25)), a bitwise OR of these things, or essentially
anything that the compiler can choke down.
Change-Id: I2127d33b03426b5e0f981aae837e07d82163fa17
* The default AOSP hardware/qcom/wlan path is listed in
PRODUCT_CFI_INCLUDE_PATHS since wpa_supplicant is compiled with
control flow integrity checks. Add the Qualcomm WLAN variant to
PRODUCT_CFI_INCLUDE_PATHS as well so wpa_supplicant can safely link
it without exploding.
Change-Id: Id5577846e1e1ea11f8a665d62847c80803e285f7
* If a cherry-pick results in an empty commit
(hints about git commit --allow-empty),
we should warn instead of failing all repopicks
Change-Id: I8410d7d02c4118c8072de609cf3c291e2d8523e6
These variables are usually set in a device's BoardConfig, setting them
in qcom_target is at the very end of the "configuration process" which
results in them being unavailable to plenty of other configuration
"things" (ex. soong namespaces or soong config). Move them to right
after a device's BoardConfig has been found and loaded.
Change-Id: Iddd731202d22ed3f8eb010197ce20d3c75a1f40a
* This function wraps add_json_str so that it does not add the soong
variable key:value pair to json structure if the second argument
(value) is empty/unset, preventing the need for more complex
conditional logic in the middle the code that builds the struct
* This concept allows us to make use of the omitempty field option
for purposes like single variables controlling ifdef blocks as well
as carrying the desired value
Change-Id: I99c8c162069c2aa8ff3d0bab2636b01181e74a9d
Google added a 32-bit vDSO to the Wahoo and Marlin kernels on Android P,
requiring a 32-bit toolchain to compile/link, and the build fails when
it is not provided.
Change-Id: I700e66a417ed431c31d82fc950f5e5acd07ab281
* Reverse the FILE and TARGET handling to sort
and filter unique paths to be pushed
* Resolves the 'mkap systemimage' where
/system/etc/nano/* symlinks were pushed
multiple times in loops
Change-Id: I178cec2e1708ad9239d9e544544fca157639e3b5
* The original commands were checking a file,
and validating that adb ran without error,
resulting in an always-true result
* Fix eat and _adb_connected by properly
checking the 'test -e' error code
Change-Id: I49f82f04f4b51097be76f03bf7021203665da76f
* Root cause of the issue is improper naming of variables. Turns out,
there was no variable to even denote where the blob should have been
searched for, at "src".
* Previously there was one such variable, suggestively called "TARGET", that
was desperately trying to serve as both, depending on who +2d hacks harder.
* One such example is "c982836 extract_utils: Fix makefile generation issues".
That patch deliberately trimmed the "src:" from a spec (therefore
obviously breaking the search at src) but enabling the searching at
dst, via the good-for-all TARGET variable.
* This patch introduces the following variables:
- SRC_FILE: absolute path corresponding to SPEC_SRC_FILE in the
Android filesystem.
- DST_FILE: absolute path corresponding to SPEC_DST_FILE in the
Android filesystem. Somewhat analogous to the old TARGET variable,
but actually contains the leading / as well (/system/bin/adsprpcd
instead of system/bin/adsprpcd).
* Use existing common get_file() function (which previously was
impossible to use, because it was impossible to determine calling
arguments properly) to reduce complexity of handling adb and disk
image as blob sources.
* Via the new SRC_FILE and DST_FILE variables, search for a blob in all
possible locations (including paths stripped of "/system" which
transforms an absolute path in the Android filesystem into a proper
relative path to that file in a disk image).
Change-Id: Ic40fb4dc93541d8b3f33fde586b773199cf4ded2
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
* This denotes the path of the file that results from the extraction
process, relative to the "proprietary" directory.
* This is a cleanup patch.
Change-Id: I38e759bb6ed697f0a31ca35a7aa9b9b92f8b6793
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
* The write_product_copy_files() and write_product_packages() functions
rely on its undocumented behavior of keeping target_args in the
returned list, because they are users of target_args (such as
";PRESIGNED" etc).
* Make the behavior documented.
Change-Id: If71595dca32abd40039706d4fed2d7f12e005365
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
* Strip target_args from target_file at callee instead of at caller
* WARNING! Changes (improperly documented) behavior of prefix_match()
function, which is expected to not strip target_args(), and the root
cause why stripping target_args was currently done at caller. Will be
addressed in next patch.
Change-Id: I820d2350aa64ff41374809fcb22f812257132652
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
This reverts commit c982836ca6.
This breaks extracting from src in "src:dst", such as from a disk image.
Will be addressed in the cleanup commit that follows.
Change-Id: Iff84a926f0c3bf908320b43ba40235e0a89db644
Recent devices (e.g. Pixel 2XL aka taimen) do not define any "system"
partition in their fstab, so a plain "mount /system" fails.
Furthermore, trying to get the entry from /etc/recovery.fstab also fails
because the partitions have slot suffixes (e.g. system_a).
So for these devices, we need to figure out the active slot, mount the
system partition (which really contains the whole root) and lastly mount
the actual system partition from the rootfs.
Change-Id: Ibb73a82896c1f6ce6af9c334b8d0908a183913b9
* Include MTK/QCOM rules directly from the build/core/config.mk hook.
* Place main.mk hook and main_version.mk into build/core with the rest
of the make system hooks.
Change-Id: Iad2f808f3e3eefbd2be2ca5facb907ff31babbb7
* It appears the only user of this was Gello, which is no longer using
it.
* Remove this deprecated directive
Change-Id: I6ab869c2f2c3b891b58b9a750e7ce882f169f296
* This is now needed for the latest legacy HAL1 hacks, which were
previously the only devices not using media extensions.
* Enable it for all QC devices to avoid running into
issues with devices not having this enabled in the future.
Change-Id: I484840e712f7da6d0064a5f8016e8061b9cba838
Some ROMs may want to track Google's master branch, which has Clang 6
and 7 toolchains available, as it gets rid of some hacks in the kernel
source. Unfortunately, with the current default choosing logic, the
latest one would be chosen, which it shouldn't be. Use the variable set
in build/make/core/clang/versions.mk, as that's what was intended.
Change-Id: I607c7f750f62caabee4cdccea67846feb7f632fa
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
If for whatever reason we need a prebuilt DT image,
it has to end up in target files for the signing slave.
Change BOARD_KERNEL_PREBUILT_DT to hold the path of the
prebuilt DT image, if it's going to be used.
Change-Id: I8042d347d271da5c3963824777d399bbc4229aa9
* proprietary-files.txt entries such as
"-app/TimeService/TimeService.apk:priv-app/TimeService/TimeService.apk" should
generate a "LOCAL_SRC_FILES := proprietary/priv-app/TimeService/TimeService.apk"
in the Makefile definition.
* However, currently, the prefix_match function is being called on the whole
PRODUCT_PACKAGES_LIST entry (whole line, including ":"), and therefore,
TimeService.apk would be included in the APPS list instead of PRIV_APPS.
* Furthermore, because of the incorrect prefix_match, the generated
LOCAL_SRC_FILES is "proprietary/app/priv-app/TimeService/TimeService.apk",
which breaks the build because there is no file at that wrong path.
* The fix is to make the extract function match up with write_product_packages
by applying the target_file function on all BUILD_PREBUILT source files.
Change-Id: Ib4859b8854db0f2142bb3f28cce8dd25f7141732
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Trailing slashes cause 'patchset' to be an empty string, which
cannot be converted to an int. If we have a trailing slash, ignore
it and pick the current patchset.
Change-Id: Ifad60b7f6ff3dcfd9dd80b2e93b1f909aa360666
vdexExtractor is a tool made by anestisb that is written in C++
with code taken directly from art. However, anestisb has also added
a quicken decompiler to oatdump that was merged upstream, so we only
need vdexExtractor for 8.1 and 8.0.
Change-Id: Ic2cf2dc627a1ad2fa4d500d02d9eac8b8a9577b5
Signed-off-by: Joe Maples <joe@frap129.org>
This will prevent link errors in case my_installed_module_stem is different
from my_built_module_stem.
Change-Id: Ic72571637ea404c92128b9cd5a28e82a36bc0033
If LOCAL_SDCLANG_2 is set to true, the secondary SDLLVM toolchain
(SDCLANG_PATH_2) will be used instead.
Change-Id: Icb7492562aeaa3c584edcbced8fe1e98776774bd
* hardware/ril is a required project for any build.
Move the path mapping logic to core/config.mk so
any build has access to the correct default mapping.
Change-Id: Ia52919d7877ddc91f8a4a988fd0858d14837fc4c
* Oreo expects VNDK compatible files to be listed as LOCAL_VENDOR_FILE,
not LOCAL_PROPRIETARY_FILE.
Change-Id: Ia2384c4f3ab3a99b79df52c796c53dc25a0f4a88
* When using "?=", expansion doesn't happen right away, so the ccache
variable is sanitized before KERNEL_CC gets expanded and no ccache
is ever used for clang builds.
* With ":=", expansion happens immediately. So let's manually check
if KERNEL_CC is already set somewhere else to determine whether or
not we should set it ourselves using ":=".
Change-Id: I8a61767606a4f3d4c6ba88c68b10fd2e11783406
that way we can split the shim list logically into multiple lines like
TARGET_LD_SHIM_LIBS := /system/bin/gpsd|/vendor/lib/libshim_gpsd.so \
/system/lib/libexynoscamera.so|/vendor/lib/libexynoscamera_shim.so \
/system/lib/libstagefright.so|/system/lib/libstagefright_shim.so
to not have one single huge line
Change-Id: Ice1411ee22b78da1dbf22eac412b9e4978acebdf
* To limit security exposure, we're forcing all devices
to define shim libs with a TARGET_LD_SHIM_LIBS
Change-Id: Ic8722c42807429f2faa3546316c71c40533ce195
* Fix makefile generation for packages that have set
a different target destination
* Thanks to rashed and javelinanddart for their help
in debugging and solving this issue.
Change-Id: I1f5a1abd6929e4a7e0ccd6370d3a3dd986f94fed
The existing kernel header logic has several issues:
* It does not depend on the actual kernel headers, so it does not
detect actual kernel header changes.
* It does depend on the kernel config, which should not be used to
generate (user space) kernel headers.
The end result is that kernel headers aren't properly regenerated when
needed, and spuriously regenerated when not needed. Additionally, the
kernel header rebuild mucks around with the kernel config, which is
unneccesary and fraught with danger.
Rewrite the kernel header dependency and generation logic as follows:
* Use the dependency file $(KERNEL_OUT)/.headers_install_deps to
manage dependencies on the actual kernel header files which are
exported to user space (and the top level kernel Makefile, which
is used to generate version.h). The dependency file is exactly
the same as what GCC would output for a C/C++ dependency with the
M/MM flags.
* Conditionally include the dependency file to detect when headers
should be (re)generated.
* Introduce the phony target INSTALLED_KERNEL_HEADERS for modules to
declare a dependency on kernel headers.
Additionally:
* Get rid of TARGET_KERNEL_HEADER_ARCH and KERNEL_HEADER_DEFCONFIG.
* Get rid of KERNEL_OUT_STAMP and move commands to the appropriate
places in the rules.
* Fail the build when $(KERNEL_OUT)/usr is mentioned in a dependency.
Note a separate commit to build/core/binary.mk will provide a
migration path and a suitable deprecation warning.
* Declare the kernel*config targets phony.
Change-Id: I8b46f4ea1c622d8e73cca5157be96ec09d42ebb3
taimen uses the dtbo.img as an DTB Overlay in order to use the same defconfig for both, taimen and wahoo.
The dtbo.img is built with "make dtbo.img". Allow automatically building it when setting TARGET_NEEDS_DTBOIMAGE to true, or by manually calling make dtboimage.
Thanks to luca020400 for help with the kernel.mk logic
[raymanfx] Add AVB hash footer support
Change-Id: Iaddafaa98e3e84880462a2c35b899e3fea21e161
While UM platform HALs are interchangable and very much interoperable
between platforms and kernels, some have qualms about commonizing
platforms that Qualcomm hasn't fully commonized themselves yet. Therefore
introduce 2 seperate UM platforms, UM3.18 and UM4.4 (corresponding to
the kernel version used for that "version" of UM) and use msm8996 for
UM3.18 and msm8998 for UM4.4 (sdm845 will probably be UM4.9).
Also disable TARGET_USES_QCOM_BSP on the UM platforms to match Qualcomm
trees as it causes WiFi display not to work and calls for missing headers
and struct elements at build time.
Change-Id: Ia574231243b7d628d35959b474dd28bd37ac4031
* Use msm8996 HAL for 8953 & 8937 since they share the exact same
git history sha1 in all 7.0+ released tags.
Change-Id: I764a9a092b6d530de8a9b9e6e54f41c0b5d8a593
Add support for compiling kernels with Clang as intoduced on android-4.4
In order to compile with clang, you must set TARGET_KERNEL_CLANG_COMPILE.
If you wish to specify a specific clang version, also set TARGET_KERNEL_CLANG_VERSION,
but if that is not set, the build system will default to the latest version of clang
available in prebuilts/clang
Change-Id: I79dc1dca9758a930f2f5ba1754b5d8de114af900
Signed-off-by: Joe Maples <joe@frap129.org>
Place kernel module output in the correct location.
Perform depmod steps (copied from build-image-kernel-modules function in
build/make/core/Makefile).
See: https://source.android.com/devices/architecture/kernel/modular-kernels
Change-Id: I6e70012a5c1acdb276f9bee0d57631d2805f71ea
* Some devices need this function to return something, yet also do not
set BOARD_USES_QCOM_HARDWARE. Allow them to override this.
Change-Id: I3cf78da39b006ba805ae35fde7379357faa10250
(cherry picked from commit 012cc275e09346ef7909b6a5a144aed59b375ccd)
CAF doesn't use qcom/opensource in their paths, so automatically adjust
the project path for this when using cafremote
Change-Id: I6252fbd1c3e8a545c0d54eefb6b730b893821574
* Use requests if installed. If not fall back to urllib. This is
done because users may or may not have requests installed and
requiring them to do so for simple http stuff isn't really
reasonable.
* If requests is installed and a .gerritrc file exists in the
user's HOME directory, try to get credentials out of it
for the given gerrit instance. If auth for the correct gerrit
instance exists, use it to auth to gerrit. If no .gerritrc
exists, just use requests with no auth.
Example ~/.gerritrc entry:
review.lineageos.org|invisiblek|httppasswordhere
Change-Id: I95be26d51bfd31b53f3613e8dbfb7bba46324571
* Previously, you could just specify a SRC directly
after './extract-files', and it would work, but
now, the arg '-p/--path' is required for the same
behavior to be applied for the extraction
* Add a catch-all case that just sets SRC if the arg
doesn't match any of the args that we care about
* Make the ordering of the cases alphabetical
Change-Id: Ia2ad42d444904ead6b3bd6d910af363eb7f015cc
The existing kernel module logic does not detect failed kernel module
builds. This is because the module build logic is a long shell chain
that invokes make macros which are not intended to be used in this way.
The essense of the issue is that we get a shell chain that looks like:
cmd && cmd && var=value; cmd && var=value; cmd;
The shell breaks this into three separate commands. The first builds
the modules. The other two are the macro invocations. So the result
of the command is the result of the last macro invocation, which will
always succeed even if the modules fail to build.
The issue is made worse by the existing build rule conflating the built
kernel modules and the installed kernel modules.
Fix this by reducing the built kernel module command to a single shell
command and creating a separate target INSTALLED_KERNEL_MODULES. Any
kernel module build failure will show up properly. The commands for
INSTALLED_KERNEL_MODULES do not invoke any macros and should avoid the
issue described above.
Finally, this also removes the fake target no-external-modules and
unifies the install logic for in-tree and out-of-tree modules.
Change-Id: I3d13056e217e1e937c8c3a345032682ffc394bca
Skip the extraction of pinned files if the ones currently available
have the expected sha1. If we don't, we will overwrite pinned files
with potentially incorrect files when the current vendor files are
not moved to a temporary directory (i.e. when not cleaning vendor).
Change-Id: I640d6bf2ed98eb366a4df17f0ebeaec81cb5274b
* WARNING: this intentionally breaks the build on devices who
are not setting BOARD_KERNEL_IMAGE_NAME and are still setting
TARGET_USES_UNCOMPRESSED_KERNEL or TARGET_KERNEL_APPEND_DTB
* The logic here is insanity and if all of this can be done
by simply setting BOARD_KERNEL_IMAGE_NAME, why have all this
extra cruft?
* Use cases:
- Set a kernel image name without "-dtb" on the end, you get a kernel.
Nothing more.
- Set a kernel image name with "-dtb" on the end, you get an kernel
with an appended dt.
- Set a kernel image name without "-dtb" on the end, and set
BOARD_KERNEL_SEPARATED_DT. You get a kernel and a separated dt.img.
- Set a kernel image name with "-dtb" on the end, and set
BOARD_KERNEL_SEPARATED_DT. You're crazy.
Change-Id: I5c3fc6eb727255684278ff562c0ee3faa7124b6b
We want to cleanup our temporary files independently on the signal,
so just execute a trap on 0. This will ensure temporary files are
always removed and doesn't require any extra care when trapping
signals such as SIGINT that require an explicit exit call.
Change-Id: Ieff4f15c44a9ac9d5a543d14c140ebd72c0e7344
To be honest, this name is a little misleading, this is how it should
have been done in the first place. This allows devices to copy vendor
files to the proper location depending on TARGET_COPY_OUT_VENDOR rather
than hardcoding system/vendor. This allows devices with dedicated vendor
partitions to copy directly to vendor. The only reason it's optional
is that some nexi set TARGET_COPY_OUT_VENDOR to system which would cause
some weird breakage.
Change-Id: Ic46bc1086737835340abef9f61693d386bc6a5dc
* Make a tempdir using the mktemp command rather than just making a
dir in /tmp to accomodate for systems that don't set proper perms
or dont have /tmp
* Fix the deodex procedure to pull files from the right path
Change-Id: I181863599b6670e3a149069dbb7b13ebf73bae8e
Oreo introduces new optimized dex files (or vdex). While smali/baksmali
have supported vdex since 2.2.1, you actually have to have the .vdex in
the same location as the .oat or else the smali will fail due to not
finding the .vdex. Copy it (if it exists) and echo a warning since vdex
deodexing is still experimental.
Change-Id: Ic612751be45a8b6e54b8794b426a4d5adbbf13d2
* Certain order of running these commands on different repos can
end up producing broken remotes, because the variables are
exported globally (looking at you PFX)
Change-Id: I0b679f04264d964ed9a0f0d1adfdbaeac9403ec8
* lineageremote was not working properly for pure AOSP projects
because there is no github remote.
* Read and convert AOSP remote name if there is no github remote
Change-Id: I629f0a8ae3be09d539e18d63a9738c32fb24496c
* ZSH errors out when it doesn't find anything in $OUT/system/lib/modules/.
* So add a check to avoid error while using installboot() with a target
that doesn't have modules enabled.
Change-Id: Ibe66f6962943e9b90c7059a4c9b4ded558318326
* This was always the default behaviour and doesn't require
any additional argument in order to make use of pinning feature
(pinned blobs are only considered when vendor folder is removed)
Change-Id: I34ff7678bd6800a2c593e9fe128cc151c59967da
Currently, using project-set-path is blocking us from overriding the pathmap
for the audio, display, and media HALs, so set them with set-device-specific-path
to allow overriding the HALs with USE_DEVICE_SPECIFIC_* and DEVICE_SPECIFIC_*_PATH
Change-Id: Iee3723cf251d0f485a77a17fd61cb62178833582
* Allows extracting only a specific section from proprietary-files.txt
* Defaults to not cleaning vendor folder before extraction
* Adds script options rather than depending on apredefined order
Change-Id: I74cd3bf4a1f652232c97c78d6164f0730599c1a7
Sometime blob directories are contained in dirs not named system
(ex. extracting blobs from another vendor dir) so check if the file
exists without system/ before appending "system/" to filenames.
Change-Id: I4ba946e178260b4f4804b1ac4422645e3085c665
Sometimes the need arises to update one specific subset of blobs
while holding others steady. Introduce a way to specify the "section"
of blobs to update (obviously requires the proprietary-files to be
properly split up first)
Requires additional changes in device tree extract_files.sh to support
passing the additional arguments
Change-Id: I98feab56f8bfade2818b1b5264e019440d4c57c5