[OE-core] [PATCH] meta/lib/oeqa/selftest/cases/wic: Add tests for configuring kernel image install into boot partition.

2023-03-08 Thread Kareem Zarka
- test_skip_kernel_install: This test verifies that the kernel is not
installed in the boot partition when the 'install-kernel-into-boot-dir'
parameter is set to false.
- test_kernel_install: This test verifies that the kernel is installed
in the boot partition when the 'install-kernel-into-boot-dir' parameter
is set to true .
Both tests use a WKS (Kickstart) file to specify the desired
configuration, build a disk image using WIC, and extract the disk image
to a temporary directory to verify the results.

Signed-off-by: Kareem Zarka 
---
 meta/lib/oeqa/selftest/cases/wic.py | 70 +
 1 file changed, 70 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/wic.py 
b/meta/lib/oeqa/selftest/cases/wic.py
index b9430cdb3b..7f5db1dc73 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -16,6 +16,7 @@ import hashlib
 from glob import glob
 from shutil import rmtree, copy
 from tempfile import NamedTemporaryFile
+from tempfile import TemporaryDirectory
 
 from oeqa.selftest.case import OESelftestTestCase
 from oeqa.core.decorator import OETestTag
@@ -146,6 +147,75 @@ class CLITests(OESelftestTestCase):
 self.assertEqual(1, runCmd('wic', ignore_status=True).status)
 
 class Wic(WicTestCase):
+def test_skip_kernel_install(self):
+"""Test the functionality of not installing the kernel in the boot 
directory using the wic plugin"""
+# Build the mtools package to support FAT filesystem handling
+bitbake("mtools") 
+# create a temporary file for the WKS content
+with NamedTemporaryFile("w", suffix=".wks") as wks:
+wks.write(
+'part --source bootimg-efi '
+
'--sourceparams="loader=grub-efi,install-kernel-into-boot-dir=false" '
+'--label boot --active\n'
+)
+wks.flush()
+# create a temporary directory to extract the disk image to
+with TemporaryDirectory() as tmpdir:
+img = 'core-image-minimal'
+# build the image using the WKS file
+cmd = "wic create %s -e %s -o %s" % (
+wks.name, img, self.resultdir)
+runCmd(cmd)
+wksname = os.path.splitext(os.path.basename(wks.name))[0]
+out = glob(os.path.join(
+self.resultdir, "%s-*.direct" % wksname))
+self.assertEqual(1, len(out))
+# extract the content of the disk image to the temporary 
directory
+cmd = "wic cp %s:1 %s" % (out[0], tmpdir)
+runCmd(cmd)
+# check if the kernel is installed or not
+kimgtype = get_bb_var('KERNEL_IMAGETYPE', img)
+for file in os.listdir(tmpdir):
+if file == kimgtype:
+raise AssertionError(
+"The kernel image '{}' was found in the 
partition".format(kimgtype)
+)
+
+def test_kernel_install(self):
+"""Test the installation of the kernel to the boot directory in the 
wic plugin"""
+# Build the mtools package to support FAT filesystem handling
+bitbake("mtools") 
+# create a temporary file for the WKS content
+with NamedTemporaryFile("w", suffix=".wks") as wks:
+wks.write(
+'part --source bootimg-efi '
+
'--sourceparams="loader=grub-efi,install-kernel-into-boot-dir=true" '
+'--label boot --active\n'
+)
+wks.flush()
+# create a temporary directory to extract the disk image to
+with TemporaryDirectory() as tmpdir:
+img = 'core-image-minimal'
+# build the image using the WKS file
+cmd = "wic create %s -e %s -o %s" % (wks.name, img, 
self.resultdir)
+runCmd(cmd)
+wksname = os.path.splitext(os.path.basename(wks.name))[0]
+out = glob(os.path.join(self.resultdir, "%s-*.direct" % 
wksname))
+self.assertEqual(1, len(out))
+# extract the content of the disk image to the temporary 
directory
+cmd = "wic cp %s:1 %s" % (out[0], tmpdir)
+runCmd(cmd)
+# check if the kernel is installed or not
+kimgtype = get_bb_var('KERNEL_IMAGETYPE', img)
+found = False
+for file in os.listdir(tmpdir):
+if file == kimgtype:
+found = True
+break
+self.assertTrue(
+found, "The kernel image '{}' was not found in the boot 
partition".format(

[OE-core] [PATCH] wic/plugins/source/bootimg-efi: Configure installation of kernel image into boot partition.

2023-03-08 Thread Kareem Zarka
The issue with installing the kernel image to both rootfs
and boot partition is that some systems rely on the kernel image in
rootfs and not in the boot partition.
This leads to duplication of the kernel image, which can cause
unnecessary storage usage.
This patch provides a solution to the problem by adding a new parameter
"install-kernel-into-boot-dir" to the wic kickstart file.
If this parameter is set to 'true', the plugin will install the
kernel image to the boot partition. If the parameter is set to 'false',
the plugin will skip installing the kernel image, avoiding duplication.
Tests for this functionality will be added in the next patch.

Signed-off-by: Kareem Zarka 
---
 scripts/lib/wic/plugins/source/bootimg-efi.py | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py 
b/scripts/lib/wic/plugins/source/bootimg-efi.py
index d6aeab2aad..09e9d6417c 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -363,9 +363,10 @@ class BootimgEFIPlugin(SourcePlugin):
 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)
-exec_cmd(install_cmd)
+if source_params.get('install-kernel-into-boot-dir') != 'false':
+install_cmd = "install -m 0644 %s/%s %s/%s" % \
+(staging_kernel_dir, kernel, hdddir, kernel)
+exec_cmd(install_cmd)
 
 if get_bitbake_var("IMAGE_EFI_BOOT_FILES"):
 for src_path, dst_path in cls.install_task:
-- 
2.25.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#178164): 
https://lists.openembedded.org/g/openembedded-core/message/178164
Mute This Topic: https://lists.openembedded.org/mt/97469748/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[OE-core] [PATCH] meta/lib/oeqa/selftest/cases/wic: Add tests for configuring kernel image install into boot partition.

2023-02-27 Thread Kareem Zarka
- test_skip_kernel_install: This test verifies that the kernel is not
installed in the boot partition when the 'install-kernel-into-boot-dir'
parameter is set to false.
- test_kernel_install: This test verifies that the kernel is installed
in the boot partition when the 'install-kernel-into-boot-dir' parameter
is set to true .
Both tests use a WKS (Kickstart) file to specify the desired
configuration, build a disk image using WIC, and extract the disk image
to a temporary directory to verify the results.

Signed-off-by: Kareem Zarka 
---
 meta/lib/oeqa/selftest/cases/wic.py | 70 +
 1 file changed, 70 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/wic.py 
b/meta/lib/oeqa/selftest/cases/wic.py
index b9430cdb3b..7f5db1dc73 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -16,6 +16,7 @@ import hashlib
 from glob import glob
 from shutil import rmtree, copy
 from tempfile import NamedTemporaryFile
+from tempfile import TemporaryDirectory
 
 from oeqa.selftest.case import OESelftestTestCase
 from oeqa.core.decorator import OETestTag
@@ -146,6 +147,75 @@ class CLITests(OESelftestTestCase):
 self.assertEqual(1, runCmd('wic', ignore_status=True).status)
 
 class Wic(WicTestCase):
+def test_skip_kernel_install(self):
+"""Test the functionality of not installing the kernel in the boot 
directory using the wic plugin"""
+# Build the mtools-native package to support FAT filesystem handling
+bitbake("mtools-native") 
+# create a temporary file for the WKS content
+with NamedTemporaryFile("w", suffix=".wks") as wks:
+wks.write(
+'part --source bootimg-efi '
+
'--sourceparams="loader=grub-efi,install-kernel-into-boot-dir=false" '
+'--label boot --active\n'
+)
+wks.flush()
+# create a temporary directory to extract the disk image to
+with TemporaryDirectory() as tmpdir:
+img = 'core-image-minimal'
+# build the image using the WKS file
+cmd = "wic create %s -e %s -o %s" % (
+wks.name, img, self.resultdir)
+runCmd(cmd)
+wksname = os.path.splitext(os.path.basename(wks.name))[0]
+out = glob(os.path.join(
+self.resultdir, "%s-*.direct" % wksname))
+self.assertEqual(1, len(out))
+# extract the content of the disk image to the temporary 
directory
+cmd = "wic cp %s:1 %s" % (out[0], tmpdir)
+runCmd(cmd)
+# check if the kernel is installed or not
+kimgtype = get_bb_var('KERNEL_IMAGETYPE', img)
+for file in os.listdir(tmpdir):
+if file == kimgtype:
+raise AssertionError(
+"The kernel image '{}' was found in the 
partition".format(kimgtype)
+)
+
+def test_kernel_install(self):
+"""Test the installation of the kernel to the boot directory in the 
wic plugin"""
+# Build the mtools-native package to support FAT filesystem handling
+bitbake("mtools-native") 
+# create a temporary file for the WKS content
+with NamedTemporaryFile("w", suffix=".wks") as wks:
+wks.write(
+'part --source bootimg-efi '
+
'--sourceparams="loader=grub-efi,install-kernel-into-boot-dir=true" '
+'--label boot --active\n'
+)
+wks.flush()
+# create a temporary directory to extract the disk image to
+with TemporaryDirectory() as tmpdir:
+img = 'core-image-minimal'
+# build the image using the WKS file
+cmd = "wic create %s -e %s -o %s" % (wks.name, img, 
self.resultdir)
+runCmd(cmd)
+wksname = os.path.splitext(os.path.basename(wks.name))[0]
+out = glob(os.path.join(self.resultdir, "%s-*.direct" % 
wksname))
+self.assertEqual(1, len(out))
+# extract the content of the disk image to the temporary 
directory
+cmd = "wic cp %s:1 %s" % (out[0], tmpdir)
+runCmd(cmd)
+# check if the kernel is installed or not
+kimgtype = get_bb_var('KERNEL_IMAGETYPE', img)
+found = False
+for file in os.listdir(tmpdir):
+if file == kimgtype:
+found = True
+break
+self.assertTrue(
+found, "The kernel image '{}' was not found in the

[OE-core] [PATCH] wic/plugins/source/bootimg-efi: Configure installation of kernel image into boot partition.

2023-02-27 Thread Kareem Zarka
The issue with installing the kernel image to both rootfs
and boot partition is that some systems rely on the kernel image in
rootfs and not in the boot partition.
This leads to duplication of the kernel image, which can cause
unnecessary storage usage.
This patch provides a solution to the problem by adding a new parameter
"install-kernel-into-boot-dir" to the wic kickstart file.
If this parameter is set to 'true', the plugin will install the
kernel image to the boot partition. If the parameter is set to 'false',
the plugin will skip installing the kernel image, avoiding duplication.
Tests for this functionality will be added in the next patch.

Signed-off-by: Kareem Zarka 
---
 scripts/lib/wic/plugins/source/bootimg-efi.py | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py 
b/scripts/lib/wic/plugins/source/bootimg-efi.py
index d6aeab2aad..09e9d6417c 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -363,9 +363,10 @@ class BootimgEFIPlugin(SourcePlugin):
 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)
-exec_cmd(install_cmd)
+if source_params.get('install-kernel-into-boot-dir') != 'false':
+install_cmd = "install -m 0644 %s/%s %s/%s" % \
+(staging_kernel_dir, kernel, hdddir, kernel)
+exec_cmd(install_cmd)
 
 if get_bitbake_var("IMAGE_EFI_BOOT_FILES"):
 for src_path, dst_path in cls.install_task:
-- 
2.25.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#177820): 
https://lists.openembedded.org/g/openembedded-core/message/177820
Mute This Topic: https://lists.openembedded.org/mt/97285463/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[OE-core] [PATCH] meta/recipes-core/images/core-image-minimal: add mtools to IMAGE_INSTALL

2023-02-24 Thread Kareem Zarka
The wic.py selftest cases test_skip_kernel_install and
test_kernel_install for OpenEmbedded were failing on autobuilders due
to a missing dependency on the mtools package, which provides a set of
tools for working with MS-DOS file systems, including mcopy.
To address this issue, we added mtools to the IMAGE_INSTALL variable in
the core-image-minimal.bb recipe. This ensures that the package is
included in the core-image-minimal image, which enables the
test_skip_kernel_install and test_kernel_install selftest cases
to run correctly on autobuilders.

Signed-off-by: Kareem Zarka 
---
 meta/recipes-core/images/core-image-minimal.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-core/images/core-image-minimal.bb 
b/meta/recipes-core/images/core-image-minimal.bb
index 84343adcd8..5d626898f0 100644
--- a/meta/recipes-core/images/core-image-minimal.bb
+++ b/meta/recipes-core/images/core-image-minimal.bb
@@ -1,6 +1,6 @@
 SUMMARY = "A small image just capable of allowing a device to boot."
 
-IMAGE_INSTALL = "packagegroup-core-boot ${CORE_IMAGE_EXTRA_INSTALL}"
+IMAGE_INSTALL = "mtools packagegroup-core-boot ${CORE_IMAGE_EXTRA_INSTALL}"
 
 IMAGE_LINGUAS = " "
 
-- 
2.25.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#177688): 
https://lists.openembedded.org/g/openembedded-core/message/177688
Mute This Topic: https://lists.openembedded.org/mt/97206738/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[OE-core] [PATCH] meta/lib/oeqa/selftest/cases/wic: Add tests for configuring kernel image install into boot partition.

2023-02-24 Thread Kareem Zarka
- test_skip_kernel_install: This test verifies that the kernel is not
installed in the boot partition when the 'install-kernel-into-boot-dir'
parameter is set to false.
- test_kernel_install: This test verifies that the kernel is installed
in the boot partition when the 'install-kernel-into-boot-dir' parameter
is set to true .
Both tests use a WKS (Kickstart) file to specify the desired
configuration, build a disk image using WIC, and extract the disk image
to a temporary directory to verify the results.

Signed-off-by: Kareem Zarka 
---
 meta/lib/oeqa/selftest/cases/wic.py | 66 +
 1 file changed, 66 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/wic.py 
b/meta/lib/oeqa/selftest/cases/wic.py
index ca1abb970a..b46dccc144 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -16,6 +16,7 @@ import hashlib
 from glob import glob
 from shutil import rmtree, copy
 from tempfile import NamedTemporaryFile
+from tempfile import TemporaryDirectory
 
 from oeqa.selftest.case import OESelftestTestCase
 from oeqa.core.decorator import OETestTag
@@ -146,6 +147,71 @@ class CLITests(OESelftestTestCase):
 self.assertEqual(1, runCmd('wic', ignore_status=True).status)
 
 class Wic(WicTestCase):
+def test_skip_kernel_install(self):
+"""Test the functionality of not installing the kernel in the boot 
directory using the wic plugin"""
+# create a temporary file for the WKS content
+with NamedTemporaryFile("w", suffix=".wks") as wks:
+wks.write(
+'part --source bootimg-efi '
+
'--sourceparams="loader=grub-efi,install-kernel-into-boot-dir=false" '
+'--label boot --active\n'
+)
+wks.flush()
+# create a temporary directory to extract the disk image to
+with TemporaryDirectory() as tmpdir:
+img = 'core-image-minimal'
+# build the image using the WKS file
+cmd = "wic create %s -e %s -o %s" % (
+wks.name, img, self.resultdir)
+runCmd(cmd)
+wksname = os.path.splitext(os.path.basename(wks.name))[0]
+out = glob(os.path.join(
+self.resultdir, "%s-*.direct" % wksname))
+self.assertEqual(1, len(out))
+# extract the content of the disk image to the temporary 
directory
+cmd = "wic cp %s:1 %s" % (out[0], tmpdir)
+runCmd(cmd)
+# check if the kernel is installed or not
+kimgtype = get_bb_var('KERNEL_IMAGETYPE', img)
+for file in os.listdir(tmpdir):
+if file == kimgtype:
+raise AssertionError(
+"The kernel image '{}' was found in the 
partition".format(kimgtype)
+)
+
+def test_kernel_install(self):
+"""Test the installation of the kernel to the boot directory in the 
wic plugin"""
+# create a temporary file for the WKS content
+with NamedTemporaryFile("w", suffix=".wks") as wks:
+wks.write(
+'part --source bootimg-efi '
+
'--sourceparams="loader=grub-efi,install-kernel-into-boot-dir=true" '
+'--label boot --active\n'
+)
+wks.flush()
+# create a temporary directory to extract the disk image to
+with TemporaryDirectory() as tmpdir:
+img = 'core-image-minimal'
+# build the image using the WKS file
+cmd = "wic create %s -e %s -o %s" % (wks.name, img, 
self.resultdir)
+runCmd(cmd)
+wksname = os.path.splitext(os.path.basename(wks.name))[0]
+out = glob(os.path.join(self.resultdir, "%s-*.direct" % 
wksname))
+self.assertEqual(1, len(out))
+# extract the content of the disk image to the temporary 
directory
+cmd = "wic cp %s:1 %s" % (out[0], tmpdir)
+runCmd(cmd)
+# check if the kernel is installed or not
+kimgtype = get_bb_var('KERNEL_IMAGETYPE', img)
+found = False
+for file in os.listdir(tmpdir):
+if file == kimgtype:
+found = True
+break
+self.assertTrue(
+found, "The kernel image '{}' was not found in the boot 
partition".format(kimgtype)
+)
+
 def test_build_image_name(self):
 """Test wic create wictestdisk --image-name=core-image-minimal"""
 cmd = "wic create wictestdisk

[OE-core] [PATCH] wic/plugins/source/bootimg-efi: Configure installation of kernel image into boot partition.

2023-02-24 Thread Kareem Zarka
The issue with installing the kernel image to both rootfs
and boot partition is that some systems rely on the kernel image in
rootfs and not in the boot partition.
This leads to duplication of the kernel image, which can cause
unnecessary storage usage.
This patch provides a solution to the problem by adding a new parameter
"install-kernel-into-boot-dir" to the wic kickstart file.
If this parameter is set to 'true', the plugin will install the
kernel image to the boot partition. If the parameter is set to 'false',
the plugin will skip installing the kernel image, avoiding duplication.
Tests for this functionality will be added in the next patch.

Signed-off-by: Kareem Zarka 
---
 scripts/lib/wic/plugins/source/bootimg-efi.py | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py 
b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 4b00913a70..4e99d37f26 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -363,9 +363,10 @@ class BootimgEFIPlugin(SourcePlugin):
 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)
-exec_cmd(install_cmd)
+if source_params.get('install-kernel-into-boot-dir') != 'false':
+install_cmd = "install -m 0644 %s/%s %s/%s" % \
+(staging_kernel_dir, kernel, hdddir, kernel)
+exec_cmd(install_cmd)
 
 if get_bitbake_var("IMAGE_EFI_BOOT_FILES"):
 for src_path, dst_path in cls.install_task:
-- 
2.25.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#177686): 
https://lists.openembedded.org/g/openembedded-core/message/177686
Mute This Topic: https://lists.openembedded.org/mt/97206734/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[OE-core] [PATCH] wic/plugins/source/bootimg-efi: Configure installation of kernel image into boot partition.

2023-02-10 Thread Kareem Zarka
The issue with installing the kernel image to both rootfs
and boot partition is that some systems rely on the kernel image in
rootfs and not in the boot partition.
This leads to duplication of the kernel image, which can cause
unnecessary storage usage.

This patch provides a solution to the problem by adding a new parameter
"install-kernel-into-boot-dir" to the wic kickstart file.
If this parameter is set to 'true', the plugin will install the
kernel image to the boot partition. If the parameter is set to 'false',
the plugin will skip installing the kernel image, avoiding duplication.

Tests for this functionality will be added in the next patch.

Signed-off-by: Kareem Zarka 
---
 scripts/lib/wic/plugins/source/bootimg-efi.py | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py 
b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 4b00913a70..4e99d37f26 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -363,9 +363,10 @@ class BootimgEFIPlugin(SourcePlugin):
 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)
-exec_cmd(install_cmd)
+if source_params.get('install-kernel-into-boot-dir') != 'false':
+install_cmd = "install -m 0644 %s/%s %s/%s" % \
+(staging_kernel_dir, kernel, hdddir, kernel)
+exec_cmd(install_cmd)
 
 if get_bitbake_var("IMAGE_EFI_BOOT_FILES"):
 for src_path, dst_path in cls.install_task:
-- 
2.25.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#176989): 
https://lists.openembedded.org/g/openembedded-core/message/176989
Mute This Topic: https://lists.openembedded.org/mt/96873813/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[OE-core] [PATCH] meta/lib/oeqa/selftest/cases/wic: Add tests for configuring kernel image install into boot partition.

2023-02-10 Thread Kareem Zarka
- test_skip_kernel_install: This test verifies that the kernel is not
installed in the boot partition when the 'install-kernel-into-boot-dir'
parameter is set to false.

- test_kernel_install: This test verifies that the kernel is installed
in the boot partition when the 'install-kernel-into-boot-dir' parameter
is set to true .

Both tests use a WKS (Kickstart) file to specify the desired
configuration, build a disk image using WIC, and extract the disk image
to a temporary directory to verify the results.

Signed-off-by: Kareem Zarka 
---
 meta/lib/oeqa/selftest/cases/wic.py | 66 +
 1 file changed, 66 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/wic.py 
b/meta/lib/oeqa/selftest/cases/wic.py
index ca1abb970a..b46dccc144 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -16,6 +16,7 @@ import hashlib
 from glob import glob
 from shutil import rmtree, copy
 from tempfile import NamedTemporaryFile
+from tempfile import TemporaryDirectory
 
 from oeqa.selftest.case import OESelftestTestCase
 from oeqa.core.decorator import OETestTag
@@ -146,6 +147,71 @@ class CLITests(OESelftestTestCase):
 self.assertEqual(1, runCmd('wic', ignore_status=True).status)
 
 class Wic(WicTestCase):
+def test_skip_kernel_install(self):
+"""Test the functionality of not installing the kernel in the boot 
directory using the wic plugin"""
+# create a temporary file for the WKS content
+with NamedTemporaryFile("w", suffix=".wks") as wks:
+wks.write(
+'part --source bootimg-efi '
+
'--sourceparams="loader=grub-efi,install-kernel-into-boot-dir=false" '
+'--label boot --active\n'
+)
+wks.flush()
+# create a temporary directory to extract the disk image to
+with TemporaryDirectory() as tmpdir:
+img = 'core-image-minimal'
+# build the image using the WKS file
+cmd = "wic create %s -e %s -o %s" % (
+wks.name, img, self.resultdir)
+runCmd(cmd)
+wksname = os.path.splitext(os.path.basename(wks.name))[0]
+out = glob(os.path.join(
+self.resultdir, "%s-*.direct" % wksname))
+self.assertEqual(1, len(out))
+# extract the content of the disk image to the temporary 
directory
+cmd = "wic cp %s:1 %s" % (out[0], tmpdir)
+runCmd(cmd)
+# check if the kernel is installed or not
+kimgtype = get_bb_var('KERNEL_IMAGETYPE', img)
+for file in os.listdir(tmpdir):
+if file == kimgtype:
+raise AssertionError(
+"The kernel image '{}' was found in the 
partition".format(kimgtype)
+)
+
+def test_kernel_install(self):
+"""Test the installation of the kernel to the boot directory in the 
wic plugin"""
+# create a temporary file for the WKS content
+with NamedTemporaryFile("w", suffix=".wks") as wks:
+wks.write(
+'part --source bootimg-efi '
+
'--sourceparams="loader=grub-efi,install-kernel-into-boot-dir=true" '
+'--label boot --active\n'
+)
+wks.flush()
+# create a temporary directory to extract the disk image to
+with TemporaryDirectory() as tmpdir:
+img = 'core-image-minimal'
+# build the image using the WKS file
+cmd = "wic create %s -e %s -o %s" % (wks.name, img, 
self.resultdir)
+runCmd(cmd)
+wksname = os.path.splitext(os.path.basename(wks.name))[0]
+out = glob(os.path.join(self.resultdir, "%s-*.direct" % 
wksname))
+self.assertEqual(1, len(out))
+# extract the content of the disk image to the temporary 
directory
+cmd = "wic cp %s:1 %s" % (out[0], tmpdir)
+runCmd(cmd)
+# check if the kernel is installed or not
+kimgtype = get_bb_var('KERNEL_IMAGETYPE', img)
+found = False
+for file in os.listdir(tmpdir):
+if file == kimgtype:
+found = True
+break
+self.assertTrue(
+found, "The kernel image '{}' was not found in the boot 
partition".format(kimgtype)
+)
+
 def test_build_image_name(self):
 """Test wic create wictestdisk --image-name=core-image-minimal"""
 cmd = "wic create wic

[OE-core] [PATCH] meta/lib/oeqa/selftest/cases/wic: Add tests for configuring kernel image install into boot partition.

2023-02-10 Thread Kareem Zarka
- test_skip_kernel_install: This test verifies that the kernel is not
installed in the boot partition when the 'install-kernel-into-boot-dir'
parameter is set to false.

- test_kernel_install: This test verifies that the kernel is installed
in the boot partition when the 'install-kernel-into-boot-dir' parameter
is set to true .

Both tests use a WKS (Kickstart) file to specify the desired
configuration, build a disk image using WIC, and extract the disk image
to a temporary directory to verify the results.

Signed-off-by: Kareem Zarka 
---
 meta/lib/oeqa/selftest/cases/wic.py | 66 +
 1 file changed, 66 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/wic.py 
b/meta/lib/oeqa/selftest/cases/wic.py
index ca1abb970a..b46dccc144 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -16,6 +16,7 @@ import hashlib
 from glob import glob
 from shutil import rmtree, copy
 from tempfile import NamedTemporaryFile
+from tempfile import TemporaryDirectory
 
 from oeqa.selftest.case import OESelftestTestCase
 from oeqa.core.decorator import OETestTag
@@ -146,6 +147,71 @@ class CLITests(OESelftestTestCase):
 self.assertEqual(1, runCmd('wic', ignore_status=True).status)
 
 class Wic(WicTestCase):
+def test_skip_kernel_install(self):
+"""Test the functionality of not installing the kernel in the boot 
directory using the wic plugin"""
+# create a temporary file for the WKS content
+with NamedTemporaryFile("w", suffix=".wks") as wks:
+wks.write(
+'part --source bootimg-efi '
+
'--sourceparams="loader=grub-efi,install-kernel-into-boot-dir=false" '
+'--label boot --active\n'
+)
+wks.flush()
+# create a temporary directory to extract the disk image to
+with TemporaryDirectory() as tmpdir:
+img = 'core-image-minimal'
+# build the image using the WKS file
+cmd = "wic create %s -e %s -o %s" % (
+wks.name, img, self.resultdir)
+runCmd(cmd)
+wksname = os.path.splitext(os.path.basename(wks.name))[0]
+out = glob(os.path.join(
+self.resultdir, "%s-*.direct" % wksname))
+self.assertEqual(1, len(out))
+# extract the content of the disk image to the temporary 
directory
+cmd = "wic cp %s:1 %s" % (out[0], tmpdir)
+runCmd(cmd)
+# check if the kernel is installed or not
+kimgtype = get_bb_var('KERNEL_IMAGETYPE', img)
+for file in os.listdir(tmpdir):
+if file == kimgtype:
+raise AssertionError(
+"The kernel image '{}' was found in the 
partition".format(kimgtype)
+)
+
+def test_kernel_install(self):
+"""Test the installation of the kernel to the boot directory in the 
wic plugin"""
+# create a temporary file for the WKS content
+with NamedTemporaryFile("w", suffix=".wks") as wks:
+wks.write(
+'part --source bootimg-efi '
+
'--sourceparams="loader=grub-efi,install-kernel-into-boot-dir=true" '
+'--label boot --active\n'
+)
+wks.flush()
+# create a temporary directory to extract the disk image to
+with TemporaryDirectory() as tmpdir:
+img = 'core-image-minimal'
+# build the image using the WKS file
+cmd = "wic create %s -e %s -o %s" % (wks.name, img, 
self.resultdir)
+runCmd(cmd)
+wksname = os.path.splitext(os.path.basename(wks.name))[0]
+out = glob(os.path.join(self.resultdir, "%s-*.direct" % 
wksname))
+self.assertEqual(1, len(out))
+# extract the content of the disk image to the temporary 
directory
+cmd = "wic cp %s:1 %s" % (out[0], tmpdir)
+runCmd(cmd)
+# check if the kernel is installed or not
+kimgtype = get_bb_var('KERNEL_IMAGETYPE', img)
+found = False
+for file in os.listdir(tmpdir):
+if file == kimgtype:
+found = True
+break
+self.assertTrue(
+found, "The kernel image '{}' was not found in the boot 
partition".format(kimgtype)
+)
+
 def test_build_image_name(self):
 """Test wic create wictestdisk --image-name=core-image-minimal"""
 cmd = "wic create wic

[OE-core] [PATCH] wic/plugins/source/bootimg-efi: Configure installation of

2023-02-10 Thread Kareem Zarka
The issue with installing the kernel image to both rootfs
and boot partition is that some systems rely on the kernel image in
rootfs and not in the boot partition.
This leads to duplication of the kernel image, which can cause
unnecessary storage usage.

This patch provides a solution to the problem by adding a new parameter
"install-kernel-into-boot-dir" to the wic kickstart file.
If this parameter is set to 'true', the plugin will install the
kernel image to the boot partition. If the parameter is set to 'false',
the plugin will skip installing the kernel image, avoiding duplication.

Tests for this functionality will be added in the next patch.

Signed-off-by: Kareem Zarka 
---
 scripts/lib/wic/plugins/source/bootimg-efi.py | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py 
b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 4b00913a70..4e99d37f26 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -363,9 +363,10 @@ class BootimgEFIPlugin(SourcePlugin):
 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)
-exec_cmd(install_cmd)
+if source_params.get('install-kernel-into-boot-dir') != 'false':
+install_cmd = "install -m 0644 %s/%s %s/%s" % \
+(staging_kernel_dir, kernel, hdddir, kernel)
+exec_cmd(install_cmd)
 
 if get_bitbake_var("IMAGE_EFI_BOOT_FILES"):
 for src_path, dst_path in cls.install_task:
-- 
2.25.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#176987): 
https://lists.openembedded.org/g/openembedded-core/message/176987
Mute This Topic: https://lists.openembedded.org/mt/96814230/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [OE-core] [PATCH] wic/plugins/source/bootimg-efi: Skip installing kernel-image into boot.

2023-02-08 Thread Kareem Zarka
Dear Luca

Thank you for the reply .

Please check https://lists.openembedded.org/g/openembedded-core/message/176829 
when you have time.

Kindest regards .

Kareem Zarka

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#176904): 
https://lists.openembedded.org/g/openembedded-core/message/176904
Mute This Topic: https://lists.openembedded.org/mt/96791012/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[OE-core] [PATCH] meta/lib/oeqa/selftest/cases/wic: Add tests for kernel

2023-02-07 Thread Kareem Zarka
This commit adds two tests for the WIC plugin:

- test_skip_kernel_install: This test verifies that the kernel is not
installed in the boot partition when the 'install-kernel-into-boot-dir'
parameter is set to false.

- test_kernel_install: This test verifies that the kernel is installed
in the boot partition when the 'install-kernel-into-boot-dir' parameter
is set to true.

Both tests use a WKS (Kickstart) file to specify the desired
configuration, build a disk image using WIC,
and extract the disk image to a temporary directory to verify the
results.

Signed-off-by: Kareem Zarka 
---
 meta/lib/oeqa/selftest/cases/wic.py | 67 +
 1 file changed, 67 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/wic.py 
b/meta/lib/oeqa/selftest/cases/wic.py
index ca1abb970a..251b61fa67 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -16,6 +16,7 @@ import hashlib
 from glob import glob
 from shutil import rmtree, copy
 from tempfile import NamedTemporaryFile
+from tempfile import TemporaryDirectory
 
 from oeqa.selftest.case import OESelftestTestCase
 from oeqa.core.decorator import OETestTag
@@ -228,6 +229,72 @@ class Wic(WicTestCase):
 runCmd(cmd)
 self.assertEqual(1, len(glob(os.path.join(self.resultdir, 
"sdimage-bootpart-*direct"
 
+def test_skip_kernel_install(self):
+"""Test the functionality of not installing the kernel in the boot 
directory using the wic plugin"""
+# create a temporary file for the WKS content
+with NamedTemporaryFile("w", suffix=".wks") as wks:
+wks.write(
+'part --source bootimg-efi '
+
'--sourceparams="loader=grub-efi,install-kernel-into-boot-dir=false" '
+'--label boot --active\n'
+)
+wks.flush()
+# create a temporary directory to extract the disk image to
+with TemporaryDirectory() as tmpdir:
+img = 'core-image-minimal'
+# build the image using the WKS file
+cmd = "wic create %s -e %s -o %s" % (
+wks.name, img, self.resultdir)
+runCmd(cmd)
+wksname = os.path.splitext(os.path.basename(wks.name))[0]
+out = glob(os.path.join(
+self.resultdir, "%s-*.direct" % wksname))
+self.assertEqual(1, len(out))
+# extract the content of the disk image to the temporary 
directory
+cmd = "wic cp %s:1 %s" % (out[0], tmpdir)
+runCmd(cmd)
+# check if the kernel is installed or not
+kimgtype = get_bb_var('KERNEL_IMAGETYPE', img)
+for file in os.listdir(tmpdir):
+if file == kimgtype:
+raise AssertionError(
+"The kernel image '{}' was found in\
+the partition".format(kimgtype)
+)
+
+def test_kernel_install(self):
+"""Test the installation of the kernel to the boot directory in the 
wic plugin"""
+# create a temporary file for the WKS content
+with NamedTemporaryFile("w", suffix=".wks") as wks:
+wks.write(
+'part --source bootimg-efi '
+
'--sourceparams="loader=grub-efi,install-kernel-into-boot-dir=true" '
+'--label boot --active\n'
+)
+wks.flush()
+# create a temporary directory to extract the disk image to
+with TemporaryDirectory() as tmpdir:
+img = 'core-image-minimal'
+# build the image using the WKS file
+cmd = "wic create %s -e %s -o %s" % (wks.name, img, 
self.resultdir)
+runCmd(cmd)
+wksname = os.path.splitext(os.path.basename(wks.name))[0]
+out = glob(os.path.join(self.resultdir, "%s-*.direct" % 
wksname))
+self.assertEqual(1, len(out))
+# extract the content of the disk image to the temporary 
directory
+cmd = "wic cp %s:1 %s" % (out[0], tmpdir)
+runCmd(cmd)
+# check if the kernel is installed or not
+kimgtype = get_bb_var('KERNEL_IMAGETYPE', img)
+found = False
+for file in os.listdir(tmpdir):
+if file == kimgtype:
+found = True
+break
+self.assertTrue(
+found, "The kernel image was not found in the boot 
partition"
+)
+
 # TODO this doesn't have to be x86-specific
 @skipIfNotArch(['i586', 'i686', 'x86_64'])

[OE-core] [PATCH] wic/plugins/source/bootimg-efi: Configure installation of

2023-02-07 Thread Kareem Zarka
The issue with installing the kernel image to both rootfs
and boot partition is that some systems rely on the kernel image in
rootfs and not in the boot partition.
This leads to duplication of the kernel image, which can cause
unnecessary storage usage.

This patch provides a solution to the problem by adding a new parameter
"install-kernel-into-boot-dir" to the wic kickstart file.
If this parameter is set to 'true', the plugin will install the
kernel image to the boot partition. If the parameter is set to 'false',
the plugin will skip installing the kernel image, avoiding duplication.

Tests for this functionality will be added in the next patch.

Signed-off-by: Kareem Zarka 
---
 scripts/lib/wic/plugins/source/bootimg-efi.py | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py 
b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 4b00913a70..4e99d37f26 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -363,9 +363,10 @@ class BootimgEFIPlugin(SourcePlugin):
 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)
-exec_cmd(install_cmd)
+if source_params.get('install-kernel-into-boot-dir') != 'false':
+install_cmd = "install -m 0644 %s/%s %s/%s" % \
+(staging_kernel_dir, kernel, hdddir, kernel)
+exec_cmd(install_cmd)
 
 if get_bitbake_var("IMAGE_EFI_BOOT_FILES"):
 for src_path, dst_path in cls.install_task:
-- 
2.25.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#176829): 
https://lists.openembedded.org/g/openembedded-core/message/176829
Mute This Topic: https://lists.openembedded.org/mt/96814230/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [OE-core] [PATCH] wic/plugins/source/bootimg-efi: Skip installing kernel-image into boot.

2023-02-07 Thread Kareem Zarka
Dear Richard and Luca,

Thank you for your feedback. I will take it into consideration.

I understand that "XXX != False" and "not XXX" have different interpretations 
in Python.

The expression "XXX != False" only evaluates to True if XXX is not equal to 
False.

This means that if skip-kernel-install is None, the condition will be False.

On the other hand, "not XXX" evaluates to True if XXX is falsy, which includes 
None, False, 0, empty string, etc.

This is why I used it in my code, as I wanted to consider the case where 
skip-kernel-install is None.

Therefore, if skip-kernel-install is not provided, its value will be None, and 
the condition will be True, which means the kernel image will be installed.

However, if we want to enforce the requirement for the user to always provide 
the parameter skip-kernel-install with either the value true or false, we can 
make use (!= false , == true).

Let me know what suits us best in this case .

Kindest regards .

Kareem Zarka.

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#176818): 
https://lists.openembedded.org/g/openembedded-core/message/176818
Mute This Topic: https://lists.openembedded.org/mt/96791012/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[OE-core] [PATCH] meta/lib/oeqa/selftest/cases/wic: Add tests for kernel installation and skip-kernel-install in wic plugin.

2023-02-06 Thread Kareem Zarka
This commit adds two tests to the wic plugin to verify that the kernel
is installed correctly when `skip-kernel-install` is not provided
and not installed when `skip-kernel-install=true`.
These tests ensure that the wic plugin is working correctly and will
help catch any future issues with kernel installation.

Signed-off-by: Kareem Zarka 
---
 meta/lib/oeqa/selftest/cases/wic.py | 71 +
 1 file changed, 71 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/wic.py 
b/meta/lib/oeqa/selftest/cases/wic.py
index ca1abb970a..40188a866a 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -16,6 +16,7 @@ import hashlib
 from glob import glob
 from shutil import rmtree, copy
 from tempfile import NamedTemporaryFile
+from tempfile import TemporaryDirectory
 
 from oeqa.selftest.case import OESelftestTestCase
 from oeqa.core.decorator import OETestTag
@@ -220,6 +221,76 @@ class Wic(WicTestCase):
 result = runCmd("wic ls %s:1/ -n %s" % (images[0], sysroot))   
 self.assertIn("kernel",result.output)
 
+def test_skip_kernel_install(self):
+"""Test skip_kernel_install in wic plugin"""
+# create a temporary file for the WKS content
+with NamedTemporaryFile("w", suffix=".wks") as wks:
+# write the WKS content to the temporary file
+wks.writelines([
+'part --source bootimg-efi \
+--sourceparams="loader=grub-efi,skip-kernal-install=true"\
+--label boot --active'
+])
+wks.flush()
+# create a temporary directory to extract the disk image to
+with TemporaryDirectory() as tmpdir:
+img = 'core-image-minimal'
+# build the image using the WKS file
+cmd = "wic create %s -e %s -o %s" % (wks.name, img, 
self.resultdir)
+runCmd(cmd)
+wksname = os.path.splitext(os.path.basename(wks.name))[0]
+out = glob(os.path.join(self.resultdir, "%s-*.direct" % 
wksname))
+self.assertEqual(1, len(out))
+
+# extract the content of the disk image to the temporary 
directory
+cmd = "wic cp %s:1 %s" % (out[0], tmpdir)
+runCmd(cmd)
+
+# check if the kernel is installed or not
+kimgtype = get_bb_var('KERNEL_IMAGETYPE', 'core-image-minimal')
+for file in os.listdir(tmpdir):
+if file == kimgtype :
+raise AssertionError(
+"The kernel image '{}' was found in\
+the partition".format(kimgtype)
+)
+
+def test_kernel_installation(self):
+"""Test kernel installation in wic plugin"""
+# create a temporary file for the WKS content
+with NamedTemporaryFile("w", suffix=".wks") as wks:
+# write the WKS content to the temporary file
+wks.writelines([
+'part --source bootimg-efi \
+--sourceparams="loader=grub-efi"\
+--label boot --active\n'
+])
+wks.flush()
+# create a temporary directory to extract the disk image to
+with TemporaryDirectory() as tmpdir:
+img = 'core-image-minimal'
+# build the image using the WKS file
+cmd = "wic create %s -e %s -o %s" % (wks.name, img, 
self.resultdir)
+runCmd(cmd)
+wksname = os.path.splitext(os.path.basename(wks.name))[0]
+out = glob(os.path.join(self.resultdir, "%s-*.direct" % 
wksname))
+self.assertEqual(1, len(out))
+
+# extract the content of the disk image to the temporary 
directory
+cmd = "wic cp %s:1 %s" % (out[0], tmpdir)
+runCmd(cmd)
+
+# check if the kernel is installed or not
+kimgtype = get_bb_var('KERNEL_IMAGETYPE', 'core-image-minimal')
+for file in os.listdir(tmpdir):
+if file == kimgtype :
+found = True
+break
+self.assertTrue(
+found,"The kernel image was not found\
+in the boot prtition".format(kimgtype)
+)
+
 def test_sdimage_bootpart(self):
 """Test creation of sdimage-bootpart image"""
 cmd = "wic create sdimage-bootpart -e core-image-minimal -o %s" % 
self.resultdir
-- 
2.25.1


-=-=-=-=

[OE-core] [PATCH] wic/plugins/source/bootimg-efi: Skip installing kernel-image into boot.

2023-02-06 Thread Kareem Zarka
The issue with installing the kernel-image to both rootfs
and boot partition is that some systems rely on the kernel-image in
rootfs and not in the boot partition.
This leads to duplication of the kernel-image, which can cause
unnecessary storage usage and potential compatibility issues.

This patch provides a solution to this problem by adding a new
parameter "skip-kernel-install" to the wic kickstart file, which can
be passed to the plugin.
If the parameter is provided, the plugin will skip installing the
kernel-image to the boot partition, avoiding duplication and potential
issues.

By adding this new parameter, we give the users the option to install
the kernel-image only in rootfs, or to install it in both rootfs and
boot partition, depending on their needs and preferences.
This will help to improve the system's storage usage and compatibility.

Tests for this functionality will be added in the next patch.

Signed-off-by: Kareem Zarka 
---
 scripts/lib/wic/plugins/source/bootimg-efi.py | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py 
b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 4b00913a70..363b9f5242 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -363,9 +363,13 @@ class BootimgEFIPlugin(SourcePlugin):
 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)
-exec_cmd(install_cmd)
+# skip-kernal-install was added to source_params to conifgure 
installing the kernel-image.
+# set skip_kernal_install in the kickstart file to skip installing 
it into hdddir.
+# if not set then the kernel-image will be installed.
+if not  source_params.get('skip-kernal-install'):
+install_cmd = "install -m 0644 %s/%s %s/%s" % \
+(staging_kernel_dir, kernel, hdddir, kernel)
+exec_cmd(install_cmd)
 
 if get_bitbake_var("IMAGE_EFI_BOOT_FILES"):
 for src_path, dst_path in cls.install_task:
-- 
2.25.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#176794): 
https://lists.openembedded.org/g/openembedded-core/message/176794
Mute This Topic: https://lists.openembedded.org/mt/96791012/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[OE-core] [PATCH] bootimg-efi.py: Skip installing kernel-image into boot partition for rootfs-reliant systems.

2023-01-31 Thread Kareem Zarka
From: Kareem Zarka 

The issue with installing the kernel-image to both rootfs
and boot partition is that some systems rely on the kernel-image in
rootfs and not in the boot partition.
This leads to duplication of the kernel-image, which can cause
unnecessary storage usage and potential compatibility issues.

This patch provides a solution to this problem by adding a new
parameter "skip-kernel-install" to the wic kickstart file, which can
be passed to the plugin.
If the parameter is provided, the plugin will skip installing the
kernel-image to the boot partition, avoiding duplication and potential
issues.

By adding this new parameter, we give the users the option to install
the kernel-image only in rootfs, or to install it in both rootfs and
boot partition, depending on their needs and preferences.
This will help to improve the system's storage usage and compatibility.

Signed-off-by: Kareem Zarka 
---
 scripts/lib/wic/plugins/source/bootimg-efi.py | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py 
b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 4b00913a70..e04d49abe6 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -363,9 +363,13 @@ class BootimgEFIPlugin(SourcePlugin):
 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)
-exec_cmd(install_cmd)
+# skip_kernal_install was added to source_params to conifgure 
installing the kernel-image.
+# set skip_kernal_install in the kickstart file to skip installing 
it into hdddir.
+# if not set then the kernel-image will be installed.
+if not  source_params.get('skip_kernal_install'):
+install_cmd = "install -m 0644 %s/%s %s/%s" % \
+(staging_kernel_dir, kernel, hdddir, kernel)
+exec_cmd(install_cmd)
 
 if get_bitbake_var("IMAGE_EFI_BOOT_FILES"):
 for src_path, dst_path in cls.install_task:
-- 
2.25.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#176517): 
https://lists.openembedded.org/g/openembedded-core/message/176517
Mute This Topic: https://lists.openembedded.org/mt/96650530/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-