Index: bin/cros_make_image_bootable |
diff --git a/bin/cros_make_image_bootable b/bin/cros_make_image_bootable |
index 3517c85ec8cdbd38143b2784d3652815fd1977e2..a2b4a1e3ddc77db145948b7441b7ad1ce9a8d883 100755 |
--- a/bin/cros_make_image_bootable |
+++ b/bin/cros_make_image_bootable |
@@ -250,6 +250,24 @@ make_image_bootable() { |
-s "${FLAGS_statefulfs_mountpoint}" |
} |
+verify_image_rootfs() { |
+ local image=$1 |
+ local rootfs_offset="$(partoffset ${image} 3)" |
+ local rootfs_size="$(partsize ${image} 3)" |
+ |
+ local rootfs_tmp_file=$(mktemp) |
+ trap "rm ${rootfs_tmp_file}" EXIT |
+ sudo dd if="${image}" of="${rootfs_tmp_file}" bs=512 skip="${rootfs_offset}" |
+ |
+ # This flips the read-only compatibility flag, so that |
+ # e2fsck does not complain about unknown file system capabilities. |
+ enable_rw_mount ${rootfs_tmp_file} |
sosa
2010/11/24 20:42:17
Want quotes around this since you put it elsewhere
gauravsh
2010/11/24 20:46:46
Done.
|
+ info "Running e2fsck to check root file system for errors" |
+ sudo e2fsck -fn "${rootfs_tmp_file}" || |
+ die "Root file system has errors, please ensure boot.desc and/or \ |
+command line parameters are correct" |
+} |
+ |
# Use default of current image location if the output dir doesn't exist. |
if [ ! -d ${FLAGS_output_dir} ]; then |
warn "Output dir not found, using ${IMAGE_DIR}." |
@@ -266,6 +284,7 @@ mkdir -p ${FLAGS_statefulfs_mountpoint} |
mkdir -p ${FLAGS_espfs_mountpoint} |
make_image_bootable ${IMAGE} |
sosa
2010/11/24 20:42:17
Note sure why calls to both of these aren't quoted
gauravsh
2010/11/24 20:46:46
Done.
|
+verify_image_rootfs ${IMAGE} |
if [ ${FLAGS_cleanup_dirs} -eq ${FLAGS_TRUE} ]; then |
rmdir ${FLAGS_rootfs_mountpoint} |