Commit Graph

24 Commits

Author SHA1 Message Date
qctecmdr
3881c58a58 Merge "ANDROID: build: Replace genrules with write_file where possible" 2023-08-10 13:43:30 -07:00
John Moon
1312198e53 ANDROID: build: Replace genrules with write_file where possible
Currently, there are a few places where we use Bazel's native genrule
rule to generate files that consist of simple strings (usually with
cat << EOF or echo "str" >> "$@" semantics). It was recently pointed
out to us that the Skylib library (already available from Kleaf) has
a "write_file" rule which is better than our genrule method for
creating files from strings.

It's better because it has a simpler interface, does not rely on any
Starlark-external tools (i.e. bash), and does not require all of the
strings to be formatted in one operation which makes the rule
slightly more readable.

Replace file-creating genrules where it makes sense to do so. This
change has no impact on actual build logic as the output files are
logically identical.

Change-Id: I2cef369e299d42b2677ddea833c43d9c80eff32c
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
2023-08-01 09:41:05 -07:00
John Moon
463dfbb7e8 ANDROID: build: Remove test_mapping definitions
Kleaf test_mapping rules are no longer used upstream and were being
skipped in our builds anyway.

Remove the test_mapping rules.

Change-Id: If8689f4572b1d1dce2c8ba03075444fa3af7d86b
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
2023-07-27 09:25:18 -07:00
John Moon
c38cee9986 ANDROID: build: Fix output directory layout
With a recent change to the output directory handling from
build_with_bazel.py, some dist directory paths incorrectly used
hyphens instead of underscores.

Fix this issue by mirroring the logic in msm_common.bzl which handles
these paths properly.

Also, run buildifier to fix format of Bazel build files.

Change-Id: Ia82073f059c54f4a7f523c5bd91afdc755c70df1
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
2023-07-22 20:40:11 -07:00
John Moon
2af4ddcc3c Revert "ANDROID: build: Setting strip_modules in kernel build"
This reverts commit 7d9197e99b.

Reverting to avoid removing debug information from modules.

Change-Id: I01be6f1b616ebde8578c40fc63f67a5d3170cf27
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
2023-03-23 18:14:17 -07:00
Cong Zhang
d0036d6f21 build: Add support for CPIO cmdline support
Add support for CPIO cmdline support to remove ramdisk of SVMs.

Change-Id: Ie0bcdfd66f94972c6b72a2285af538a6f4f37173
Signed-off-by: Cong Zhang <quic_congzhan@quicinc.com>
2023-03-19 19:18:56 -07:00
qctecmdr
db8bb5aa2a Merge "ANDROID: build: Remove define_compile_commands argument" 2023-03-16 14:54:43 -07:00
qctecmdr
27000b0647 Merge "ANDROID: build: Set module signing keys in VM config" 2023-03-09 02:34:34 -08:00
John Moon
a9a0a0120b ANDROID: build: Remove define_compile_commands argument
Currently, a kernel_compile_commands rule can be defined if the user
passes define_compile_commands = True to the definition macros. This
was to avoid enabling the interceptor on the kernel_build when it was
not necessary.

With a recent change upstream, the interceptor is no longer needed to
use compile_commands. Therefore, let's remove the argument and always
define the rule. That way, users can always generate the
compile_commands.json file if they wish.

Change-Id: I723756b31a2ec4582fee804386406194f5ce77d8
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
2023-03-08 15:12:39 -08:00
John Moon
ccef00df94 ANDROID: build: Use upstream UAPI library function
Currently, our build uses an in-house definition of a header-only
cc_library for use with userspace apps using UAPI headers.

Since we've upstreamed this feature, we should remove our internal
definition and use the one in Kleaf instead.

Change-Id: I22fd497a82a2b6148141b80c7f838d221c812a0e
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
2023-03-07 12:53:15 -08:00
John Moon
315568a798 ANDROID: build: Set module signing keys in VM config
Currently, modules are not signed by the VM config.

In legacy build.sh, the signing keys/certs would be generated in the
POST_DEFCONFIG phase of the build, but now, the keys are generated
by Bazel in a separate rule.

Take the key generation step out and use the new Bazel attributes
instead.

Change-Id: Ibbe3e98eab9d6d6a8dafc05582b3f17f83a226db
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
2023-03-02 09:42:17 -08:00
qctecmdr
790eb22306 Merge "ANDROID: build: Build all VM dtb's for any variant" 2023-02-28 07:27:43 -08:00
qctecmdr
3eb23712fb Merge "ANDROID: build: Merge multiple vm images into one" 2023-02-27 21:39:23 -08:00
Vamsi Krishna Lanka
242a2163ff ANDROID: build: Build all VM dtb's for any variant
LE builds expect to build all the dtb's in the out directory for
any variant. so with this commit we are building all the dbt's but
considering only variant related dtb's to generate dtb image.

Change-Id: I6f5649955b773ab917cc62cefa4de03dfca2faff
Signed-off-by: Vamsi Krishna Lanka <quic_vamslank@quicinc.com>
2023-02-23 20:58:47 -08:00
John Moon
7d9197e99b ANDROID: build: Setting strip_modules in kernel build
Currently, DO_NOT_STRIP_MODULES is used to signal when and when not
to strip kernel modules. A recent upstream change removes this config
option by unsetting it during the Bazel build in Kleaf.

Instead of using the deprecated build.config method, use the
kernel_build attribute "strip_modules". Set to True in our builds.

Change-Id: I918758ce8758234bcc13a683c2b39fc639678229
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
2023-02-23 20:12:33 -08:00
Vamsi Krishna Lanka
7230c91d6e ANDROID: build: Add genrule to build dtb image for VM's
Currently, we are doing cat of all the vm dtb's into the dtb.img
which is causing issues.
Use mkdtboimg to create the dtb images for vm.

Change-Id: Iea2fef866370329e884ee1832823cf9c58b4b99f
Signed-off-by: Vamsi Krishna Lanka <quic_vamslank@quicinc.com>
2023-02-17 11:58:40 -08:00
John Moon
2a63202b0a ANDROID: build: Add dtb.img to dist dir for VM builds
Currently, the DTB img is not included in the output directory for
VM builds.

Add the kernel_images rule output to the dist directory list so the
dtb.img is copied.

Change-Id: Iefefa83041c7dec4e1ded4f4d7da5f8412b0e1fc
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
2023-02-08 13:02:10 -08:00
John Moon
944f85cffc ANDROID: build: Add signing/verity keys to output
Signing keys and certificates are required to sign kernel modules
and dm-verity hash, but these files are not generated in the current
build.

Add a Bazel rule to generate them and add to the output of the VM
distributions. Also add the scripts and pre-generated key required
to use them.

Change-Id: I1909548911b3d5742c75b3128f6b17b18ef789b4
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
2023-02-03 05:26:06 -08:00
John Moon
c1f79d7980 build: Add initramfs files for VM userspace compilation
There are a few initramfs files from the kernel build that are
required for userspace VM compilation.

Include these files in the dist output.

Change-Id: I7539538fc44626fc3aee58f157ba245d342cf4ec
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
2023-01-30 15:08:47 -08:00
John Moon
515dc189be build: Unify output directory format
Currently, the Bazel build output directory format differs from
legacy build.sh in that it replaces underscores directory name to
hyphens.

This behavior is undesirable, so refactor the output directory name
logic to be consistent with legacy build.sh:

out/msm-kernel-<target>-<variant> where words in the target and
variant are underscore-delimited.

Change-Id: Ia60076dd613fc034888703f10d5dc836b34c317b
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
2023-01-18 17:14:58 -08:00
John Moon
16bce14397 ANDROID: Enable oemvm builds in Bazel
Currently, only tuivm builds are available.

Enable the oemvm targets.

Change-Id: I5acda1e41150467726be27fcb57fd9146a425ca8
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
2022-12-19 09:40:20 -08:00
John Moon
c2170f5e11 build: Change paths to Bazel extensions
The canonical location of msm_kernel_extensions.bzl is changing.

Update the load() calls to the new location.

Change-Id: I27df6131de155cd0592cad5d57202ca01c4affb5
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
2022-11-20 17:40:14 -08:00
John Moon
13a5aa4fac build: Export UAPI headers as Bazel cc_library
There's currently no way for userspace programs building with
Bazel to ingest the kernel UAPI headers. Kleaf generates a tarball
of the headers, but a Bazel cc_binary rule cannot use that as an
input.

Define a native Bazel header-only cc_library which userspace
programs can use to build with the kernel's UAPI headers. For
example:

cc_binary(
    name = "foo",
    srcs = ["foo.c"],
    deps = ["//msm-kernel:kalama_gki_uapi_header_library"],
)

Change-Id: Ib884d9123e4ffd0bead97e8cebb5a3456e73b2a6
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
2022-11-14 16:02:01 -08:00
John Moon
8503690aa2 build: Add support for Bazel VM builds
Currently, only legacy build.sh support exists for VM
builds.

Add Bazel support for these builds.

Change-Id: I10b221aa4a6633240b984eff333e15f5cd8b82cd
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
2022-11-14 15:05:22 -08:00