@@ -9,13 +9,12 @@ import re
import shlex
import logging
import pprint
-import tempfile
import oe.fitimage
from oeqa.selftest.case import OESelftestTestCase
-from oeqa.utils.commands import runCmd, bitbake, get_bb_vars, get_bb_var
-
+from oeqa.utils.commands import runCmd, bitbake, get_bb_vars, get_bb_var, runqemu, runqemu_check_taps
+from oeqa.core.decorator import OETestTag
class BbVarsMockGenKeys:
def __init__(self, keydir, gen_keys="0", sign_enabled="0", keyname="", sign_ind="0", img_keyname=""):
@@ -1020,6 +1019,38 @@ FIT_HASH_ALG = "sha256"
self._gen_signing_key(bb_vars)
self._test_fitimage(bb_vars)
+ @OETestTag("runqemu")
+ def test_fit_image_initramfs_qemu(self):
+ """
+ Summary: Verify building an image including a FIT image kernel and booting in Qemu works.
+ Expected: 1. core-image-minimal including a FIT image in /boot gets built
+ 2. Qemu can boot the zImage and initramfs with direct kernel boot
+ since Qemu does not support FIT images
+ """
+
+ config = """
+DISTRO = "poky"
+MACHINE = "beaglebone-yocto"
+INITRAMFS_IMAGE = "core-image-initramfs-boot"
+FIT_IMAGE_KERNEL = "1"
+# Do not override kernel command line network configuration
+BAD_RECOMMENDATIONS:append:pn-oe-selftest-image = " init-ifupdown"
+"""
+ self.write_config(config)
+ if not runqemu_check_taps():
+ self.skipTest('No tap devices found - you must set up tap devices with scripts/runqemu-gen-tapdevs before running this test')
+ testimage = "oe-selftest-image"
+ bitbake(testimage)
+ # Boot the image
+ with runqemu(testimage) as qemu:
+ # Run a test command to see if it was installed properly
+ sshargs = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
+ result = runCmd('ssh %s root@%s %s' % (sshargs, qemu.ip, "ls -1 /boot"))
+ self.logger.debug("ls -1 /boot: %s" % str(result.output))
+ boot_files = result.output.splitlines()
+ self.assertIn("fitImage", boot_files)
+ self.assertNotIn("zImage", boot_files)
+
class FitImagePyTests(KernelFitImageBase):
"""Test cases for the fitimage.py module without calling bitbake"""