From patchwork Wed Feb 9 10:10:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 541092 Delivered-To: patch@linaro.org Received: by 2002:ad5:420f:0:0:0:0:0 with SMTP id e15csp1208635imo; Wed, 9 Feb 2022 02:13:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJz7CwQzcZ3MwWjHTDvaqBBlm1ojde4JlyaBVSdhA9mQm6xuH0X6gaQjTHsM15E71FXrCDmS X-Received: by 2002:a17:907:9689:: with SMTP id hd9mr1272666ejc.240.1644401605506; Wed, 09 Feb 2022 02:13:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644401605; cv=none; d=google.com; s=arc-20160816; b=kUldMRuCd6i0K5VFLl4NF5yB1NAJ9+bwOeYyRG7oiCHl3mdm3K26mFV2P46K49X+nH FacuFhkXqibd99gYid6Q0hErXul/dgCkqIrt1QyRNHLCIgEEj8XljimpbIIZrpLtnu2f kCzHhjrhDGMCclpJss5nwtooCiad1mJlO+fsz4skE+SZMwKFJHUUFSfkg099n4yu/TJz eaOCut6cyuXhHRXLvMsRNpe0AdHXN+PqcLD0VpHfpIh/by3AQsLiy8b0nO5TK6J/dzpY OmrWeV1y0qbDz2VrQpIWmJXy2yS1HLYoIxjMgfkTBrwK9nSbrZNasIOVLlaGX8mdDOrg r4og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=37b4CbGVq2vXfUQd07BoRyvPsjDtxkfVdV+ImREOVoM=; b=ONsSGXazbuHJZZx2AVd6bGcri+1781GhQSUVdU0U1t8HFTCmpQq0nbSOCKC+u37OJF cx+RQaurgYchmDjG3oHvSNQd0B4StAzNsIodJ1lLGsO0aFDZT2DOkiVm7nVL2SKr25L0 ieRQ4P+SaYNrxxeL9HkQ2RVyJjHlilhXSQ9InXTxCgYZmx0zimkmUfMLzB9K7Jezm7uq KHWS7Edv+sxnZTq6YUU5h1Qjuhm0NgEc7QpqRBxWKwIrqOvZlf+mxcgud1FKXuG/Txh/ 44wAOW193TicuiWWZL0F0fhy03sc8u05YWAkd7DfCVYlu4EILzyvkgbhF1Uu0hr//WLt XSqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EilEImLS; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id hp5si12177223ejc.435.2022.02.09.02.13.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 02:13:25 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EilEImLS; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DBF3083E3C; Wed, 9 Feb 2022 11:12:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="EilEImLS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 155DF83E1D; Wed, 9 Feb 2022 11:12:03 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5171E83E4E for ; Wed, 9 Feb 2022 11:11:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pf1-x432.google.com with SMTP id i21so1925963pfd.13 for ; Wed, 09 Feb 2022 02:11:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=37b4CbGVq2vXfUQd07BoRyvPsjDtxkfVdV+ImREOVoM=; b=EilEImLSg8+QV3WM8+oPHvkF/MTWTYiN6P5FpElhe8RuX2bd1mfA+fy9+wLoE3WDHr /e54L4dpuCXay9zKpk5n07LtRjyWCPvk/2RHT0aTyUUz1VQlwTVLF6Km2B98sUPmb53j /rUJCvSS6+IJFLSuVqwzvSddBL3FQXYavQrMDOLuJyA/cqc+sV0ot2fNPZMPLn1jbY5f GIaiNHNfmHIFZ8GeORAdD47mpnz1CYVePEZVJuZInyxjUvJxkDl/M0tfwD7MPlmF8Ksf WKXOVs85CASVKBW6+jeE2bnUDsyP/h6/MdT7GtAWE9McvcsAP6ECP29O27KlErLDBrJm 1JMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=37b4CbGVq2vXfUQd07BoRyvPsjDtxkfVdV+ImREOVoM=; b=MIJ66UWAQqMUiTJExYO0UBcKdJNXbvoQBnesiYEmSyqIBJRTIPPB1FkYReUP5sjzv7 BEh0icY4QmW5zCyLrmMFvjrJocwTtQXXnC6qBkA3thFx2S8wNFtJkx9an01QsmYk0ll9 g72aTsR64uUp0V/f5hMVAGESGAP0MQC/Zwfw1ziL11KXiphuW4UtgoSxrgAAmw7fPXwe 62oZpE6CfHHeRCgZ0VHxs+R/4DFbdcmsv5VfpTDauGkjhukgO4cYkXHdOMz9ygOAwUT7 WSF0VRK8YpTujFXOAGVHwPtvmbjspJcdvip+rETQx9HPUmbX1y4p+aAxRmy4N/rBVLqN aULQ== X-Gm-Message-State: AOAM530mCxNJdHZHCCrRdQS7vYAe6A9ONCNkx543C97ujJWCfT4C4xlb 10eJ0t0SHoWtdiqLK/MkbocfCA== X-Received: by 2002:a63:1266:: with SMTP id 38mr1291607pgs.261.1644401509724; Wed, 09 Feb 2022 02:11:49 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c3e1:100:d885:543e:bfe4:9eb5]) by smtp.gmail.com with ESMTPSA id mi18sm5143303pjb.35.2022.02.09.02.11.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 02:11:49 -0800 (PST) From: AKASHI Takahiro To: xypron.glpk@gmx.de Cc: sjg@chromium.org, ilias.apalodimas@linaro.org, sughosh.ganu@linaro.org, masami.hiramatsu@linaro.org, mark.kettenis@xs4all.nl, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v11 8/9] test/py: efi_capsule: add a test for "--guid" option Date: Wed, 9 Feb 2022 19:10:41 +0900 Message-Id: <20220209101042.78036-9-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220209101042.78036-1-takahiro.akashi@linaro.org> References: <20220209101042.78036-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean This test scenario tests a new feature of mkeficapsule, "--guid" option, which allows us to specify FMP driver's guid explicitly at the command line. Signed-off-by: AKASHI Takahiro --- test/py/tests/test_efi_capsule/conftest.py | 3 + .../test_efi_capsule/test_capsule_firmware.py | 67 +++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/test/py/tests/test_efi_capsule/conftest.py b/test/py/tests/test_efi_capsule/conftest.py index a5a25c53dcb4..9076087a12b7 100644 --- a/test/py/tests/test_efi_capsule/conftest.py +++ b/test/py/tests/test_efi_capsule/conftest.py @@ -86,6 +86,9 @@ def efi_capsule_data(request, u_boot_config): check_call('cd %s; %s/tools/mkeficapsule --index 1 --raw u-boot.bin.new Test02' % (data_dir, u_boot_config.build_dir), shell=True) + check_call('cd %s; %s/tools/mkeficapsule --index 1 --guid E2BB9C06-70E9-4B14-97A3-5A7913176E3F u-boot.bin.new Test03' % + (data_dir, u_boot_config.build_dir), + shell=True) if capsule_auth_enabled: # firmware signed with proper key check_call('cd %s; ' diff --git a/test/py/tests/test_efi_capsule/test_capsule_firmware.py b/test/py/tests/test_efi_capsule/test_capsule_firmware.py index 9eeaae27d626..9cc973560fa1 100644 --- a/test/py/tests/test_efi_capsule/test_capsule_firmware.py +++ b/test/py/tests/test_efi_capsule/test_capsule_firmware.py @@ -247,3 +247,70 @@ class TestEfiCapsuleFirmwareFit(object): 'sf read 4000000 100000 10', 'md.b 4000000 10']) assert 'u-boot:New' in ''.join(output) + + def test_efi_capsule_fw4( + self, u_boot_config, u_boot_console, efi_capsule_data): + """ + Test Case 4 - Test "--guid" option of mkeficapsule + The test scenario is the same as Case 3. + """ + disk_img = efi_capsule_data + with u_boot_console.log.section('Test Case 4-a, before reboot'): + output = u_boot_console.run_command_list([ + 'host bind 0 %s' % disk_img, + 'efidebug boot add -b 1 TEST host 0:1 /helloworld.efi -s ""', + 'efidebug boot order 1', + 'env set -e -nv -bs -rt OsIndications =0x0000000000000004', + 'env set dfu_alt_info "sf 0:0=u-boot-bin raw 0x100000 0x50000;u-boot-env raw 0x150000 0x200000"', + 'env save']) + + # initialize content + output = u_boot_console.run_command_list([ + 'sf probe 0:0', + 'fatload host 0:1 4000000 %s/u-boot.bin.old' % CAPSULE_DATA_DIR, + 'sf write 4000000 100000 10', + 'sf read 5000000 100000 10', + 'md.b 5000000 10']) + assert 'Old' in ''.join(output) + + # place a capsule file + output = u_boot_console.run_command_list([ + 'fatload host 0:1 4000000 %s/Test03' % CAPSULE_DATA_DIR, + 'fatwrite host 0:1 4000000 %s/Test03 $filesize' % CAPSULE_INSTALL_DIR, + 'fatls host 0:1 %s' % CAPSULE_INSTALL_DIR]) + assert 'Test03' in ''.join(output) + + # reboot + u_boot_console.restart_uboot() + + capsule_early = u_boot_config.buildconfig.get( + 'config_efi_capsule_on_disk_early') + with u_boot_console.log.section('Test Case 4-b, after reboot'): + if not capsule_early: + # make sure that dfu_alt_info exists even persistent variables + # are not available. + output = u_boot_console.run_command_list([ + 'env set dfu_alt_info "sf 0:0=u-boot-bin raw 0x100000 0x50000;u-boot-env raw 0x150000 0x200000"', + 'host bind 0 %s' % disk_img, + 'fatls host 0:1 %s' % CAPSULE_INSTALL_DIR]) + assert 'Test03' in ''.join(output) + + # need to run uefi command to initiate capsule handling + output = u_boot_console.run_command( + 'env print -e Capsule0000') + + output = u_boot_console.run_command_list(['efidebug capsule esrt']) + + # ensure that EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID is in the ESRT. + assert 'E2BB9C06-70E9-4B14-97A3-5A7913176E3F' in ''.join(output) + + output = u_boot_console.run_command_list([ + 'host bind 0 %s' % disk_img, + 'fatls host 0:1 %s' % CAPSULE_INSTALL_DIR]) + assert 'Test03' not in ''.join(output) + + output = u_boot_console.run_command_list([ + 'sf probe 0:0', + 'sf read 4000000 100000 10', + 'md.b 4000000 10']) + assert 'u-boot:New' in ''.join(output)