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 CA082C47088 for ; Thu, 24 Nov 2022 04:21:14 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E6B02855EC; Thu, 24 Nov 2022 05:21:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="JO3ttm1U"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BEFE8855EF; Thu, 24 Nov 2022 05:21:08 +0100 (CET) Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) (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 47F10855C2 for ; Thu, 24 Nov 2022 05:21:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=seanga2@gmail.com Received: by mail-qk1-x72c.google.com with SMTP id d7so364637qkk.3 for ; Wed, 23 Nov 2022 20:21:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=HhGu2LSpC3hQcB9Sdcu7pgCe2sVZYOO/tQ7tVcTDK4I=; b=JO3ttm1U1LRty2EMgx0kc4FGbwFHcz7dWqV4NsaNxRP8BGZmE7VV3bts1LjSYabq0S mXM+dB9apTgBdfn0PH+ILeyQwOa8fHf4d6a0ov2rHiIlnWIwe1NgJJDy4jIPYOeyfuZy zkJ7lhsGntNcpa0oKigxFRBdcxJPiJfg/LVgBNnP+jF9NRt8044XE/tIqAlz7sRsHp8d GqPAWS1T1ZaBb6F8IaOF+Zv6h3PCwVmflHKTkIDD3IA696d98xjW2p1NhkDK/VUPf9YV p1cXPNwdGS23Unw9w4O8HuO+9XG8+ZzhoKFqeAx/prJDLrKgRAHN6wr/YiUd/KXa9y3A +3yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HhGu2LSpC3hQcB9Sdcu7pgCe2sVZYOO/tQ7tVcTDK4I=; b=7tpiu5sucY0mejqICIs6UgFih5ltTeM4Qi8H6xatuGn+9QTFOynTUjeav2QtbC+tth INEE4ap+BeuvA2eSOkT3L7OroYmlgn4hmWkgOaWrByOxjAobtc267MWPGvDe9WgqXYxt PlgEVJiNjQOgSb29qEO07KIb0KwKm4ucl5NjuNrSCRgGIy7wBo2WisoKoEl4yHyYrGTP EjhdDQa/CT3J1d8UZKwo6lBPmlQqFUVORFHX7HmfOzEw0fzsOe1NYvZA/Su697sfsAZc x5h1SSSotI6slF4upDIxE5iP9UcoDzWMNB7leApds550KgAIwatMmPWYZl9aeUJ2L7Hw uh2A== X-Gm-Message-State: ANoB5pkEY0XOvGECezyJ9oy+MYU2MCyRfaAMOjd7vNX8o7PwYKv1RSHg ulYLv77MowU9wBT9tA3L0+pOol2Iagw= X-Google-Smtp-Source: AA0mqf6Fp77otCme42te1FaIfp3Df6uZVaepBfDgj6r2MKokxok/yWVxYrSgoov0YJSWnNYFuECaMQ== X-Received: by 2002:a37:5885:0:b0:6fa:1ef8:49dc with SMTP id m127-20020a375885000000b006fa1ef849dcmr27926934qkb.314.1669263663987; Wed, 23 Nov 2022 20:21:03 -0800 (PST) Received: from [192.168.1.201] (pool-173-73-95-180.washdc.fios.verizon.net. [173.73.95.180]) by smtp.gmail.com with ESMTPSA id r13-20020ae9d60d000000b006f9f714cb6asm224634qkk.50.2022.11.23.20.21.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Nov 2022 20:21:03 -0800 (PST) Message-ID: <2837445e-1f11-b8d9-089c-39d57f12cd33@gmail.com> Date: Wed, 23 Nov 2022 23:21:02 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v3 2/2] tools: mkimage: add new image type "fdt_legacy" Content-Language: en-US To: Marc Kleine-Budde , u-boot@lists.denx.de Cc: embedded@vivavis.com, Simon Glass References: <20221123115533.1276329-1-mkl@pengutronix.de> <20221123115533.1276329-3-mkl@pengutronix.de> From: Sean Anderson In-Reply-To: <20221123115533.1276329-3-mkl@pengutronix.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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.6 at phobos.denx.de X-Virus-Status: Clean On 11/23/22 06:55, Marc Kleine-Budde wrote: > If the user select the image type "flat_dt" a FIT image will be build. > This breaks the legacy use case of putting a Flat Device Tree into a > legacy u-boot image. > > Add a new image type "fdt_legacy" to build a legacy u-boot image > with a "flat_dt" type. > > Link: https://lore.kernel.org/all/20221028155205.ojw6tcso2fofgnhm@pengutronix.de > Signed-off-by: Marc Kleine-Budde > --- > boot/image.c | 1 + > include/image.h | 1 + > tools/default_image.c | 11 +++++++++-- > 3 files changed, 11 insertions(+), 2 deletions(-) > > diff --git a/boot/image.c b/boot/image.c > index b33d1dfc6b36..958dbf853474 100644 > --- a/boot/image.c > +++ b/boot/image.c > @@ -180,6 +180,7 @@ static const table_entry_t uimage_type[] = { > { IH_TYPE_COPRO, "copro", "Coprocessor Image"}, > { IH_TYPE_SUNXI_EGON, "sunxi_egon", "Allwinner eGON Boot Image" }, > { IH_TYPE_SUNXI_TOC0, "sunxi_toc0", "Allwinner TOC0 Boot Image" }, > + { IH_TYPE_FDT_LEGACY, "fdt_legacy", "legacy Image with Flat Device Tree ", }, > { -1, "", "", }, > }; > > diff --git a/include/image.h b/include/image.h > index 65d0d4f4387d..601bf85e3dcc 100644 > --- a/include/image.h > +++ b/include/image.h > @@ -229,6 +229,7 @@ enum image_type_t { > IH_TYPE_COPRO, /* Coprocessor Image for remoteproc*/ > IH_TYPE_SUNXI_EGON, /* Allwinner eGON Boot Image */ > IH_TYPE_SUNXI_TOC0, /* Allwinner TOC0 Boot Image */ > + IH_TYPE_FDT_LEGACY, /* Binary Flat Device Tree Blob in a Legacy Image */ > > IH_TYPE_COUNT, /* Number of image types */ > }; > diff --git a/tools/default_image.c b/tools/default_image.c > index 4a067e65862e..0ac3382003d5 100644 > --- a/tools/default_image.c > +++ b/tools/default_image.c > @@ -27,7 +27,8 @@ static struct legacy_img_hdr header; > static int image_check_image_types(uint8_t type) > { > if (((type > IH_TYPE_INVALID) && (type < IH_TYPE_FLATDT)) || > - (type == IH_TYPE_KERNEL_NOLOAD) || (type == IH_TYPE_FIRMWARE_IVT)) > + (type == IH_TYPE_KERNEL_NOLOAD) || (type == IH_TYPE_FIRMWARE_IVT) || > + (type == IH_TYPE_FDT_LEGACY)) > return EXIT_SUCCESS; > else > return EXIT_FAILURE; > @@ -94,6 +95,7 @@ static void image_set_header(void *ptr, struct stat *sbuf, int ifd, > uint32_t imagesize; > uint32_t ep; > uint32_t addr; > + int type; > struct legacy_img_hdr *hdr = (struct legacy_img_hdr *)ptr; > > checksum = crc32(0, > @@ -113,6 +115,11 @@ static void image_set_header(void *ptr, struct stat *sbuf, int ifd, > else > imagesize = sbuf->st_size - sizeof(struct legacy_img_hdr); > > + if (params->type == IH_TYPE_FDT_LEGACY) > + type = IH_TYPE_FLATDT; > + else > + type = params->type; > + > if (params->os == IH_OS_TEE) { > addr = optee_image_get_load_addr(hdr); > ep = optee_image_get_entry_point(hdr); > @@ -127,7 +134,7 @@ static void image_set_header(void *ptr, struct stat *sbuf, int ifd, > image_set_dcrc(hdr, checksum); > image_set_os(hdr, params->os); > image_set_arch(hdr, params->arch); > - image_set_type(hdr, params->type); > + image_set_type(hdr, type); > image_set_comp(hdr, params->comp); > > image_set_name(hdr, params->imagename); Reviewed-by: Sean Anderson