mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-08 16:41:55 +00:00
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 <zero-space> file) with dev keys. Then generated delta update between the two new images. This time there was no <zero-space> file between the two images. Change-Id: Ib97fb206f5c8bcfd97c43d075990c7fcdaad6f7e Reviewed-on: https://chromium-review.googlesource.com/848237 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
@@ -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}"
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user