From patchwork Tue Oct 1 08:28:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Rapeli X-Patchwork-Id: 49846 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 3FF0CCE7CEC for ; Tue, 1 Oct 2024 08:28:48 +0000 (UTC) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by mx.groups.io with SMTP id smtpd.web10.76269.1727771318160787045 for ; Tue, 01 Oct 2024 01:28:38 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=pYsJOkd8; spf=pass (domain: linaro.org, ip: 209.85.208.180, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2fabfc06de3so29467151fa.1 for ; Tue, 01 Oct 2024 01:28:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727771316; x=1728376116; 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=pYsJOkd8BZcF/lzL8Z1XpDCg1A2IpEtOfAwSHAJN/FichZ/1ZBvmw4vJ7+/d8ie8af /CpBok2OPa4RMLHKdUVf5fo8vEE7NF3S49rJsei+ttpNejLh3C2fgFQRBd5ZG9CUAsXF K8wwmaxy/tmxvXGA4Qft7vknQ0BTPWRjHviXZZHIIx3IdMv5ETSQ6OM+FYjEXc8rkz9/ y7a/kQ3ZN/vCh348hf8o/S41egTfOPa3PmdXYT/JX7Tu02FQ6i63LQPTGT1AU/Y0YLyK WbKYe93ExRaeguCUxj3GF1tPnujUXdiHG/XOpM04JXMNo+CNmnMBV0Qkm7ZPbXvghzJX vKWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727771316; x=1728376116; 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=W+BfK1paAS0Wq7b+Ya8GWt+SeBW7XgXnvHLXKxemtap4YDdiGwuCIZdVVdM8hzz6yT j2W4AnSVhwOURVxtVsKPpXmRFHSVQh49UGTTbOZSjA9Ry/WEJpVk1DfeenxXMDMs1Kqb gacA69q6te9o28zzZOYxypHZerA++EOM+hFTTmXfT36Z9+09KeYiIP2isAT83NN4kPoZ nN+ISVdA6wogIuytZbWX+Z0npLD21vR6sGSH0MpCpHav9gPkf6mRWAMQiiVvpXPATQBJ HGstwD5k6GkqsQhW/0cmmVz1TvItQ9PS8ESje95oFwPBimMc1muz1ZflHFpXoryfNhOa 5caA== X-Gm-Message-State: AOJu0Yz8QJV3qCekBZ7UBfVEYH9jJ8jo/AJfJaOXBBESilyY0vCcsH1i gQSVMzgajny4i3hXCquIhH3XWns9tBGsw1dyGY1oVPHoEtXXADivOHTvgaf0GM5+Ew/bJ6sotTJ ZRlA= X-Google-Smtp-Source: AGHT+IGbQbk1kO/Cm13tzpbPEr3vvXtHeOpj2n1Q7gtTCs5dHljRw5eEP25mxxi5EU0HTYn+LDIEYw== X-Received: by 2002:a2e:a553:0:b0:2f7:663c:48d7 with SMTP id 38308e7fff4ca-2f9d41d3267mr76270751fa.39.1727771316289; Tue, 01 Oct 2024 01:28:36 -0700 (PDT) Received: from localhost.localdomain (78-27-76-97.bb.dnainternet.fi. [78.27.76.97]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2facb2ce928sm7734221fa.76.2024.10.01.01.28.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 01:28:34 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v5 01/11] python3-pefile: add recipe from meta-openembedded Date: Tue, 1 Oct 2024 11:28:11 +0300 Message-ID: <20241001082821.26115-2-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001082821.26115-1-mikko.rapeli@linaro.org> References: <20241001082821.26115-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 ; Tue, 01 Oct 2024 08:28:48 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/205135 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 Tue Oct 1 08:28:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Rapeli X-Patchwork-Id: 49848 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 4895ACE7CE7 for ; Tue, 1 Oct 2024 08:28:48 +0000 (UTC) Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) by mx.groups.io with SMTP id smtpd.web10.76271.1727771322624482666 for ; Tue, 01 Oct 2024 01:28:43 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=sNgBBnl9; spf=pass (domain: linaro.org, ip: 209.85.208.173, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2fad8337aa4so9319051fa.0 for ; Tue, 01 Oct 2024 01:28:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727771321; x=1728376121; 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=sNgBBnl9j7AOIR4/aohndHjr/uEct0PQP5O8vTlMXpObjOHDtogYS3dib6A5eErJKW mX65mjeoNiJrcJF2Owh1TZFedEPX67/h/qeKeTqKA/9KkeAG8rhRe6Xolmwy8hEhjti6 AqdeeIKAeBuuH8xXRyTq0mSCF/pdORB1fMgLVfRYnr8xq/qaFPAmYA+va2QmV2Tx0ZgZ kn2P0wAwlyIOTL9KxacxFYPmFhbK1vJb2L6b9YBMEe1g1ds+m9BPfCU7VDoSWseCyCmZ pKbA34nPpNnqkAMURZzDWqtpxIJZP+VvCj4gDDdFwft8VShTzxgss9+1dWVMobbF/3aT BKTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727771321; x=1728376121; 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=VCSrQ6WyEiXEsXy+D1BMRN7uZq596LVxNaQ+611Wzp1W5puXULnOiym2dpI4sUg8Wb RxdHBh1VI5J10/mgkD4jMc60W6TJrdj0po+W1cJ+/5Ay6ZCY0D9i+nQXQmjdCjZ45uJ7 3HJOZxLi0YkX/DoUwpdScraxQ7r+vEUe4zxnpD+cCt02j8gJLCjGQt5siB5ob0o0Jazs Stks5+/pYWt0L0xfU6ROZcsGKKnn4L7EIB6va45HjEa7laDPt5/s0aoIkcVrM/km7efB ZhZ101RhmlCFCyItvvyecsw4UgSOYw55TEZOYS2EhKZs3ZOqMQeXvdGknhQ9BygoOrMM 2lnw== X-Gm-Message-State: AOJu0YxC4Fky5PQJSOWItw129QdwiWsHWm5yTFpVcexBDdUVCLLPAXt3 ZF8VcclEkF73MB90UXju0/9mC4vhdN5SH9V7Bp+aTEkr+piMMK8LCBeT7TGeVMXwjbPubhstaq0 F9dw= X-Google-Smtp-Source: AGHT+IH1j57cwnasgloJtcbW7wcJkrZepHqQTc2J7lHdz8O0LAbs1cBjBFHFUgpKQTuec2Rbkn25dQ== X-Received: by 2002:a2e:4e19:0:b0:2ef:c281:54f7 with SMTP id 38308e7fff4ca-2f9d41979a9mr60656581fa.37.1727771320743; Tue, 01 Oct 2024 01:28:40 -0700 (PDT) Received: from localhost.localdomain (78-27-76-97.bb.dnainternet.fi. [78.27.76.97]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2facb2ce928sm7734221fa.76.2024.10.01.01.28.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 01:28:38 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v5 02/11] maintainers.inc: add python3-pefile Date: Tue, 1 Oct 2024 11:28:12 +0300 Message-ID: <20241001082821.26115-3-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001082821.26115-1-mikko.rapeli@linaro.org> References: <20241001082821.26115-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 ; Tue, 01 Oct 2024 08:28:48 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/205136 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 Tue Oct 1 08:28:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Rapeli X-Patchwork-Id: 49847 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 3A295CE7CEB for ; Tue, 1 Oct 2024 08:28:48 +0000 (UTC) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) by mx.groups.io with SMTP id smtpd.web10.76273.1727771327117359965 for ; Tue, 01 Oct 2024 01:28:47 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=R/6lrw9S; spf=pass (domain: linaro.org, ip: 209.85.208.178, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2facf48166bso19511781fa.0 for ; Tue, 01 Oct 2024 01:28:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727771325; x=1728376125; 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=Wqoqd7msuLgMdcy5pk4TzN5OOomlS/s2Wl4roxejQjM=; b=R/6lrw9SSLZFp9tx5Vxt2meI17DsInIfzpgTdiWS3yt7/j4q9Gol9AG0zi0ZwyZblt b9r9126j+bMvD6hR0kEDKHVrrGbjQv0HJNd6ZHu9fKoZI6iMO7zze4pAZnicHXvNuFvU nQVZacbZRWPNyrPusatl4uhcoEQIlS5RxKjvEmDg2ZP1LIJaPb2g4eDIT5CZTC7ll4i2 bd80n+Vw3iZqChpRkRgz0Q+07LsiBBtsgLgIbdVo/dzu72oWun8DyxJtnkkV9O8FF5SI 5nV6p5qPqZ/Lg1/8kEgiwzGIM+gjPwzr4+BzbSPCzBVNUxAq+EG3IBVwT9ZYAnIf06Uj kz6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727771325; x=1728376125; 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=Wqoqd7msuLgMdcy5pk4TzN5OOomlS/s2Wl4roxejQjM=; b=MmOfVBjiUkXvi/xWPe4SAMOHTt/Gk9r1ca1SyyXNfsrTN/51WQRSOtKis69xNXS/09 MlCZD/F1moSSrmMr10WKZDifaNshlGBNyANfgMsP+EfK/E3wbugBlQzMgYrqkU6LMo8E 2vfEgQ6C2aimh3m1nnS4n9LSaRuF8/U/v3wDMfebrBqjE8OWmechUkNWg0CslT0SdXtP MlPo9CTQKIS0Dc5Jynbc848u9MQvGeE0g+i20sjgBaEpr5kr1rrZ6t1pUTJ3SXEL7yo4 nVcCyfEGMd5nb+1EJGwYK2rjIw2AVIxQ6MLAXyUhxlP0Q597/Qlgrlw4qh3gTDOo8p9u k1Pg== X-Gm-Message-State: AOJu0Yx6vCL3qyFkfB+Saz13XLo0W2qJBr2S4p83iiO6bcvSBIk/ZtAH TdA2VSmEPjx0pYtk82/ChMbC+SrOA8h4pQnjq44N8Fe6MaMQ//y2lhZCMI0fTKFgF9BIluH+nxq jzVs= X-Google-Smtp-Source: AGHT+IF3LgbIM/aYSQ2vuc0JEIu8qNbcbWPRy8IczEihiLiClovY+Wb9MA2G8uIGpyMRjpGEjNS3yA== X-Received: by 2002:a05:651c:4ca:b0:2fa:d67a:ada7 with SMTP id 38308e7fff4ca-2fad67ab1d6mr21350001fa.23.1727771325058; Tue, 01 Oct 2024 01:28:45 -0700 (PDT) Received: from localhost.localdomain (78-27-76-97.bb.dnainternet.fi. [78.27.76.97]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2facb2ce928sm7734221fa.76.2024.10.01.01.28.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 01:28:43 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v5 03/11] systemd-boot-native: add runtime dependency to python3-pefile-native Date: Tue, 1 Oct 2024 11:28:13 +0300 Message-ID: <20241001082821.26115-4-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001082821.26115-1-mikko.rapeli@linaro.org> References: <20241001082821.26115-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 ; Tue, 01 Oct 2024 08:28:48 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/205137 It's needed to run the ukify script. Signed-off-by: Mikko Rapeli --- meta/recipes-core/systemd/systemd-boot-native_256.6.bb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meta/recipes-core/systemd/systemd-boot-native_256.6.bb b/meta/recipes-core/systemd/systemd-boot-native_256.6.bb index 73db59b14e..58db408dcf 100644 --- a/meta/recipes-core/systemd/systemd-boot-native_256.6.bb +++ b/meta/recipes-core/systemd/systemd-boot-native_256.6.bb @@ -13,3 +13,5 @@ addtask install after do_unpack PACKAGES = "${PN}" FILES:${PN} = "${bindir}/ukify" + +RDEPENDS:${PN} += "python3-pefile-native" From patchwork Tue Oct 1 08:28:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Rapeli X-Patchwork-Id: 49850 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 34220CE7CEE for ; Tue, 1 Oct 2024 08:28:58 +0000 (UTC) Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) by mx.groups.io with SMTP id smtpd.web11.76641.1727771331174061398 for ; Tue, 01 Oct 2024 01:28:51 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=eGVYk9Sn; spf=pass (domain: linaro.org, ip: 209.85.208.175, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2facf40737eso19784661fa.0 for ; Tue, 01 Oct 2024 01:28:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727771329; x=1728376129; 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=eGVYk9Sn4gFL/YFEGjIeakcdLXmOvW6Bbs42O1CJOXAB0jStSBAq5YUQtXUFjC/+ct eZrPpIa9pXgcGiRIsQRXTpOEoSzbhrcM/7hIuaFGIJurVvDpNsb4WIcMyk+F9VOllGeL iYnp8e9cqUsAd/2MPO/Jc+8n5gj3srpKDf6oYcdjhgm2MmSF4KFVaAPNVJ9vcFJEJOec aCkGtraClk7vGwY72FjDIy9wZ0IHGThY8AuTXwikJQi5bxL6TjhBZQazlL0i4SC75jQv G7eOPs/hv6V2bWwWCky9c0lrRi7sUOhcJh+l1UB6pWPz0pli3yJUjYCRJh5IfBSwmmyb Sr/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727771329; x=1728376129; 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=P1xijdpUtgki1Adf7cx/Oljz/3TXu3uIGmp21EhHfLHGzNqW+zZb1XTv0qe4pAgFW7 Tbvw1HKS5zSig7JJZ4vAp6AJArvq7bvLl0bJcPlgMv+cURF5H/DGy7icZjCmXVKyDrm/ XpktLc6DJUfuEfhB5uTwtYXwAb0PQz+rWvxLXAi8+NPk6Abf1ANLb/OJUY4Ap0IJFjjh XtEp+Ej01FNcEajSfDz5QpGiSQtuCswNuI9z+YoHVJ/EtvtrqMN5RWvuxLO/xbDpNZ+a bdCyr8xjmaw4ULCbqMaQmv2/g4i6MrkkoL64ogrsm1/F2cYDvdlkAfksXnw5u9qSLqwP 0JFQ== X-Gm-Message-State: AOJu0YwLIyQ/jDE9ZfhpEjI4teg5/CbVnDJ3eWve8w8SKJq9cwYD2W82 4I6g3TA5Wjdtj6/NQ9TmkiOAz421KSzns5zULoazg7WthlW8yTSpU3bklU/xgI/yGr4CCKuqt6n +vCI= X-Google-Smtp-Source: AGHT+IEvmT1NJbVErn7+vBV+OnlZllHMT0frvn2BgmiC6ZZF78Swng9H/y6eq5S8joUjZCO2+U30PA== X-Received: by 2002:a2e:e12:0:b0:2f7:5f6e:d894 with SMTP id 38308e7fff4ca-2f9d3e6b711mr53699291fa.25.1727771329119; Tue, 01 Oct 2024 01:28:49 -0700 (PDT) Received: from localhost.localdomain (78-27-76-97.bb.dnainternet.fi. [78.27.76.97]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2facb2ce928sm7734221fa.76.2024.10.01.01.28.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 01:28:47 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Michelle Lin , Erik Schilling , Mikko Rapeli Subject: [PATCH v5 04/11] uki.bbclass: add class for building Unified Kernel Images (UKI) Date: Tue, 1 Oct 2024 11:28:14 +0300 Message-ID: <20241001082821.26115-5-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001082821.26115-1-mikko.rapeli@linaro.org> References: <20241001082821.26115-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 ; Tue, 01 Oct 2024 08:28:58 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/205138 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 Tue Oct 1 08:28:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Rapeli X-Patchwork-Id: 49849 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 33B8BCE7CED for ; Tue, 1 Oct 2024 08:28:58 +0000 (UTC) Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) by mx.groups.io with SMTP id smtpd.web10.76276.1727771335096264439 for ; Tue, 01 Oct 2024 01:28:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=tiWNu550; spf=pass (domain: linaro.org, ip: 209.85.208.174, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-2fabc9bc5dfso35846771fa.0 for ; Tue, 01 Oct 2024 01:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727771333; x=1728376133; 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=tiWNu550h4p6TpBsYEQuXK/HITDGoOtNezhDh5T9X+AgBqKGsNLw4kSpWaLHGstavc GK3xITkc/TnKGTIUnlxL5g4YzeU1sbcjaVIEve4CHdj14WdxtDAObzocTH/t/0EW2WZA JwmmlhVOqo+wGwjdkkXqx5fVgnqshmaqHEykepFDTn/UFZNTgcw4ghMp9ClQojHvPJxq pEISC643XQZ9XTMa5cK8eTXq/vq9Btl0wbaNcVewskN/R0XX0Uj99L5ouLlrd6rmE5Hr xknVTQSnX/71WOQixs7RHeeORsrs2xEw5odf6+0mbS1sz4VOqaNEuCGmnnrwbUMS1RM/ gyrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727771333; x=1728376133; 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=U4ZLPIS7R0G/ts9zopDjfRktfNnZRzG7diBR3BkHqSS22hx8EeOGh8ekjble1jZWDm F3BXmE7iG904qGTMZxypUU9PgeVMoXPL5Myn8EzSot9rcyBaGbEqIvFkbGCXprIe/vw4 6VFQ1yDyNd3ZSYCjogbJ4di5YB4sVsXYzLvotfI/YIdQWQ7tvpxehhyPiioFLFupu4XR GylAmm8AMBBjI52CxnUxKdH2IlYMSqgKrjb5MRN/YUQFToYJqeobJbZVExHR7Pn8dVNb SZdk8VmwYls44Zlj6Qr26PBRus2it2o92b2w5W7gW4dFDWQQhVl3yDxh1BmBapmfebC/ eVlw== X-Gm-Message-State: AOJu0YxyoapLt6EwWNt8cIF5HKacsPtLbLnUcsvAO9SEhWrcqwkFcWO5 uvixujM2mrnULJufWftJVtAWjrimfC7I75bCL7lBpXjGfXvR2f4BDCc3wBGFqkKBUnQKiJ3yxiv 7Vt4= X-Google-Smtp-Source: AGHT+IFEcUFoUJDnKVhKmcz0/GVcXnP4HflOGSNFatjvP6YdE6tZ0sVSscM7W2MAaPZqgqlt7MQOKQ== X-Received: by 2002:a05:651c:211d:b0:2fa:cd7e:3b3d with SMTP id 38308e7fff4ca-2facd7e3c47mr38227321fa.42.1727771333124; Tue, 01 Oct 2024 01:28:53 -0700 (PDT) Received: from localhost.localdomain (78-27-76-97.bb.dnainternet.fi. [78.27.76.97]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2facb2ce928sm7734221fa.76.2024.10.01.01.28.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 01:28:51 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v5 05/11] wic bootimg-efi.py: keep timestamps and add debug prints Date: Tue, 1 Oct 2024 11:28:15 +0300 Message-ID: <20241001082821.26115-6-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001082821.26115-1-mikko.rapeli@linaro.org> References: <20241001082821.26115-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 ; Tue, 01 Oct 2024 08:28:58 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/205139 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 Tue Oct 1 08:28:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Rapeli X-Patchwork-Id: 49851 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 335A6CE7CEF for ; Tue, 1 Oct 2024 08:29:08 +0000 (UTC) Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) by mx.groups.io with SMTP id smtpd.web11.76646.1727771339283789388 for ; Tue, 01 Oct 2024 01:28:59 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=bT0Qm3CW; spf=pass (domain: linaro.org, ip: 209.85.208.174, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-2fabc9bc5dfso35847461fa.0 for ; Tue, 01 Oct 2024 01:28:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727771337; x=1728376137; 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=WF5CogOGJ7lUJyGi23SDGPVKzs39ssfvf2xcSI8+oc0=; b=bT0Qm3CWsaCWYjBX8UlBSSMfik30GRGPaie5J/iiS/FHehsLP7s+kagraVc8iSaHm+ 8UWpqn9BE142t4U7fHrzDjub5Kl5DMQZ0htnhLiCwKxv8aPrvU2q4HVdK7aLptDe7YT6 bZQaD/x6DITIa0CUePKba0SChdKAdfCJI4oBDEBLHTghHvZnIw7mtm0rBvex0yV8bbZD i33Jn1wrUT3e7u3x2DaZjh+mvKTU3UMczMFSjs9PMjKFgjRa6o321PS9XmrlnqFAX+Du +73ZVQDBPnoXzAT+oaH0ZAXn6L7bfyDOpToxZ4wuHF5S4oXXwhYboDz1x1iGv91wVHpk MoXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727771337; x=1728376137; 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=WF5CogOGJ7lUJyGi23SDGPVKzs39ssfvf2xcSI8+oc0=; b=fTvE5FGtVK170KIhdFyWL4BKsv0S227ohvtpfUNa7E9P/dScISSstWs2qWZLdB6hlE 6VTmALVTw/p9uY8t44IygIKdOb+1sRjDNhv6ukclmCVEpLJXLz9Sxwq+X12qoPgEGx+h N+JlKl7nkuDTywyfvOOSAGDlS7HJUy3DuWExU2z9f4q4CNVQxX3IzlpVF7fu6U/Itq2N sJYVBTSuvOGKRVmyLLsxZCsfiKerWsoAanHrgTTc+Zad5js6y604mLPz9kmJXBM9hzL1 d8ZbFiHOutUSCzOq5mgD7e2NvHWdylUezsDMy88EWiD3cbSd/3VtifysqtXou74Hkxnr 9yww== X-Gm-Message-State: AOJu0YyVOVEYOttyqJVCA2DHjRb6e+RGQuyy7gAL3n228kZzH8XmEW2e 7o5fMEdGhNzezDUGgVXiBL0tDJDoB8GeEDoQQHniDncxTjPT9z+JC7cWeRXW+EVZHTiMfk++9zX WI00= X-Google-Smtp-Source: AGHT+IHQRa0q5YzuVzx343SOFATyjjmsbwpWDwt5DXU9hD9ZVsFNcLuCYSjnskTABAjl4tb7AOtIJg== X-Received: by 2002:a2e:be9c:0:b0:2fa:ce48:11ca with SMTP id 38308e7fff4ca-2face4814bfmr33788731fa.35.1727771337232; Tue, 01 Oct 2024 01:28:57 -0700 (PDT) Received: from localhost.localdomain (78-27-76-97.bb.dnainternet.fi. [78.27.76.97]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2facb2ce928sm7734221fa.76.2024.10.01.01.28.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 01:28:55 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v5 06/11] wic bootimg-efi.py: change UKI support from wic plugin to uki.bbclass Date: Tue, 1 Oct 2024 11:28:16 +0300 Message-ID: <20241001082821.26115-7-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001082821.26115-1-mikko.rapeli@linaro.org> References: <20241001082821.26115-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 ; Tue, 01 Oct 2024 08:29:08 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/205140 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 86f40633eb..a3160f4978 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 = "" 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 Tue Oct 1 08:28: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: 49852 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 37B8ECE7CF1 for ; Tue, 1 Oct 2024 08:29:08 +0000 (UTC) Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) by mx.groups.io with SMTP id smtpd.web11.76649.1727771343271085598 for ; Tue, 01 Oct 2024 01:29:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=I93UE4Ew; spf=pass (domain: linaro.org, ip: 209.85.208.172, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2fad0f66d49so22990421fa.3 for ; Tue, 01 Oct 2024 01:29:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727771341; x=1728376141; 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=I93UE4EwmjCo02owDTsqZjuLxWX6jqg3FNr/nHdB4KbYD+KcZpVyOJlYxG/a/FA0jZ gmlGaexca87mMvdfmfiyV7fBeyEe1ArhW0YnyCuUBXuP1eORsyn6oyS2+rjAj0bGHfR3 n1uuatuW1GYivZmGpmq3uNDO+Vk8AY1wQ9N7Aj6AdtA2f5IzxjMi/aHtckbGPW2MLVNv ikwE1GZESf8kW8ms/wnl8TPu1FRJT6xcUwcMlxVnpSnd9zyQl9hvENZkcAyESwHa7qSx DrhAKl3wu5hXxL55C0yH6VMEhQS6zPf5JMeI7m02fzOMwZNgJNM2T4zb2KVDMTdlPqjR zjKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727771341; x=1728376141; 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=thsQFf0Th0ktLrrI0GnC16XmNZQH/WmS+8CTrUMuM9ZU3AEpE7T2Lj9Wsc1J9FJzaa 6Nu5TQCoF6JaUFNizInbY9SvSLRyIbL2Vvjnp75axVzb0sNljmP1Zv8F0xF1Me0uEtEF VyinR7i3q2MVpcDXWgBIC/qwLfP60xEOZVP0MAoh/W8dguGnu2vcCi9SnP/XMF4KlMYV oVjXcotC527JgIrXUuSz8LYYyevHuJ1UQ5dxHXstKY8OuwAxm2Hj16dTjvQCfCx6IbB3 gz5KyTsTW6kjA6K+b8y4SWrEodi4TDkXouUY3R3WGYtIaw7EeUHmE9q+mds3yMoWDa3g z4NA== X-Gm-Message-State: AOJu0YzNqQaRXXoWZ5l8MdQZlblR4VTjP+nTrtOFWiaCAJE7nIXhYi9g DYnPPqtAPP7FnT14JKo4Y0sFP4sfMN4jFloYr2phjEwmoM6yK+i1VIYmb6RysIHPXVt3z1NUx7Z P8Fg= X-Google-Smtp-Source: AGHT+IENQNs29yqSxw3X3h1ledoimjwO3HHQW9u3UVYx5ERRVwm7JgFGj5KfUDBQwEex9qtLbzQEsw== X-Received: by 2002:a05:651c:a0b:b0:2fa:bda2:ce34 with SMTP id 38308e7fff4ca-2fabda2cf9fmr52628211fa.36.1727771341329; Tue, 01 Oct 2024 01:29:01 -0700 (PDT) Received: from localhost.localdomain (78-27-76-97.bb.dnainternet.fi. [78.27.76.97]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2facb2ce928sm7734221fa.76.2024.10.01.01.28.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 01:28:59 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v5 07/11] oeqa selftest uki.py: add tests for uki.bbclass Date: Tue, 1 Oct 2024 11:28:17 +0300 Message-ID: <20241001082821.26115-8-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001082821.26115-1-mikko.rapeli@linaro.org> References: <20241001082821.26115-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 ; Tue, 01 Oct 2024 08:29:08 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/205141 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 Tue Oct 1 08:28: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: 49854 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 39821CE7CF5 for ; Tue, 1 Oct 2024 08:29:18 +0000 (UTC) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) by mx.groups.io with SMTP id smtpd.web11.76651.1727771347878088884 for ; Tue, 01 Oct 2024 01:29:08 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=sIgik++Z; spf=pass (domain: linaro.org, ip: 209.85.208.169, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2fadc95ccfcso3170091fa.1 for ; Tue, 01 Oct 2024 01:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727771346; x=1728376146; 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=sIgik++ZT3byHXQnJ3Ozd/7d3+8O1AsM372RPNLsO351WqP4NQ2Mo+601bDqS1Vo/K rdpg+waDD9T70q/3B7W6lU8JK+3A/swkXbo475+5zpA/GQOmXvozplwkmmbeEcAkiYsm wxoH9firgDt5hyPQYHGXz3kzYDiiKMyBAK+RxByTVl38zmzTCocxXF68RBlEJ00o95h5 q5/8GFw4IVIFGcNgv+7RsWC8vgQXUV2UM/uLK4ivIpsxyv9Ofn6Jg1oAZzSpTWVoys67 Ng0x4wugo4oDb1Qlt90dkMvg5iVhIlHIR0uPYIfFg+noyPR1clQr/Uvk50Tz8p+txjEm SvbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727771346; x=1728376146; 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=BJSR9Jbor2KxiY/oENnrm8D10qXT3209oVzvtlxR4jOxA0SZXhoN8+N0x2p0B7Sigq tmNzynDjWcZnZKxnBw/ZV8cAO9GsYfzrK8DnjsfrJIKufro7gCZbozZw5Oq6/+RY6Q/B WQOwo4VgDm7k8NntOsCA5BbK047o9vmkoNehqUr5LSSjaOO/uwj0dwKsB6Haw9vI1mR8 7ATgPZiIVL78YugM2POsafXdQ8sEz0CRQZ3vIpMLpjc58MrEDeJBY/VWN7Zw8CoAF3yB CwUBBt0c4yL2jSNPrfK/aOB/8Gx0C5whihqfiTjsdYXgdimPGYZHqUbylkDK/PrkdEVb BhCA== X-Gm-Message-State: AOJu0Yw93W+V5I3SbHQNjLBjlZKMDyS9r68urRgnCGIuYnu4JXJ2XutK kKcSPv6q622w6asde4bMZe6liexfFnsZcCaFxCrpX+dLat1chrbnTt/njLXhZky8+HraDBKCjld bNmI= X-Google-Smtp-Source: AGHT+IFP9sYPBzt0YyRVtRdQsqhdt3NNZUaqjqcS1LbeC7HAhD2g3kZvLe5ih+NlQ+2pruaPuM1TZA== X-Received: by 2002:a2e:d09:0:b0:2f7:4ccd:8918 with SMTP id 38308e7fff4ca-2f9d41b5f1cmr64136771fa.43.1727771345844; Tue, 01 Oct 2024 01:29:05 -0700 (PDT) Received: from localhost.localdomain (78-27-76-97.bb.dnainternet.fi. [78.27.76.97]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2facb2ce928sm7734221fa.76.2024.10.01.01.29.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 01:29:04 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v5 08/11] oeqa selftest efibootpartition.py: add TEST_RUNQEMUPARAMS to runqemu Date: Tue, 1 Oct 2024 11:28:18 +0300 Message-ID: <20241001082821.26115-9-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001082821.26115-1-mikko.rapeli@linaro.org> References: <20241001082821.26115-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 ; Tue, 01 Oct 2024 08:29:18 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/205142 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 Tue Oct 1 08:28: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: 49855 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 4C2A2CE7CF8 for ; Tue, 1 Oct 2024 08:29:18 +0000 (UTC) Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) by mx.groups.io with SMTP id smtpd.web10.76279.1727771349432883744 for ; Tue, 01 Oct 2024 01:29:09 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=Bmz9ks2j; spf=pass (domain: linaro.org, ip: 209.85.208.179, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-2fabfc06de3so29473261fa.1 for ; Tue, 01 Oct 2024 01:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727771347; x=1728376147; 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=Bmz9ks2jX/n1acXw7Ckb4mu7GQBW9CdCs0WLCer1Sa3+q/NxPhyz/OFb76fHjM16wt +/H/qLzL6sX4jj8FSwI1DzYcXZmyCtQo8h72aJuVSNvGaRAnQoSNwNlT5e44UDPjyZ2R w8BKVxPtmilf0WaTsNipWpIlFNpAqKNPD7HfJLskQ/SciQHsqofVU0bQVu9qaLrgfiCX XRmifhoyOxv/JQFoMSFHL1luGSjtNL4rXmLPeuubNUyRGfC3ZOOmiMhPkaNGXtHwdO8Y VDXWloImBqJuZUxw0Lcy2EMjQJibYUvPjB+w4V6sSgU8Tx2F6ANHYU17pfDspPng1l0e ZoJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727771347; x=1728376147; 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=C0DwhT9OOx185PPA1HZd9n0nIj4gk0XivxNdpvjx65zJKCq7JXfch2C/h8IVTBFson iZ7BNj0cwQHFyXyh8yYuVi+Ki94n72uOQqxgZG8z4nIogktuMiZBCMoOMXp9w4VIyZea Jx8C2sieIIP7lUQMqNlxducufgaPpwgyGM1gBE7f+yb766oZfkeycf/Jng4qxjti8LrA E0jcyoa2sJ2uk+pWP5LqWgJYGUfaIYZq9aV5VqjHZiqtC4nMYqHO1uo90vPZSXJqIHkL K//6cWPpj1zGFxTwCIEj55YiLrznty5InSazbUVUxLlb4/cBk+Mlbjby+4el5VjhFteR tDgw== X-Gm-Message-State: AOJu0Yzu52F1GMEfSY+WZ4xzUbGOzun2FXN6oZ33tRfH4z0gOnvPhenh fj3a4tyJtG0dCFleiys6KcbgSARqJv6WwK/DE8+YIfL5+EXgtn3Jjs2zEDmPA3SStCT1yuuT+/c c6iA= X-Google-Smtp-Source: AGHT+IEOJ/4WKcImziAgwKtjSAPpsbad3PiTQuYIMMRR/4EUaYzn7QH8mmTvQz1ezu1oekw/dcmuQw== X-Received: by 2002:a05:651c:19a9:b0:2fa:c5e5:62a0 with SMTP id 38308e7fff4ca-2fac5e5671bmr43312011fa.1.1727771347558; Tue, 01 Oct 2024 01:29:07 -0700 (PDT) Received: from localhost.localdomain (78-27-76-97.bb.dnainternet.fi. [78.27.76.97]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2facb2ce928sm7734221fa.76.2024.10.01.01.29.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 01:29:07 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v5 09/11] oeqa selftest efibootpartition.py: remove systemd-boot from grub-efi test Date: Tue, 1 Oct 2024 11:28:19 +0300 Message-ID: <20241001082821.26115-10-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001082821.26115-1-mikko.rapeli@linaro.org> References: <20241001082821.26115-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 ; Tue, 01 Oct 2024 08:29:18 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/205143 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 Tue Oct 1 08:28: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: 49856 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 3AC9DCE7CF6 for ; Tue, 1 Oct 2024 08:29:18 +0000 (UTC) Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) by mx.groups.io with SMTP id smtpd.web11.76653.1727771353474559408 for ; Tue, 01 Oct 2024 01:29:13 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=kw75vsp9; spf=pass (domain: linaro.org, ip: 209.85.208.177, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2fad5024b8dso15594831fa.1 for ; Tue, 01 Oct 2024 01:29:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727771351; x=1728376151; 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=kw75vsp9WhXnBPERb0sexDgUX5TjsoAZ2IgLvcS2vC9urBdrzslFQ6pkANTnMICnpV 7gQigrDCwd98dwP176w/Z2CjyhaCxZWpPe6ttErG0YV+9EmuAtjPnpcuE8v3qHDqKk0P ZsSZrEiIXzszvKkN/ZiZQsp2VVBIl5F8xP4KLfM4D65cARggecAE85elSd1r/LjGLmMs I6vpfDep4sPx/RQCC20WkkjAgNbqWXRcDrGh28wWjlxUtRCZ0cBG1u+J8oKSIouU4Yul 3XcjiDIcOSXflhfJWVG3CcCeKDZQ9W4IH2SKtQEJ7WSX53QvyfKiLmtLDKCgnEnb+a3e v79Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727771351; x=1728376151; 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=Z+aGGbugWT9rmWnq074SotVDaVUo5JVo2peUx8Veawzqw9lCFh7ZlakZ7VSXnN3I9O 2u9VbJP0rRC991SQYAtR2s9+FM8ZAW7xMdG6I6FrgYiZFd/wFS0toPehMVVoiPjkNA// F/pU10pfdsMglirwAqc9mlZC2xUljPnWYu6fFTRb4ST/iiZINgnIYkhPNHrWCVeLMqnH ya/wjxNVvLcGNQ6NCkQ6sKedRbmwP3Ewnc90UsVMC3B0Eqasynf4yqOifRAaz4fMR9ya YkW5lUpLucZpPj9SiioqU/cjbuzodAJW2vjgVFOuktxBynYfC9dQAQXDHCjg33Jn+dOj MhXA== X-Gm-Message-State: AOJu0YxiNo99BdlsRsmfKwql8aPUUSJcz/heWEXyuiSlWJqL1bje/HoB c9Xp0tML9XYxAehJlk4BbJ7jcYxLjkGbKEp9pGuG23mc9ph/+SImwpSceCSWiSGN901OIrS/PhR hIik= X-Google-Smtp-Source: AGHT+IFz9XSNszSQUPDhSvPKF8HXx+kge7br93KEuZoy+fXrttJWyyjnK3YhAH6ecf3/PVMvhn5Mmw== X-Received: by 2002:a2e:bc19:0:b0:2fa:c873:45ce with SMTP id 38308e7fff4ca-2fac873471cmr28369461fa.30.1727771351441; Tue, 01 Oct 2024 01:29:11 -0700 (PDT) Received: from localhost.localdomain (78-27-76-97.bb.dnainternet.fi. [78.27.76.97]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2facb2ce928sm7734221fa.76.2024.10.01.01.29.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 01:29:09 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v5 10/11] oeqa selftest wic.py: add TEST_RUNQEMUPARAMS to runqemu Date: Tue, 1 Oct 2024 11:28:20 +0300 Message-ID: <20241001082821.26115-11-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001082821.26115-1-mikko.rapeli@linaro.org> References: <20241001082821.26115-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 ; Tue, 01 Oct 2024 08:29:18 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/205144 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 Tue Oct 1 08:28: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: 49853 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 36CAACE7CF4 for ; Tue, 1 Oct 2024 08:29:18 +0000 (UTC) Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) by mx.groups.io with SMTP id smtpd.web10.76282.1727771356176955627 for ; Tue, 01 Oct 2024 01:29:16 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=vcharMeD; spf=pass (domain: linaro.org, ip: 209.85.208.170, mailfrom: mikko.rapeli@linaro.org) Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2fabe5c8c26so29884811fa.2 for ; Tue, 01 Oct 2024 01:29:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727771354; x=1728376154; 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=vcharMeD5ml9Aw+fJNzymzMjtCjZu9B8ZGlRHS9BKA3hlqj6BlhjpqY2RN3c/ai04q RN7cL9NzYvg+bYyUFtEw2zRPqwxkHMvzcUTtVutSDGp4cvcEKIDPrkSJXgrhkmFzxbDa BFijYk2cbcTbTIjNJjVYWrgKQ6aSMJthBQiIT3TtqN8375oP/PBKf124uhjBqPvE75l+ 9k29TcOf2m2HwqmIhbDLQHm+Dx4/wzD3Y9LExV/FFEffDYlJ8WgI2KyxNWZI2b7Acrkp NNdYz7Ejy2OnnqdcxUNjVYj1/YhMAPlRBtH2yXM2N77QPT2rco6yysXGqWYv0PR0/pwx JZSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727771354; x=1728376154; 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=Mq5SoM66D7fxR/bSsLpKBpniV+EIN5zxUfezAVI/nuXERFUVzfklYs/nH+Gu4fHrYy gTtOah8775NWf1GHvCMCBjshCUbNG6SciDUryZ/UpITlvMdBJP7BAYalU5V4/9ZAaBlU msN33/xIV82BfXCEp8U4GV+1qkBf1a92Gxr5qwPUony6grokwHvSB4aarvAOWv6uy7vT /gOpcLO5axaUwCEK0RBR5O+aWNoOwQJVcGSZbnXpdzd7WsJ5eFA4v+tU7CUdAufncVY8 XDdB4q7mnFn9ODvc17CKdUVfXm6VWo684O0PvtR1qYMsVpbwKKCnfUUsals33/WE6LZ7 pSZQ== X-Gm-Message-State: AOJu0Yzxd3Dola/omU1f4XIeEfQrzhw80MNgjcp0YAX6iR+Ocvbrhtt0 o6NZc1S2gd76T0lbC6xEBBD2Kjd9eX4C5gIG0tXGmK9dBMmU2E1JY0aI6LCqDI+D9cyqxnsa0V2 xF8c= X-Google-Smtp-Source: AGHT+IG9BQw6v2hksuNzVwlRKpBvtvG3UKMayyHE2MOAZVZYckLw1Uzr2UGFc6OX+yD0Sgx3xO2H2w== X-Received: by 2002:a2e:e11:0:b0:2f7:58bc:f497 with SMTP id 38308e7fff4ca-2f9d41a4ceemr58414321fa.28.1727771354225; Tue, 01 Oct 2024 01:29:14 -0700 (PDT) Received: from localhost.localdomain (78-27-76-97.bb.dnainternet.fi. [78.27.76.97]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2facb2ce928sm7734221fa.76.2024.10.01.01.29.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 01:29:12 -0700 (PDT) From: Mikko Rapeli To: openembedded-core@lists.openembedded.org Cc: Mikko Rapeli Subject: [PATCH v5 11/11] oeqa selftest wic.py: support UKIs via uki.bbclass Date: Tue, 1 Oct 2024 11:28:21 +0300 Message-ID: <20241001082821.26115-12-mikko.rapeli@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241001082821.26115-1-mikko.rapeli@linaro.org> References: <20241001082821.26115-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 ; Tue, 01 Oct 2024 08:29:18 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/205145 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')