signer: syncronize image packing to what we have in build image phase.

This follows steps we have in build image phase to have parity in image
  * Discard reapply selinex context. This looks not needed once
    re-signing should not change selinux context. Instead we could do
    similar to build image, pass file context to mksquashfs
  * Apply mksquashfs params based on image type, container/vm. This
    fixes proper block size and image compression algorithm
  * Remove old image before packing to prevent mksquashfs merge attempt

TEST=locally signed vm (kohaku) and container (hana): arc.Optin*,
     arc.Preopt*. Also checked final image size. With this CL it is
     reduced to 150Mb(vm) and very close to original image size
     (delta is less than 0.1%)

Signed-off-by: Yury Khmel <>
Change-Id: I7037bea68fc2969345a8fabc3c6a9b9b690f02d1
Reviewed-by: Yusuke Sato <>
Reviewed-by: George Engelbrecht <>
Tested-by: Yury Khmel <>
Auto-Submit: Yury Khmel <>
Commit-Queue: Yury Khmel <>
1 file changed