update_kernel: Remove multiple cros_secure from remote_bootargs.
update_kernel.sh get remote_bootargs from /proc/cmdline, which includes
the 'cros_secure' prepended by depthcharge. This cause the cmdline to
contain multiple instances of 'cros_secure' after multiple run of
`update_kernel.sh --remote_bootargs`, and eventually cause kernel to
refuse to boot because of too long cmdline.
Fix this by removing continuous repeating cros_secure flag from
remote_bootargs in update_kernel.sh.
BUG=chromium:907772
TEST=manually, run `update_kernel.sh --remote_bootargs` multiple times,
and see that `cat /proc/cmdline` on DUT still have only two
cros_secure.
Change-Id: I308043648547cbb5ed6006cc436f56068848ab6a
Reviewed-on: https://chromium-review.googlesource.com/1351176
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Pi-Hsun Shih <pihsun@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/update_kernel.sh b/update_kernel.sh
index 9f7e408..da2f604 100755
--- a/update_kernel.sh
+++ b/update_kernel.sh
@@ -105,7 +105,9 @@
if [ ${FLAGS_remote_bootargs} -eq ${FLAGS_TRUE} ] ; then
info "Using remote bootargs"
- remote_sh cat /proc/cmdline && echo "${REMOTE_OUT}"
+ remote_sh cat /proc/cmdline
+ # Remove multiple instances of cros_secure, https://crbug.com/907772
+ echo "${REMOTE_OUT}" | sed -E 's/\b(cros_secure )+/cros_secure /g'
else
if [ -n "${FLAGS_rootoff}" ]; then
sed "s/PARTNROFF=1/PARTNROFF=${FLAGS_rootoff}/" "${local_config}"