From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8887A2EDD69 for ; Wed, 26 Nov 2025 10:57:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764154636; cv=none; b=WRKsrtCxm/QDxWLxmcTdsW7RCSw/25PhVLe9e5EhVawMTsuEfuTs681o0YNHCS/T0ho4JusWktoSu/1uYsnnLthPJS115Fmf2gHcK1SUT9oph5CDKvAhz02ahQlBQnbwBnVneMKeTq5QyMi/gkEL4jPPopv1zasKRI78D0GXuuA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764154636; c=relaxed/simple; bh=J3SfE4W/ZSd3GTe7BxSLVl/6f4lMnNQZFSaFYDAzwOQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=OLzXCgBUZMWTg35ww5Yago1uK8uM17EASwL3Jth0oy3ej8UuxLjhrp2Hv3JyZUN+cwvyBUX1O6Lh0vjndCPBPSyV95KWAAqWzFXaIIQAjlzw/tot5WmrmaMfHgz9j9Y6NPZo3lMsPEuz4RQLZfgmLzWeWtBZWOvAvLzhT8x4j1E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[127.0.0.1]) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1vODCg-0005W9-Dg; Wed, 26 Nov 2025 11:56:54 +0100 Message-ID: <7fdf869d-d2c8-4694-8f06-db1a32e817da@pengutronix.de> Date: Wed, 26 Nov 2025 11:56:54 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 2/8] scripts/make_fit: Support an initial ramdisk To: Simon Glass , linux-arm-kernel@lists.infradead.org Cc: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , Masahiro Yamada , Tom Rini , =?UTF-8?B?SiAuIE5ldXNjaMOkZmVy?= , Chen-Yu Tsai , Nicolas Schier , linux-kernel@vger.kernel.org References: <20251119181333.991099-1-sjg@chromium.org> <20251119181333.991099-3-sjg@chromium.org> Content-Language: en-US, de-DE, de-BE From: Ahmad Fatoum In-Reply-To: <20251119181333.991099-3-sjg@chromium.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: a.fatoum@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org On 11/19/25 7:13 PM, Simon Glass wrote: > FIT (Flat Image Tree) allows a ramdisk to be included in each > configuration. Add support for this to the script. > > This feature is not available via 'make image.fit' since the ramdisk > likely needs to be built separately anyway, e.g. using modules from > the kernel build. A later patch in this series provides support for > doing that. > > Note that the uncompressed size is not correct when a ramdisk is used, > since it is too expensive to decompress the ramdisk. > > Signed-off-by: Simon Glass > Reviewed-by: Nicolas Schier With load address removed: Reviewed-by: Ahmad Fatoum > + with fsw.add_node('ramdisk'):> + fsw.property_string('description', 'Ramdisk') > + fsw.property_string('type', 'ramdisk') > + fsw.property_string('arch', args.arch) > + fsw.property_string('os', args.os) > + fsw.property('data', data) The spec reads as if a compression = "none" is mandatory for ramdisks: If the data is compressed but it should not be uncompressed by the loader (e.g. compressed ramdisk + fsw.property_u32('load', 0) 0 is a valid SDRAM address on many SoCs. I think this should be dropped. > + > + > +def finish_fit(fsw, entries, has_ramdisk=False): > """Finish the FIT ready for use > > Writes the /configurations node and subnodes > @@ -143,6 +168,7 @@ def finish_fit(fsw, entries): > entries (list of tuple): List of configurations: > str: Description of model > str: Compatible stringlist > + has_ramdisk (bool): True if a ramdisk is included in the FIT > """ > fsw.end_node() > seq = 0 > @@ -154,6 +180,8 @@ def finish_fit(fsw, entries): > fsw.property_string('description', model) > fsw.property('fdt', bytes(''.join(f'fdt-{x}\x00' for x in files), "ascii")) > fsw.property_string('kernel', 'kernel') > + if has_ramdisk: > + fsw.property_string('ramdisk', 'ramdisk') > fsw.end_node() > > > @@ -274,6 +302,14 @@ def build_fit(args): > size += os.path.getsize(args.kernel) > write_kernel(fsw, comp_data, args) > > + # Handle the ramdisk if provided. Compression is not supported as it is > + # already compressed. > + if args.ramdisk: > + with open(args.ramdisk, 'rb') as inf: > + data = inf.read() > + size += len(data) > + write_ramdisk(fsw, data, args) > + > for fname in args.dtbs: > # Ignore non-DTB (*.dtb) files > if os.path.splitext(fname)[1] != '.dtb': > @@ -296,12 +332,12 @@ def build_fit(args): > > entries.append([model, compat, files_seq]) > > - finish_fit(fsw, entries) > + finish_fit(fsw, entries, bool(args.ramdisk)) > > # Include the kernel itself in the returned file count > fdt = fsw.as_fdt() > fdt.pack() > - return fdt.as_bytearray(), seq + 1, size > + return fdt.as_bytearray(), seq + 1 + bool(args.ramdisk), size > > > def run_make_fit(): -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |