If the handoff files were generated on a Windows system, they will have
DOS line endings (CRLF).  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 `dos2unix` command to `copy_source()` to change the DOS
line endings (CRLF) to Unix line endings (LF).

Also output a message before running `unifdef` and fix the spelling of
"paths" in one of the other messages.

Signed-off-by: Ian Abbott <[email protected]>
---
v2: Corrected tabs in echoed output.
v3: Use dos2unix instead of sed, as suggested by Ahmed Fatoum.  Remove
    the corresponding echo command because dos2unix is verbose enough
    already!
---
 scripts/socfpga_import_preloader | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/socfpga_import_preloader b/scripts/socfpga_import_preloader
index bd54e1b913..fb8270f5d3 100755
--- a/scripts/socfpga_import_preloader
+++ b/scripts/socfpga_import_preloader
@@ -79,6 +79,9 @@ copy_source() {
 
        cp $src $tgt
 
+       dos2unix $tgt
+
+       echo "  Fixing conditional compilation..."
        unifdef -D HCX_COMPAT_MODE=1 -D ENABLE_INST_ROM_WRITE=1 $tgt -o $tgt
 
        echo "  Fixing extern/static keywords..."
@@ -99,7 +102,7 @@ copy_source() {
        sed -i 's/alt_8/int8_t/g' $tgt
        sed -i 's/#include "alt_types.h"//g' $tgt
 
-       echo "  Fixing include pathes..."
+       echo "  Fixing include paths..."
        # Fix include pathes
        sed -i 's/#include <iocsr_config_cyclone5.h>/#include 
<mach\/cyclone5-scan-manager.h>/g' $tgt
        sed -i 's/#include <pinmux_config.h>/#include <common.h>/g' $tgt
-- 
2.39.2


Reply via email to