base_image_util: remove HWDB files in the images
the /lib/udev/hwdb.d/*.hwdb and /etc/udev/hwdb.d/*.hwdb are used to
generate the binary udev database in /etc/udev/hwdb.bin.
The generation happens at build time and those files don't seem to be
used at runtime, remove them to save space in the rootfs.
We cannot use the INSTALL_MASK to skip them as we are running a last
pass of hwdb.bin generation during the image generation.
BUG=b:179950282
TEST=manual, on Jinlon, verify rootfs content and try lsusb.
Change-Id: I0d01039a3b393e33e769417f6e347a714a460264
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/2696332
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/build_library/base_image_util.sh b/build_library/base_image_util.sh
index 638be6b..d900337 100755
--- a/build_library/base_image_util.sh
+++ b/build_library/base_image_util.sh
@@ -313,6 +313,12 @@
# Run udevadm to generate /etc/udev/hwdb.bin
run_udevadm_hwdb "${root_fs_dir}"
+ # Clean-up the *.hwdb, we don't need them at runtime
+ # but we cannot put them in the INSTALL_MASK else
+ # the hwdb.bin generation above won't do anything.
+ sudo rm -rf "${root_fs_dir}/lib/udev/hwdb.d" \
+ "${root_fs_dir}/etc/udev/hwdb.d" || :
+
# File searches /usr/share even if it's installed in /usr/local. Add a
# symlink so it works in dev images & when using dev_install. Unless it's
# already installed. https://crbug.com/210493