Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Cal Sullivan <california.l.sullivan@intel.com>
To: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] initrdscripts: init-install(-efi).sh: don't assume 20M boot partition
Date: Mon, 2 Apr 2018 18:28:17 -0700	[thread overview]
Message-ID: <79202746-ae4e-fb47-9591-98f79ce0fc75@intel.com> (raw)
In-Reply-To: <20180403011517.22772-1-california.l.sullivan@intel.com>

I forgot to deal with RDEPENDS here. With the addition of du the script 
will depend on ${VIRTUAL-RUNTIME_base-utils}. This happens to be present 
in core-image-minimal-initramfs, so it worked for me, but could fail for 
others using their own initramfs.

I'll send a v2 adding to RDEPENDS on the recipes that use this.

Thanks,
Cal

On 04/02/2018 06:15 PM, California Sullivan wrote:
> 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.
>
> [YOCTO #12583].
>
> Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
> ---
>   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(-)
>
> diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
> index 43b75b01751..82b0aa819e3 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 aa9476660ba..28e8f09d19d 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



      reply	other threads:[~2018-04-03  1:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-03  1:15 [PATCH] initrdscripts: init-install(-efi).sh: don't assume 20M boot partition California Sullivan
2018-04-03  1:28 ` Cal Sullivan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=79202746-ae4e-fb47-9591-98f79ce0fc75@intel.com \
    --to=california.l.sullivan@intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox