[v7,5/6] meta-isar: install expand-on-first-boot in most images and add space

Message ID 20221223085529.8835-6-henning.schild@siemens.com
State Accepted, archived
Headers show
Series expand-on-first-boot btrfs and CI testing | expand

Commit Message

Henning Schild Dec. 23, 2022, 8:55 a.m. UTC
Here we take the most common and generic images and add some empty space
at the end of then.
This will enable better interactive use of our example images since
people will have some space to install some more packages. While the
space seems fixed it really is open end if the mass storage happens to be
bigger, because we install expand-on-first-boot as well.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 meta-isar/conf/machine/qemuamd64.conf                       | 1 +
 meta-isar/conf/machine/virtualbox.conf                      | 1 +
 meta-isar/conf/machine/vmware.conf                          | 1 +
 meta-isar/conf/multiconfig/qemuarm-bookworm.conf            | 1 +
 meta-isar/scripts/lib/wic/canned-wks/expand-padding.wks.inc | 5 +++++
 meta-isar/scripts/lib/wic/canned-wks/sdimage-efi-btrfs.wks  | 2 ++
 meta-isar/scripts/lib/wic/canned-wks/sdimage-efi-sd.wks     | 2 ++
 meta-isar/scripts/lib/wic/canned-wks/sdimage-efi.wks        | 2 ++
 8 files changed, 15 insertions(+)
 create mode 100644 meta-isar/scripts/lib/wic/canned-wks/expand-padding.wks.inc

Comments

Roberto A. Foglietta Dec. 23, 2022, 3:43 p.m. UTC | #1
On Fri, 23 Dec 2022 at 09:55, Henning Schild <henning.schild@siemens.com> wrote:
>
> Here we take the most common and generic images and add some empty space
> at the end of then.
> This will enable better interactive use of our example images since
> people will have some space to install some more packages. While the
> space seems fixed it really is open end if the mass storage happens to be
> bigger, because we install expand-on-first-boot as well.

[...]

> +++ b/meta-isar/scripts/lib/wic/canned-wks/expand-padding.wks.inc
> @@ -0,0 +1,5 @@
> +# some extra space we put in the end after the last partition
> +# that allows testing expand-on-first-boot while at the same time
> +# making our images more useful because they have space to play around
> +
> +part --source empty --no-table --ondisk sda --size 256M

This approach works only if the expand last partition is installed and
works but only after the first boot into a device or a virtual
machine.

Otherwise this space will remain unavailable. For example, if someone
chroot into wic image for applying some changes s/he wants to test
before integrating into a recipe.

An alternative to add extra space into the disk, is to add it directly
into the rootfs with these two last options:

part / --source rootfs [...] --extra-space 1G --overhead-factor 1.2

I developed wicshell.sh in order to automatize the operations of
chroot into the .wic image and also sharing a folder with the host
which is always useful when ssh/scp is not available.

https://github.com/robang74/isar-nvidia-debian/blob/main/wicshell.sh

Moreover, I saw that there are .conf files for producing vmdk and ova
files. IMHO, a more general and flexible approach is to create these
files directly from the .wic image, like in my project

wicinst vmdk:$filename.vmdk [disk_size_in_gigabytes]

wicinst ovaf:$filename.ova [disk_size_in_gigabytes]

https://github.com/robang74/isar-nvidia-debian/blob/main/wicinst.sh

I hope you are going to take in consideration this approach to
simplify the access of these functionalities which are documented into
my project README.md

Every suggestion and critic in order to improve this approach will be welcome.

Best regards, R-
Roberto A. Foglietta Dec. 23, 2022, 7:11 p.m. UTC | #2
On Fri, 23 Dec 2022 at 16:43, Roberto A. Foglietta
<roberto.foglietta@gmail.com> wrote:

> Moreover, I saw that there are .conf files for producing vmdk and ova
> files. IMHO, a more general and flexible approach is to create these
> files directly from the .wic image, like in my project
>
> wicinst vmdk:$filename.vmdk [disk_size_in_gigabytes]
>
> wicinst ovaf:$filename.ova [disk_size_in_gigabytes]

However, some automatic test systems might prefer the .ova or .vmdk as
the ultimate output of the building without the necessity to call a
secondary script. I have not in mind anyone but I cannot exclude that
they exist. So, the two approaches can exist together as complementary
ones. Or possibly, their .conf allows a more tunable output than a
mere conversion which is easier to adopt during the development,
instead. IMHO.

> Best regards, R-

Patch

diff --git a/meta-isar/conf/machine/qemuamd64.conf b/meta-isar/conf/machine/qemuamd64.conf
index 6b40cb50702e..a1be5e5b113b 100644
--- a/meta-isar/conf/machine/qemuamd64.conf
+++ b/meta-isar/conf/machine/qemuamd64.conf
@@ -19,6 +19,7 @@  IMAGER_INSTALL_append_debian-bullseye = " ${SYSTEMD_BOOTLOADER_INSTALL} btrfs-pr
 IMAGE_PREINSTALL_append_debian-bullseye = " btrfs-progs"
 
 IMAGE_INSTALL += "sshd-regen-keys"
+IMAGE_INSTALL += "expand-on-first-boot"
 
 QEMU_ARCH ?= "x86_64"
 QEMU_MACHINE ?= "q35"
diff --git a/meta-isar/conf/machine/virtualbox.conf b/meta-isar/conf/machine/virtualbox.conf
index de3d04c3c4b4..8c3e9bacbf9b 100644
--- a/meta-isar/conf/machine/virtualbox.conf
+++ b/meta-isar/conf/machine/virtualbox.conf
@@ -10,6 +10,7 @@  KERNEL_NAME ?= "amd64"
 WKS_FILE ?= "sdimage-efi"
 
 IMAGER_INSTALL += "${GRUB_BOOTLOADER_INSTALL}"
+IMAGE_INSTALL += "expand-on-first-boot"
 
 VMDK_SUBFORMAT = "monolithicSparse"
 IMAGE_FSTYPES ?= "ova"
diff --git a/meta-isar/conf/machine/vmware.conf b/meta-isar/conf/machine/vmware.conf
index fba639b19350..42503374742c 100644
--- a/meta-isar/conf/machine/vmware.conf
+++ b/meta-isar/conf/machine/vmware.conf
@@ -12,6 +12,7 @@  WKS_FILE ?= "sdimage-efi"
 IMAGER_INSTALL += "${GRUB_BOOTLOADER_INSTALL}"
 
 OVF_TEMPLATE_FILE ?= "vm-img-vmware.ovf.tmpl"
+IMAGE_INSTALL += "expand-on-first-boot"
 
 VMDK_SUBFORMAT = "streamOptimized"
 IMAGE_FSTYPES ?= "ova"
diff --git a/meta-isar/conf/multiconfig/qemuarm-bookworm.conf b/meta-isar/conf/multiconfig/qemuarm-bookworm.conf
index 126935b06fda..0b9ecb664545 100644
--- a/meta-isar/conf/multiconfig/qemuarm-bookworm.conf
+++ b/meta-isar/conf/multiconfig/qemuarm-bookworm.conf
@@ -7,3 +7,4 @@  IMAGE_FSTYPES_append = " wic"
 WKS_FILE ?= "sdimage-efi-sd"
 
 IMAGER_INSTALL += "${SYSTEMD_BOOTLOADER_INSTALL}"
+IMAGE_INSTALL += "expand-on-first-boot"
diff --git a/meta-isar/scripts/lib/wic/canned-wks/expand-padding.wks.inc b/meta-isar/scripts/lib/wic/canned-wks/expand-padding.wks.inc
new file mode 100644
index 000000000000..701fba764176
--- /dev/null
+++ b/meta-isar/scripts/lib/wic/canned-wks/expand-padding.wks.inc
@@ -0,0 +1,5 @@ 
+# some extra space we put in the end after the last partition
+# that allows testing expand-on-first-boot while at the same time
+# making our images more useful because they have space to play around
+
+part --source empty --no-table --ondisk sda --size 256M
diff --git a/meta-isar/scripts/lib/wic/canned-wks/sdimage-efi-btrfs.wks b/meta-isar/scripts/lib/wic/canned-wks/sdimage-efi-btrfs.wks
index 014ecca61f0c..e22dba2f83f8 100644
--- a/meta-isar/scripts/lib/wic/canned-wks/sdimage-efi-btrfs.wks
+++ b/meta-isar/scripts/lib/wic/canned-wks/sdimage-efi-btrfs.wks
@@ -6,4 +6,6 @@  part /boot --source bootimg-efi-isar --sourceparams "loader=systemd-boot" --ondi
 
 part / --source rootfs --ondisk sda --fstype btrfs --label platform --align 1024 --use-uuid --exclude-path boot/
 
+include expand-padding.wks.inc
+
 bootloader --ptable gpt --timeout 3 --append "rootwait console=ttyS0,115200 console=tty0"
diff --git a/meta-isar/scripts/lib/wic/canned-wks/sdimage-efi-sd.wks b/meta-isar/scripts/lib/wic/canned-wks/sdimage-efi-sd.wks
index 754fbc46f8e4..7fe2953f5ff2 100644
--- a/meta-isar/scripts/lib/wic/canned-wks/sdimage-efi-sd.wks
+++ b/meta-isar/scripts/lib/wic/canned-wks/sdimage-efi-sd.wks
@@ -6,4 +6,6 @@  part /boot --source bootimg-efi-isar --sourceparams "loader=systemd-boot" --ondi
 
 part / --source rootfs --ondisk sda --fstype ext4 --mkfs-extraopts "-T default" --label platform --align 1024 --use-uuid --exclude-path boot/
 
+include expand-padding.wks.inc
+
 bootloader --ptable gpt --timeout 3 --append "rootwait console=ttyS0,115200 console=tty0"
diff --git a/meta-isar/scripts/lib/wic/canned-wks/sdimage-efi.wks b/meta-isar/scripts/lib/wic/canned-wks/sdimage-efi.wks
index f3addbc7515d..80c3a5359b1f 100644
--- a/meta-isar/scripts/lib/wic/canned-wks/sdimage-efi.wks
+++ b/meta-isar/scripts/lib/wic/canned-wks/sdimage-efi.wks
@@ -6,4 +6,6 @@  part /boot --source bootimg-efi-isar --sourceparams "loader=grub-efi" --ondisk s
 
 part / --source rootfs --ondisk sda --fstype ext4 --mkfs-extraopts "-T default" --label platform --align 1024 --use-uuid --exclude-path boot/
 
+include expand-padding.wks.inc
+
 bootloader --ptable gpt --timeout 3 --append "rootwait console=ttyS0,115200 console=tty0"