From 2de354af77fe2737374845afe20f963a24f68cb4 Mon Sep 17 00:00:00 2001 From: Amin Hassani Date: Tue, 2 Jan 2018 18:03:31 -0800 Subject: image_signing: fix zeroing free space We are not zeroing the free space properly before signing official images. This patch fixes it by using fstrim instead of dd. More info can be found in CL:751809. BRANCH=none BUG=chromium:780291 TEST=used sign_official_build.sh to sign two recovery images (these images produced file) with dev keys. Then generated delta update between the two new images. This time there was no file between the two images. Change-Id: Ib97fb206f5c8bcfd97c43d075990c7fcdaad6f7e Reviewed-on: https://chromium-review.googlesource.com/848237 Commit-Ready: Amin Hassani Tested-by: Amin Hassani Reviewed-by: Mike Frysinger --- scripts/image_signing/strip_boot_from_image.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/image_signing/strip_boot_from_image.sh b/scripts/image_signing/strip_boot_from_image.sh index 5e650af6..2ff85e0a 100755 --- a/scripts/image_signing/strip_boot_from_image.sh +++ b/scripts/image_signing/strip_boot_from_image.sh @@ -31,11 +31,7 @@ zero_free_space() { local rootfs="$1" info "Zeroing freespace in ${rootfs}" - # dd is a silly thing and will produce a "No space left on device" message - # that cannot be turned off and is confusing to unsuspecting victims. - ( sudo dd if=/dev/zero of="${rootfs}/filler" bs=4096 conv=fdatasync \ - status=noxfer || true ) 2>&1 | grep -v "No space left on device" - sudo rm "${rootfs}/filler" + sudo fstrim -v "${rootfs}" } -- cgit v1.2.1