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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D63B7C77B75 for ; Tue, 23 May 2023 20:10:59 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9BB3985FF3; Tue, 23 May 2023 22:10:32 +0200 (CEST) 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="HzPQZV7U"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1B43A85DCE; Tue, 23 May 2023 21:28:07 +0200 (CEST) Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) (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 ACCBE846F3 for ; Tue, 23 May 2023 21:28:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=raymond.mao@linaro.org Received: by mail-qk1-x72a.google.com with SMTP id af79cd13be357-75b2a2bf757so15765485a.2 for ; Tue, 23 May 2023 12:28:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684870083; x=1687462083; 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=8lvz0AaxiVC8Ftza/UB89cfz8kKX7P83WAJNVHHy0jc=; b=HzPQZV7UxDkxaBGuMzPzcrQW3T74/tn+7uyE/rzDtU7KNjrrW/FVIkcTNJ2+TH2Z6Z YAOr188xmagymjhWpDUwXFn21UVuv10oWIB6zmFXjPwKiFk2oEj/gwK2r+xdvJjSwclh uciY5tgm0BjjyStFPyO6uWMjGVPJwHSgE5EyVHmyUGEDMVSCCoVukOTl+kdkVHwYat9g xmk0XrWktWqG5P4CJJtAmg9GlHRVSdKExrkpB76A+EPmJUsgrMaLWRwBdoV+zWe7X+zx byWD4wE7271xvd0xxVyuSDptNAq8VWukki4Pf4r0yj3taJH0DKL4gZ1lfgHMv5khYBuI qqVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684870083; x=1687462083; 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=8lvz0AaxiVC8Ftza/UB89cfz8kKX7P83WAJNVHHy0jc=; b=Pv/p2Om03AKEiwU/HlBMu58tj1IGbIAVbORIbllnjUzgVziH45XPnbjJNLe2zLfLc2 iRun6ERp6dh6LTM1OyeydZJ6eEeyWxetEl13zNt4Of03jAzeXgV2Q+ONZrDZZrg+G+uP f2qnsQpRL8BfFjkLAgmDUT8oPU9j12AkhkrgfJaD8JUDpRpg0fgW4rRbYTCNG5DDLv2j 51ID7FKfX3W3kHIsRzUvr5Wq0vnKBH+YdPUmov0c0zY78DedmFZjxEIDxd7TNzeU4c2T 6rPc8bC06vJUPRATw3RTUJ9dNUb0e8A+QCGrZ+GnVrlpkORZApXAapCAcNXQ4aqtS9eQ tuyw== X-Gm-Message-State: AC+VfDxab/XlSC2Hg+B+/vvKRyEApvET5ZJQ/LmToN1XseiWa1mYFY+Y BLLmjtxztW3fbsb0RfxDtuLPBV8bxPQCbLp4vzg= X-Google-Smtp-Source: ACHHUZ4PsTuUIKpS1NQ8VV9CkwHiuqMzk5X0yZVVXKuaYSru/94nb8lSiE+uE1fh6fFMTy+6FPJ3/w== X-Received: by 2002:a05:6214:cc7:b0:616:4da9:9aff with SMTP id 7-20020a0562140cc700b006164da99affmr29400126qvx.16.1684870083363; Tue, 23 May 2023 12:28:03 -0700 (PDT) Received: from ubuntu.localdomain (cpe688f2e182063-cm688f2e182060.sdns.net.rogers.com. [174.114.251.9]) by smtp.gmail.com with ESMTPSA id mn21-20020a0562145ed500b006212a3d8cc1sm3017921qvb.32.2023.05.23.12.28.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 12:28:03 -0700 (PDT) From: Raymond Mao To: u-boot@lists.denx.de Cc: Raymond Mao , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Masahisa Kojima Subject: [PATCH v4 3/3] Load option with short device path for boot vars Date: Tue, 23 May 2023 12:18:22 -0700 Message-Id: <20230523191819.80258-3-raymond.mao@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230523191819.80258-1-raymond.mao@linaro.org> References: <20230523191819.80258-1-raymond.mao@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Tue, 23 May 2023 22:10:27 +0200 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.8 at phobos.denx.de X-Virus-Status: Clean The boot variables automatically generated for removable medias should be with short form of device path without device nodes. This is a requirement for the case that a removable media is plugged into a different port but is still able to work with the existing boot variables. Signed-off-by: Raymond Mao --- Changes in v2 - Ignore EFI_NOT_FOUND returned from efi_bootmgr_update_media_device_boot_option which means no boot options scanned. Changes in v3 - Split the patch into moving and renaming functions and individual patches for each changed functionality Changes in v4 - Revert the change of introducing a bool parameter when updating the boot option. Use short-form of device path by default lib/efi_loader/efi_bootmgr.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c index c329428973..336b9d2d8f 100644 --- a/lib/efi_loader/efi_bootmgr.c +++ b/lib/efi_loader/efi_bootmgr.c @@ -387,6 +387,11 @@ static efi_status_t efi_bootmgr_enumerate_boot_option(struct eficonfig_media_boo p = dev_name; utf8_utf16_strncpy(&p, buf, strlen(buf)); + /* use short form device path */ + device_path = efi_dp_shorten(device_path); + if (!device_path) + continue; + lo.label = dev_name; lo.attributes = LOAD_OPTION_ACTIVE; lo.file_path = device_path; -- 2.25.1