From 2ca601bef44a07512c93b8452cf9001dce402617 Mon Sep 17 00:00:00 2001 From: California Sullivan Date: Mon, 2 Apr 2018 18:40:04 -0700 Subject: initrdscripts: init-install(-efi).sh: don't assume 20M boot partition With multi kernel support in the installer we can exceed this limit. Calculate a sane size by checking the size of the original boot partition minus some objects we know won't be installed, plus some extra space for users. In addition, in the common case where only one small kernel is present to be installed, we actually get a smaller boot partition with less wasted space. Also add VIRTUAL-RUNTIME_base-utils to RDEPENDS where these scripts are used, as they're needed for the du command. [YOCTO #12583]. Signed-off-by: California Sullivan Signed-off-by: Richard Purdie --- meta/recipes-core/initrdscripts/files/init-install-efi.sh | 15 +++++++++++++-- meta/recipes-core/initrdscripts/files/init-install.sh | 15 +++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) (limited to 'meta/recipes-core/initrdscripts/files') diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh index 43b75b0175..82b0aa819e 100644 --- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh +++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh @@ -8,8 +8,19 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin -# We need 20 Mb for the boot partition -boot_size=20 +# figure out how big of a boot partition we need +boot_size=$(du -ms /run/media/$1/ | awk '{print $1}') +# remove rootfs.img ($2) from the size if it exists, as its not installed to /boot +if [ -e /run/media/$1/$2 ]; then + boot_size=$(( boot_size - $( du -ms /run/media/$1/$2 | awk '{print $1}') )) +fi +# remove initrd from size since its not currently installed +if [ -e /run/media/$1/initrd ]; then + boot_size=$(( boot_size - $( du -ms /run/media/$1/initrd | awk '{print $1}') )) +fi +# add 10M to provide some extra space for users and account +# for rounding in the above subtractions +boot_size=$(( boot_size + 10 )) # 5% for swap swap_ratio=5 diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh index aa9476660b..28e8f09d19 100644 --- a/meta/recipes-core/initrdscripts/files/init-install.sh +++ b/meta/recipes-core/initrdscripts/files/init-install.sh @@ -7,8 +7,19 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin -# We need 20 Mb for the boot partition -boot_size=20 +# figure out how big of a boot partition we need +boot_size=$(du -ms /run/media/$1/ | awk '{print $1}') +# remove rootfs.img ($2) from the size if it exists, as its not installed to /boot +if [ -e /run/media/$1/$2 ]; then + boot_size=$(( boot_size - $( du -ms /run/media/$1/$2 | awk '{print $1}') )) +fi +# remove initrd from size since its not currently installed +if [ -e /run/media/$1/initrd ]; then + boot_size=$(( boot_size - $( du -ms /run/media/$1/initrd | awk '{print $1}') )) +fi +# add 10M to provide some extra space for users and account +# for rounding in the above subtractions +boot_size=$(( boot_size + 10 )) # 5% for the swap swap_ratio=5 -- cgit 1.2.3-korg