]> code.ossystems Code Review - openembedded-core.git/commitdiff
initrdscripts: init-install(-efi).sh: don't assume 20M boot partition
authorCalifornia Sullivan <california.l.sullivan@intel.com>
Tue, 3 Apr 2018 01:40:04 +0000 (18:40 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 3 Apr 2018 09:53:49 +0000 (10:53 +0100)
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 <california.l.sullivan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/initrdscripts/files/init-install-efi.sh
meta/recipes-core/initrdscripts/files/init-install.sh
meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb
meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
meta/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bb
meta/recipes-core/initrdscripts/initramfs-module-install_1.0.bb

index 43b75b017518726506a8786d7673bff39b9bfcfe..82b0aa819e3844ebeec16a08592905f5d657b0ff 100644 (file)
@@ -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
index aa9476660ba362e9d4daa134675efe081a3c0395..28e8f09d19d20e154a299d9fe8bd03314c971658 100644 (file)
@@ -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
index 2a7f84ddc8fdea088ea4b4fca1395a717c020708..f588a1077bfc852de9fc411eae8acf4f5cdc7a5c 100644 (file)
@@ -5,7 +5,7 @@ SRC_URI = "file://init-install-efi.sh"
 
 PR = "r1"
 
-RDEPENDS_${PN} = "parted e2fsprogs-mke2fs dosfstools util-linux-blkid"
+RDEPENDS_${PN} = "parted e2fsprogs-mke2fs dosfstools util-linux-blkid ${VIRTUAL-RUNTIME_base-utils}"
 
 S = "${WORKDIR}"
 
index a553a0d8ba5e7057f91cc9789f097462e8a56ddf..9222d57c1aeb1bf65946ced183653c8a7ba87564 100644 (file)
@@ -7,7 +7,7 @@ PR = "r9"
 
 S = "${WORKDIR}"
 
-RDEPENDS_${PN} = "grub parted e2fsprogs-mke2fs util-linux-blkid"
+RDEPENDS_${PN} = "grub parted e2fsprogs-mke2fs util-linux-blkid ${VIRTUAL-RUNTIME_base-utils}"
 
 do_install() {
         install -m 0755 ${WORKDIR}/init-install.sh ${D}/install.sh
index 1e7f76fd5652d4d58e38a74a6a5956b4383620a7..78a61cde25f26256ca35595310d132a0b6bb6e6f 100644 (file)
@@ -1,7 +1,7 @@
 SUMMARY = "initramfs-framework module for EFI installation option"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
-RDEPENDS_${PN} = "initramfs-framework-base parted e2fsprogs-mke2fs dosfstools util-linux-blkid"
+RDEPENDS_${PN} = "initramfs-framework-base parted e2fsprogs-mke2fs dosfstools util-linux-blkid ${VIRTUAL-RUNTIME_base-utils}"
 
 PR = "r4"
 
index 02b69f37a4d474a4a68b3ec5596a3330ba570f7f..04e90cd302c411be5545a2a0afcb69d7be1b49a6 100644 (file)
@@ -1,7 +1,7 @@
 SUMMARY = "initramfs-framework module for installation option"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
-RDEPENDS_${PN} = "initramfs-framework-base grub parted e2fsprogs-mke2fs util-linux-blkid"
+RDEPENDS_${PN} = "initramfs-framework-base grub parted e2fsprogs-mke2fs util-linux-blkid ${VIRTUAL-RUNTIME_base-utils}"
 
 # The same restriction as grub
 COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*)-(linux.*|freebsd.*)'