[PATCH] tools: mkenvimage: Add pure shell implementation of mkenvimage
Marek Vasut
marex at denx.de
Sat Feb 8 22:26:04 CET 2025
On 2/7/25 8:40 AM, Alexander Dahl wrote:
> Hi Marek,
>
> had a short look on your script yesterday. Looks clean and well
> designed, nice job.
>
> Am Thu, Feb 06, 2025 at 09:38:58PM +0100 schrieb Marek Vasut:
>> On 2/6/25 1:38 PM, Simon Glass wrote:
>>> Hi Marek,
>>>
>>> On Wed, 5 Feb 2025 at 07:37, Marek Vasut <marex at denx.de> wrote:
>>>>
>>>> Add implementation of mkenvimage written purely in bourne shell.
>>>>
>>>> This is not a replacement for mkenvimage tool, but rather a simple
>>>> implementation which can be used in environments where mkenvimage
>>>> itself cannot be deployed due to various constraints, like hardware
>>>> manufacturing plants, but where bourne shell and basic tool are
>>>> already available.
>>>>
>>>> The external dependencies which are not shell built-ins are gzip
>>>> and grep.
>>>>
>>>> All mkenvimage parameters are implemented and compatible with the
>>>> C implementation of mkenvimage.
>>>>
>>>> Signed-off-by: Marek Vasut <marex at denx.de>
>>>> ---
>>>> Cc: Joe Hershberger <joe.hershberger at ni.com>
>>>> Cc: Tom Rini <trini at konsulko.com>
>>>> ---
>>>> tools/mkenvimage.sh | 126 ++++++++++++++++++++++++++++++++++++++++++++
>>>> 1 file changed, 126 insertions(+)
>>>> create mode 100755 tools/mkenvimage.sh
>>>
>>> Would it be worth adding a simple test for this?
>> Sure, is there an existing test for similar case I can look at ?
>
> I thought about testing yesterday, but had no good idea on top, but
> now it's discussed anyways … How about throwing the same input
> at the c and the sh version and assert the output is the same? For
> more sophisticated tests it should be tested with both variants.
I do have local shell script which does exactly that -- feed inputs into
both mkenvimage C and SH variants and compare the checksum of results.
More information about the U-Boot
mailing list