From 26d68ecaa590f9ed08af804b21b09b98b73949b6 Mon Sep 17 00:00:00 2001 From: Arkaitz Ruiz Alvarez Date: Fri, 24 Jun 2011 11:03:18 -0700 Subject: [PATCH] Add cros_debug to kernel commandline in dev images Every developer image (and test images based on the developer image) should include "cros_debug" in the kernel commandline. This flag is used by the crossystem application to determine if the image being run is a developer image. cros_make_image_bootable receives a new flag, --force_developer_mode that appends "cros_debug" to the boot args. BUG=chromium-os:16951 TEST=build images. Flash a base image and confirm the absence of "cros_debug" in /proc/cmdline. Flash the developer image and confirm the existence of the string. Change-Id: I9f748638b5dac384be991908239e8b447ddf3b5e Reviewed-on: http://gerrit.chromium.org/gerrit/3169 Tested-by: Arkaitz Ruiz Alvarez Reviewed-by: Gaurav Shah --- bin/cros_make_image_bootable | 7 +++++++ build_image | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/cros_make_image_bootable b/bin/cros_make_image_bootable index 6a661623dc..1c2bccbd03 100755 --- a/bin/cros_make_image_bootable +++ b/bin/cros_make_image_bootable @@ -125,6 +125,9 @@ DEFINE_boolean crosbug12352_arm_kernel_signing ${FLAGS_TRUE} \ # TODO(sosa): Remove once known images no longer use this in their config. DEFINE_string arm_extra_bootargs "" "DEPRECATED FLAG. Do not use." +DEFINE_boolean force_developer_mode ${FLAGS_FALSE} \ + "Add cros_debug to boot args." + # Parse the boot.desc and any overrides eval set -- "${BOOT_DESC} ${FLAG_OVERRIDES}" FLAGS "${@}" || exit 1 @@ -188,6 +191,10 @@ make_image_bootable() { use_dev_keys="--use_dev_keys" fi + if [ ${FLAGS_force_developer_mode} -eq ${FLAGS_TRUE} ]; then + FLAGS_boot_args="${FLAGS_boot_args} cros_debug" + fi + # Builds the kernel partition image. The temporary files are kept around # so that we can perform a load_kernel_test later on the final image. ${SCRIPTS_DIR}/build_kernel_image.sh \ diff --git a/build_image b/build_image index 70e8e6c3ab..237232fc77 100755 --- a/build_image +++ b/build_image @@ -487,6 +487,9 @@ update_dev_packages() { sudo /sbin/ldconfig -r "${ROOT_FS_DIR}" # Mark the image as a developer image (input to chromeos_startup). + # TODO(arkaitzr): Remove this file when applications no longer rely on it + # (crosbug.com/16648). The preferred way of determining developer mode status + # is via crossystem cros_debug?1 (checks boot args for "cros_debug"). sudo mkdir -p "${ROOT_FS_DIR}/root" sudo touch "${ROOT_FS_DIR}/root/.dev_mode" @@ -938,7 +941,8 @@ if [ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ] ; then update_dev_packages ${DEVELOPER_IMAGE_NAME} ${SCRIPTS_DIR}/bin/cros_make_image_bootable "${OUTPUT_DIR}" \ "${DEVELOPER_IMAGE_NAME}" \ - ${crosbug12352_flag} + ${crosbug12352_flag} \ + --force_developer_mode fi # Create a test or factory test image if desired