Forum Discussion
Altera_Forum
Honored Contributor
21 years agoJust use the source supplied with the Windows "uClinux 2.6 Distribution for Nios II" posted in the forum.
Remove CRs from the source-files by using dos2unix or stripcr.c included at the end of this mail (have also included a script which calls this prog.). Build instructions: Installdir=/usr/local/nios2-gnutools (or whatever you want) Sourcedir contents: binutils gdb gcc make newlib Get rid of Cygwin inserted CRs: ./stripcr.sh In sourcedir do: [1] Binutils mkdir binutils-build cd binutils-build ../binutils/configure --target=nios2-elf --program-prefix=nios2-elf- --prefix=$Installdir --exec_prefix=$Installdir -v make all make install [2] GCC export PATH=$PATH:$Installdir mkdir gcc-build cd gcc-build ../gcc/configure --target=nios2-elf --program-prefix=nios2-elf- --prefix=$Installdir --exec_prefix=$Installdir --with-newlib --with-headers=../newlib/newlib/libc/include -v make all make install [3] Make mkdir make-build cd make-build ../make/configure --target=nios2-elf --program-prefix=nios2-elf- --prefix=$Installdir --exec_prefix=$Installdir -v make all make install [4] Newlib cp newlib/newlib/configure.host.normalc newlib/newlib/configure.host mkdir newlib-build cd newlib-build ../make/configure --target=nios2-elf --program-prefix=nios2-elf- --prefix=$Installdir --exec_prefix=$Installdir -v make all make install [5] GDB mkdir gdb-build cd gdb-build ../make/configure --target=nios2-elf --program-prefix=nios2-elf- --prefix=$Installdir --exec_prefix=$Installdir -v make all make install Hope this is helpful Regards Atle ---------------------------------------------- stripcr: ----------------------------------------------# include <stdio.h># include <string.h># include <errno.h> char strip_tmpfile[]="/tmp/stripCR.tmp"; int custom_copy (const char* in, const char* out, int stripCR); int main (argc, argv) int argc; char* argv[]; { int result; while (--argc > 0) { argv++; result = custom_copy (argv[0], strip_tmpfile, 1); if (result==1) { if (custom_copy (strip_tmpfile, argv[0], 0)) exit(-1); printf(" Stripping CR from file %s\n", argv[0]); }else { if (result!=0) exit(-1); } } return 0; } /* return value: 0: no strip, 1: file stripped, otherwise error */ int custom_copy (const char* in, const char* out, int stripCR) { FILE *ifp; /* input file pointer */ FILE *ofp; /* output file pointer */ char ch; int result=0; ifp = fopen (in, "rb"); ofp = fopen (out, "wb"); if (ifp == NULL) { printf ("Could not open %s for reading\n", in); return 0; } if (ofp == NULL) { printf ("Could not open %s for writing.\n", out); return -1; } while (!feof (ifp)) { if(fread ((void*) &ch, 1, 1, ifp)) { if (stripCR && (ch == (char) 0x0D)) { result=1; continue; } fwrite((void*) &ch, 1, 1, ofp); } } fclose (ifp); fclose (ofp); return result; } ------------------------------------------------------- stripcr.sh: -------------------------------------------------------# !/bin/bash# Strips CRs from all Makefiles and sourcefiles # stripcr binary STRIPCR=$PWD"/stripcr/stripcr" SRCDIR=$PWD"/src/" echo $PWD # Makefiles find $SRCDIR \( -name 'Makefile' -o -name 'Makefile.in' \) -exec $STRIPCR {} \; # Source files find $SRCDIR \( -name '*.c' -o -name '*.h' -o -name '*.S' \) -exec $STRIPCR {} \; # Linker scripts find $SRCDIR \( -name '*.ld' \) -exec $STRIPCR {} \; # Awk, sed and perl scripts find $SRCDIR \( -name '*.awk' -o -name '*.sed' -o -name '*.pl' \) -exec $STRIPCR {} \; # Config find $SRCDIR \( -name 'config.in' -o -name 'configure.in' -o -name 'configure' \) -exec $STRIPCR {} \; # Other find $SRCDIR \( -name '*.md' \) -exec $STRIPCR {} \;