nxp-imx / mfgtools

Freescale/NXP I.MX Chip image deploy tools.
BSD 3-Clause "New" or "Revised" License
523 stars 293 forks source link

FB:< with multi-line output script #413

Open vlahan opened 5 months ago

vlahan commented 5 months ago

Hi all,

it seems that at the moment the "PROTOCOL:<" construct (for using stdout as command source) works only with single-line output.

e.g. for test.sh

#!/bin/bash
echo "ucmd setenv env1 value1"
echo "ucmd setenv env2 value2"

FB:< sh -c "test.sh"

would only process the first command.

Adding multi-line / multi-command support for < (in which each output line is interpreted as separate command) would be extremely beneficial for production-time customization tasks.

Alternatively, it would be beneficial if the command line buffer is increased so one can use longer command concatenation chains like:

echo "ucmd setenv env1 value1 && setenv env2 value2 && ...

nxpfrankli commented 5 months ago

multi-line is good idea. let me check. command length limited by uboot fastboot. Standard fastboot define is 64byte

https://android.googlesource.com/platform/system/core/+/2ec418a4c98f6e8f95395456e1ad4c2956cac007/fastboot/fastboot_protocol.txt

  1. Host sends a command, which is an ascii string in a single   | packet no greater than 64 bytes.
vlahan commented 5 months ago

Thanks for the quick feedback!

Yes, it seems that the buffer extension is not possible, thus the support for multiple lines seems like the way to go here.