chromeos-installer: delete unused files

BUG=chromium-os:4873
TEST=none

Change-Id: I335bea0b25e9cbbe83e4e7d55832002b0545fe86

Review URL: http://codereview.chromium.org/6413012
diff --git a/bin/cros_build_gpt.sh b/bin/cros_build_gpt.sh
deleted file mode 100755
index 3d6f5bc..0000000
--- a/bin/cros_build_gpt.sh
+++ /dev/null
@@ -1,167 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# Load common constants.  This should be the first executable line.
-# The path to common.sh should be relative to your script's location.
-. "/usr/lib/crosutils/common.sh"
-
-# Load functions and constants for chromeos-install
-. "/usr/lib/installer/chromeos-common.sh"
-
-# Script must be run inside the chroot.
-restart_in_chroot_if_needed $*
-
-get_default_board
-
-# Flags.
-DEFINE_string arch "" \
-  "The target architecture (\"arm\" or \"x86\")."
-DEFINE_string board "$DEFAULT_BOARD" \
-  "The board to build an image for."
-DEFINE_string arm_extra_bootargs "" \
-  "Additional command line options to pass to the ARM kernel."
-DEFINE_integer rootfs_partition_size 1024 \
-  "rootfs parition size in MBs."
-
-# Usage.
-FLAGS_HELP=$(cat <<EOF
-
-Usage: $(basename $0) [flags] IMAGEDIR OUTDEV
-
-This takes the image components in IMAGEDIR and creates a bootable,
-GPT-formatted image in OUTDEV. OUTDEV can be a file or block device.
-
-EOF
-)
-
-# Parse command line.
-FLAGS "$@" || exit 1
-eval set -- "${FLAGS_ARGV}"
-
-if [[ -z "$FLAGS_board" ]] ; then
-  error "--board is required."
-  exit 1
-fi
-
-if [[ -z "$1" || -z "$2" ]] ; then
-  flags_help
-  exit 1
-fi
-IMAGEDIR="$1"
-OUTDEV="$2"
-
-if [[ -n "$FLAGS_arch" ]]; then
-  ARCH=${FLAGS_arch}
-else
-  # Figure out ARCH from the given toolchain.
-  # TODO: Move to common.sh as a function after scripts are switched over.
-  TC_ARCH=$(echo "$CHOST" | awk -F'-' '{ print $1 }')
-  case "$TC_ARCH" in
-    arm*)
-      ARCH="arm"
-      ;;
-    *86)
-      ARCH="x86"
-      ;;
-    *)
-      error "Unable to determine ARCH from toolchain: $CHOST"
-      exit 1
-  esac
-fi
-
-# Only now can we die on error.  shflags functions leak non-zero error codes,
-# so will die prematurely if 'set -e' is specified before now.
-set -e
-# Die on uninitialized variables.
-set -u
-
-# Check for missing parts.
-ROOTFS_IMG="${IMAGEDIR}/rootfs.image"
-if [[ ! -s ${ROOTFS_IMG} ]]; then
-  error "Can't find ${ROOTFS_IMG}"
-  exit 1
-fi
-
-KERNEL_IMG="${IMAGEDIR}/vmlinuz.image"
-if [[ ! -s ${KERNEL_IMG} ]]; then
-  error "Can't find ${KERNEL_IMG}"
-  exit 1
-fi
-
-STATEFUL_IMG="${IMAGEDIR}/stateful_partition.image"
-if [ ! -s ${STATEFUL_IMG} ]; then
-  error "Can't find ${STATEFUL_IMG}"
-  exit 1
-fi
-
-OEM_IMG="${IMAGEDIR}/partner_partition.image"
-if [[ ! -s ${OEM_IMG} ]]; then
-  error "Can't find ${OEM_IMG}"
-  exit 1
-fi
-
-ESP_IMG="${IMAGEDIR}/esp.image"
-if [ ! -s ${ESP_IMG} ]; then
-  error "Can't find ${ESP_IMG}"
-  exit 1
-fi
-
-# We'll need some code to put in the PMBR, for booting on legacy BIOS. Some ARM
-# systems will use a U-Boot script temporarily, but it goes in the same place.
-if [[ "$ARCH" = "arm" ]]; then
-  PMBRCODE=/dev/zero
-else
-  PMBRCODE=$(readlink -f /usr/share/syslinux/gptmbr.bin)
-fi
-
-# Create the GPT. This has the side-effect of setting some global vars
-# describing the partition table entries (see the comments in the source).
-install_gpt $OUTDEV $(numsectors $ROOTFS_IMG) $(numsectors $STATEFUL_IMG) \
-    $PMBRCODE $(numsectors $ESP_IMG) false $FLAGS_rootfs_partition_size
-
-if [[ "$ARCH" = "arm" ]]; then
-  # assume /dev/mmcblk1. we could not get this from ${OUTDEV}
-  DEVICE=1
-  MBR_SCRIPT_UIMG=$(make_arm_mbr \
-    ${START_KERN_A} \
-    ${NUM_KERN_SECTORS} \
-    ${DEVICE} \
-    "${FLAGS_arm_extra_bootargs}")
-  sudo dd bs=1 count=`stat --printf="%s" ${MBR_SCRIPT_UIMG}` \
-     if="$MBR_SCRIPT_UIMG" of=${OUTDEV} conv=notrunc
-fi
-
-# Emit helpful scripts for testers, etc.
-/usr/bin/cros_emit_gpt_scripts.sh "${OUTDEV}" "${IMAGEDIR}"
-
-sudo=
-if [ ! -w "$OUTDEV" ] ; then
-  # use sudo when writing to a block device.
-  sudo=sudo
-fi
-
-# Now populate the partitions.
-echo "Copying stateful partition..."
-$sudo dd if=${STATEFUL_IMG} of=${OUTDEV} conv=notrunc bs=512 \
-    seek=${START_STATEFUL}
-
-echo "Copying OEM partition..."
-$sudo dd if=${OEM_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_OEM}
-
-echo "Copying kernel..."
-$sudo dd if=${KERNEL_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_KERN_A}
-
-echo "Copying rootfs..."
-$sudo dd if=${ROOTFS_IMG} of=${OUTDEV} conv=notrunc bs=512 \
-    seek=${START_ROOTFS_A}
-
-echo "Copying EFI system partition..."
-$sudo dd if=${ESP_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ESP}
-
-# Clean up temporary files.
-if [[ -n "${MBR_IMG:-}" ]]; then
-  rm "${MBR_IMG}"
-fi
diff --git a/bin/cros_build_kernel_image.sh b/bin/cros_build_kernel_image.sh
deleted file mode 100755
index d9bbba1..0000000
--- a/bin/cros_build_kernel_image.sh
+++ /dev/null
@@ -1,209 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Helper script that generates the signed kernel image
-
-. "/usr/lib/crosutils/common.sh"
-
-get_default_board
-
-# Flags.
-DEFINE_string arch "x86" \
-  "The boot architecture: arm or x86. (Default: x86)"
-DEFINE_string to "/tmp/vmlinuz.image" \
-  "The path to the kernel image to be created. (Default: /tmp/vmlinuz.image)"
-DEFINE_string hd_vblock "/tmp/vmlinuz_hd.vblock" \
-  "The path to the installed kernel's vblock (Default: /tmp/vmlinuz_hd.vblock)"
-DEFINE_string vmlinuz "vmlinuz" \
-  "The path to the kernel (Default: vmlinuz)"
-DEFINE_string working_dir "/tmp/vmlinuz.working" \
-  "Working directory for in-progress files. (Default: /tmp/vmlinuz.working)"
-DEFINE_boolean keep_work ${FLAGS_FALSE} \
-  "Keep temporary files (*.keyblock, *.vbpubk). (Default: false)"
-DEFINE_string keys_dir "${SRC_ROOT}/platform/vboot_reference/tests/testkeys" \
-  "Directory with the RSA signing keys. (Defaults to test keys)"
-DEFINE_boolean use_dev_keys ${FLAGS_FALSE} \
-  "Use developer keys for signing. (Default: false)"
-# Note, to enable verified boot, the caller would manually pass:
-# --boot_args='dm="... /dev/sd%D%P /dev/sd%D%P ..." \
-# --root=/dev/dm-0
-DEFINE_string boot_args "noinitrd" \
-  "Additional boot arguments to pass to the commandline (Default: noinitrd)"
-DEFINE_string root "/dev/sd%D%P" \
-  "Expected device root (Default: root=/dev/sd%D%P)"
-
-# If provided, will automatically add verified boot arguments.
-DEFINE_string rootfs_image "" \
-  "Optional path to the rootfs device or image.(Default: \"\")"
-DEFINE_string rootfs_hash "" \
-  "Optional path to output the rootfs hash to. (Default: \"\")"
-DEFINE_integer verity_error_behavior 2 \
-  "Verified boot error behavior [0: I/O errors, 1: reboot, 2: nothing] \
-(Default: 2)"
-DEFINE_integer verity_tree_depth 1 \
-  "Optional Verified boot hash tree depth. (Default: 1)"
-DEFINE_integer verity_max_ios 1024 \
-  "Optional number of outstanding I/O operations. (Default: 1024)"
-DEFINE_string verity_hash_alg "sha1" \
-  "Cryptographic hash algorithm used for dm-verity. (Default: sha1)"
-
-# Parse flags
-FLAGS "$@" || exit 1
-eval set -- "${FLAGS_ARGV}"
-
-# Die on error
-set -e
-
-verity_args=
-# Even with a rootfs_image, root= is not changed unless specified.
-if [[ -n "${FLAGS_rootfs_image}" && -n "${FLAGS_rootfs_hash}" ]]; then
-  # Gets the number of blocks. 4096 byte blocks _are_ expected.
-  root_fs_blocks=$(sudo dumpe2fs "${FLAGS_rootfs_image}" 2> /dev/null |
-                   grep "Block count" |
-                   tr -d ' ' |
-                   cut -f2 -d:)
-  root_fs_block_sz=$(sudo dumpe2fs "${FLAGS_rootfs_image}" 2> /dev/null |
-                     grep "Block size" |
-                     tr -d ' ' |
-                     cut -f2 -d:)
-  info "rootfs is ${root_fs_blocks} blocks of ${root_fs_block_sz} bytes"
-  if [[ ${root_fs_block_sz} -ne 4096 ]]; then
-    error "Root file system blocks are not 4k!"
-  fi
-
-  info "Generating root fs hash tree."
-  # Runs as sudo in case the image is a block device.
-  table=$(sudo verity create ${FLAGS_verity_tree_depth} \
-                        ${FLAGS_verity_hash_alg} \
-                        ${FLAGS_rootfs_image} \
-                        ${root_fs_blocks} \
-                        ${FLAGS_rootfs_hash})
-  if [[ -f "${FLAGS_rootfs_hash}" ]]; then
-    sudo chmod a+r "${FLAGS_rootfs_hash}"
-  fi
-  # Don't claim the root device unless the root= flag is pointed to
-  # the verified boot device.  Doing so will claim /dev/sdDP out from
-  # under the system.
-  if [[ ${FLAGS_root} = "/dev/dm-0" ]]; then
-    table=${table//HASH_DEV//dev/sd%D%P}
-    table=${table//ROOT_DEV//dev/sd%D%P}
-  fi
-  verity_args="dm=\"vroot none ro,${table}\""
-  info "dm-verity configuration: ${verity_args}"
-fi
-
-mkdir -p "${FLAGS_working_dir}"
-cat <<EOF > "${FLAGS_working_dir}/boot.config"
-root=${FLAGS_root}
-dm_verity.error_behavior=${FLAGS_verity_error_behavior}
-dm_verity.max_bios=${FLAGS_verity_max_ios}
-${verity_args}
-${FLAGS_boot_args}
-EOF
-
-WORK="${WORK} ${FLAGS_working_dir}/boot.config"
-info "Emitted cross-platform boot params to ${FLAGS_working_dir}/boot.config"
-
-# FIXME: At the moment, we're working on signed images for x86 only. ARM will
-# support this before shipping, but at the moment they don't.
-if [[ "${FLAGS_arch}" = "x86" ]]; then
-
-  # Legacy BIOS will use the kernel in the rootfs (via syslinux), as will
-  # standard EFI BIOS (via grub, from the EFI System Partition). Chrome OS
-  # BIOS will use a separate signed kernel partition, which we'll create now.
-  # FIXME: remove serial output, debugging messages.
-  mkdir -p ${FLAGS_working_dir}
-  cat <<EOF | cat - "${FLAGS_working_dir}/boot.config" \
-    > "${FLAGS_working_dir}/config.txt"
-earlyprintk=serial,ttyS0,115200
-console=ttyS0,115200
-init=/sbin/init
-add_efi_memmap
-boot=local
-rootwait
-ro
-noresume
-noswap
-i915.modeset=1
-loglevel=7
-cros_secure
-kern_guid=%U
-EOF
-  WORK="${WORK} ${FLAGS_working_dir}/config.txt"
-
-  # We sign the image with the recovery_key, because this is what goes onto the
-  # USB key. We can only boot from the USB drive in recovery mode.
-  # For dev install shim, we need to use the installer keyblock instead of
-  # the recovery keyblock because of the difference in flags.
-  if [ ${FLAGS_use_dev_keys} -eq ${FLAGS_TRUE} ]; then
-    USB_KEYBLOCK=installer_kernel.keyblock
-    info "DEBUG: use dev install signing key"
-  else
-    USB_KEYBLOCK=recovery_kernel.keyblock
-    info "DEBUG: use recovery signing key"
-  fi
-
-  # Create and sign the kernel blob
-  vbutil_kernel \
-    --pack "${FLAGS_to}" \
-    --keyblock "${FLAGS_keys_dir}/${USB_KEYBLOCK}" \
-    --signprivate "${FLAGS_keys_dir}/recovery_kernel_data_key.vbprivk" \
-    --version 1 \
-    --config "${FLAGS_working_dir}/config.txt" \
-    --bootloader /lib64/bootstub/bootstub.efi \
-    --vmlinuz "${FLAGS_vmlinuz}"
-
-  # And verify it.
-  vbutil_kernel \
-    --verify "${FLAGS_to}" \
-    --signpubkey "${FLAGS_keys_dir}/recovery_key.vbpubk"
-
-
-  # Now we re-sign the same image using the normal keys. This is the kernel
-  # image that is put on the hard disk by the installer. Note: To save space on
-  # the USB image, we're only emitting the new verfication block, and the
-  # installer just replaces that part of the hard disk's kernel partition.
-  vbutil_kernel \
-    --repack "${FLAGS_hd_vblock}" \
-    --vblockonly \
-    --keyblock "${FLAGS_keys_dir}/kernel.keyblock" \
-    --signprivate "${FLAGS_keys_dir}/kernel_data_key.vbprivk" \
-    --oldblob "${FLAGS_to}"
-
-
-  # To verify it, we have to replace the vblock from the original image.
-  tempfile=$(mktemp)
-  trap "rm -f $tempfile" EXIT
-  cat "${FLAGS_hd_vblock}" > $tempfile
-  dd if="${FLAGS_to}" bs=65536 skip=1 >> $tempfile
-
-  vbutil_kernel \
-    --verify $tempfile \
-    --signpubkey "${FLAGS_keys_dir}/kernel_subkey.vbpubk"
-
-  rm -f $tempfile
-  trap - EXIT
-
-elif [[ "${FLAGS_arch}" = "arm" ]]; then
-  # FIXME: For now, ARM just uses the unsigned kernel by itself.
-  cp -f "${FLAGS_vmlinuz}" "${FLAGS_to}"
-else
-  error "Unknown arch: ${FLAGS_arch}"
-fi
-
-set +e  # cleanup failure is a-ok
-
-if [[ ${FLAGS_keep_work} -eq ${FLAGS_FALSE} ]]; then
-  info "Cleaning up temporary files: ${WORK}"
-  rm ${WORK}
-  rmdir ${FLAGS_working_dir}
-fi
-
-info "Kernel partition image emitted: ${FLAGS_to}"
-
-if [[ -f ${FLAGS_rootfs_hash} ]]; then
-  info "Root filesystem hash emitted: ${FLAGS_rootfs_hash}"
-fi
diff --git a/bin/cros_emit_gpt_scripts.sh b/bin/cros_emit_gpt_scripts.sh
deleted file mode 100755
index d14ee97..0000000
--- a/bin/cros_emit_gpt_scripts.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/bash
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# Emit scripts to pack and unpack the partitions from a GPT disk image.
-
-# Load common constants.  This should be the first executable line.
-# The path to common.sh should be relative to your script's location.
-. "/usr/lib/crosutils/common.sh"
-. "/usr/lib/installer/chromeos-common.sh"
-
-set -e
-
-# Usage
-IMAGE=${1:-}
-DIR=${2:-}
-if [[ -z "$IMAGE" || -z "$DIR" ]]; then
-  echo "Usage: $0 GPT_DEVICE DIRECTORY" 1>&2
-  exit 1
-fi
-
-PACK="${DIR}/pack_partitions.sh"
-UNPACK="${DIR}/unpack_partitions.sh"
-
-locate_gpt
-
-TMP=$(mktemp)
-$GPT show "$IMAGE" > $TMP
-
-HEADER='#!/bin/bash -eu
-# File generated by cros_emit_gpt_scripts.sh. Do not edit.
-TARGET=${1:-}
-if [[ -z "$TARGET" ]]; then
-  echo "Usage: $0 DEVICE" 1>&2
-  exit 1
-fi
-set -x'
-
-echo "$HEADER" > "$PACK"
-echo "$HEADER" > "$UNPACK"
-cat $TMP | sed -e 's/^/# /' >> "$PACK"
-cat $TMP | sed -e 's/^/# /' >> "$UNPACK"
-
-$GPT show -q "$IMAGE" | \
-  while read start size part x; do \
-    file="part_$part"
-    loc="\"\$TARGET\""
-    echo "dd if=$loc of=$file bs=512 skip=$start count=$size" \
-      >> "$UNPACK"
-    echo \
-      "dd if=$file of=$loc bs=512 seek=$start count=$size conv=notrunc" \
-      >> "$PACK"
-  done
-
-chmod +x "$PACK" "$UNPACK"
-
-rm $TMP
diff --git a/bin/cros_generate_update_payload b/bin/cros_generate_update_payload
deleted file mode 100755
index d703013..0000000
--- a/bin/cros_generate_update_payload
+++ /dev/null
@@ -1,184 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Script to generate a Chromium OS update for use by the update engine.
-# If a source .bin is specified, the update is assumed to be a delta update.
-
-# Load common constants.  This should be the first executable line.
-# The path to common.sh should be relative to your script's location.
-. "/usr/lib/crosutils/common.sh"
-
-# Load functions and constants for chromeos-install
-. "/usr/lib/installer/chromeos-common.sh"
-
-SRC_MNT=""
-DST_MNT=""
-SRC_KERNEL=""
-SRC_ROOT=""
-DST_KERNEL=""
-DST_ROOT=""
-STATE_MNT=""
-STATE_LOOP_DEV=""
-
-# Pass an arg to not exit 1 at the end
-cleanup() {
-  set +e
-  echo "Cleaning up"
-  if [ -n "$SRC_MNT" ]; then
-    sudo umount -d "$SRC_MNT"
-    [ -d "$SRC_MNT" ] && rmdir "$SRC_MNT"
-    SRC_MNT=""
-  fi
-  if [ -n "$DST_MNT" ]; then
-    sudo umount -d "$DST_MNT"
-    [ -d "$DST_MNT" ] && rmdir "$DST_MNT"
-    DST_MNT=""
-  fi
-  if [ -n "$STATE_MNT" ]; then
-    sudo umount "$STATE_MNT"
-    [ -d "$STATE_MNT" ] && rmdir "$STATE_MNT"
-    STATE_MNT=""
-  fi
-  if [ -n "$STATE_LOOP_DEV" ]; then
-    sudo losetup -d "$STATE_LOOP_DEV"
-    STATE_LOOP_DEV=""
-  fi
-  rm -f "$SRC_KERNEL"
-  rm -f "$SRC_ROOT"
-  rm -f "$DST_KERNEL"
-  rm -f "$DST_ROOT"
-  [ -n "$1" ] || exit 1
-}
-
-extract_partition_to_temp_file() {
-  local filename="$1"
-  local partition="$2"
-  local temp_file=$(mktemp /tmp/generate_update_payload.XXXXXX)
-
-  local offset=$(partoffset "${filename}" ${partition})  # 512-byte sectors
-  local length=$(partsize "${filename}" ${partition})  # 512-byte sectors
-  local bs=512
-  local sectors_per_two_mib=$((2 * 1024 * 1024 / 512))
-  if [ $(( $offset % $sectors_per_two_mib )) -eq 0 -a \
-       $(( $length % $sectors_per_two_mib )) -eq 0 ]; then
-    bs=$((2 * 1024 * 1024))
-    offset=$(($offset / $sectors_per_two_mib))
-    length=$(($length / $sectors_per_two_mib))
-  else
-    warn "partition offset or length not at 2MiB boundary"
-  fi
-  dd if="$filename" of="$temp_file" bs=$bs count="$length" skip="$offset"
-  echo "$temp_file"
-}
-
-patch_kernel() {
-  local IMAGE="$1"
-  local KERN_FILE="$2"
-
-  STATE_LOOP_DEV=$(sudo losetup -f)
-  [ -n "$STATE_LOOP_DEV" ] || die "no free loop device"
-  local offset=$(partoffset "${IMAGE}" 1)
-  offset=$(($offset * 512))
-  sudo losetup -o "$offset" "$STATE_LOOP_DEV" "$IMAGE"
-  STATE_MNT=$(mktemp -d /tmp/state.XXXXXX)
-  sudo mount "$STATE_LOOP_DEV" "$STATE_MNT"
-  dd if="$STATE_MNT"/vmlinuz_hd.vblock of="$KERN_FILE" conv=notrunc
-  sudo umount "$STATE_MNT"
-  STATE_MNT=""
-  sudo losetup -d "$STATE_LOOP_DEV"
-  STATE_LOOP_DEV=""
-}
-
-# We should be in the chroot.
-assert_inside_chroot
-
-DEFINE_string image "" "The image that should be sent to clients."
-DEFINE_string src_image "" "Optional: a source image. If specified, this makes\
- a delta update."
-DEFINE_boolean old_style "$FLAGS_TRUE" "Generate an old-style .gz full update."
-DEFINE_string output "" "Output file"
-DEFINE_boolean patch_kernel "$FLAGS_FALSE" "Whether or not to patch the kernel \
-with the patch from the stateful partition (default: false)"
-
-# Parse command line
-FLAGS "$@" || exit 1
-eval set -- "${FLAGS_ARGV}"
-
-set -e
-
-locate_gpt
-
-DELTA=$FLAGS_TRUE
-[ -n "$FLAGS_output" ] || die \
-    "Error: you must specify an output filename with --output FILENAME"
-
-if [ -z "$FLAGS_src_image" ]; then
-  DELTA=$FLAGS_FALSE
-  if [ "$FLAGS_old_style" = "$FLAGS_TRUE" ]; then
-    echo "Generating an old-style full update"
-  else
-    die "Generating a new-style full update not yet supported"
-  fi
-fi
-
-if [ "$DELTA" -eq "$FLAGS_TRUE" ]; then
-  echo "Generating a delta update"
-
-  # Sanity check that the real generator exists:
-  GENERATOR="$(dirname "$0")/../platform/update_engine/delta_generator"
-  [ -x "$GENERATOR" ] || die "$GENERATOR doesn't exist, or isn't executable"
-
-  trap cleanup INT TERM EXIT
-  SRC_KERNEL=$(extract_partition_to_temp_file "$FLAGS_src_image" 2)
-  if [ "$FLAGS_patch_kernel" -eq "$FLAGS_TRUE" ]; then
-    patch_kernel "$FLAGS_src_image" "$SRC_KERNEL"
-  fi
-  SRC_ROOT=$(extract_partition_to_temp_file "$FLAGS_src_image" 3)
-
-  echo md5sum of src kernel:
-  md5sum "$SRC_KERNEL"
-  echo md5sum of src root:
-  md5sum "$SRC_ROOT"
-
-  DST_KERNEL=$(extract_partition_to_temp_file "$FLAGS_image" 2)
-  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)
-
-  SRC_MNT=$(mktemp -d /tmp/src_root.XXXXXX)
-  sudo mount -o loop,ro "$SRC_ROOT" "$SRC_MNT"
-
-  DST_MNT=$(mktemp -d /tmp/src_root.XXXXXX)
-  sudo mount -o loop,ro "$DST_ROOT" "$DST_MNT"
-
-  sudo "$GENERATOR" \
-      -new_dir "$DST_MNT" -new_image "$DST_ROOT" -new_kernel "$DST_KERNEL" \
-      -old_dir "$SRC_MNT" -old_image "$SRC_ROOT" -old_kernel "$SRC_KERNEL" \
-      -out_file "$FLAGS_output"
-
-  trap - INT TERM EXIT
-  cleanup noexit
-  echo "Done generating delta."
-else
-  echo "Generating full update"
-
-  trap cleanup INT TERM EXIT
-  DST_KERNEL=$(extract_partition_to_temp_file "$FLAGS_image" 2)
-  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)
-
-  GENERATOR="/usr/bin/cros_mk_memento_images.sh"
-
-  CROS_GENERATE_UPDATE_PAYLOAD_CALLED=1 "$GENERATOR" "$DST_KERNEL" "$DST_ROOT"
-  mv "$(dirname "$DST_KERNEL")/update.gz" "$FLAGS_output"
-
-  trap - INT TERM EXIT
-  cleanup noexit
-  echo "Done generating full update."
-fi
diff --git a/bin/cros_image_to_usb.sh b/bin/cros_image_to_usb.sh
deleted file mode 100755
index e5ef733..0000000
--- a/bin/cros_image_to_usb.sh
+++ /dev/null
@@ -1,236 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Script to convert the output of build_image.sh to a usb image.
-
-# Load common constants.  This should be the first executable line.
-# The path to common.sh should be relative to your script's location.
-. "/usr/lib/crosutils/common.sh"
-
-# Load functions and constants for chromeos-install
-. "/usr/lib/installer/chromeos-common.sh"
-
-get_default_board
-
-# Flags
-DEFINE_string board "${DEFAULT_BOARD}" "Board for which the image was built"
-DEFINE_string from "" \
-  "Directory containing chromiumos_image.bin"
-DEFINE_string to "/dev/sdX" "${DEFAULT_TO_HELP}"
-DEFINE_boolean yes ${FLAGS_FALSE} "Answer yes to all prompts" "y"
-DEFINE_boolean force_copy ${FLAGS_FALSE} "Always rebuild test image"
-DEFINE_boolean force_non_usb ${FLAGS_FALSE} \
-  "Write out image even if target (--to) doesn't look like a USB disk"
-DEFINE_boolean factory_install ${FLAGS_FALSE} \
-  "Whether to generate a factory install shim."
-DEFINE_boolean factory ${FLAGS_FALSE} \
-  "Whether to generate a factory runin image. Implies aututest and test"
-DEFINE_boolean copy_kernel ${FLAGS_FALSE} \
-  "Copy the kernel to the fourth partition."
-DEFINE_boolean test_image "${FLAGS_FALSE}" \
-  "Copies normal image to chromiumos_test_image.bin, modifies it for test."
-DEFINE_string image_name "chromiumos_image.bin" \
-  "Base name of the image" i
-DEFINE_string build_root "/build" \
-  "The root location for board sysroots."
-
-# Parse command line
-FLAGS "$@" || exit 1
-eval set -- "${FLAGS_ARGV}"
-
-if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ] ; then
-  if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ] ; then
-    echo "Factory test image is incompatible with factory install shim."
-    exit 1
-  fi
-fi
-
-# Require autotest for manucaturing image.
-if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ] ; then
-  echo "Factory image requires --test_image, setting."
-  FLAGS_test_image=${FLAGS_TRUE}
-fi
-
-# Require test for for factory install shim.
-if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ] ; then
-  echo "Factory install shim requires --test_image, setting."
-  FLAGS_test_image=${FLAGS_TRUE}
-fi
-
-
-# Die on any errors.
-set -e
-
-# No board, no default and no image set then we can't find the image
-if [ -z ${FLAGS_from} ] && [ -z ${FLAGS_board} ] ; then
-  setup_board_warning
-  exit 1
-fi
-
-# We have a board name but no image set.  Use image at default location
-if [ -z "${FLAGS_from}" ]; then
-  IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${FLAGS_board}"
-  FLAGS_from="${IMAGES_DIR}/$(ls -t ${IMAGES_DIR} 2>&-| head -1)"
-fi
-
-if [ ! -d "${FLAGS_from}" ] ; then
-  echo "Cannot find image directory ${FLAGS_from}"
-  exit 1
-fi
-
-if [ "${FLAGS_to}" == "/dev/sdX" ]; then
-  echo "You must specify a file or device to write to using --to."
-  disks=$(list_usb_disks)
-  if [ -n "$disks" ]; then
-    echo "Available USB disks:"
-    for disk in $disks; do
-      echo "  /dev/$disk:"
-      echo "    Manufacturer: $(get_disk_info $disk manufacturer)"
-      echo "         Product: $(get_disk_info $disk product)"
-      echo "            Size: $[$(cat /sys/block/$disk/size) * 512] bytes"
-    done
-  fi
-  exit 1
-fi
-
-# Convert args to paths.  Need eval to un-quote the string so that shell
-# chars like ~ are processed; just doing FOO=`readlink -f ${FOO}` won't work.
-FLAGS_from=`eval readlink -f ${FLAGS_from}`
-FLAGS_to=`eval readlink -f ${FLAGS_to}`
-
-# One last check to make sure user is not shooting themselves in the foot
-if [ -b "${FLAGS_to}" ]; then
-  if list_usb_disks | grep -q '^'${FLAGS_to##*/}'$'; then
-    disk_manufacturer=$(get_disk_info ${FLAGS_to##*/} manufacturer)
-    disk_product=$(get_disk_info ${FLAGS_to##*/} product)
-  elif [ ${FLAGS_force_non_usb} -ne ${FLAGS_TRUE} ]; then
-    # Safeguard against writing to a real non-USB disk
-    echo "Error: Device ${FLAGS_to} does not appear to be a USB disk!"
-    echo "       To override this safeguard, use the --force_non_usb flag"
-    exit 1
-  fi
-fi
-
-# Use this image as the source image to copy
-SRC_IMAGE="${FLAGS_from}/${FLAGS_image_name}"
-
-STATEFUL_DIR="${FLAGS_from}/stateful_partition"
-mkdir -p "${STATEFUL_DIR}"
-
-function do_cleanup {
-  echo "Cleaning loopback devices: ${STATEFUL_LOOP_DEV}"
-  if [ "${STATEFUL_LOOP_DEV}" != "" ]; then
-    sudo umount "${STATEFUL_DIR}"
-    sudo losetup -d "${STATEFUL_LOOP_DEV}"
-    rmdir "${STATEFUL_DIR}"
-    echo "Cleaned"
-  fi
-}
-
-
-# If we're asked to modify the image for test, then let's make a copy and
-# modify that instead.
-if [ ${FLAGS_test_image} -eq ${FLAGS_TRUE} ] ; then
-  if [ ! -f "${FLAGS_from}/chromiumos_test_image.bin" ] || \
-     [ ${FLAGS_force_copy} -eq ${FLAGS_TRUE} ] ; then
-    # Copy it.
-    echo "Creating test image from original..."
-    cp -f "${SRC_IMAGE}" "${FLAGS_from}/chromiumos_test_image.bin"
-
-    # Check for manufacturing image.
-    if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ] ; then
-      EXTRA_ARGS="--factory"
-    fi
-
-    # Check for instqall shim.
-    if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ] ; then
-      EXTRA_ARGS="--factory_install"
-    fi
-
-    # Modify it. Pass --yes so that cros_mod_image_for_test.sh won't ask us if
-    # we really want to modify the image; the user gave their assent already
-    # with --test-image and the original image is going to be preserved.
-    "/usr/bin/cros_mod_image_for_test.sh" --image \
-      "${FLAGS_from}/chromiumos_test_image.bin" --board=${FLAGS_board} \
-      ${EXTRA_ARGS} --yes
-    echo "Done with cros_mod_image_for_test."
-  else
-    echo "Using cached test image."
-  fi
-  SRC_IMAGE="${FLAGS_from}/chromiumos_test_image.bin"
-  echo "Source test image is: ${SRC_IMAGE}"
-fi
-
-
-# Let's do it.
-if [ -b "${FLAGS_to}" ]
-then
-  # Output to a block device (i.e., a real USB key), so need sudo dd
-  echo "Copying USB image ${SRC_IMAGE} to device ${FLAGS_to}..."
-
-  # Warn if it looks like they supplied a partition as the destination.
-  if echo "${FLAGS_to}" | grep -q '[0-9]$'; then
-    drive=$(echo "${FLAGS_to}" | sed -re 's/[0-9]+$//')
-    if [ -b "${drive}" ]; then
-      echo
-      echo "NOTE: It looks like you may have supplied a partition as the "
-      echo "destination.  This script needs to write to the drive's device "
-      echo "node instead (i.e. ${drive} rather than ${FLAGS_to})."
-      echo
-    fi
-  fi
-
-  # Make sure this is really what the user wants, before nuking the device
-  if [ ${FLAGS_yes} -ne ${FLAGS_TRUE} ]
-  then
-    sudo fdisk -l "${FLAGS_to}" 2>/dev/null | grep Disk | head -1
-    [ -n "$disk_manufacturer" ] && echo "Manufacturer: $disk_manufacturer"
-    [ -n "$disk_product" ] && echo "Product: $disk_product"
-    echo "This will erase all data on this device:"
-    read -p "Are you sure (y/N)? " SURE
-    SURE="${SURE:0:1}" # Get just the first character
-    if [ "${SURE}" != "y" ]
-    then
-      echo "Ok, better safe than sorry."
-      exit 1
-    fi
-  fi
-
-  echo "Attempting to unmount any mounts on the USB device..."
-  for i in $(mount | grep ^"${FLAGS_to}" | awk '{print $1}')
-  do
-    if sudo umount "$i" 2>&1 >/dev/null | grep "not found"; then
-      echo
-      echo "The device you have specified is already mounted at some point "
-      echo "that is not visible from inside the chroot.  Please unmount the "
-      echo "device manually from outside the chroot and try again."
-      echo
-      exit 1
-    fi
-  done
-  sleep 3
-
-  echo "Copying ${SRC_IMAGE} to ${FLAGS_to}..."
-  sudo dd if="${SRC_IMAGE}" of="${FLAGS_to}" bs=4M
-  sync
-
-  echo "Done."
-else
-  # Output to a file, so just make a copy.
-  echo "Copying ${SRC_IMAGE} to ${FLAGS_to}..."
-  cp -f "${SRC_IMAGE}" "${FLAGS_to}"
-
-  echo "Done.  To copy to a USB drive, outside the chroot, do something like:"
-  echo "   sudo dd if=${FLAGS_to} of=/dev/sdX bs=4M"
-  echo "where /dev/sdX is the entire drive."
-  if [ ${INSIDE_CHROOT} -eq 1 ]
-  then
-    example=$(basename "${FLAGS_to}")
-    echo "NOTE: Since you are currently inside the chroot, and you'll need to"
-    echo "run dd outside the chroot, the path to the USB image will be"
-    echo "different (ex: ~/chromeos/trunk/src/build/images/SOME_DIR/$example)."
-  fi
-fi
diff --git a/bin/cros_image_to_vm.sh b/bin/cros_image_to_vm.sh
deleted file mode 100755
index 33aee74..0000000
--- a/bin/cros_image_to_vm.sh
+++ /dev/null
@@ -1,272 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Script to convert the output of build_image.sh to a VMware image and write a
-# corresponding VMware config file.
-
-# Load common constants.  This should be the first executable line.
-# The path to common.sh should be relative to your script's location.
-. "/usr/lib/crosutils/common.sh"
-. "/usr/lib/installer/chromeos-common.sh"
-
-get_default_board
-
-DEFAULT_VMDK="ide.vmdk"
-DEFAULT_VMX="chromiumos.vmx"
-DEFAULT_VBOX_DISK="os.vdi"
-DEFAULT_QEMU_IMAGE="chromiumos_qemu_image.bin"
-
-MOD_SCRIPTS_ROOT="/usr/share/chromeos-installer/mod_for_test_scripts"
-
-# Flags
-DEFINE_string board "${DEFAULT_BOARD}" \
-  "Board for which the image was built"
-DEFINE_boolean factory $FLAGS_FALSE \
-    "Modify the image for manufacturing testing"
-DEFINE_boolean factory_install $FLAGS_FALSE \
-    "Modify the image for factory install shim"
-DEFINE_boolean force_copy ${FLAGS_FALSE} "Always rebuild test image"
-DEFINE_string format "qemu" \
-  "Output format, either qemu, vmware or virtualbox"
-DEFINE_string from "" \
-  "Directory containing rootfs.image and mbr.image"
-DEFINE_boolean make_vmx ${FLAGS_TRUE} \
-  "Create a vmx file for use with vmplayer (vmware only)."
-DEFINE_integer mem "${DEFAULT_MEM}" \
-  "Memory size for the vm config in MBs (vmware only)."
-DEFINE_integer rootfs_partition_size 1024 \
-  "rootfs parition size in MBs."
-DEFINE_string state_image "" \
-  "Stateful partition image (defaults to creating new statful partition)"
-DEFINE_integer statefulfs_size -1 \
-  "Stateful partition size in MBs."
-DEFINE_boolean test_image "${FLAGS_FALSE}" \
-  "Copies normal image to chromiumos_test_image.bin, modifies it for test."
-DEFINE_string to "" \
-  "Destination folder for VM output file(s)"
-DEFINE_string vbox_disk "${DEFAULT_VBOX_DISK}" \
-  "Filename for the output disk (virtualbox only)."
-DEFINE_integer vdisk_size 3072 \
-  "virtual disk size in MBs."
-DEFINE_string vmdk "${DEFAULT_VMDK}" \
-  "Filename for the vmware disk image (vmware only)."
-DEFINE_string vmx "${DEFAULT_VMX}" \
-  "Filename for the vmware config (vmware only)."
-
-# Parse command line
-FLAGS "$@" || exit 1
-eval set -- "${FLAGS_ARGV}"
-
-# Die on any errors.
-set -e
-
-if [ -z "${FLAGS_board}" ] ; then
-  die "--board is required."
-fi
-
-IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${FLAGS_board}"
-# Default to the most recent image
-if [ -z "${FLAGS_from}" ] ; then
-  FLAGS_from="${IMAGES_DIR}/$(ls -t $IMAGES_DIR | head -1)"
-else
-  pushd "${FLAGS_from}" && FLAGS_from=`pwd` && popd
-fi
-if [ -z "${FLAGS_to}" ] ; then
-  FLAGS_to="${FLAGS_from}"
-fi
-
-# Use this image as the source image to copy
-SRC_IMAGE="${FLAGS_from}/chromiumos_image.bin"
-
-# If we're asked to modify the image for test, then let's make a copy and
-# modify that instead.
-if [ ${FLAGS_test_image} -eq ${FLAGS_TRUE} ] ; then
-  if [ ! -f "${FLAGS_from}/chromiumos_test_image.bin" ] || \
-     [ ${FLAGS_force_copy} -eq ${FLAGS_TRUE} ] ; then
-    # Copy it.
-    echo "Creating test image from original..."
-    cp -f "${SRC_IMAGE}" "${FLAGS_from}/chromiumos_test_image.bin"
-
-    # Check for manufacturing image.
-    if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ] ; then
-      EXTRA_ARGS="--factory"
-    fi
-
-    # Check for install shim.
-    if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ] ; then
-      EXTRA_ARGS="--factory_install"
-    fi
-
-    # Modify it. Pass --yes so that cros_mod_image_for_test.sh won't ask us if
-    # we really want to modify the image; the user gave their assent already
-    # with --test-image and the original image is going to be preserved.
-    "/usr/lib/installer/bin/cros_mod_image_for_test.sh" --image \
-      "${FLAGS_from}/chromiumos_test_image.bin" ${EXTRA_ARGS} --yes
-    echo "Done with cros_mod_image_for_test."
-  else
-    echo "Using cached test image."
-  fi
-  SRC_IMAGE="${FLAGS_from}/chromiumos_test_image.bin"
-  echo "Source test image is: ${SRC_IMAGE}"
-fi
-
-# Memory units are in MBs
-DEFAULT_MEM="1024"
-TEMP_IMG="$(dirname ${SRC_IMAGE})/vm_temp_image.bin"
-
-# If we're not building for VMWare, don't build the vmx
-if [ "${FLAGS_format}" != "vmware" ]; then
-  FLAGS_make_vmx="${FLAGS_FALSE}"
-fi
-
-# Convert args to paths.  Need eval to un-quote the string so that shell
-# chars like ~ are processed; just doing FOO=`readlink -f $FOO` won't work.
-FLAGS_from=`eval readlink -f $FLAGS_from`
-FLAGS_to=`eval readlink -f $FLAGS_to`
-
-# Split apart the partitions and make some new ones
-TEMP_DIR=$(mktemp -d)
-(cd "${TEMP_DIR}" &&
-  "${FLAGS_from}/unpack_partitions.sh" "${SRC_IMAGE}")
-
-# Fix the kernel command line
-TEMP_ESP="${TEMP_DIR}"/part_12
-TEMP_ROOTFS="${TEMP_DIR}"/part_3
-TEMP_STATE="${TEMP_DIR}"/part_1
-TEMP_KERN="${TEMP_DIR}"/part_2
-if [ -n "${FLAGS_state_image}" ]; then
-  TEMP_STATE="${FLAGS_state_image}"
-else
-  # If we have a stateful fs size specified create a new state partition
-  # of the specified size.
-  if [ "${FLAGS_statefulfs_size}" -ne -1 ]; then
-    STATEFUL_SIZE_BYTES=$((1024 * 1024 * ${FLAGS_statefulfs_size}))
-    original_image_size=$(stat -c%s "${TEMP_STATE}")
-    if [ "${original_image_size}" -gt "${STATEFUL_SIZE_BYTES}" ]; then
-      die "Cannot resize stateful image to smaller than original. Exiting."
-    fi
-
-    echo "Resizing stateful partition to ${FLAGS_statefulfs_size}MB"
-    STATEFUL_LOOP_DEV=$(sudo losetup -f)
-    if [ -z "${STATEFUL_LOOP_DEV}" ]; then
-      die "No free loop device. Free up a loop device or reboot. Exiting."
-    fi
-
-    # Extend the original file size to the new size.
-    dd if=/dev/zero of="${TEMP_STATE}" bs=1 count=1 \
-        seek=$((STATEFUL_SIZE_BYTES - 1))
-    # Resize the partition.
-    sudo losetup "${STATEFUL_LOOP_DEV}" "${TEMP_STATE}"
-    sudo e2fsck -f "${STATEFUL_LOOP_DEV}"
-    sudo resize2fs "${STATEFUL_LOOP_DEV}"
-    sudo losetup -d "${STATEFUL_LOOP_DEV}"
-  fi
-fi
-TEMP_PMBR="${TEMP_DIR}"/pmbr
-dd if="${SRC_IMAGE}" of="${TEMP_PMBR}" bs=512 count=1
-
-TEMP_MNT=$(mktemp -d)
-TEMP_ESP_MNT=$(mktemp -d)
-cleanup() {
-  sudo umount -d "${TEMP_MNT}"
-  sudo umount -d "${TEMP_ESP_MNT}"
-  rmdir "${TEMP_MNT}" "${TEMP_ESP_MNT}"
-}
-trap cleanup INT TERM EXIT
-mkdir -p "${TEMP_MNT}"
-sudo mount -o loop "${TEMP_ROOTFS}" "${TEMP_MNT}"
-mkdir -p "${TEMP_ESP_MNT}"
-sudo mount -o loop "${TEMP_ESP}" "${TEMP_ESP_MNT}"
-
-if [ "${FLAGS_format}" = "qemu" ]; then
-  sudo python ./fixup_image_for_qemu.py --mounted_dir="${TEMP_MNT}" \
-  --enable_tablet=true
-else
-  sudo python ./fixup_image_for_qemu.py --mounted_dir="${TEMP_MNT}" \
-  --enable_tablet=false
-fi
-
-# Modify the unverified usb template which uses a default usb_disk of sdb3
-sudo sed -i -e 's/sdb3/sda3/g' "${TEMP_MNT}/boot/syslinux/usb.A.cfg"
-
-# Unmount everything prior to building a final image
-sync
-trap - INT TERM EXIT
-cleanup
-
-# Make 3 GiB output image
-# TOOD(adlr): pick a size that will for sure accomodate the partitions
-dd if=/dev/zero of="${TEMP_IMG}" bs=1 count=1 \
-  seek=$((${FLAGS_vdisk_size} * 1024 * 1024 - 1))
-
-# Set up the partition table
-install_gpt "${TEMP_IMG}" "$(numsectors $TEMP_ROOTFS)" \
-  "$(numsectors $TEMP_STATE)" "${TEMP_PMBR}" "$(numsectors $TEMP_ESP)" \
-  false ${FLAGS_rootfs_partition_size}
-# Copy into the partition parts of the file
-dd if="${TEMP_ROOTFS}" of="${TEMP_IMG}" conv=notrunc bs=512 \
-  seek="${START_ROOTFS_A}"
-dd if="${TEMP_STATE}"  of="${TEMP_IMG}" conv=notrunc bs=512 \
-  seek="${START_STATEFUL}"
-dd if="${TEMP_KERN}"   of="${TEMP_IMG}" conv=notrunc bs=512 \
-  seek="${START_KERN_A}"
-dd if="${TEMP_ESP}"    of="${TEMP_IMG}" conv=notrunc bs=512 \
-  seek="${START_ESP}"
-
-# Make the built-image bootable and ensure that the legacy default usb boot
-# uses /dev/sda instead of /dev/sdb3.
-# NOTE: The TEMP_IMG must live in the same image dir as the original image
-#       to operate automatically below.
-/usr/bin/cros_make_image_bootable $(dirname "${TEMP_IMG}") \
-                                  $(basename "${TEMP_IMG}") \
-                                  --usb_disk /dev/sda3
-
-echo Creating final image
-# Convert image to output format
-if [ "${FLAGS_format}" = "virtualbox" -o "${FLAGS_format}" = "qemu" ]; then
-  if [ "${FLAGS_format}" = "virtualbox" ]; then
-    VBoxManage convertdd "${TEMP_IMG}" "${FLAGS_to}/${FLAGS_vbox_disk}"
-  else
-    mv ${TEMP_IMG} ${FLAGS_to}/${DEFAULT_QEMU_IMAGE}
-  fi
-elif [ "${FLAGS_format}" = "vmware" ]; then
-  qemu-img convert -f raw "${TEMP_IMG}" \
-    -O vmdk "${FLAGS_to}/${FLAGS_vmdk}"
-else
-  die "Invalid format: ${FLAGS_format}"
-fi
-
-rm -rf "${TEMP_DIR}" "${TEMP_IMG}"
-if [ -z "${FLAGS_state_image}" ]; then
-  rm -f "${STATE_IMAGE}"
-fi
-
-echo "Created image at ${FLAGS_to}"
-
-# Generate the vmware config file
-# A good reference doc: http://www.sanbarrow.com/vmx.html
-VMX_CONFIG="#!/usr/bin/vmware
-.encoding = \"UTF-8\"
-config.version = \"8\"
-virtualHW.version = \"4\"
-memsize = \"${FLAGS_mem}\"
-ide0:0.present = \"TRUE\"
-ide0:0.fileName = \"${FLAGS_vmdk}\"
-ethernet0.present = \"TRUE\"
-usb.present = \"TRUE\"
-sound.present = \"TRUE\"
-sound.virtualDev = \"es1371\"
-displayName = \"Chromium OS\"
-guestOS = \"otherlinux\"
-ethernet0.addressType = \"generated\"
-floppy0.present = \"FALSE\""
-
-if [[ "${FLAGS_make_vmx}" = "${FLAGS_TRUE}" ]]; then
-  echo "${VMX_CONFIG}" > "${FLAGS_to}/${FLAGS_vmx}"
-  echo "Wrote the following config to: ${FLAGS_to}/${FLAGS_vmx}"
-  echo "${VMX_CONFIG}"
-fi
-
diff --git a/bin/cros_make_factory_package.sh b/bin/cros_make_factory_package.sh
deleted file mode 100755
index 8312903..0000000
--- a/bin/cros_make_factory_package.sh
+++ /dev/null
@@ -1,185 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Script to generate a factory install partition set and miniomaha.conf
-# file from a release image and a factory image. This creates a server
-# configuration that can be installed using a factory install shim.
-#
-# miniomaha lives in src/platform/dev/ and miniomaha partition sets live
-# in src/platform/dev/static.
-
-# Load common constants.  This should be the first executable line.
-# The path to common.sh should be relative to your script's location.
-. "/usr/lib/crosutils/common.sh"
-
-# Load functions and constants for chromeos-install
-. "/usr/lib/installer/chromeos-common.sh"
-
-get_default_board
-
-# Flags
-DEFINE_string board "${DEFAULT_BOARD}" "Board for which the image was built"
-DEFINE_string factory "" \
-  "Directory and file containing factory image: /path/chromiumos_test_image.bin"
-DEFINE_string firmware_updater "" \
-  "If set, include the firmware shellball into the server configuration"
-DEFINE_string release "" \
-  "Directory and file containing release image: /path/chromiumos_image.bin"
-
-
-# Parse command line
-FLAGS "$@" || exit 1
-eval set -- "${FLAGS_ARGV}"
-
-if [ ! -f "${FLAGS_release}" ] ; then
-  echo "Cannot find image file ${FLAGS_release}"
-  exit 1
-fi
-
-if [ ! -f "${FLAGS_factory}" ] ; then
-  echo "Cannot find image file ${FLAGS_factory}"
-  exit 1
-fi
-
-if [ ! -z "${FLAGS_firmware_updater}" ] && \
-   [ ! -f "${FLAGS_firmware_updater}" ] ; then
-  echo "Cannot find firmware file ${FLAGS_firmware_updater}"
-  exit 1
-fi
-
-# Convert args to paths.  Need eval to un-quote the string so that shell
-# chars like ~ are processed; just doing FOO=`readlink -f ${FOO}` won't work.
-OMAHA_DIR=${SRC_ROOT}/platform/dev
-OMAHA_DATA_DIR=${OMAHA_DIR}/static/
-
-if [ ${INSIDE_CHROOT} -eq 0 ]; then
-  echo "Caching sudo authentication"
-  sudo -v
-  echo "Done"
-fi
-
-# Use this image as the source image to copy
-RELEASE_DIR=`dirname ${FLAGS_release}`
-FACTORY_DIR=`dirname ${FLAGS_factory}`
-RELEASE_IMAGE=`basename ${FLAGS_release}`
-FACTORY_IMAGE=`basename ${FLAGS_factory}`
-
-
-prepare_omaha() {
-  sudo rm -rf ${OMAHA_DATA_DIR}/rootfs-test.gz
-  sudo rm -rf ${OMAHA_DATA_DIR}/rootfs-release.gz
-  rm -rf ${OMAHA_DATA_DIR}/efi.gz
-  rm -rf ${OMAHA_DATA_DIR}/oem.gz
-  rm -rf ${OMAHA_DATA_DIR}/state.gz
-  rm -rf ${OMAHA_DIR}/miniomaha.conf
-}
-
-prepare_dir() {
-  sudo rm -rf rootfs-test.gz
-  sudo rm -rf rootfs-release.gz
-  rm -rf efi.gz
-  rm -rf oem.gz
-  rm -rf state.gz
-}
-
-
-# Clean up stale config and data files.
-prepare_omaha
-
-# Get the release image.
-pushd ${RELEASE_DIR} > /dev/null
-echo "Generating omaha release image from ${FLAGS_release}"
-echo "Generating omaha factory image from ${FLAGS_factory}"
-echo "Output omaha image to ${OMAHA_DATA_DIR}"
-echo "Output omaha config to ${OMAHA_DIR}/miniomaha.conf"
-
-prepare_dir
-
-sudo ./unpack_partitions.sh ${RELEASE_IMAGE} &> /dev/null
-release_hash=`sudo /usr/bin/cros_mk_memento_images.sh part_2 \
-    part_3 | grep hash | awk '{print $4}'`
-sudo chmod a+rw update.gz
-mv update.gz rootfs-release.gz
-mv rootfs-release.gz ${OMAHA_DATA_DIR}
-echo "release: ${release_hash}"
-
-cat part_8 | gzip -9 > oem.gz
-oem_hash=`cat oem.gz | openssl sha1 -binary | openssl base64`
-mv oem.gz ${OMAHA_DATA_DIR}
-echo "oem: ${oem_hash}"
-
-cat part_12 | gzip -9 > efi.gz
-efi_hash=`cat efi.gz | openssl sha1 -binary | openssl base64`
-mv efi.gz ${OMAHA_DATA_DIR}
-echo "efi: ${efi_hash}"
-
-popd > /dev/null
-
-# Go to retrieve the factory test image.
-pushd ${FACTORY_DIR} > /dev/null
-prepare_dir
-
-
-sudo ./unpack_partitions.sh ${FACTORY_IMAGE} &> /dev/null
-test_hash=`sudo /usr/bin/cros_mk_memento_images.sh part_2 part_3 \
-    | grep hash | awk '{print $4}'`
-sudo chmod a+rw update.gz
-mv update.gz rootfs-test.gz
-mv rootfs-test.gz ${OMAHA_DATA_DIR}
-echo "test: ${test_hash}"
-
-cat part_1 | gzip -9 > state.gz
-state_hash=`cat state.gz | openssl sha1 -binary | openssl base64`
-mv state.gz ${OMAHA_DATA_DIR}
-echo "state: ${state_hash}"
-
-popd > /dev/null
-
-if [ ! -z ${FLAGS_firmware_updater} ] ; then
-  SHELLBALL="${FLAGS_firmware_updater}"
-  if [ ! -f  "$SHELLBALL" ]; then
-    echo "Failed to find firmware updater: $SHELLBALL."
-    exit 1
-  fi
-
-  cat $SHELLBALL | gzip -9 > firmware.gz
-  firmware_hash=`cat firmware.gz | openssl sha1 -binary | openssl base64`
-  mv firmware.gz ${OMAHA_DATA_DIR}
-  echo "firmware: ${firmware_hash}"
-fi
-
-echo -n "
-config = [
- {
-   'qual_ids': set([\"${FLAGS_board}\"]),
-   'factory_image': 'rootfs-test.gz',
-   'factory_checksum': '${test_hash}',
-   'release_image': 'rootfs-release.gz',
-   'release_checksum': '${release_hash}',
-   'oempartitionimg_image': 'oem.gz',
-   'oempartitionimg_checksum': '${oem_hash}',
-   'efipartitionimg_image': 'efi.gz',
-   'efipartitionimg_checksum': '${efi_hash}',
-   'stateimg_image': 'state.gz',
-   'stateimg_checksum': '${state_hash}'," > ${OMAHA_DIR}/miniomaha.conf
-
-if [ ! -z "${FLAGS_firmware_updater}" ]  ; then
-  echo -n "
-   'firmware_image': 'firmware.gz',
-   'firmware_checksum': '${firmware_hash}'," >> ${OMAHA_DIR}/miniomaha.conf
-fi
-
-echo -n "
- },
-]
-" >> ${OMAHA_DIR}/miniomaha.conf
-
-echo "The miniomaha server lives in src/platform/dev"
-echo "to validate the configutarion, run:"
-echo "  python2.6 devserver.py --factory_config miniomaha.conf \
---validate_factory_config"
-echo "To run the server:"
-echo "  python2.6 devserver.py --factory_config miniomaha.conf"
diff --git a/bin/cros_make_image_bootable b/bin/cros_make_image_bootable
deleted file mode 100755
index ba4f7af..0000000
--- a/bin/cros_make_image_bootable
+++ /dev/null
@@ -1,261 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# Script which ensures that a given image has an up-to-date
-# kernel partition, rootfs integrity hashes, and legacy bootloader configs.
-
-# Load common constants.  This should be the first executable line.
-# The path to common.sh should be relative to your script's location.
-COMMON_PATH="/usr/lib/crosutils/common.sh"
-if [ ! -r "${COMMON_PATH}" ]; then
-  echo "ERROR! Cannot find common.sh: ${COMMON_PATH}" 1>&2
-  exit 1
-fi
-. "/usr/lib/crosutils/common.sh"
-
-set -e
-. "/usr/lib/installer/chromeos-common.sh"  # for partoffset and partsize
-if [ $# -lt 2 ]; then
-  echo "Usage: ${0} /PATH/TO/IMAGE IMAGE.BIN [shflags overrides]"
-  exit 1
-fi
-
-BOOT_DESC_FILE="${1}/boot.desc"
-IMAGE="${1}/${2}"
-shift
-shift
-FLAG_OVERRIDES="${@}"
-
-if [ ! -r "${BOOT_DESC_FILE}" ]; then
-  warn "${BOOT_DESC_FILE} cannot be read!"
-  warn "Falling back to command line parsing"
-  BOOT_DESC="${@}"
-else
-  BOOT_DESC="$(cat ${BOOT_DESC_FILE} | tr -s '\n' ' ')"
-  info "Boot-time configuration for $(dirname ${IMAGE}): "
-  cat ${BOOT_DESC_FILE} | while read line; do
-    info "  ${line}"
-  done
-fi
-
-if [ ! -r "${IMAGE}" ]; then
-  die "${IMAGE} cannot be read!"
-fi
-
-# Script must be run inside the chroot.
-restart_in_chroot_if_needed $*
-
-locate_gpt
-set +e
-
-# Now parse the build settings from ${OUTPUT_DIR}/boot.desc
-
-DEFINE_string output_dir "/tmp" \
-  "Directory to place output in."
-DEFINE_string image "chromiumos_base.img" \
-  "Full path to the chromiumos image to make bootable."
-DEFINE_string arch "x86" \
-  "Architecture to make bootable for: arm or x86"
-DEFINE_string usb_disk "/dev/sdb3" \
-  "Path syslinux should use to do a usb boot."
-DEFINE_boolean cleanup_dirs ${FLAGS_TRUE} \
-  "Whether the mount dirs should be removed on completion."
-
-DEFINE_integer rootfs_size 720 \
-  "rootfs filesystem size in MBs."
-# ceil(0.1 * rootfs_size) is a good minimum.
-DEFINE_integer rootfs_hash_pad 8 \
-  "MBs reserved at the end of the rootfs image."
-
-DEFINE_string rootfs_hash "/tmp/rootfs.hash" \
-  "Path where the rootfs hash should be stored."
-DEFINE_boolean enable_rootfs_verification ${FLAGS_FALSE} \
-  "Default all bootloaders to use kernel-based root fs integrity checking."
-DEFINE_integer verity_error_behavior 2 \
-  "Kernel verified boot error behavior (0: I/O errors, 1: reboot, 2: nothing)"
-DEFINE_integer verity_depth 1 \
-  "Kernel verified boot hash tree depth"
-DEFINE_integer verity_max_ios 1024 \
-  "Number of outstanding I/O operations dm-verity caps at."
-DEFINE_string verity_algorithm "sha1" \
-  "Cryptographic hash algorithm used for kernel vboot."
-
-DEFINE_string arm_extra_bootargs "" \
-  "Additional command line options to pass to the ARM kernel."
-
-DEFINE_string keys_dir "/usr/share/vboot/devkeys" \
-  "Directory containing the signing keys."
-
-DEFINE_string rootfs_mountpoint "/tmp/rootfs" \
-  "Path where the rootfs can be safely mounted"
-DEFINE_string statefulfs_mountpoint "/tmp/statefulfs" \
-  "Path where the statefulfs can be safely mounted"
-DEFINE_string espfs_mountpoint "/tmp/espfs" \
-  "Path where the espfs can be safely mounted"
-
-DEFINE_boolean use_dev_keys ${FLAGS_FALSE} \
-  "Use developer keys for signing. (Default: false)"
-
-# Parse the boot.desc and any overrides
-eval set -- "${BOOT_DESC} ${FLAG_OVERRIDES}"
-FLAGS "${@}" || exit 1
-
-# Only now can we die on error.  shflags functions leak non-zero error codes,
-# so will die prematurely if 'set -e' is specified before now.
-set -e -u
-
-# $1 - Directory where developer rootfs is mounted.
-# $2 - Directory where developer stateful_partition is mounted.
-# $3 - Directory where the ESP partition is mounted.
-mount_gpt_cleanup() {
-  local rootfs="${1-$FLAGS_rootfs_mountpoint}"
-  local statefs="${2-$FLAGS_statefulfs_mountpoint}"
-  local espfs="${3-$FLAGS_espfs_mountpoint}"
-  "/usr/bin/cros_mount_gpt_image.sh" \
-    -u -r "${rootfs}" -s "${statefs}" -e "${espfs}"
-}
-
-make_image_bootable() {
-  local image="$1"
-  local use_dev_keys=
-
-  cros_root=/dev/sd%D%P
-  if [[ "${FLAGS_arch}" = "arm" ]]; then
-    # TODO(wad) assumed like in build_gpt for now.
-    cros_root=/dev/mmcblk1p3
-  fi
-  if [[ ${FLAGS_enable_rootfs_verification} -eq ${FLAGS_TRUE} ]]; then
-    cros_root=/dev/dm-0
-  fi
-
-  trap "mount_gpt_cleanup" EXIT
-  /usr/bin/cros_mount_gpt_image.sh --from "$(dirname ${image})" \
-    --image "$(basename ${image})" -r "${FLAGS_rootfs_mountpoint}" \
-    -s "${FLAGS_statefulfs_mountpoint}"
-
-  # The rootfs should never be mounted rw again after this point without
-  # re-calling make_image_bootable.
-  sudo mount -o remount,ro "${FLAGS_rootfs_mountpoint}"
-  root_dev=$(mount | grep -- "on ${FLAGS_rootfs_mountpoint} type" |
-             cut -f1 -d' ' | tail -1)
-
-  if [ ${FLAGS_use_dev_keys} -eq ${FLAGS_TRUE} ]; then
-    use_dev_keys="--use_dev_keys"
-  fi
-
-  # Builds the kernel partition image.  The temporary files are kept around
-  # so that we can perform a load_kernel_test later on the final image.
-  /usr/bin/cros_build_kernel_image.sh \
-    --arch="${FLAGS_arch}" \
-    --to="${FLAGS_output_dir}/vmlinuz.image" \
-    --hd_vblock="${FLAGS_output_dir}/vmlinuz_hd.vblock" \
-    --vmlinuz="${FLAGS_rootfs_mountpoint}/boot/vmlinuz" \
-    --working_dir="${FLAGS_output_dir}" \
-    --keep_work \
-    --rootfs_image=${root_dev} \
-    --rootfs_hash=${FLAGS_rootfs_hash} \
-    --verity_hash_alg=${FLAGS_verity_algorithm} \
-    --verity_tree_depth=${FLAGS_verity_depth} \
-    --verity_max_ios=${FLAGS_verity_max_ios} \
-    --verity_error_behavior=${FLAGS_verity_error_behavior} \
-    --root=${cros_root} \
-    --keys_dir="${FLAGS_keys_dir}" \
-    ${use_dev_keys}
-
-  local rootfs_hash_size=$(stat -c '%s' ${FLAGS_rootfs_hash})
-  info "Appending rootfs.hash (${rootfs_hash_size} bytes) to the root fs"
-  if [[ ${rootfs_hash_size} -gt $((FLAGS_rootfs_hash_pad * 1024 * 1024)) ]]
-  then
-    die "--rootfs_hash_pad reserves less than the needed ${rootfs_hash_size}"
-  fi
-  # Unfortunately, cros_mount_gpt_image uses mount and not losetup to create the
-  # loop devices.  This means that they are not the correct size.  We have to
-  # write directly to the image to append the hash tree data.
-  local hash_offset="$(partoffset ${image} 3)"
-  hash_offset=$((hash_offset + ((1024 * 1024 * ${FLAGS_rootfs_size}) / 512)))
-  sudo dd bs=512 \
-          seek=${hash_offset} \
-          if="${FLAGS_rootfs_hash}" \
-          of="${image}" \
-          conv=notrunc
-  # We don't need to keep the file around anymore.
-  sudo rm "${FLAGS_rootfs_hash}"
-
-  # Move the verification block needed for the hard disk install to the
-  # stateful partition. Mount stateful fs, copy file, and umount fs.
-  # In original CL: http://codereview.chromium.org/2868044, this was done in
-  # create_base_image(). However, it could break the build if it is a clean
-  # build because vmlinuz_hd.vblock hasn't been created by
-  # cros_build_kernel_image.sh
-  if [[ "${FLAGS_arch}" = "x86" ]]; then
-    sudo cp "${FLAGS_output_dir}/vmlinuz_hd.vblock" \
-            "${FLAGS_statefulfs_mountpoint}"
-  fi
-
-  # START_KERN_A is set by the first call to install the gpt.
-  local koffset="$(partoffset ${image} 2)"
-  sudo dd if="${FLAGS_output_dir}/vmlinuz.image" of="${image}" \
-    conv=notrunc bs=512 seek=${koffset}
-
-  # Update the bootloaders.  For legacy/efi x86, the EFI system partition
-  # will be updated and for arm, the mbr will be updated (for u-boot).
-  local kernel_part=
-  local usb_disk="${FLAGS_usb_disk}"
-
-  # We should update the esp in place in the image.
-  local bootloader_to="${image}"
-  local esp_offset="$(partoffset ${image} 12)"
-  esp_offset=$((esp_offset * 512))  # sectors to bytes
-  local esp_size="$(partsize ${image} 12)"
-  esp_size=$((esp_size * 512))  # sectors to bytes
-  local bootloader_to_flags="--to_offset=${esp_offset} --to_size=${esp_size}"
-
-  if [[ "${FLAGS_arch}" = "x86" ]]; then
-    # Use the kernel partition to acquire configuration flags.
-    kernel_part="--kernel_partition='${FLAGS_output_dir}/vmlinuz.image'"
-    # Install syslinux on the EFI System Partition.
-    kernel_part="${kernel_part} --install_syslinux"
-  elif [[ "${FLAGS_arch}" = "arm" ]]; then
-    # TODO(wad) mmcblk1p3 is hardcoded for arm for now!
-    usb_disk="/dev/mmcblk1p3"
-    # ARM doesn't support using the kernel image for kernel cmdline flags yet.
-    kernel_part="--kernel_cmdline=\"${FLAGS_arm_extra_bootargs}\" "
-    # TODO(wad) Integrate dmtable extraction into the arm build
-    # E.g.  $(cat ${FLAGS_output_dir}/boot.config | tr -s '\n' ' ')"
-    local kpart_offset="--kernel_partition_offset=${koffset}"
-    local kpart_size="--kernel_partition_sectors="
-    kpart_size="${kpart_size}$(partsize ${image} 2)"
-    kernel_part="${kernel_part} ${kpart_size} ${kpart_offset}"
-    info "Using addition bootloader arguments: ${kernel_part}"
-  fi
-
-  # Update partition 12
-  /usr/bin/cros_update_bootloaders.sh \
-    --arch=${FLAGS_arch} \
-    --to="${bootloader_to}" \
-    --from="${FLAGS_rootfs_mountpoint}"/boot \
-    --vmlinuz="${FLAGS_rootfs_mountpoint}"/boot/vmlinuz \
-    --usb_disk="${usb_disk}" \
-    ${bootloader_to_flags} \
-    $kernel_part
-
-  trap - EXIT
-  /usr/bin/cros_mount_gpt_image.sh -u -r "${FLAGS_rootfs_mountpoint}" \
-                                      -s "${FLAGS_statefulfs_mountpoint}"
-}
-
-# Create the directories if they don't exist.
-mkdir -p ${FLAGS_rootfs_mountpoint}
-mkdir -p ${FLAGS_statefulfs_mountpoint}
-mkdir -p ${FLAGS_espfs_mountpoint}
-
-make_image_bootable ${IMAGE}
-
-if [ ${FLAGS_cleanup_dirs} -eq ${FLAGS_TRUE} ]; then
-  rmdir ${FLAGS_rootfs_mountpoint}
-  rmdir ${FLAGS_statefulfs_mountpoint}
-  rmdir ${FLAGS_espfs_mountpoint}
-fi
diff --git a/bin/cros_mk_memento_images.sh b/bin/cros_mk_memento_images.sh
deleted file mode 100755
index de921bb..0000000
--- a/bin/cros_mk_memento_images.sh
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# This script takes a path to a rootfs.ext2 which was generated by
-# build_image.sh and generates an image that can be used for auto
-# update.
-
-set -e
-
-if [ -z "$2" -o -z "$1" ]; then
-  echo "usage: $0 path/to/kernel_partition_img path/to/rootfs_partition_img"
-  exit 1
-fi
-
-if [ "$CROS_GENERATE_UPDATE_PAYLOAD_CALLED" != "1" ]; then
-  echo "WARNING:"
-  echo "This script should only be called from cros_generate_update_payload"
-  echo "Please run that script with --help to see how to use it."
-fi
-
-if [ $(whoami) = "root" ]; then
-  echo "running $0 as root which is unneccessary"
-fi
-
-KPART="$1"
-ROOT_PART="$2"
-
-KPART_SIZE=$(stat -c%s "$KPART")
-
-# Sanity check size.
-if [ "$KPART_SIZE" -gt $((16 * 1024 * 1024)) ]; then
-  echo "Kernel partition size ($KPART_SIZE bytes) greater than 16 MiB."
-  echo "That's too big."
-  exit 1
-fi
-
-FINAL_OUT_FILE=$(dirname "$1")/update.gz
-UNCOMPRESSED_OUT_FILE="$FINAL_OUT_FILE.uncompressed"
-
-# First, write size of kernel partition in big endian as uint64 to out file
-# printf converts it to a number like 00000000003d0900. sed converts it to:
-# \\x00\\x00\\x00\\x00\\x00\\x3d\\x09\\x00, then xargs converts it to binary
-# with echo.
-printf %016x "$KPART_SIZE" | \
-  sed 's/\([0-9a-f][0-9a-f]\)/\\\\x\1/g' | \
-  xargs echo -ne > "$UNCOMPRESSED_OUT_FILE"
-
-# Next, write kernel partition to the out file
-cat "$KPART" >> "$UNCOMPRESSED_OUT_FILE"
-
-# Sanity check size of output file now
-if [ $(stat -c%s "$UNCOMPRESSED_OUT_FILE") -ne $((8 + $KPART_SIZE)) ]; then
-  echo "Kernel partition changed size during image generation. Aborting."
-  exit 1
-fi
-
-# Put rootfs into the out file
-cat "$ROOT_PART" >> "$UNCOMPRESSED_OUT_FILE"
-
-# compress and hash
-CS_AND_RET_CODES=$(gzip -c "$UNCOMPRESSED_OUT_FILE" | \
-                   tee "$FINAL_OUT_FILE" | openssl sha1 -binary | \
-                   openssl base64 | tr '\n' ' '; \
-                   echo ${PIPESTATUS[*]})
-EXPECTED_RET_CODES="0 0 0 0 0"
-set -- $CS_AND_RET_CODES
-CALC_CS="$1"
-shift
-RET_CODES="$@"
-if [ "$RET_CODES" != "$EXPECTED_RET_CODES" ]; then
-  echo compression/hash failed. $RET_CODES
-  exit 1
-fi
-
-rm "$UNCOMPRESSED_OUT_FILE"
-
-echo Success. hash is "$CALC_CS"
diff --git a/bin/cros_mod_image_for_dev_recovery.sh b/bin/cros_mod_image_for_dev_recovery.sh
deleted file mode 100755
index 8850869..0000000
--- a/bin/cros_mod_image_for_dev_recovery.sh
+++ /dev/null
@@ -1,174 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Script to create a Chrome OS dev recovery image using a dev install shim
-
-# Source constants and utility functions
-. "/usr/lib/crosutils/common.sh"
-. "/usr/lib/installer/chromeos-common.sh"
-
-get_default_board
-
-DEFINE_string board "$DEFAULT_BOARD" "Board for which the image was built \
-Default: ${DEFAULT_BOARD}"
-DEFINE_string dev_install_shim "" "Path of the developer install shim. \
-Default: (empty)"
-DEFINE_string payload_dir "" "Directory containing developer payload and \
-(optionally) a custom install script. Default: (empty)"
-
-# Parse command line
-FLAGS "$@" || exit 1
-eval set -- "${FLAGS_ARGV}"
-
-set -e
-
-# No board set and no default set then we can't proceed
-if [ -z $FLAGS_board ] ; then
-  setup_board_warning
-  die "No board set"
-fi
-
-# Abort early if --payload_dir is not set, invalid or empty
-if [ -z $FLAGS_payload_dir ] ; then
-  die "flag --payload_dir not set"
-fi
-
-if [ ! -d "${FLAGS_payload_dir}" ] ; then
-  die "${FLAGS_payload_dir} is not a directory"
-fi
-
-PAYLOAD_DIR_SIZE=
-if [ -z "$(ls -A $FLAGS_payload_dir)" ] ; then
-  die "${FLAGS_payload_dir} is empty"
-else
-  # Get directory size in 512-byte sectors so we can resize stateful partition
-  PAYLOAD_DIR_SIZE=\
-"$(du --apparent-size -B 512 ${FLAGS_payload_dir} | awk '{print $1}')"
-  info "${FLAGS_payload_dir} has ${PAYLOAD_DIR_SIZE} 512-byte sectors"
-fi
-
-DEV_INSTALL_SHIM="dev_install_shim.bin"
-# We have a board name but no dev_install_shim set. Try find a recent one
-if [ -z $FLAGS_dev_install_shim ] ; then
-  IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${FLAGS_board}"
-  FLAGS_dev_install_shim=\
-"${IMAGES_DIR}/$(ls -t $IMAGES_DIR 2>&-| head -1)/${DEV_INSTALL_SHIM}"
-fi
-
-# Turn relative path into an absolute path.
-FLAGS_dev_install_shim=$(eval readlink -f ${FLAGS_dev_install_shim})
-
-# Abort early if we can't find the install shim
-if [ ! -f $FLAGS_dev_install_shim ] ; then
-  die "No dev install shim found at $FLAGS_dev_install_shim"
-else
-  info "Using a recent dev install shim at ${FLAGS_dev_install_shim}"
-fi
-
-# Constants
-INSTALL_SHIM_DIR="$(dirname "$FLAGS_dev_install_shim")"
-DEV_RECOVERY_IMAGE="dev_recovery_image.bin"
-
-# Resize stateful partition of install shim to hold payload content
-# Due to this resize, we can't just re-pack the modified part back into an
-# image using pack_partition.sh generated for the dev install shim. Instead,
-# a revised partition table and a new image is needed
-# (see update_partition_table() for details)
-resize_statefulfs() {
-  local source_part=$1  # source stateful partition
-  local num_sectors=$2  # number of 512-byte sectors to be added
-
-  source_image_sectors=$(roundup $(numsectors ${source_part}))
-  info "source stateful fs has $((512 * $(expr $source_image_sectors))) bytes"
-  resized_image_bytes=$((512 * $(expr $source_image_sectors + $num_sectors)))
-  info "resized stateful fs has $resized_image_bytes bytes"
-
-  STATEFUL_LOOP_DEV=$(sudo losetup -f)
-  if [ -z "${STATEFUL_LOOP_DEV}" ]; then
-    die "No free loop device. Free up a loop device or reboot. Exiting."
-  fi
-
-  # Extend the source file size to the new size.
-  dd if=/dev/zero of="${source_part}" bs=1 count=1 \
-      seek=$((resized_image_bytes - 1))
-
-  # Resize the partition.
-  sudo losetup "${STATEFUL_LOOP_DEV}" "${source_part}"
-  sudo e2fsck -f "${STATEFUL_LOOP_DEV}"
-  sudo resize2fs "${STATEFUL_LOOP_DEV}"
-  sudo losetup -d "${STATEFUL_LOOP_DEV}"
-}
-
-# Update partition table with resized stateful partition and create the final
-# dev recovery image
-update_partition_table() {
-  TEMP_IMG=$(mktemp)
-
-  TEMP_KERN="${TEMP_DIR}"/part_2
-  TEMP_ROOTFS="${TEMP_DIR}"/part_3
-  TEMP_OEM="${TEMP_DIR}"/part_8
-  TEMP_ESP="${TEMP_DIR}"/part_12
-  TEMP_PMBR="${TEMP_DIR}"/pmbr
-  dd if="${FLAGS_dev_install_shim}" of="${TEMP_PMBR}" bs=512 count=1
-
-  # Set up a new partition table
-  install_gpt "${TEMP_IMG}" "$(numsectors $TEMP_ROOTFS)" \
-    "$(numsectors $TEMP_STATE)" "${TEMP_PMBR}" "$(numsectors $TEMP_ESP)" \
-    false $(roundup $(numsectors ${TEMP_ROOTFS}))
-
-  # Copy into the partition parts of the file
-  dd if="${TEMP_ROOTFS}" of="${TEMP_IMG}" conv=notrunc bs=512 \
-    seek="${START_ROOTFS_A}"
-  dd if="${TEMP_STATE}"  of="${TEMP_IMG}" conv=notrunc bs=512 \
-    seek="${START_STATEFUL}"
-  # Copy the full kernel (i.e. with vboot sections)
-  dd if="${TEMP_KERN}"   of="${TEMP_IMG}" conv=notrunc bs=512 \
-    seek="${START_KERN_A}"
-  dd if="${TEMP_OEM}"    of="${TEMP_IMG}" conv=notrunc bs=512 \
-    seek="${START_OEM}"
-  dd if="${TEMP_ESP}"    of="${TEMP_IMG}" conv=notrunc bs=512 \
-    seek="${START_ESP}"
-}
-
-# Creates a dev recovery image using an existing dev install shim
-# If successful, content of --payload_dir is copied to a directory named
-# "dev_payload" under the root of stateful partition.
-create_dev_recovery_image() {
-  # Split apart the partitions so we can make modifications
-  TEMP_DIR=$(mktemp -d)
-  (cd "${TEMP_DIR}" &&
-    "${INSTALL_SHIM_DIR}/unpack_partitions.sh" "${FLAGS_dev_install_shim}")
-
-  TEMP_STATE="${TEMP_DIR}"/part_1
-
-  resize_statefulfs $TEMP_STATE $PAYLOAD_DIR_SIZE
-
-  # Mount resized stateful FS and copy payload content to its root directory
-  TEMP_MNT_STATE=$(mktemp -d)
-  mkdir -p "${TEMP_MNT_STATE}"
-  sudo mount -o loop "${TEMP_STATE}" "${TEMP_MNT_STATE}"
-  sudo cp -R "${FLAGS_payload_dir}" "${TEMP_MNT_STATE}"
-  sudo mv "${TEMP_MNT_STATE}/$(basename ${FLAGS_payload_dir})" \
-"${TEMP_MNT_STATE}/dev_payload"
-  # Mark image as dev recovery
-  sudo touch "${TEMP_MNT_STATE}/.recovery"
-  sudo touch "${TEMP_MNT_STATE}/.dev_recovery"
-
-  # TODO(tgao): handle install script (for default and custom cases)
-  update_partition_table
-
-  sudo umount "${TEMP_MNT_STATE}"
-  trap - EXIT
-}
-
-# Main
-DST_PATH="${INSTALL_SHIM_DIR}/${DEV_RECOVERY_IMAGE}"
-info "Attempting to create dev recovery image using dev install shim \
-${FLAGS_dev_install_shim}"
-create_dev_recovery_image
-
-mv -f $TEMP_IMG $DST_PATH
-info "Dev recovery image created at ${DST_PATH}"
diff --git a/bin/cros_mod_image_for_recovery.sh b/bin/cros_mod_image_for_recovery.sh
deleted file mode 100755
index 2bed5e6..0000000
--- a/bin/cros_mod_image_for_recovery.sh
+++ /dev/null
@@ -1,123 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Script to modify a pristine/dev Chrome OS image to be used for recovery
-
-. "/usr/lib/crosutils/common.sh"
-
-# Load functions and constants for chromeos-install
-. "/usr/lib/installer/chromeos-common.sh"
-
-# Script must be run inside the chroot.
-restart_in_chroot_if_needed $*
-
-get_default_board
-
-RECOVERY_IMAGE="recovery_image.bin"
-
-DEFINE_string board "$DEFAULT_BOARD" "Board for which the image was built"
-DEFINE_string image "" "Location of the rootfs raw image file"
-DEFINE_string output "${RECOVERY_IMAGE}" \
-  "(optional) output image name. Default: ${RECOVERY_IMAGE}"
-
-# Parse command line
-FLAGS "$@" || exit 1
-eval set -- "${FLAGS_ARGV}"
-
-# No board, no default and no image set then we can't find the image
-if [ -z $FLAGS_image ] && [ -z $FLAGS_board ] ; then
-  setup_board_warning
-  die "cros_mod_image_for_recovery failed.  No board set and no image set"
-fi
-
-# We have a board name but no image set.  Use image at default location
-if [ -z $FLAGS_image ] ; then
-  IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${FLAGS_board}"
-  FILENAME="chromiumos_image.bin"
-  FLAGS_image="${IMAGES_DIR}/$(ls -t $IMAGES_DIR 2>&-| head -1)/${FILENAME}"
-fi
-
-# Turn path into an absolute path.
-FLAGS_image=$(eval readlink -f ${FLAGS_image})
-
-# Abort early if we can't find the image
-if [ ! -f $FLAGS_image ] ; then
-  echo "No image found at $FLAGS_image"
-  exit 1
-fi
-
-set -e
-
-# Constants
-IMAGE_DIR="$(dirname "$FLAGS_image")"
-IMAGE_NAME="$(basename "$FLAGS_image")"
-
-# loop device utility methods mostly duplicated from
-#   src/platform/installer/chromeos-install
-# TODO(tgao): minimize duplication by refactoring these methods into a separate
-# library script which both scripts can reference
-
-# Set up loop device for an image file at specified offset
-loop_offset_setup() {
-  local filename=$1
-  local offset=$2  # 512-byte sectors
-
-  LOOP_DEV=$(sudo losetup -f)
-  if [ -z "$LOOP_DEV" ]
-  then
-    echo "No free loop device. Free up a loop device or reboot. Exiting."
-    exit 1
-  fi
-
-  sudo losetup -o $(($offset * 512)) ${LOOP_DEV} ${filename}
-}
-
-loop_offset_cleanup() {
-  sudo losetup -d ${LOOP_DEV} || /bin/true
-}
-
-mount_on_loop_dev() {
-  TMPMNT=$(mktemp -d)
-  sudo mount ${LOOP_DEV} ${TMPMNT}
-}
-
-# Unmount loop-mounted device.
-umount_from_loop_dev() {
-  mount | grep -q " on ${TMPMNT} " && sudo umount ${TMPMNT}
-}
-
-# Undo both mount and loop.
-my_cleanup() {
-  umount_from_loop_dev
-  loop_offset_cleanup
-}
-
-# Modifies an existing image for recovery use
-update_recovery_packages() {
-  local image_name=$1
-
-  echo "Modifying image ${image_name} for recovery use"
-
-  locate_gpt  # set $GPT env var
-  loop_offset_setup ${image_name} $(partoffset "${image_name}" 1)
-  trap loop_offset_cleanup EXIT
-  mount_on_loop_dev "readwrite"
-  trap my_cleanup EXIT
-  sudo touch ${TMPMNT}/.recovery
-  umount_from_loop_dev
-  trap loop_offset_cleanup EXIT
-  loop_offset_cleanup
-  trap - EXIT
-}
-
-# Main
-
-DST_PATH="${IMAGE_DIR}/${FLAGS_output}"
-echo "Making a copy of original image ${FLAGS_image}"
-cp $FLAGS_image $DST_PATH
-update_recovery_packages $DST_PATH
-
-echo "Recovery image created at ${DST_PATH}"
diff --git a/bin/cros_mod_image_for_test.sh b/bin/cros_mod_image_for_test.sh
deleted file mode 100755
index 7625aeb..0000000
--- a/bin/cros_mod_image_for_test.sh
+++ /dev/null
@@ -1,233 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Script to modify a keyfob-based chromeos system image for testability.
-
-# Load common constants.  This should be the first executable line.
-# The path to common.sh should be relative to your script's location.
-. "/usr/lib/crosutils/common.sh"
-
-# Load functions and constants for chromeos-install
-. "/usr/lib/installer/chromeos-common.sh"
-
-# We need to be in the chroot to emerge test packages.
-assert_inside_chroot
-
-get_default_board
-
-DEFINE_string board "$DEFAULT_BOARD" "Board for which the image was built" b
-DEFINE_boolean factory $FLAGS_FALSE \
-    "Modify the image for manufacturing testing" f
-DEFINE_boolean factory_install $FLAGS_FALSE \
-    "Modify the image for factory install shim"
-DEFINE_string image "" "Location of the rootfs raw image file" i
-DEFINE_boolean installmask $FLAGS_TRUE \
-    "Use INSTALL_MASK to shrink the resulting image." m
-DEFINE_integer jobs -1 \
-    "How many packages to build in parallel at maximum." j
-DEFINE_string qualdb "" "Location of qualified component file" d
-DEFINE_boolean yes $FLAGS_FALSE "Answer yes to all prompts" y
-DEFINE_string build_root "/build" \
-    "The root location for board sysroots."
-DEFINE_boolean fast ${DEFAULT_FAST} "Call many emerges in parallel"
-
-
-# Parse command line
-FLAGS "$@" || exit 1
-eval set -- "${FLAGS_ARGV}"
-
-EMERGE_CMD="emerge"
-EMERGE_BOARD_CMD="emerge-${FLAGS_board}"
-if [ "${FLAGS_fast}" -eq "${FLAGS_TRUE}" ]; then
-  echo "Using alternate emerge"
-  EMERGE_CMD="${SCRIPTS_DIR}/parallel_emerge"
-  EMERGE_BOARD_CMD="${EMERGE_CMD} --board=${FLAGS_board}"
-fi
-
-# No board, no default and no image set then we can't find the image
-if [ -z $FLAGS_image ] && [ -z $FLAGS_board ] ; then
-  setup_board_warning
-  die "cros_mod_image_for_test failed.  No board set and no image set"
-fi
-
-# We have a board name but no image set.  Use image at default location
-if [ -z $FLAGS_image ] ; then
-  IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${FLAGS_board}"
-  FILENAME="chromiumos_image.bin"
-  FLAGS_image="${IMAGES_DIR}/$(ls -t $IMAGES_DIR 2>&-| head -1)/${FILENAME}"
-fi
-
-# Turn path into an absolute path.
-FLAGS_image=`eval readlink -f ${FLAGS_image}`
-
-# Abort early if we can't find the image
-if [ ! -f $FLAGS_image ] ; then
-  echo "No image found at $FLAGS_image"
-  exit 1
-fi
-
-# What cross-build are we targeting?
-. "${FLAGS_build_root}/${FLAGS_board}/etc/make.conf.board_setup"
-# Figure out ARCH from the given toolchain.
-# TODO: Move to common.sh as a function after scripts are switched over.
-TC_ARCH=$(echo "${CHOST}" | awk -F'-' '{ print $1 }')
-case "${TC_ARCH}" in
-  arm*)
-    ARCH="arm"
-    ;;
-  *86)
-    ARCH="x86"
-    ;;
-  *)
-    error "Unable to determine ARCH from toolchain: ${CHOST}"
-    exit 1
-esac
-
-# Make sure anything mounted in the rootfs/stateful is cleaned up ok on exit.
-cleanup_mounts() {
-  # Occasionally there are some daemons left hanging around that have our
-  # root/stateful image file system open. We do a best effort attempt to kill
-  # them.
-  PIDS=`sudo lsof -t "$1" | sort | uniq`
-  for pid in ${PIDS}
-  do
-    local cmdline=`cat /proc/$pid/cmdline`
-    echo "Killing process that has open file on the mounted directory: $cmdline"
-    sudo kill $pid || /bin/true
-  done
-}
-
-cleanup() {
-  "/usr/bin/cros_mount_gpt_image.sh" -u -r "$ROOT_FS_DIR" \
-                                        -s "$STATEFUL_DIR"
-}
-
-# Emerges chromeos-test onto the image.
-emerge_chromeos_test() {
-  INSTALL_MASK=""
-  if [[ $FLAGS_installmask -eq ${FLAGS_TRUE} ]]; then
-    INSTALL_MASK="$DEFAULT_INSTALL_MASK"
-  fi
-
-  # Determine the root dir for test packages.
-  ROOT_DEV_DIR="$ROOT_FS_DIR/usr/local"
-
-  sudo INSTALL_MASK="$INSTALL_MASK" $EMERGE_BOARD_CMD \
-    --root="$ROOT_DEV_DIR" --root-deps=rdeps \
-    --usepkgonly chromeos-test $EMERGE_JOBS
-}
-
-
-install_autotest() {
-    SYSROOT="${FLAGS_build_root}/${FLAGS_board}"
-    AUTOTEST_SRC="${SYSROOT}/usr/local/autotest"
-    stateful_root="${ROOT_FS_DIR}/usr/local"
-    autotest_client="/autotest"
-
-    echo "Install autotest into stateful partition from $AUTOTEST_SRC"
-
-    sudo mkdir -p "${stateful_root}${autotest_client}"
-
-    # Remove excess files from stateful partition.
-    # If these aren't there, that's fine.
-    sudo rm -rf "${stateful_root}${autotest_client}/*" || true
-    sudo rm -rf "${stateful_root}/autotest-pkgs" || true
-    sudo rm -rf "${stateful_root}/lib/icedtea6" || true
-
-    sudo rsync --delete --delete-excluded -auv \
-      --exclude=deps/realtimecomm_playground \
-      --exclude=tests/ltp \
-      --exclude=site_tests/graphics_O3DSelenium \
-      --exclude=site_tests/realtimecomm_GTalk\* \
-      --exclude=site_tests/platform_StackProtector \
-      --exclude=deps/chrome_test \
-      --exclude=site_tests/desktopui_BrowserTest \
-      --exclude=site_tests/desktopui_UITest \
-      --exclude=.svn \
-      ${AUTOTEST_SRC}/client/* "${stateful_root}/${autotest_client}"
-
-    sudo chmod 755 "${stateful_root}/${autotest_client}"
-    sudo chown -R 1000:1000 "${stateful_root}/${autotest_client}"
-}
-
-# main process begins here.
-
-# Make sure this is really what the user wants, before nuking the device
-if [ $FLAGS_yes -ne $FLAGS_TRUE ]; then
-  read -p "Modifying image ${FLAGS_image} for test; are you sure (y/N)? " SURE
-  SURE="${SURE:0:1}" # Get just the first character
-  if [ "$SURE" != "y" ]; then
-    echo "Ok, better safe than sorry."
-    exit 1
-  fi
-else
-  echo "Modifying image ${FLAGS_image} for test..."
-fi
-
-set -e
-
-IMAGE_DIR="$(dirname "$FLAGS_image")"
-IMAGE_NAME="$(basename "$FLAGS_image")"
-ROOT_FS_DIR="$IMAGE_DIR/rootfs"
-STATEFUL_DIR="$IMAGE_DIR/stateful_partition"
-
-trap cleanup EXIT
-
-# Mounts gpt image and sets up var, /usr/local and symlinks.
-"/usr/bin/cros_mount_gpt_image.sh" -i "$IMAGE_NAME" \
-    -f "$IMAGE_DIR" -r "$ROOT_FS_DIR" -s "$STATEFUL_DIR"
-
-if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then
-  # We don't want to emerge test packages on factory install, otherwise we run
-  # out of space.
-
-  # Run factory setup script to modify the image.
-  sudo $EMERGE_BOARD_CMD --root=$ROOT_FS_DIR --usepkgonly \
-      --root-deps=rdeps --nodeps chromeos-factoryinstall
-
-  # Set factory server if necessary.
-  if [ "${FACTORY_SERVER}" != "" ]; then
-    sudo sed -i \
-      "s/CHROMEOS_AUSERVER=.*$/CHROMEOS_AUSERVER=\
-http:\/\/${FACTORY_SERVER}:8080\/update/" \
-      ${ROOT_FS_DIR}/etc/lsb-release
-  fi
-else
-  emerge_chromeos_test
-
-  MOD_TEST_ROOT="/usr/share/chromeos-installer/mod_for_test_scripts"
-  # Run test setup script to modify the image
-  sudo GCLIENT_ROOT="${GCLIENT_ROOT}" ROOT_FS_DIR="${ROOT_FS_DIR}" \
-      STATEFUL_DIR="${STATEFUL_DIR}" ARCH="${ARCH}" "${MOD_TEST_ROOT}/test_setup.sh"
-
-  if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then
-    install_autotest
-
-    MOD_FACTORY_ROOT="/usr/share/chromeos-installer/mod_for_factory_scripts"
-    # Run factory setup script to modify the image
-    sudo GCLIENT_ROOT="${GCLIENT_ROOT}" ROOT_FS_DIR="${ROOT_FS_DIR}" \
-        QUALDB="${FLAGS_qualdb}" BOARD=${FLAGS_board} \
-        "${MOD_FACTORY_ROOT}/factory_setup.sh"
-  fi
-fi
-
-# Let's have a look at the image just in case..
-if [ "${VERIFY}" = "true" ]; then
-  pushd "${ROOT_FS_DIR}"
-  bash
-  popd
-fi
-
-cleanup
-
-# Now make it bootable with the flags from build_image
-/usr/bin/cros_make_image_bootable $(dirname "${FLAGS_image}") \
-                                  $(basename "${FLAGS_image}")
-
-print_time_elapsed
-
-trap - EXIT
-
diff --git a/bin/cros_mount_gpt_image.sh b/bin/cros_mount_gpt_image.sh
deleted file mode 100755
index d8fc0cd..0000000
--- a/bin/cros_mount_gpt_image.sh
+++ /dev/null
@@ -1,131 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Helper script that mounts chromium os image from a device or directory
-# and creates mount points for /var and /usr/local (if in dev_mode).
-
-. "/usr/lib/crosutils/common.sh"
-
-# For functions related to gpt images.
-. "/usr/lib/installer/chromeos-common.sh"
-locate_gpt
-
-get_default_board
-
-# Flags.
-DEFINE_string board "$DEFAULT_BOARD" \
-  "The board for which the image was built." b
-DEFINE_boolean unmount $FLAGS_FALSE \
-  "Unmount previously mounted dir." u
-DEFINE_string from "/dev/sdc" \
-  "Directory containing image or device with image on it" f
-DEFINE_string image "chromiumos_image.bin"\
-  "Name of the bin file if a directory is specified in the from flag" i
-DEFINE_string "rootfs_mountpt" "/tmp/m" "Mount point for rootfs" "r"
-DEFINE_string "stateful_mountpt" "/tmp/s" \
-    "Mount point for stateful partition" "s"
-DEFINE_string "esp_mountpt" "" \
-    "Mount point for esp partition" "e"
-DEFINE_boolean most_recent ${FLAGS_FALSE} "Use the most recent image dir" m
-
-# Parse flags
-FLAGS "$@" || exit 1
-eval set -- "${FLAGS_ARGV}"
-
-# Die on error
-set -e
-
-# Common unmounts for either a device or directory
-function unmount_image() {
-  echo "Unmounting image from ${FLAGS_stateful_mountpt}" \
-      "and ${FLAGS_rootfs_mountpt}"
-  # Don't die on error to force cleanup
-  set +e
-  # Reset symlinks in /usr/local.
-  setup_symlinks_on_root "/usr/local" "/var" \
-    "${FLAGS_stateful_mountpt}"
-  fix_broken_symlinks "${FLAGS_rootfs_mountpt}"
-  sudo umount "${FLAGS_rootfs_mountpt}/usr/local"
-  sudo umount "${FLAGS_rootfs_mountpt}/var"
-  if [[ -n "${FLAGS_esp_mountpt}" ]]; then
-    sudo umount -d "${FLAGS_esp_mountpt}"
-  fi
-  sudo umount -d "${FLAGS_stateful_mountpt}"
-  sudo umount -d "${FLAGS_rootfs_mountpt}"
-  set -e
-}
-
-function get_usb_partitions() {
-  sudo mount "${FLAGS_from}3" "${FLAGS_rootfs_mountpt}"
-  sudo mount "${FLAGS_from}1" "${FLAGS_stateful_mountpt}"
-  if [[ -n "${FLAGS_esp_mountpt}" ]]; then
-    sudo mount "${FLAGS_from}12" "${FLAGS_esp_mountpt}"
-  fi
-}
-
-function get_gpt_partitions() {
-  local filename="${FLAGS_image}"
-
-  # Mount the rootfs partition using a loopback device.
-  local offset=$(partoffset "${FLAGS_from}/${filename}" 3)
-  sudo mount -o loop,offset=$(( offset * 512 )) "${FLAGS_from}/${filename}" \
-    "${FLAGS_rootfs_mountpt}"
-
-  # Mount the stateful partition using a loopback device.
-  offset=$(partoffset "${FLAGS_from}/${filename}" 1)
-  sudo mount -o loop,offset=$(( offset * 512 )) "${FLAGS_from}/${filename}" \
-    "${FLAGS_stateful_mountpt}"
-
-  # Mount the stateful partition using a loopback device.
-  if [[ -n "${FLAGS_esp_mountpt}" ]]; then
-    offset=$(partoffset "${FLAGS_from}/${filename}" 12)
-    sudo mount -o loop,offset=$(( offset * 512 )) "${FLAGS_from}/${filename}" \
-      "${FLAGS_esp_mountpt}"
-  fi
-}
-
-# Mount a gpt based image.
-function mount_image() {
-  mkdir -p "${FLAGS_rootfs_mountpt}"
-  mkdir -p "${FLAGS_stateful_mountpt}"
-  if [[ -n "${FLAGS_esp_mountpt}" ]]; then
-    mkdir -p "${FLAGS_esp_mountpt}"
-  fi
-
-  # Get the partitions for the image / device.
-  if [ -b ${FLAGS_from} ] ; then
-    get_usb_partitions
-  else
-    get_gpt_partitions
-  fi
-
-  # Mount directories and setup symlinks.
-  sudo mount --bind "${FLAGS_stateful_mountpt}/var" \
-    "${FLAGS_rootfs_mountpt}/var"
-  sudo mount --bind "${FLAGS_stateful_mountpt}/dev_image" \
-    "${FLAGS_rootfs_mountpt}/usr/local"
-  # Setup symlinks in /usr/local so you can emerge packages into /usr/local.
-  setup_symlinks_on_root "${FLAGS_stateful_mountpt}/dev_image" \
-    "${FLAGS_stateful_mountpt}/var" "${FLAGS_stateful_mountpt}"
-  echo "Image specified by ${FLAGS_from} mounted at"\
-    "${FLAGS_rootfs_mountpt} successfully."
-}
-
-# Find the last image built on the board.
-if [ ${FLAGS_most_recent} -eq ${FLAGS_TRUE} ] ; then
-  IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${FLAGS_board}"
-  FLAGS_from="${IMAGES_DIR}/$(ls -t ${IMAGES_DIR} 2>&-| head -1)"
-fi
-
-# Turn path into an absolute path.
-FLAGS_from=`eval readlink -f ${FLAGS_from}`
-
-# Perform desired operation.
-if [ ${FLAGS_unmount} -eq ${FLAGS_TRUE} ] ; then
-  unmount_image
-else
-  mount_image
-fi
diff --git a/bin/cros_resign_image.sh b/bin/cros_resign_image.sh
deleted file mode 100755
index dd73fb4..0000000
--- a/bin/cros_resign_image.sh
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Script to resign the kernel partition generated in the output of build_image
-# with keys of our choosing.
-
-# Load common constants.  This should be the first executable line.
-# The path to common.sh should be relative to your script's location.
-. "/usr/lib/crosutils/common.sh"
-
-. "/usr/lib/installer/chromeos-common.sh"  # for partoffset and partsize
-
-locate_gpt
-
-DEFINE_string from "chromiumos_image.bin" \
-  "Input file name of Chrome OS image to re-sign."
-DEFINE_string datakey "" \
-  "Private Kernel Data Key (.vbprivk) to use for re-signing."
-DEFINE_string keyblock "" \
-  "Kernel Keyblock (.keyblock) to use for generating the vblock"
-DEFINE_string to "" \
-  "Output file name for the re-signed image."
-DEFINE_string vsubkey "" \
-  "(Optional) Public Kernel SubKey (.vbpubk) to use for testing verification."
-DEFINE_string vbutil_dir "" \
-  "(Optional) Path to directory containing vboot utility binaries"
-DEFINE_integer bootflags 0 \
-  "(Optional) Boot flags to use for verifying the output image"
-
-# Parse command line
-FLAGS "$@" || exit 1
-eval set -- "${FLAGS_ARGV}"
-
-# Abort on error
-set -e
-
-if [ -z $FLAGS_from ] || [ ! -f $FLAGS_from ] ; then
-  echo "Error: invalid flag --from"
-  exit 1
-fi
-
-if [ -z $FLAGS_datakey ] || [ ! -f $FLAGS_datakey ] ; then
-  echo "Error: invalid kernel data key"
-  exit 1
-fi
-
-if [ -z $FLAGS_keyblock ] || [ ! -f $FLAGS_keyblock ] ; then
-  echo "Error: invalid kernel keyblock"
-  exit 1
-fi
-
-if [ -z $FLAGS_to ]; then
-  echo "Error: invalid flag --to"
-  exit 1
-fi
-
-sector_size=512  # sector size in bytes
-num_sectors_vb=128  # number of sectors in kernel verification blob
-koffset="$(partoffset ${FLAGS_from} 2)"
-ksize="$(partsize ${FLAGS_from} 2)"
-
-echo "Re-signing image ${FLAGS_from} and outputting ${FLAGS_to}"
-temp_kimage=$(mktemp)
-trap "rm -f ${temp_kimage}" EXIT
-temp_out_vb=$(mktemp)
-trap "rm -f ${temp_out_vb}" EXIT
-
-# Grab the kernel image in preparation for resigning
-dd if="${FLAGS_from}" of="${temp_kimage}" skip=$koffset bs=$sector_size \
-  count=$ksize
-${FLAGS_vbutil_dir}vbutil_kernel \
-  --repack "${temp_out_vb}" \
-  --vblockonly \
-  --keyblock "${FLAGS_keyblock}" \
-  --signprivate "${FLAGS_datakey}" \
-  --oldblob "${temp_kimage}"
-
-# Create a copy of the input image and put in the new vblock
-cp "${FLAGS_from}" "${FLAGS_to}"
-dd if="${temp_out_vb}" of="${FLAGS_to}" seek=$koffset bs=$sector_size \
-  count=$num_sectors_vb conv=notrunc
-
-# Only test verification if the public subkey was passed in.
-if [ ! -z $FLAGS_vsubkey ]; then
-  ${FLAGS_vbutil_dir}load_kernel_test "${FLAGS_to}" "${FLAGS_vsubkey}" \
-    ${FLAGS_bootflags}
-fi
-
-echo "New signed image was output to ${FLAGS_to}"
-
-# Clean up temporary files
-rm -f ${temp_kimage}
-rm -f ${temp_out_vb}
diff --git a/bin/cros_sign_to_ssd b/bin/cros_sign_to_ssd
deleted file mode 100755
index 50ff357..0000000
--- a/bin/cros_sign_to_ssd
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Script to resign the kernel partition generated in the output of build_image
-# with SSD keys.
-
-# Load common constants.  This should be the first executable line.
-# The path to common.sh should be relative to your script's location.
-. "/usr/lib/crosutils/common.sh"
-
-. "/usr/lib/installer/chromeos-common.sh"  # for partoffset and partsize
-
-locate_gpt
-
-DEFINE_string from "chromiumos_image.bin" \
-  "Input file name of Chrome OS image to re-sign."
-
-# Parse command line
-FLAGS "$@" || exit 1
-eval set -- "${FLAGS_ARGV}"
-
-failure() {
-  echo "SIGNING HAD FAILED"
-  exit 1
-}
-
-# Abort on error
-set -e
-
-trap "failure" EXIT
-
-if [ -z "${FLAGS_from}" ] || [ ! -f "${FLAGS_from}" ] ; then
-  echo "Error: invalid flag --from"
-  exit 1
-fi
-
-# Example commandline is as follows:
-# ./sign_official_build.sh \
-# ssd \
-# /.../build/images/x86-mario/0.8.68.2/chromiumos_test_image.bin \
-# ../../tests/devkeys/ \
-# /.../build/images/x86-mario/0.8.68.2/chromiumos_test_ssd_image.bin
-
-VBOOT_DIR="$(dirname "$0")/../../platform/vboot_reference"
-if [ ! -d "${VBOOT_DIR}" ]; then
-  die "VBOOT DIR NOT FOUND at \'${VBOOT_DIR}\' .."
-fi
-
-TMP_IMAGE=$(mktemp)
-VBOOT_KEYS="${VBOOT_DIR}/tests/devkeys"
-if [ ! -d "${VBOOT_KEYS}" ]; then
-  die "VBOOT KEYS NOT FOUND at \'${VBOOT_KEYS}\' .."
-fi
-
-VBOOT_SIGN="${VBOOT_DIR}/scripts/image_signing/sign_official_build.sh"
-if [ ! -x "${VBOOT_SIGN}" ]; then
-  die "VBOOT TOOL sign_official_build.sh NOT FOUND at \'${VBOOT_SIGN}\' .."
-fi
-
-cp "${FLAGS_from}" "${TMP_IMAGE}"
-
-${VBOOT_SIGN} ssd "${TMP_IMAGE}" "${VBOOT_KEYS}" "${FLAGS_from}"
-
-rm "${TMP_IMAGE}"
-
-set +e
-trap - EXIT
diff --git a/bin/cros_update_bootloaders.sh b/bin/cros_update_bootloaders.sh
deleted file mode 100755
index 0067f9a..0000000
--- a/bin/cros_update_bootloaders.sh
+++ /dev/null
@@ -1,217 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Helper script that generates the legacy/efi bootloader partitions.
-# It does not populate the templates, but can update a loop device.
-
-. "/usr/lib/crosutils/common.sh"
-. "/usr/lib/installer/chromeos-common.sh"  # installer
-
-get_default_board
-
-# Flags.
-DEFINE_string arch "x86" \
-  "The boot architecture: arm or x86. (Default: x86)"
-# TODO(wad) once extlinux is dead, we can remove this.
-DEFINE_boolean install_syslinux ${FLAGS_FALSE} \
-  "Controls whether syslinux is run on 'to'. (Default: false)"
-DEFINE_string from "/tmp/boot" \
-  "Path the legacy bootloader templates are copied from. (Default /tmp/boot)"
-DEFINE_string to "/tmp/esp.img" \
-  "Path to esp image or ARM output MBR (Default: /tmp/esp.img)"
-DEFINE_integer to_offset 0 \
-  "Offset in bytes into 'to' if it is a file (Default: 0)"
-DEFINE_integer to_size -1 \
-  "Size in bytes of 'to' to use if it is a file. -1 is ignored. (Default: -1)"
-DEFINE_string vmlinuz "/tmp/vmlinuz" \
-  "Path to the vmlinuz file to use (Default: /tmp/vmlinuz)"
-# The kernel_partition and the kernel_cmdline each are used to supply
-# verified boot configuration: dm="".
-DEFINE_string kernel_partition "/tmp/vmlinuz.image" \
-  "Path to the signed kernel image. (Default: /tmp/vmlinuz.image)"
-DEFINE_string kernel_cmdline "" \
-  "Kernel commandline if no kernel_partition given. (Default: '')"
-DEFINE_string kernel_partition_offset "0" \
-  "Offset to the kernel partition [KERN-A] (Default: 0)"
-DEFINE_string kernel_partition_sectors "0" \
-  "Kernel partition sectors (Default: 0)"
-DEFINE_string usb_disk /dev/sdb3 \
-  "Path syslinux should use to do a usb (or arm!) boot. Default: /dev/sdb3"
-
-# Parse flags
-FLAGS "$@" || exit 1
-eval set -- "${FLAGS_ARGV}"
-set -e
-
-# If not provided by chromeos-common.sh, this will update all of the
-# boot loader files (both A and B) with the data pulled
-# from the kernel_partition.  The default boot target should
-# be set when the rootfs is stuffed.
-if ! type -p update_x86_bootloaders; then
-  update_x86_bootloaders() {
-    local old_root="$1"  # e.g., sd%D%P
-    local kernel_cmdline="$2"
-    local esp_fs_dir="$3"
-    local template_dir="$4"
-
-    # Pull out the dm="" values
-    dm_table=
-    if echo "$kernel_cmdline" | grep -q 'dm="'; then
-      dm_table=$(echo "$kernel_cmdline" | sed -s 's/.*dm="\([^"]*\)".*/\1/')
-    fi
-
-    # Rewrite grub table
-    grub_dm_table_a=${dm_table//${old_root}/\$linuxpartA}
-    grub_dm_table_b=${dm_table//${old_root}/\$linuxpartB}
-    sed -e "s|DMTABLEA|${grub_dm_table_a}|g" \
-        -e "s|DMTABLEB|${grub_dm_table_b}|g" \
-        "${template_dir}"/efi/boot/grub.cfg |
-        sudo dd of="${esp_fs_dir}"/efi/boot/grub.cfg
-
-    # Rewrite syslinux DM_TABLE
-    syslinux_dm_table_usb=${dm_table//\/dev\/${old_root}/${FLAGS_usb_disk}}
-    sed -e "s|DMTABLEA|${syslinux_dm_table_usb}|g" \
-        "${template_dir}"/syslinux/usb.A.cfg |
-        sudo dd of="${esp_fs_dir}"/syslinux/usb.A.cfg
-
-    syslinux_dm_table_a=${dm_table//\/dev\/${old_root}/HDROOTA}
-    sed -e "s|DMTABLEA|${syslinux_dm_table_a}|g" \
-        "${template_dir}"/syslinux/root.A.cfg |
-        sudo dd of="${esp_fs_dir}"/syslinux/root.A.cfg
-
-    syslinux_dm_table_b=${dm_table//\/dev\/${old_root}/HDROOTB}
-    sed -e "s|DMTABLEB|${syslinux_dm_table_b}|g" \
-        "${template_dir}"/syslinux/root.B.cfg |
-        sudo dd of="${esp_fs_dir}"/syslinux/root.B.cfg
-
-    # Copy the vmlinuz's into place for syslinux
-    sudo cp -f "${template_dir}"/vmlinuz "${esp_fs_dir}"/syslinux/vmlinuz.A
-    sudo cp -f "${template_dir}"/vmlinuz "${esp_fs_dir}"/syslinux/vmlinuz.B
-
-    # The only work left for the installer is to pick the correct defaults
-    # and replace HDROOTA and HDROOTB with the correct /dev/sd%D%P.
-  }
-fi
-
-ESP_DEV=
-if [[ ! -e "${FLAGS_to}" ]]; then
-  error "The ESP doesn't exist"
-  # This shouldn't happen.
-  info "Creating a new esp image at ${FLAGS_to}" anyway.
-  # Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI
-  # BIOS). We only need this for x86, but it's simpler and safer to keep the
-  # disk images the same for both x86 and ARM.
-  # NOTE: The size argument for mkfs.vfat is in 1024-byte blocks.
-  # We'll hard-code it to 16M for now.
-  ESP_BLOCKS=16384
-  /usr/sbin/mkfs.vfat -C "${FLAGS_to}" ${ESP_BLOCKS}
-  ESP_DEV=$(sudo losetup -f)
-  if [ -z "${ESP_DEV}" ]; then
-    die "No free loop devices."
-  fi
-  sudo losetup "${ESP_DEV}" "${FLAGS_to}"
-else
-  if [[ -f "${FLAGS_to}" ]]; then
-    ESP_DEV=$(sudo losetup -f)
-    if [ -z "${ESP_DEV}" ]; then
-      die "No free loop devices."
-    fi
-
-    esp_offset="--offset ${FLAGS_to_offset}"
-    esp_size="--sizelimit ${FLAGS_to_size}"
-    if [ ${FLAGS_to_size} -lt 0 ]; then
-      esp_size=
-    fi
-    sudo losetup ${esp_offset} ${esp_size} "${ESP_DEV}" "${FLAGS_to}"
-  else
-    # If it is a block device or something else, try to mount it anyway.
-    ESP_DEV="${FLAGS_to}"
-  fi
-fi
-
-ESP_FS_DIR=$(mktemp -d /tmp/esp.XXXXXX)
-cleanup() {
-  set +e
-  sudo umount "${ESP_FS_DIR}"
-  if [[ -n "${ESP_DEV}" && -z "${ESP_DEV//\/dev\/loop*}" ]]; then
-    sudo losetup -d  "${ESP_DEV}"
-  fi
-  rm -rf "${ESP_FS_DIR}"
-}
-trap cleanup EXIT
-sudo mount "${ESP_DEV}" "${ESP_FS_DIR}"
-
-if [[ "${FLAGS_arch}" = "x86" ]]; then
-  # Populate the EFI bootloader configuration
-  sudo mkdir -p "${ESP_FS_DIR}/efi/boot"
-  sudo cp "${FLAGS_from}"/efi/boot/bootx64.efi \
-          "${ESP_FS_DIR}/efi/boot/bootx64.efi"
-  sudo cp "${FLAGS_from}/efi/boot/grub.cfg" \
-          "${ESP_FS_DIR}/efi/boot/grub.cfg"
-
-  # Prepopulate the syslinux directories too and update for verified boot values
-  # after the rootfs work is done.
-  sudo mkdir -p "${ESP_FS_DIR}"/syslinux
-  sudo cp -r "${FLAGS_from}"/syslinux/. "${ESP_FS_DIR}"/syslinux
-
-  # Stage both kernels with the only one we built.
-  sudo cp -f "${FLAGS_vmlinuz}" "${ESP_FS_DIR}"/syslinux/vmlinuz.A
-  sudo cp -f "${FLAGS_vmlinuz}" "${ESP_FS_DIR}"/syslinux/vmlinuz.B
-
-  # Extract kernel flags
-  kernel_cfg=
-  old_root="sd%D%P"
-  if [[ -n "${FLAGS_kernel_cmdline}" ]]; then
-    info "Using supplied kernel_cmdline to update templates."
-    kernel_cfg="${FLAGS_kernel_cmdline}"
-  elif [[ -n "${FLAGS_kernel_partition}" ]]; then
-    info "Extracting the kernel command line from ${FLAGS_kernel_partition}"
-    kernel_cfg=$(dump_kernel_config "${FLAGS_kernel_partition}")
-  fi
-  update_x86_bootloaders "${old_root}" \
-                         "${kernel_cfg}" \
-                         "${ESP_FS_DIR}" \
-                         "${FLAGS_from}"
-
-  # Install the syslinux loader on the ESP image (part 12) so it is ready when
-  # we cut over from rootfs booting (extlinux).
-  if [[ ${FLAGS_install_syslinux} -eq ${FLAGS_TRUE} ]]; then
-    sudo umount "${ESP_FS_DIR}"
-    sudo syslinux -d /syslinux "${ESP_DEV}"
-  fi
-elif [[ "${FLAGS_arch}" = "arm" ]]; then
-  # Extract kernel flags
-  kernel_cfg=
-  old_root="sd%D%P"
-  if [[ -n "${FLAGS_kernel_cmdline}" ]]; then
-    info "Using supplied kernel_cmdline to update templates."
-    kernel_cfg="${FLAGS_kernel_cmdline}"
-  elif [[ -n "${FLAGS_kernel_partition}" ]]; then
-    info "Extracting the kernel command line from ${FLAGS_kernel_partition}"
-    kernel_cfg=$(dump_kernel_config "${kernel_partition}")
-  fi
-  dm_table=
-  if echo "$kernel_cfg" | grep -q 'dm="'; then
-    dm_table=$(echo "$kernel_cfg" | sed -s 's/.*dm="\([^"]*\)".*/\1/')
-  fi
-  # TODO(wad) assume usb_disk contains the arm boot location for now.
-  new_root="${FLAGS_usb_disk}"
-  info "Replacing dm slave devices with /dev/${new_root}"
-  dm_table="${dm_table//ROOT_DEV/\/dev\/${new_root}}"
-  dm_table="${dm_table//HASH_DEV/\/dev\/${new_root}}"
-
-  warn "FIXME: cannot replace root= here for the arm bootloader yet."
-  dm_table=""  # TODO(wad) Clear it until we can fix root=/dev/dm-0
-
-  # Copy u-boot script to ESP partition
-  if [ -r "${FLAGS_from}/boot-A.scr.uimg" ]; then
-    sudo mkdir -p "${ESP_FS_DIR}/u-boot"
-    sudo cp "${FLAGS_from}/boot-A.scr.uimg" \
-      "${ESP_FS_DIR}/u-boot/boot.scr.uimg"
-  fi
-fi
-
-set +e