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 <quic_nainsing@quicinc.com>
Signed-off-by: Naman Jain <quic_namajain@quicinc.com>
This commit is contained in:
Naini Singh 2024-04-23 18:27:48 +05:30 committed by Naman Jain
parent 2c4e117d35
commit 9fa997948e
5 changed files with 19 additions and 5 deletions

View File

@ -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 = []):

View File

@ -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

View File

@ -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

View File

@ -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
],
)

View File

@ -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,