[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7fdf869d-d2c8-4694-8f06-db1a32e817da@pengutronix.de>
Date: Wed, 26 Nov 2025 11:56:54 +0100
From: Ahmad Fatoum <a.fatoum@...gutronix.de>
To: Simon Glass <sjg@...omium.org>, linux-arm-kernel@...ts.infradead.org
Cc: Thomas Weißschuh <thomas.weissschuh@...utronix.de>,
Masahiro Yamada <masahiroy@...nel.org>, Tom Rini <trini@...sulko.com>,
J . Neuschäfer <j.ne@...teo.net>,
Chen-Yu Tsai <wenst@...omium.org>, Nicolas Schier <nsc@...nel.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 2/8] scripts/make_fit: Support an initial ramdisk
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 <sjg@...omium.org>
> Reviewed-by: Nicolas Schier <nsc@...nel.org>
With load address removed:
Reviewed-by: Ahmad Fatoum <a.fatoum@...gutronix.de>
> + 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 <pair: ramdisk; compressed), this should
also be set to “none”.
Thoughts?
> + 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 |
Powered by blists - more mailing lists