From 775bc8e3c182178fe1db0b4f696625db4761e1fe Mon Sep 17 00:00:00 2001 From: Jonathan Kliegman Date: Tue, 14 Aug 2012 12:30:49 -0400 Subject: [PATCH] Warn if kernel build directory is fresher than installed image update_kernel will silently run and report no errors if the user runs cros_workon_make instead of cros_workon_make --install. As there are times where the 'uname -a' output doesn't change between builds (modifying modules or devicetree entries), its not always obvious that the most recently modified kernel wasn't what was deployed. This doesn't catch the case where the user first cros_workon's a package but hasn't done an install (either through emerge or cros_workon_make). BUG=None TEST=While cros_workon: cros_workon_make chromeos-kernel - observe update_kernel warns cros_workon_make --install chromeos-kernel - no warning cros_workon stop chromeos-kernel emerge-${BOARD} -g chromeos-kernel - no warning emerge-${BOARD} chromeos-kernel - no warning Change-Id: I25caa44dc82e00c9bf8703b72d09f76df3db1251 Reviewed-on: https://gerrit.chromium.org/gerrit/30214 Reviewed-by: Olof Johansson Commit-Ready: Jon Kliegman Tested-by: Jon Kliegman --- update_kernel.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/update_kernel.sh b/update_kernel.sh index e0b428c1e4..7f48e5d63a 100755 --- a/update_kernel.sh +++ b/update_kernel.sh @@ -95,6 +95,16 @@ copy_kernelimage() { remote_sh dd if=/tmp/new_kern.bin of="${FLAGS_partition}" } +check_kernelbuildtime() { + local version=$(readlink "/build/${FLAGS_board}/boot/vmlinuz" | cut -d- -f2-) + local build_dir="/build/${FLAGS_board}/lib/modules/${version}/build" + if [ "${build_dir}/Makefile" -nt "/build/${FLAGS_board}/boot/vmlinuz" ]; then + warn "Your build directory has been built more recently than" + warn "the installed kernel being updated to. Did you forget to" + warn "run 'cros_workon_make chromeos-kernel --install'?" + fi +} + main() { trap cleanup EXIT @@ -114,6 +124,8 @@ main() { old_kernel="${REMOTE_OUT}" + check_kernelbuildtime + make_kernelimage if [[ ${REMOTE_VERITY} -eq ${FLAGS_FALSE} ]]; then