* [PATCH 0/9] Update wic
@ 2022-08-05 18:51 Jan Kiszka
2022-08-05 18:51 ` [PATCH 1/9] wic: added fspassno parameter to partition Jan Kiszka
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: Jan Kiszka @ 2022-08-05 18:51 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
Brings wic to latest oe-core, adding support for --fspassno, allowing
changes in fstab on rootfs, and permitting DTB update via grub and
systemd-boot. Also some smaller fixes come in this way.
I've picked all wic-related patches from OE-core since the last update
and then re-sync'ed the only affected plugin fork, bootimg-efi-isar.py.
Jan
Claudius Heine (1):
wic: added fspassno parameter to partition
Jan Kiszka (3):
wic/bootimg-efi: Factor out some common bits
wic/bootimg-efi: Add support for loading devicetree files
wic: bootimg-efi-isar: Sync with latest upstream changes
Martin Jansa (1):
wic: fix WicError message
Mihai Lindner (1):
wic/plugins/rootfs: Fix NameError for 'orig_path'
Ross Burton (2):
wic: add target tools to PATH when executing native commands
wic/bootimg-efi: use cross objcopy when building unified kernel image
Tobias Schmidl (1):
wic/plugins/images/direct: Allow changes in fstab on rootfs
.../wic/plugins/source/bootimg-efi-isar.py | 97 +++++++++++--------
scripts/lib/wic/help.py | 6 ++
scripts/lib/wic/ksparser.py | 1 +
scripts/lib/wic/misc.py | 7 +-
scripts/lib/wic/partition.py | 1 +
scripts/lib/wic/plugins/imager/direct.py | 5 +-
scripts/lib/wic/plugins/source/bootimg-efi.py | 95 ++++++++++--------
scripts/lib/wic/plugins/source/rootfs.py | 2 +-
scripts/wic | 2 +-
9 files changed, 133 insertions(+), 83 deletions(-)
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/9] wic: added fspassno parameter to partition
2022-08-05 18:51 [PATCH 0/9] Update wic Jan Kiszka
@ 2022-08-05 18:51 ` Jan Kiszka
2022-08-05 18:51 ` [PATCH 2/9] wic/plugins/images/direct: Allow changes in fstab on rootfs Jan Kiszka
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Jan Kiszka @ 2022-08-05 18:51 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
From: Claudius Heine <ch@denx.de>
The `fspassno` parameter allows to overwrite the value of the last
column (`fs_passno`) in the /etc/fstab of the target root file system.
This allows to have periodic file system checks.
Signed-off-by: Claudius Heine <ch@denx.de>
Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
scripts/lib/wic/help.py | 6 ++++++
scripts/lib/wic/ksparser.py | 1 +
scripts/lib/wic/partition.py | 1 +
scripts/lib/wic/plugins/imager/direct.py | 3 ++-
4 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
index 4ff7470a..73e3380c 100644
--- a/scripts/lib/wic/help.py
+++ b/scripts/lib/wic/help.py
@@ -940,6 +940,12 @@ DESCRIPTION
quotes. If not specified, the default string is
"defaults".
+ --fspassno: Specifies the order in which filesystem checks are done
+ at boot time by fsck. See fs_passno parameter of
+ fstab(5). This parameter will be copied into the
+ /etc/fstab file of the installed system. If not
+ specified the default value of "0" will be used.
+
--label label: Specifies the label to give to the filesystem
to be made on the partition. If the given
label is already in use by another filesystem,
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index 0df9eb0d..a49b7b97 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -155,6 +155,7 @@ class KickStart():
part.add_argument('--change-directory')
part.add_argument("--extra-space", type=sizetype("M"))
part.add_argument('--fsoptions', dest='fsopts')
+ part.add_argument('--fspassno', dest='fspassno')
part.add_argument('--fstype', default='vfat',
choices=('ext2', 'ext3', 'ext4', 'btrfs',
'squashfs', 'vfat', 'msdos', 'erofs',
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index 09e491dd..e50871b8 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -33,6 +33,7 @@ class Partition():
self.include_path = args.include_path
self.change_directory = args.change_directory
self.fsopts = args.fsopts
+ self.fspassno = args.fspassno
self.fstype = args.fstype
self.label = args.label
self.use_label = args.use_label
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index 4d0b836e..da483dae 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -138,8 +138,9 @@ class DirectPlugin(ImagerPlugin):
device_name = "/dev/%s%s%d" % (part.disk, prefix, part.realnum)
opts = part.fsopts if part.fsopts else "defaults"
+ passno = part.fspassno if part.fspassno else "0"
line = "\t".join([device_name, part.mountpoint, part.fstype,
- opts, "0", "0"]) + "\n"
+ opts, "0", passno]) + "\n"
fstab_lines.append(line)
updated = True
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/9] wic/plugins/images/direct: Allow changes in fstab on rootfs
2022-08-05 18:51 [PATCH 0/9] Update wic Jan Kiszka
2022-08-05 18:51 ` [PATCH 1/9] wic: added fspassno parameter to partition Jan Kiszka
@ 2022-08-05 18:51 ` Jan Kiszka
2022-08-05 18:51 ` [PATCH 3/9] wic: fix WicError message Jan Kiszka
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Jan Kiszka @ 2022-08-05 18:51 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
From: Tobias Schmidl <tobiasschmidl@siemens.com>
Allow wic to also manipulate the rootfs entry in fstab, which it
currently refuses to write. Reasons one might want to do that include
using systemd-growfs via --fsoptions on /
With this change / is now handled exactly the same as other
mountpoints, the former exception seemingly was not even documented.
Signed-off-by: Tobias Schmidl <tobiasschmidl@siemens.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
scripts/lib/wic/plugins/imager/direct.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index da483dae..c44159b2 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -117,7 +117,7 @@ class DirectPlugin(ImagerPlugin):
updated = False
for part in self.parts:
if not part.realnum or not part.mountpoint \
- or part.mountpoint == "/" or not part.mountpoint.startswith('/'):
+ or not part.mountpoint.startswith('/'):
continue
if part.use_uuid:
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/9] wic: fix WicError message
2022-08-05 18:51 [PATCH 0/9] Update wic Jan Kiszka
2022-08-05 18:51 ` [PATCH 1/9] wic: added fspassno parameter to partition Jan Kiszka
2022-08-05 18:51 ` [PATCH 2/9] wic/plugins/images/direct: Allow changes in fstab on rootfs Jan Kiszka
@ 2022-08-05 18:51 ` Jan Kiszka
2022-08-05 18:51 ` [PATCH 4/9] wic/plugins/rootfs: Fix NameError for 'orig_path' Jan Kiszka
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Jan Kiszka @ 2022-08-05 18:51 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
From: Martin Jansa <Martin.Jansa@gmail.com>
* add missing % to print the values instead of:
| INFO: Build artifacts not found, exiting.
| INFO: (Please check that the build artifacts for the machine
| INFO: selected in local.conf actually exist and that they
| INFO: are the correct artifacts for the image (.wks file)).
|
| ERROR: ("The artifact that couldn't be found was %s:\n %s", 'kernel-dir', '/OE/build/deploy/images/qemux86-64')
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
scripts/wic | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/wic b/scripts/wic
index aee63a45..06e0b48d 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -209,7 +209,7 @@ def wic_create_subcommand(options, usage_str):
logger.info(" (Please check that the build artifacts for the machine")
logger.info(" selected in local.conf actually exist and that they")
logger.info(" are the correct artifacts for the image (.wks file)).\n")
- raise WicError("The artifact that couldn't be found was %s:\n %s", not_found, not_found_dir)
+ raise WicError("The artifact that couldn't be found was %s:\n %s" % (not_found, not_found_dir))
krootfs_dir = options.rootfs_dir
if krootfs_dir is None:
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 4/9] wic/plugins/rootfs: Fix NameError for 'orig_path'
2022-08-05 18:51 [PATCH 0/9] Update wic Jan Kiszka
` (2 preceding siblings ...)
2022-08-05 18:51 ` [PATCH 3/9] wic: fix WicError message Jan Kiszka
@ 2022-08-05 18:51 ` Jan Kiszka
2022-08-05 18:51 ` [PATCH 5/9] wic: add target tools to PATH when executing native commands Jan Kiszka
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Jan Kiszka @ 2022-08-05 18:51 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
From: Mihai Lindner <mihai.lindner@gmail.com>
Fix "NameError: name 'orig_path' is not defined".
It's a typo from when this error was handled outside this function.
Signed-off-by: Mihai Lindner <mihai.lindner@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
scripts/lib/wic/plugins/source/rootfs.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
index 25bb41dd..fc06312e 100644
--- a/scripts/lib/wic/plugins/source/rootfs.py
+++ b/scripts/lib/wic/plugins/source/rootfs.py
@@ -35,7 +35,7 @@ class RootfsPlugin(SourcePlugin):
@staticmethod
def __validate_path(cmd, rootfs_dir, path):
if os.path.isabs(path):
- logger.error("%s: Must be relative: %s" % (cmd, orig_path))
+ logger.error("%s: Must be relative: %s" % (cmd, path))
sys.exit(1)
# Disallow climbing outside of parent directory using '..',
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 5/9] wic: add target tools to PATH when executing native commands
2022-08-05 18:51 [PATCH 0/9] Update wic Jan Kiszka
` (3 preceding siblings ...)
2022-08-05 18:51 ` [PATCH 4/9] wic/plugins/rootfs: Fix NameError for 'orig_path' Jan Kiszka
@ 2022-08-05 18:51 ` Jan Kiszka
2022-08-05 18:51 ` [PATCH 6/9] wic/bootimg-efi: use cross objcopy when building unified kernel image Jan Kiszka
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Jan Kiszka @ 2022-08-05 18:51 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
From: Ross Burton <ross.burton@arm.com>
We might want to run a cross tool, such as objcopy, in wic. These are
in a TARGET_SYS/ subdirectory under /usr/bin, so add that directory to
the search path too.
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
scripts/lib/wic/misc.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/scripts/lib/wic/misc.py b/scripts/lib/wic/misc.py
index 3bc165fd..2b90821b 100644
--- a/scripts/lib/wic/misc.py
+++ b/scripts/lib/wic/misc.py
@@ -141,11 +141,12 @@ def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""):
cmd_and_args = pseudo + cmd_and_args
hosttools_dir = get_bitbake_var("HOSTTOOLS_DIR")
+ target_sys = get_bitbake_var("TARGET_SYS")
- native_paths = "%s/sbin:%s/usr/sbin:%s/usr/bin:%s/bin:%s" % \
+ native_paths = "%s/sbin:%s/usr/sbin:%s/usr/bin:%s/usr/bin/%s:%s/bin:%s" % \
(native_sysroot, native_sysroot,
- native_sysroot, native_sysroot,
- hosttools_dir)
+ native_sysroot, native_sysroot, target_sys,
+ native_sysroot, hosttools_dir)
native_cmd_and_args = "export PATH=%s:$PATH;%s" % \
(native_paths, cmd_and_args)
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 6/9] wic/bootimg-efi: use cross objcopy when building unified kernel image
2022-08-05 18:51 [PATCH 0/9] Update wic Jan Kiszka
` (4 preceding siblings ...)
2022-08-05 18:51 ` [PATCH 5/9] wic: add target tools to PATH when executing native commands Jan Kiszka
@ 2022-08-05 18:51 ` Jan Kiszka
2022-08-05 18:51 ` [PATCH 7/9] wic/bootimg-efi: Factor out some common bits Jan Kiszka
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Jan Kiszka @ 2022-08-05 18:51 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
From: Ross Burton <ross.burton@arm.com>
We can't rely on the host objcopy knowing how to process target binaries,
so use the cross objcopy in the sysroot instead.
Also construct the command argument-by-argument as the format expression
was getting unwieldy.
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
scripts/lib/wic/plugins/source/bootimg-efi.py | 25 +++++++++----------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 0391aebd..a65a5b97 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -326,21 +326,20 @@ class BootimgEFIPlugin(SourcePlugin):
exec_cmd(install_cmd)
staging_dir_host = get_bitbake_var("STAGING_DIR_HOST")
+ target_sys = get_bitbake_var("TARGET_SYS")
# https://www.freedesktop.org/software/systemd/man/systemd-stub.html
- objcopy_cmd = "objcopy \
- --add-section .osrel=%s --change-section-vma .osrel=0x20000 \
- --add-section .cmdline=%s --change-section-vma .cmdline=0x30000 \
- --add-section .linux=%s --change-section-vma .linux=0x2000000 \
- --add-section .initrd=%s --change-section-vma .initrd=0x3000000 \
- %s %s" % \
- ("%s/usr/lib/os-release" % staging_dir_host,
- cmdline.name,
- "%s/%s" % (staging_kernel_dir, kernel),
- initrd.name,
- efi_stub,
- "%s/EFI/Linux/linux.efi" % hdddir)
- exec_cmd(objcopy_cmd)
+ objcopy_cmd = "%s-objcopy" % target_sys
+ objcopy_cmd += " --add-section .osrel=%s/usr/lib/os-release" % staging_dir_host
+ objcopy_cmd += " --change-section-vma .osrel=0x20000"
+ objcopy_cmd += " --add-section .cmdline=%s" % cmdline.name
+ objcopy_cmd += " --change-section-vma .cmdline=0x30000"
+ objcopy_cmd += " --add-section .linux=%s/%s" % (staging_kernel_dir, kernel)
+ objcopy_cmd += " --change-section-vma .linux=0x2000000"
+ objcopy_cmd += " --add-section .initrd=%s" % initrd.name
+ objcopy_cmd += " --change-section-vma .initrd=0x3000000"
+ objcopy_cmd += " %s %s/EFI/Linux/linux.efi" % (efi_stub, hdddir)
+ exec_native_cmd(objcopy_cmd, native_sysroot)
else:
install_cmd = "install -m 0644 %s/%s %s/%s" % \
(staging_kernel_dir, kernel, hdddir, kernel)
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 7/9] wic/bootimg-efi: Factor out some common bits
2022-08-05 18:51 [PATCH 0/9] Update wic Jan Kiszka
` (5 preceding siblings ...)
2022-08-05 18:51 ` [PATCH 6/9] wic/bootimg-efi: use cross objcopy when building unified kernel image Jan Kiszka
@ 2022-08-05 18:51 ` Jan Kiszka
2022-08-05 18:51 ` [PATCH 8/9] wic/bootimg-efi: Add support for loading devicetree files Jan Kiszka
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Jan Kiszka @ 2022-08-05 18:51 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
From: Jan Kiszka <jan.kiszka@siemens.com>
The paths for configuring grub and systemd-boot have some common bits
around copying the initrd files. This will even grow when adding dtb
support. Factor this out into a class function.
Along this, avoid evaluating 'create-unified-kernel-image' multiple
times in do_configure_systemdboot and suppress a bogus warning about
"Ignoring missing initrd" when it is turned on.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
scripts/lib/wic/plugins/source/bootimg-efi.py | 46 +++++++++----------
1 file changed, 21 insertions(+), 25 deletions(-)
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index a65a5b97..57e79f45 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -34,6 +34,20 @@ class BootimgEFIPlugin(SourcePlugin):
name = 'bootimg-efi'
+ @classmethod
+ def _copy_additional_files(cls, hdddir, initrd):
+ if initrd:
+ bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
+ if not bootimg_dir:
+ raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
+
+ initrds = initrd.split(';')
+ for rd in initrds:
+ cp_cmd = "cp %s/%s %s" % (bootimg_dir, rd, hdddir)
+ exec_cmd(cp_cmd, True)
+ else:
+ logger.debug("Ignoring missing initrd")
+
@classmethod
def do_configure_grubefi(cls, hdddir, creator, cr_workdir, source_params):
"""
@@ -54,17 +68,7 @@ class BootimgEFIPlugin(SourcePlugin):
initrd = source_params.get('initrd')
- if initrd:
- bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
- if not bootimg_dir:
- raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
-
- initrds = initrd.split(';')
- for rd in initrds:
- cp_cmd = "cp %s/%s %s" % (bootimg_dir, rd, hdddir)
- exec_cmd(cp_cmd, True)
- else:
- logger.debug("Ignoring missing initrd")
+ cls._copy_additional_files(hdddir, initrd)
if not custom_cfg:
# Create grub configuration using parameters from wks file
@@ -119,25 +123,17 @@ class BootimgEFIPlugin(SourcePlugin):
bootloader = creator.ks.bootloader
+ unified_image = source_params.get('create-unified-kernel-image') == "true"
+
loader_conf = ""
- if source_params.get('create-unified-kernel-image') != "true":
+ if not unified_image:
loader_conf += "default boot\n"
loader_conf += "timeout %d\n" % bootloader.timeout
initrd = source_params.get('initrd')
- if initrd and source_params.get('create-unified-kernel-image') != "true":
- # obviously we need to have a common common deploy var
- bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
- if not bootimg_dir:
- raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
-
- initrds = initrd.split(';')
- for rd in initrds:
- cp_cmd = "cp %s/%s %s" % (bootimg_dir, rd, hdddir)
- exec_cmd(cp_cmd, True)
- else:
- logger.debug("Ignoring missing initrd")
+ if not unified_image:
+ cls._copy_additional_files(hdddir, initrd)
logger.debug("Writing systemd-boot config "
"%s/hdd/boot/loader/loader.conf", cr_workdir)
@@ -185,7 +181,7 @@ class BootimgEFIPlugin(SourcePlugin):
for rd in initrds:
boot_conf += "initrd /%s\n" % rd
- if source_params.get('create-unified-kernel-image') != "true":
+ if not unified_image:
logger.debug("Writing systemd-boot config "
"%s/hdd/boot/loader/entries/boot.conf", cr_workdir)
cfg = open("%s/hdd/boot/loader/entries/boot.conf" % cr_workdir, "w")
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 8/9] wic/bootimg-efi: Add support for loading devicetree files
2022-08-05 18:51 [PATCH 0/9] Update wic Jan Kiszka
` (6 preceding siblings ...)
2022-08-05 18:51 ` [PATCH 7/9] wic/bootimg-efi: Factor out some common bits Jan Kiszka
@ 2022-08-05 18:51 ` Jan Kiszka
2022-08-05 18:51 ` [PATCH 9/9] wic: bootimg-efi-isar: Sync with latest upstream changes Jan Kiszka
2022-08-15 8:23 ` [PATCH 0/9] Update wic Anton Mikanovich
9 siblings, 0 replies; 11+ messages in thread
From: Jan Kiszka @ 2022-08-05 18:51 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
From: Jan Kiszka <jan.kiszka@siemens.com>
For device tree using systems, add support to set a custom devices tree
during UEFI boot. This requires to copy the DTB file to the boot
partition and to add the respective loader entries to the configuration
files.
Both grub and systemd-boot support only loading a specific device tree.
Therefore refuse to work if the 'dtb' parameter contains more than one
entry.
Out of scope for now are overlays (only supported by systemd-boot).
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
[Luca: rebased on commit 98e9d435b278 ("wic/bootimg-efi: use cross objcopy when building unified kernel image")]
---
scripts/lib/wic/plugins/source/bootimg-efi.py | 38 +++++++++++++++----
1 file changed, 31 insertions(+), 7 deletions(-)
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 57e79f45..634a808d 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -35,12 +35,12 @@ class BootimgEFIPlugin(SourcePlugin):
name = 'bootimg-efi'
@classmethod
- def _copy_additional_files(cls, hdddir, initrd):
- if initrd:
- bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
- if not bootimg_dir:
- raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
+ def _copy_additional_files(cls, hdddir, initrd, dtb):
+ bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
+ if not bootimg_dir:
+ raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
+ if initrd:
initrds = initrd.split(';')
for rd in initrds:
cp_cmd = "cp %s/%s %s" % (bootimg_dir, rd, hdddir)
@@ -48,6 +48,12 @@ class BootimgEFIPlugin(SourcePlugin):
else:
logger.debug("Ignoring missing initrd")
+ if dtb:
+ if ';' in dtb:
+ raise WicError("Only one DTB supported, exiting")
+ cp_cmd = "cp %s/%s %s" % (bootimg_dir, dtb, hdddir)
+ exec_cmd(cp_cmd, True)
+
@classmethod
def do_configure_grubefi(cls, hdddir, creator, cr_workdir, source_params):
"""
@@ -67,8 +73,9 @@ class BootimgEFIPlugin(SourcePlugin):
"get it from %s." % configfile)
initrd = source_params.get('initrd')
+ dtb = source_params.get('dtb')
- cls._copy_additional_files(hdddir, initrd)
+ cls._copy_additional_files(hdddir, initrd, dtb)
if not custom_cfg:
# Create grub configuration using parameters from wks file
@@ -102,6 +109,9 @@ class BootimgEFIPlugin(SourcePlugin):
grubefi_conf += " /%s" % rd
grubefi_conf += "\n"
+ if dtb:
+ grubefi_conf += "devicetree /%s\n" % dtb
+
grubefi_conf += "}\n"
logger.debug("Writing grubefi config %s/hdd/boot/EFI/BOOT/grub.cfg",
@@ -131,9 +141,10 @@ class BootimgEFIPlugin(SourcePlugin):
loader_conf += "timeout %d\n" % bootloader.timeout
initrd = source_params.get('initrd')
+ dtb = source_params.get('dtb')
if not unified_image:
- cls._copy_additional_files(hdddir, initrd)
+ cls._copy_additional_files(hdddir, initrd, dtb)
logger.debug("Writing systemd-boot config "
"%s/hdd/boot/loader/loader.conf", cr_workdir)
@@ -181,6 +192,9 @@ class BootimgEFIPlugin(SourcePlugin):
for rd in initrds:
boot_conf += "initrd /%s\n" % rd
+ if dtb:
+ boot_conf += "devicetree /%s\n" % dtb
+
if not unified_image:
logger.debug("Writing systemd-boot config "
"%s/hdd/boot/loader/entries/boot.conf", cr_workdir)
@@ -316,6 +330,15 @@ class BootimgEFIPlugin(SourcePlugin):
shutil.copyfileobj(in_file, initrd)
initrd.close()
+ dtb = source_params.get('dtb')
+ if dtb:
+ if ';' in dtb:
+ raise WicError("Only one DTB supported, exiting")
+ dtb_params = '--add-section .dtb=%s/%s --change-section-vma .dtb=0x40000' % \
+ (deploy_dir, dtb)
+ else:
+ dtb_params = ''
+
# Searched by systemd-boot:
# https://systemd.io/BOOT_LOADER_SPECIFICATION/#type-2-efi-unified-kernel-images
install_cmd = "install -d %s/EFI/Linux" % hdddir
@@ -330,6 +353,7 @@ class BootimgEFIPlugin(SourcePlugin):
objcopy_cmd += " --change-section-vma .osrel=0x20000"
objcopy_cmd += " --add-section .cmdline=%s" % cmdline.name
objcopy_cmd += " --change-section-vma .cmdline=0x30000"
+ objcopy_cmd += dtb_params
objcopy_cmd += " --add-section .linux=%s/%s" % (staging_kernel_dir, kernel)
objcopy_cmd += " --change-section-vma .linux=0x2000000"
objcopy_cmd += " --add-section .initrd=%s" % initrd.name
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 9/9] wic: bootimg-efi-isar: Sync with latest upstream changes
2022-08-05 18:51 [PATCH 0/9] Update wic Jan Kiszka
` (7 preceding siblings ...)
2022-08-05 18:51 ` [PATCH 8/9] wic/bootimg-efi: Add support for loading devicetree files Jan Kiszka
@ 2022-08-05 18:51 ` Jan Kiszka
2022-08-15 8:23 ` [PATCH 0/9] Update wic Anton Mikanovich
9 siblings, 0 replies; 11+ messages in thread
From: Jan Kiszka @ 2022-08-05 18:51 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
From: Jan Kiszka <jan.kiszka@siemens.com>
Specifically brings in DTB support for grub and systemd-boot.
It also changes the generation of unified kernel images in a way that
is definitely not compatible with Isar. Not sure if this feature was
used before (isar-cip-core uses EFI Boot Guard for that purpose), but
it's still patched here to not call non-existing objcopy binaries, just
in case.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../wic/plugins/source/bootimg-efi-isar.py | 97 +++++++++++--------
1 file changed, 59 insertions(+), 38 deletions(-)
diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
index a24e04f3..6e6cd6ec 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
@@ -40,6 +40,26 @@ class BootimgEFIPlugin(SourcePlugin):
name = 'bootimg-efi-isar'
+ @classmethod
+ def _copy_additional_files(cls, hdddir, initrd, dtb):
+ bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
+ if not bootimg_dir:
+ raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
+
+ if initrd:
+ initrds = initrd.split(';')
+ for rd in initrds:
+ cp_cmd = "cp %s/%s %s" % (bootimg_dir, rd, hdddir)
+ exec_cmd(cp_cmd, True)
+ else:
+ logger.debug("Ignoring missing initrd")
+
+ if dtb:
+ if ';' in dtb:
+ raise WicError("Only one DTB supported, exiting")
+ cp_cmd = "cp %s/%s %s" % (bootimg_dir, dtb, hdddir)
+ exec_cmd(cp_cmd, True)
+
@classmethod
def do_configure_grubefi(cls, hdddir, creator, cr_workdir, source_params):
"""
@@ -59,18 +79,9 @@ class BootimgEFIPlugin(SourcePlugin):
"get it from %s." % configfile)
initrd = source_params.get('initrd')
+ dtb = source_params.get('dtb')
- if initrd:
- bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
- if not bootimg_dir:
- raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
-
- initrds = initrd.split(';')
- for rd in initrds:
- cp_cmd = "cp %s/%s %s" % (bootimg_dir, rd, hdddir)
- exec_cmd(cp_cmd, True)
- else:
- logger.debug("Ignoring missing initrd")
+ cls._copy_additional_files(hdddir, initrd, dtb)
if not custom_cfg:
# Create grub configuration using parameters from wks file
@@ -108,6 +119,9 @@ class BootimgEFIPlugin(SourcePlugin):
grubefi_conf += " /%s" % rd
grubefi_conf += "\n"
+ if dtb:
+ grubefi_conf += "devicetree /%s\n" % dtb
+
grubefi_conf += "}\n"
logger.debug("Writing grubefi config %s/hdd/boot/EFI/BOOT/grub.cfg",
@@ -129,25 +143,18 @@ class BootimgEFIPlugin(SourcePlugin):
bootloader = creator.ks.bootloader
+ unified_image = source_params.get('create-unified-kernel-image') == "true"
+
loader_conf = ""
- if source_params.get('create-unified-kernel-image') != "true":
+ if not unified_image:
loader_conf += "default boot\n"
loader_conf += "timeout %d\n" % bootloader.timeout
initrd = source_params.get('initrd')
+ dtb = source_params.get('dtb')
- if initrd and source_params.get('create-unified-kernel-image') != "true":
- # obviously we need to have a common common deploy var
- bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
- if not bootimg_dir:
- raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
-
- initrds = initrd.split(';')
- for rd in initrds:
- cp_cmd = "cp %s/%s %s" % (bootimg_dir, rd, hdddir)
- exec_cmd(cp_cmd, True)
- else:
- logger.debug("Ignoring missing initrd")
+ if not unified_image:
+ cls._copy_additional_files(hdddir, initrd, dtb)
logger.debug("Writing systemd-boot config "
"%s/hdd/boot/loader/loader.conf", cr_workdir)
@@ -197,7 +204,10 @@ class BootimgEFIPlugin(SourcePlugin):
for rd in initrds:
boot_conf += "initrd /%s\n" % rd
- if source_params.get('create-unified-kernel-image') != "true":
+ if dtb:
+ boot_conf += "devicetree /%s\n" % dtb
+
+ if not unified_image:
logger.debug("Writing systemd-boot config "
"%s/hdd/boot/loader/entries/boot.conf", cr_workdir)
cfg = open("%s/hdd/boot/loader/entries/boot.conf" % cr_workdir, "w")
@@ -332,27 +342,38 @@ class BootimgEFIPlugin(SourcePlugin):
shutil.copyfileobj(in_file, initrd)
initrd.close()
+ dtb = source_params.get('dtb')
+ if dtb:
+ if ';' in dtb:
+ raise WicError("Only one DTB supported, exiting")
+ dtb_params = '--add-section .dtb=%s/%s --change-section-vma .dtb=0x40000' % \
+ (deploy_dir, dtb)
+ else:
+ dtb_params = ''
+
# Searched by systemd-boot:
# https://systemd.io/BOOT_LOADER_SPECIFICATION/#type-2-efi-unified-kernel-images
install_cmd = "install -d %s/EFI/Linux" % hdddir
exec_cmd(install_cmd)
staging_dir_host = get_bitbake_var("STAGING_DIR_HOST")
+ target_sys = get_bitbake_var("TARGET_SYS")
# https://www.freedesktop.org/software/systemd/man/systemd-stub.html
- objcopy_cmd = "objcopy \
- --add-section .osrel=%s --change-section-vma .osrel=0x20000 \
- --add-section .cmdline=%s --change-section-vma .cmdline=0x30000 \
- --add-section .linux=%s --change-section-vma .linux=0x2000000 \
- --add-section .initrd=%s --change-section-vma .initrd=0x3000000 \
- %s %s" % \
- ("%s/usr/lib/os-release" % staging_dir_host,
- cmdline.name,
- "%s/%s" % (staging_kernel_dir, kernel),
- initrd.name,
- efi_stub,
- "%s/EFI/Linux/linux.efi" % hdddir)
- exec_cmd(objcopy_cmd)
+ objcopy_cmd = "%s-objcopy" % target_sys
+ # Isar runs this natively
+ objcopy_cmd = "objcopy"
+ objcopy_cmd += " --add-section .osrel=%s/usr/lib/os-release" % staging_dir_host
+ objcopy_cmd += " --change-section-vma .osrel=0x20000"
+ objcopy_cmd += " --add-section .cmdline=%s" % cmdline.name
+ objcopy_cmd += " --change-section-vma .cmdline=0x30000"
+ objcopy_cmd += dtb_params
+ objcopy_cmd += " --add-section .linux=%s/%s" % (staging_kernel_dir, kernel)
+ objcopy_cmd += " --change-section-vma .linux=0x2000000"
+ objcopy_cmd += " --add-section .initrd=%s" % initrd.name
+ objcopy_cmd += " --change-section-vma .initrd=0x3000000"
+ objcopy_cmd += " %s %s/EFI/Linux/linux.efi" % (efi_stub, hdddir)
+ exec_native_cmd(objcopy_cmd, native_sysroot)
else:
install_cmd = "install -m 0644 %s/%s %s/%s" % \
(staging_kernel_dir, kernel, hdddir, kernel)
--
2.35.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/9] Update wic
2022-08-05 18:51 [PATCH 0/9] Update wic Jan Kiszka
` (8 preceding siblings ...)
2022-08-05 18:51 ` [PATCH 9/9] wic: bootimg-efi-isar: Sync with latest upstream changes Jan Kiszka
@ 2022-08-15 8:23 ` Anton Mikanovich
9 siblings, 0 replies; 11+ messages in thread
From: Anton Mikanovich @ 2022-08-15 8:23 UTC (permalink / raw)
To: Jan Kiszka, isar-users; +Cc: Henning Schild
05.08.2022 21:51, Jan Kiszka wrote:
> Brings wic to latest oe-core, adding support for --fspassno, allowing
> changes in fstab on rootfs, and permitting DTB update via grub and
> systemd-boot. Also some smaller fixes come in this way.
>
> I've picked all wic-related patches from OE-core since the last update
> and then re-sync'ed the only affected plugin fork, bootimg-efi-isar.py.
>
> Jan
>
> Claudius Heine (1):
> wic: added fspassno parameter to partition
>
> Jan Kiszka (3):
> wic/bootimg-efi: Factor out some common bits
> wic/bootimg-efi: Add support for loading devicetree files
> wic: bootimg-efi-isar: Sync with latest upstream changes
>
> Martin Jansa (1):
> wic: fix WicError message
>
> Mihai Lindner (1):
> wic/plugins/rootfs: Fix NameError for 'orig_path'
>
> Ross Burton (2):
> wic: add target tools to PATH when executing native commands
> wic/bootimg-efi: use cross objcopy when building unified kernel image
>
> Tobias Schmidl (1):
> wic/plugins/images/direct: Allow changes in fstab on rootfs
>
> .../wic/plugins/source/bootimg-efi-isar.py | 97 +++++++++++--------
> scripts/lib/wic/help.py | 6 ++
> scripts/lib/wic/ksparser.py | 1 +
> scripts/lib/wic/misc.py | 7 +-
> scripts/lib/wic/partition.py | 1 +
> scripts/lib/wic/plugins/imager/direct.py | 5 +-
> scripts/lib/wic/plugins/source/bootimg-efi.py | 95 ++++++++++--------
> scripts/lib/wic/plugins/source/rootfs.py | 2 +-
> scripts/wic | 2 +-
> 9 files changed, 133 insertions(+), 83 deletions(-)
>
Applied to next, thanks.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2022-08-15 8:23 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-05 18:51 [PATCH 0/9] Update wic Jan Kiszka
2022-08-05 18:51 ` [PATCH 1/9] wic: added fspassno parameter to partition Jan Kiszka
2022-08-05 18:51 ` [PATCH 2/9] wic/plugins/images/direct: Allow changes in fstab on rootfs Jan Kiszka
2022-08-05 18:51 ` [PATCH 3/9] wic: fix WicError message Jan Kiszka
2022-08-05 18:51 ` [PATCH 4/9] wic/plugins/rootfs: Fix NameError for 'orig_path' Jan Kiszka
2022-08-05 18:51 ` [PATCH 5/9] wic: add target tools to PATH when executing native commands Jan Kiszka
2022-08-05 18:51 ` [PATCH 6/9] wic/bootimg-efi: use cross objcopy when building unified kernel image Jan Kiszka
2022-08-05 18:51 ` [PATCH 7/9] wic/bootimg-efi: Factor out some common bits Jan Kiszka
2022-08-05 18:51 ` [PATCH 8/9] wic/bootimg-efi: Add support for loading devicetree files Jan Kiszka
2022-08-05 18:51 ` [PATCH 9/9] wic: bootimg-efi-isar: Sync with latest upstream changes Jan Kiszka
2022-08-15 8:23 ` [PATCH 0/9] Update wic Anton Mikanovich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox