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 <arkaitzr@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
This commit is contained in:
Arkaitz Ruiz Alvarez 2011-06-24 11:03:18 -07:00
parent ffd0ca6f36
commit 26d68ecaa5
2 changed files with 12 additions and 1 deletions

View File

@ -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. # TODO(sosa): Remove once known images no longer use this in their config.
DEFINE_string arm_extra_bootargs "" "DEPRECATED FLAG. Do not use." 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 # Parse the boot.desc and any overrides
eval set -- "${BOOT_DESC} ${FLAG_OVERRIDES}" eval set -- "${BOOT_DESC} ${FLAG_OVERRIDES}"
FLAGS "${@}" || exit 1 FLAGS "${@}" || exit 1
@ -188,6 +191,10 @@ make_image_bootable() {
use_dev_keys="--use_dev_keys" use_dev_keys="--use_dev_keys"
fi 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 # 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. # so that we can perform a load_kernel_test later on the final image.
${SCRIPTS_DIR}/build_kernel_image.sh \ ${SCRIPTS_DIR}/build_kernel_image.sh \

View File

@ -487,6 +487,9 @@ update_dev_packages() {
sudo /sbin/ldconfig -r "${ROOT_FS_DIR}" sudo /sbin/ldconfig -r "${ROOT_FS_DIR}"
# Mark the image as a developer image (input to chromeos_startup). # 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 mkdir -p "${ROOT_FS_DIR}/root"
sudo touch "${ROOT_FS_DIR}/root/.dev_mode" 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} update_dev_packages ${DEVELOPER_IMAGE_NAME}
${SCRIPTS_DIR}/bin/cros_make_image_bootable "${OUTPUT_DIR}" \ ${SCRIPTS_DIR}/bin/cros_make_image_bootable "${OUTPUT_DIR}" \
"${DEVELOPER_IMAGE_NAME}" \ "${DEVELOPER_IMAGE_NAME}" \
${crosbug12352_flag} ${crosbug12352_flag} \
--force_developer_mode
fi fi
# Create a test or factory test image if desired # Create a test or factory test image if desired