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

Unified Diff: build_image

Issue 5704004: Zero free space on rootfs so it's more compressible for auto-update (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Address code review feedbacks Created 10 years 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: build_image
diff --git a/build_image b/build_image
index 722d704f96f5ad70ccc30b8af16b78afa1dad360..4280bddb9c6fd62439feb71a1de205c2499c5a6c 100755
--- a/build_image
+++ b/build_image
@@ -503,6 +503,14 @@ update_base_packages() {
-s "${STATEFUL_FS_DIR}" -e "${ESP_FS_DIR}"
}
+zero_free_space() {
+ local fs_mount_point=$1
+ info "Zeroing freespace in ${fs_mount_point}"
+ sudo dd if=/dev/zero of="${fs_mount_point}/filler" oflag=sync bs=4096 || true
+ sudo rm -f "${fs_mount_point}/filler"
+ sudo sync
+}
+
create_base_image() {
local image_name=$1
@@ -683,6 +691,10 @@ create_base_image() {
# Create an empty esp image to be updated in by update_bootloaders.sh.
${SCRIPTS_DIR}/create_esp.sh --to="${ESP_FS_IMG}"
+ # Zero rootfs free space to make it more compressible so auto-update
+ # payloads become smaller
+ zero_free_space "${ROOT_FS_DIR}"
+
cleanup
trap delete_prompt EXIT
« 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