Skip to content

Commit

Permalink
Remove unnecessary GRUB userspace tools and other files (#3887)
Browse files Browse the repository at this point in the history
Because the OTA hooks interact with GRUB environment using grub-editenv, we
have BR2_TARGET_GRUB2_INSTALL_TOOLS enabled. However, that brings massive bloat
of files that are never used in HAOS, as it also installs many other binaries,
GRUB modules and translations.

As it's not possible to configure what gets installed in grub2 package, remove
the undesired files in the post-build function. This brings savings of ~8.5MB
of space in the root partition.
  • Loading branch information
sairon authored Feb 20, 2025
1 parent e158fbc commit 664ae4e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions buildroot-external/scripts/rootfs-layer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ function fix_rootfs() {

# Use systemd-resolved for Host OS resolve
sed -i '/^hosts:/ {/resolve/! s/files/resolve [!UNAVAIL=return] files/}' "${TARGET_DIR}/etc/nsswitch.conf"

# Remove unnecessary grub userspace tools, config, modules and translations
find "${TARGET_DIR}"/usr/{,s}bin -name "grub-*" -not -name "grub-editenv" -delete
rm -rf "${TARGET_DIR}/etc/grub.d"
rm -rf "${TARGET_DIR}/usr/lib/grub"
if [ -d "${TARGET_DIR}/share/locale" ]; then
find "${TARGET_DIR}/share/locale" -name "grub.mo" -delete
find "${TARGET_DIR}/share/locale" -type d -empty -delete
fi
}


Expand Down

0 comments on commit 664ae4e

Please sign in to comment.