[PATCH] scripts: socfpga_import_preloader: Translate DOS line endings

Ian Abbott abbotti at mev.co.uk
Thu Jun 15 08:49:59 PDT 2023


On 15/06/2023 14:55, Ian Abbott wrote:
> If the handoff files were generated on a Windows system, they will have
> DOS line endings.  The `indent` program (with the options used by the
> script) does a lousy job tidying up those files, leaving ASCII CR
> characters embedded in the lines.  This is particularly bad for array
> initializers that have one value per line, because they all end up on a
> single line with embedded ASCII CR characters between each value.
> 
> Add an initial `sed` command to `copy_source()` to match and remove an
> ASCII CR character from the end of each input line.
> 
> Also output a message before running `unifdef` and fix the spelling of
> "paths" in one of the other messages.
> 
> Signed-off-by: Ian Abbott <abbotti at mev.co.uk>
> ---
>   scripts/socfpga_import_preloader | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/socfpga_import_preloader b/scripts/socfpga_import_preloader
> index bd54e1b913..156382009e 100755
> --- a/scripts/socfpga_import_preloader
> +++ b/scripts/socfpga_import_preloader
> @@ -79,6 +79,10 @@ copy_source() {
>   
>   	cp $src $tgt
>   
> +	echo "  Translating DOS line endings..."
> +	sed -i "s/`echo -e '\r'`$//" $tgt
> +
> +	echo "  Fixing conditional compilation..."
>   	unifdef -D HCX_COMPAT_MODE=1 -D ENABLE_INST_ROM_WRITE=1 $tgt -o $tgt

I got the whitespace wrong in those "echo" commands. They should start 
with a TAB, not two spaces!

I'll send a 'v2' patch shortly.

-- 
-=( Ian Abbott <abbotti at mev.co.uk> || MEV Ltd. is a company  )=-
-=( registered in England & Wales.  Regd. number: 02862268.  )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-




More information about the barebox mailing list