Commit Graph

95 Commits

Author SHA1 Message Date
Hongxu Jia
2768d6f676 wic-image-minimal, oeqa/selftest/wic: run 'wic ls/cp/rm' in bitbake task
Due to commit [2255f28b57 wic: add WIC_SECTOR_SIZE variable][1] applied,
call `wic ls|cp|rm|write' in bitbake task will hung, but we have no scenario
case to cover it

After commit [scripts/wic: fix calling wic ls|cp|rm|write hung in bitbake task] applied,
this commit run `wic cp|ls|rm' in case wic.Wic2.test_wic_image_type and wic.Wic2.test_qemu,
at post function of with do_image_wic in image wic-image-minimal, and
check if file is there

$ echo 'SANITY_TESTED_DISTROS = ""' >> conf/local.conf
$ oe-selftest -r wic.Wic2.test_wic_image_type wic.Wic2.test_qemu
...
2025-06-23 15:46:22,157 - oe-selftest - INFO - Adding: "include selftest.inc" in /buildarea5/hjia/poky/build-st/conf/local.conf
2025-06-23 15:46:22,157 - oe-selftest - INFO - Adding: "include bblayers.inc" in bblayers.conf
2025-06-23 15:46:22,157 - oe-selftest - INFO - test_qemu (wic.Wic2)
The variable 'TEST_RUNQEMUPARAMS' is not defined
2025-06-23 15:56:46,319 - oe-selftest - INFO -  ... ok
2025-06-23 15:56:46,324 - oe-selftest - INFO - test_wic_image_type (wic.Wic2)
2025-06-23 15:57:17,780 - oe-selftest - INFO -  ... ok
2025-06-23 15:57:17,781 - oe-selftest - INFO - ----------------------------------------------------------------------
2025-06-23 15:57:17,781 - oe-selftest - INFO - Ran 2 tests in 655.792s
2025-06-23 15:57:17,781 - oe-selftest - INFO - OK
2025-06-23 15:57:25,743 - oe-selftest - INFO - RESULTS:
2025-06-23 15:57:25,743 - oe-selftest - INFO - RESULTS - wic.Wic2.test_qemu: PASSED (624.16s)
2025-06-23 15:57:25,744 - oe-selftest - INFO - RESULTS - wic.Wic2.test_wic_image_type: PASSED (31.46s)
2025-06-23 15:57:25,746 - oe-selftest - INFO - SUMMARY:
2025-06-23 15:57:25,746 - oe-selftest - INFO - oe-selftest () - Ran 2 tests in 655.793s
2025-06-23 15:57:25,746 - oe-selftest - INFO - oe-selftest - OK - All required tests passed (successes=2, skipped=0, failures=0, errors=0)

(From OE-Core rev: 18d774eafb7fba720882fcdb945d145b82fa1dd4)

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-06-26 11:02:34 +01:00
Richard Purdie
a65fd2b9d5 wic: Update after plugin name changes
Update the plugin names to account for the "-" to "_" plugin name change.

(From OE-Core rev: afa1b5c9f6ed17c021e37a54d0d6abee50a60bf9)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-06-16 17:57:30 +01:00
Mikko Rapeli
e7c70cfca8 oeqa/selftest/wic: Add ext4 to IMAGE_FSTYPES in test_exclude_path_with_extra_space
All qemu machines have ext4 in IMAGE_FSTYPES which makes
native mkfs.ext4 available at wic image build time.
genericarm64 defaults to only wic in IMAGE_FSTYPES
and this test was failing:

| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing python function set_image_size
| DEBUG: 148548.400000 = 114268 * 1.300000
| DEBUG: 652644.400000 = max(148548.400000, 8192)[148548.400000] + 504096
| DEBUG: 652645.000000 = int(652644.400000)
| DEBUG: 652645 = aligned(652645)
| DEBUG: returning 652645
| DEBUG: Python function set_image_size finished
| DEBUG: Executing shell function do_image_wic
| INFO: Creating image(s)...
|
| ERROR: A native program mkfs.ext4 required to build the image was not found (see details above).
|
| Please make sure wic-tools have e2fsprogs-native in its DEPENDS, build it with 'bitbake wic-tools' and try again.
|
| WARNING: exit code 1 from a shell command.
NOTE: recipe core-image-minimal-1.0-r0: task do_image_wic: Failed

(From OE-Core rev: 59b5ec3d53058237dc6f3e85385851d1a8a97f97)

Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-05-01 14:22:54 +01:00
Mikko Rapeli
87c5907bc8 oeqa/selftest/wic: Increase rootfs size in test_offset
This test is failing on genericarm64 which includes all kernel
modules on rootfs by default. Recently added kernel modules
triggered the size limits to be exceeded. Fixes:

ERROR: Actual rootfs size (112884 kB) is larger than allowed size 102400 kB

Doubling the size to avoid issues like this on machines which
may include a lot of packages on default images. Size of the
rootfs does not matter for the test, only that the offsets are
correct in various usecases.

(From OE-Core rev: 1ff542318ea66514ef550d4817ba9b2ef688134c)

Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-05-01 14:22:54 +01:00
Trevor Woerner
e97d88578c oe-selftest.wic: add native sysroot handling
The wic test_exclude_path_with_extra_space does not succeed on debian-based
AB workers since they, by default, do not install the 'parted' utility. This
test installs the 'wic-tools' package, which includes the 'parted' utility,
but it is not being found/used for some unknown reason.

In the previous patch it was believed that doing some extra PATH handling
(as performed by some other tests with a python try...finally block) would
solve the issue. That turned out to not be the case. This patch starts by
reverting that change, since it has no benefit.

In order to use the native tools from the 'wic-tools' package, wic's
'--native-sysroot' can be used (as demonstrated in other tests). In fact
the wic help message explaining the purpose of this flag states that it is
for passing "...the path to the native sysroot containing the tools(parted
and mtools) to use"[sic].

Removing the host's 'parted' utility better simulates the situation found
on the debian workers for testing. This patch is seen to make this test pass
with no host 'parted' utility in place.

(From OE-Core rev: 306e4831f07d4a8db6ab880487813a6abd0ffa08)

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-05-01 14:22:54 +01:00
Trevor Woerner
69c5f72278 oe-selftest.wic: add PATH handling
The wic test_exclude_path_with_extra_space test succeeds on non-debian AB
workers. Add PATH handling so parted from the wic-tools can be found on
debian-based AB workers.

Fixes [YOCTO #15838]

(From OE-Core rev: 3994e727f10c5a0143d52bdd6e1d9ca037296d59)

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-04-29 09:59:01 +01:00
Trevor Woerner
35807e8f63 wic: do not ignore ROOTFS_SIZE if the rootfs is modified
If the *.wks file contains a "--source rootfs" then
lib/wic/plugins/source/rootfs.py will be invoked to generate (what is assumed
to be) the rootfs partition. If the rootfs partition needs to be tweaked or
modified, the "rootfs.py" plugin will make a copy of the filesystem and then
perform the changes on that copy. In other words, if the "--source rootfs"
line of the *.wks file also contains any of:

	--exclude-path
	--include-path
	--change-directory
	--use-label (i.e. modify etc/fstab)

then the rootfs will be copied first, then the copy is modified.

If, for example, the unmodified IMAGE_ROOTFS is:

	.../tmp/work/qemuarm64_secureboot-oe-linux/core-image-base/1.0/rootfs

then the copy would be made at:

	.../tmp/work/qemuarm64_secureboot-oe-linux/core-image-base/1.0/tmp-wic/rootfs${LINENO}

where ${LINENO} is the line number where this "--source rootfs" line appears
in the *wks file.

When it comes time to make an actual partition of a specific filesystem type,
lib/wic/partition.py::prepare_rootfs() is called. It is in this function that
wic figures out if any extra size needs to be added. The bitbake variable used
to specify the ultimate rootfs size is ROOTFS_SIZE, and since this variable is
only valid for the rootfs (and not any other partitions), the code also
verifies that the partition being created is ${IMAGE_ROOTFS}:

	rsize_bb = get_bitbake_var('ROOTFS_SIZE')
	rdir = get_bitbake_var('IMAGE_ROOTFS')
	if rsize_bb and rdir == rootfs_dir:
		<use rsize_bb>
	else:
		<calculate the partition size using "du -ks $p">

As noted above, if lib/wic/plugins/source/rootfs.py has made a copy, then the
"rdir == rootfs_dir" clause will fail and the code will assume this partition
is not a rootfs since the strings do not compare equal.

Therefore, in order to determine if this is a rootfs, retain the existing
"rdir == rootfs_dir" comparison, but also add another one to check whether or
not this is a wic-generated copy of the rootfs.

STEPS TO REPRODUCE:
	- start with the following *wks file:
		bootloader --ptable gpt
		part /boot --size=100M --active --fstype=ext4 --label boot
		part /     --source rootfs      --fstype=ext4 --label root
	- and the following extra variable in conf/local.conf:
		IMAGE_ROOTFS_EXTRA_SPACE = "500000"
	- build an image
	- run it in qemu
		$ runqemu slirp nographic serial
	- verify the root partition has extra space:
		root@qemuarm64-secureboot:~# df -h
		Filesystem                Size      Used Available Use% Mounted on
		/dev/root               721.5M     67.4M    600.6M  10% /
		devtmpfs                477.7M         0    477.7M   0% /dev
		tmpfs                    40.0K         0     40.0K   0% /mnt
		tmpfs                   489.3M     92.0K    489.2M   0% /run
		tmpfs                   489.3M     68.0K    489.2M   0% /var/volatile
		/dev/vda1               120.4M     19.9M     91.4M  18% /boot
	- modify the "/" line of the *wks file to be:
		part /     --source rootfs      --fstype=ext4 --label root --exclude-path boot/
	- build image

	when it fails:
		root@qemuarm64-secureboot:~# df -h
		Filesystem                Size      Used Available Use% Mounted on
		/dev/root                73.4M     41.9M     25.8M  62% /
		devtmpfs                477.7M         0    477.7M   0% /dev
		tmpfs                    40.0K         0     40.0K   0% /mnt
		tmpfs                   489.3M     92.0K    489.2M   0% /run
		tmpfs                   489.3M     68.0K    489.2M   0% /var/volatile
		/dev/vda1               120.4M     19.9M     91.4M  18% /boot

	after this fix:
		root@qemuarm64-secureboot:~# df -h
		Filesystem                Size      Used Available Use% Mounted on
		/dev/root               721.5M     47.4M    620.6M   7% /
		devtmpfs                477.7M         0    477.7M   0% /dev
		tmpfs                    40.0K         0     40.0K   0% /mnt
		tmpfs                   489.3M     92.0K    489.2M   0% /run
		tmpfs                   489.3M     68.0K    489.2M   0% /var/volatile
		/dev/vda1               120.4M     19.9M     91.4M  18% /boot

Doing the math we see that the /boot partition is ~20MB and in the first image
the / partition contains this ~20MB in addition to the rest of the rootfs.
This ~20MB is completely wasted since it is used in the / partition, but then
the /boot partition is mounted on top of it, making the /boot directory of /
inaccessible. After the fix the / partition has an additional ~20MB since the
/boot portion is excluded.

Fixes [YOCTO #15555]

(From OE-Core rev: 1c690aa046ebca13d7b29de50d42b5d8a4a8486c)

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-04-17 11:03:22 +01:00
Yi Zhao
5040d252c6 oeqa/selftest/wic: add test for excluding symlinks
Add test to check if --exclude-path option can exclude symlinks. This
test validates commit[1].

Test result:
$ oe-selftest -r wic.Wic.test_exclude_path
2025-04-03 15:11:25,211 - oe-selftest - INFO - meta-selftest layer not found in BBLAYERS, adding it
2025-04-03 15:11:30,016 - oe-selftest - INFO - Adding layer libraries:
2025-04-03 15:11:30,017 - oe-selftest - INFO -  /buildarea/poky/meta/lib
2025-04-03 15:11:30,017 - oe-selftest - INFO - /buildarea/poky/meta-yocto-bsp/lib
2025-04-03 15:11:30,017 - oe-selftest - INFO - /buildarea/poky/meta-selftest/lib
2025-04-03 15:11:30,019 - oe-selftest - INFO - Checking base configuration is valid/parsable
NOTE: Starting bitbake server...
2025-04-03 15:11:31,652 - oe-selftest - INFO - Adding: "include selftest.inc" in /buildarea/poky/build-st/conf/local.conf
2025-04-03 15:11:31,653 - oe-selftest - INFO - Adding: "include bblayers.inc" in bblayers.conf
2025-04-03 15:11:31,653 - oe-selftest - INFO - test_exclude_path (wic.Wic)
2025-04-03 15:43:11,341 - oe-selftest - INFO -  ... ok
2025-04-03 15:43:11,341 - oe-selftest - INFO - ----------------------------------------------------------------------
2025-04-03 15:43:11,342 - oe-selftest - INFO - Ran 1 test in 1899.900s
2025-04-03 15:43:11,342 - oe-selftest - INFO - OK
2025-04-03 15:43:14,834 - oe-selftest - INFO - RESULTS:
2025-04-03 15:43:14,835 - oe-selftest - INFO - RESULTS - wic.Wic.test_exclude_path: PASSED (1899.69s)
2025-04-03 15:43:14,836 - oe-selftest - INFO - SUMMARY:
2025-04-03 15:43:14,836 - oe-selftest - INFO - oe-selftest () - Ran 1 test in 1899.900s
2025-04-03 15:43:14,836 - oe-selftest - INFO - oe-selftest - OK - All required tests passed (successes=1, skipped=0, failures=0, errors=0)

[1] https://git.openembedded.org/openembedded-core/commit/?id=42e829ac1e9d74646b6dfb327b18b15f6b0df60b

(From OE-Core rev: 0dd455bed9b52c0cf237ea2f8bd1a8f7890078e9)

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-04-08 15:49:17 +01:00
Vyacheslav Yurkov
a7b14b3ca2 oeqa/selftest: Drop dependency on systemd-native
The tests don't need it. On top of that, this extra requirement
creates a dependency loop between systemd-systemctl-native and util-linux.

(From OE-Core rev: b5770d8c56036bdfef8d596d27433d8f408ee36f)

Signed-off-by: Vyacheslav Yurkov <uvv.mail@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-02-18 22:53:45 +00:00
Vince Chang
806c6b974b selftest: wic: wic_sector_size add wic-tools path
Add wic-tools to the PATH to avoid failures when running the
wic_sector_size test case on a build host that doesn’t have parted.

(From OE-Core rev: 013dcdf75669421bc38d699263cb1e8d5b95d398)

Signed-off-by: Vince Chang <vince_chang@aspeedtech.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-11-01 23:03:32 +00:00
Vince Chang
e07cda3174 selftest: wic: remove 2>/dev/null to help fail diagnostic
The wic test case previously used '2>/dev/null' to suppress error
messages. This commit updates the code to use 'stderr=subprocess.PIPE'
when calling runCmd().

Refer:
https://lists.openembedded.org/g/openembedded-core/topic/109308684

(From OE-Core rev: bd26d999a0ba1107ee5629a8e238f4fe945e9be5)

Signed-off-by: Vince Chang <vince_chang@aspeedtech.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-11-01 23:03:32 +00:00
Vince Chang
0a27b7b9a4 selftest: wic: add test for WIC_SECTOR_SIZE
Add test for WIC_SECTOR_SIZE=4096. Verified it on ext4 file system.

(From OE-Core rev: 69a1f18ce18d67881d7379ccc19ca001a35acb68)

Signed-off-by: Vince Chang <vince_chang@aspeedtech.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-10-29 11:19:57 +00:00
Mikko Rapeli
9d287835b2 oeqa selftest wic.py: apply build config to runqemu too
Build configuration is applied to bitbake build command
but removed before calling runqemu. Thus disabling KVM
support on aarc64 host was not effective. Note that this
pattern is used in a lot of tests. KVM gets enabled
via CI scripts.

(From OE-Core rev: 7a9fbf509fec2e149fd5702552bc4d819969ab1f)

Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-10-25 15:12:22 +01:00
Mikko Rapeli
36f7e52567 oeqa selftest wic.py: fix missing ext4 image
test_rawcopy_plugin fails if machine does not build
ext4 images by default. Make the ext4 image build
explicit in the test. Fixes test on genericarm64 machine
which defaults to wic image only.

(From OE-Core rev: 0344b9e7949ef854b09deb0874a45cde2861f55b)

Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-10-25 15:12:22 +01:00
Mikko Rapeli
18c123d8da oeqa selftest wic.py: support UKIs via uki.bbclass
Use label to detect rootfs since UKI with kernel command
line is generated before rootfs is generated by wic.

Adapt wic tests to build and boot uki.bbclass generated
UKIs.

Keeping one UKI test in wic.py and rest of the UKI features
are tested with dedicated uki.py test. Add plain non-UKI
systemd-boot tests to wic suite for aarch64 and x86.

(From OE-Core rev: 3f94256b977637d4276f82db7c20b8b5e57b9d86)

Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-10-25 15:12:22 +01:00
Mikko Rapeli
a7c025cc11 oeqa selftest wic.py: add TEST_RUNQEMUPARAMS to runqemu
To support "slirp" networking on shared build machines instead
of tun/tap devices. Users can set

TEST_RUNQEMUPARAMS = "slirp"

in their build/conf/local.conf to run selftests using "slirp"
networking. The same works for testimage.bbclass and oeqa runtime
tests.

(From OE-Core rev: 4974ec71367492ce314da63c359ccf99acfca882)

Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-10-25 15:12:22 +01:00
Lukas Funke
2da0213eee selftest: wic: add test for zerorize option of empty plugin
Add test for empty plugin which tests whether the plugin creates
partitions with actual data which is 'zero'.

(From OE-Core rev: 6c6b236b34b35d0e2c020e0f9c447ac35adf8faf)

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-06 22:55:49 +00:00
Kareem Zarka
95d8a12b31 oeqa/selftest/wic: Add tests for kernel image installation
- 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.

(From OE-Core rev: a99bc5ed8bf67f171be24c0e2220aae6cccf230e)

Signed-off-by: Kareem Zarka <kareem.zarka@huawei.com>
Signed-off-by: Christian Taedcke <christian.taedcke@weidmueller.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-04 11:23:37 +00:00
Lee Chee Yang
dfedec4b2d wic: add test for partition hidden attributes
Add test for the --hidden argument introduced in Oe-Core
rev 7a111ff58d7390b79e2e63c8059f6c25f40f8977.

(From OE-Core rev: 819286cdce6471ca3dd048d3950b943b28e6d222)

Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-11-27 22:54:59 +00:00
Richard Purdie
2564f3a432 oeqa/selftest/wic: Improve assertTrue calls
assertTrue is a problematic call use in test cases since when it fails,
you just get an unhelpful "False is not True" message.

Replace some uses with assertIn/assertNotIn which will give more helpful results
and for the rest, add msg entries which given more helpful debugging.

For example, this patch would help debugging of #15176.

(From OE-Core rev: 35d4c39e0df1a304f557471151a03d1e4b0f30c7)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-09-20 08:57:26 +01:00
Markus Niebel
4a56d0cc93 oeqa: wic: Add test for --no-table option
Add basic test for the --no-table wic part option.

(From OE-Core rev: ad89d7e6039da2d79c1d55fe7fdc8bb9c235dacf)

Signed-off-by: Markus Niebel <Markus.Niebel@ew.tq-group.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-08-29 09:41:07 +01:00
Richard Purdie
511d007248 oeqa/selftest/wic: Fix host contamination issue
If wic.Wic2.test_gpt_partition_name is run on a system without sfdisk, the test
will currently fail. As done in another test, it needs to use sfdisk from the
wic-tools sysroot. This patch fixes that host contamination issue.

(From OE-Core rev: 6f9200cc30d50888b9b63103824880abaf8b5eea)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-06-06 07:41:42 +01:00
Martin Jansa
ca12fac112 selftest: wic.py respect IMAGE_LINK_NAME
* use IMAGE_LINK_NAME instead of hardcoding
  core-image-minimal-${MACHINE} assumption

[YOCTO #12937]

(From OE-Core rev: e34d7617b00ec9423221c9c7b96be6f9e5358e6a)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-05-29 13:42:56 +01:00
Dit Kozmaj
a60925d00a selftest: wic: Add test for --part-name argument
Add test for wic --part-name argument in .wks file.
Test three different cases:
- Set only the --part-name argument.
- Set only the --label argument. In this case the GPT partition label
  is set to the value of --label for compatibility reasons.
- Set both. In this case the code has been changed to set the GPT
  partition label to the --part-name value.

The test uses a test_gpt_partition_name.wks file created for this
purpose.

(From OE-Core rev: 06af6795cf6f079362303bddb39a14459e228e72)

Signed-off-by: Dit Kozmaj <dit.kozmaj@kynetics.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-04-13 11:56:07 +01:00
Martin Jansa
e1334b120e selftest: wic: respect IMAGE_LINK_NAME also in test_rawcopy_plugin_qemu
* this one is more tricky, because the test_rawcopy_plugin.wks.in file
  is used while building core-image-minimal-mtdutils, but the image filename
  inside wks.in is from core-image-minimal, so we cannot just let bitbake
  expand IMAGE_LINK_NAME, use separate variable set in the same config fragment
  IMAGE_LINK_NAME_CORE_IMAGE_MINIMAL

[YOCTO #12937]

(From OE-Core rev: 8864ee825fdc52fe7a8cf93876c81c639fba66f4)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-03-22 13:53:29 +00:00
Martin Jansa
af9f67606c selftest: wic: respect IMAGE_LINK_NAME
* use IMAGE_LINK_NAME instead of hardcoding
  core-image-minimal-${MACHINE} assumption

[YOCTO #12937]

(From OE-Core rev: d6151aeb1e8f6162113b1123fa0f162536e48a44)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-03-22 13:53:29 +00:00
Pavel Zhukov
2e18bbb307 oeqa/selftest/wic: Add test for uefi-kernel loader
This is regression test for [1].
[1] https://bugzilla.yoctoproject.org/show_bug.cgi?id=15033

(From OE-Core rev: d8ef15bb9ef652bf85002fe523ff5060b47bca6a)

Signed-off-by: Pavel Zhukov <pavel@zhukoff.net>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-02-26 11:49:00 +00:00
Ross Burton
33b4cd0c00 oeqa/selftest/wic: use skipIfNotArch instead of custom decorator
There's now a shared decorator for architecture skipping, so use that.

(From OE-Core rev: 1ce83c6b22e5835d8fe3f733f40207526c6771d4)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-11-11 13:43:40 +00:00
Ross Burton
d3ec3aa81f oeqa/selftest/wic: skip more tests on aarch64
test_rawcopy_plugin_qemu and test_wic_image_type are x86-specific
currently as the .wks uses x86-specific bootloaders.

This can be fixed, but that can come later.

(From OE-Core rev: 93525809a1ecb01ae7218558c0d6c1b0344606c5)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-11-11 13:43:40 +00:00
Richard Purdie
35183c1b33 selftest/wic: Tweak test case to not depend on kernel size
The current test assumes the kernel size leaves a certain amount of whitespace
in the output. Improve this constraint so a slightly larger kernel doesn't fail
the test.

(From OE-Core rev: bd60c44bef4a1b5d3c8fe77a9e6d3a8f43b0dea4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-08-08 15:44:21 +01:00
Tobias Schmidl
fd255af7de oeqa/selftest/wic.py: Repaired test_qemu()
The grep is too wide, so it falsely fits additional lines that have
a UUID (i.e, `/`).

(From OE-Core rev: f72fdea1c890ddd793aa63bb9c1c0857962161cc)

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-05-27 23:50:48 +01:00
Ross Burton
c4436040eb oeqa/selftest/wic: use self.td instead of get_bb_var to save on bitbake calls
When a test case starts, self.td is populated with all the variables in
the data store.  Typically this can be used instead of get_bb_var(),
which saves a bitbake call per variable lookup.

The only catch is that in parallel runs the build directory is moved
after td is populated, so paths in the build directory are wrong: these
still need to be fetched in the test.

(From OE-Core rev: 884201c6c1bbf7c1b958bab7d7c91e27577eeaac)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-04-01 23:11:38 +01:00
Ross Burton
12a1456b06 oeqa/selftest/wic: use os.path.join to join paths
Instead of using string concatenation, use os.path.join.

(From OE-Core rev: 73d1b7163792ec089ffb3bf99f1b4f8760beaea7)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-04-01 23:11:38 +01:00
Ross Burton
ada2cbb682 oeqa/selftest/wic: rearrange tests
Split the tests into further classes: one which exercises the CLI and
doesn't need to build images at all, and another which is just the
tests that manipulate existing images.

(From OE-Core rev: c9bc4def71325dba7b7ad93001f7fe1acced0bea)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-04-01 23:11:38 +01:00
Ross Burton
443d557ba0 oeqa/selftest/wic: cleanup WicTestCase.setUpLocal
Use os.path.join to construct paths, and invoke bitbake once instead of
three times.

(From OE-Core rev: 27953d4cf6edc86cd505826c3da21222864c7760)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-04-01 23:11:37 +01:00
Ross Burton
416cce968d oeqa/selftest: tag tests that use runqemu
There may be environments or machines which don't have working runqemu,
so tag all of the tests which use runqemu() so that they can be skipped.

(From OE-Core rev: 3f45ce6d2b1dfde8bc3d554397d55f81846c52d5)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-04-01 23:11:37 +01:00
Ross Burton
1985249632 oeqa/selftest/wic: add more arch-specific annotations
Some tests which are marked as x86-specific will actually work on
aarch64 (e.g. use EFI), whilst some other tests really are x86-specific
(e.g. use syslinux).

(From OE-Core rev: 1285bdaa4f472519083c03946ee34c7d8c204e27)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-04-01 23:11:37 +01:00
Ross Burton
e2d112b471 oeqa/selftest/wic: don't hardcode kernel image type in test_wic_rm
Don't assume bzImage, resepct KERNEL_IMAGETYPE.

(From OE-Core rev: f03d47833593734489e73f054f41c3dbbe423204)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-04-01 23:11:37 +01:00
Ross Burton
e9c8d638f9 oeqa/selftest/wic: clean up only_for_arch decorator
There's no need to pass a recipe name when determining the target
architecture, there's no need to cap the size of the lru_cache as it
will only have one entry, and __name__ is set by @wraps.

(From OE-Core rev: e8e6c679f6eb74cb25c124a18af88dd5c2e2c833)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-04-01 23:11:37 +01:00
Ross Burton
8d01207fd7 oeqa/selftest/wic: remove redundant asserts
By default bitbake() will raise an assertion if it fails, so there's no
need to wrap it in a further assert.

(From OE-Core rev: de3c8994dc482cf5e9f3317c4762fe4ac35d9f31)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-04-01 23:11:37 +01:00
Ross Burton
6cd1a31bef oeqa/selftest/wic: use os.rename instead of bb.utils.rename
bb.utils.rename() only exists to handle moves across filesystems. As
these moves are within the same directory we can just use os.rename().

(From OE-Core rev: 450e09b6d4ca019848aec4c62fce280a09395b97)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-04-01 23:11:37 +01:00
Stefan Herbrechtsmeier
8adc4d0c77 selftest: wic: Disable graphic of qemu to support WSL
Disable graphic support of qemu to support qemu tests in WSL.

(From OE-Core rev: 797af95eb272bd12eac193cdfe72ddffe8aa39ca)

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-16 09:46:29 +00:00
Stefan Herbrechtsmeier
ba2bb92331 selftest: wic: Add rawcopy plugin unpack test
(From OE-Core rev: 0e4a030948707ef74f9c977d2d02d9f92c119f7e)

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-16 09:46:29 +00:00
Stefan Herbrechtsmeier
b709e926d3 selftest: wic: Remove requirement of syslinux from test_rawcopy_plugin
Remove bootimg-pcbios from wks to eliminate requirement of syslinux from
test_rawcopy_plugin to avoid the following error.

ERROR: Couldn't find correct bootimg_dir, exiting

(From OE-Core rev: 99e2321e049fa63b83f3daa076eeff7f6791986b)

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-16 09:46:29 +00:00
Kristian Klausen
b8c0f073f6 wic/bootimg-efi: Add Unified Kernel Image option
"A unified kernel image is a single EFI PE executable combining an EFI
stub loader, a kernel image, an initramfs image, and the kernel command
line.

[...]

Images of this type have the advantage that all metadata and payload
that makes up the boot entry is monopolized in a single PE file that can
be signed cryptographically as one for the purpose of EFI
SecureBoot."[1]

This commit adds a create-unified-kernel-image=true option to the
bootimg-efi plugin for creating a Unified Kernel Image[1] and installing
it into $BOOT/EFI/Linux/ with a .efi extension per the the Boot Loader
Specification[1][2]. This is useful for implementing Secure Boot.

systemd-boot is the only mainstream bootloader implementing the
specification, but GRUB should be able to boot the EFI binary, this
commit however doesn't implement the necessary changes to the GRUB
config generation logic to boot the Unified Kernel Image.

[1] https://systemd.io/BOOT_LOADER_SPECIFICATION/#type-2-efi-unified-kernel-images
[2] https://systemd.io/BOOT_LOADER_SPECIFICATION/

(From OE-Core rev: b0573f240525df561ddef6e47cb285b217d38487)

Signed-off-by: Kristian Klausen <kristian@klausen.dk>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-10-04 15:03:53 +01:00
Kristian Klausen
73384ac936 wic: Add extra-space argument
This allows extra space to be added after the last partition and is
especially useful when free space is needed for ex: adding partitions on
first boot with ex: systemd-repart[1] and the image is tested in QEMU.

[1] https://www.freedesktop.org/software/systemd/man/systemd-repart.html

(From OE-Core rev: f81b188bcf5aa18746fd622eb7b5c0dcb0b5c93d)

Signed-off-by: Kristian Klausen <kristian@klausen.dk>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-09-06 09:49:50 +01:00
Daniel Gomez
9986923d05 oeqa: wic: Add tests for --no-fstab-update
Add tests for the --no-fstab-update wic part command.

(From OE-Core rev: 90141d41a370ff377d95fb3dd144b63a85e22f8e)

Signed-off-by: Daniel Gomez <daniel@qtec.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-08-20 08:53:03 +01:00
Richard Purdie
65133015b1 meta: Manual override fixes
The automated conversion of OE-Core to use the new override sytax isn't
perfect. This patches some mis-converted lines and some lines which were missed
by the automation.

(From OE-Core rev: 4e9a06b64b43131b731fb59a0305f78a98e27fbd)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-08-02 15:44:10 +01:00
Richard Purdie
bb6ddc3691 Convert to new override syntax
This is the result of automated script conversion:

scripts/contrib/convert-overrides.py <oe-core directory>

converting the metadata to use ":" as the override character instead of "_".

(From OE-Core rev: 42344347be29f0997cc2f7636d9603b1fe1875ae)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-08-02 15:44:10 +01:00
Devendra Tewari
b71375304f classes/lib/scripts: Use bb.utils.rename() instead of os.rename()
Incremental build in Docker fails with:

OSError: [Errno 18] Invalid cross-device link

when source and destination are on different overlay filesystems.

Rather than adding fallback code to every call site, use a new wrapper
in bitbake which detects this case and falls back to shutil.move
which is slower but will handtle the overlay docker filesystems correctly.

[YOCTO #14301]

(From OE-Core rev: 656a65b2b84e7d529b89cf5de7eb838f902d84a2)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-05-06 11:16:23 +01:00