Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(603)

Unified Diff: bin/cros_make_image_bootable

Issue 5216003: cros_make_image_bootable: Do a final sanity check on the rootfs by running e2fsck (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git@master
Patch Set: new change Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/cros_make_image_bootable
diff --git a/bin/cros_make_image_bootable b/bin/cros_make_image_bootable
index 3517c85ec8cdbd38143b2784d3652815fd1977e2..e9333e7284d141ad4e0c006c0d7f8e4f55f9309a 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
sosa 2010/11/24 18:16:15 Use {} around var names to be consistent with rest
gauravsh 2010/11/24 19:40:18 Done.
+ sudo dd if="$image" of="$rootfs_tmp_file" bs=512 skip="$rootfs_offset"
+
+ # This flips the read-inly compatibility flag, so that
sosa 2010/11/24 18:16:15 read-only*
gauravsh 2010/11/24 19:40:18 Done.
+ # e2fsck does not complain about unknown file system capabilities.
+ enable_rw_mount $rootfs_tmp_file
+ 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 \
sosa 2010/11/24 18:16:15 Indent 2 here
gauravsh 2010/11/24 19:40:18 Done.
+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}
+verify_image_rootfs ${IMAGE}
if [ ${FLAGS_cleanup_dirs} -eq ${FLAGS_TRUE} ]; then
rmdir ${FLAGS_rootfs_mountpoint}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698