From 7d7d2ef0f0d9bf606333d0d5d8bf1ac8af4461f4 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Tue, 18 Oct 2011 13:12:12 -0700 Subject: [PATCH] update_kernel: update the syslinux partition too The KVM examples boot from the syslinux partiton, so update the kernel that lives there too. BUG=None TEST=correctly updated a kernel in a VM Change-Id: I1526064f85d6c9233696590e9e746bc91bcd6d2a Signed-off-by: Kees Cook Reviewed-on: http://gerrit.chromium.org/gerrit/10239 Reviewed-by: Mandeep Singh Baines --- update_kernel.sh | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/update_kernel.sh b/update_kernel.sh index ca3561354b..ace8c0dec6 100755 --- a/update_kernel.sh +++ b/update_kernel.sh @@ -138,6 +138,7 @@ function main() { if [[ ${REMOTE_VERITY} -eq ${FLAGS_FALSE} ]]; then tar -C /build/"${FLAGS_board}"/lib/modules -cjf /tmp/new_modules.tar . tar -C /build/"${FLAGS_board}"/lib/firmware -cjf /tmp/new_firmware.tar . + tar -C /build/"${FLAGS_board}"/boot -cjf /tmp/new_boot.tar . remote_sh mount -o remount,rw / echo "copying modules" @@ -149,9 +150,33 @@ function main() { remote_cp_to /tmp/new_firmware.tar /tmp/ remote_sh tar -C /lib/firmware -xjf /tmp/new_firmware.tar + + echo "copying kernel" + remote_cp_to /tmp/new_boot.tar /tmp/ + + remote_sh tar -C /boot -xjf /tmp/new_boot.tar + + # ARM does not have the syslinux directory, so skip it when the + # partition or the syslinux vmlinuz target is missing. + echo "updating syslinux kernel" + remote_sh grep $(echo ${FLAGS_device}12 | cut -d/ -f3) /proc/partitions + if [ $(echo "$REMOTE_OUT" | wc -l) -eq 1 ]; then + remote_sh mkdir -p /tmp/12 + remote_sh mount ${FLAGS_device}12 /tmp/12 + + if [ "$FLAGS_partition" = "${FLAGS_device}2" ]; then + target="/tmp/12/syslinux/vmlinuz.A" + else + target="/tmp/12/syslinux/vmlinuz.B" + fi + remote_sh "test ! -f $target || cp /boot/vmlinuz $target" + + remote_sh umount /tmp/12 + remote_sh rmdir /tmp/12 + fi fi - echo "copying kernel" + echo "copying kernel image" copy_kernelimage