Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp223637lqs; Thu, 13 Jun 2024 08:22:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVBkKgExJFoXzvHb4Rly1aALWT8A5NsWDwPgJPggMA7vV9Lin0xHg/PLda+uje4NyUG271oURoHC3WqUnEMlfyXTLfOzFjtbSNPMEY0lg== X-Google-Smtp-Source: AGHT+IFXTRsnTdjicelnZqZZVIYcj2LJJ5Tv18dYZRyq3xpS9v+3nZLL6jm5BwH45GKxoiZ5bEc5 X-Received: by 2002:a05:690c:b9a:b0:631:4e00:2c06 with SMTP id 00721157ae682-6314e002c22mr17922927b3.2.1718292163007; Thu, 13 Jun 2024 08:22:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718292162; cv=pass; d=google.com; s=arc-20160816; b=Cw8rTu8PhPiIBZb7jhy7w0jr5egYwLuW73VG5oVuWluR7NHJ5s8yEH40Er0eSpCHQp a8PgD3lMh7NQfIsiNkYWrIFVYMY3dnjEpjWrjR8i+aTyyLE6HlNT0IhLeLxEyNfHW4VT tnItcfp+/YS8i+Zw+lonmHXjCMsElZzs+sszp+4VX5CNOnBj+T64UUk+H0Voyz5CBKsA tviFMp/D1ehXzPwuP6nURMzzYsOc0IriYPLDuRUKfoH3Etdpmr1iBaKCqSGTjkoPohRp TnLHFugdO9kbUoJktsQC8MSwD/9RgUKfrkecOv1xdl9OtlrJHT5YN/4W53kRLu8ixfEf sr0g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=c1FwXGbPrFXal5e1NPPyrNFtuM5Jb5Wk1WnrPz9CJ3g=; fh=9+OFN+qz6FTstRiA790dkfkRUQ7FDFlcDfexKsP/0D4=; b=xJGrF7tORQL72r3nTGXep9VQXBaxRMVH6zg5WiDTr7u08cUH3degzJinCHVeNmF/uu kUr0iGWG38wRyxwIL72AyyBen8YA9zRDW8gOfuZrtmDdSumD9hII2aZDvX9XNfRGnKQz F3wOAue8DJpMKAjxiNzwVJeC+aEcqEunEQ7GBEnT+yM8yUd4C4Aid/PxOA3aEtYxkPgA YOKmA+KFb/sqYaqwuZxFeCxfo07P3LfOzjpktX9/MhVpZksGyiMAAK2yecpv68K7cVZk 4p9Zx66eVgEu4wrmlTuicVdbOsiIU4vGI5QlEUDc6ZuZ7lRqYbVAgwulkShl2DZHTadg 2DUg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=d5sbq6c+; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-213529-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213529-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 71dfb90a1353d-4ed3f1f7ad3si344283e0c.53.2024.06.13.08.22.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 08:22:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213529-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=d5sbq6c+; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-213529-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213529-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A93351C225B0 for ; Thu, 13 Jun 2024 15:22:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9A6D21494D6; Thu, 13 Jun 2024 15:22:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="d5sbq6c+" Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4639713CF85 for ; Thu, 13 Jun 2024 15:22:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718292156; cv=none; b=ZEr+w73iC6xE7VBtVfILVv5jKW2UglIeTR9dAxNFjWkNjOQLr/9+IPBxqH3P4nVXr7n4ip9eSWkMJumpDEq79vGzkOba8kVO0LEmhJufZ/XbpCWp2KstqhZj8MffLajsvVddEtorWys5vX5Lr33vR5Qv3JgJdlFc3CrRIUIFOxo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718292156; c=relaxed/simple; bh=n4hXsXgUNly0dvZL2DEJYivRYjI1ORhlqA7s2/ruvis=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=oQiLQhVMLjmTg5Vx8vbQrMm9d+/bLmktefD+szVd0ty34LGJixE9rn7+GquKq+3fWVKS9952qKhYvIETpWvXfS2ViaPtMx6lO8+sz8F8ZItPyaM0ZbUlne0FqRRGx8KYGjxEwRmNEqOkpaPquJsvy10s32aXwNQUM4TWdELEU+Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=d5sbq6c+; arc=none smtp.client-ip=209.85.219.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-qv1-f47.google.com with SMTP id 6a1803df08f44-6b06e63d288so6120936d6.0 for ; Thu, 13 Jun 2024 08:22:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1718292154; x=1718896954; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=c1FwXGbPrFXal5e1NPPyrNFtuM5Jb5Wk1WnrPz9CJ3g=; b=d5sbq6c+Ln9ohEJetSbmbITgkXLfYXo3TH2XJiZv7uqd7Y48X+qrPgc5XVgeP4McGI wOi+I40pbwUij3Dx3JCuIKXF9LeDVhh+Qm0UN3wDucL343aTN8JNdn+58n2HgSgDEEVL d/hg1oppE/hIizHKJbA5+j8RBY+XHuhjF/gTc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718292154; x=1718896954; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=c1FwXGbPrFXal5e1NPPyrNFtuM5Jb5Wk1WnrPz9CJ3g=; b=MNalbOa8MIz1ZdazanTK2v0IFUmURp6oMWlAuvlBT3nQl6r1VqTkeA5UUaRnD2xS6T atNN5q6i9i8NA+Qxsa8+k7zFMkd5YW8+UryeR1WQhGKC5rVXzsFftd+YBMUlvTIOe3dL ryJcj+jrTyM+FTbQMLOMaxXy0DswXKi2PRMAhk5RE2fGzdyiW9+8ioioISu98iZzZlYs VpvJKXyFKIAr+YLla+uvNhYKTLCPh+JX1xFHUP/RW9afzWjmdGMMc9uP0mguPA99AZEE c6HE4aNqiXGp2sHwVEuq27io13ZlBzIMkUodBeoe6REeJiJEdOVzMEj4WJ5JuXVmqvDY SYtQ== X-Forwarded-Encrypted: i=1; AJvYcCUFez8WzNv48oMLiuyUJvHyTunPTYF+JkF1ZvhAYnBR0iW1y5W6Q92fRS1Cph0tshr3g6n0bV+kFcZQApuoRPbRauYKQQTH9mJnUePA X-Gm-Message-State: AOJu0YyvmoWrdXOXaVxQyCbtIRdQWxc9pwj72A8lOpf1TzO8brL2Jptj lRsxBwqimo6/Tl/iG0zu57bPelRCLO4mcuK23n5VuuCqjzkhUj6zjW8VPWi8rQC/++AWPwPIbqh Ne0s4loCMWe8es1swlMocE+jnepO3x3QLFM6u X-Received: by 2002:a05:6214:3a82:b0:6b0:74cf:676c with SMTP id 6a1803df08f44-6b1a77f12e4mr68951216d6.63.1718292154251; Thu, 13 Jun 2024 08:22:34 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240613093433.131699-1-wenst@chromium.org> In-Reply-To: <20240613093433.131699-1-wenst@chromium.org> From: Simon Glass Date: Thu, 13 Jun 2024 09:22:23 -0600 Message-ID: Subject: Re: [PATCH v2] scripts/make_fit: Support decomposing DTBs To: Chen-Yu Tsai Cc: Masahiro Yamada , Nathan Chancellor , Nicolas Schier , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Thu, 13 Jun 2024 at 03:34, Chen-Yu Tsai wrote: > > The kernel tree builds some "composite" DTBs, where the final DTB is the > result of applying one or more DTB overlays on top of a base DTB with > fdtoverlay. > > The FIT image specification already supports configurations having one > base DTB and overlays applied on top. It is then up to the bootloader to > apply said overlays and either use or pass on the final result. This > allows the FIT image builder to reuse the same FDT images for multiple > configurations, if such cases exist. > > The decomposition function depends on the kernel build system, reading > back the .cmd files for the to-be-packaged DTB files to check for the > fdtoverlay command being called. This will not work outside the kernel > tree. The function is off by default to keep compatibility with possible > existing users. > > To facilitate the decomposition and keep the code clean, the model and > compatitble string extraction have been moved out of the output_dtb > function. The FDT image description is replaced with the base file name > of the included image. > > Signed-off-by: Chen-Yu Tsai > --- > Changes since v1: > - Replace OrderedDict with standard {} dict > - Change short form command line argument to -D > - Drop [] around "'fdt-{x}\x00' for x in files" > - Add spaces around '+' in slice argument > - Split out DTB parsing into separate function > > Simon's reviewed-by was dropped. > > This is a feature I alluded to in my replies to Simon's original > submission of the make_fit.py script [1]. > > This is again made a runtime argument as not all firmware out there > that boot FIT images support applying overlays. Like my previous > submission for disabling compression for included FDT images, the > bootloader found in RK3399 and MT8173 Chromebooks do not support > applying overlays. Another case of this is U-boot shipped by development > board vendors in binary form (without upstream) in an image or in > SPI flash on the board that were built with OF_LIBFDT_OVERLAY=n. > These would fail to boot FIT images with DT overlays. One such > example is my Hummingboard Pulse. In these cases the firmware is > either not upgradable or very hard to upgrade. > > I believe there is value in supporting these cases. A common script > shipped with the kernel source that can be shared by distros means > the distro people don't have to reimplement this in their downstream > repos or meta-packages. For ChromeOS this means reducing the amount > of package code we have in shell script. > > [1] https://lore.kernel.org/linux-kbuild/20231207142723.GA3187877@google.com/ > > scripts/Makefile.lib | 1 + > scripts/make_fit.py | 86 ++++++++++++++++++++++++++++++++------------ > 2 files changed, 65 insertions(+), 22 deletions(-) Reviewed-by: Simon Glass