From 9fa997948e22b506542a8aa8c657b46ea3baf205 Mon Sep 17 00:00:00 2001 From: Naini Singh Date: Tue, 23 Apr 2024 18:27:48 +0530 Subject: [PATCH] ANDROID: build: Remove default value passed to earlycon cmdline option Early boot kernel logs are enabled with earlycon cmdline option. If earlycon device is passed to earlycon as a parameter with "=dev", it is considered, otherwise kernel relies on stdout-path for the device. Since this device can be different for different chipsets, sharing the same compiled binary, the value passed to earlycon parameter can be wrong for some of the chipsets, which is leading to issues like invalid address access or garbled logs in some cases. To fix this, add earlycon without any value so that the right device can be picked from stdout-path. For chipsets not having stdout-path defined, keep passing earlycon value if it is explicitly defined in target bazel file. Also, remove default earlycon param value for Pineapple family of chipsets to avoid adding wrong address for Cliffs, Volcano SoCs. Change-Id: If40d23a3916f1f148e26033d67408279dfca5493 Signed-off-by: Naini Singh Signed-off-by: Naman Jain --- image_opts.bzl | 2 +- msm_kernel_la.bzl | 7 ++++++- msm_kernel_lagvm.bzl | 7 ++++++- msm_kernel_le.bzl | 7 ++++++- pineapple.bzl | 1 - 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/image_opts.bzl b/image_opts.bzl index 4a510fe64b70..167166bc8dfb 100644 --- a/image_opts.bzl +++ b/image_opts.bzl @@ -5,7 +5,7 @@ def boot_image_opts( super_image_size = 0x10000000, boot_partition_size = 0x6000000, lz4_ramdisk = True, - earlycon_addr = "0x00a9C000", + earlycon_addr = None, kernel_vendor_cmdline_extras = ["bootconfig"], board_kernel_cmdline_extras = [], board_bootconfig_extras = []): diff --git a/msm_kernel_la.bzl b/msm_kernel_la.bzl index c512eda4d7d4..002d938a6a5f 100644 --- a/msm_kernel_la.bzl +++ b/msm_kernel_la.bzl @@ -48,6 +48,11 @@ def _define_build_config( variant: variant of kernel to build (e.g. "gki") """ + # keep earlycon addr in earlycon cmdline param only when provided explicitly in target's bazel file + # otherwise, rely on stdout-path + earlycon_param = "={}".format(boot_image_opts.earlycon_addr) if boot_image_opts.earlycon_addr != None else "" + earlycon_param = '[ "$KERNEL_CMDLINE_CONSOLE_AUTO" != "0" ] && KERNEL_VENDOR_CMDLINE+=\' earlycon{} \''.format(earlycon_param) + write_file( name = "{}_build_config_bazel".format(target), out = "build.config.msm.{}.generated".format(target), @@ -67,7 +72,7 @@ def _define_build_config( "BUILD_INIT_BOOT_IMG=1", "LZ4_RAMDISK={}".format(int(boot_image_opts.lz4_ramdisk)), '[ -z "$DT_OVERLAY_SUPPORT" ] && DT_OVERLAY_SUPPORT=1', - '[ "$KERNEL_CMDLINE_CONSOLE_AUTO" != "0" ] && KERNEL_VENDOR_CMDLINE+=\' earlycon={} \''.format(boot_image_opts.earlycon_addr), + earlycon_param, "KERNEL_VENDOR_CMDLINE+=' {} '".format(" ".join(boot_image_opts.kernel_vendor_cmdline_extras)), "VENDOR_BOOTCONFIG+='androidboot.first_stage_console=1 androidboot.hardware=qcom_kp'", "", # Needed for newline at end of file diff --git a/msm_kernel_lagvm.bzl b/msm_kernel_lagvm.bzl index 974b08765160..7706e79a1091 100644 --- a/msm_kernel_lagvm.bzl +++ b/msm_kernel_lagvm.bzl @@ -45,6 +45,11 @@ def _define_build_config( variant: variant of kernel to build (e.g. "gki") """ + # keep earlycon addr in earlycon cmdline param only when provided explicitly in target's bazel file + # otherwise, rely on stdout-path + earlycon_param = "={}".format(boot_image_opts.earlycon_addr) if boot_image_opts.earlycon_addr != None else "" + earlycon_param = '[ "$KERNEL_CMDLINE_CONSOLE_AUTO" != "0" ] && KERNEL_VENDOR_CMDLINE+=\' earlycon{} \''.format(earlycon_param) + write_file( name = "{}_build_config_bazel".format(target), out = "build.config.msm.{}.generated".format(target), @@ -64,7 +69,7 @@ def _define_build_config( "BUILD_INIT_BOOT_IMG=1", "LZ4_RAMDISK={}".format(int(boot_image_opts.lz4_ramdisk)), '[ -z "$DT_OVERLAY_SUPPORT" ] && DT_OVERLAY_SUPPORT=1', - '[ "$KERNEL_CMDLINE_CONSOLE_AUTO" != "0" ] && KERNEL_VENDOR_CMDLINE+=\' earlycon={} \''.format(boot_image_opts.earlycon_addr), + earlycon_param, "KERNEL_VENDOR_CMDLINE+=' {} '".format(" ".join(boot_image_opts.kernel_vendor_cmdline_extras)), "VENDOR_BOOTCONFIG+='androidboot.first_stage_console=1 androidboot.hardware=qcom_kp'", "", # Needed for newline at end of file diff --git a/msm_kernel_le.bzl b/msm_kernel_le.bzl index 2688a00d4124..af50506d4c9c 100644 --- a/msm_kernel_le.bzl +++ b/msm_kernel_le.bzl @@ -42,6 +42,11 @@ def _define_build_config( variant: variant of kernel to build (e.g. "gki") """ + # keep earlycon addr in earlycon cmdline param only when provided explicitly in target's bazel file + # otherwise, rely on stdout-path + earlycon_param = "={}".format(boot_image_opts.earlycon_addr) if boot_image_opts.earlycon_addr != None else "" + earlycon_param = "earlycon" + earlycon_param + write_file( name = "{}_build_config_bazel".format(target), out = "build.config.msm.{}.generated".format(target), @@ -60,7 +65,7 @@ def _define_build_config( "SKIP_UNPACKING_RAMDISK=1", "BUILD_INITRAMFS=1", '[ -z "$DT_OVERLAY_SUPPORT" ] && DT_OVERLAY_SUPPORT=1', - '[ "$KERNEL_CMDLINE_CONSOLE_AUTO" != "0" ] && KERNEL_VENDOR_CMDLINE+=\' console=ttyMSM0,115200n8 earlycon=qcom_geni,0x00a9C000 qcom_geni_serial.con_enabled=1 \'', + '[ "$KERNEL_CMDLINE_CONSOLE_AUTO" != "0" ] && KERNEL_VENDOR_CMDLINE+=\' console=ttyMSM0,115200n8 {} qcom_geni_serial.con_enabled=1 \''.format(earlycon_param), "", # Needed for newline at end of file ], ) diff --git a/pineapple.bzl b/pineapple.bzl index 672d9acb31b2..069dd8261431 100644 --- a/pineapple.bzl +++ b/pineapple.bzl @@ -328,7 +328,6 @@ def define_pineapple(): variant = variant, in_tree_module_list = mod_list, boot_image_opts = boot_image_opts( - earlycon_addr = "qcom_geni,0x00a9C000", kernel_vendor_cmdline_extras = kernel_vendor_cmdline_extras, board_kernel_cmdline_extras = board_kernel_cmdline_extras, board_bootconfig_extras = board_bootconfig_extras,