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>
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>
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>
This reverts commit 7d9197e99b.
Reverting to avoid removing debug information from modules.
Change-Id: I01be6f1b616ebde8578c40fc63f67a5d3170cf27
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
Add support for CPIO cmdline support to remove ramdisk of SVMs.
Change-Id: Ie0bcdfd66f94972c6b72a2285af538a6f4f37173
Signed-off-by: Cong Zhang <quic_congzhan@quicinc.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Currently, only tuivm builds are available.
Enable the oemvm targets.
Change-Id: I5acda1e41150467726be27fcb57fd9146a425ca8
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
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>
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>
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>