From e2f33fb50a10f2c3c24ada2104fc0117d32017c9 Mon Sep 17 00:00:00 2001 From: Arkaitz Ruiz Alvarez Date: Fri, 8 Jul 2011 12:21:22 -0700 Subject: [PATCH] Fix cros_debug not being passed to VMs When building a VM or USB-run image the boot args come from a preset template which does not include the cros_debug flag. If this flag is present we maintain it in this new boot configuration. The way we do it is by replacing the string "cros_legacy" (which originates with the template) with "cros_legacy cros_debug". TEST=Build VM from a developer and test image and check grep "cros_debug" /proc/cmdline. BUG=chromium-os:17392 Change-Id: I2cb578274cf9596bf863ec835b1c921fff252a04 Reviewed-on: http://gerrit.chromium.org/gerrit/3808 Reviewed-by: Chris Sosa Reviewed-by: Gaurav Shah Tested-by: Arkaitz Ruiz Alvarez --- update_bootloaders.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/update_bootloaders.sh b/update_bootloaders.sh index de9ccdfe6b..5cede9deba 100755 --- a/update_bootloaders.sh +++ b/update_bootloaders.sh @@ -88,27 +88,37 @@ if ! type -p update_x86_bootloaders; then dm_table=$(echo "$kernel_cmdline" | sed -s 's/.*dm="\([^"]*\)".*/\1/') fi + # Maintain cros_debug flag in developer and test images. + cros_flags="cros_legacy" + if echo "$kernel_cmdline" | grep -q 'cros_debug'; then + cros_flags="cros_legacy cros_debug" + fi + # Rewrite grub table grub_dm_table_a=${dm_table//${old_root}/\/dev\/\$linuxpartA} grub_dm_table_b=${dm_table//${old_root}/\/dev\/\$linuxpartB} sed -e "s|DMTABLEA|${grub_dm_table_a}|g" \ -e "s|DMTABLEB|${grub_dm_table_b}|g" \ + -e "s|cros_legacy|${cros_flags}|g" \ "${template_dir}"/efi/boot/grub.cfg | sudo dd of="${esp_fs_dir}"/efi/boot/grub.cfg # Rewrite syslinux DM_TABLE syslinux_dm_table_usb=${dm_table//${old_root}/${FLAGS_usb_disk}} sed -e "s|DMTABLEA|${syslinux_dm_table_usb}|g" \ + -e "s|cros_legacy|${cros_flags}|g" \ "${template_dir}"/syslinux/usb.A.cfg | sudo dd of="${esp_fs_dir}"/syslinux/usb.A.cfg syslinux_dm_table_a=${dm_table//${old_root}/HDROOTA} sed -e "s|DMTABLEA|${syslinux_dm_table_a}|g" \ + -e "s|cros_legacy|${cros_flags}|g" \ "${template_dir}"/syslinux/root.A.cfg | sudo dd of="${esp_fs_dir}"/syslinux/root.A.cfg syslinux_dm_table_b=${dm_table//${old_root}/HDROOTB} sed -e "s|DMTABLEB|${syslinux_dm_table_b}|g" \ + -e "s|cros_legacy|${cros_flags}|g" \ "${template_dir}"/syslinux/root.B.cfg | sudo dd of="${esp_fs_dir}"/syslinux/root.B.cfg