[PATCH] isar-installer: Added option to add additional kernel cmdline arguments for isar-image-installer.

28 views
Skip to first unread message

alexander...@siemens.com

unread,
Dec 11, 2024, 4:35:55 AM12/11/24
to isar-...@googlegroups.com, Alexander Heinisch
From: Alexander Heinisch <alexander...@siemens.com>

In combination with unattended mode this allows to specify
several settings like target device, target image path, aso.
to be specified during buildtime.

Signed-off-by: Alexander Heinisch <alexander...@siemens.com>
---
meta-isar/recipes-core/images/isar-image-installer.bb | 1 +
meta-isar/scripts/lib/wic/canned-wks/installer-efi.wks.in | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta-isar/recipes-core/images/isar-image-installer.bb b/meta-isar/recipes-core/images/isar-image-installer.bb
index dfce311a..a325ab9f 100644
--- a/meta-isar/recipes-core/images/isar-image-installer.bb
+++ b/meta-isar/recipes-core/images/isar-image-installer.bb
@@ -10,6 +10,7 @@ DESCRIPTION = "Example of a ISAR based Installer Image"
# Use variable to switch easily to another wks
INSTALLER_WKS_FILE ??= "installer-efi.wks.in"
WKS_FILE = "${INSTALLER_WKS_FILE}"
+ADDITIONAL_KERNEL_CMDLINE ??= ""
IMAGER_INSTALL:wic:append = " ${SYSTEMD_BOOTLOADER_INSTALL}"

IMAGE_INSTALL += "deploy-image-service"
diff --git a/meta-isar/scripts/lib/wic/canned-wks/installer-efi.wks.in b/meta-isar/scripts/lib/wic/canned-wks/installer-efi.wks.in
index be8127cb..ecc6adbb 100644
--- a/meta-isar/scripts/lib/wic/canned-wks/installer-efi.wks.in
+++ b/meta-isar/scripts/lib/wic/canned-wks/installer-efi.wks.in
@@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: MIT

-bootloader --ptable gpt --timeout 0 --append "rootwait console=ttyS0,115200 console=tty0 earlyprintk"
+bootloader --ptable gpt --timeout 0 --append "rootwait console=ttyS0,115200 console=tty0 earlyprintk ${ADDITIONAL_KERNEL_CMDLINE}"
part /boot --source bootimg-efi-isar --sourceparams "loader=systemd-boot" --label efi --part-type EF00 --align 1024 --use-uuid
part / --source rootfs --fstype ext4 --exclude-path=install --label installroot --align 1024 --use-uuid
part /install --source rootfs --change-directory=install --label INSTALLDATA --size 4G --fstype=vfat --use-uuid --align 1024
--
2.43.0

Florian Bezdeka

unread,
Dec 11, 2024, 4:49:19 AM12/11/24
to alexander...@siemens.com, isar-...@googlegroups.com
On Wed, 2024-12-11 at 10:35 +0100, alexander.heinisch via isar-users
wrote:
> From: Alexander Heinisch <alexander...@siemens.com>
>
> In combination with unattended mode this allows to specify
> several settings like target device, target image path, aso.
> to be specified during buildtime.
>
> Signed-off-by: Alexander Heinisch <alexander...@siemens.com>
> ---
> meta-isar/recipes-core/images/isar-image-installer.bb | 1 +
> meta-isar/scripts/lib/wic/canned-wks/installer-efi.wks.in | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/meta-isar/recipes-core/images/isar-image-installer.bb b/meta-isar/recipes-core/images/isar-image-installer.bb
> index dfce311a..a325ab9f 100644
> --- a/meta-isar/recipes-core/images/isar-image-installer.bb
> +++ b/meta-isar/recipes-core/images/isar-image-installer.bb
> @@ -10,6 +10,7 @@ DESCRIPTION = "Example of a ISAR based Installer Image"
> # Use variable to switch easily to another wks
> INSTALLER_WKS_FILE ??= "installer-efi.wks.in"
> WKS_FILE = "${INSTALLER_WKS_FILE}"
> +ADDITIONAL_KERNEL_CMDLINE ??= ""

As this is specific for the installer image:

Should we prefix the variable with INSTALLER_ (or something similar?)

Anton Mikanovich

unread,
Dec 11, 2024, 4:53:45 AM12/11/24
to isar-...@googlegroups.com, alexander...@siemens.com
11/12/2024 11:35, alexander.heinisch via isar-users wrote:
> From: Alexander Heinisch <alexander...@siemens.com>
>
> In combination with unattended mode this allows to specify
> several settings like target device, target image path, aso.
> to be specified during buildtime.
>
> Signed-off-by: Alexander Heinisch <alexander...@siemens.com>

Hello Alexander,

Can you also add any kind of usage example?

Heinisch, Alexander

unread,
Dec 11, 2024, 6:52:43 AM12/11/24
to Bezdeka, Florian, isar-...@googlegroups.com
>On Wed, 2024-12-11 at 10:35 +0100, alexander.heinisch via isar-users
>wrote:
>> From: Alexander Heinisch <alexander...@siemens.com>
>>
>> In combination with unattended mode this allows to specify several
>> settings like target device, target image path, aso.
>> to be specified during buildtime.
>>
>> Signed-off-by: Alexander Heinisch <alexander...@siemens.com>
>> ---
>> meta-isar/recipes-core/images/isar-image-installer.bb | 1 +
>> meta-isar/scripts/lib/wic/canned-wks/installer-efi.wks.in | 2 +-
>> 2 files changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta-isar/recipes-core/images/isar-image-installer.bb
>> b/meta-isar/recipes-core/images/isar-image-installer.bb
>> index dfce311a..a325ab9f 100644
>> --- a/meta-isar/recipes-core/images/isar-image-installer.bb
>> +++ b/meta-isar/recipes-core/images/isar-image-installer.bb
>> @@ -10,6 +10,7 @@ DESCRIPTION = "Example of a ISAR based Installer Image"
>> # Use variable to switch easily to another wks INSTALLER_WKS_FILE
>> ??= "installer-efi.wks.in"
>> WKS_FILE = "${INSTALLER_WKS_FILE}"
>> +ADDITIONAL_KERNEL_CMDLINE ??= ""
>
>As this is specific for the installer image:
>
>Should we prefix the variable with INSTALLER_ (or something similar?)

While having such a prefix makes it more clear to the user,
most of the user's setup installer image in a multiconfig env.
Thus, there shouldn't be too much conflict/confusion.

On the other hand, once we have unique `ADDITIONAL_KERNEL_CMDLINE`
it allows for easier swapping of wks files once adoption of
`--append="...${ADDITIONAL_KERNEL_CMDLINE}"` is available for multiple wks files.

e.g. a signed installer image, could reuse parts of a generic wks for signed ukis
only adding the additional `/install`.

Maybe that's YAGNI, so I am completely open to adding the prefix as well,
those were just the thoughts/concerns I had in mind when coming up with the unified approach.

BR Alexander

Heinisch, Alexander

unread,
Dec 11, 2024, 6:57:11 AM12/11/24
to Anton Mikanovich, isar-...@googlegroups.com
You can find some examples here: https://github.com/ilbers/isar/commit/4c66faf1110ded164440df8108effef7e9a52d34

- installer.unattended
- installer.image.uri ...file name of the image to be installed (parameter name uri chosen since we plan to support download of images in upcoming patches)
- installer.target.dev ...target device name (e.g. /dev/sda) for the image to be installed to
- installer.target.overwrite ...strategy how to handle target devices not empty (possible values: OVERWRITE - overwrite data on target | ABORT - abort installation if target not empty)

I will put the link and a short description in the commit message!
Since, I plan to push further changes for the target bootstrapping,
I'd prefer to update the documentation, once that's done.

BR Alexander

>

Anton Mikanovich

unread,
Dec 11, 2024, 7:18:08 AM12/11/24
to Heinisch, Alexander, isar-...@googlegroups.com
11/12/2024 13:57, Heinisch, Alexander wrote:
>> Hello Alexander,
>>
>> Can you also add any kind of usage example?
> You can find some examples here: https://github.com/ilbers/isar/commit/4c66faf1110ded164440df8108effef7e9a52d34
>
> - installer.unattended
> - installer.image.uri ...file name of the image to be installed (parameter name uri chosen since we plan to support download of images in upcoming patches)
> - installer.target.dev ...target device name (e.g. /dev/sda) for the image to be installed to
> - installer.target.overwrite ...strategy how to handle target devices not empty (possible values: OVERWRITE - overwrite data on target | ABORT - abort installation if target not empty)
>
> I will put the link and a short description in the commit message!
> Since, I plan to push further changes for the target bootstrapping,
> I'd prefer to update the documentation, once that's done.
>
> BR Alexander

Thanks, but I mean the usage of ADDITIONAL_KERNEL_CMDLINE with any
sample target, so we will have all the way of that variables starting
from image generation to have them handled in handle-config.sh.
This will help to keep tracking this functionality for regressions.

alexander...@siemens.com

unread,
Dec 11, 2024, 11:28:14 AM12/11/24
to isar-...@googlegroups.com, Alexander Heinisch
From: Alexander Heinisch <alexander...@siemens.com>

In combination with unattended mode this allows to specify
several settings like target device, target image path, aso.
to be specified during buildtime.

Signed-off-by: Alexander Heinisch <alexander...@siemens.com>
---
meta-isar/recipes-core/images/isar-image-installer.bb | 1 +
meta-isar/scripts/lib/wic/canned-wks/installer-efi.wks.in | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta-isar/recipes-core/images/isar-image-installer.bb b/meta-isar/recipes-core/images/isar-image-installer.bb
index dfce311a..a325ab9f 100644
--- a/meta-isar/recipes-core/images/isar-image-installer.bb
+++ b/meta-isar/recipes-core/images/isar-image-installer.bb
@@ -10,6 +10,7 @@ DESCRIPTION = "Example of a ISAR based Installer Image"
# Use variable to switch easily to another wks
INSTALLER_WKS_FILE ??= "installer-efi.wks.in"
WKS_FILE = "${INSTALLER_WKS_FILE}"
+ADDITIONAL_KERNEL_CMDLINE ??= ""

alexander...@siemens.com

unread,
Dec 12, 2024, 7:53:59 AM12/12/24
to isar-...@googlegroups.com, ami...@ilbers.de, Alexander Heinisch
From: Alexander Heinisch <alexander...@siemens.com>

Made isar-image-installer's unattended mode configurable.

isar-image-installer allows to specify several parameters like:
- installer.unattended
- installer.image.uri ...file name of the image to be installed (parameter name uri chosen since we plan to support download of images in upcoming patches)
- installer.target.dev ...target device name (e.g. /dev/sda) for the image to be installed to
- installer.target.overwrite ...strategy how to handle target devices not empty (possible values: OVERWRITE - overwrite data on target | ABORT - abort installation if target not empty)
to execute image deployment in "unattended" mode.

Thus, I extended the image to allow specification of those parameters and added
options to configure those via kconfig menu.

This resolves the discussions from https://groups.google.com/g/isar-users/c/bngoAN6FwV8

Alexander Heinisch (2):
isar-installer: Added option to add additional kernel cmdline
arguments for isar-image-installer.
isar-installer: Added config options for isar-image-installer
unattended mode.

kas/image/Kconfig | 37 +++++++++++++++++++
.../images/isar-image-installer.bb | 11 ++++++
.../lib/wic/canned-wks/installer-efi.wks.in | 2 +-
3 files changed, 49 insertions(+), 1 deletion(-)

---

Changes in v2:
- Added kconfig menu options to setup unattended mode.

--
2.43.0

alexander...@siemens.com

unread,
Dec 12, 2024, 7:54:12 AM12/12/24
to isar-...@googlegroups.com, ami...@ilbers.de, Alexander Heinisch
From: Alexander Heinisch <alexander...@siemens.com>

In combination with unattended mode this allows to specify
several settings like target device, target image path, aso.
to be specified during buildtime.

isar-image-installer allows to specify several parameters like:
- installer.unattended
- installer.image.uri ...file name of the image to be installed (parameter name uri chosen since we plan to support download of images in upcoming patches)
- installer.target.dev ...target device name (e.g. /dev/sda) for the image to be installed to
- installer.target.overwrite ...strategy how to handle target devices not empty (possible values: OVERWRITE - overwrite data on target | ABORT - abort installation if target not empty)
to execute image deployment in "unattended" mode.

alexander...@siemens.com

unread,
Dec 12, 2024, 7:54:20 AM12/12/24
to isar-...@googlegroups.com, ami...@ilbers.de, Alexander Heinisch
From: Alexander Heinisch <alexander...@siemens.com>

Signed-off-by: Alexander Heinisch <alexander...@siemens.com>
---
kas/image/Kconfig | 37 +++++++++++++++++++
.../images/isar-image-installer.bb | 10 +++++
2 files changed, 47 insertions(+)

diff --git a/kas/image/Kconfig b/kas/image/Kconfig
index e4f64dcc..0c0a664c 100644
--- a/kas/image/Kconfig
+++ b/kas/image/Kconfig
@@ -67,6 +67,43 @@ config INSTALLER_TARGET_IMAGE
default "isar-image-base" if INSTALL_IMAGE_BASE
default "isar-image-base" if INSTALL_IMAGE_DEBUG

+config INSTALL_UNATTENDED
+ bool "Run installer unattended"
+
+if INSTALL_UNATTENDED
+
+config INSTALLER_UNATTENDED
+ string
+ default "1" if INSTALL_UNATTENDED
+ default ""
+
+config INSTALLER_TARGET_DEVICE
+ string "Target device to deploy"
+ default "/dev/sda"
+ help
+ Device to deploy the image onto.
+ Leave this empty to get prompted during installation
+ Examples: /dev/sda, /dev/nvme0n1
+
+choice
+ prompt "Overwrite handling"
+ default OPT_INSTALLER_TARGET_OVERWRITE
+
+config OPT_INSTALLER_TARGET_OVERWRITE
+ bool "Overwrite if target is not empty"
+
+config OPT_INSTALLER_TARGET_ABORT
+ bool "Abort if target is not empty"
+
+endchoice
+
+config INSTALLER_TARGET_OVERWRITE
+ string
+ default "OVERWRITE" if OPT_INSTALLER_TARGET_OVERWRITE
+ default "ABORT" if OPT_INSTALLER_TARGET_ABORT
+
+endif
+
endif

config KAS_INCLUDE_IMAGE
diff --git a/meta-isar/recipes-core/images/isar-image-installer.bb b/meta-isar/recipes-core/images/isar-image-installer.bb
index a325ab9f..ee04bb41 100644
--- a/meta-isar/recipes-core/images/isar-image-installer.bb
+++ b/meta-isar/recipes-core/images/isar-image-installer.bb
@@ -10,7 +10,17 @@ DESCRIPTION = "Example of a ISAR based Installer Image"
# Use variable to switch easily to another wks
INSTALLER_WKS_FILE ??= "installer-efi.wks.in"
WKS_FILE = "${INSTALLER_WKS_FILE}"
+
ADDITIONAL_KERNEL_CMDLINE ??= ""
+
+OVERRIDES .= "${@':unattended-installer' if d.getVar('INSTALLER_UNATTENDED') else ''}"
+ADDITIONAL_KERNEL_CMDLINE:append:unattended-installer = " \
+ installer.unattended \
+ installer.image.uri=/install/${IMAGE_DATA_FILE}.${IMAGE_DATA_POSTFIX} \
+ installer.target.dev=${INSTALLER_TARGET_DEVICE} \
+ installer.target.overwrite=${INSTALLER_TARGET_OVERWRITE} \
+ "
+
IMAGER_INSTALL:wic:append = " ${SYSTEMD_BOOTLOADER_INSTALL}"

IMAGE_INSTALL += "deploy-image-service"
--
2.43.0

Uladzimir Bely

unread,
Dec 20, 2024, 2:49:21 AM12/20/24
to alexander...@siemens.com, isar-...@googlegroups.com, ami...@ilbers.de
On Thu, 2024-12-12 at 13:53 +0100, alexander.heinisch via isar-users
wrote:
Applied to next, thanks.

--
Best regards,
Uladzimir.



Reply all
Reply to author
Forward
0 new messages