binman: Add support for symlinking images
PATCH 1/1 binman: Add support for symlinking images
Adding support to symlink an image packaged using binman.
--- tools/binman/image.py | 6 ++++++ 1 file changed, 6 insertions(+)
tools/binman/image.py +6 -0
@@ -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') @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) + def WriteMap(self): """Write a map of the image to a .map file
Signature · 1 line
2.34.1
Hi Neha,
Quoted 8 lines · Neha Malcom Francis
Adding support to symlink an image packaged using binman.
Signed-off-by Neha Malcom Francis <[email protected]>--- 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.
Quoted 13 lines
tools/binman/image.py +1
-0@@ -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
tools/binman/image.py class Image(section.Entry_section): · line 101
Quoted 4 lines
tools/binman/image.py +1
-0@@ -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.
tools/binman/image.py class Image(section.Entry_section): · line 188
Quoted 10 lines
tools/binman/image.py +3
-0@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?
Quoted 7 lines
tools/binman/image.py +1
-1+ def WriteMap(self): """Write a map of the image to a .map file --2.34.1
Regards,
Simon
Hi Simon,
Quoted 6 lines · Simon Glass
Hi Neha,
Quoted 3 lines · Neha Malcom Francis
Adding support to symlink an image packaged using binman.
Quoted 9 lines
Quoted 5 lines
Signed-off-by Neha Malcom Francis <[email protected]>--- tools/binman/image.py | 6 ++++++ 1 file changed, 6 insertions(+)This looks fine as a feature, but please add a test to
ftest.pyand see below.
Got it, will add a test.
Quoted 10 lines
Quoted 10 lines
tools/binman/image.py +1
-0@@ -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
Quoted 11 lines
tools/binman/image.py class Image(section.Entry_section): · line 101
Quoted 7 lines
tools/binman/image.py +1
-0Args: 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.rstto describe your new feature.
Will add that.
Quoted 7 lines
Quoted 7 lines
tools/binman/image.py +0
-0@classmethod def FromFile(cls, fname):@@ -181,6 +183,10 @@ class Image(section.Entry_section): fd.write(data) tout.info("Wrote %#x bytes" % len(data))
Quoted 6 lines
tools/binman/image.py class Image(section.Entry_section): · line 188
Quoted 3 lines
tools/binman/image.py +3
-0+ # 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?
Yes that will be better, agreed. Thanks!
Quoted 10 lines
Quoted 7 lines
tools/binman/image.py +1
-1+ def WriteMap(self): """Write a map of the image to a .map file --2.34.1
Regards,
Simon
Signature · 2 lines
Thanking You Neha Malcom Francis