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 24E40C4332F for ; Thu, 17 Nov 2022 05:01:27 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 96BEE851C1; Thu, 17 Nov 2022 06:01:25 +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="KpyA3zk8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8B6D0851C0; Thu, 17 Nov 2022 06:01:24 +0100 (CET) Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) (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 D934D851DF for ; Thu, 17 Nov 2022 06:01:21 +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-x735.google.com with SMTP id x18so501092qki.4 for ; Wed, 16 Nov 2022 21:01:21 -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=BDOeTFFwt8RzSwXN+umUuiRB18na5J7JfJEPHrZEq48=; b=KpyA3zk8WbzBr1ffRGmMfj4lIa6NUbYAdZbS70FeuxSevY3hNDrKumDBb71PMUcsQc Pun5fCZWdGtCia2i+bJu6YFHxEDqu6zZqQxJs77fyM1S2lBAUDJEg3IGTf9SdVBAhY6L tt1mWzkJ0VF3zLMarIbQiS1Uit15Mueqm3tgxM+gR13QRTpTp2JHdQScYLS1e8pGQ9ti hQYqUFf1Qqi3W3EloqB4PuFlBm/asAs5VYN2FoWucivifamXUkfejtvJfw+WesYgGACR UPxn8IcZefJtcEAdfck/s9oOwKYZVMXeCHM7l57CKwcN38fds1cHV6o1uwRterNosWWk DQKQ== 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=BDOeTFFwt8RzSwXN+umUuiRB18na5J7JfJEPHrZEq48=; b=Zbq5E89+GyyU9IkqUKMHYDxjROdgji5Bq0dMnl3LgYcSHQLyRTey8u8/1y38QYhTX0 SL4bdw18yDoUm2M04K6sWvanu+4XaprP+J6iKSB0Af4Lwo8so+9LG7eGQYk0Qu1IQNSY Ysf1FH42TPcec4T2QtuQ2ToJS6qYFVx5/4uHB1h8XmRzah8w29PlTb+nE059tFl6SkQL eqZeUSGelF3IDPfuftG6ssYwmGrd9BOumH+DeZ6jigEI5F3DI350QXqyuLNn1SsNhxub ymrdt64hh/2EYIc0WWEZH+YFbc4Sm+goZ69hlmxC7AwTX52Dlxlbu0+yM899EBq7pBu1 S/ZQ== X-Gm-Message-State: ANoB5pnj4cOJ4pwX9kxXafhoUZMnz5nxLjV3Ho4Y4opSTdU7jzgxlhLY 27agPzIT6yPMQz6F3Df6e46TqD5gOJ3yaQ== X-Google-Smtp-Source: AA0mqf6HeDxZI0aNfRo+gOyAWSD+Idr0hVmuBSn20a+yLUQsVJojD0x3HOMxgwRGaii94aVw8D/Ukw== X-Received: by 2002:a05:620a:1fa:b0:6ee:24d5:b8fc with SMTP id x26-20020a05620a01fa00b006ee24d5b8fcmr427494qkn.336.1668661280622; Wed, 16 Nov 2022 21:01:20 -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 u2-20020ac87502000000b0035cd6a4ba3csm9892697qtq.39.2022.11.16.21.01.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Nov 2022 21:01:20 -0800 (PST) Message-ID: <9180e35d-97ae-e8e3-52f8-fba8933220c4@gmail.com> Date: Thu, 17 Nov 2022 00:01:19 -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 v2 2/2] tools: mkimage: add new image type "flat_dt_legacy" Content-Language: en-US To: Marc Kleine-Budde , u-boot@lists.denx.de Cc: embedded@vivavis.com References: <20221031145121.236877-1-mkl@pengutronix.de> <20221031145121.236877-3-mkl@pengutronix.de> <20221116104938.bscob5tuzbtxff2o@pengutronix.de> From: Sean Anderson In-Reply-To: <20221116104938.bscob5tuzbtxff2o@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/16/22 05:49, Marc Kleine-Budde wrote: > On 31.10.2022 15:51:21, 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 "flat_dt_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 > > Sean, what about this approach compared to adding the new command line > parameter? > This is good. Maybe we should just name it fdt? --Sean >> --- >> 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 9f95b3260a80..9d7e57dee985 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_FLATDT_LEGACY, "flat_dt_legacy", "Flat Device Tree legacy Image", }, >> { -1, "", "", }, >> }; >> >> diff --git a/include/image.h b/include/image.h >> index d7d6a3fe5b81..e578e2c5f1fd 100644 >> --- a/include/image.h >> +++ b/include/image.h >> @@ -229,6 +229,7 @@ enum { >> 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_FLATDT_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..3b49f0d70e29 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_FLATDT_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_FLATDT_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); >> -- >> 2.35.1 >> >> >> >