cros_generate_update_payload: Get rid of the --patch_kernel option.

The kernel will have the right vblock on it by default, so patching the vblock
is basically a no-op. All call sites have been modified not to use that option,
so it should be safe to remove.

CQ-DEPEND=CL:213988
CQ-DEPEND=CL:216573
CQ-DEPEND=CL:216579
BUG=chromium:403031
TEST=Ran a butterfly-paladin tryjob with --hwtest.

Change-Id: Ide1f6de837004691b2f7e571172791cdfd3b9b2f
Reviewed-on: https://chromium-review.googlesource.com/216612
Reviewed-by: Yu-Ju Hong <yjhong@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
diff --git a/host/cros_generate_update_payload b/host/cros_generate_update_payload
index 91d96d8..a66fd2d 100755
--- a/host/cros_generate_update_payload
+++ b/host/cros_generate_update_payload
@@ -156,23 +156,6 @@
       skip="$offset" 2>/dev/null
 }
 
-patch_kernel() {
-  local IMAGE="$1"
-  local KERN_FILE="$2"
-
-  echo "Patching kernel" $KERN_FILE
-  echo "   into" $IMAGE
-  # Keep `local` decl split from assignment so return code is checked.
-  local offset
-  offset=$(partoffset "${IMAGE}" 1)
-  : $(( offset *= 512 ))
-  STATE_MNT=$(mktemp -d --tmpdir="${FLAGS_work_dir}" state.XXXXXX)
-  sudo mount -o ro,loop,offset=$offset "$IMAGE" "$STATE_MNT"
-  dd if="$STATE_MNT"/vmlinuz_hd.vblock of="$KERN_FILE" conv=notrunc 2>/dev/null
-  umount_and_rmdir "$STATE_MNT"
-  STATE_MNT=""
-}
-
 extract_kern_root() {
   local bin_file="$1"
   local kern_out="$2"
@@ -186,9 +169,6 @@
   fi
 
   extract_partition_to_temp_file "$bin_file" 4 "$kern_out" > /dev/null
-  if [ "$FLAGS_patch_kernel" -eq "$FLAGS_TRUE" ]; then
-    patch_kernel "$bin_file" "$kern_out"
-  fi
   extract_partition_to_temp_file "$bin_file" 3 "$root_out" > /dev/null
 }
 
@@ -197,8 +177,6 @@
  a delta update."
 DEFINE_string output "" "Output file"
 DEFINE_boolean outside_chroot "$FLAGS_FALSE" "Running outside of chroot."
-DEFINE_boolean patch_kernel "$FLAGS_FALSE" "Whether or not to patch the kernel \
-with the patch from the stateful partition (default: false)"
 DEFINE_string private_key "" "Path to private key in .pem format."
 DEFINE_string out_metadata_hash_file "" "Path to output metadata hash file."
 DEFINE_boolean extract "$FLAGS_FALSE" "If set, extract old/new kernel/rootfs \
@@ -287,9 +265,6 @@
   if [ "$FLAGS_full_kernel" -eq "$FLAGS_FALSE" ]; then
     SRC_KERNEL=$(extract_partition_to_temp_file "$FLAGS_src_image" 4 \
                  "$FLAGS_src_kern_path")
-    if [ "$FLAGS_patch_kernel" -eq "$FLAGS_TRUE" ]; then
-      patch_kernel "$FLAGS_src_image" "$SRC_KERNEL"
-    fi
     echo md5sum of src kernel:
     md5sum "$SRC_KERNEL"
   else
@@ -304,9 +279,6 @@
 
 DST_KERNEL=$(extract_partition_to_temp_file "$FLAGS_image" 4 \
              "$FLAGS_kern_path")
-if [ "$FLAGS_patch_kernel" -eq "$FLAGS_TRUE" ]; then
-  patch_kernel "$FLAGS_image" "$DST_KERNEL"
-fi
 DST_ROOT=$(extract_partition_to_temp_file "$FLAGS_image" 3 \
            "$FLAGS_root_path")