diff --git a/bin/cros_make_image_bootable b/bin/cros_make_image_bootable index 38783cbc70..85e865bf00 100755 --- a/bin/cros_make_image_bootable +++ b/bin/cros_make_image_bootable @@ -145,6 +145,9 @@ DEFINE_boolean enable_squashfs ${FLAGS_FALSE} \ DEFINE_string squash_sort_file "" \ "Specify the priority of files when squashing the rootfs." +DEFINE_string enable_serial "" \ + "Enable serial port for printks. Example values: ttyS0" + # Parse the boot.desc and any overrides eval set -- "${BOOT_DESC} ${FLAG_OVERRIDES}" FLAGS "${@}" || exit 1 @@ -240,6 +243,7 @@ make_image_bootable() { --verity_error_behavior=${FLAGS_verity_error_behavior} \ --verity_salt=${FLAGS_verity_salt} \ --keys_dir="${FLAGS_keys_dir}" \ + --enable_serial="${FLAGS_enable_serial}" \ ${enable_rootfs_verification_flag} \ ${enable_bootcache_flag} \ ${use_dev_keys} diff --git a/build_image b/build_image index 907b141680..2fddc70486 100755 --- a/build_image +++ b/build_image @@ -31,6 +31,8 @@ DEFINE_boolean standard_backdoor ${FLAGS_TRUE} \ "Install standard backdoor credentials for testing" DEFINE_string usb_disk /dev/sdb3 \ "Path syslinux should use to do a usb boot. Default: /dev/sdb3" +DEFINE_string enable_serial "" \ + "Enable serial port for printks. Example values: ttyS0" FLAGS_HELP="USAGE: build_image [flags] [list of images to build]. This script is used to build a Chromium OS image. Chromium OS comes in many diff --git a/build_kernel_image.sh b/build_kernel_image.sh index 167e1991df..581b811015 100755 --- a/build_kernel_image.sh +++ b/build_kernel_image.sh @@ -49,6 +49,8 @@ DEFINE_boolean enable_rootfs_verification ${FLAGS_TRUE} \ "Enable kernel-based root fs integrity checking. (Default: true)" DEFINE_boolean enable_bootcache ${FLAGS_FALSE} \ "Enable boot cache to accelerate booting. (Default: false)" +DEFINE_string enable_serial "" \ + "Enable serial port for printks. Example values: ttyS0" # Parse flags FLAGS "$@" || exit 1 @@ -180,10 +182,25 @@ WORK="${WORK} ${FLAGS_working_dir}/boot.config" info "Emitted cross-platform boot params to ${FLAGS_working_dir}/boot.config" # Add common boot options first. -cat < "${FLAGS_working_dir}/config.txt" -loglevel=7 +config="${FLAGS_working_dir}/config.txt" +if [[ -n ${FLAGS_enable_serial} ]]; then + console=${FLAGS_enable_serial} + if [[ ${console} != *,* ]]; then + console+=",115200n8" + fi + cat < "${config}" +console=${console} +earlyprintk=${console} +console=tty1 +EOF +else + cat < "${config}" console= +EOF +fi + +cat <> "${config}" +loglevel=7 init=/sbin/init cros_secure EOF diff --git a/build_library/build_image_util.sh b/build_library/build_image_util.sh index cea628fb3c..bb25e26f1e 100755 --- a/build_library/build_image_util.sh +++ b/build_library/build_image_util.sh @@ -139,6 +139,7 @@ create_boot_desc() { --boot_args="${FLAGS_boot_args}" --nocleanup_dirs --verity_algorithm=sha1 + --enable_serial="${FLAGS_enable_serial}" ${enable_rootfs_verification_flag} ${enable_bootcache_flag} EOF