memento_updater: Remove kernel post processing.

The "Release" kernel should now have a valid vblock in it without having to
copy over the one in the stateful partition which is being deprecated.

BUG=chromium:403031
TEST=emerge-lumpy memento_softwareupdate

Change-Id: I974b828e79393d765b6dd76778a5e35dadaa63db
Reviewed-on: https://chromium-review.googlesource.com/213440
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
diff --git a/src/recovery_installer.cc b/src/recovery_installer.cc
index 69468cd..477b766 100644
--- a/src/recovery_installer.cc
+++ b/src/recovery_installer.cc
@@ -59,7 +59,6 @@
   //TODO(chunyen): Replace these with memento_common.h
   const int kFactoryKernelPartition = 2;
   const int kFactoryPartition = 3;
-  const int kReleaseKernelPartition = 4;
   const int kReleasePartition = 5;
 
   // For recovery image, real kernel is at partition 4 and rootfs is at
@@ -79,10 +78,6 @@
       DiskImageInstaller::InstallDevice(channel_id, device_path,
                                        kernel_device_path);
   }
-
-  if (channel_id == kReleaseKernelPartition) {
-    PostprocessKernel(kernel_device_path);
-  }
 }
 
 
@@ -152,45 +147,4 @@
   error_exit("Fail downloading release image.");
 }
 
-void RecoveryInstaller::PostprocessKernel(const string& kernel_device) {
-  const string kVmlinuzHdFile="vmlinuz_hd.vblock";
-  // TODO(chunyen): Replace this with the declaration in memento_common.h
-  const int kStatefulPartition = 1;
-
-  // Since we need to mount directly from image by syscall,
-  // mount handler is not used here.
-  char mount_template[] = "/tmp/image_XXXXXX";
-  string image_mount(mkdtemp(mount_template));
-  image_mount += "/";
-
-  // Find of the location of stateful partition
-  int begin_sector = GetImageOffsetInBlock(image_path_, kStatefulPartition);
-  int num_sectors = GetImageSizeInBlock(image_path_, kStatefulPartition);
-
-  // Mount stateful partition directly from image
-  stringstream command;
-  command << "mount -o loop,offset=" << (uint64_t) begin_sector * kBlockSize <<
-             ",sizelimit=" << (uint64_t) num_sectors * kBlockSize << ",ro" <<
-             " " << image_path_ << " " << image_mount;
-  cerr << command.str() << endl;
-  if (system(command.str().c_str()) != 0) {
-    error_exit("Cannot mount stateful partition from image");
-  }
-
-  // Copy kVmlinuzHdFile to kernel partition
-  command.str(string());
-  command << "dd if=" << image_mount << kVmlinuzHdFile <<
-             " of=" << kernel_device << " bs=512 conv=notrunc";
-  if (system(command.str().c_str()) != 0) {
-    error_exit("Cannot update kernel with " + kVmlinuzHdFile);
-  }
-
-  if (system(("umount " + image_mount).c_str()) != 0) {
-    error_exit("Cannot umount " + image_mount);
-  }
-  if (remove(image_mount.c_str()) != 0){
-    error_exit("Cannot remove " + image_mount);
-  }
-}
-
 }  // namespace chromeos_memento_updater
diff --git a/src/recovery_installer.h b/src/recovery_installer.h
index b77f55a..1066ef7 100644
--- a/src/recovery_installer.h
+++ b/src/recovery_installer.h
@@ -36,7 +36,6 @@
                     std::string& value);
 
   void DownloadImageFromServer();
-  void PostprocessKernel(const std::string& kernel_device_path);
   const static std::string kConfigUrl;
   const static std::string kConfigPath;
   const static std::string kZipImagePath;