From patchwork Sun Sep 22 08:41:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Rapeli X-Patchwork-Id: 49424 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81761CF9C68 for ; Sun, 22 Sep 2024 08:42:04 +0000 (UTC) Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by mx.groups.io with SMTP id smtpd.web11.11623.1726994514174775293 for ; Sun, 22 Sep 2024 01:41:54 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=Gx/K9kyc; spf=pass (domain: linaro.org, ip: 209.85.167.52, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-53655b9bbcdso3899498e87.2 for ; Sun, 22 Sep 2024 01:41:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726994512; x=1727599312; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=G0uDRZA04VsIMktPpDX99/nDrmUPNNj3R7DcNAkt110=; b=Gx/K9kyckxO6j07kftVx4WuL1TmZ1+14ocERRndW5DYTa2Vuf3xtcIXhtDQN4ty8Qe 95gf1uzes8warf1AducAndCqqkrUiGPZv3de1aUEgQ9fjKoL3kW/6252n5mBCNTp8JwL a7NKhpW7/pO8Kx2iwjtm0KvBHFMFVBGfOKhA5F4v7WbhzhaFcZLHZf+LwABb5nICak1S L/ifHptKyYpsKzWOp8PXmgs6NTJ+6UmIFCCPXhlhfoxxsHQ58Ib9D9o6wOQ7Q9K/1fiF Ldwu6uk1sdMRYLuraRM0+HSMpX6YTto2UpMpcxf2/86VnY3mjvtY7v5s3IodPnuEg66R +DCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726994512; x=1727599312; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G0uDRZA04VsIMktPpDX99/nDrmUPNNj3R7DcNAkt110=; b=dGwPt269xudQqw2cm7ry6HMGMe2EFmAL7w6Bq4RDkWHKLaGWOJBqM6lU43EhB7z9IO YSyKMvmIxbVIMUi0dpVN+blVv0RSrcH/phUz7HJoepqwx9ZzyxkbaPryvspKL912lfew HmBnrFNH5U6m6VrRrv9WfZzOba3pWAxa/Byri21xUhJZRC3zI+tU1FePFX5tUPFGpv6Z MKeFzGmEiNAFMqnVrUD1qpQPSH7eA2kUDc+37/rHqAalVeSmtE4Sxuir6i3qS7VD43Wo PplrahVIGdigYCEuDlN4AooxDiP5pWMuTIsRmICiv0gfhOX+8tUtfwTV0c1q57QSfLQ3 u2ow== X-Gm-Message-State: AOJu0Yyrzu8eHZDLEdfbIICwH7nd1EBVF4BN0z0sp4sNVxmmgBQxZ3Rv Gibvi5xckK1JJCexXA0BjHJRPsFmnroUjImQaftrVPPdW7HV9XlwCSCWCjweiVgujc4d7WhQfcT 48UA= X-Google-Smtp-Source: AGHT+IG3/jZnvyTtcyly4cdu9kU7cdcxho1EbaUsKYaUTurxCwv3i6NYk7+E/U+UePBr4yR3rhbyVg== X-Received: by 2002:ac2:4c4b:0:b0:52c:d645:eda7 with SMTP id 2adb3069b0e04-536ad164093mr3330117e87.18.1726994512291; Sun, 22 Sep 2024 01:41:52 -0700 (PDT) Received: from localhost.localdomain (87-100-245-199.bb.dnainternet.fi. [87.100.245.199]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-536870a8745sm2877339e87.236.2024.09.22.01.41.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Sep 2024 01:41:50 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v4 01/12] python3-pefile: add recipe from meta-openembedded Date: Sun, 22 Sep 2024 11:41:17 +0300 Message-ID: <20240922084128.9648-2-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240922084128.9648-1-mikko.rapeli@linaro.org> References: <20240922084128.9648-1-mikko.rapeli@linaro.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 22 Sep 2024 08:42:04 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/204773 It is needed by systemd ukify tool and uki.bbclass to generate UEFI boot binaries. Added to fast list in ptest-packagelists.inc. Signed-off-by: Mikko Rapeli --- .../distro/include/ptest-packagelists.inc | 1 + .../python/python3-pefile/run-ptest | 3 ++ .../python/python3-pefile_2023.2.7.bb | 28 +++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 meta/recipes-devtools/python/python3-pefile/run-ptest create mode 100644 meta/recipes-devtools/python/python3-pefile_2023.2.7.bb diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc index 7b8418654a..4a48188562 100644 --- a/meta/conf/distro/include/ptest-packagelists.inc +++ b/meta/conf/distro/include/ptest-packagelists.inc @@ -70,6 +70,7 @@ PTESTS_FAST = "\ python3-more-itertools \ python3-packaging \ python3-pluggy \ + python3-pefile \ python3-pyasn1 \ python3-pytz \ python3-pyyaml \ diff --git a/meta/recipes-devtools/python/python3-pefile/run-ptest b/meta/recipes-devtools/python/python3-pefile/run-ptest new file mode 100644 index 0000000000..95ae72306f --- /dev/null +++ b/meta/recipes-devtools/python/python3-pefile/run-ptest @@ -0,0 +1,3 @@ +#!/bin/sh + +pytest --automake --ignore=./tests/pefile_test.py diff --git a/meta/recipes-devtools/python/python3-pefile_2023.2.7.bb b/meta/recipes-devtools/python/python3-pefile_2023.2.7.bb new file mode 100644 index 0000000000..e30b362323 --- /dev/null +++ b/meta/recipes-devtools/python/python3-pefile_2023.2.7.bb @@ -0,0 +1,28 @@ +SUMMARY = "Python PE parsing module" +DESCRIPTION = "A multi-platform Python module to parse and work with Portable Executable (PE) files." +HOMEPAGE = "https://github.com/erocarrera/pefile" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=38066667888b01d8118ff9cc23da1873" + +inherit setuptools3 ptest +SRCREV = "1ab2807c4eec16041e791d7a6acc68cc23fd5266" +SRC_URI = "git://github.com/erocarrera/pefile;branch=master;protocol=https \ + file://run-ptest" +S = "${WORKDIR}/git" + +BBCLASSEXTEND = "native nativesdk" + +do_install_ptest() { + install -d ${D}${PTEST_PATH}/tests + cp -rf ${S}/tests/* ${D}${PTEST_PATH}/tests/ +} + +RDEPENDS:${PN} += " \ + python3-mmap \ + python3-netclient \ + python3-stringold \ +" +RDEPENDS:${PN}-ptest += "\ + python3-pytest \ + python3-unittest-automake-output \ +" From patchwork Sun Sep 22 08:41:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Rapeli X-Patchwork-Id: 49426 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80240CF9C6C for ; Sun, 22 Sep 2024 08:42:04 +0000 (UTC) Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) by mx.groups.io with SMTP id smtpd.web10.11535.1726994517669840130 for ; Sun, 22 Sep 2024 01:41:58 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=G3NoxBbV; spf=pass (domain: linaro.org, ip: 209.85.208.181, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2f7657f9f62so37327511fa.3 for ; Sun, 22 Sep 2024 01:41:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726994515; x=1727599315; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dMHKrlrsTVk0uUvK/TIRcDwWQtyRXn6XEb4zPPLaQRU=; b=G3NoxBbV8rRoeQ5zZhvcL8ispUIlD21Br0oOWM5NZfoqTkCsiPpXbQXXb9a99rnLmU gzU6PZ/pqGfNpCGxhayXi+b1QkqQXVvlChdyBe4NP5L/BcwWs8fPmuw7JcnL1fRjBuS/ Jtw+Nwg1jWWzG9s3Nu8wRQGGz3SGV0sWc5u0wqWTTmhb0IwAFOyMzuVIwC6PNubbgwLY OMvhU11rzUX8TXyQcQFyo6R81PDd1gHA8JkTHYgx9qL44q10vtDXLvUOnWHm/H/T6yn8 97Zs3Qw2qY9MyvxQsMe22CsligAA1nd4fFdTdqWTG+mddo+T1proePXRp5E9HQajJf61 V2HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726994515; x=1727599315; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dMHKrlrsTVk0uUvK/TIRcDwWQtyRXn6XEb4zPPLaQRU=; b=VeTBTDZpcInugDamtrshHolqqDPHhMeoqbb7oTwwajc2MTMrMGAkvI7rfmRRJtpVji K/tdFWRdXXYgUOt5ecvZvnzxlbKDJPPPH15VjZcvlCxkXbyBKhdYF2Otevm3V5gMtL2R Qe95vhrau3E/xm6pw93IHqBhGM0IQmF3LH5o5uEWgpnGDhCOti8kWdTM1uyRUfHsW6k3 2gNoSnfsN158mYttGXJzzsr3m6P7/YVMCjF40fkl821Lf3p9gfQiSXMb8MvGze4+kpI8 6iV7jts32Z/60Gl2XykfQV+71tztE90sD7cZlHQwlRA7zJU5j13uv23E+4y67Xrp8vHs bvzA== X-Gm-Message-State: AOJu0YxFdobSsVVllj2s8BxLURthkCSvmdgOtHXEI+QXvkpGarKZNXdH u0oGN35168dTcrx5wcJTSXOwlTqrZFxRqI3t69UBjjQq5w44Bsc5RQU3qp7kc4s2KOVKrlrU9Ee VbiM= X-Google-Smtp-Source: AGHT+IFmYdrWdVC1EALl9ot8EIzyWVGFoM4pS9qzh5LKk0DtSoL1ChPV1ODsRUtECP4AugsmCHCDmA== X-Received: by 2002:a05:6512:1153:b0:536:52c4:d7d3 with SMTP id 2adb3069b0e04-536acf6a51cmr3752911e87.9.1726994515444; Sun, 22 Sep 2024 01:41:55 -0700 (PDT) Received: from localhost.localdomain (87-100-245-199.bb.dnainternet.fi. [87.100.245.199]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-536870a8745sm2877339e87.236.2024.09.22.01.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Sep 2024 01:41:54 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v4 02/12] maintainers.inc: add python3-pefile Date: Sun, 22 Sep 2024 11:41:18 +0300 Message-ID: <20240922084128.9648-3-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240922084128.9648-1-mikko.rapeli@linaro.org> References: <20240922084128.9648-1-mikko.rapeli@linaro.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 22 Sep 2024 08:42:04 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/204774 Recipe moved from meta-oe to oe-core and Khem Raj agreed to continue as maintainer. Signed-off-by: Mikko Rapeli --- meta/conf/distro/include/maintainers.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc index 60f36a9449..b86c91c5d6 100644 --- a/meta/conf/distro/include/maintainers.inc +++ b/meta/conf/distro/include/maintainers.inc @@ -662,6 +662,7 @@ RECIPE_MAINTAINER:pn-python3-numpy = "Trevor Gamblin " RECIPE_MAINTAINER:pn-python3-packaging = "Tim Orling " RECIPE_MAINTAINER:pn-python3-pathspec = "Ross Burton " RECIPE_MAINTAINER:pn-python3-pbr = "Zang Ruochen " +RECIPE_MAINTAINER:pn-python3-pefile = "Khem Raj " RECIPE_MAINTAINER:pn-python3-pip = "Zang Ruochen " RECIPE_MAINTAINER:pn-python3-pluggy = "Tim Orling " RECIPE_MAINTAINER:pn-python3-ply = "Tim Orling " From patchwork Sun Sep 22 08:41:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Rapeli X-Patchwork-Id: 49425 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D90BCF9C69 for ; Sun, 22 Sep 2024 08:42:04 +0000 (UTC) Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) by mx.groups.io with SMTP id smtpd.web11.11624.1726994520358224288 for ; Sun, 22 Sep 2024 01:42:00 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=Za10qO50; spf=pass (domain: linaro.org, ip: 209.85.167.41, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-53659867cbdso4730711e87.3 for ; Sun, 22 Sep 2024 01:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726994518; x=1727599318; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mJ/knW2N7PVRDDB5R+brL7z9Erq/BRnXkTj06+QJIXc=; b=Za10qO504ywWru3gsAnOSj6MfXHwFwDHOTY96I3pD8IfDRKPRqRc3SP9ixIuIZcUzk jTOF39OjNsG8EY41gzg2i/Oo49blmQypUKK/MW3Ru+D7+T07QEZqcDJvkvkOX0A3vogV JJVKjsFw1FLQCNAisKJvgxKFAPOw/chi0sygzgZKUwG2GwikIw/JnGWggtMltE2dyd9Z HRmnE/p0ghqoxhu7F7Tqz+lul4rCqSjLVH1xa63P+lrJ/KtlVH+osdQebalzFra4PIx4 CBTlsBvuJeNDwHNGjMjS99hRfe6ncmxhHS8SljFafzA5Cp6e0ZZnrKcu0HJLRYScac6j MnRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726994518; x=1727599318; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mJ/knW2N7PVRDDB5R+brL7z9Erq/BRnXkTj06+QJIXc=; b=BBDva/zO4n8lZxaQ9iGaAFX7W80qSntjllZSnJ42Av+VpUm9/hiM1f7rtpRqhEV+6E ATbznGHkAcauHdMmMV1AVk5seEuBvDsNSzznurXDL9oI8c3RfhOSYrKhyhuSwAefvPiA mYwGRVzFSSiCjJAgzLbfGrORaunLQsJH/dF5+HyACIOR4U5DUuOJJdMudVgxYP9HBsPG LxFXtIF+PE2IZaydo5UnDidrGEB+34GY0TurZZnao8kyEoLyIp1e51PviOqmO7D8M49w 0f6iGKhzSAowFqEa4xpQZGEcI3cIJFgNYbeDTGzp194TagogqYJyro1qBhuTmYoInbUg LTlA== X-Gm-Message-State: AOJu0YzDuTHTpp3L5Kbw5OcZrTiVXVTlenE6eFdCdi6iz4g3K9lmF5oP hVMKI0dcvauT7DGRzheBhlVuAUXeFAEcZeCUAB/irX6TwCfmwl99hmE0tLPxpSxe/WmP9n7ITp5 IqU8= X-Google-Smtp-Source: AGHT+IHnrHCKen2WYWx6XNaOzCg814dglkDxH4lpwlc2xuR4/TBNLlByN16CnJK7gQ1hS+CYiHhbIw== X-Received: by 2002:a05:6512:130e:b0:535:3d15:e70e with SMTP id 2adb3069b0e04-536ac32e4e4mr5402884e87.37.1726994518288; Sun, 22 Sep 2024 01:41:58 -0700 (PDT) Received: from localhost.localdomain (87-100-245-199.bb.dnainternet.fi. [87.100.245.199]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-536870a8745sm2877339e87.236.2024.09.22.01.41.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Sep 2024 01:41:56 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v4 03/12] systemd-boot-native: add runtime dependency to python3-pefile-native Date: Sun, 22 Sep 2024 11:41:19 +0300 Message-ID: <20240922084128.9648-4-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240922084128.9648-1-mikko.rapeli@linaro.org> References: <20240922084128.9648-1-mikko.rapeli@linaro.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 22 Sep 2024 08:42:04 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/204775 It's needed to run the ukify script. Signed-off-by: Mikko Rapeli --- meta/recipes-core/systemd/systemd-boot-native_256.5.bb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meta/recipes-core/systemd/systemd-boot-native_256.5.bb b/meta/recipes-core/systemd/systemd-boot-native_256.5.bb index 73db59b14e..58db408dcf 100644 --- a/meta/recipes-core/systemd/systemd-boot-native_256.5.bb +++ b/meta/recipes-core/systemd/systemd-boot-native_256.5.bb @@ -13,3 +13,5 @@ addtask install after do_unpack PACKAGES = "${PN}" FILES:${PN} = "${bindir}/ukify" + +RDEPENDS:${PN} += "python3-pefile-native" From patchwork Sun Sep 22 08:41:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Rapeli X-Patchwork-Id: 49428 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AF0ECF9C69 for ; Sun, 22 Sep 2024 08:42:14 +0000 (UTC) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by mx.groups.io with SMTP id smtpd.web10.11538.1726994524292578441 for ; Sun, 22 Sep 2024 01:42:04 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=s6lsghwS; spf=pass (domain: linaro.org, ip: 209.85.167.54, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-536584f6c84so4189670e87.0 for ; Sun, 22 Sep 2024 01:42:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726994522; x=1727599322; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TY1LcLRkDV0dwoZOYgyz7hs4xM3PQA3/2P0EdgxcE/o=; b=s6lsghwSW3W6wQoD9VQAI1a1ao2NXBYUzFzJOF94Fn2ViOevt3faWjGe1BtrcEGEdk LmsavE14Dju7/brkCfon0w2Ot2zxaIqvx7wMAG4AyZ4+ITUvw8vxZA+itR774dGXoMKP Uaps6mqIx2xCu3fNRupXWXVY0V6uTKrSIS0atn5CbW4bEgUkdE4JdIQSwaA3LyBcFv4H Eg0bJU0obiv+OLudQZKb1UZ7wXQHaEztwa+Emlpwkt4h6rKcf88Qz8A52DfzwBOWokHW nsQh50/TP/spPObTkCOukbwyS7diC2wXzj7cld2gN1JxQkRgZvaiNjos5IFJGO/qsaiv SQBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726994522; x=1727599322; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TY1LcLRkDV0dwoZOYgyz7hs4xM3PQA3/2P0EdgxcE/o=; b=KsISH+ApLLlbHoKnKTPz/deBnp7FypUVoy4Xrbaptiri1TMt/y5L/mCbhOSdvmPrmw SOCrr5xF5y3DAtkJXWp5Kf95AvFl6tOsH+a6m3Yh2/girOW6V7CzjsVAs+xcj74m4wKX FgYEGurmpTFgStRExf1koB1rsEfnAqStHdL/OdTqaBFM1uaREE7XVWxbq68TAzqdrx6b Pd0ihfFtyvFPaAyWdoVlr3QSRCnE/+3BNYP3riol2ckH7NI+WC0hEpxuwAc4Cg7NKMdh CryQx1Z1IgK7nkl0UDt1X3wOZ9P1yLTTxtAXK3DFS9s/j4Ng0UHPsaF7upXR6m+dTaMP VuvA== X-Gm-Message-State: AOJu0YyqIFUrYjBOMZ9hYO3O75H9FSDG4nQBm1DqXkRjlS2O0Q4jp64s +ZdoeTaSda7IKEN8gvPg1UyYhmgHGOEGj3pnZcQ2PQH02Ni0xwosXT8E0Xp5Ppse2X0mJz8VHdV QaJw= X-Google-Smtp-Source: AGHT+IFNJJfe8tdfoYQYnjse5syJJ4YC4HRHpB1VMy/NR57gHPAy+8O43MW8cC8FZGcpot+OwaNZUQ== X-Received: by 2002:a05:6512:138b:b0:52f:c833:861a with SMTP id 2adb3069b0e04-536ac3400b5mr4125884e87.51.1726994522314; Sun, 22 Sep 2024 01:42:02 -0700 (PDT) Received: from localhost.localdomain (87-100-245-199.bb.dnainternet.fi. [87.100.245.199]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-536870a8745sm2877339e87.236.2024.09.22.01.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Sep 2024 01:42:00 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Michelle Lin , Erik Schilling , Mikko Rapeli Subject: [PATCH v4 04/12] uki.bbclass: add class for building Unified Kernel Images (UKI) Date: Sun, 22 Sep 2024 11:41:20 +0300 Message-ID: <20240922084128.9648-5-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240922084128.9648-1-mikko.rapeli@linaro.org> References: <20240922084128.9648-1-mikko.rapeli@linaro.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 22 Sep 2024 08:42:14 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/204776 From: Michelle Lin This class calls systemd ukify tool, which will combine kernel/initrd/stub components to build the UKI. To sign the UKI (i.e. SecureBoot), the keys/cert files can be specified in a configuration file or UEFI binary signing can be done via separate steps, see qemuarm64-secureboot in meta-arm. UKIs are loaded by UEFI firmware on target which can improve security by loading only correctly signed kernel, initrd and kernel command line. Using systemd-measure to pre-calculate TPM PCR values and sign them is not supported since that requires a TPM device on the build host. Thus "ConditionSecurity=measured-uki" default from systemd 256 does not work but "ConditionSecurity=tpm2" in combination with secure boot will. These can be used to boot securely into systemd-boot, kernel, kernel command line and initrd which then securely mounts a read-only dm-verity /usr partition and creates a TPM encrypted read-write / rootfs. Tested via qemuarm64-secureboot in meta-arm with https://lists.yoctoproject.org/g/meta-arm/topic/patch_v3_02_13/108031399 and a few more changes needed, will be posted separately. Signed-off-by: Michelle Lin Acked-by: Erik Schilling Signed-off-by: Mikko Rapeli --- meta/classes-recipe/uki.bbclass | 197 ++++++++++++++++++++++++++++++++ 1 file changed, 197 insertions(+) create mode 100644 meta/classes-recipe/uki.bbclass diff --git a/meta/classes-recipe/uki.bbclass b/meta/classes-recipe/uki.bbclass new file mode 100644 index 0000000000..fac50ea8ca --- /dev/null +++ b/meta/classes-recipe/uki.bbclass @@ -0,0 +1,197 @@ +# Unified kernel image (UKI) class +# +# This bbclass merges kernel, initrd etc as a UKI standard UEFI binary, +# to be loaded with UEFI firmware and systemd-boot on target HW. +# TPM PCR pre-calculation is not supported since systemd-measure tooling +# is meant to run on target, not in cross compile environment. +# +# See: +# https://www.freedesktop.org/software/systemd/man/latest/ukify.html +# https://uapi-group.org/specifications/specs/unified_kernel_image/ +# +# The UKI contains: +# +# - UEFI stub +# The linux kernel can generate a UEFI stub, however the one from systemd-boot can fetch +# the command line from a separate section of the EFI application, avoiding the need to +# rebuild the kernel. +# - kernel +# - initramfs +# - kernel command line +# - uname -r kernel version +# - /etc/os-release to create a boot menu with version details +# - optionally secure boot signature(s) +# - other metadata (e.g. TPM PCR measurements) +# +# Usage instructions: +# +# - requires UEFI compatible firmware on target, e.g. qemuarm64-secureboot u-boot based +# from meta-arm or qemux86 ovmf/edk2 based firmware for x86_64 +# +# - Distro/build config: +# +# INIT_MANAGER = "systemd" +# MACHINE_FEATURES:append = " efi" +# DISTRO_FEATURES:append = " systemd" +# DISTRO_FEATURES_NATIVE:append = " systemd" +# EFI_PROVIDER = "systemd-boot" +# INITRAMFS_IMAGE = "core-image-minimal-initramfs" +# +# - image recipe: +# +# inherit uki +# +# - qemuboot/runqemu changes in image recipe or build config: +# +# # Kernel command line must be inside the signed uki +# QB_KERNEL_ROOT = "" +# # kernel is in the uki image, not loaded separately +# QB_DEFAULT_KERNEL = "none" +# +# - for UEFI secure boot, systemd-boot and uki (including kernel) can +# be signed but require sbsign-tool-native (recipe available from meta-secure-core, +# see also qemuarm64-secureboot from meta-arm). Set variable +# UKI_SB_KEY to path of private key and UKI_SB_CERT for certificate. +# Note that systemd-boot also need to be signed with the same key. +# +# - at runtime, UEFI firmware will load and boot systemd-boot which +# creates a menu from all detected uki binaries. No need to manually +# setup boot menu entries. +# +# - see efi-uki-bootdisk.wks.in how to create ESP partition which hosts systemd-boot, +# config file(s) for systemd-boot and the UKI binaries. +# + +DEPENDS += "\ + os-release \ + systemd-boot \ + systemd-boot-native \ + virtual/${TARGET_PREFIX}binutils \ + virtual/kernel \ +" + +inherit image-artifact-names +require ../conf/image-uefi.conf + +INITRAMFS_IMAGE ?= "core-image-minimal-initramfs" + +INITRD_ARCHIVE ?= "${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES}" + +do_image_complete[depends] += "${INITRAMFS_IMAGE}:do_image_complete" + +UKIFY_CMD ?= "ukify build" +UKI_CONFIG_FILE ?= "${UNPACKDIR}/uki.conf" +UKI_FILENAME ?= "uki.efi" +UKI_KERNEL_FILENAME ?= "${KERNEL_IMAGETYPE}" +UKI_CMDLINE ?= "rootwait root=LABEL=root console=${KERNEL_CONSOLE}" +# secure boot keys and cert, needs sbsign-tools-native (meta-secure-core) +#UKI_SB_KEY ?= "" +#UKI_SB_CERT ?= "" + +IMAGE_EFI_BOOT_FILES ?= "${UKI_FILENAME};EFI/Linux/${UKI_FILENAME}" + +do_uki[depends] += " \ + systemd-boot:do_deploy \ + virtual/kernel:do_deploy \ + " +do_uki[depends] += "${@ '${INITRAMFS_IMAGE}:do_image_complete' if d.getVar('INITRAMFS_IMAGE') else ''}" + +# ensure that the build directory is empty everytime we generate a newly-created uki +do_uki[cleandirs] = "${B}" +# influence the build directory at the start of the builds +do_uki[dirs] = "${B}" + +# we want to allow specifying files in SRC_URI, such as for signing the UKI +python () { + d.delVarFlag("do_fetch","noexec") + d.delVarFlag("do_unpack","noexec") +} + +# main task +python do_uki() { + import glob + import bb.process + + # base ukify command, can be extended if needed + ukify_cmd = d.getVar('UKIFY_CMD') + + deploy_dir_image = d.getVar('DEPLOY_DIR_IMAGE') + + # architecture + target_arch = d.getVar('EFI_ARCH') + if target_arch: + ukify_cmd += " --efi-arch %s" % (target_arch) + + # systemd stubs + stub = "%s/linux%s.efi.stub" % (d.getVar('DEPLOY_DIR_IMAGE'), target_arch) + if not os.path.exists(stub): + bb.fatal(f"ERROR: cannot find {stub}.") + ukify_cmd += " --stub %s" % (stub) + + # initrd + initramfs_image = "%s" % (d.getVar('INITRD_ARCHIVE')) + ukify_cmd += " --initrd=%s" % (os.path.join(deploy_dir_image, initramfs_image)) + + deploy_dir_image = d.getVar('DEPLOY_DIR_IMAGE') + + # kernel + kernel_filename = d.getVar('UKI_KERNEL_FILENAME') or None + if kernel_filename: + kernel = "%s/%s" % (deploy_dir_image, kernel_filename) + if not os.path.exists(kernel): + bb.fatal(f"ERROR: cannot find %s" % (kernel)) + ukify_cmd += " --linux=%s" % (kernel) + # not always needed, ukify can detect version from kernel binary + kernel_version = d.getVar('KERNEL_VERSION') + if kernel_version: + ukify_cmd += "--uname %s" % (kernel_version) + else: + bb.fatal("ERROR - UKI_KERNEL_FILENAME not set") + + # command line + cmdline = d.getVar('UKI_CMDLINE') + if cmdline: + ukify_cmd += " --cmdline='%s'" % (cmdline) + + # dtb + if d.getVar('KERNEL_DEVICETREE'): + for dtb in d.getVar('KERNEL_DEVICETREE').split(): + dtb_path = "%s/%s" % (deploy_dir_image, dtb) + if not os.path.exists(dtb_path): + bb.fatal(f"ERROR: cannot find {dtb_path}.") + ukify_cmd += " --devicetree %s" % (dtb_path) + + # custom config for ukify + if os.path.exists(d.getVar('UKI_CONFIG_FILE')): + ukify_cmd += " --config=%s" % (d.getVar('UKI_CONFIG_FILE')) + + # systemd tools + ukify_cmd += " --tools=%s%s/lib/systemd/tools" % \ + (d.getVar("RECIPE_SYSROOT_NATIVE"), d.getVar("prefix")) + + # version + ukify_cmd += " --os-release=@%s%s/lib/os-release" % \ + (d.getVar("RECIPE_SYSROOT"), d.getVar("prefix")) + + # TODO: tpm2 measure for secure boot, depends on systemd-native and TPM tooling + # needed in systemd > 254 to fulfill ConditionSecurity=measured-uki + # Requires TPM device on build host, thus not supported at build time. + #ukify_cmd += " --measure" + + # securebooot signing, also for kernel + key = d.getVar('UKI_SB_KEY') + if key: + ukify_cmd += " --sign-kernel --secureboot-private-key='%s'" % (key) + cert = d.getVar('UKI_SB_CERT') + if cert: + ukify_cmd += " --secureboot-certificate='%s'" % (cert) + + # custom output UKI filename + output = " --output=%s/%s" % (d.getVar('DEPLOY_DIR_IMAGE'), d.getVar('UKI_FILENAME')) + ukify_cmd += " %s" % (output) + + # Run the ukify command + bb.warn("uki: running command: %s" % (ukify_cmd)) + bb.process.run(ukify_cmd, shell=True) +} +addtask uki after do_rootfs before do_deploy do_image_complete do_image_wic From patchwork Sun Sep 22 08:41:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Rapeli X-Patchwork-Id: 49429 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87B93CF9C6F for ; Sun, 22 Sep 2024 08:42:14 +0000 (UTC) Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by mx.groups.io with SMTP id smtpd.web11.11627.1726994528375675191 for ; Sun, 22 Sep 2024 01:42:08 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=yVe5t1KF; spf=pass (domain: linaro.org, ip: 209.85.167.51, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-5344ab30508so3845386e87.0 for ; Sun, 22 Sep 2024 01:42:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726994526; x=1727599326; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DJNo4wGhLEtqK+sIgiiDtzQuGcRIfZ4uZOnsGWSPLew=; b=yVe5t1KFNcnx760fNLcAQL9mwKiRjJlURbzleT+Q38wZZHhZy2ei5SGebIiYQDddWV LTZMNX1zA8v+Q65bn2tNXzbyGvMqgcxgsQI2Y8sMfIJn4nXwmHacW2p4TxVi5vmlGbiJ kAA6jBItlxR1ndPceVax7kOp6fpaxKbUyW+sLamEYLUHsGFN/r6uJ+j0XM2lApVsVp1l QtNySVj6JOEQ8HJiOdTgc6Y9GklCeTvtgApga7r8MbdokPJSWPW/DYNWg46G9Nyz+Kty nXACMrOu6Mg39bXY3BOVnHBxOwel3X2/ASzuxxBkEk0m/qJ4ob/I+ajhAHLH7cOFVUdI 0E5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726994526; x=1727599326; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DJNo4wGhLEtqK+sIgiiDtzQuGcRIfZ4uZOnsGWSPLew=; b=Z3vUInZQ7/hs4fOC8WqeS3MLO271mkeCLFk52u0tq6eLsfG38WEK8+af/F6KFTNpdy odzc6tBbf2mVkzaijg/EyuSBNPZ/99VKjiEXtcd9g7/2dKgB0Iicgp19AUDzddJGy5RN 4LHQy8rLmSRJU/QmDkrB4suvj8n2Rc5IztxX8NzCWnUZvn1gedzVlah8xFAs/Sckwvzn dn2J3Ti2U1MIyCWZ/7qv9PXGPg0Enz8jmrzJ/gwVFqhFq1AtgquiZnq27VCw6yiMHRG0 c7h35MXSoCmMfaI8TqJ77IFO9nrXVbLAa/7VLI288bZQDmUE2tS/JhpB08Kra/xyJ3Tn vtiw== X-Gm-Message-State: AOJu0Yy3rDz0DUcPby6Ii3an7yZzlmvG8te+8eNywatepdIi/oNveun1 PtCP64bTXgCQl8HiSPOQ60svhuKfxoDtz30rgu6YAuH358Ow8xtt1P2SD/f/3rhBkRR2ToBzlM+ lpB0= X-Google-Smtp-Source: AGHT+IH9lwDe+0/g7jNm8vXsUQgLuaTk1BX1RFM27DCHyM1D+uOHxWcMsQDPWMRaO0i+BLS+7OhPIA== X-Received: by 2002:a05:6512:2807:b0:52e:8161:4ce6 with SMTP id 2adb3069b0e04-536abb649afmr2662940e87.25.1726994526447; Sun, 22 Sep 2024 01:42:06 -0700 (PDT) Received: from localhost.localdomain (87-100-245-199.bb.dnainternet.fi. [87.100.245.199]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-536870a8745sm2877339e87.236.2024.09.22.01.42.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Sep 2024 01:42:04 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v4 05/12] image_types_wic.bbclass: set systemd-boot and os-release dependency for all archs Date: Sun, 22 Sep 2024 11:41:21 +0300 Message-ID: <20240922084128.9648-6-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240922084128.9648-1-mikko.rapeli@linaro.org> References: <20240922084128.9648-1-mikko.rapeli@linaro.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 22 Sep 2024 08:42:14 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/204777 These work on all archs not just x86. Signed-off-by: Mikko Rapeli --- meta/classes-recipe/image_types_wic.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/classes-recipe/image_types_wic.bbclass b/meta/classes-recipe/image_types_wic.bbclass index 86f40633eb..e02eb0b367 100644 --- a/meta/classes-recipe/image_types_wic.bbclass +++ b/meta/classes-recipe/image_types_wic.bbclass @@ -110,7 +110,7 @@ WKS_FILE_DEPENDS_DEFAULT = '${@bb.utils.contains_any("BUILD_ARCH", [ 'x86_64', ' WKS_FILE_DEPENDS_DEFAULT += "bmaptool-native cdrtools-native btrfs-tools-native squashfs-tools-native e2fsprogs-native erofs-utils-native" # Unified kernel images need objcopy WKS_FILE_DEPENDS_DEFAULT += "virtual/${TARGET_PREFIX}binutils" -WKS_FILE_DEPENDS_BOOTLOADERS = "" +WKS_FILE_DEPENDS_BOOTLOADERS ?= "systemd-boot os-release" WKS_FILE_DEPENDS_BOOTLOADERS:x86 = "syslinux grub-efi systemd-boot os-release" WKS_FILE_DEPENDS_BOOTLOADERS:x86-64 = "syslinux grub-efi systemd-boot os-release" WKS_FILE_DEPENDS_BOOTLOADERS:x86-x32 = "syslinux grub-efi" From patchwork Sun Sep 22 08:41:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Rapeli X-Patchwork-Id: 49427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72C14CF9C68 for ; Sun, 22 Sep 2024 08:42:14 +0000 (UTC) Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by mx.groups.io with SMTP id smtpd.web11.11628.1726994532494796060 for ; Sun, 22 Sep 2024 01:42:12 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=oU/RBac6; spf=pass (domain: linaro.org, ip: 209.85.167.51, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-5356ab89665so4119442e87.1 for ; Sun, 22 Sep 2024 01:42:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726994531; x=1727599331; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=l0By32o/C+iOFmrKlzNfHouLvy5UgXAOcr2DlyVaw4c=; b=oU/RBac65sseBF565ucOY+DGZaFDPl/boTWqzjtNQUMmOQHNUDWt9JdptY5wzde0BT FvfEUI3lfkK08WPwESQC7HJLebhy3nc9Ujbp+L96h+3vzwVh3OA/k7Lm0cc5VLlAy5+Z u4QIZfMB6pspEdcELJ0T7II7UV561uR5RJK1yJk3aPRJG1p0pym2zX1AfkufU/bd+QJA pl98Iz/8deLFWCXQbPp3wGV6xHVvEZlJn/j70QOl1olKT+A+NEVWwk3PpWdGWb2t1dop 4xzYwCPyjJUZmRD8OgEVZe3yb6KUgRfwTVknjuAVoD/6An1aVHMsWaXP5+Zw6EE3NHHA ib2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726994531; x=1727599331; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l0By32o/C+iOFmrKlzNfHouLvy5UgXAOcr2DlyVaw4c=; b=lOtC/T38JLNfRB7LezvynX/aWgxkib//7zCi1Wu2iY4wGPeiZWf+BC4eSUtJtMXhxz faQJogoaYRjusMTc9WEv+MA51NS2Tv5N9ormjFHyJ94G4MCKdQf/0prUGVlkLwNGEVI+ Q0TQZCrpOm3U6jf5fHqlBv4eYZ/ysPg0q0u4k/HdtXAX1+NRqAkzC0XRlYKCTpKzUA3q m/l7AMjSpI9hAmFRDLzRfqrB9RMVgaoTJCdKzyK7nuwcMrARodxFKcecCqkAQunjF+wc xITdBMoCLt9F8Ewl62DaVYPHXbcEQNgRZ0g4y7w8ALah8U5f/VLSi7rB9ZVD8yZAVqoh Mb3g== X-Gm-Message-State: AOJu0YyFMtgFX+p/8B09ElbyxRXMaYN8uKAP3HhKY6GY06V1utu/JNlF POpQghdnB83HTLDXeLvGLZgyvdOgE+cW43+V5l3NQ2BbBWZS3oMoxBhe4vDg3DvTz3DmTsjRoza DQ8c= X-Google-Smtp-Source: AGHT+IFa86JjL8MdzUq1OoVnyU5DFLqBgYLfsH5ru6kfrKWOKdSjc806n8GDE4BfF6tR1I4Ve9690g== X-Received: by 2002:a05:6512:33d0:b0:536:53dd:6584 with SMTP id 2adb3069b0e04-536ad180828mr3739440e87.34.1726994530528; Sun, 22 Sep 2024 01:42:10 -0700 (PDT) Received: from localhost.localdomain (87-100-245-199.bb.dnainternet.fi. [87.100.245.199]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-536870a8745sm2877339e87.236.2024.09.22.01.42.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Sep 2024 01:42:08 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v4 06/12] wic bootimg-efi.py: keep timestamps and add debug prints Date: Sun, 22 Sep 2024 11:41:22 +0300 Message-ID: <20240922084128.9648-7-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240922084128.9648-1-mikko.rapeli@linaro.org> References: <20240922084128.9648-1-mikko.rapeli@linaro.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 22 Sep 2024 08:42:14 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/204778 Keep timestamps etc to help build reproducibility. Add prints to see what is being copied to ESP partition. Signed-off-by: Mikko Rapeli --- scripts/lib/wic/plugins/source/bootimg-efi.py | 49 ++++++++++++------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py index 7cc5131541..d00f5428da 100644 --- a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py @@ -43,16 +43,18 @@ class BootimgEFIPlugin(SourcePlugin): if initrd: initrds = initrd.split(';') for rd in initrds: - cp_cmd = "cp %s/%s %s" % (bootimg_dir, rd, hdddir) - exec_cmd(cp_cmd, True) + cp_cmd = "cp -v -p %s/%s %s" % (bootimg_dir, rd, hdddir) + out = exec_cmd(cp_cmd, True) + logger.debug("initrd files:\n%s" % (out)) else: logger.debug("Ignoring missing initrd") if dtb: if ';' in dtb: raise WicError("Only one DTB supported, exiting") - cp_cmd = "cp %s/%s %s" % (bootimg_dir, dtb, hdddir) - exec_cmd(cp_cmd, True) + cp_cmd = "cp -v -p %s/%s %s" % (bootimg_dir, dtb, hdddir) + out = exec_cmd(cp_cmd, True) + logger.debug("dtb files:\n%s" % (out)) @classmethod def do_configure_grubefi(cls, hdddir, creator, cr_workdir, source_params): @@ -150,6 +152,7 @@ class BootimgEFIPlugin(SourcePlugin): "%s/hdd/boot/loader/loader.conf", cr_workdir) cfg = open("%s/hdd/boot/loader/loader.conf" % cr_workdir, "w") cfg.write(loader_conf) + logger.debug("loader.conf:\n%s" % (loader_conf)) cfg.close() configfile = creator.ks.bootloader.configfile @@ -401,30 +404,33 @@ class BootimgEFIPlugin(SourcePlugin): exec_native_cmd(objcopy_cmd, native_sysroot) else: if source_params.get('install-kernel-into-boot-dir') != 'false': - install_cmd = "install -m 0644 %s/%s %s/%s" % \ + install_cmd = "install -v -p -m 0644 %s/%s %s/%s" % \ (staging_kernel_dir, kernel, hdddir, kernel) - exec_cmd(install_cmd) + out = exec_cmd(install_cmd) + logger.debug("Installed kernel files:\n%s" % out) if get_bitbake_var("IMAGE_EFI_BOOT_FILES"): for src_path, dst_path in cls.install_task: - install_cmd = "install -m 0644 -D %s %s" \ + install_cmd = "install -v -p -m 0644 -D %s %s" \ % (os.path.join(kernel_dir, src_path), os.path.join(hdddir, dst_path)) - exec_cmd(install_cmd) + out = exec_cmd(install_cmd) + logger.debug("Installed IMAGE_EFI_BOOT_FILES:\n%s" % out) try: if source_params['loader'] == 'grub-efi': shutil.copyfile("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir, "%s/grub.cfg" % cr_workdir) for mod in [x for x in os.listdir(kernel_dir) if x.startswith("grub-efi-")]: - cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[9:]) + cp_cmd = "cp -v -p %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[9:]) exec_cmd(cp_cmd, True) shutil.move("%s/grub.cfg" % cr_workdir, "%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir) elif source_params['loader'] == 'systemd-boot': for mod in [x for x in os.listdir(kernel_dir) if x.startswith("systemd-")]: - cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[8:]) - exec_cmd(cp_cmd, True) + cp_cmd = "cp -v -p %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[8:]) + out = exec_cmd(cp_cmd, True) + logger.debug("systemd-boot files:\n%s" % out) elif source_params['loader'] == 'uefi-kernel': kernel = get_bitbake_var("KERNEL_IMAGETYPE") if not kernel: @@ -445,8 +451,9 @@ class BootimgEFIPlugin(SourcePlugin): raise WicError("UEFI stub kernel is incompatible with target %s" % target) for mod in [x for x in os.listdir(kernel_dir) if x.startswith(kernel)]: - cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, kernel_efi_image) - exec_cmd(cp_cmd, True) + cp_cmd = "cp -v -p %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, kernel_efi_image) + out = exec_cmd(cp_cmd, True) + logger.debug("uefi-kernel files:\n%s" % out) else: raise WicError("unrecognized bootimg-efi loader: %s" % source_params['loader']) @@ -455,13 +462,15 @@ class BootimgEFIPlugin(SourcePlugin): startup = os.path.join(kernel_dir, "startup.nsh") if os.path.exists(startup): - cp_cmd = "cp %s %s/" % (startup, hdddir) - exec_cmd(cp_cmd, True) + cp_cmd = "cp -v -p %s %s/" % (startup, hdddir) + out = exec_cmd(cp_cmd, True) + logger.debug("startup files:\n%s" % out) for paths in part.include_path or []: for path in paths: - cp_cmd = "cp -r %s %s/" % (path, hdddir) + cp_cmd = "cp -v -p -r %s %s/" % (path, hdddir) exec_cmd(cp_cmd, True) + logger.debug("include_path files:\n%s" % out) du_cmd = "du -bks %s" % hdddir out = exec_cmd(du_cmd) @@ -489,12 +498,14 @@ class BootimgEFIPlugin(SourcePlugin): label = part.label if part.label else "ESP" - dosfs_cmd = "mkdosfs -n %s -i %s -C %s %d" % \ + dosfs_cmd = "mkdosfs -v -n %s -i %s -C %s %d" % \ (label, part.fsuuid, bootimg, blocks) exec_native_cmd(dosfs_cmd, native_sysroot) + logger.debug("mkdosfs:\n%s" % (str(out))) - mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (bootimg, hdddir) - exec_native_cmd(mcopy_cmd, native_sysroot) + mcopy_cmd = "mcopy -v -p -i %s -s %s/* ::/" % (bootimg, hdddir) + out = exec_native_cmd(mcopy_cmd, native_sysroot) + logger.debug("mcopy:\n%s" % (str(out))) chmod_cmd = "chmod 644 %s" % bootimg exec_cmd(chmod_cmd) From patchwork Sun Sep 22 08:41:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Rapeli X-Patchwork-Id: 49432 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76B0ACF9C68 for ; Sun, 22 Sep 2024 08:42:24 +0000 (UTC) Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) by mx.groups.io with SMTP id smtpd.web11.11630.1726994536623586005 for ; Sun, 22 Sep 2024 01:42:17 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=ipFgDIFF; spf=pass (domain: linaro.org, ip: 209.85.167.43, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-5344ab30508so3845422e87.0 for ; Sun, 22 Sep 2024 01:42:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726994535; x=1727599335; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0fqvkLatHUcGlPBaIeQKYhFgmt1O9nIIWDQ/lF/bFug=; b=ipFgDIFFbRlReUeoWQRSGbEz/QeDfCxdAfwV+3EgiF0L1/peOxb1uSph/L6DvUyPcf tamRkx6GbaBhu/6xkHow06k8Lpru09wK327lK0vJoAP3t4b4xgqWubk7k+DvXNfmoWed mcekVd4X9gHOv+hgn014rhvoFwCGQnMZwVhfhT7p4BkNwa8OYOnosbPcyZ95Z1I2F9kC GtkMjgqOnjOPHNI7PsoURDeHaWyBBIlCfcQ5bl06SVZQpErmc5CR9LtLK5KXz9mVbL8H W4Co/ianjB5hGL5XtC/runFJtM4sXpVoITCPtS7NRLqmJLUTy1ecGFU17czR4wBtkPz7 XovQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726994535; x=1727599335; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0fqvkLatHUcGlPBaIeQKYhFgmt1O9nIIWDQ/lF/bFug=; b=ZtKeG4KpusjC2OdgwNjJbBl/IQ6C1VVRnSsKy4VDP2uMOfsdVMy+XxTmtSICojM0VS k4v76aGZd0wwMSKLjT5SbAn28PgEqqyemXhYqg0c6ajlGNBmnyQoO0vXKCcC4H0Fki5x j6hH9qBaArPdEKF/KUlNollI0Kop01sC0ac3q8e5KyBbE1uRHkAFAZyEC2r72c2KS6GD Xd8O5wdpV+HhigKioqFq0JRn5GiHiWJQQI2EZYeQOa1DBlPEdxphiWeu6jWZgrNvcXai 4OK5Nw1zMjhLPvlr24kzfG7CtRo25vpE7POx6lpLcVODwyUB6jbDqxPmNmNeJh1ME4fk szVw== X-Gm-Message-State: AOJu0Yymw4owZ7y8kfctbqVFzPDmNPHij2T3nAoodvjujhJ7SkF76+qr 6n9A881AcMZzDUcPPRFEmDhld984z8shdinxZopv8WxArPvwcAj31oIstCh4EZKg4f9vH2dlxjr wGws= X-Google-Smtp-Source: AGHT+IH1044MvHlBc3zaLm+8qASKNxh6LpO2m18BsIE3Fo++S8X91uEA8gFFoj0HZzeKRstlqMLmzw== X-Received: by 2002:a05:6512:2249:b0:52f:30d:526c with SMTP id 2adb3069b0e04-536abb1c97amr2346919e87.5.1726994534617; Sun, 22 Sep 2024 01:42:14 -0700 (PDT) Received: from localhost.localdomain (87-100-245-199.bb.dnainternet.fi. [87.100.245.199]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-536870a8745sm2877339e87.236.2024.09.22.01.42.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Sep 2024 01:42:12 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v4 07/12] wic bootimg-efi.py: change UKI support from wic plugin to uki.bbclass Date: Sun, 22 Sep 2024 11:41:23 +0300 Message-ID: <20240922084128.9648-8-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240922084128.9648-1-mikko.rapeli@linaro.org> References: <20240922084128.9648-1-mikko.rapeli@linaro.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 22 Sep 2024 08:42:24 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/204779 Remove custom wic plugin implementation and use systemd ukify reference implementation when generating UKI images. Fail if users still have create-unified-kernel-image in wic image config. uki.bbclass use is detected from IMAGE_CLASSES variable ("inherit uki" in image recipe) so export that to wic plugins. If UKI is used, then only generate a minimal loader config for systemd-boot which basically just sets a timeout. Also set 5 second timeout by default instead of failing if wic bootloader config is missing. Boot menu is generated at runtime based on UKI binaries found from ESP partition. Signed-off-by: Mikko Rapeli --- meta/classes-recipe/image_types_wic.bbclass | 3 +- scripts/lib/wic/plugins/source/bootimg-efi.py | 144 ++++-------------- 2 files changed, 31 insertions(+), 116 deletions(-) diff --git a/meta/classes-recipe/image_types_wic.bbclass b/meta/classes-recipe/image_types_wic.bbclass index e02eb0b367..668d0c6d64 100644 --- a/meta/classes-recipe/image_types_wic.bbclass +++ b/meta/classes-recipe/image_types_wic.bbclass @@ -15,6 +15,7 @@ WICVARS ?= "\ HOSTTOOLS_DIR \ IMAGE_BASENAME \ IMAGE_BOOT_FILES \ + IMAGE_CLASSES \ IMAGE_EFI_BOOT_FILES \ IMAGE_LINK_NAME \ IMAGE_ROOTFS \ @@ -112,7 +113,7 @@ WKS_FILE_DEPENDS_DEFAULT += "bmaptool-native cdrtools-native btrfs-tools-native WKS_FILE_DEPENDS_DEFAULT += "virtual/${TARGET_PREFIX}binutils" WKS_FILE_DEPENDS_BOOTLOADERS ?= "systemd-boot os-release" WKS_FILE_DEPENDS_BOOTLOADERS:x86 = "syslinux grub-efi systemd-boot os-release" -WKS_FILE_DEPENDS_BOOTLOADERS:x86-64 = "syslinux grub-efi systemd-boot os-release" +WKS_FILE_DEPENDS_BOOTLOADERS:x86-64 = "syslinux systemd-boot os-release" WKS_FILE_DEPENDS_BOOTLOADERS:x86-x32 = "syslinux grub-efi" WKS_FILE_DEPENDS ??= "${WKS_FILE_DEPENDS_DEFAULT} ${WKS_FILE_DEPENDS_BOOTLOADERS}" diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py index d00f5428da..dbe1dcde07 100644 --- a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py @@ -125,8 +125,16 @@ class BootimgEFIPlugin(SourcePlugin): @classmethod def do_configure_systemdboot(cls, hdddir, creator, cr_workdir, source_params): """ - Create loader-specific systemd-boot/gummiboot config + Create loader-specific systemd-boot/gummiboot config. Unified Kernel Image (uki) + support is done in image recipe with uki.bbclass and only systemd-boot loader config + and ESP partition structure is created here. """ + # detect uki.bbclass usage + image_classes = get_bitbake_var("IMAGE_CLASSES").split() + unified_image = False + if "uki" in image_classes: + unified_image = True + install_cmd = "install -d %s/loader" % hdddir exec_cmd(install_cmd) @@ -134,19 +142,10 @@ class BootimgEFIPlugin(SourcePlugin): exec_cmd(install_cmd) bootloader = creator.ks.bootloader - - unified_image = source_params.get('create-unified-kernel-image') == "true" - loader_conf = "" - if not unified_image: - loader_conf += "default boot\n" - loader_conf += "timeout %d\n" % bootloader.timeout - initrd = source_params.get('initrd') - dtb = source_params.get('dtb') - - if not unified_image: - cls._copy_additional_files(hdddir, initrd, dtb) + # 5 seconds is a sensible default timeout + loader_conf += "timeout %d\n" % (bootloader.timeout or 5) logger.debug("Writing systemd-boot config " "%s/hdd/boot/loader/loader.conf", cr_workdir) @@ -155,8 +154,14 @@ class BootimgEFIPlugin(SourcePlugin): logger.debug("loader.conf:\n%s" % (loader_conf)) cfg.close() + initrd = source_params.get('initrd') + dtb = source_params.get('dtb') + if not unified_image: + cls._copy_additional_files(hdddir, initrd, dtb) + configfile = creator.ks.bootloader.configfile custom_cfg = None + boot_conf = "" if configfile: custom_cfg = get_custom_config(configfile) if custom_cfg: @@ -167,8 +172,7 @@ class BootimgEFIPlugin(SourcePlugin): else: raise WicError("configfile is specified but failed to " "get it from %s.", configfile) - - if not custom_cfg: + else: # Create systemd-boot configuration using parameters from wks file kernel = get_bitbake_var("KERNEL_IMAGETYPE") if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1": @@ -178,7 +182,6 @@ class BootimgEFIPlugin(SourcePlugin): title = source_params.get('title') - boot_conf = "" boot_conf += "title %s\n" % (title if title else "boot") boot_conf += "linux /%s\n" % kernel @@ -198,11 +201,16 @@ class BootimgEFIPlugin(SourcePlugin): if dtb: boot_conf += "devicetree /%s\n" % dtb + boot_conf = "" + boot_conf += "title %s\n" % (title if title else "boot") + boot_conf += "efi /linux.efi\n" + if not unified_image: logger.debug("Writing systemd-boot config " "%s/hdd/boot/loader/entries/boot.conf", cr_workdir) cfg = open("%s/hdd/boot/loader/entries/boot.conf" % cr_workdir, "w") cfg.write(boot_conf) + logger.debug("boot.conf:\n%s" % (boot_conf)) cfg.close() @@ -307,107 +315,13 @@ class BootimgEFIPlugin(SourcePlugin): (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME")) if source_params.get('create-unified-kernel-image') == "true": - initrd = source_params.get('initrd') - if not initrd: - raise WicError("initrd= must be specified when create-unified-kernel-image=true, exiting") - - deploy_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") - efi_stub = glob("%s/%s" % (deploy_dir, "linux*.efi.stub")) - if len(efi_stub) == 0: - raise WicError("Unified Kernel Image EFI stub not found, exiting") - efi_stub = efi_stub[0] - - with tempfile.TemporaryDirectory() as tmp_dir: - label = source_params.get('label') - label_conf = "root=%s" % creator.rootdev - if label: - label_conf = "LABEL=%s" % label - - bootloader = creator.ks.bootloader - cmdline = open("%s/cmdline" % tmp_dir, "w") - cmdline.write("%s %s" % (label_conf, bootloader.append)) - cmdline.close() + raise WicError("create-unified-kernel-image is no longer supported. Please use uki.bbclass.") - initrds = initrd.split(';') - initrd = open("%s/initrd" % tmp_dir, "wb") - for f in initrds: - with open("%s/%s" % (deploy_dir, f), 'rb') as in_file: - shutil.copyfileobj(in_file, initrd) - initrd.close() - - # Searched by systemd-boot: - # https://systemd.io/BOOT_LOADER_SPECIFICATION/#type-2-efi-unified-kernel-images - install_cmd = "install -d %s/EFI/Linux" % hdddir - exec_cmd(install_cmd) - - staging_dir_host = get_bitbake_var("STAGING_DIR_HOST") - target_sys = get_bitbake_var("TARGET_SYS") - - objdump_cmd = "%s-objdump" % target_sys - objdump_cmd += " -p %s" % efi_stub - objdump_cmd += " | awk '{ if ($1 == \"SectionAlignment\"){print $2} }'" - - ret, align_str = exec_native_cmd(objdump_cmd, native_sysroot) - align = int(align_str, 16) - - objdump_cmd = "%s-objdump" % target_sys - objdump_cmd += " -h %s | tail -2" % efi_stub - ret, output = exec_native_cmd(objdump_cmd, native_sysroot) - - offset = int(output.split()[2], 16) + int(output.split()[3], 16) - - osrel_off = offset + align - offset % align - osrel_path = "%s/usr/lib/os-release" % staging_dir_host - osrel_sz = os.stat(osrel_path).st_size - - cmdline_off = osrel_off + osrel_sz - cmdline_off = cmdline_off + align - cmdline_off % align - cmdline_sz = os.stat(cmdline.name).st_size - - dtb_off = cmdline_off + cmdline_sz - dtb_off = dtb_off + align - dtb_off % align - - dtb = source_params.get('dtb') - if dtb: - if ';' in dtb: - raise WicError("Only one DTB supported, exiting") - dtb_path = "%s/%s" % (deploy_dir, dtb) - dtb_params = '--add-section .dtb=%s --change-section-vma .dtb=0x%x' % \ - (dtb_path, dtb_off) - linux_off = dtb_off + os.stat(dtb_path).st_size - linux_off = linux_off + align - linux_off % align - else: - dtb_params = '' - linux_off = dtb_off - - linux_path = "%s/%s" % (staging_kernel_dir, kernel) - linux_sz = os.stat(linux_path).st_size - - initrd_off = linux_off + linux_sz - initrd_off = initrd_off + align - initrd_off % align - - # https://www.freedesktop.org/software/systemd/man/systemd-stub.html - objcopy_cmd = "%s-objcopy" % target_sys - objcopy_cmd += " --enable-deterministic-archives" - objcopy_cmd += " --preserve-dates" - objcopy_cmd += " --add-section .osrel=%s" % osrel_path - objcopy_cmd += " --change-section-vma .osrel=0x%x" % osrel_off - objcopy_cmd += " --add-section .cmdline=%s" % cmdline.name - objcopy_cmd += " --change-section-vma .cmdline=0x%x" % cmdline_off - objcopy_cmd += dtb_params - objcopy_cmd += " --add-section .linux=%s" % linux_path - objcopy_cmd += " --change-section-vma .linux=0x%x" % linux_off - objcopy_cmd += " --add-section .initrd=%s" % initrd.name - objcopy_cmd += " --change-section-vma .initrd=0x%x" % initrd_off - objcopy_cmd += " %s %s/EFI/Linux/linux.efi" % (efi_stub, hdddir) - - exec_native_cmd(objcopy_cmd, native_sysroot) - else: - if source_params.get('install-kernel-into-boot-dir') != 'false': - install_cmd = "install -v -p -m 0644 %s/%s %s/%s" % \ - (staging_kernel_dir, kernel, hdddir, kernel) - out = exec_cmd(install_cmd) - logger.debug("Installed kernel files:\n%s" % out) + if source_params.get('install-kernel-into-boot-dir') != 'false': + install_cmd = "install -v -p -m 0644 %s/%s %s/%s" % \ + (staging_kernel_dir, kernel, hdddir, kernel) + out = exec_cmd(install_cmd) + logger.debug("Installed kernel files:\n%s" % out) if get_bitbake_var("IMAGE_EFI_BOOT_FILES"): for src_path, dst_path in cls.install_task: From patchwork Sun Sep 22 08:41:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Rapeli X-Patchwork-Id: 49431 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 833ABCF9C69 for ; Sun, 22 Sep 2024 08:42:24 +0000 (UTC) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) by mx.groups.io with SMTP id smtpd.web11.11632.1726994539377350458 for ; Sun, 22 Sep 2024 01:42:19 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=IfyAZ3z7; spf=pass (domain: linaro.org, ip: 209.85.167.42, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-52f01b8738dso2416171e87.1 for ; Sun, 22 Sep 2024 01:42:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726994537; x=1727599337; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ph6B0GC+X4VXkgg9zSlm0KU4kn6qEnM0IeTYSixch3g=; b=IfyAZ3z7jnyU+qAJym1fwqMIbzzK7RS+nI0uj2n5kV4cIOfLTDCD2KN2v3TmK0sMdU AjUJ7V/kweLh0gPzQQrxWQCfgq6/64U9WZIW1IAL9BBuFEq4K95waTrWhXvYAM+OTTy/ 8V6H2JYXkf8ByaOUEK8t9RIpKviWdAohG7jyZG/SvR8JR5og3K94TOmYBKOxP+7QOtQ3 9UlquV0WK8WsZq+R4NvtCJvwqPgMtIizUUl3B8Qdc/pk8ufFcjcc1Bcmb5iJbqHN53ha COCIUy0RJ+HyCuE/ux0mTlSndyBHDdG5eP+Oeu4ol6tppt9/4q3nj6DYsbma5/2l5uw3 BtPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726994537; x=1727599337; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ph6B0GC+X4VXkgg9zSlm0KU4kn6qEnM0IeTYSixch3g=; b=u/FiNEx4Pl3qDmCLWh3UtF2FgK8vl1BPcsqK8IG9T8167ivTdDjyQCXDOQZNRWM/4W yJUtq6KYUT8asP1gXQJDXUcQmdSjXJtzGMzaBJF7JcWzb9Yi4L7pIINtuWHVastG59Xe glgqGc07I8vjs8pWCy9cmrXbedc0RJ2eKgsjXFgXuRVILPXb2LVDZJhJL4bzfKUtYvI/ wCzGThjRSnfPbA1Qfg3Q1doQJGOhqpcorsfeoZ/QOb65XVlKffdzZ2wMpGRkFecAxOKM T1VIlWTMVVysyEZPRgSRvBYfBWftRYaOPDtB6Y4K4i6qbrl9b5aVG5TlL12fj0n/ZR97 VDwA== X-Gm-Message-State: AOJu0Yy7T2cF6bzpVI08ELCauUdtRXWiybYq4I/2q8a7A7tWjto12w6n iD4yT57Xqpu4qI9QrPQkgahdOL/jB59nQmBIfHhj2M5meN+/FQqsKcQchQUnxo8RMcNSqwq1BJX 2L9U= X-Google-Smtp-Source: AGHT+IE6UY01DW+VoIrIQae0aLF1p0dgv1O2AJrvf1as7VNZk8qwxjb4GLcDudfqbMEDLYpZJt17VA== X-Received: by 2002:a05:6512:10cf:b0:533:40dc:823e with SMTP id 2adb3069b0e04-536ac3201bcmr4423348e87.48.1726994537397; Sun, 22 Sep 2024 01:42:17 -0700 (PDT) Received: from localhost.localdomain (87-100-245-199.bb.dnainternet.fi. [87.100.245.199]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-536870a8745sm2877339e87.236.2024.09.22.01.42.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Sep 2024 01:42:16 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v4 08/12] oeqa selftest uki.py: add tests for uki.bbclass Date: Sun, 22 Sep 2024 11:41:24 +0300 Message-ID: <20240922084128.9648-9-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240922084128.9648-1-mikko.rapeli@linaro.org> References: <20240922084128.9648-1-mikko.rapeli@linaro.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 22 Sep 2024 08:42:24 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/204780 Tests builds and boots qemu into uki binary with systemd and sysvinit. Due to depedency to x86 specific ovmf UEFI firmware, tests are specific to x86 curently. UEFI firmware for ARM can be generated via qemuarm64-secureboot machine in meta-arm and similar tests on qemu will pass. Signed-off-by: Mikko Rapeli --- meta/lib/oeqa/selftest/cases/uki.py | 138 ++++++++++++++++++ .../wic/canned-wks/efi-uki-bootdisk.wks.in | 3 + 2 files changed, 141 insertions(+) create mode 100644 meta/lib/oeqa/selftest/cases/uki.py create mode 100644 scripts/lib/wic/canned-wks/efi-uki-bootdisk.wks.in diff --git a/meta/lib/oeqa/selftest/cases/uki.py b/meta/lib/oeqa/selftest/cases/uki.py new file mode 100644 index 0000000000..b0e6e52d64 --- /dev/null +++ b/meta/lib/oeqa/selftest/cases/uki.py @@ -0,0 +1,138 @@ +# Based on runqemu.py test file +# +# Copyright (c) 2017 Wind River Systems, Inc. +# +# SPDX-License-Identifier: MIT +# + +from oeqa.selftest.case import OESelftestTestCase +from oeqa.utils.commands import bitbake, runqemu, get_bb_var +from oeqa.core.decorator.data import skipIfNotArch +from oeqa.core.decorator import OETestTag +import oe.types + +class UkiTest(OESelftestTestCase): + """Boot Unified Kernel Image (UKI) generated with uki.bbclass on UEFI firmware (omvf/edk2)""" + + @skipIfNotArch(['i586', 'i686', 'x86_64']) + @OETestTag("runqemu") + def test_uki_boot_systemd(self): + """Build and boot into UEFI firmware (omvf/edk2), systemd-boot, initrd without systemd, rootfs with systemd""" + image = "core-image-minimal" + runqemu_params = get_bb_var('TEST_RUNQEMUPARAMS', image) or "" + cmd = "runqemu %s nographic serial wic ovmf" % (runqemu_params) + if oe.types.qemu_use_kvm(self.td.get('QEMU_USE_KVM', 0), self.td["TARGET_ARCH"]): + cmd += " kvm" + + self.write_config(""" +# efi firmware must load systemd-boot, not grub +EFI_PROVIDER = "systemd-boot" + +# image format must be wic, needs esp partition for firmware etc +IMAGE_FSTYPES:pn-%s:append = " wic" +WKS_FILE = "efi-uki-bootdisk.wks.in" + +# efi, uki and systemd features must be enabled +INIT_MANAGER = "systemd" +MACHINE_FEATURES:append = " efi" +DISTRO_FEATURES:append = " uki" +DISTRO_FEATURES:append = " systemd" +DISTRO_FEATURES_NATIVE:append = " systemd" +IMAGE_CLASSES:append:pn-core-image-minimal = " uki" + +# uki embeds also an initrd +INITRAMFS_IMAGE = "core-image-minimal-initramfs" + +# runqemu must not load kernel separately, it's in the uki +QB_KERNEL_ROOT = "" +QB_DEFAULT_KERNEL = "none" + +# boot command line provided via uki, not via bootloader +UKI_CMDLINE = "rootwait root=LABEL=root console=${KERNEL_CONSOLE}" +""" % (image)) + + uki_filename = get_bb_var('UKI_FILENAME', image) + + bitbake(image + " ovmf") + with runqemu(image, ssh=False, launch_cmd=cmd) as qemu: + self.assertTrue(qemu.runner.logged, "Failed: %s" % cmd) + + # Verify from efivars that firmware was: + # x86_64, qemux86_64 = edk2 + # arm, = u-boot + cmd = "echo $( cat /sys/firmware/efi/efivars/LoaderFirmwareInfo-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f ) | grep 'EDK II'" + status, output = qemu.run_serial(cmd) + self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) + + # Check that systemd-boot was the loader + cmd = "echo $( cat /sys/firmware/efi/efivars/LoaderInfo-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f ) | grep systemd-boot" + status, output = qemu.run_serial(cmd) + self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) + + # Check that systemd-stub was used + cmd = "echo $( cat /sys/firmware/efi/efivars/StubInfo-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f ) | grep systemd-stub" + status, output = qemu.run_serial(cmd) + self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) + + # Check that the compiled uki file was booted into + cmd = "echo $( cat /sys/firmware/efi/efivars/LoaderEntrySelected-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f ) | grep '%s'" % (uki_filename) + status, output = qemu.run_serial(cmd) + self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) + + @skipIfNotArch(['i586', 'i686', 'x86_64']) + @OETestTag("runqemu") + def test_uki_sysvinit(self): + """Build and boot into UEFI firmware (omvf/edk2), systemd-boot, initrd with sysvinit, rootfs with sysvinit""" + config = """ +# efi firmware must load systemd-boot, not grub +EFI_PROVIDER = "systemd-boot" + +# image format must be wic, needs esp partition for firmware etc +IMAGE_FSTYPES:pn-core-image-base:append = " wic" +WKS_FILE = "efi-uki-bootdisk.wks.in" + +# efi, uki and systemd features must be enabled +MACHINE_FEATURES:append = " efi" +DISTRO_FEATURES_NATIVE:append = " systemd" +IMAGE_CLASSES:append:pn-core-image-base = " uki" + +# uki embeds also an initrd, no systemd or udev +INITRAMFS_IMAGE = "core-image-initramfs-boot" + +# runqemu must not load kernel separately, it's in the uki +QB_KERNEL_ROOT = "" +QB_DEFAULT_KERNEL = "none" + +# boot command line provided via uki, not via bootloader +UKI_CMDLINE = "rootwait root=LABEL=root console=${KERNEL_CONSOLE}" + +""" + self.append_config(config) + bitbake('core-image-base ovmf') + runqemu_params = get_bb_var('TEST_RUNQEMUPARAMS', 'core-image-base') or "" + uki_filename = get_bb_var('UKI_FILENAME', 'core-image-base') + self.remove_config(config) + + with runqemu('core-image-base', ssh=False, + runqemuparams='%s slirp nographic ovmf' % (runqemu_params), image_fstype='wic') as qemu: + # Verify from efivars that firmware was: + # x86_64, qemux86_64 = edk2 + # arm, = u-boot + cmd = "echo $( cat /sys/firmware/efi/efivars/LoaderFirmwareInfo-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f ) | grep 'EDK II'" + status, output = qemu.run_serial(cmd) + self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) + + # Check that systemd-boot was the loader + cmd = "echo $( cat /sys/firmware/efi/efivars/LoaderInfo-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f ) | grep systemd-boot" + status, output = qemu.run_serial(cmd) + self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) + + # Check that systemd-stub was used + cmd = "echo $( cat /sys/firmware/efi/efivars/StubInfo-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f ) | grep systemd-stub" + status, output = qemu.run_serial(cmd) + self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) + + # Check that the compiled uki file was booted into + cmd = "echo $( cat /sys/firmware/efi/efivars/LoaderEntrySelected-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f ) | grep '%s'" % (uki_filename) + status, output = qemu.run_serial(cmd) + self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) diff --git a/scripts/lib/wic/canned-wks/efi-uki-bootdisk.wks.in b/scripts/lib/wic/canned-wks/efi-uki-bootdisk.wks.in new file mode 100644 index 0000000000..1ea9c8a845 --- /dev/null +++ b/scripts/lib/wic/canned-wks/efi-uki-bootdisk.wks.in @@ -0,0 +1,3 @@ +bootloader --ptable gpt --timeout=5 +part /boot --source bootimg-efi --sourceparams="loader=${EFI_PROVIDER}" --label boot --active --align 1024 --use-uuid --part-name="ESP" --part-type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B --fixed-size 512M +part / --source rootfs --fstype=ext4 --label root --align 1024 --exclude-path boot/ From patchwork Sun Sep 22 08:41:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Rapeli X-Patchwork-Id: 49430 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78634CF9C6C for ; Sun, 22 Sep 2024 08:42:24 +0000 (UTC) Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) by mx.groups.io with SMTP id smtpd.web10.11541.1726994543213006322 for ; Sun, 22 Sep 2024 01:42:23 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=UazXCoA0; spf=pass (domain: linaro.org, ip: 209.85.167.53, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-5356bb5522bso4053188e87.1 for ; Sun, 22 Sep 2024 01:42:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726994541; x=1727599341; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yHK/wJqit9EI4RDs5pqRkRsBKVbzpULM3hajdw6AHGY=; b=UazXCoA0kZC5pQqczUIpaDbm6N4NFBfb39feccHCBsWDryIVZbD7RCVYbRKQ668Ckn pGLcahXVMNk+368sMDgA8kRHcAauEWt5WMgr2GtGIrqUzhzNqnixsM+Ndwlcms56Tp7T iEFGA4WI0w+2Wcn4QGYyALFaohmSSj+bgq//0rXz+KikVuT0tQtpfRazRsvO6bOHzh1B u3FFPkIry0WBg0X6VBzQWzlixROr6S7Nq1VL3lEjEbzgQpeEUmIiEWtr6zF53E33G3dc RQ1O6MGacd7qAznrGP+DuOGRpshc74j1CslbMgKhneplxdzCKVn/qdCUGppI0ynx/lhy mq2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726994541; x=1727599341; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yHK/wJqit9EI4RDs5pqRkRsBKVbzpULM3hajdw6AHGY=; b=o9vkmI8WEWq37RAXNpyr3plGUNOHN5mCAW4vVPMVipeKbK/RnG3IRvGMWREomfTXsM dIRLV9Rzah0/wDJxrHK9FXwRAVphP4Gxsfd5us7H+OPBy0DCOkUVdemPkREPfrzmyL8z /I0ghmn4u9GDp9b0hNV9TM7m37rjAbS/RbGiDfnhFszGpIEWrIWM6AtowQW8o6X5wARc 1za6eK9JJra2syBTAybbtD2QI49zjq3S3WNzQcz/VdsjvlTu1aZ4YlYhyf7jveiYeSwi VoeyM2VWLm21rH+c0Ls+n3JawnMXjjByXFAy/n7q5jmh2EEV1JdXjJ9jHP+NBW82g1Pd 8bJA== X-Gm-Message-State: AOJu0Yxo83G5rZeMT3vZE5oGym8ZMRoAfaGo+IQedyVCv6jaMkmnd7MI RwCc7mOqWA2TD8wikTyKB8Nd+QHJqsjVtbdU5EuQIuTJAcUZwyBEfdjPoUDDllxh3M8lc9TvZcx foh0= X-Google-Smtp-Source: AGHT+IEoE8zjF/X2jFDxOqvegSSQsf4Ncq1oqLoPokvDppjGFDpsHHZaJm92tHiU8KJlT10L7nwdVA== X-Received: by 2002:a05:6512:12ca:b0:535:3cdc:8755 with SMTP id 2adb3069b0e04-536ac2e5b93mr4243829e87.20.1726994541317; Sun, 22 Sep 2024 01:42:21 -0700 (PDT) Received: from localhost.localdomain (87-100-245-199.bb.dnainternet.fi. [87.100.245.199]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-536870a8745sm2877339e87.236.2024.09.22.01.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Sep 2024 01:42:19 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v4 09/12] oeqa selftest efibootpartition.py: add TEST_RUNQEMUPARAMS to runqemu Date: Sun, 22 Sep 2024 11:41:25 +0300 Message-ID: <20240922084128.9648-10-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240922084128.9648-1-mikko.rapeli@linaro.org> References: <20240922084128.9648-1-mikko.rapeli@linaro.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 22 Sep 2024 08:42:24 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/204781 TEST_RUNQEMUPARAMS variable is used to add runqemu parameters like "slirp" networking. Support this also in selftests so that "slirp" networking can be used instead of the tun/tap devices setup which is easier to work with on shared build machines. Signed-off-by: Mikko Rapeli --- meta/lib/oeqa/selftest/cases/efibootpartition.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/efibootpartition.py b/meta/lib/oeqa/selftest/cases/efibootpartition.py index fa74103dec..e6d6a91a22 100644 --- a/meta/lib/oeqa/selftest/cases/efibootpartition.py +++ b/meta/lib/oeqa/selftest/cases/efibootpartition.py @@ -6,7 +6,7 @@ # from oeqa.selftest.case import OESelftestTestCase -from oeqa.utils.commands import bitbake, runqemu +from oeqa.utils.commands import bitbake, runqemu, get_bb_var from oeqa.core.decorator.data import skipIfNotMachine import oe.types @@ -14,10 +14,11 @@ class GenericEFITest(OESelftestTestCase): """EFI booting test class""" @skipIfNotMachine("qemux86-64", "test is qemux86-64 specific currently") def test_boot_efi(self): - cmd = "runqemu nographic serial wic ovmf" + image = "core-image-minimal" + runqemu_params = get_bb_var('TEST_RUNQEMUPARAMS', image) or "" + cmd = "runqemu %s nographic serial wic ovmf" % (runqemu_params) if oe.types.qemu_use_kvm(self.td.get('QEMU_USE_KVM', 0), self.td["TARGET_ARCH"]): cmd += " kvm" - image = "core-image-minimal" self.write_config(""" EFI_PROVIDER = "systemd-boot" From patchwork Sun Sep 22 08:41:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Rapeli X-Patchwork-Id: 49433 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7489BCF9C6C for ; Sun, 22 Sep 2024 08:42:34 +0000 (UTC) Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by mx.groups.io with SMTP id smtpd.web10.11542.1726994547438035565 for ; Sun, 22 Sep 2024 01:42:27 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=ossfKKCS; spf=pass (domain: linaro.org, ip: 209.85.167.44, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-5365392cfafso3426596e87.0 for ; Sun, 22 Sep 2024 01:42:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726994545; x=1727599345; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=V9V65r0HXKpZR9eOjIBLjsUByBDggRnmrGcQf/O+X80=; b=ossfKKCSypiIqB8G+xQWYE6apEfJ5R/FEuKe8yEeQ2SpCUL6NT8ws60NqmAo78hcVm j1ku5ngywQu9VMDN8+12zjm3o7330X/CDJW45+SZVdis3cAr1Rdb6K/Loj+nch8zoAMY ksvksodV8+j9ZfBinU9CUjSubql85imRwWJ7Hw8O1zWC6qxKSzwRKouLvJjnySurSW1r hd/RaY62h6P1zk2yikhhsFZg2upI+E0iANjcRkmDPXVCFUd024E+zBtFdntx0RUdCPsV WiIoe3TLYKs3ILxu5dnxFSWKFReqOSX0m3z3I6MZdYYCkmzA7KwvQmIf9Yhs/eVcstk8 qRyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726994545; x=1727599345; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V9V65r0HXKpZR9eOjIBLjsUByBDggRnmrGcQf/O+X80=; b=nwEOmQvRXj45xU5DaUCQu+eDtrct/DeHgrQAxQQiwlfGX8zNr5B6FJ7NbayEfs4jlb Oo4rtM/11TGEbqTJCXbVysjtiNxG7d5HTkEBkFaaKpWsitaAMtXtxMF5P+9zhbuZ1+gY UotZs1a1g25jU/KkmWhZiwCLjCWm7uf3Ipdj7NCnAVo7KfpdvF6k5Vm4xkL9poXShkgW KbJwnGZ66tCfXoqRNAVGKYTyjncEx57As+2QAsEbj2vn7XIT6cfI/RfUaIU6MkCWF+0i +uAfCr0ADpO65Gqnbkui9NGBwA4kKlUjgC9nY/K7mA4BR0IWdbEkqimAMzs4QaYq0iR1 2GbA== X-Gm-Message-State: AOJu0YxMY7PJ4/J1FD76U0NWeGZt3pNx0IWvdN9gFR9gkredWn7f9dDV 6GhWZ8VMR/GjWDfVxupnTwMxHjqZ7YH2hxILieQfdJ6mdL4eGFdmjc5Yyiik9JaZ1J72sC0STtr XM98= X-Google-Smtp-Source: AGHT+IGhhs4jPVYqnkOW+v1cN/NSGfXjjsUZMoqAEpUHhQbHugYaGxaYlxMK2dEPNl064Rn3YXVuDA== X-Received: by 2002:ac2:4f03:0:b0:533:d3e:16fe with SMTP id 2adb3069b0e04-536ac32f114mr4296990e87.38.1726994545562; Sun, 22 Sep 2024 01:42:25 -0700 (PDT) Received: from localhost.localdomain (87-100-245-199.bb.dnainternet.fi. [87.100.245.199]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-536870a8745sm2877339e87.236.2024.09.22.01.42.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Sep 2024 01:42:23 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v4 10/12] oeqa selftest efibootpartition.py: remove systemd-boot from grub-efi test Date: Sun, 22 Sep 2024 11:41:26 +0300 Message-ID: <20240922084128.9648-11-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240922084128.9648-1-mikko.rapeli@linaro.org> References: <20240922084128.9648-1-mikko.rapeli@linaro.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 22 Sep 2024 08:42:34 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/204782 The test is actually using grub-efi not systemd-boot so remove it completely. systemd-boot will be tested via uki.py tests. Signed-off-by: Mikko Rapeli --- meta/lib/oeqa/selftest/cases/efibootpartition.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/efibootpartition.py b/meta/lib/oeqa/selftest/cases/efibootpartition.py index e6d6a91a22..fcfcdaf7e4 100644 --- a/meta/lib/oeqa/selftest/cases/efibootpartition.py +++ b/meta/lib/oeqa/selftest/cases/efibootpartition.py @@ -21,11 +21,11 @@ class GenericEFITest(OESelftestTestCase): cmd += " kvm" self.write_config(""" -EFI_PROVIDER = "systemd-boot" +EFI_PROVIDER = "grub-efi" IMAGE_FSTYPES:pn-%s:append = " wic" MACHINE_FEATURES:append = " efi" WKS_FILE = "efi-bootdisk.wks.in" -IMAGE_INSTALL:append = " grub-efi systemd-boot kernel-image-bzimage" +IMAGE_INSTALL:append = " grub-efi kernel-image-bzimage" """ % (image)) From patchwork Sun Sep 22 08:41:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Rapeli X-Patchwork-Id: 49434 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74870CF9C69 for ; Sun, 22 Sep 2024 08:42:34 +0000 (UTC) Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by mx.groups.io with SMTP id smtpd.web11.11637.1726994550417941524 for ; Sun, 22 Sep 2024 01:42:30 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=TsfHmeZN; spf=pass (domain: linaro.org, ip: 209.85.167.48, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-5365392cfafso3426609e87.0 for ; Sun, 22 Sep 2024 01:42:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726994548; x=1727599348; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YMQTWSW2pxYCYeqvg5XPpJ4xKvMr/05hM5ADcPNUguk=; b=TsfHmeZN+k+wFl4m9UGiRckbk4guam/eNnXypmAVGeB2x5oMdQFVTgfR58hBq23esT Jt1spAvQ4yX3hdGQAfBsCEhy0QtWMUiEr4F/e/+wiKzl82pzCpTA2SGsSHZnLbw5kmiO tnBPplXLk/luO9UEHwCc8Aa+luJPaVGWl9j+D0hqfOk+OApwuII9s+XecWB3O6SF2tp+ Z3oAH9vkgYebfNZWEqbEsu/+tE80xVIvffmRN2zI1UXtX2+4MtfAqpqfOnXG6XMKkneb joZUGtTgEcHOpzwk4+VP5t9/CM6e4dHqGL7BROFysVE9S8trkq8mJu3w1AQfIjQ207Mh XGtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726994548; x=1727599348; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YMQTWSW2pxYCYeqvg5XPpJ4xKvMr/05hM5ADcPNUguk=; b=B9ufUhlRFd+b8XzuLbIG4dYPo5agwDv6DF/6tjaggdoQrhuGli0uZlRu8WhRWfmhNV pEGiRC6SkpFyr0C80pP4ymQjhmfIniLRfEljIDPrAZS1x939OrYPntFRsWcZF5loas4r DIgbgSUTCJBBDRIq6hrX1alXeILF8rsFIRnNV9b+ldtHbLKLfz/Wf3FWCdcY6SBwv0VL LsCAwbHE2zgPo1uHTChJzzFM3OYpyzsd1T1qw8plvKuHMEUfcu9APPxtOZenTDR2sbog o551ORZpVJ4jgBEs9DEKSFZOpgzZNBXCTY4A9mTfKWasQOJDgne91lAHO3WhS0h3PPio D8rw== X-Gm-Message-State: AOJu0YzZijRtOQjlQHSXseYW0rZwwOiWVTVT1C9Ih0se2c7L+KIF/alS IkzKlg53abCUOGkAfBdyOh4UVqUGSD77yq44wxwd1Q1GWGXl3PQVHdGD3b31e3wD7HA24f8YwYJ AAc8= X-Google-Smtp-Source: AGHT+IEGf6I8OI/c3P9r/eXcBjTg/oHi53O+lbAZKHYmHbbMClA/Wt+ThdYb739UbnzfvAh4WFmh3w== X-Received: by 2002:a05:6512:2345:b0:52e:be50:9c66 with SMTP id 2adb3069b0e04-536ac340248mr4147848e87.53.1726994548466; Sun, 22 Sep 2024 01:42:28 -0700 (PDT) Received: from localhost.localdomain (87-100-245-199.bb.dnainternet.fi. [87.100.245.199]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-536870a8745sm2877339e87.236.2024.09.22.01.42.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Sep 2024 01:42:27 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v4 11/12] oeqa selftest wic.py: add TEST_RUNQEMUPARAMS to runqemu Date: Sun, 22 Sep 2024 11:41:27 +0300 Message-ID: <20240922084128.9648-12-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240922084128.9648-1-mikko.rapeli@linaro.org> References: <20240922084128.9648-1-mikko.rapeli@linaro.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 22 Sep 2024 08:42:34 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/204783 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. Signed-off-by: Mikko Rapeli --- meta/lib/oeqa/selftest/cases/wic.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py index b616759209..f2a46c965b 100644 --- a/meta/lib/oeqa/selftest/cases/wic.py +++ b/meta/lib/oeqa/selftest/cases/wic.py @@ -939,7 +939,8 @@ class Wic2(WicTestCase): bitbake('wic-image-minimal') self.remove_config(config) - with runqemu('wic-image-minimal', ssh=False, runqemuparams='nographic') as qemu: + runqemu_params = get_bb_var('TEST_RUNQEMUPARAMS', 'wic-image-minimal') or "" + with runqemu('wic-image-minimal', ssh=False, runqemuparams='%s nographic' % (runqemu_params)) as qemu: cmd = "mount | grep '^/dev/' | cut -f1,3 -d ' ' | egrep -c -e '/dev/sda1 /boot' " \ "-e '/dev/root /|/dev/sda2 /' -e '/dev/sda3 /media' -e '/dev/sda4 /mnt'" status, output = qemu.run_serial(cmd) @@ -959,8 +960,9 @@ class Wic2(WicTestCase): bitbake('core-image-minimal ovmf') self.remove_config(config) + runqemu_params = get_bb_var('TEST_RUNQEMUPARAMS', 'core-image-minimal') or "" with runqemu('core-image-minimal', ssh=False, - runqemuparams='nographic ovmf', image_fstype='wic') as qemu: + runqemuparams='%s nographic ovmf' % (runqemu_params), image_fstype='wic') as qemu: cmd = "grep sda. /proc/partitions |wc -l" status, output = qemu.run_serial(cmd) self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) @@ -1154,8 +1156,9 @@ class Wic2(WicTestCase): bitbake('core-image-minimal-mtdutils') self.remove_config(config) + runqemu_params = get_bb_var('TEST_RUNQEMUPARAMS', 'core-image-minimal-mtdutils') or "" with runqemu('core-image-minimal-mtdutils', ssh=False, - runqemuparams='nographic', image_fstype='wic') as qemu: + runqemuparams='%s nographic' % (runqemu_params), image_fstype='wic') as qemu: cmd = "grep sda. /proc/partitions |wc -l" status, output = qemu.run_serial(cmd) self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) @@ -1214,8 +1217,9 @@ class Wic2(WicTestCase): bitbake('core-image-minimal') self.remove_config(config) + runqemu_params = get_bb_var('TEST_RUNQEMUPARAMS', 'core-image-minimal') or "" with runqemu('core-image-minimal', ssh=False, - runqemuparams='nographic', image_fstype='wic') as qemu: + runqemuparams='%s nographic' % (runqemu_params), image_fstype='wic') as qemu: # Check that we have ONLY two /dev/sda* partitions (/boot and /) cmd = "grep sda. /proc/partitions | wc -l" status, output = qemu.run_serial(cmd) @@ -1446,8 +1450,8 @@ class Wic2(WicTestCase): os.rename(image_path, image_path + '.bak') os.rename(new_image_path, image_path) - # Check if it boots in qemu - with runqemu('core-image-minimal', ssh=False, runqemuparams='nographic') as qemu: + runqemu_params = get_bb_var('TEST_RUNQEMUPARAMS', 'core-image-minimal') or "" + with runqemu('core-image-minimal', ssh=False, runqemuparams='%s nographic' % (runqemu_params)) as qemu: cmd = "ls /etc/" status, output = qemu.run_serial('true') self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) From patchwork Sun Sep 22 08:41:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Rapeli X-Patchwork-Id: 49435 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 752FECF9C68 for ; Sun, 22 Sep 2024 08:42:44 +0000 (UTC) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by mx.groups.io with SMTP id smtpd.web11.11638.1726994554395931253 for ; Sun, 22 Sep 2024 01:42:34 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=WIl3wjb8; spf=pass (domain: linaro.org, ip: 209.85.167.54, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-53659c8d688so2507988e87.1 for ; Sun, 22 Sep 2024 01:42:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726994552; x=1727599352; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uRpm+Xz6BTpaJ92TuH3n9oStDg0UQ674uOgS/L2whlk=; b=WIl3wjb8tln2sLnSo1NBA1DJHL5AxWp0EMIuExR2TDs6y2lI1hXUFV8eYWzd6PrDk3 iQmLZUaMQHpProt8LbPRqjepK5iRV3HQuKYngzzVyK1TcxV2afidWvivbJ7NhAEoo8su 2Ie4/vuFKsirI3eHtquUNNjIIKkSpU+RUUfLDSvAFvjwNear6psjXcfNPtPPDqmQidVc eQr5fwAt7QzD1fHbd9bum1dHGynQzfK64FjGQuZcA/jwSEdBE1mJ/nvifYPK3J6GUGVH puAhBzw5+QL/U9zFjK7jOa/Ls2dvWcjYH4NkkJJ5FGgevrJkUR7HPME055IShNGEoc8v U0nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726994552; x=1727599352; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uRpm+Xz6BTpaJ92TuH3n9oStDg0UQ674uOgS/L2whlk=; b=KCyC3xE3CqoaLx+mE+zvekhWfSxhbR30+eP6t7rLJrUhmJ622FYb5JWO6z0GnveOBr UYCJedDr1xRF1XQh3/PWkDnZcB6gC5lYgO/VUk9Tgd1LwfdT5lI5xybcgswSjtL9QGbV UouUF0O4QxR2A2LxvkMonehH8tpdcw6ILrlVrwMZ7VNDZux971EBAFWF0RKXqsVTECYp 3F/ReD9UeSQeQbHNJ7zPwSQOmoA4ktA8y46+ohwCDR+5mz6EX3ns65ODyf1v9peZ94mK poko0fvLasVAty388inBL7vF4CGIPFmvCq4nFEllCbzfiPettXYer1a+JXnciTvkVDvL H/Ag== X-Gm-Message-State: AOJu0YwLsjEvvax1wsq4w68eivsmKjZsBq8flr5Gt/NhLtN6kj0/U866 9bUcYcXjHyVnHD9Chvg/Ek4uHsxA86BtdIucS2fwjKUeLCSodpxRfKhYXS3rTdWSAOWYAE02t3c ZWM4= X-Google-Smtp-Source: AGHT+IGtKMS9SE0FL6hL9veIQZoLDYRINbrSpYD8qgFJkCd1sm2Emd6Cuiozjw1tYwZms+Ur/IhvZQ== X-Received: by 2002:a05:6512:3184:b0:52c:dc56:ce62 with SMTP id 2adb3069b0e04-536a563715cmr3755017e87.12.1726994552427; Sun, 22 Sep 2024 01:42:32 -0700 (PDT) Received: from localhost.localdomain (87-100-245-199.bb.dnainternet.fi. [87.100.245.199]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-536870a8745sm2877339e87.236.2024.09.22.01.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Sep 2024 01:42:30 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v4 12/12] oeqa selftest wic.py: support UKIs via uki.bbclass Date: Sun, 22 Sep 2024 11:41:28 +0300 Message-ID: <20240922084128.9648-13-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240922084128.9648-1-mikko.rapeli@linaro.org> References: <20240922084128.9648-1-mikko.rapeli@linaro.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 22 Sep 2024 08:42:44 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/204784 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 tests in wic.py and rest of the UKI features are tested with dedicated uki.py test. Signed-off-by: Mikko Rapeli --- meta-selftest/wic/test_efi_plugin.wks | 5 ++-- meta/lib/oeqa/selftest/cases/wic.py | 42 ++++++++++++++++++++------- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/meta-selftest/wic/test_efi_plugin.wks b/meta-selftest/wic/test_efi_plugin.wks index 1603d6c4bb..e876a4be0e 100644 --- a/meta-selftest/wic/test_efi_plugin.wks +++ b/meta-selftest/wic/test_efi_plugin.wks @@ -1,6 +1,5 @@ # short-description: This file is used in oe-selftest wic module to test efi plugin - -part /boot --source bootimg-efi --sourceparams="loader=systemd-boot,create-unified-kernel-image=true,initrd=${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES}" --active --align 1024 --use-uuid -part / --source rootfs --fstype=ext4 --align 1024 --use-uuid +part /boot --source bootimg-efi --sourceparams="loader=systemd-boot" --active --align 1024 --use-uuid +part / --source rootfs --fstype=ext4 --align 1024 --use-uuid --label root bootloader --timeout=0 --append="console=ttyS0,115200n8" diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py index f2a46c965b..0f6283869e 100644 --- a/meta/lib/oeqa/selftest/cases/wic.py +++ b/meta/lib/oeqa/selftest/cases/wic.py @@ -1292,24 +1292,46 @@ class Wic2(WicTestCase): @skipIfNotArch(['i586', 'i686', 'x86_64']) @OETestTag("runqemu") def test_efi_plugin_unified_kernel_image_qemu(self): - """Test efi plugin's Unified Kernel Image feature in qemu""" - config = 'IMAGE_FSTYPES = "wic"\n'\ - 'INITRAMFS_IMAGE = "core-image-minimal-initramfs"\n'\ - 'WKS_FILE = "test_efi_plugin.wks"\n'\ - 'MACHINE_FEATURES:append = " efi"\n' + """Test Unified Kernel Image feature in qemu without systemd in initramfs or rootfs""" + config = """ +# efi firmware must load systemd-boot, not grub +EFI_PROVIDER = "systemd-boot" + +# image format must be wic, needs esp partition for firmware etc +IMAGE_FSTYPES:pn-core-image-base:append = " wic" +WKS_FILE = "test_efi_plugin.wks" + +# efi, uki and systemd features must be enabled +MACHINE_FEATURES:append = " efi" +DISTRO_FEATURES_NATIVE:append = " systemd" +IMAGE_CLASSES:append:pn-core-image-base = " uki" + +# uki embeds also an initrd, no systemd or udev +INITRAMFS_IMAGE = "core-image-initramfs-boot" + +# runqemu must not load kernel separately, it's in the uki +QB_KERNEL_ROOT = "" +QB_DEFAULT_KERNEL = "none" + +# boot command line provided via uki, not via bootloader +UKI_CMDLINE = "rootwait root=LABEL=root console=${KERNEL_CONSOLE}" + +""" self.append_config(config) - bitbake('core-image-minimal core-image-minimal-initramfs ovmf') + bitbake('core-image-base ovmf') + runqemu_params = get_bb_var('TEST_RUNQEMUPARAMS', 'core-image-base') or "" + uki_filename = get_bb_var('UKI_FILENAME', 'core-image-base') self.remove_config(config) - with runqemu('core-image-minimal', ssh=False, - runqemuparams='nographic ovmf', image_fstype='wic') as qemu: + with runqemu('core-image-base', ssh=False, + runqemuparams='%s nographic ovmf' % (runqemu_params), image_fstype='wic') as qemu: # Check that /boot has EFI bootx64.efi (required for EFI) cmd = "ls /boot/EFI/BOOT/bootx64.efi | wc -l" status, output = qemu.run_serial(cmd) self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) self.assertEqual(output, '1') - # Check that /boot has EFI/Linux/linux.efi (required for Unified Kernel Images auto detection) - cmd = "ls /boot/EFI/Linux/linux.efi | wc -l" + # Check that /boot has EFI/Linux/${UKI_FILENAME} (required for Unified Kernel Images auto detection) + cmd = "ls /boot/EFI/Linux/%s | wc -l" % (uki_filename) status, output = qemu.run_serial(cmd) self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) self.assertEqual(output, '1')