Declare du_flush_pipe in or1200_top
[openrisc.git] / toolchain_install_scripts / MOF_ORSOC_TCHN_v5c_or32-elf.sh
blob1b44cde0747fff622fb78b4c12a3a036f5b581bf
1 #!/bin/bash
3 # Copyright (C) 2008,2009,2010 www.meansoffreedom.org, www.orsoc.se
4 # This file is free software; you can redistribute it and/or modify it
5 # under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 ##Date: 11/03/2010
19 ##Title: MOF_ORSOC_TCN_v5c_or32-elf.sh
20 ##Purpose: Complete Toolchain Builder from MOF & ORSoC.
21 ##initial rgd, mse
22 ##updated jb
24 #Changelog
25 # 090306 - jb
26 # - added exit code checking after each make and patch
27 # - changed download method to instead generate a script and run it in
28 # kermit (requiring single ftp logon per host)
29 # 090309 - jb
30 # - changed download of GNU tools so they occurr from the GNU.org ftp
31 # (except binutils-2.18.50, it's not there)
32 # - changed download of Linux kernel so it's now from ftp.kernel.org
33 # - changed patch for binutils (fixes gcc-4.3.2 compilation problem
34 # caused by non-string literals in printf)
35 # - changed or1ksim version from 0.3.0rc2 to 0.3.0
36 # - changed Linux kernel version from 2.6.19 to 2.6.24
37 # - changed Linux kernel patch version for this new kernel version
38 # generated new patch for Linux kernel, based on one from MOF
39 # (www.meansoffreedom.net) which contains a more complete config file.
40 # removing need for user input during "make oldconfig"
41 # - changed organisation so that all the packages are not copied into
42 # the build directory before they are extracted, instead it's done
43 # from where they are.
44 # - changed gdb-6.8 patch version due to stricter gcc-4.3.2 checking
45 # return types.
46 # - included better or1ksim config file in Linux sources patch, now
47 # named "or1ksim_linux.cfg"
48 # 100309 - jb
49 # - changed back to wget for file retrieval
50 # - changed introduction readme
51 # - changed install destination checking and setup
52 # - added md5sum checking of any existing downloaded files, removing
53 # need for redownloading things every time
54 # - added debug build mode - run script with -d at command line
55 # note: not everything in this mode has been tested, may not work
56 # in certain combinations!
57 # 120309 - jb
58 # - New OS X version - busybox doesn't work (removed from script),
59 # nor does ors1ksim (compiles but segfaults somewhere during test).
60 # 140309 - Added ability to change target name. Included some sed commands to
61 # change or32-uclinux to whatever $TARGET is set to in some scripts
62 # (mainly for uClibc install, the are set at configure time)
63 # 160309 - (v5a) Replaced busybox sources in download list (removed for OS X
64 # version and forgot to replace it when running on Linux again.)
65 # 270309 - Changed the declaration of the check_exit_code function to be without
66 # the preceeding "function" as this isn't valid in sh, and the new way
67 # appears to be valid in bash.
68 # - Changed the link in the error output to the new OpenCores forum.
69 # 210409 - Changed linux kernel and uClibc patch versions to latest
70 # - Changed output to all be piped to appropriate files, makes things neater
71 # 260409 - Added Cygwin exports section
72 # - Hopefully now runs on Cygwin with new patch for uClibc
73 # 300409 - New Binutils patch - fixes objdump instruction decode issue
74 # 110509 - (v5c) Put in check for required build tools before building
75 # 260509 - Changed gcc's package download to gcc-core as we only use the
76 # c-language compiler and libraries right now.
77 # 030609 - Fixed odd problem with uClibc build on latest Cygwin where it tried
78 # to run the INSTALL script file instead of the systems install binary
79 # by adding a suffix to the text file.
80 # 290609 - Changed linux patch to 2.3 - is a patch derived from revision 42 of
81 # OpenRISC repository's kernel.
82 # 301109 - Changed GCC patch to one with single precision floating point as
83 # default
84 # 021209 - Added --disable-werror flag to gdb-6.8 configure line to fix issue
85 # with gcc-4.4.1
86 # 110310 - Moved or1ksim to its own directory in the chosen install directory
87 # 140310 - Fixed problem with mkdir command
88 # 140310 - Fixed ncurses header checking
89 # 010410 - Fixed ncurses header checking on Cygwin (added -I path to gcc cmd)
90 # 270610 - Updated or1ksim version to 0.4.0
92 # TODO: OS X build things - need an "elf.h" from some Linux machine's
93 # /usr/local/include dir and put in Mac's /usr/local/include dir -
94 # this solves issue with Linux compilation
95 # TODO: OS X build things - add HOST_LOADLIBES="lintl" to make line of uClibc
96 # TODO: OS X build things - must remove the -Werror line in $GDB_VER/gdb/Makefile,
97 # sed command:
98 # sed 's/WERROR\_CFLAGS\ \=\ \-Werror/WERROR\_CFLAGS\ \=/' $GDB_VER/gdb/Makefile
99 # Can also just change the gdb-6.8/gdb/Makefile.in and remove the Werror= thing
100 # TODO: OS X build things - or1ksim, in or1ksim-0.3.0/peripheral/atadevice.c, it
101 # includes byteswap.h - actually it's abstract.h that defines #LE_16() bswap_16(),
102 # so in abstract.h we put in defines for bswap_16 as
103 # #define bswap_16(value) ((((value) & 0xff) << 8) | ((value) >> 8))
104 # TODO: OS X Build things - or1ksim strndup.c, in or1k-0.3.0/port/strndup.c strndup function,
105 # types not exist etc. Need to include sys/types.h and string.h to this file to fix
106 # a few problems.
107 # TODO: OS X build things - or1ksim - or1ksim-0.3.0/sim-cmd.c passes one of our functions
108 # to a readline function, rl_event_hook, but this is not defined in the OS X (BSD)
109 # readline package, so the GNU readline package must be used.
110 # TODO: OS X build things - or1ksim segfaults when run for some reason.
112 ## A function we'll call throughout the setup process to check if the previous
113 ## command finished without error
114 check_exit_code()
116 if [ $? -ne 0 ]
117 then
118 echo
119 echo "############################ERROR#############################"
120 echo
121 echo "Error during toolchain installation."
122 echo
123 echo "Please report this to the script maintainers."
124 echo
125 echo "A useful report would contain information such as the tool"
126 echo "being built/\"make\"d when the error occurred and the relevant"
127 echo "lines of console output or log file relating to the error. It"
128 echo "also helps to include information about your the host OS and"
129 echo "version of GCC."
130 echo "A good place to look for solutions, and report any bugs, is at"
131 echo "the OpenRISC project's bug tracker on OpenCores.org:"
132 echo
133 echo " http://opencores.org/openrisc,bugtracker"
134 echo
135 exit $?
139 REQUIRED_TOOL_LIST="
140 make
141 patch
144 bzip2
145 wget
146 makeinfo
148 header_check() {
149 # Compile a simple program, including the header we're checking for
150 echo "#include <$1.h>" > header_check.c
151 echo "int main () { return 0; }" >> header_check.c
152 gcc header_check.c -I/usr/include/$1
155 check_essential_build_tools()
158 echo "#########################Checking for required build tools######################"
159 echo
160 for TOOL in $REQUIRED_TOOL_LIST
162 echo -n "Checking for $TOOL "
163 WHICHTOOL=`which $TOOL`
164 echo "$WHICHTOOL"
165 if [ -z $WHICHTOOL ]
166 then
167 echo
168 echo "\t$TOOL not found"
169 echo
170 echo "Please install $TOOL and re-run this script"
171 echo
172 exit 2
174 done
176 echo "Checking for libncurses-dev (headers)"
177 header_check "ncurses"
178 # Now check the return value of that function
179 if [ $? -ne 0 ]; then
180 echo
181 echo "\tlibncurses-dev not found"
182 echo ; echo "Please install libncurses-dev and re-run this script"; echo
183 rm -f header_check.c a.out
184 exit 2
186 rm -f header_check.c a.out
188 # Todo: somehow inform the user that if we're checking for makeinfo they need to install texinfo package
189 echo
192 ## SCRIPT VERSION ##
193 SCRIPT_VERSION="v5c"
195 ## Beginning globals ##
197 ## ORSoC FTP download settings ##
198 ORSOC_FTP_HOST="opencores.org"
199 ORSOC_FTP_USER="ocuser"
200 ORSOC_FTP_PASSWD="oc"
201 ORSOC_FTP_DIR="toolchain"
203 ## GNU FTP download settings ##
204 GNU_FTP_HOST="ftp.gnu.org"
205 GNU_FTP_USER="anonymous"
206 #GNU_FTP_BINUTILS_DIR="gnu/binutils"
207 GNU_FTP_GCC_DIR="gnu/gcc/gcc-4.2.2"
208 GNU_FTP_GDB_DIR="gnu/gdb"
210 ## Linux kernel download settings ##
211 KERNEL_FTP_HOST="ftp.kernel.org"
212 KERNEL_FTP_USER="anonymous"
213 KERNEL_FTP_PASSWD="anonymous"
214 KERNEL_FTP_DIR="pub/linux/kernel/v2.6"
216 ## Local directory variables ##
217 START_DIR=`pwd`
218 DN="n"
219 DIR=`pwd`
221 ## Makedir command we'll use ##
222 MKDIR='mkdir -p'
223 ## Versions of the toolchain components ##
224 BINUTILS_VER=binutils-2.18.50
225 GCC_VER_NUM=4.2.2
226 GCC_VER=gcc-$GCC_VER_NUM
227 GDB_VER=gdb-6.8
228 UCLIB_VER=uClibc-0.9.29
229 LINUX_VER=linux-2.6.24
230 BUSY_VER=busybox-1.7.5
231 SIM_VER=or1ksim-0.4.0
233 ## Patches ##
234 BINUTILS_PATCH="$BINUTILS_VER.or32_fixed_patch-v2.1.bz2"
235 GCC_PATCH=$GCC_VER-or32-fp.patch.bz2
236 LINUX_PATCH="linux_2.6.24_or32_unified_v2.3.bz2"
237 UCLIBC_PATCH="uClibc-0.9.29-or32-patch-1.1.bz2"
238 GDB_PATCH="or32-gdb-6.8-patch-2.4.bz2"
240 ## MD5sum file ##
241 MD5SUM_FILE=md5sums
243 ## Configs ##
244 #CONFIG1="rgd_uc_29dotconfig" ## Now changed to rgd_uc_29v5dotconfig as it uses paths to the 2.6.24 kernel ##
245 CONFIG1="rgd_uc_29v5dotconfig"
246 CONFIG2="rgd_bb_1.75dotconfig"
248 ## Ramdisk name ##
249 RAMDISK_FILE=initrd-fb-03.ext2.last.work.1.7.5
250 LINUX_RAMDISK_FILE=arch/or32/support/initrd-fb-03.ext2 ## The location and name of the ramdisk that Linux wants when it compiles
252 ## Toolchain prefix ##
253 TARGET=or32-elf
256 ## Tarballs ##
257 ZBALL1=$BINUTILS_VER.tar.bz2
258 TBALL1=$BINUTILS_VER.tar
259 ZBALL2=gcc-core-$GCC_VER_NUM.tar.bz2
260 TBALL2=$GCC_VER.tar
261 ZBALL3=$UCLIB_VER.tar.bz2
262 TBALL3=$UCLIB_VER.tar
263 ZBALL4=$LINUX_VER.tar.bz2
264 TBALL4=$LINUX_VER.tar
265 ZBALL5=$BUSY_VER.tar.bz2
266 TBALL5=$BUSY_VER.tar
267 ZBALL6=$SIM_VER.tar.bz2
268 TBALL6=$SIM_VER.tar
269 ZBALL7=$RAMDISK_FILE.bz2
270 ZBALL8=$GDB_VER.tar.bz2
271 TBALL8=$GDB_VER.tar
273 ORSOC_FTP_FILE_LIST="$ZBALL1
274 $ZBALL3
275 $ZBALL5
276 $ZBALL6
277 $ZBALL7
278 $BINUTILS_PATCH
279 $GCC_PATCH
280 $LINUX_PATCH
281 $UCLIBC_PATCH
282 $GDB_PATCH
283 $CONFIG1
284 $CONFIG2"
286 GNU_FTP_FILE_LIST="$ZBALL2
287 $ZBALL8"
289 KERNEL_FTP_FILE_LIST=$ZBALL4
293 ## Check if we've been given the debug mode flag ##
294 ## We won't clear away all the directories if run with the -d or -D options ##
295 DBG_BUILD=0
296 while getopts d OPT; do
297 case "$OPT" in
299 DBG_BUILD=1
301 esac
302 done
304 ##Welcome message
305 echo
306 echo "The OpenRISC toolchain install script - Provided by ORSoC & MeansOfFreedom.net"
307 echo "Version $SCRIPT_VERSION"
308 echo
309 echo "#####################################README#####################################"
310 echo
311 echo "This script will install tools required for development on the OpenRISC platform"
312 echo "This version ($SCRIPT_VERSION) includes: "
313 echo " $GCC_VER, $BINUTILS_VER, $UCLIB_VER"
314 echo " $LINUX_VER, $GDB_VER, $BUSY_VER and $SIM_VER"
315 echo
316 echo "Please follow the prompts to select the install location."
317 echo
318 echo "Note: Two new directories, or32-build and or32-download, will be created in the"
319 echo "current directory for storing downloaded files and building the tools."
320 echo "Also: This script attempts to mount a ramdisk image in a local directory to copy"
321 echo "in the freshly built busybox. This requires root user privileges - if they are"
322 echo "not deteceted the existing busybox binaries will remain in the ramdisk image."
323 echo
324 echo "#####################################README#####################################"
325 echo
327 echo "Install the toolchain under current directory?"
328 echo "Current directory: [$DIR]"
329 echo "Tools will be installed in [$DIR/$TARGET]"
330 echo [Y/n]:
331 read YN
334 ## $YN will be zero length string if user just pressed enter ##
335 if [ -z $YN ]
336 then
337 VAL="y"
338 else
339 VAL=$(echo $YN | tr [:upper:] [:lower:])
342 if [ $VAL = "n" ]
343 then
344 # Optional install path
345 echo "Enter the path the toolchain will be installed in:"
346 read DIR
348 # Check if the path exists and ask the user to verify it
349 until [ $DN = "y" ]
352 #Check the path exists
353 if [ -d $DIR ]
354 then
355 # The path entered is OK
356 echo "Chosen directory is [$DIR]"
357 echo "Tools will be installed in [$DIR/$TARGET], or1ksim in [$DIR/or1ksim]"
358 echo "[y/n]:"
359 read DN
361 if [ -z $DN ]
362 then
363 # Presume yes here
364 DN="y"
367 VAL=$(echo $DN | tr [:upper:] [:lower:])
368 else
369 echo
370 #echo "Path does not exist. Please create it and ensure user has correct permissions."
371 echo "Path does not exist. Create $DIR now?"
372 echo "[y/N]:"
373 read MKPATH
374 if [ -z $MKPATH ]
375 then
376 ## $MKPATH was zero, so user probably just pressed enter without entering anything, which we'll interpret as "n" ##
377 MKPATHYN="n"
378 else
379 MKPATHYN=$(echo $MKPATH | tr [:upper:] [:lower:])
382 if [ $MKPATHYN = "y" ]
383 then
384 `mkdir -p $DIR`
386 # Check we made it successfully
387 if [ $? -ne 0 ]
388 then
389 DN="n"
390 else
391 DN="x" # Set this so we do go back through and ask the user to verify
394 else
395 DN="n"
399 if [ $DN = "n" ]
400 then
401 echo "Enter the path the toolchain should be installed in:"
402 read DIR
405 done
406 cd $DIR
407 # echo "loop done"
408 # echo "Working in " `pwd`
411 ## Now check that the required tools to build the toolchain are installed
412 check_essential_build_tools
414 BUILD_TOP=$START_DIR/or32-build
415 export BUILD_TOP
417 ## Set donload directory to be under the current directory ##
418 DOWNLOAD_DIR=$START_DIR/or32-download
420 ## Setup the target tool installation directory ##
421 INSTALL_DIR=$DIR
423 $MKDIR $INSTALL_DIR
425 ####################################################################################################
426 ## Now check which sources have already been downloaded, if any ##
427 DO_DOWNLOADS="y" ## Default is to NOT do downloads
429 if [ $DBG_BUILD -eq 1 ]
430 then
431 ## Ask if we should do downloads ##
432 echo "Do downloads?"
433 echo "[y/N]:"
434 read DO_DOWNLOADS
435 ## $YN will be zero length string if user just pressed enter ##
436 if [ -z $DO_DOWNLOADS ]
437 then
438 DO_DOWNLOADS="n"
439 else
440 DO_DOWNLOADS=$(echo $DO_DOWNLOADS | tr [:upper:] [:lower:])
445 if [ $DO_DOWNLOADS = "y" ]
446 then
447 ## Check if download directory exists, if not create it ##
448 if [ ! -d $DOWNLOAD_DIR ]; then
449 $MKDIR $DOWNLOAD_DIR
452 cd $DOWNLOAD_DIR
454 ## We'll need the md5sum file ##
455 ## This is a file stored on the ORSoC FTP server, containing checksums of all the files we need ##
456 rm -f $MD5SUM_FILE
457 wget ftp://$ORSOC_FTP_USER:$ORSOC_FTP_PASSWD@$ORSOC_FTP_HOST/$ORSOC_FTP_DIR/$MD5SUM_FILE
458 ## Make sure we got that OK ##
459 check_exit_code
461 ## We have lists of what to get from each FTP let's create a loop for each ##
463 ## ORSoC FTP server downloads ##
464 for CURRENT_FILE in $ORSOC_FTP_FILE_LIST
466 # Check if we've already got the file
467 if [ -e $CURRENT_FILE ]
468 then
469 echo "File $CURRENT_FILE exists locally."
470 echo "Verifying MD5 checksum:"
471 ## Verify it's right by checking the MD5 checksum ##
472 ## First we get the line for $CURRENT_FILE out of the $MD5SUM_FILE, then feed it to "md5sum -c"
473 ## which checks it and sets the return code, $? to 0 if OK, 1 if problem ##
474 cat $MD5SUM_FILE | grep $CURRENT_FILE | md5sum -c
475 if [ $? -ne 0 ]
476 then
477 #MD5sum of $CURRENT_FILE differs from expected value - we'll download it again
478 echo "MD5 checksum of $CURRENT_FILE differs from expected value. Re-downloading."
479 rm -f $CURRENT_FILE
480 wget ftp://$ORSOC_FTP_USER:$ORSOC_FTP_PASSWD@$ORSOC_FTP_HOST/$ORSOC_FTP_DIR/$CURRENT_FILE
481 check_exit_code
483 else
484 # File doesn't exist locally - we'll download it
485 echo "Downloading $CURRENT_FILE"
486 wget ftp://$ORSOC_FTP_USER:$ORSOC_FTP_PASSWD@$ORSOC_FTP_HOST/$ORSOC_FTP_DIR/$CURRENT_FILE
487 check_exit_code
489 echo
490 done
492 ## GNU FTP server downloads ##
493 for CURRENT_FILE in $GNU_FTP_FILE_LIST
495 ## Check if we've already got the file ##
496 if [ -e $CURRENT_FILE ]
497 then
498 echo "File $CURRENT_FILE exists locally."
499 echo "Verifying MD5 checksum:"
500 ## Verify it's right by checking the MD5 checksum ##
501 ## First we get the line for $CURRENT_FILE out of the $MD5SUM_FILE, then feed it to "md5sum -c"
502 ## which checks it and sets the return code, $? to 0 if OK, 1 if problem ##
503 cat $MD5SUM_FILE | grep $CURRENT_FILE | md5sum -c
504 if [ $? -ne 0 ]
505 then
506 ## MD5sum of present one is incorrect - we'll download it again ##
507 echo "MD5 checksum of $CURRENT_FILE differs from expected value. Re-downloading."
508 rm -f $CURRENT_FILE
509 ## Depending on the file, we need a specific path ##
510 ## gcc's path on ftp ##
511 if [ $CURRENT_FILE = $ZBALL2 ]; then
512 GNU_FTP_DIR=$GNU_FTP_GCC_DIR
514 ## gdb's path on ftp ##
515 if [ $CURRENT_FILE = $ZBALL8 ]; then
516 GNU_FTP_DIR=$GNU_FTP_GDB_DIR
518 wget ftp://$GNU_FTP_USER:$GNU_FTP_USER@$GNU_FTP_HOST/$GNU_FTP_DIR/$CURRENT_FILE
519 check_exit_code
521 else
522 # File doesn't exist - we'll download it
523 echo "Downloading $CURRENT_FILE"
524 ## Depending on the file, we need a specific path ##
525 ## gcc's path on ftp ##
526 if [ $CURRENT_FILE = $ZBALL2 ]; then
527 GNU_FTP_DIR=$GNU_FTP_GCC_DIR
529 ## gdb's path on ftp ##
530 if [ $CURRENT_FILE = $ZBALL8 ]; then
531 GNU_FTP_DIR=$GNU_FTP_GDB_DIR
533 wget ftp://$GNU_FTP_USER:$GNU_FTP_USER@$GNU_FTP_HOST/$GNU_FTP_DIR/$CURRENT_FILE
534 check_exit_code
536 echo
537 done
539 ## Kernel.org FTP server downloads ##
540 CURRENT_FILE=$KERNEL_FTP_FILE_LIST
541 ## Usually just a single file from the kernel.org ftp site ##
542 if [ -e $CURRENT_FILE ]
543 then
544 echo "File $CURRENT_FILE exists locally."
545 echo "Verifying MD5 checksum:"
546 ## Verify it's right by checking the MD5 checksum ##
547 ## First we get the line for $CURRENT_FILE out of the $MD5SUM_FILE, then feed it to "md5sum -c"
548 ## which checks it and sets the return code, $? to 0 if OK, 1 if problem ##
549 cat $MD5SUM_FILE | grep $CURRENT_FILE | md5sum -c
550 if [ $? -ne 0 ]
551 then
552 #MD5sum of present one is incorrect - we'll download it again
553 echo "MD5 checksum of $CURRENT_FILE differs from expected value. Re-downloading."
554 rm -f $CURRENT_FILE
555 wget ftp://$KERNEL_FTP_USER:$KERNEL_FTP_USER@$KERNEL_FTP_HOST/$KERNEL_FTP_DIR/$CURRENT_FILE
556 check_exit_code
558 else
559 ## Download it ##
560 echo "Downloading $CURRENT_FILE"
561 wget ftp://$KERNEL_FTP_USER:$KERNEL_FTP_PASSWD@$KERNEL_FTP_HOST/$KERNEL_FTP_DIR/$CURRENT_FILE
562 check_exit_code
565 echo
566 fi # if [ $DO_DOWNLOADS = "y" ]
568 ####################################################################################################
570 ## Cygwin exports ##
571 ON_CYGWIN=`set | grep -i mach|grep -i -c cygwin`
572 if [ $ON_CYGWIN -ge 1 ]
573 then
574 echo
575 echo "Cygwin host detected"
576 echo "Platform specific exports:"
577 echo "export HOST_LOADLIBES=\"-lcurses -lintl\" "
578 echo
579 export ON_CYGWIN=1
580 export HOST_LOADLIBES="-lcurses -lintl"
583 ####################################################################################################
585 cd $START_DIR
587 ## if not debug building, let's remove all the old stuff ##
589 if [ $DBG_BUILD -eq 0 ]
590 then
591 ## Always start with a clean build dir ##
592 rm -fr $BUILD_TOP
593 $MKDIR $BUILD_TOP
594 chmod 777 $BUILD_TOP
596 $MKDIR $BUILD_TOP/b-gcc
597 $MKDIR $BUILD_TOP/b-b
600 ## default build option is yes ##
601 BUILD_THIS="y"
603 if [ $DBG_BUILD -eq 1 ]
604 then
605 ## Ask if we should build binutils ##
606 echo "Re-build $BINUTILS_VER ?"
607 echo "[y/N]:"
608 read YN
609 ## $YN will be zero length string if user just pressed enter ##
610 if [ -z $YN ]
611 then
612 BUILD_THIS="n"
613 else
614 BUILD_THIS=$(echo $YN | tr [:upper:] [:lower:])
617 if [ $BUILD_THIS = "y" ]
618 then
619 ## Delete and recreate the binutils directory ##
620 rm -rf $BUILD_TOP/b-b
621 rm -rf $BUILD_TOP/$BINUTILS_VER
622 $MKDIR $BUILD_TOP/b-b
627 ##########################Building Binutils#######################
628 if [ $BUILD_THIS = "y" ]
629 then
631 echo "############################## Building binutils ###############################"
632 echo
633 echo "Decompressing source"
634 cd $BUILD_TOP
636 ## Extract sources ##
637 tar xjf $DOWNLOAD_DIR/$ZBALL1
639 echo
640 echo "Patching binutils with $BINUTILS_PATCH"
642 cd $BINUTILS_VER
644 bzip2 -dc $DOWNLOAD_DIR/$BINUTILS_PATCH | patch -p1 > $BINUTILS_VER-patch.log 2>&1
646 ## Make sure that patched ok ##
647 check_exit_code
649 cd ..
650 cd $BUILD_TOP/b-b
652 echo
653 echo "Configuring $BINUTILS_VER: --target=$TARGET --prefix=$INSTALL_DIR/$TARGET --disable-checking"
654 echo "Logging output to $BINUTILS_VER-configure.log"
655 $BUILD_TOP/$BINUTILS_VER/configure --target=$TARGET --prefix=$INSTALL_DIR/$TARGET --disable-checking > $BINUTILS_VER-configure.log 2>&1
657 echo
658 echo "Making and installing $BINUTILS_VER"
659 echo "Logging output to $BINUTILS_VER-make.log "
660 make all install > $BINUTILS_VER-make.log 2>&1
662 ## Make sure that built ok ##
663 check_exit_code
665 cd $BUILD_TOP
668 #######################Finish Building Binutils#####################
670 ## Export the path to the new or32 binaries directory, used by the rest of this script ##
671 echo
672 echo "Adding $INSTALL_DIR/$TARGET/bin to the PATH variable"
673 export PATH=$INSTALL_DIR/$TARGET/bin:$PATH
675 ## default build option is yes ##
676 BUILD_THIS="y"
678 if [ $DBG_BUILD -eq 1 ]
679 then
680 ## Ask if we should do the initial builds of GCC and Linux ##
681 echo "Re-do initial $GCC_VER and $LINUX_VER builds (note if you choose to do this then it's EXTREMELY likely that you will have to do the rest of the script, particularly the re-build of gcc that occurs later)?"
682 echo "[y/N]:"
683 read YN
684 ## $YN will be zero length string if user just pressed enter ##
685 if [ -z $YN ]
686 then
687 BUILD_THIS="n" # default is no
688 else
689 BUILD_THIS=$(echo $YN | tr [:upper:] [:lower:])
692 if [ $BUILD_THIS = "y" ]
693 then
694 ## Delete and recreate the gcc directory ##
695 rm -rf $BUILD_TOP/b-gcc
696 rm -rf $BUILD_TOP/$GCC_VER
697 rm -rf $BUILD_TOP/$LINUX_VER
699 $MKDIR $BUILD_TOP/b-gcc
701 ## Undo everything done in the next part
702 rm -rf $INSTALL_DIR/$TARGET/include
703 unlink $INSTALL_DIR/$TARGET/sys-include
708 ##########################Building GCC and Linux############################
709 if [ $BUILD_THIS = "y" ]
710 then
712 echo
713 echo "####################### Building or32 gcc and Linux ############################"
714 echo
715 echo "Decompressing source"
717 cd $BUILD_TOP
719 ## Extract sources ##
720 tar xjf $DOWNLOAD_DIR/$ZBALL2 ## gcc sources ##
722 tar xjf $DOWNLOAD_DIR/$ZBALL4 ## Linux kernel sources ##
724 echo
725 echo "Patching $LINUX_VER with patch file $LINUX_PATCH"
727 cd $LINUX_VER
729 ## Apply patch to linux kernel sources ##
730 bzip2 -dc $DOWNLOAD_DIR/$LINUX_PATCH | patch -p1 > $LINUX_VER-patch.log 2>&1
732 ## Make sure that patched ok ##
733 check_exit_code
734 ## Copy our preconfigured configuration file into place ##
735 cp rgd_dot_config .config
737 echo
738 echo "Making Linux oldconfig"
740 make oldconfig > $LINUX_VER-make-oldconfig.log 2>&1
742 ## Make sure that built ok ##
743 check_exit_code
745 cd $BUILD_TOP
747 $MKDIR $INSTALL_DIR/$TARGET/include
748 $MKDIR $INSTALL_DIR/$TARGET/include/asm
749 $MKDIR $INSTALL_DIR/$TARGET/include/linux
751 cp -f -dR $LINUX_VER/include/linux/* $INSTALL_DIR/$TARGET/include/linux
752 cp -f -dR $LINUX_VER/include/asm-or32/* $INSTALL_DIR/$TARGET/include/asm
754 cd $INSTALL_DIR/$TARGET
755 ln -s include sys-include
756 cd $BUILD_TOP
758 cd $GCC_VER
760 ## Patch gcc ##
761 echo
762 echo "Patching $GCC_VER with $GCC_PATCH"
764 bzip2 -dc $DOWNLOAD_DIR/$GCC_PATCH | patch -p1 > $GCC_VER-patch.log 2>&1
766 ## Make sure that patched ok ##
767 check_exit_code
769 cd $BUILD_TOP
770 cd b-gcc
772 # configure GCC
773 echo
774 echo "Configuring $GCC_VER: --target=$TARGET --prefix=$INSTALL_DIR/$TARGET --with-local-prefix=$INSTALL_DIR/$TARGET/$TARGET --with-gnu-as --with-gnu-ld --disable-libssp --enable-languages=c"
775 echo "Logging output to $GCC_VER-configure.log"
776 $BUILD_TOP/$GCC_VER/configure --target=$TARGET --prefix=$INSTALL_DIR/$TARGET --with-local-prefix=$INSTALL_DIR/$TARGET/$TARGET --with-gnu-as --with-gnu-ld --disable-libssp --enable-languages=c > $GCC_VER-configure.log 2>&1
778 echo
779 echo "Making and installing $GCC_VER"
780 echo "Logging output to $GCC_VER-make.log"
781 make all install > $GCC_VER-make.log 2>&1
783 ## Make sure that built ok ##
784 check_exit_code
786 cd $BUILD_TOP
788 echo
789 echo "Making vmlinux image"
790 echo "Logging output to vmlinux-make.log"
792 cd $LINUX_VER
793 make vmlinux ARCH=or32 CROSS_COMPILE=$INSTALL_DIR/$TARGET/bin/$TARGET- > vmlinux-make.log 2>&1
795 ## Make sure that built ok ##
796 check_exit_code
798 ##########################Finish Building GCC and Linux############################
801 ## default build option is yes ##
802 BUILD_THIS="y"
804 if [ $DBG_BUILD -eq 1 ]
805 then
806 ## Ask if we should rebuild uClibc ##
807 echo "Re-build $UCLIB_VER ?"
808 echo "[y/N]:"
809 read YN
810 ## $YN will be zero length string if user just pressed enter ##
811 if [ -z $YN ]
812 then
813 BUILD_THIS="n" # default is no
814 else
815 BUILD_THIS=$(echo $YN | tr [:upper:] [:lower:])
818 if [ $BUILD_THIS = "y" ]
819 then
820 ## Delete the uClibc directory ##
821 rm -rf $BUILD_TOP/$UCLIB_VER
825 ##########################Building uClibc#########################
826 if [ $BUILD_THIS = "y" ]
827 then
829 echo
830 echo "############################## Building uClibc #################################"
831 echo
832 echo "Decompressing source"
834 cd $BUILD_TOP
835 tar xjf $DOWNLOAD_DIR/$ZBALL3 ## uClibc sources ##
837 echo
838 echo "Patching $UCLIB_VER with $UCLIBC_PATCH"
840 cd $UCLIB_VER
842 ## Patch uClibc sources ##
843 bzip2 -dc $DOWNLOAD_DIR/$UCLIBC_PATCH | patch -p1 > $UCLIB_VER-patch.log 2>&1
845 ## Make sure that patched ok ##
846 check_exit_code
848 export CC=$TARGET-gcc
849 export BUILD_TOP
850 #cp $DOWNLOAD_DIR/$CONFIG1 $BUILD_TOP/$UCLIB_VER/.config
851 #cp $DOWNLOAD_DIR/$CONFIG1 $BUILD_TOP/$UCLIB_VER/.config.old
853 ## $TARGET name implementation into config script ##
854 ## First get the second part of the target name, after the "-", the "elf" in "or32-elf", for example ##
855 TARGET_SECOND_PART=`echo $TARGET | cut -f 2 -d "-"`
856 ## First change any references to the uclinux target ##
857 ## And delete the line saying DEVEL_PREFIX so we can put our $INSTALL_DIR path in ##
858 sed "s/or32\-uclinux/\or32\-$TARGET_SECOND_PART/" $DOWNLOAD_DIR/$CONFIG1 | sed "/DEVEL\_PREFIX\=/d" > $BUILD_TOP/$UCLIB_VER/.config ## Output to the .config ##
859 ## Now output the new DEVEL_PATH= value ##
860 echo "DEVEL_PREFIX=\"$INSTALL_DIR/$TARGET\"" >> $BUILD_TOP/$UCLIB_VER/.config
861 ## copy it to .config.old ##
862 cp $BUILD_TOP/$UCLIB_VER/.config $BUILD_TOP/$UCLIB_VER/.config.old
863 ## Do the configuration ##
865 ## Change the cross compiler name in the Config.or32 file
866 ## First get the second part of the target name, after the "-" ##
867 TARGET_SECOND_PART=`echo $TARGET | cut -f 2 -d "-"`
868 ## Removes the uclinux line and changes to whatever our current target is ##
869 sed "s/or32\-uclinux/\or32\-$TARGET_SECOND_PART/" $BUILD_TOP/$UCLIB_VER/extra/Configs/Config.or32 > $BUILD_TOP/$UCLIB_VER/extra/Configs/Config.or32.newtarget
870 mv $BUILD_TOP/$UCLIB_VER/extra/Configs/Config.or32.newtarget $BUILD_TOP/$UCLIB_VER/extra/Configs/Config.or32
872 if [ $ON_CYGWIN -ge 1 ]
873 then
874 ## If on Cygwin, fix strange error where 'install' command by the makefile ##
875 ## results in it trying to execute the INSTALL text file in the root of the ##
876 ## package ##
877 mv INSTALL INSTALL.txt
880 echo
881 echo "Making uClibc oldconfig"
883 HOST_LOADLIBES="-lcurses -lintl" HOSTCC=`which gcc` make oldconfig > $UCLIB_VER-make-oldconfig.log 2>&1
885 ## Make sure that built ok ##
886 check_exit_code
888 ln -s extra/Configs/Config.or32 Config
890 echo
891 echo "Making and install $UCLIB_VER"
892 echo "Logging output to $UCLIB_VER-make.log"
893 make all install > $UCLIB_VER-make.log 2>&1
895 ## Make sure that built ok ##
896 check_exit_code
898 unset CC
900 ##########################Finish Building uClibc#########################
903 ## default build option is yes ##
904 BUILD_THIS="y"
906 if [ $DBG_BUILD -eq 1 ]
907 then
908 ## Ask if we should rebuild gcc ##
909 echo "Perform $GCC_VER re-build? - YES (y) if you rebuilt GCC and Linux previously, otherwise definitely NO (n)."
910 echo "[y/N]:"
911 read YN
912 ## $YN will be zero length string if user just pressed enter ##
913 if [ -z $YN ]
914 then
915 BUILD_THIS="n" # default is no
916 else
917 BUILD_THIS=$(echo $YN | tr [:upper:] [:lower:])
920 if [ $BUILD_THIS = "y" ]
921 then
922 ## Undo some things we did before after doing this compile ##
923 unlink $INSTALL_DIR/$TARGET/$TARGET/sys-include
924 rm -rf $INSTALL_DIR/$TARGET/$TARGET/lib/*
929 ##########################re-Building GCC########################
930 if [ $BUILD_THIS = "y" ]
931 then
933 echo
934 echo "############################## Re-building or-32 gcc ###########################"
935 echo
936 echo "Re-building $GCC_VER"
938 cd $BUILD_TOP
940 cd b-gcc
942 echo
943 echo "Re-configuring $GCC_VER: --target=$TARGET --prefix=$INSTALL_DIR/$TARGET --with-local-prefix=$INSTALL_DIR/$TARGET/$TARGET --with-gnu-as --with-gnu-ld --disable-libssp --enable-languages=c"
944 echo "Logging output to $GCC_VER-rebuild-configure.log"
946 $BUILD_TOP/$GCC_VER/configure --target=$TARGET --prefix=$INSTALL_DIR/$TARGET --with-local-prefix=$INSTALL_DIR/$TARGET/$TARGET --with-gnu-as --with-gnu-ld --disable-libssp --enable-languages=c > $GCC_VER-rebuild-configure.log 2>&1
950 echo
951 echo "Re-building and re-installing $GCC_VER"
952 echo "Logging output to $GCC_VER-rebuild-make.log"
953 make all install > $GCC_VER-rebuild-make.log 2>&1
955 ## Make sure that built ok ##
956 check_exit_code
958 cd $INSTALL_DIR/$TARGET/$TARGET
959 ln -s ../include sys-include
960 cd lib
961 cp -f -dR ../../lib/* .
962 cd $BUILD_TOP
966 ##########################finish re-Building GCC########################
969 ## default build option is yes ##
970 BUILD_THIS="y"
972 if [ $DBG_BUILD -eq 1 ]
973 then
974 ## Ask if we should rebuild gdb ##
975 echo "Rebuild $GDB_VER?"
976 echo "[y/N]:"
977 read YN
978 ## $YN will be zero length string if user just pressed enter ##
979 if [ -z $YN ]
980 then
981 BUILD_THIS="n" # default is no
982 else
983 BUILD_THIS=$(echo $YN | tr [:upper:] [:lower:])
986 if [ $BUILD_THIS = "y" ]
987 then
988 ## Delete existing gdb dir ##
989 rm -rf $BUILD_TOP/$GDB_VER
994 ########################## GDB build ################
995 if [ $BUILD_THIS = "y" ]
996 then
998 echo
999 echo "############################## Building GDB ####################################"
1000 echo
1001 echo "Decompressing source"
1004 cd $BUILD_TOP
1006 tar xjf $DOWNLOAD_DIR/$ZBALL8
1008 echo
1009 echo "Patching $GDB_VER with $GDB_PATCH"
1010 echo "Logging output to $GDB_VER-patch.log"
1011 cd $GDB_VER
1013 bzcat -dc $DOWNLOAD_DIR/$GDB_PATCH | patch -p1 > $GDB_VER-patch.log 2>&1
1015 ## Make sure that patched ok ##
1016 check_exit_code
1018 echo
1019 echo "Configuring $GDB_VER: --target=$TARGET --prefix=$INSTALL_DIR/$TARGET --disable-werror"
1020 echo "Logging output to $GDB_VER-configure.log"
1022 ./configure --target=$TARGET --prefix=$INSTALL_DIR/$TARGET --disable-werror > $GDB_VER-configure.log 2>&1
1024 echo
1025 echo "Making and installing $GDB_VER"
1026 echo "Logging output to $GDB_VER-make.log"
1027 make all install > $GDB_VER-make.log 2>&1
1029 ## Make sure that built ok ##
1030 check_exit_code
1032 cd $BUILD_TOP
1035 ########################## finish GDB build ################
1037 ## default build option is yes ##
1038 BUILD_THIS="y"
1040 if [ $DBG_BUILD -eq 1 ]
1041 then
1042 ## Ask if we should rebuild busybox ##
1043 echo "Rebuild $BUSY_VER?"
1044 echo "[y/N]:"
1045 read YN
1046 ## $YN will be zero length string if user just pressed enter ##
1047 if [ -z $YN ]
1048 then
1049 BUILD_THIS="n" # default is no
1050 else
1051 BUILD_THIS=$(echo $YN | tr [:upper:] [:lower:])
1054 if [ $BUILD_THIS = "y" ]
1055 then
1056 ## Delete existing busybox stuff ##
1057 rm -rf $BUILD_TOP/$BUSY_VER
1061 ##########################Building Busybox########################
1062 if [ $BUILD_THIS = "y" ]
1063 then
1065 echo
1066 echo "############################## Building BusyBox ################################"
1067 echo
1068 echo "Decompressing source"
1071 cd $BUILD_TOP
1073 tar xjf $DOWNLOAD_DIR/$ZBALL5
1076 cd $BUSY_VER
1077 cp $DOWNLOAD_DIR/$CONFIG2 $BUILD_TOP/$BUSY_VER/.config
1078 cp $DOWNLOAD_DIR/$CONFIG2 $BUILD_TOP/$BUSY_VER/.config.old
1080 echo
1081 echo "Making $BUSY_VER oldconfig"
1082 make oldconfig > $BUSY_VER-make-oldconfig.log 2>&1
1084 ## Make Sure that built ok ##
1085 check_exit_code
1087 ## Put the Linux headers in BusyBox's include dir ##
1089 ln -s $BUILD_TOP/$LINUX_VER/include/linux $BUILD_TOP/$BUSY_VER/include/.
1090 ln -s $BUILD_TOP/$LINUX_VER/include/asm $BUILD_TOP/$BUSY_VER/include/.
1092 echo
1093 echo "Making $BUSY_VER"
1094 echo "Logging output to $BUSY_VER-make.log"
1095 make ARCH=or32 CROSS_COMPILE=$INSTALL_DIR/$TARGET/bin/$TARGET- > $BUSY_VER-make.log 2>&1
1097 ## Make sure that built ok ##
1098 check_exit_code
1100 echo
1101 echo "Installing $BUSY_VER"
1102 echo "Logging output to $BUSY_VER-install.log"
1103 make install ARCH=or32 CROSS_COMPILE=$INSTALL_DIR/$TARGET/bin/$TARGET- > $BUSY_VER-install.log 2>&1
1105 ## Make sure that built ok ##
1106 check_exit_code
1108 cd $BUILD_TOP
1110 ## Copy and extract the ramdisk image file
1112 cp $DOWNLOAD_DIR/$ZBALL7 . ## Ramdisk file ##
1114 bunzip2 $RAMDISK_FILE.bz2
1116 ## We can only play with the ext2 image if we're not on Cygwin ##
1117 if [ -z $ON_CYGWIN ]
1118 then
1120 RT=`whoami`
1121 if [ $RT = "root" ];then
1122 $MKDIR rd_mount
1123 chmod 777 rd_mount
1124 mount -t ext2 -o loop $RAMDISK_FILE rd_mount
1125 cp -f -dR $BUILD_TOP/busy_out.1.7.5/* $BUILD_TOP/rd_mount
1126 umount rd_mount
1127 cp -f $RAMDISK_FILE $LINUX_VER/$LINUX_RAMDISK_FILE
1128 else
1129 echo
1130 echo "User is not root. Unable to mount Linux ramdisk."
1131 echo "Note that this program built BusyBox but did not"
1132 echo "install it on the ramdisk. Defaults are used."
1133 cp -f $RAMDISK_FILE $LINUX_VER/$LINUX_RAMDISK_FILE
1136 fi ## if [ -z $ON_CYGWIN ]
1138 cd $BUILD_TOP
1141 ########################## Finish BusyBox build ################
1143 ## default build option is yes ##
1144 BUILD_THIS="y"
1146 if [ $DBG_BUILD -eq 1 ]
1147 then
1148 ## Ask if we should rebuild linux again##
1149 echo "Rebuild the $LINUX_VER rebuild (only ever yes (y) if performed previous linux rebuild)?"
1150 echo "[y/N]:"
1151 read YN
1152 ## $YN will be zero length string if user just pressed enter ##
1153 if [ -z $YN ]
1154 then
1155 BUILD_THIS="n" # default is no
1156 else
1157 BUILD_THIS=$(echo $YN | tr [:upper:] [:lower:])
1162 #echo "Start Building Linux kernel?"
1163 #read Q
1164 ##########################Final Linux kernel build################
1165 if [ $BUILD_THIS = "y" ]
1166 then
1168 echo
1169 echo "########################### Linux image generation #############################"
1170 cd $BUILD_TOP
1171 cd $LINUX_VER
1173 echo
1174 echo "Making vmlinux"
1175 echo "Logging output to vmlinux-remake.log"
1176 make vmlinux ARCH=or32 CROSS_COMPILE=$INSTALL_DIR/$TARGET/bin/$TARGET- > vmlinux-remake.log 2>&1
1178 ## Make sure that built ok ##
1179 check_exit_code
1181 cd $BUILD_TOP
1183 ##########################Finished Final Linux kernel build################
1185 BUILD_THIS="y"
1187 if [ $DBG_BUILD -eq 1 ]
1188 then
1189 ## Ask if we should rebuild or1ksim##
1190 echo "Rebuild $SIM_VER ?"
1191 echo "[y/N]:"
1192 read YN
1193 ## $YN will be zero length string if user just pressed enter ##
1194 if [ -z $YN ]
1195 then
1196 BUILD_THIS="n" # default is no
1197 else
1198 BUILD_THIS=$(echo $YN | tr [:upper:] [:lower:])
1201 if [ $BUILD_THIS = "y" ]
1202 then
1203 ## Clean previous or1ksim directories ##
1204 rm -rf $BUILD_TOP/$SIM_VER
1209 ##########################Simulator build#########################
1210 if [ $BUILD_THIS = "y" ]
1211 then
1213 echo
1214 echo "############################## Building or1ksim ################################"
1215 echo
1216 echo "Decompressing source"
1218 cd $BUILD_TOP
1220 tar xjf $DOWNLOAD_DIR/$ZBALL6
1222 cd $SIM_VER
1224 echo
1225 echo "Configuring $SIM_VER: --target=$TARGET --prefix=$INSTALL_DIR/$SIM_VER"
1227 ./configure --target=$TARGET --prefix=$INSTALL_DIR/$SIM_VER > $SIM_VER-configure.log 2>&1
1229 echo
1230 echo "Making and installing $SIM_VER"
1231 echo "Logging output to $SIM_VER-make.log"
1232 make all install > $SIM_VER-make.log 2>&1
1234 ## Make sure that built ok ##
1235 check_exit_code
1237 ## Setup symbolic link from or1ksim-x.y.z to simply or1ksim
1239 echo "Symbolically linking $INSTALL_DIR/$SIM_VER to $INSTALL_DIR/or1ksim"
1240 if [ -e $INSTALL_DIR/or1ksim ]; then
1241 echo "Symlink $INSTALL_DIR/or1ksim already exists. Updating to this version"
1242 unlink $INSTALL_DIR/or1ksim;
1243 check_exit_code
1245 echo "ln -s $INSTALL_DIR/$SIM_VER $INSTALL_DIR/or1ksim"
1246 ln -s $INSTALL_DIR/$SIM_VER $INSTALL_DIR/or1ksim
1248 cd $BUILD_TOP
1250 ##########################Finish Simulator build#########################
1253 ##########################Code Test###############################
1254 cd $BUILD_TOP
1255 echo "Launch the simulator with the newly compiled Linux image and BusyBox apps?"
1256 echo "[y/N]:"
1257 read SI
1259 if [ -z $SI ]
1260 then
1261 SVAL="n" ## Default is no ##
1262 else
1263 SVAL=$(echo $SI | tr [:upper:] [:lower:])
1266 if [ $SVAL = "y" ];then
1268 ## Check for X's xterm, if we find it, and a valid $DISPLAY variable, we'll open the simulator with an xterm tty ##
1269 which xterm
1272 if [ $? -eq 0 ]
1273 then
1274 # Xterm exists, check if the $DISPLAY variable is set
1275 # Get the display variable
1276 DISPLAY=`printenv DISPLAY`
1277 echo "DISPLAY variable is set to $DISPLAY"
1278 if [ -n $DISPLAY ]
1279 then
1280 ## It appears display is set, let's set the or1ksim_linux.cfg file to use an xterm instead of telnet ##
1281 cd $LINUX_VER
1282 ## Rename the original script, adding .orig to the end ##
1283 mv or1ksim_linux.cfg or1ksim_linux.cfg.orig
1284 ## Now use sed to comment the line specifiying a telnet tty and uncomment the xterm line, restoring the original script ##
1285 sed 's/channel\ \=\ \"tcp\:10084\"/\/\*\ channel\ \=\ \"tcp\:10084\"\ \*\//' or1ksim_linux.cfg.orig | sed 's/\/\*\ channel\ \=\ \"xterm\:\"\ \*\//\ channel\ \=\ \"xterm\:\"\ /' > or1ksim_linux.cfg
1286 echo "########################## or1ksim ###############################"
1287 echo
1288 echo "or1ksim will open an xterm for console output as Linux is booting."
1289 echo
1290 echo "########################## or1ksim ###############################"
1291 cd $BUILD_TOP
1294 else
1295 echo "########################## or1ksim ###############################"
1296 echo
1297 echo " To connect to the simulator run: telnet 127.0.0.1 10084"
1298 echo
1299 echo "########################## or1ksim ###############################"
1304 cd $BUILD_TOP/$LINUX_VER
1305 $INSTALL_DIR/or1ksim/bin/$TARGET-sim -f or1ksim_linux.cfg vmlinux
1307 else
1308 ## User didn't run the sim, but tell them how to anyway ##
1309 echo "The compiled linux image is found in $BUILD_TOP/$LINUX_VER/vmlinux"
1310 echo "To run it in the simulator, cd to $BUILD_TOP/$LINUX_VER"
1311 echo "and run:"
1312 echo "$TARGET-sim -f or1ksim_linux.cfg vmlinux"
1313 echo
1317 echo
1318 echo "OpenRISC toolchain and architectural simulator build is complete!"
1319 echo
1320 echo "Your tools are installed in: $INSTALL_DIR/$TARGET"
1321 echo "or1ksim has been installed in: $INSTALL_DIR/$SIM_VER"
1322 echo
1323 echo "Please add the paths:"
1324 echo "\t$INSTALL_DIR/$TARGET/bin"
1325 echo "\t$INSTALL_DIR/or1ksim/bin"
1326 echo "to your PATH variable, for example, in most systems add the line"
1327 echo "below to your ~/.bashrc file:"
1328 echo
1329 echo "\texport PATH=\$PATH:$INSTALL_DIR/$TARGET/bin:$INSTALL_DIR/or1ksim/bin"
1330 echo
1331 echo "For further support please visit the OpenRISC forum at OpenCores"
1332 echo "http://opencores.org/forum,OpenRISC"
1333 echo
1334 exit 0
1336 ##########################End Script##############################