[PATCH] binman: Add support for symlinking images

Simon Glass sjg at chromium.org
Tue Oct 11 01:49:00 CEST 2022


Hi Neha,

On Mon, 10 Oct 2022 at 05:07, Neha Malcom Francis <n-francis at ti.com> wrote:
>
> Adding support to symlink an image packaged using binman.
>
> Signed-off-by: Neha Malcom Francis <n-francis at ti.com>
> ---
>  tools/binman/image.py | 6 ++++++
>  1 file changed, 6 insertions(+)
>

This looks fine as a feature, but please add a test to ftest.py and see below.


> diff --git a/tools/binman/image.py b/tools/binman/image.py
> index afc4b4d643..191d121d88 100644
> --- a/tools/binman/image.py
> +++ b/tools/binman/image.py
> @@ -38,6 +38,7 @@ class Image(section.Entry_section):
>              repacked later
>          test_section_timeout: Use a zero timeout for section multi-threading
>              (for testing)
> +        symlink: Name of symlink to image
>
>      Args:
>          copy_to_orig: Copy offset/size to orig_offset/orig_size after reading
> @@ -97,6 +98,7 @@ class Image(section.Entry_section):
>          if filename:
>              self._filename = filename
>          self.allow_repack = fdt_util.GetBool(self._node, 'allow-repack')
> +        self._symlink = fdt_util.GetString(self._node, 'symlink')

Please update 'Image description format' in binman.rst to describe
your new feature.

>
>      @classmethod
>      def FromFile(cls, fname):
> @@ -181,6 +183,10 @@ class Image(section.Entry_section):
>              fd.write(data)
>          tout.info("Wrote %#x bytes" % len(data))
>
> +        # Create symlink to file if symlink given
> +        if self._symlink is not None:
> +            tools.Run('ln', '-sf', self._filename, self._symlink)

Can you use os.symlink() instead?

> +
>      def WriteMap(self):
>          """Write a map of the image to a .map file
>
> --
> 2.34.1
>

Regards,
Simon


More information about the U-Boot mailing list