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 <sosa@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Tested-by: Arkaitz Ruiz Alvarez <arkaitzr@chromium.org>
This commit is contained in:
Arkaitz Ruiz Alvarez 2011-07-08 12:21:22 -07:00
parent 049c0520c5
commit e2f33fb50a

View File

@ -88,27 +88,37 @@ if ! type -p update_x86_bootloaders; then
dm_table=$(echo "$kernel_cmdline" | sed -s 's/.*dm="\([^"]*\)".*/\1/') dm_table=$(echo "$kernel_cmdline" | sed -s 's/.*dm="\([^"]*\)".*/\1/')
fi 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 # Rewrite grub table
grub_dm_table_a=${dm_table//${old_root}/\/dev\/\$linuxpartA} grub_dm_table_a=${dm_table//${old_root}/\/dev\/\$linuxpartA}
grub_dm_table_b=${dm_table//${old_root}/\/dev\/\$linuxpartB} grub_dm_table_b=${dm_table//${old_root}/\/dev\/\$linuxpartB}
sed -e "s|DMTABLEA|${grub_dm_table_a}|g" \ sed -e "s|DMTABLEA|${grub_dm_table_a}|g" \
-e "s|DMTABLEB|${grub_dm_table_b}|g" \ -e "s|DMTABLEB|${grub_dm_table_b}|g" \
-e "s|cros_legacy|${cros_flags}|g" \
"${template_dir}"/efi/boot/grub.cfg | "${template_dir}"/efi/boot/grub.cfg |
sudo dd of="${esp_fs_dir}"/efi/boot/grub.cfg sudo dd of="${esp_fs_dir}"/efi/boot/grub.cfg
# Rewrite syslinux DM_TABLE # Rewrite syslinux DM_TABLE
syslinux_dm_table_usb=${dm_table//${old_root}/${FLAGS_usb_disk}} syslinux_dm_table_usb=${dm_table//${old_root}/${FLAGS_usb_disk}}
sed -e "s|DMTABLEA|${syslinux_dm_table_usb}|g" \ sed -e "s|DMTABLEA|${syslinux_dm_table_usb}|g" \
-e "s|cros_legacy|${cros_flags}|g" \
"${template_dir}"/syslinux/usb.A.cfg | "${template_dir}"/syslinux/usb.A.cfg |
sudo dd of="${esp_fs_dir}"/syslinux/usb.A.cfg sudo dd of="${esp_fs_dir}"/syslinux/usb.A.cfg
syslinux_dm_table_a=${dm_table//${old_root}/HDROOTA} syslinux_dm_table_a=${dm_table//${old_root}/HDROOTA}
sed -e "s|DMTABLEA|${syslinux_dm_table_a}|g" \ sed -e "s|DMTABLEA|${syslinux_dm_table_a}|g" \
-e "s|cros_legacy|${cros_flags}|g" \
"${template_dir}"/syslinux/root.A.cfg | "${template_dir}"/syslinux/root.A.cfg |
sudo dd of="${esp_fs_dir}"/syslinux/root.A.cfg sudo dd of="${esp_fs_dir}"/syslinux/root.A.cfg
syslinux_dm_table_b=${dm_table//${old_root}/HDROOTB} syslinux_dm_table_b=${dm_table//${old_root}/HDROOTB}
sed -e "s|DMTABLEB|${syslinux_dm_table_b}|g" \ sed -e "s|DMTABLEB|${syslinux_dm_table_b}|g" \
-e "s|cros_legacy|${cros_flags}|g" \
"${template_dir}"/syslinux/root.B.cfg | "${template_dir}"/syslinux/root.B.cfg |
sudo dd of="${esp_fs_dir}"/syslinux/root.B.cfg sudo dd of="${esp_fs_dir}"/syslinux/root.B.cfg