From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7118849486659518464 X-Received: by 2002:a05:6000:2cc:b0:21d:76d8:1f2c with SMTP id o12-20020a05600002cc00b0021d76d81f2cmr13888256wry.471.1657486308842; Sun, 10 Jul 2022 13:51:48 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6000:178b:b0:21d:350e:23a6 with SMTP id e11-20020a056000178b00b0021d350e23a6ls13422176wrg.2.gmail; Sun, 10 Jul 2022 13:51:47 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uYt1AAOh8snSXNxR+LOp4GXNCJFNao71SsMYwbHj2iKdjCme4isAdPuYTRxWd5kYecKTyi X-Received: by 2002:a05:6000:185:b0:21d:7ffc:4916 with SMTP id p5-20020a056000018500b0021d7ffc4916mr13932052wrx.692.1657486307654; Sun, 10 Jul 2022 13:51:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657486307; cv=pass; d=google.com; s=arc-20160816; b=yMx2pNtPB2f9vNjvgBYRQB0LP7Ef9rWDsMjFNpJL2S+a4R7BC8BncL5W6pxIiMHw+q Ion75R2KL0Dm9ohgVXw/dgXKqY/C5ReivUdHPrjDNJPLX3INcw3ykewb8L8+o47lI4Jg w2DL3ZiJVUrvs2FAdxdl6Y+MfK2NMfNrVkg6k1EwRwANAo1qKdMQRk/K/AukEKM/i2/7 13rrHeh0hGfUfwlnbG11jyeJmFBz1o20Ofr/o1nELyeZfjRhx8x46Nuem6ZHvzURFUc2 ah9JyvBipdxqJQw9Xpwu8zUG4txYczjYPHElufJWAkNOb7LNx6p7jdDY4S3YalnT6QPk q+vA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:to:content-language:subject:from :user-agent:mime-version:date:message-id:dkim-signature; bh=9thRZYYXWSyMxKICJnflFegwD3YZofsqf97VlQHEp4Y=; b=ql66x9oUa685yCpUzbQEc1X6dqCmRXEqLwYvM8L1wixKyFBllPMw6UDfXGxgX6vg92 NWjNQ6EZGlOgwpdQQljif7sNfHP8EOrrfZK2foHcbyBqDc+DvLmbEvfWMOSh99zsoOkK VvcvMew/M1MDr15gMhh7EDF1Nz6F3JY/yF/SHROcStL59VBIJlpZJUjNSeahv4RMK3FM MzqR980JspVlzF0fnGbHNL34BZRQtf68+FHYU73b6/QSVVfEjb5XKKm8L0lhEwFgptZA ClQcG8SDUqEZFDR0YHwEZNbvF7GtGQIpC286RmZBMjobJrQDU5sqOiQrCcsT8yzsWU4/ IjSA== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=SyexQudH; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of jan.kiszka@siemens.com designates 40.107.22.86 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2086.outbound.protection.outlook.com. [40.107.22.86]) by gmr-mx.google.com with ESMTPS id ba6-20020a0560001c0600b0021d9f21dd58si76037wrb.6.2022.07.10.13.51.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Jul 2022 13:51:47 -0700 (PDT) Received-SPF: pass (google.com: domain of jan.kiszka@siemens.com designates 40.107.22.86 as permitted sender) client-ip=40.107.22.86; Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=SyexQudH; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of jan.kiszka@siemens.com designates 40.107.22.86 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OLvNIaBC9TtKptk90L1xae4iExScLeIkoxdzFiK6FRx/R/YeEcovZ7O4A6Qk1gwodYOXzqpRqARgdV6N015/Ur2ClgNwITbEq9H7Ss17ICY9PyCJgdDSdEIyuHRrAI02FLI0Rv/L1kNpGJ3tuIdX7KNXlRbTA4uHAI8bSPvM3UbU9CQd5n1g3LMqHyIaybw4XZLlc0/l9jnjz3K1uhLyPoWeHB362lQ3xfGpITsJsk+tGZbrIgUqL9J8o5DVA3IKLdnyF6idY6uwfmdHXKTeRj78wyH7JW9A3AZGLZzg/9oJ5PSvhBWh7ZT4Lnlf7u5Ok1JM/1pnfVF/hc2abwa6nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9thRZYYXWSyMxKICJnflFegwD3YZofsqf97VlQHEp4Y=; b=XMwY3NF+YCncFSHlixrba7iFCIbyOedCu/4Bjyw5aiXgQQ2n2V902DXOQGRGWeriGzXnYmeAo68vGUVffFW5BZ//bBXFJDomNByxJxKGkB2yI0dS7W9nUOdsb6EK9ghjCN2cqfu3rWU5qN8nFUXcAj80ZI3U6Qu35yGlL/9Q/L1RB0XSy0lPOY6bu1g57t3JicJ3uQ2AGVNHeHra/1dUS4TGuRbPomnOACt1T9P2sP7I87exHFtclO1Zwi+l1cwRrU2scLLkDZ0xhe1n7gHbCmec6LQweNwQGdZuYjGSsBoLHwTXD7f0oEvmgb2fq0LGcAKBn27Ht5J+jj5RJqLbbg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 194.138.21.73) smtp.rcpttodomain=googlegroups.com smtp.mailfrom=siemens.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=siemens.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=siemens.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9thRZYYXWSyMxKICJnflFegwD3YZofsqf97VlQHEp4Y=; b=SyexQudHzyfvqpsOsGCyisXySyVJTjNZMkW6psVnpWm3Y/fhg3DswZY8ivaUSzAwiYo47ou6w+zWnWS8fMog8qZkdbsj9Uj5Mv3vrUsxS34IOSLCb+eMr118GOpEn5h6uHHOOW6KnMwmZZO/DsnIWEsWu1n2kwhtMxVpDcG5T4d5OSUVxMXAewzWplLWdgWWRn5JS/BxdAB141w1vyGJvxINL7I6Emd+tQGICrk31ydBLpAhyHeG24a7QEL+zdHnhyMmygqmZgrD0h2W2e4WA9Il0UjDFYxRgcfhqQWk9AmUv+0n1rcSlMhyEhbPxZEd7m4TjbpuiOYjpleTrr+3Sg== Received: from AS9PR04CA0120.eurprd04.prod.outlook.com (2603:10a6:20b:531::7) by DB8PR10MB3943.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:14a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.17; Sun, 10 Jul 2022 20:51:46 +0000 Received: from VE1EUR01FT102.eop-EUR01.prod.protection.outlook.com (2603:10a6:20b:531:cafe::7d) by AS9PR04CA0120.outlook.office365.com (2603:10a6:20b:531::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.26 via Frontend Transport; Sun, 10 Jul 2022 20:51:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 194.138.21.73) smtp.mailfrom=siemens.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=siemens.com; Received-SPF: Pass (protection.outlook.com: domain of siemens.com designates 194.138.21.73 as permitted sender) receiver=protection.outlook.com; client-ip=194.138.21.73; helo=hybrid.siemens.com; pr=C Received: from hybrid.siemens.com (194.138.21.73) by VE1EUR01FT102.mail.protection.outlook.com (10.152.3.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.16 via Frontend Transport; Sun, 10 Jul 2022 20:51:46 +0000 Received: from DEMCHDC89XA.ad011.siemens.net (139.25.226.103) by DEMCHDC9SNA.ad011.siemens.net (194.138.21.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.9; Sun, 10 Jul 2022 22:51:45 +0200 Received: from [139.21.18.178] (139.21.18.178) by DEMCHDC89XA.ad011.siemens.net (139.25.226.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.9; Sun, 10 Jul 2022 22:51:45 +0200 Message-ID: Date: Sun, 10 Jul 2022 22:51:44 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 From: Jan Kiszka Subject: [PATCH] wic: bootimg-efi-isar: Add support for loading device tree files Content-Language: en-US To: isar-users Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-Path: jan.kiszka@siemens.com X-Originating-IP: [139.21.18.178] X-ClientProxiedBy: DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) To DEMCHDC89XA.ad011.siemens.net (139.25.226.103) X-TM-AS-Product-Ver: SMEX-14.0.0.3080-8.6.1018-26680.007 X-TM-AS-Result: No-10--15.768200-8.000000 X-TMASE-MatchedRID: 4hNj2i8ecmwZN8TODtwDNcwZf6suBkTqUriXxFmUkHxrIu4+N99FEX/0 yDqj7AyLRDL/jWAFbKX2fEQwNHKn0DG06h+EdezRbi9xEiKwEZciX7JWomr1HIKvnFrZK2Uhnl2 UEte7FZEvfU/riSJXkU6pgIbVd5REafrC0wghMNqVNHLO38io31ocitgq/alOU7GvsbOuBFABDy a2JbH/+pLIQKBXBt8kGKhkaAUN33OqqsCwzad2bGuxrifqNUT0wT/ZBeki4eY/ApMPW/xhXo5Ua fLmrvaGWXZfkVm7qxsg2AikADwu48mkz11dSnh5VcAulOmFtP/cobPXbxxYcW12v13Qb606Qonm LI1gY+n9oeSZAMlGVk8fY4SH/55sVKTJL0CItGqui0EVZK4raE1+zyfzlN7ygxsfzkNRlfLdB/C xWTRRu/558CedkGIvqcoAhihTwvgXmJebktkAIA== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--15.768200-8.000000 X-TMASE-Version: SMEX-14.0.0.3080-8.6.1018-26680.007 X-TM-SNTS-SMTP: 78BD258C00A47BB4F6D8160C0E234C1C643C328AF1691ECAA42D63D1959248B22000:8 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c01579f0-3785-4018-3d48-08da62b600d4 X-MS-TrafficTypeDiagnostic: DB8PR10MB3943:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7JkDhUkkCy/6SV6naqfWeo4HhgvzN38yU11tDvA6uQF7hxGf18u1i1waccultlB1qAq6QIo1fG51htOE6lfR7rsUI/3+AgEnTR6hSGRm++kK2MysrP1a7e2F38mhLHmTLoUwPfY831y0XLW4Rm9cKvRVDe54CpbQqkW+qoq0B/QZpB/ZPNxYwT0X4nE1TxuwojxtpBEwSHJNncMAKOl3bA/jjBuYf696PD7jCG/O9GnzY4a2CUCzC8fUOu+bSSTT6LxY7joI8zM+zf6PD+YKLJRWGB9aCoOks2chUHQ3TwuHPAOru2jpTf0UH/CNJOU7qeXgNELcH/p0r9w2wd1a9VLPuRyh0h4WOT72jvhmHxcwpSVycLWZz2f3B6BQxzMEuAYTd50qHCiD6h0bzgJI0ZfOlbiINrm2PjA1LhCyWtwu117hJ0PhYdhNvYxcm+V/CB+PlP6mrGCZa1dnaFTcVnwBOW/mpyxAIJJVX0K1ihhh00igPjuraDhghbohIcHJgLijZW+f+g7EOQGFHsZTl4N49OsYUt6tnXmALbfsfkV/ATo7/w/Mz3hIhGrz+7qYeu5V/7Hw85r0dm2mwDy8bJGIK0lvR1c6wxt2gqldREkc7P1TUET+lcQ0YnVuycWw2r35d0kZjRobMv+f1LIj8XKSfaiRNP0Z1TF8weiH+hcFkLVDbpakujWwJR7+x351gE9Lu/EV+3/vUqHWMXZiLWe0fSKKWm8kPBH8r+I7SoPNLzGUamXEQvGfMYt2vw8lA/RH/TWDBbxf+GnYWs36NIKUfuEdfe9aA9NJWMtam5nVDkDi6JCYLFD6qsi6EqxbnoWIHSl9S29FYNdpflhS3FG0qtU5WSkITq8tULXrXdwXtFjNUzEfOmCTnKz75rL2pDzKQCVFp1od3O4enLJazvKaRjxSDweWa4dGQgQh5/s= X-Forefront-Antispam-Report: CIP:194.138.21.73;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:hybrid.siemens.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230016)(4636009)(136003)(346002)(376002)(396003)(39860400002)(40470700004)(36840700001)(46966006)(478600001)(41300700001)(82310400005)(2906002)(40480700001)(6916009)(86362001)(31696002)(36756003)(8676002)(31686004)(26005)(70586007)(70206006)(16576012)(316002)(81166007)(83380400001)(956004)(2616005)(356005)(82960400001)(82740400003)(6706004)(8936002)(40460700003)(5660300002)(44832011)(336012)(47076005)(36860700001)(186003)(16526019)(3940600001)(43740500002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2022 20:51:46.3357 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c01579f0-3785-4018-3d48-08da62b600d4 X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38ae3bcd-9579-4fd4-adda-b42e1495d55a;Ip=[194.138.21.73];Helo=[hybrid.siemens.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR01FT102.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR10MB3943 X-TUID: ISHjI24Lhr8H From: Jan Kiszka For device tree using systems, add support to set a custom devices tree during UEFI boot. This requires to copy the DTB file to the boot partition and to add the respective loader entries to the configuration files. Both grub and systemd-boot support only loading a specific device tree. Therefore refuse to work if DTB_FILES contains more than one entry. This has been tested with grub from bullseye and systemd from bullseye-backport. The latter is needed as only systemd 250 gained the required feature. Out of scope are overlays (only supported by systemd-boot) as well as unified kernel images (practically broken on non-x86 with current toolchains). Signed-off-by: Jan Kiszka --- meta/classes/imagetypes_wic.bbclass | 2 +- .../wic/plugins/source/bootimg-efi-isar.py | 39 +++++++++++++------ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass index 61a74d4a..3a577f71 100644 --- a/meta/classes/imagetypes_wic.bbclass +++ b/meta/classes/imagetypes_wic.bbclass @@ -106,7 +106,7 @@ WICVARS += "\ ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH" # Isar specific vars used in our plugins -WICVARS += "DISTRO DISTRO_ARCH" +WICVARS += "DISTRO DISTRO_ARCH DTB_FILES" python do_rootfs_wicenv () { wicvars = d.getVar('WICVARS', True) diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py index a24e04f3..aff51e81 100644 --- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py +++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py @@ -58,13 +58,12 @@ class BootimgEFIPlugin(SourcePlugin): raise WicError("configfile is specified but failed to " "get it from %s." % configfile) - initrd = source_params.get('initrd') + bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") + if not bootimg_dir: + raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") + initrd = source_params.get('initrd') if initrd: - bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") - if not bootimg_dir: - raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") - initrds = initrd.split(';') for rd in initrds: cp_cmd = "cp %s/%s %s" % (bootimg_dir, rd, hdddir) @@ -72,6 +71,13 @@ class BootimgEFIPlugin(SourcePlugin): else: logger.debug("Ignoring missing initrd") + dtb_files = (get_bitbake_var("DTB_FILES") or '').split() + if dtb_files: + if len(dtb_files) > 1: + raise WicError("Only one DTB support in grub configuration, exiting") + cp_cmd = "cp %s/%s %s" % (bootimg_dir, dtb_files[0], hdddir) + exec_cmd(cp_cmd, True) + if not custom_cfg: # Create grub configuration using parameters from wks file bootloader = creator.ks.bootloader @@ -108,6 +114,9 @@ class BootimgEFIPlugin(SourcePlugin): grubefi_conf += " /%s" % rd grubefi_conf += "\n" + if dtb_files: + grubefi_conf += "devicetree /%s\n" % dtb_files[0] + grubefi_conf += "}\n" logger.debug("Writing grubefi config %s/hdd/boot/EFI/BOOT/grub.cfg", @@ -134,14 +143,12 @@ class BootimgEFIPlugin(SourcePlugin): loader_conf += "default boot\n" loader_conf += "timeout %d\n" % bootloader.timeout - initrd = source_params.get('initrd') + bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") + if not bootimg_dir: + raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") + initrd = source_params.get('initrd') if initrd and source_params.get('create-unified-kernel-image') != "true": - # obviously we need to have a common common deploy var - bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") - if not bootimg_dir: - raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") - initrds = initrd.split(';') for rd in initrds: cp_cmd = "cp %s/%s %s" % (bootimg_dir, rd, hdddir) @@ -149,6 +156,13 @@ class BootimgEFIPlugin(SourcePlugin): else: logger.debug("Ignoring missing initrd") + dtb_files = (get_bitbake_var("DTB_FILES") or '').split() + if dtb_files: + if len(dtb_files) > 1: + raise WicError("Only one DTB support in grub configuration, exiting") + cp_cmd = "cp %s/%s %s" % (bootimg_dir, dtb_files[0], hdddir) + exec_cmd(cp_cmd, True) + logger.debug("Writing systemd-boot config " "%s/hdd/boot/loader/loader.conf", cr_workdir) cfg = open("%s/hdd/boot/loader/loader.conf" % cr_workdir, "w") @@ -197,6 +211,9 @@ class BootimgEFIPlugin(SourcePlugin): for rd in initrds: boot_conf += "initrd /%s\n" % rd + if dtb_files: + boot_conf += "devicetree /%s\n" % dtb_files[0] + if source_params.get('create-unified-kernel-image') != "true": logger.debug("Writing systemd-boot config " "%s/hdd/boot/loader/entries/boot.conf", cr_workdir) -- 2.35.3