public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: isar-users@googlegroups.com
Cc: Florian Bezdeka <florian.bezdeka@siemens.com>,
	Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>,
	jan.kiszka@siemens.com,
	Henning Schild <henning.schild@siemens.com>
Subject: [PATCH v2 2/7] wic: add utility library for common bits of isar plugins
Date: Fri,  3 Sep 2021 14:53:50 +0200	[thread overview]
Message-ID: <20210903125355.12279-3-henning.schild@siemens.com> (raw)
In-Reply-To: <20210903125355.12279-1-henning.schild@siemens.com>

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 .../scripts/lib/wic/plugins/isarpluginbase.py | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 meta/scripts/lib/wic/plugins/isarpluginbase.py

diff --git a/meta/scripts/lib/wic/plugins/isarpluginbase.py b/meta/scripts/lib/wic/plugins/isarpluginbase.py
new file mode 100644
index 000000000000..185e2ea14fc7
--- /dev/null
+++ b/meta/scripts/lib/wic/plugins/isarpluginbase.py
@@ -0,0 +1,39 @@
+#
+# Copyright (c) Siemens AG, 2021
+#
+# SPDX-License-Identifier: MIT
+#
+# DESCRIPTION
+# This implements a few utility functions to be used in isar-specific plugins.
+
+import os
+
+def isar_populate_boot_cmd(rootfs_dir, hdddir):
+    # copy all files from rootfs/boot into boot partition
+    # no not copy symlinks (ubuntu places them here) because targetfs is fat
+    return "find %s/boot -type f -exec cp -a {} %s ;" % (rootfs_dir, hdddir)
+
+def isar_get_filenames(rootfs_dir):
+    # figure out the real filename in /boot by following debian symlinks
+    for kernel_symlink in ["vmlinuz", "vmlinux" ]:
+        kernel_file_abs = os.path.join(rootfs_dir, kernel_symlink)
+        if os.path.isfile(kernel_file_abs):
+            break
+        # in ubuntu those symlinks could be in /boot
+        kernel_file_abs = os.path.join(rootfs_dir, "boot", kernel_symlink)
+        if os.path.isfile(kernel_file_abs):
+            break
+
+    kernel = os.path.basename(os.path.realpath(kernel_file_abs))
+    initrd =  "initrd.img"
+    kernel_parts = kernel.split("-")
+    kernel_suffix = "-".join(kernel_parts[1:])
+    if kernel_suffix:
+        initrd += "-%s" % kernel_suffix
+
+    if not os.path.isfile(os.path.join(rootfs_dir, "boot", kernel)):
+        raise WicError("kernel %s not found" % (os.path.join(rootfs_dir, "boot", kernel)))
+    if not os.path.isfile(os.path.join(rootfs_dir, "boot", initrd)):
+        raise WicError("initrd %s not found" % (os.path.join(rootfs_dir, "boot", initrd)))
+
+    return kernel, initrd
-- 
2.32.0


  parent reply	other threads:[~2021-09-03 12:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03 12:53 [PATCH v2 0/7] re-fork wic pcbios and efi plugins Henning Schild
2021-09-03 12:53 ` [PATCH v2 1/7] wic: reset our plugin forks to OE upstream for re-forking Henning Schild
2021-09-03 12:53 ` Henning Schild [this message]
2021-09-03 12:53 ` [PATCH v2 3/7] wic: apply the actual fork changes to our pcbios plugin fork Henning Schild
2021-09-03 12:53 ` [PATCH v2 4/7] wic: clean up wic class in terms of isar variables Henning Schild
2021-09-03 12:53 ` [PATCH v2 5/7] wic: apply the actual fork changes to our efi plugin fork Henning Schild
2021-09-03 12:53 ` [PATCH v2 6/7] wic: mount /boot and exlude it from root for efi Henning Schild
2021-09-03 16:06   ` Henning Schild
2021-09-03 12:53 ` [PATCH v2 7/7] meta-isar: use "systemd-boot" for one test target Henning Schild
2021-09-06  5:05 ` [PATCH v2 0/7] re-fork wic pcbios and efi plugins Jan Kiszka
2021-09-06  8:59   ` Henning Schild
2021-09-06  9:48 ` Anton Mikanovich
2021-09-06 10:51   ` Henning Schild
2021-09-07  7:15 ` Bezdeka, Florian
2021-09-07  8:00   ` Henning Schild
2021-09-13 13:05 ` Anton Mikanovich

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=20210903125355.12279-3-henning.schild@siemens.com \
    --to=henning.schild@siemens.com \
    --cc=Vijaikumar_Kanagarajan@mentor.com \
    --cc=florian.bezdeka@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    /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