From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE645C433F5 for ; Fri, 5 Nov 2021 09:35:23 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 11C0361268 for ; Fri, 5 Nov 2021 09:35:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 11C0361268 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 836948356D; Fri, 5 Nov 2021 10:35:20 +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="E/K4BLLg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4A2BD83686; Fri, 5 Nov 2021 10:35:19 +0100 (CET) Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) (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 AED988344C for ; Fri, 5 Nov 2021 10:35:14 +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-pg1-x52a.google.com with SMTP id p17so7929859pgj.2 for ; Fri, 05 Nov 2021 02:35:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=sYCYOl+sI50zVJwiIg01HCxwhwnv71Bn9kFX4bBX2xM=; b=E/K4BLLgotF2CuG5V3m8mFJ26zXN4EneWjb8aJGg/3TCJr23BRbYzrPdhTrZEhc0NB /m0rbjzNLQ40TLKMtgGWfohFKSE+4NbpqfFFi6Mw/DLYAxk/AeJ4kxc3zJLkSSdVzoyJ sYS9Hu7tdKm3WSzjGXDg3nO713ue4AUHTmcte389D2XuEHWKS0M1yU8Jh2Yg9X9I56aW D7cs63Z6ZIWzSdZkyLC3f/wly2ctDnZXuLeYPM5KUR1yblbXxCCjrNKZg6kTbcbqZwde zH76nBnxYjx3HE2QLxZYzJTCW2CwaLjelpw6bTSMMoKbaHCtnBNm0feYaFf5LHXBZFO8 vkgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to; bh=sYCYOl+sI50zVJwiIg01HCxwhwnv71Bn9kFX4bBX2xM=; b=E9Fhpvn6x22JXhwxCPFH/dVSCynKEzLuHkj+3yMY96jmesY5AI6D6CvLhC4ax4WYlp wn4kVK9Lq4LpllkUZSLkonScmDyygXu5pD3OjjQrEhGRjPXa266iE7tzPLA8n5uhTUf1 1U0w3EcTUGWbWJB8tS9OHDCBhfZPWaU0RctPJv4FXTkw/OK8igwpa/nFg0smD+KpHCWF Q/+prtS0H4bySU+2FWjdYKWq/6KTjUCKAXAHrY6YStZUWvpfk0ih0Mx7onAX2IdVXgPY wO2Q/3U0/WhyZNjV8hIFbgckmn9FAfF3m7Z9sPWMukmR8aShLBgCSAo+NZ1EKiLOtQFP wgrg== X-Gm-Message-State: AOAM532ov7lksNORtfPioDEW5LDRuQ5EJwv8pgw/iV22NWqZPfXZgFlG 10IMl4F1HVoep4de+sxg4WiO/g== X-Google-Smtp-Source: ABdhPJz3B4WnxDD0+LXi3TJ4KTxhpeS8uzm1yxnzLz5qvndxqUoz2ppYjBW0x6O/PzbadsRxWWaT8w== X-Received: by 2002:a63:81c7:: with SMTP id t190mr19005411pgd.292.1636104912894; Fri, 05 Nov 2021 02:35:12 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:844c:5534:2811:8a4d]) by smtp.gmail.com with ESMTPSA id d20sm7519533pfl.173.2021.11.05.02.35.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Nov 2021 02:35:12 -0700 (PDT) Date: Fri, 5 Nov 2021 18:35:08 +0900 From: AKASHI Takahiro To: Simon Glass , Mark Kettenis , xypron.glpk@gmx.de, agraf@csgraf.de, ilias.apalodimas@linaro.org, sughosh.ganu@linaro.org, masami.hiramatsu@linaro.org, u-boot@lists.denx.de Subject: Re: [PATCH v5 02/11] tools: mkeficapsule: add firmwware image signing Message-ID: <20211105093508.GH27316@laputa> Mail-Followup-To: AKASHI Takahiro , Simon Glass , Mark Kettenis , xypron.glpk@gmx.de, agraf@csgraf.de, ilias.apalodimas@linaro.org, sughosh.ganu@linaro.org, masami.hiramatsu@linaro.org, u-boot@lists.denx.de References: <20211029045628.GA33977@laputa> <20211105010433.GA27316@laputa> <20211105023500.GC27316@laputa> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211105023500.GC27316@laputa> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean On Fri, Nov 05, 2021 at 11:35:00AM +0900, AKASHI Takahiro wrote: > On Thu, Nov 04, 2021 at 08:02:40PM -0600, Simon Glass wrote: > > Hi Takahiro, > > > > On Thu, 4 Nov 2021 at 19:04, AKASHI Takahiro wrote: > > > > > > Hi, Simon, > > > > > > On Thu, Nov 04, 2021 at 09:11:59AM -0600, Simon Glass wrote: > > > > Hi Mark, > > > > > > > > On Thu, 4 Nov 2021 at 08:31, Mark Kettenis wrote: > > > > > > > > > > > From: Simon Glass > > > > > > Date: Wed, 3 Nov 2021 20:51:25 -0600 > > > > > > > > > > > > Hi Mark, > > > > > > > > > > > > On Tue, 2 Nov 2021 at 09:13, Mark Kettenis wrote: > > > > > > > > > > > > > > > From: Simon Glass > > > > > > > > Date: Tue, 2 Nov 2021 08:56:50 -0600 > > > > > > > > > > > > > > > > Hi Takahiro, > > > > > > > > > > > > > > > > > > - can we just build the tool always? > > > > > > > > > > > > > > > > > > This is one of my questions. > > > > > > > > > Why do you want to do so while there are bunch of tools that are > > > > > > > > > not always built. > > > > > > > > > > > > > > > > Because I think all tools should be built always. It is fine if that > > > > > > > > happens due to CONFIG options but we should try to avoid making it > > > > > > > > complicated. > > > > > > > > > > > > > > Well, unless this patchset fixes things, we can't, because > > > > > > > mkeficapsule doesn't build on OpenBSD. I tried looking into it, but I > > > > > > > can't figure out how this is even supposed to compile as a host tool: > > > > > > > > > > > > > > > > > > > > > In file included from tools/mkeficapsule.c:8: > > > > > > > In file included from include/malloc.h:369: > > > > > > > include/linux/string.h:15:24: error: conflicting types for 'strspn' > > > > > > > extern __kernel_size_t strspn(const char *,const char *); > > > > > > > ^ > > > > > > > /usr/include/string.h:88:9: note: previous declaration is here > > > > > > > size_t strspn(const char *, const char *); > > > > > > > > > > > > My guess is that linux/string.h should not be included, or perhaps > > > > > > __kernel_size_t should be defined to size_t. > > > > > > > > > > > > I doubt it would take an age to figure out, with a bit of fiddling. > > > > > > > > > > Well, I think the problem is quite fundamental. Indeed I agree that > > > > > linux/string.h shouldn't be included. It gets pulled in because the > > > > > tools include . Modern software really shouldn't include > > > > > that header anymore, and we removed it in OpenBSD some time ago. But > > > > > even with that fixed, things break since the same header gets pulled > > > > > in from . > > > > > > > > > > Redefining __kernel_size_t doesn't provide a way out: > > > > > > > > > > tools/mkeficapsule.c:23:16: error: typedef redefinition with different types ('size_t' (aka 'unsigned long') vs 'unsigned int') > > > > > typedef size_t __kernel_size_t; > > > > > ^ > > > > > ./arch/arm/include/asm/posix_types.h:37:23: note: previous definition is here > > > > > typedef unsigned int __kernel_size_t; > > > > > ^ > > > > > > > > > > This is on an amd64 host, so "unsigned int" clearly is the wrong type > > > > > for size_t. > > > > > > > > > > The fundamental problem seems to be that isn't safe to include > > > > > in a "host" tool because it includes "target" headers that > > > > > accidentally resolve to "system" headers on Linux systems. > > > > > > > > > > Maybe Takahiro or Heinrich have an idea how to fix that? But in the > > > > > meantime it would be good if building this tool would remain optional. > > > > > > > > Yes let's ask them to fix that as I agree this sounds wrong. We have > > > > several efi headers so perhaps just need to have the right stuff in > > > > each. > > > > > > As far as I know, you initially introduced efi.h and efi_api.h. > > > What is your intent to have the two? > > > > > > I think that efi_api.h contains definitions and interfaces defined > > > in UEFI specification for building EFI application/modules, hence > > > I believe that it should be target-independent. Right? > > > > > > But it *includes* efi.h which also contains some definitions > > > defined in UEFI specification, while efi.h is only for U-Boot as > > > UEFI application. > > > > > > I suspect that is the root cause. > > > > Yes I think you are right. > > > > > Or should we thoroughly use linux headers like "efi/efi.h" > > > in this tool? > > > > Well either way, we need host builds to not include U-Boot headers. > > Yeah, but there are still lots of host tools which include U-Boot headers. > In addition, I'm not quite sure whether *generic* efi headers, like > efi/efi.h, are available across different host OSs. I looked through linux's efi headers under /usr/include/efi, but they don't provide enough set of definitions to make mkeficapsule buildable. Particularly, capsule-related structure definitions are missing. So modifying U-Boot headers and removing target-dependent coding would be more practical. (I don't know yet whether it is feasible or not.) Or even adding host-tools-local headers would be more optimal. -Takahiro Akashi > -Takahiro Akashi > > > > > - Simon > > > > > > > > -Takahiro Akashi > > > > > > > > > > It is OK to have it optional with a CONFIG, but it should be enabled > > > > by default, otherwise no one will know it is there. > > > > > > > > Can we get the OpenBSD environment into CI or is that just too hard? > > > > > > > > Regards, > > > > Simon