[oe-commits] [openembedded-core] 04/15: oeqa/controllers: Add test target for Systemd-boot

git at git.openembedded.org git at git.openembedded.org
Wed Jul 20 10:14:42 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit d1fd3a7dbc363bdc02d810f796b3b810cb13f029
Author: Jose Perez Carranza <jose.perez.carranza at intel.com>
AuthorDate: Wed Jul 13 14:01:57 2016 -0500

    oeqa/controllers: Add test target for Systemd-boot
    
    A new test target is neede to test Systemd-boot similar
    to gummiboot. Created a copy of GummibootTarget class
    and named as SystemdbootTarget, at this point the
    gummibootTarget will remain until documentation is
    updated with new systed information.
    
    Signed-off-by: Jose Perez Carranza <jose.perez.carranza at intel.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/lib/oeqa/controllers/masterimage.py | 40 ++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/meta/lib/oeqa/controllers/masterimage.py b/meta/lib/oeqa/controllers/masterimage.py
index 4cb7553..9ce3bf8 100644
--- a/meta/lib/oeqa/controllers/masterimage.py
+++ b/meta/lib/oeqa/controllers/masterimage.py
@@ -197,3 +197,43 @@ class GummibootTarget(MasterImageHardwareTarget):
         self.power_cycle(self.master)
         # there are better ways than a timeout but this should work for now
         time.sleep(120)
+
+
+class SystemdbootTarget(MasterImageHardwareTarget):
+
+    def __init__(self, d):
+        super(SystemdbootTarget, self).__init__(d)
+        # this the value we need to set in the LoaderEntryOneShot EFI variable
+        # so the system boots the 'test' bootloader label and not the default
+        # The first four bytes are EFI bits, and the rest is an utf-16le string
+        # (EFI vars values need to be utf-16)
+        # $ echo -en "test\0" | iconv -f ascii -t utf-16le | hexdump -C
+        # 00000000  74 00 65 00 73 00 74 00  00 00                    |t.e.s.t...|
+        self.efivarvalue = r'\x07\x00\x00\x00\x74\x00\x65\x00\x73\x00\x74\x00\x00\x00'
+        self.deploy_cmds = [
+                'mount -L boot /boot',
+                'mkdir -p /mnt/testrootfs',
+                'mount -L testrootfs /mnt/testrootfs',
+                'modprobe efivarfs',
+                'mount -t efivarfs efivarfs /sys/firmware/efi/efivars',
+                'cp ~/test-kernel /boot',
+                'rm -rf /mnt/testrootfs/*',
+                'tar xvf ~/test-rootfs.%s -C /mnt/testrootfs' % self.image_fstype,
+                'printf "%s" > /sys/firmware/efi/efivars/LoaderEntryOneShot-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f' % self.efivarvalue
+                ]
+
+    def _deploy(self):
+        # make sure these aren't mounted
+        self.master.run("umount /boot; umount /mnt/testrootfs; umount /sys/firmware/efi/efivars;")
+        # from now on, every deploy cmd should return 0
+        # else an exception will be thrown by sshcontrol
+        self.master.ignore_status = False
+        self.master.copy_to(self.rootfs, "~/test-rootfs." + self.image_fstype)
+        self.master.copy_to(self.kernel, "~/test-kernel")
+        for cmd in self.deploy_cmds:
+            self.master.run(cmd)
+
+    def _start(self, params=None):
+        self.power_cycle(self.master)
+        # there are better ways than a timeout but this should work for now
+        time.sleep(120)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list