Commit graph

31 commits

Author SHA1 Message Date
Alessandro Astone
d11ff7c5ab kernel: Add prebuilt m4 to build environment
* android-11 removed M4 from the Allowed list, and provided a
   prebuilt binary in prebuilts/build-tools

Change-Id: I83d033ecd35a0e2318210e47309fcc010843347f
2020-09-24 16:21:42 +02:00
LuK1337
a413b6ee55 kernel: Use Clang as HOST_{CC,CXX}
GCC was deprecated upstream, so switch to Clang.

Change-Id: I8a6c9d6b763db0055189d83f9037ccb0c50a23ea
2020-09-24 11:59:52 +01:00
dianlujitao
2c62140d3d kernel: Use nproc from prebuilts
Change-Id: I1d7a33dac57cbba9ce1a92f81d74709146e92968
2020-09-24 11:58:50 +01:00
Bruno Martins
c3ad8b5c54 lineage: Use $(HOST_PREBUILT_TAG) where possible
Change-Id: If211d23ce72b3404368cd723cbb9ea801e61802c
2020-09-24 11:56:08 +01:00
LuK1337
2baeb4fb8b kernel: Use CPATH for including host headers
* Fixes build on distros where CAP_LAST_CAP @ /usr/include/linux/capability.h
  doesn't match target device kernel src.

Change-Id: Iafdf9694fd165c83b22bd95df95e940ecceb0fdd
2020-09-02 19:44:54 +02:00
Luca Stefani
fe00ea90c9 kernel: Rework how DTB/DTBO are built
* Remove the separate dtbo.mk task and merge it
  in kernel.mk
* Merge in-kernel and separated DTBO image generation

Change-Id: I2cae84095cbd3d68abbe1899a9cae34c8a1e5fc9
2020-08-22 20:26:13 +02:00
dianlujitao
a24144faf2 kernel: Add bison and flex to build environment
* Required since Linux 4.16

Change-Id: I107ea1b097d72a7b5251273c8c7e33ad6585b59c
Signed-off-by: Jesse Chan <jc@lineageos.org>
2020-05-29 17:31:10 +02:00
Rashed Abdel-Tawab
e3c319a271
kernel: Move our dtb.img logic here
Our build/make changes break incremenetal builds with prebuilt dtb dir
(see discussion here: https://android-review.googlesource.com/c/platform/build/+/1134337/1/core/Makefile )

Instead of using the AOSP recipe, just define our own and use it by not defining
BOARD_PREBUILT_DTBIMAGE_DIR

Change-Id: If579b1670db447557b6f76ca79ecec22661c4080
2019-10-07 14:46:06 -04:00
Rashed Abdel-Tawab
2c247d80d0 kernel: Build dtb.img from compiled dtbs
Change-Id: If419d090740c005357fbd1665f78296d106b4509
2019-10-05 05:32:14 +02:00
LuK1337
9d8578bb13 kernel: Switch back to host openssl entirely
* OpenSSL cannot be statically linked because of
  getaddrinfo and gethostbyname calls.
* Also according to soong it's whitelisted:
  33f9529962/ui/build/paths/config.go (L98)

Change-Id: I1718bd98e7ac30d31de38c2cd3bc3e51b7100ce4
2019-10-01 22:42:34 +02:00
Rashed Abdel-Tawab
06539d4267 kernel: Add OpenSSL libs to LD_LIBRARY_PATH
Change-Id: If266f5f7bf0f2853ea54601023a894935d350754
2019-09-28 00:22:02 +02:00
Rashed Abdel-Tawab
168fd231b6 Revert "kernel: fix KERNEL_TOOLCHAIN_PATH_gcc and usage"
This reverts commit 13f4c837fe.

Reason for revert: reeet. I broke stuff.

Change-Id: If8518aaa409d9afeaf20c689405fd21900fa5e74
2019-09-24 17:22:39 +02:00
Simon Shields
13f4c837fe kernel: fix KERNEL_TOOLCHAIN_PATH_gcc and usage
Previously, this would be a full compile prefix
(e.g. prebuilts/gcc/.../bin/aarch64-linux-gnu-). Since we're adding
this to PATH, it only needs to be prebuilts/gcc/.../bin.

Also remove the extra /bin/ added by kernel.mk.

Change-Id: If2490729128c0243c61de646f6c8e19a15c8dc1c
2019-09-24 17:19:45 +02:00
Rashed Abdel-Tawab
812efbcbb9
lineage: Move perl base modules to common prebuilts dir
Change-Id: I88df0825c26aaebfa9329cf15eb93d8e2bf728e1
2019-09-23 16:59:39 -07:00
Rashed Abdel-Tawab
9c57748956
lineage: Move openssl to generic 1.1.1 directory and correct darwin path
Change-Id: I2c1ad1054027d5fbf91421342c3c0d3e7972b1a3
2019-09-18 10:36:25 -07:00
Rashed Abdel-Tawab
c648519530 kernel: Add GCC toolchains to the path
Tools like `as` only exist in the GCC toolchain, so we need that

Change-Id: I025d0d9bdf6eda94a538d2d6ddafbecc8830f471
2019-09-13 08:27:49 +02:00
Luca Stefani
70207cd54d
kernel: Fix nproc number
kati wrapper is forcing this to 2 for some reason. Hack around it.

Change-Id: Ie056f3e43645515f3c5922e0fbf79a0b5ecf7856
2019-09-09 12:21:36 -07:00
Rashed Abdel-Tawab
ba5ea35eb6
kernel: Use absolute path for kernel O= argument
The kernel make command is executed in the build root. Without absolute
out paths, kernel out start with "out/" meaning it would be created in
the kernel source. Add BUILD_ROOT to the argument to ensure it's always
made in the actual out/ dir.

Change-Id: I425134a893d4d5c9f31efccaf75e153b5462b76c
2019-09-09 12:21:35 -07:00
Rashed Abdel-Tawab
493ad4b8a5
kernel: Set kernel toolchain roots for aarch64, arm, and x86
The GCC toolchains are no longer added to the path by default, so
we need to hardcode the full paths for these. Also set variables
for every arch, and then set the toolchain to the arch specific var.
This is so we can set the ARM32 cross compile flag for vDSO32
enabled kernels.

Change-Id: I7e099a26a17f4a3cc9be6232a26c671e8fcfbdef
2019-09-09 12:20:43 -07:00
dianlujitao
bd16a8e3a4
kernel: Use linux-android- toolchains to build kernel on aarch64 and x86
* -androidkernel ones became symlinks to -android ones long time ago, use
   -android executables directly to simplify the logic on these platforms.
 * Keep arm on -androidkernel because it doesn't boot for some reason.

Change-Id: I97dd93121fc0e805a965e3f8b84466dd7bd686c0
2019-09-09 12:20:43 -07:00
Rashed Abdel-Tawab
dfc3d1830d
kernel: Use prebuilt binaries
perl, lz4c, and a bunch of other binaries are not allowed anymore.
So we need to provide our own.

Change-Id: Idbc88b76247b3dda7c5d52e5eed2d548c33f6f2d
2019-09-09 12:19:44 -07:00
Rashed Abdel-Tawab
d7e24e397b
kernel: Link against prebuilt openssl
Using preinstalled system headers and libraries is no longer allowed.
So we're gonna make our own prebuilts/openssl so we can build kernels.

Change-Id: Ic5bc3b14c37b3bca352932c6f19a592377dbaf27
2019-09-08 13:41:36 -07:00
Rashed Abdel-Tawab
3ad0e0d705
kernel: Use full user defined path to ccache
The built ccache command is now deprecated and spits out errors. ccache is
also no longer used for the full build unless CCACHE_EXEC is defined. Move
the kernel to the same logic in order to actually use ccache and silence
the warnings.

Change-Id: Iccedd9d5868d31060677667cc18810aae0149a26
2019-09-08 13:41:35 -07:00
Rashed Abdel-Tawab
21ee5983e2
kernel: Use full path to the gcc/g++ commands
gcc and g++ are now dissallowed commands so just run the full commands

Change-Id: I2ba5675a3f5410f51fc37b723714b35f1e4628c8
2019-09-08 13:41:35 -07:00
Rashed Abdel-Tawab
fb35b9da61
kernel: Use full path to the make command
make is now a dissallowed command so just run the full command

Change-Id: I9390dc5a8bcd17f316354b88bdbc65ac8663b369
2019-09-08 13:41:35 -07:00
Rashed Abdel-Tawab
3254cafe49
kernel: Add TARGET_KERNEL_ADDITIONAL_FLAGS to allow setting extra cflags
Also fix KERNEL_MAKE_FLAGS not being used by the kernel make command

Change-Id: I8786d6c1de6652f87a02c990c4b56f62b0cc0203
2019-09-01 17:45:00 -07:00
Ethan Chen
b7b49cc07d build: Use ifeq/else ifeq/else construction in board config
* Instead of nesting ifeq/else/ifeq/else/endif/endif construction, make
  allows the more readable ifeq/else ifeq/else/endif construction. Use it
  instead.

Change-Id: Ifd2635929799db593e04a13827f05c97e95487e4
2019-06-25 23:13:21 +02:00
Rashed Abdel-Tawab
8613ea0ac1 kernel: Set correct kernel compiler prefixes for aarch64 clang
These configuration options are set based on the Google configurations
located in kernels
(ex. https://github.com/LineageOS/android_kernel_google_wahoo/blob/lineage-16.0/build.config)

This is composed of 2 parts:

Revert "kernel: Correct CROSS_COMPILE_ARM32 toolchain"

This reverts commit c77bb3a5ba.
This breaks builds when building with upstream commit
ad15006cc78459d059af56729c4d9bed7c7fd860. That commit fixes LD being
used from outside the path, however androidkernel toolchains don't
have elfedit. Google specifically doesn't use androidkernel, so we
need to follow them on this.

Set CROSS_COMPILE_PREFIX to aarch64-linux-android- for clang builds

Upstream commit ad15006cc78459d059af56729c4d9bed7c7fd860 makes the
kernel build system use GCC toolchains for elfedit, so we have to
actually use a real GCC toolchain, not the androidkernel one.

Change-Id: I79ac4ac47d3ba6c2abbc5ce40e56ed5c707295b4
2019-06-16 06:27:43 +02:00
Rashed Abdel-Tawab
60fe93525a lineage: Rework DTBO image generation
Currently we handle the DTBO images from start to finish, including
AVB footers, and just drop them in $(PRODUCT_OUT)/dtbo.img when done.
While this works for the most part, we are limited in what we can do
with the DTBO images. For example non-A/B device recovery images must
have a copy of the DTBO image appended to recovery (see AOSP docs:
https://source.android.com/devices/bootloader/recovery-image ). This
means that we need to pass the pre-AVB dtbo image into
BOARD_PREBUILT_DTBOIMAGE in order to let the AOSP build system handle it.

This commit reworks the way the DTBO images are built, placing them at
$(PRODUCT_OUT)/dtbo-pre.img instead and setting BOARD_PREBUILT_DTBOIMAGE
to that path so the AOSP build system can pick the images up and sign
them and append to recovery (for applicable devices).

Change-Id: I8819d7cd92ba298de67dbc7f6b321917ba8524f1
2019-06-06 07:17:27 +02:00
Ethan Chen
995aff2a45 kernel: Add more threads to kernel build process
Change-Id: I9c90de7820308542c7bb15605df519976dd04e0b
2019-03-09 13:41:19 -08:00
Rashed Abdel-Tawab
a836d79629 lineage: Move some kernel definitions to BoardConfigKernel
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
2018-10-20 21:50:38 +02:00