linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Simon Glass <sjg@chromium.org>, linux-arm-kernel@lists.infradead.org
Cc: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
	"Masahiro Yamada" <masahiroy@kernel.org>,
	"Tom Rini" <trini@konsulko.com>,
	"J . Neuschäfer" <j.ne@posteo.net>,
	"Chen-Yu Tsai" <wenst@chromium.org>,
	"Nicolas Schier" <nsc@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 2/8] scripts/make_fit: Support an initial ramdisk
Date: Wed, 26 Nov 2025 11:56:54 +0100	[thread overview]
Message-ID: <7fdf869d-d2c8-4694-8f06-db1a32e817da@pengutronix.de> (raw)
In-Reply-To: <20251119181333.991099-3-sjg@chromium.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 <sjg@chromium.org>
> Reviewed-by: Nicolas Schier <nsc@kernel.org>

With load address removed:

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.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 |



  reply	other threads:[~2025-11-26 10:57 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-19 18:13 [PATCH v6 0/8] scripts/make_fit: Support ramdisks and faster operations Simon Glass
2025-11-19 18:13 ` [PATCH v6 1/8] scripts/make_fit: Speed up operation Simon Glass
2025-11-26  9:24   ` Ahmad Fatoum
2025-12-02 10:28   ` Chen-Yu Tsai
2025-11-19 18:13 ` [PATCH v6 2/8] scripts/make_fit: Support an initial ramdisk Simon Glass
2025-11-26 10:56   ` Ahmad Fatoum [this message]
2025-11-19 18:13 ` [PATCH v6 3/8] scripts/make_fit: Move dtb processing into a function Simon Glass
2025-11-26 11:01   ` Ahmad Fatoum
2025-12-02 10:54   ` Chen-Yu Tsai
2025-11-19 18:13 ` [PATCH v6 4/8] scripts/make_fit: Provide a way to add built modules Simon Glass
2025-11-26 11:09   ` Ahmad Fatoum
2025-12-11 13:20     ` Simon Glass
2025-11-19 18:13 ` [PATCH v6 5/8] kbuild: Split out module targets into a variable Simon Glass
2025-11-19 20:20   ` Nicolas Schier
2025-11-26 11:10   ` Ahmad Fatoum
2025-11-19 18:13 ` [PATCH v6 6/8] kbuild: Allow adding modules into the FIT ramdisk Simon Glass
2025-11-19 20:20   ` Nicolas Schier
2025-11-20  7:49   ` Thomas Weißschuh
2025-11-20 20:09     ` Nicolas Schier
2025-11-25 21:58     ` Simon Glass
2025-11-26  7:16       ` Thomas Weißschuh
2025-11-26 11:26         ` Ahmad Fatoum
2025-12-02 10:31           ` Thomas Weißschuh
2025-12-11 13:31             ` Simon Glass
2025-12-11 13:49               ` Ahmad Fatoum
2025-11-19 18:13 ` [PATCH v6 7/8] scripts/make_fit: Support a few more parallel compressors Simon Glass
2025-12-02 10:17   ` Chen-Yu Tsai
2025-12-11 13:29     ` Simon Glass
2025-11-19 18:13 ` [PATCH v6 8/8] scripts/make_fit: Compress dtbs in parallel Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7fdf869d-d2c8-4694-8f06-db1a32e817da@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=j.ne@posteo.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nsc@kernel.org \
    --cc=sjg@chromium.org \
    --cc=thomas.weissschuh@linutronix.de \
    --cc=trini@konsulko.com \
    --cc=wenst@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).