Implement a proper thread shutdown and also most (if not all) malloc related crashes.
[kugel-rb.git] / tools / configure
blob86feaa1400f6371d666cb0f9dc0f69afc5062e7a
1 g#!/bin/sh
2 #             __________               __   ___.
3 #   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
4 #   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
5 #   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
6 #   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
7 #                     \/            \/     \/    \/            \/
8 # $Id$
11 # global CC options for all platforms
12 CCOPTS="-W -Wall -Wundef -O -nostdlib -ffreestanding -Wstrict-prototypes -pipe"
14 use_logf="#undef ROCKBOX_HAS_LOGF"
15 use_bootchart="#undef DO_BOOTCHART"
17 scriptver=`echo '$Revision$' | sed -e 's:\\$::g' -e 's/Revision: //'`
19 rbdir=".rockbox"
20   
22 # Begin Function Definitions
24 input() {
25     read response
26     echo $response
29 prefixtools () {
30  prefix="$1"
31  CC=${prefix}gcc
32  WINDRES=${prefix}windres
33  DLLTOOL=${prefix}dlltool
34  DLLWRAP=${prefix}dllwrap
35  RANLIB=${prefix}ranlib
36  LD=${prefix}ld
37  AR=${prefix}ar
38  AS=${prefix}as
39  OC=${prefix}objcopy
42 findarmgcc() {
43   if [ "$ARG_ARM_EABI" = "1" ]; then
44     prefixtools arm-elf-eabi-
45     gccchoice="4.4.3"
46   else
47     prefixtools arm-elf-
48     gccchoice="4.0.3"
49   fi
52 # scan the $PATH for the given command
53 findtool(){
54   file="$1"
56   IFS=":"
57   for path in $PATH
58   do
59     # echo "checks for $file in $path" >&2
60     if test -f "$path/$file"; then
61       echo "$path/$file"
62       return
63     fi
64   done
65   # check whether caller wants literal return value if not found
66   if [ "$2" = "--lit" ]; then
67     echo "$file"
68   fi
71 # scan the $PATH for sdl-config - check whether for a (cross-)win32
72 # sdl as requested
73 findsdl(){
74   file="sdl-config"
75   winbuild="$1"
77   IFS=":"
78   for path in $PATH
79   do
80     #echo "checks for $file in $path" >&2
81     if test -f "$path/$file"; then
82       if [ "0" != `$path/$file --libs |grep -c mwindows` ]; then
83         if [ "yes" = "${winbuild}" ]; then
84           echo "$path/$file"
85           return
86         fi
87       else
88         if [ "yes" != "${winbuild}" ]; then
89           echo "$path/$file"
90           return
91         fi
92       fi
93     fi
94   done
97 simcc () {
99  # default tool setup for native building
100  prefixtools ""
102  simver=sdl
103  winbuild="$crosscompile"
104  GCCOPTS='-W -Wall -g -fno-builtin'
105  GCCOPTIMIZE=''
106  LDOPTS=''
108  # default output binary name
109  output="rockboxui"
111  # default share option, override below if needed
112  SHARED_FLAG="-shared"
114  case $uname in
115    CYGWIN*)
116    echo "Cygwin host detected"
118    LDOPTS="-mconsole"
119    output="rockboxui.exe"
120    winbuild="yes"
121    ;;
123    MINGW*)
124    echo "MinGW host detected"
126    LDOPTS="-mconsole"
127    output="rockboxui.exe"
128    winbuild="yes"
129    ;;
131    Linux)
132    echo "Linux host detected"
133    ;;
135    FreeBSD)
136    echo "FreeBSD host detected"
137    ;;
139    Darwin)
140    echo "Darwin host detected"
142    SHARED_FLAG="-dynamiclib -Wl\,-single_module"
143    ;;
145    SunOS)
146    echo "*Solaris host detected"
148    GCCOPTS="$GCCOPTS -fPIC"
149    LDOPTS="-lm"
150    ;;
152    *)
153    echo "[ERROR] Unsupported system: $uname, fix configure and retry"
154    exit 1
155    ;;
156  esac
158  sdl=`findsdl $winbuild`
160  if [ $1 = "sdl" ]; then
161     if [ -z "$sdl" ]; then
162         echo "configure didn't find sdl-config, which indicates that you"
163         echo "don't have SDL (properly) installed. Please correct and"
164         echo "re-run configure!"
165         exit 2
166     else 
167         # generic sdl-config checker
168         GCCOPTS="$GCCOPTS `$sdl --cflags` `pth-config --cflags`"
169         LDOPTS="$LDOPTS `$sdl --libs` `pth-config --libs`"
170     fi
171  fi
173  GCCOPTS="$GCCOPTS -I\$(SIMDIR)"
175  if test "X$crosscompile" != "Xyes"; then
176    case `uname -m` in
177     x86_64|amd64)
178       # fPIC is needed to make shared objects link
179       # setting visibility to hidden is necessary to avoid strange crashes
180       # due to symbol clashing
181       GCCOPTS="$GCCOPTS -fPIC -fvisibility=hidden"
182       # x86_64 supports MMX by default
183     ;;
185     i686)
186       echo "Enabling MMX support"
187       GCCOPTS="$GCCOPTS -mmmx"
188     ;;
189    esac
191    id=$$
192    cat >$tmpdir/conftest-$id.c <<EOF
193 #include <stdio.h>
194 int main(int argc, char **argv)
196   int var=0;
197   char *varp = (char *)&var;
198   *varp=1;
200   printf("%d\n", var);
201   return 0;
205    $CC -o $tmpdir/conftest-$id $tmpdir/conftest-$id.c 2>/dev/null
207    if test `$tmpdir/conftest-$id 2>/dev/null` -gt "1"; then
208      # big endian
209      endian="big"
210    else
211      # little endian
212      endian="little"
213    fi
215    if [ $1 = "sdl" ]; then
216      echo "Simulator environment deemed $endian endian"
217    elif [ $1 = "checkwps" ]; then
218      echo "CheckWPS environment deemed $endian endian"
219    fi
221    # use wildcard here to make it work even if it was named *.exe like
222    # on cygwin
223    rm -f $tmpdir/conftest-$id*
224  else
225    # We are crosscompiling
226    # add cross-compiler option(s)
227    prefixtools i586-mingw32msvc-
228    LDOPTS="$LDOPTS -mconsole"
229    output="rockboxui.exe"
230    endian="little" # windows is little endian
231    echo "Enabling MMX support"
232    GCCOPTS="$GCCOPTS -mmmx"
233  fi
237 # functions for setting up cross-compiler names and options
238 # also set endianess and what the exact recommended gcc version is
239 # the gcc version should most likely match what versions we build with
240 # rockboxdev.sh
242 shcc () {
243  prefixtools sh-elf-
244  GCCOPTS="$CCOPTS -m1"
245  GCCOPTIMIZE="-fomit-frame-pointer -fschedule-insns"
246  endian="big"
247  gccchoice="4.0.3"
250 calmrisccc () {
251  prefixtools calmrisc16-unknown-elf-
252  GCCOPTS="-Wl\,--no-check-sections $CCOPTS"
253  GCCOPTIMIZE="-fomit-frame-pointer"
254  endian="big"
257 coldfirecc () {
258  prefixtools m68k-elf-
259  GCCOPTS="$CCOPTS -m5206e -Wa\,-m5249 -malign-int -mstrict-align"
260  GCCOPTIMIZE="-fomit-frame-pointer"
261  endian="big"
262  gccchoice="3.4.6"
265 arm7tdmicc () {
266  findarmgcc
267  GCCOPTS="$CCOPTS -mcpu=arm7tdmi"
268  if test "X$1" != "Xshort" -a "$ARG_ARM_EABI" != "1"; then
269    GCCOPTS="$GCCOPTS -mlong-calls"
270  fi
271  GCCOPTIMIZE="-fomit-frame-pointer"
272  endian="little"
275 arm9tdmicc () {
276  findarmgcc
277  GCCOPTS="$CCOPTS -mcpu=arm9tdmi"
278  if test "$modelname" != "gigabeatfx" -a "$t_manufacturer" != "as3525" -a "$ARG_ARM_EABI" != "1"; then
279   GCCOPTS="$GCCOPTS -mlong-calls"
280  fi
281  GCCOPTIMIZE="-fomit-frame-pointer"
282  endian="little"
285 arm940tbecc () {
286  findarmgcc
287  GCCOPTS="$CCOPTS -mbig-endian -mcpu=arm940t"
288  if test "$ARG_ARM_EABI" != "1"; then
289   GCCOPTS="$GCCOPTS -mlong-calls"
290  fi
291  GCCOPTIMIZE="-fomit-frame-pointer"
292  endian="big"
295 arm940tcc () {
296  findarmgcc
297  GCCOPTS="$CCOPTS -mcpu=arm940t"
298  if test "$ARG_ARM_EABI" != "1"; then
299   GCCOPTS="$GCCOPTS -mlong-calls"
300  fi
301  GCCOPTIMIZE="-fomit-frame-pointer"
302  endian="little"
305 arm946cc () {
306  findarmgcc
307  GCCOPTS="$CCOPTS -mcpu=arm9e"
308  if test "$ARG_ARM_EABI" != "1"; then
309   GCCOPTS="$GCCOPTS -mlong-calls"
310  fi
311  GCCOPTIMIZE="-fomit-frame-pointer"
312  endian="little"
315 arm926ejscc () {
316  findarmgcc
317  GCCOPTS="$CCOPTS -mcpu=arm926ej-s"
318  if test "$t_manufacturer" != "as3525" -a "$ARG_ARM_EABI" != "1"; then
319   GCCOPTS="$GCCOPTS -mlong-calls"
320  fi
321  GCCOPTIMIZE="-fomit-frame-pointer"
322  endian="little"
325 arm1136jfscc () {
326  findarmgcc
327  GCCOPTS="$CCOPTS -mcpu=arm1136jf-s"
328  if test "$modelname" != "gigabeats" -a "$ARG_ARM_EABI" != "1"; then
329   GCCOPTS="$GCCOPTS -mlong-calls"
330  fi
331  GCCOPTIMIZE="-fomit-frame-pointer"
332  endian="little"
335 arm1176jzscc () {
336  findarmgcc
337  GCCOPTS="$CCOPTS -mcpu=arm1176jz-s"
338  if test "$ARG_ARM_EABI" != "1"; then
339   GCCOPTS="$GCCOPTS -mlong-calls"
340  fi
341  GCCOPTIMIZE="-fomit-frame-pointer"
342  endian="little"
345 mipselcc () {
346  prefixtools mipsel-elf-
347  GCCOPTS="$CCOPTS -march=mips32 -mtune=r4600 -mno-mips16 -mno-long-calls"
348  GCCOPTS="$GCCOPTS -ffunction-sections -msoft-float -G 0 -Wno-parentheses"
349  GCCOPTIMIZE="-fomit-frame-pointer"
350  endian="little"
351  gccchoice="4.1.2"
354 whichadvanced () {
355   atype=`echo "$1" | cut -c 2-`
356   ##################################################################
357   # Prompt for specific developer options
358   #
359   if [ "$atype" ]; then
360     interact=
361   else
362     interact=1
363     echo ""
364     echo "Enter your developer options (press enter when done)"
365     printf "(D)EBUG, (L)ogf, Boot(c)hart, (S)imulator, (P)rofiling, (V)oice, (W)in32 crosscompile, (T)est plugins"
366     if [ "$memory" = "2" ]; then
367       printf ", (8)MB MOD"
368     fi
369     if [ "$modelname" = "archosplayer" ]; then
370       printf ", Use (A)TA poweroff"
371     fi
372     if [ "$t_model" = "ondio" ]; then
373       printf ", (B)acklight MOD"
374     fi
375     if [ "$modelname" = "iaudiom5" ]; then
376       printf ", (F)M radio MOD"
377     fi
378     if [ "$modelname" = "iriverh120" ]; then
379       printf ", (R)TC MOD"
380     fi
381     echo ""
382   fi
384   cont=1
385   while [ $cont = "1" ]; do
387     if [ "$interact" ]; then
388       option=`input`
389     else
390       option=`echo "$atype" | cut -c 1`
391     fi
393     case $option in
394       [Dd])
395         if [ "yes" = "$profile" ]; then
396           echo "Debug is incompatible with profiling"
397         else
398           echo "DEBUG build enabled"
399           use_debug="yes"
400         fi
401         ;;
402       [Ll])
403         echo "logf() support enabled"
404         logf="yes"
405         ;;
406       [Tt])
407         echo "Including test plugins"
408         extradefines="$extradefines -DHAVE_TEST_PLUGINS"
409         ;;
410       [Cc])
411           echo "bootchart enabled (logf also enabled)"
412         bootchart="yes"
413         logf="yes"
414         ;;
415       [Ss])
416         echo "Simulator build enabled"
417         simulator="yes"
418         ;;
419       [Pp])
420         if [ "yes" = "$use_debug" ]; then
421           echo "Profiling is incompatible with debug"
422         else
423           echo "Profiling support is enabled"
424           profile="yes"
425         fi
426         ;;
427       [Vv])
428         echo "Voice build selected"
429         voice="yes"
430         ;;
431       8)
432         if [ "$memory" = "2" ]; then
433           memory="8"
434           echo "Memory size selected: 8MB"
435         fi
436         ;;
437       [Aa])
438         if [ "$modelname" = "archosplayer" ]; then
439           have_ata_poweroff="#define HAVE_ATA_POWER_OFF"
440           echo "ATA power off enabled"
441         fi
442         ;;
443       [Bb])
444         if [ "$t_model" = "ondio" ]; then
445           have_backlight="#define HAVE_BACKLIGHT"
446           echo "Backlight functions enabled"
447         fi
448         ;;
449       [Ff])
450         if [ "$modelname" = "iaudiom5" ]; then
451           have_fmradio_in="#define HAVE_FMRADIO_IN"
452           echo "FM radio functions enabled"
453         fi
454         ;;
455       [Rr])
456         if [ "$modelname" = "iriverh120" ]; then
457           config_rtc="#define CONFIG_RTC RTC_DS1339_DS3231"
458           have_rtc_alarm="#define HAVE_RTC_ALARM"
459           echo "RTC functions enabled (DS1339/DS3231)"
460         fi
461         ;;
462       [Ww])
463         echo "Enabling Windows 32 cross-compiling"
464         crosscompile="yes"
465         ;;
466       *)
467         if [ "$interact" ]; then
468           cont=0
469         else
470           echo "[ERROR] Option $option unsupported"
471         fi
472         ;;
473     esac
474     if [ "$interact" ]; then
475       btype="$btype$option"
476     else
477       atype=`echo "$atype" | cut -c 2-`
478       [ "$atype" ] || cont=0
479     fi
480   done
481   echo "done"
483   if [ "yes" = "$voice" ]; then
484     # Ask about languages to build
485     picklang
486     voicelanguage=`whichlang`
487     echo "Voice language set to $voicelanguage"
489     # Configure encoder and TTS engine for each language
490     for thislang in `echo $voicelanguage | sed 's/,/ /g'`; do
491       voiceconfig "$thislang"
492     done
493   fi
494   if [ "yes" = "$use_debug" ]; then
495     debug="-DDEBUG"
496     GCCOPTS="$GCCOPTS -g -DDEBUG"
497   fi
498   if [ "yes" = "$logf" ]; then
499     use_logf="#define ROCKBOX_HAS_LOGF 1"
500   fi
501   if [ "yes" = "$bootchart" ]; then
502     use_bootchart="#define DO_BOOTCHART 1"
503   fi
504   if [ "yes" = "$simulator" ]; then
505     debug="-DDEBUG"
506     extradefines="$extradefines -DSIMULATOR"
507     archosrom=""
508     flash=""
509   fi
510   if [ "yes" = "$profile" ]; then
511     extradefines="$extradefines -DRB_PROFILE"
512     PROFILE_OPTS="-finstrument-functions"
513   fi
516 # Configure voice settings
517 voiceconfig () {
518     thislang=$1
519     if [ ! "$ARG_TTS" ]; then
520         echo "Building $thislang voice for $modelname. Select options"
521         echo ""
522     fi
524     if [ -n "`findtool flite`" ]; then
525         FLITE="F(l)ite "
526         FLITE_OPTS=""
527         DEFAULT_TTS="flite"
528         DEFAULT_TTS_OPTS=$FLITE_OPTS
529         DEFAULT_NOISEFLOOR="500"
530         DEFAULT_CHOICE="L"
531     fi
532     if [ -n "`findtool espeak`" ]; then
533         ESPEAK="(e)Speak "
534         ESPEAK_OPTS=""
535         DEFAULT_TTS="espeak"
536         DEFAULT_TTS_OPTS=$ESPEAK_OPTS
537         DEFAULT_NOISEFLOOR="500"
538         DEFAULT_CHOICE="e"
539     fi
540     if [ -n "`findtool festival`" ]; then
541         FESTIVAL="(F)estival "
542         case "$thislang" in
543             "italiano")
544             FESTIVAL_OPTS="--language italian"
545             ;;
546             "espanol")
547             FESTIVAL_OPTS="--language spanish"
548             ;;
549             "finnish")
550             FESTIVAL_OPTS="--language finnish"
551             ;;
552             "czech")
553             FESTIVAL_OPTS="--language czech"
554             ;;
555             *)
556             FESTIVAL_OPTS=""
557             ;;
558         esac
559         DEFAULT_TTS="festival"
560         DEFAULT_TTS_OPTS=$FESTIVAL_OPTS
561         DEFAULT_NOISEFLOOR="500"
562         DEFAULT_CHOICE="F"
563     fi
564     if [ -n "`findtool swift`" ]; then
565         SWIFT="S(w)ift "
566         SWIFT_OPTS=""
567         DEFAULT_TTS="swift"
568         DEFAULT_TTS_OPTS=$SWIFT_OPTS
569         DEFAULT_NOISEFLOOR="500"
570         DEFAULT_CHOICE="w"
571     fi
572     # Allow SAPI if Windows is in use
573     if [ -n "`findtool winver`" ]; then
574         SAPI="(S)API "
575         SAPI_OPTS=""
576         DEFAULT_TTS="sapi"
577         DEFAULT_TTS_OPTS=$SAPI_OPTS
578         DEFAULT_NOISEFLOOR="500"
579         DEFAULT_CHOICE="S"
580     fi
582     if [ "$FESTIVAL" = "$FLITE" ] && [ "$FLITE" = "$ESPEAK" ] && [ "$ESPEAK" = "$SAPI" ] && [ "$SAPI" = "$SWIFT" ]; then
583         echo "You need Festival, eSpeak or Flite in your path, or SAPI available to build voice files"
584         exit 3
585     fi
587     if [ "$ARG_TTS" ]; then
588         option=$ARG_TTS
589     else
590         echo "TTS engine to use: ${FLITE}${FESTIVAL}${ESPEAK}${SAPI}${SWIFT}(${DEFAULT_CHOICE})?"
591         option=`input`
592     fi
593     advopts="$advopts --tts=$option"
594     case "$option" in
595         [Ll])
596         TTS_ENGINE="flite"
597         NOISEFLOOR="500" # TODO: check this value
598         TTS_OPTS=$FLITE_OPTS
599         ;;
600         [Ee])
601         TTS_ENGINE="espeak"
602         NOISEFLOOR="500"
603         TTS_OPTS=$ESPEAK_OPTS
604         ;;
605         [Ff])
606         TTS_ENGINE="festival"
607         NOISEFLOOR="500"
608         TTS_OPTS=$FESTIVAL_OPTS
609         ;;
610         [Ss])
611         TTS_ENGINE="sapi"
612         NOISEFLOOR="500"
613         TTS_OPTS=$SAPI_OPTS
614         ;;
615         [Ww])
616         TTS_ENGINE="swift"
617         NOISEFLOOR="500"
618         TTS_OPTS=$SWIFT_OPTS
619         ;;
620         *)
621         TTS_ENGINE=$DEFAULT_TTS
622         TTS_OPTS=$DEFAULT_TTS_OPTS
623         NOISEFLOOR=$DEFAULT_NOISEFLOOR
624     esac
625     echo "Using $TTS_ENGINE for TTS"
627     # Select which voice to use for Festival
628     if [ "$TTS_ENGINE" = "festival" ]; then
629         voicelist=`echo "(voice.list)"|festival -i 2>/dev/null |tr "\n" " "|sed -e 's/.*festival> (\(.*\)) festival>/\1/'|sort`
630         for voice in $voicelist; do
631             TTS_FESTIVAL_VOICE="$voice" # Default choice
632             break
633         done
634         if [ "$ARG_VOICE" ]; then
635             CHOICE=$ARG_VOICE
636         else
637             i=1
638             for voice in $voicelist; do
639                 printf "%3d. %s\n" "$i" "$voice"
640                 i=`expr $i + 1`
641             done
642             printf "Please select which Festival voice to use (default is $TTS_FESTIVAL_VOICE): "
643             CHOICE=`input`
644         fi
645         i=1
646         for voice in $voicelist; do
647             if [ "$i" = "$CHOICE" -o "$voice" = "$CHOICE" ]; then
648                 TTS_FESTIVAL_VOICE="$voice"
649             fi
650             i=`expr $i + 1`
651         done
652         advopts="$advopts --voice=$CHOICE"
653         echo "Festival voice set to $TTS_FESTIVAL_VOICE"
654         echo "(voice_$TTS_FESTIVAL_VOICE)" > festival-prolog.scm
655     fi
657     # Read custom tts options from command line
658     if [ "$ARG_TTSOPTS" ]; then
659         TTS_OPTS="$ARG_TTSOPTS"
660         advopts="$advopts --ttsopts='$TTS_OPTS'"
661         echo "$TTS_ENGINE options set to $TTS_OPTS"
662     fi
664     if [ "$swcodec" = "yes" ]; then
665         ENCODER="rbspeexenc"
666         ENC_CMD="rbspeexenc"
667         ENC_OPTS="-q 4 -c 10"
668     else
669         if [ -n "`findtool lame`" ]; then
670             ENCODER="lame"
671             ENC_CMD="lame"
672             ENC_OPTS="--resample 12 -t -m m -h -V 9.999 -S -B 64 --vbr-new"
673          else
674             echo "You need LAME in the system path to build voice files for"
675             echo "HWCODEC targets."
676             exit 4
677          fi
678     fi
680     echo "Using $ENCODER for encoding voice clips"
682     # Read custom encoder options from command line
683     if [ "$ARG_ENCOPTS" ]; then
684         ENC_OPTS="$ARG_ENCOPTS"
685         advopts="$advopts --encopts='$ENC_OPTS'"
686         echo "$ENCODER options set to $ENC_OPTS"
687     fi
689     TEMPDIR="${pwd}"
690     if [ -n "`findtool cygpath`" ]; then
691         TEMPDIR=`cygpath . -a -w`
692     fi
695 picklang() {
696     # figure out which languages that are around
697     for file in $rootdir/apps/lang/*.lang; do
698         clean=`basename $file .lang`
699         langs="$langs $clean"
700     done
702     if [ "$ARG_LANG" ]; then
703         pick=$ARG_LANG
704     else
705         echo "Select a number for the language to use (default is english)"
706         # FIXME The multiple-language feature is currently broken
707         # echo "You may enter a comma-separated list of languages to build"
709         num=1
710         for one in $langs; do
711             echo "$num. $one"
712             num=`expr $num + 1`
713         done
714         pick=`input`
715     fi
716     advopts="$advopts --language=$pick"
719 whichlang() {
720     output=""
721     # Allow the user to pass a comma-separated list of langauges
722     for thispick in `echo $pick | sed 's/,/ /g'`; do
723         num=1
724         for one in $langs; do
725             # Accept both the language number and name
726             if [ "$num" = "$thispick" ] || [ "$thispick" = "$one" ]; then
727                 if [ "$output" = "" ]; then
728                     output=$one
729                 else
730                     output=$output,$one
731                 fi
732             fi
733             num=`expr $num + 1`
734         done
735     done
736     if [ -z "$output" ]; then
737       # pick a default
738       output="english"
739     fi
740     echo $output
743 help() {
744   echo "Rockbox configure script."
745   echo "Invoke this in a directory to generate a Makefile to build Rockbox"
746   echo "Do *NOT* run this within the tools directory!"
747   echo ""
748   cat <<EOF
749   Usage: configure [OPTION]...
750   Options:
751     --target=TARGET   Sets the target, TARGET can be either the target ID or
752                       corresponding string. Run without this option to see all
753                       available targets.
755     --ram=RAM         Sets the RAM for certain targets. Even though any number
756                       is accepted, not every number is correct. The default
757                       value will be applied, if you entered a wrong number
758                       (which depends on the target). Watch the output.  Run
759                       without this option if you are not sure which the right
760                       number is.
762     --type=TYPE       Sets the build type. Shortcuts are also valid.
763                       Run without this option to see all available types.
764                       Multiple values are allowed and managed in the input
765                       order. So --type=b stands for Bootloader build, while
766                       --type=ab stands for "Backlight MOD" build.
768     --language=LANG   Set the language used for voice generation (used only if
769                       TYPE is AV).
771     --tts=ENGINE      Set the TTS engine used for voice generation (used only
772                       if TYPE is AV).
774     --voice=VOICE     Set voice to use with selected TTS (used only if TYPE is
775                       AV).
777     --ttsopts=OPTS    Set TTS engine manual options (used only if TYPE is AV).
779     --encopts=OPTS    Set encoder manual options (used only if ATYPE is AV).
781     --rbdir=dir       Use alternative rockbox directory (default: ${rbdir}).
782                       This is useful for having multiple alternate builds on
783                       your device that you can load with ROLO. However as the
784                       bootloader looks for .rockbox you won't be able to boot
785                       into this build.
787     --ccache          Enable ccache use (done by default these days)
788     --no-ccache       Disable ccache use
790     --eabi            Make configure prefer toolchains that are able to compile
791                       for the new ARM standard abi EABI
792     --no-eabi         The opposite of --eabi (prefer old non-eabi toolchains)
793     --help            Shows this message (must not be used with other options)
797   exit
800 ARG_CCACHE=
801 ARG_ENCOPTS=
802 ARG_LANG=
803 ARG_RAM=
804 ARG_RBDIR=
805 ARG_TARGET=
806 ARG_TTS=
807 ARG_TTSOPTS=
808 ARG_TYPE=
809 ARG_VOICE=
810 ARG_ARM_EABI=
811 err=
812 for arg in "$@"; do
813         case "$arg" in
814                 --ccache)     ARG_CCACHE=1;;
815                 --no-ccache)  ARG_CCACHE=0;;
816                 --encopts=*)  ARG_ENCOPTS=`echo "$arg" | cut -d = -f 2`;;
817                 --language=*) ARG_LANG=`echo "$arg" | cut -d = -f 2`;;
818                 --ram=*)      ARG_RAM=`echo "$arg" | cut -d = -f 2`;;
819                 --rbdir=*)    ARG_RBDIR=`echo "$arg" | cut -d = -f 2`;;
820                 --target=*)   ARG_TARGET=`echo "$arg" | cut -d = -f 2`;;
821                 --tts=*)      ARG_TTS=`echo "$arg" | cut -d = -f 2`;;
822                 --ttsopts=*)  ARG_TTSOPTS=`echo "$arg" | cut -d = -f 2`;;
823                 --type=*)     ARG_TYPE=`echo "$arg" | cut -d = -f 2`;;
824                 --voice=*)    ARG_VOICE=`echo "$arg" | cut -d = -f 2`;;
825                 --eabi)       ARG_ARM_EABI=1;;
826                 --no-eabi)    ARG_ARM_EABI=0;;
827                 --help)       help;;
828                 *)            err=1; echo "[ERROR] Option '$arg' unsupported";;
829         esac
830 done
831 [ "$err" ] && exit 1
833 advopts=
835 if [ "$TMPDIR" != "" ]; then
836   tmpdir=$TMPDIR
837 else
838   tmpdir=/tmp
840 echo Using temporary directory $tmpdir
842 if test -r "configure"; then
843  # this is a check for a configure script in the current directory, it there
844  # is one, try to figure out if it is this one!
846  if { grep "^#   Jukebox" configure >/dev/null 2>&1 ; } then
847    echo "WEEEEEEEEP. Don't run this configure script within the tools directory."
848    echo "It will only cause you pain and grief. Instead do this:"
849    echo ""
850    echo " cd .."
851    echo " mkdir build-dir"
852    echo " cd build-dir"
853    echo " ../tools/configure"
854    echo ""
855    echo "Much happiness will arise from this. Enjoy"
856    exit 5
857  fi
860 # get our current directory
861 pwd=`pwd`;
863 if { echo $pwd | grep " "; } then
864   echo "You're running this script in a path that contains space. The build"
865   echo "system is unfortunately not clever enough to deal with this. Please"
866   echo "run the script from a different path, rename the path or fix the build"
867   echo "system!"
868   exit 6
871 if [ -z "$rootdir" ]; then
872   ##################################################################
873   # Figure out where the source code root is!
874   #
875   rootdir=`dirname $0`/../
877   #####################################################################
878   # Convert the possibly relative directory name to an absolute version
879   #
880   now=`pwd`
881   cd $rootdir
882   rootdir=`pwd`
884   # cd back to the build dir
885   cd $now
888 apps="apps"
889 appsdir='\$(ROOTDIR)/apps'
890 firmdir='\$(ROOTDIR)/firmware'
891 toolsdir='\$(ROOTDIR)/tools'
894 ##################################################################
895 # Figure out target platform
898 if [ "$ARG_TARGET" ]; then
899   buildfor=$ARG_TARGET
900 else
901   echo "Enter target platform:"
902 cat <<EOF
903  ==Archos==               ==iriver==             ==Apple iPod==
904   0) Player/Studio        10) H120/H140          20) Color/Photo
905   1) Recorder             11) H320/H340          21) Nano 1G
906   2) FM Recorder          12) iHP-100/110/115    22) Video
907   3) Recorder v2          13) iFP-790            23) 3G
908   4) Ondio SP             14) H10 20Gb           24) 4G Grayscale
909   5) Ondio FM             15) H10 5/6Gb          25) Mini 1G
910   6) AV300                                       26) Mini 2G
911                           ==Toshiba==            27) 1G, 2G
912  ==Cowon/iAudio==         40) Gigabeat F/X       28) Nano 2G
913  30) X5/X5V/X5L           41) Gigabeat S
914  31) M5/M5L                                      ==SanDisk==
915  32) 7                    ==Olympus=             50) Sansa e200
916  33) D2                   70) M:Robe 500         51) Sansa e200R
917  34) M3/M3L               71) M:Robe 100         52) Sansa c200
918                                                  53) Sansa m200
919  ==Creative==             ==Philips==            54) Sansa c100
920  90) Zen Vision:M 30GB    100) GoGear SA9200     55) Sansa Clip
921  91) Zen Vision:M 60GB    101) GoGear HDD1630/   56) Sansa e200v2
922  92) Zen Vision                HDD1830           57) Sansa m200v4
923                           102) GoGear HDD6330    58) Sansa Fuze
924  ==Onda==                                        59) Sansa c200v2
925  120) VX747               ==Meizu==              60) Sansa Clipv2
926  121) VX767               110) M6SL              61) Sansa View
927  122) VX747+              111) M6SP              62) Sansa Clip+
928  123) VX777               112) M3                63) Sansa Fuze v2
930                                                  ==Logik==
931  ==Samsung==              ==Tatung==             80) DAX 1GB MP3/DAB
932  140) YH-820              150) Elio TPJ-1022
933  141) YH-920                                     ==Lyre project==
934  142) YH-925              ==Packard Bell==       130) Lyre proto 1
935  143) YP-S3               160) Vibe 500          131) Mini2440
937  ==MPIO==
938  170) HD200
941   buildfor=`input`;
944   # Set of tools built for all target platforms:
945   toolset="rdf2binary convbdf codepages"
947   # Toolsets for some target families:
948   archosbitmaptools="$toolset scramble descramble sh2d uclpack bmp2rb"
949   iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb"
950   iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb"
951   ipodbitmaptools="$toolset scramble bmp2rb"
952   gigabeatbitmaptools="$toolset scramble descramble bmp2rb"
953   tccbitmaptools="$toolset scramble bmp2rb"
954   # generic is used by IFP, Meizu and Onda
955   genericbitmaptools="$toolset bmp2rb"
956   # scramble is used by all other targets
957   scramblebitmaptools="$genericbitmaptools scramble"
960   #  ---- For each target ----
961   #
962   #   *Variables*
963   # target_id: a unique number identifying this target, IS NOT the menu number.
964   #            Just use the currently highest number+1 when you add a new
965   #            target.
966   # modelname: short model name used all over to identify this target
967   # memory:    number of megabytes of RAM this target has. If the amount can
968   #            be selected by the size prompt, let memory be unset here
969   # target:    -Ddefine passed to the build commands to make the correct
970   #            config-*.h file get included etc
971   # tool:      the tool that takes a plain binary and converts that into a
972   #            working "firmware" file for your target
973   # output:    the final output file name
974   # boottool:  the tool that takes a plain binary and generates a bootloader
975   #            file for your target (or blank to use $tool)
976   # bootoutput:the final output file name for the bootloader (or blank to use
977   #            $output)
978   # appextra:  passed to the APPEXTRA variable in the Makefiles.
979   #            TODO: add proper explanation
980   # archosrom: used only for Archos targets that build a special flashable .ucl
981   #            image.
982   # flash:     name of output for flashing, for targets where there's a special
983   #            file output for this.
984   # plugins:   set to 'yes' to build the plugins. Early development builds can
985   #            set this to no in the early stages to have an easier life for a
986   #            while
987   # swcodec:   set 'yes' on swcodec targets
988   # toolset:   lists what particular tools in the tools/ directory that this
989   #            target needs to have built prior to building Rockbox
990   #
991   #   *Functions*
992   # *cc:       sets up gcc and compiler options for your target builds. Note
993   #            that if you select a simulator build, the compiler selection is
994   #            overridden later in the script.
996   case $buildfor in
998    0|archosplayer)
999     target_id=1
1000     modelname="archosplayer"
1001     target="-DARCHOS_PLAYER"
1002     shcc
1003     tool="$rootdir/tools/scramble"
1004     output="archos.mod"
1005     appextra="player:gui"
1006     archosrom="$pwd/rombox.ucl"
1007     flash="$pwd/rockbox.ucl"
1008     plugins="yes"
1009     swcodec=""
1011     # toolset is the tools within the tools directory that we build for
1012     # this particular target.
1013     toolset="$toolset scramble descramble sh2d player_unifont uclpack"
1015     # Note: the convbdf is present in the toolset just because: 1) the
1016     # firmware/Makefile assumes it is present always, and 2) we will need it when we
1017     # build the player simulator
1019     t_cpu="sh"
1020     t_manufacturer="archos"
1021     t_model="player"
1022     ;;
1024    1|archosrecorder)
1025     target_id=2
1026     modelname="archosrecorder"
1027     target="-DARCHOS_RECORDER"
1028     shcc
1029     tool="$rootdir/tools/scramble"
1030     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1031     bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
1032     output="ajbrec.ajz"
1033     appextra="recorder:gui"
1034     #archosrom="$pwd/rombox.ucl"
1035     flash="$pwd/rockbox.ucl"
1036     plugins="yes"
1037     swcodec=""
1038     # toolset is the tools within the tools directory that we build for
1039     # this particular target.
1040     toolset=$archosbitmaptools
1041     t_cpu="sh"
1042     t_manufacturer="archos"
1043     t_model="recorder"
1044     ;;
1046    2|archosfmrecorder)
1047     target_id=3
1048     modelname="archosfmrecorder"
1049     target="-DARCHOS_FMRECORDER"
1050     shcc
1051     tool="$rootdir/tools/scramble -fm"
1052     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1053     bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
1054     output="ajbrec.ajz"
1055     appextra="recorder:gui"
1056     #archosrom="$pwd/rombox.ucl"
1057     flash="$pwd/rockbox.ucl"
1058     plugins="yes"
1059     swcodec=""
1060     # toolset is the tools within the tools directory that we build for
1061     # this particular target.
1062     toolset=$archosbitmaptools
1063     t_cpu="sh"
1064     t_manufacturer="archos"
1065     t_model="fm_v2"
1066     ;;
1068    3|archosrecorderv2)
1069     target_id=4
1070     modelname="archosrecorderv2"
1071     target="-DARCHOS_RECORDERV2"
1072     shcc
1073     tool="$rootdir/tools/scramble -v2"
1074     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1075     bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
1076     output="ajbrec.ajz"
1077     appextra="recorder:gui"
1078     #archosrom="$pwd/rombox.ucl"
1079     flash="$pwd/rockbox.ucl"
1080     plugins="yes"
1081     swcodec=""
1082     # toolset is the tools within the tools directory that we build for
1083     # this particular target.
1084     toolset=$archosbitmaptools
1085     t_cpu="sh"
1086     t_manufacturer="archos"
1087     t_model="fm_v2"
1088     ;;
1090    4|archosondiosp)
1091     target_id=7
1092     modelname="archosondiosp"
1093     target="-DARCHOS_ONDIOSP"
1094     shcc
1095     tool="$rootdir/tools/scramble -osp"
1096     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1097     bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
1098     output="ajbrec.ajz"
1099     appextra="recorder:gui"
1100     #archosrom="$pwd/rombox.ucl"
1101     flash="$pwd/rockbox.ucl"
1102     plugins="yes"
1103     swcodec=""
1104     # toolset is the tools within the tools directory that we build for
1105     # this particular target.
1106     toolset=$archosbitmaptools
1107     t_cpu="sh"
1108     t_manufacturer="archos"
1109     t_model="ondio"
1110     ;;
1112    5|archosondiofm)
1113     target_id=8
1114     modelname="archosondiofm"
1115     target="-DARCHOS_ONDIOFM"
1116     shcc
1117     tool="$rootdir/tools/scramble -ofm"
1118     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1119     bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
1120     output="ajbrec.ajz"
1121     appextra="recorder:gui"
1122     #archosrom="$pwd/rombox.ucl"
1123     flash="$pwd/rockbox.ucl"
1124     plugins="yes"
1125     swcodec=""
1126     toolset=$archosbitmaptools
1127     t_cpu="sh"
1128     t_manufacturer="archos"
1129     t_model="ondio"
1130     ;;
1132    6|archosav300)
1133     target_id=38
1134     modelname="archosav300"
1135     target="-DARCHOS_AV300"
1136     memory=16 # always
1137     arm7tdmicc
1138     tool="$rootdir/tools/scramble -mm=C"
1139     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1140     bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1141     output="cjbm.ajz"
1142     appextra="recorder:gui"
1143     plugins="yes"
1144     swcodec=""
1145     # toolset is the tools within the tools directory that we build for
1146     # this particular target.
1147     toolset="$toolset scramble descramble bmp2rb"
1148     # architecture, manufacturer and model for the target-tree build
1149     t_cpu="arm"
1150     t_manufacturer="archos"
1151     t_model="av300"
1152     ;;
1154   10|iriverh120)
1155     target_id=9
1156     modelname="iriverh120"
1157     target="-DIRIVER_H120"
1158     memory=32 # always
1159     coldfirecc
1160     tool="$rootdir/tools/scramble -add=h120"
1161     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1162     bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
1163     bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1164     bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
1165     output="rockbox.iriver"
1166     bootoutput="bootloader.iriver"
1167     appextra="recorder:gui"
1168     flash="$pwd/rombox.iriver"
1169     plugins="yes"
1170     swcodec="yes"
1171     # toolset is the tools within the tools directory that we build for
1172     # this particular target.
1173     toolset=$iriverbitmaptools
1174     t_cpu="coldfire"
1175     t_manufacturer="iriver"
1176     t_model="h100"
1177     ;;
1179    11|iriverh300)
1180     target_id=10
1181     modelname="iriverh300"
1182     target="-DIRIVER_H300"
1183     memory=32 # always
1184     coldfirecc
1185     tool="$rootdir/tools/scramble -add=h300"
1186     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1187     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1188     bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1189     bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
1190     output="rockbox.iriver"
1191     appextra="recorder:gui"
1192     plugins="yes"
1193     swcodec="yes"
1194     # toolset is the tools within the tools directory that we build for
1195     # this particular target.
1196     toolset=$iriverbitmaptools
1197     t_cpu="coldfire"
1198     t_manufacturer="iriver"
1199     t_model="h300"
1200     ;;
1202    12|iriverh100)
1203     target_id=11
1204     modelname="iriverh100"
1205     target="-DIRIVER_H100"
1206     memory=16 # always
1207     coldfirecc
1208     tool="$rootdir/tools/scramble -add=h100"
1209     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1210     bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
1211     bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1212     bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
1213     output="rockbox.iriver"
1214     bootoutput="bootloader.iriver"
1215     appextra="recorder:gui"
1216     flash="$pwd/rombox.iriver"
1217     plugins="yes"
1218     swcodec="yes"
1219     # toolset is the tools within the tools directory that we build for
1220     # this particular target.
1221     toolset=$iriverbitmaptools
1222     t_cpu="coldfire"
1223     t_manufacturer="iriver"
1224     t_model="h100"
1225     ;;
1227    13|iriverifp7xx)
1228     target_id=19
1229     modelname="iriverifp7xx"
1230     target="-DIRIVER_IFP7XX"
1231     memory=1
1232     arm7tdmicc short
1233     tool="cp"
1234     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1235     bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
1236     output="rockbox.wma"
1237     appextra="recorder:gui"
1238     plugins="yes"
1239     swcodec="yes"
1240     # toolset is the tools within the tools directory that we build for
1241     # this particular target.
1242     toolset=$genericbitmaptools
1243     t_cpu="arm"
1244     t_manufacturer="pnx0101"
1245     t_model="iriver-ifp7xx"
1246     ;;
1248    14|iriverh10)
1249     target_id=22
1250     modelname="iriverh10"
1251     target="-DIRIVER_H10"
1252     memory=32 # always
1253     arm7tdmicc
1254     tool="$rootdir/tools/scramble -mi4v3 -model=h10 -type=RBOS"
1255     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1256     bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
1257     output="rockbox.mi4"
1258     appextra="recorder:gui"
1259     plugins="yes"
1260     swcodec="yes"
1261     boottool="$rootdir/tools/scramble -mi4v3 -model=h10 -type=RBBL"
1262     bootoutput="H10_20GC.mi4"
1263     # toolset is the tools within the tools directory that we build for
1264     # this particular target.
1265     toolset=$scramblebitmaptools
1266     # architecture, manufacturer and model for the target-tree build
1267     t_cpu="arm"
1268     t_manufacturer="iriver"
1269     t_model="h10"
1270     ;;
1272    15|iriverh10_5gb)
1273     target_id=24
1274     modelname="iriverh10_5gb"
1275     target="-DIRIVER_H10_5GB"
1276     memory=32 # always
1277     arm7tdmicc
1278     tool="$rootdir/tools/scramble -mi4v2 -model=h105 -type=RBOS"
1279     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1280     bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
1281     output="rockbox.mi4"
1282     appextra="recorder:gui"
1283     plugins="yes"
1284     swcodec="yes"
1285     boottool="$rootdir/tools/scramble -mi4v2 -model=h105 -type=RBBL"
1286     bootoutput="H10.mi4"
1287     # toolset is the tools within the tools directory that we build for
1288     # this particular target.
1289     toolset=$scramblebitmaptools
1290     # architecture, manufacturer and model for the target-tree build
1291     t_cpu="arm"
1292     t_manufacturer="iriver"
1293     t_model="h10"
1294     ;;
1296    20|ipodcolor)
1297     target_id=13
1298     modelname="ipodcolor"
1299     target="-DIPOD_COLOR"
1300     memory=32 # always
1301     arm7tdmicc
1302     tool="$rootdir/tools/scramble -add=ipco"
1303     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1304     bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
1305     output="rockbox.ipod"
1306     appextra="recorder:gui"
1307     plugins="yes"
1308     swcodec="yes"
1309     bootoutput="bootloader-$modelname.ipod"
1310     # toolset is the tools within the tools directory that we build for
1311     # this particular target.
1312     toolset=$ipodbitmaptools
1313     # architecture, manufacturer and model for the target-tree build
1314     t_cpu="arm"
1315     t_manufacturer="ipod"
1316     t_model="color"
1317     ;;
1319    21|ipodnano1g)
1320     target_id=14
1321     modelname="ipodnano1g"
1322     target="-DIPOD_NANO"
1323     memory=32 # always
1324     arm7tdmicc
1325     tool="$rootdir/tools/scramble -add=nano"
1326     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1327     bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
1328     output="rockbox.ipod"
1329     appextra="recorder:gui"
1330     plugins="yes"
1331     swcodec="yes"
1332     bootoutput="bootloader-$modelname.ipod"
1333     # toolset is the tools within the tools directory that we build for
1334     # this particular target.
1335     toolset=$ipodbitmaptools
1336     # architecture, manufacturer and model for the target-tree build
1337     t_cpu="arm"
1338     t_manufacturer="ipod"
1339     t_model="nano"
1340     ;;
1342    22|ipodvideo)
1343     target_id=15
1344     modelname="ipodvideo"
1345     target="-DIPOD_VIDEO"
1346     arm7tdmicc
1347     tool="$rootdir/tools/scramble -add=ipvd"
1348     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1349     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1350     output="rockbox.ipod"
1351     appextra="recorder:gui"
1352     plugins="yes"
1353     swcodec="yes"
1354     bootoutput="bootloader-$modelname.ipod"
1355     # toolset is the tools within the tools directory that we build for
1356     # this particular target.
1357     toolset=$ipodbitmaptools
1358     # architecture, manufacturer and model for the target-tree build
1359     t_cpu="arm"
1360     t_manufacturer="ipod"
1361     t_model="video"
1362     ;;
1364    23|ipod3g)
1365     target_id=16
1366     modelname="ipod3g"
1367     target="-DIPOD_3G"
1368     memory=32 # always
1369     arm7tdmicc
1370     tool="$rootdir/tools/scramble -add=ip3g"
1371     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1372     bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1373     output="rockbox.ipod"
1374     appextra="recorder:gui"
1375     plugins="yes"
1376     swcodec="yes"
1377     bootoutput="bootloader-$modelname.ipod"
1378     # toolset is the tools within the tools directory that we build for
1379     # this particular target.
1380     toolset=$ipodbitmaptools
1381     # architecture, manufacturer and model for the target-tree build
1382     t_cpu="arm"
1383     t_manufacturer="ipod"
1384     t_model="3g"
1385     ;;
1387    24|ipod4g)
1388     target_id=17
1389     modelname="ipod4g"
1390     target="-DIPOD_4G"
1391     memory=32 # always
1392     arm7tdmicc
1393     tool="$rootdir/tools/scramble -add=ip4g"
1394     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1395     bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1396     output="rockbox.ipod"
1397     appextra="recorder:gui"
1398     plugins="yes"
1399     swcodec="yes"
1400     bootoutput="bootloader-$modelname.ipod"
1401     # toolset is the tools within the tools directory that we build for
1402     # this particular target.
1403     toolset=$ipodbitmaptools
1404     # architecture, manufacturer and model for the target-tree build
1405     t_cpu="arm"
1406     t_manufacturer="ipod"
1407     t_model="4g"
1408     ;;
1410    25|ipodmini1g)
1411     target_id=18
1412     modelname="ipodmini1g"
1413     target="-DIPOD_MINI"
1414     memory=32 # always
1415     arm7tdmicc
1416     tool="$rootdir/tools/scramble -add=mini"
1417     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1418     bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1419     output="rockbox.ipod"
1420     appextra="recorder:gui"
1421     plugins="yes"
1422     swcodec="yes"
1423     bootoutput="bootloader-$modelname.ipod"
1424     # toolset is the tools within the tools directory that we build for
1425     # this particular target.
1426     toolset=$ipodbitmaptools
1427     # architecture, manufacturer and model for the target-tree build
1428     t_cpu="arm"
1429     t_manufacturer="ipod"
1430     t_model="mini"
1431     ;;
1433    26|ipodmini2g)
1434     target_id=21
1435     modelname="ipodmini2g"
1436     target="-DIPOD_MINI2G"
1437     memory=32 # always
1438     arm7tdmicc
1439     tool="$rootdir/tools/scramble -add=mn2g"
1440     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1441     bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1442     output="rockbox.ipod"
1443     appextra="recorder:gui"
1444     plugins="yes"
1445     swcodec="yes"
1446     bootoutput="bootloader-$modelname.ipod"
1447     # toolset is the tools within the tools directory that we build for
1448     # this particular target.
1449     toolset=$ipodbitmaptools
1450     # architecture, manufacturer and model for the target-tree build
1451     t_cpu="arm"
1452     t_manufacturer="ipod"
1453     t_model="mini2g"
1454     ;;
1456    27|ipod1g2g)
1457     target_id=29
1458     modelname="ipod1g2g"
1459     target="-DIPOD_1G2G"
1460     memory=32 # always
1461     arm7tdmicc
1462     tool="$rootdir/tools/scramble -add=1g2g"
1463     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1464     bmp2rb_native="$rootdir/tools/bmp2rb -f 6"
1465     output="rockbox.ipod"
1466     appextra="recorder:gui"
1467     plugins="yes"
1468     swcodec="yes"
1469     bootoutput="bootloader-$modelname.ipod"
1470     # toolset is the tools within the tools directory that we build for
1471     # this particular target.
1472     toolset=$ipodbitmaptools
1473     # architecture, manufacturer and model for the target-tree build
1474     t_cpu="arm"
1475     t_manufacturer="ipod"
1476     t_model="1g2g"
1477     ;;
1479    28|ipodnano2g)
1480     target_id=62
1481     modelname="ipodnano2g"
1482     target="-DIPOD_NANO2G"
1483     memory=32 # always
1484     arm940tcc
1485     tool="$rootdir/tools/scramble -add=nn2g"
1486     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1487     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1488     output="rockbox.ipod"
1489     appextra="recorder:gui"
1490     plugins="yes"
1491     swcodec="yes"
1492     bootoutput="bootloader-$modelname.ipod"
1493     # toolset is the tools within the tools directory that we build for
1494     # this particular target.
1495     toolset=$ipodbitmaptools
1496     # architecture, manufacturer and model for the target-tree build
1497     t_cpu="arm"
1498     t_manufacturer="s5l8700"
1499     t_model="ipodnano2g"
1500     ;;
1502    30|iaudiox5)
1503     target_id=12
1504     modelname="iaudiox5"
1505     target="-DIAUDIO_X5"
1506     memory=16 # always
1507     coldfirecc
1508     tool="$rootdir/tools/scramble -add=iax5"
1509     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1510     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1511     bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1512     bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 7"
1513     output="rockbox.iaudio"
1514     appextra="recorder:gui"
1515     plugins="yes"
1516     swcodec="yes"
1517     # toolset is the tools within the tools directory that we build for
1518     # this particular target.
1519     toolset="$iaudiobitmaptools"
1520     # architecture, manufacturer and model for the target-tree build
1521     t_cpu="coldfire"
1522     t_manufacturer="iaudio"
1523     t_model="x5"
1524     ;;
1526    31|iaudiom5)
1527     target_id=28
1528     modelname="iaudiom5"
1529     target="-DIAUDIO_M5"
1530     memory=16 # always
1531     coldfirecc
1532     tool="$rootdir/tools/scramble -add=iam5"
1533     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1534     bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
1535     bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1536     bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 7"
1537     output="rockbox.iaudio"
1538     appextra="recorder:gui"
1539     plugins="yes"
1540     swcodec="yes"
1541     # toolset is the tools within the tools directory that we build for
1542     # this particular target.
1543     toolset="$iaudiobitmaptools"
1544     # architecture, manufacturer and model for the target-tree build
1545     t_cpu="coldfire"
1546     t_manufacturer="iaudio"
1547     t_model="m5"
1548     ;;
1550    32|iaudio7)
1551     target_id=32
1552     modelname="iaudio7"
1553     target="-DIAUDIO_7"
1554     memory=16 # always
1555     arm946cc
1556     tool="$rootdir/tools/scramble -add=i7"
1557     boottool="$rootdir/tools/scramble -tcc=crc"
1558     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1559     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1560     output="rockbox.iaudio"
1561     appextra="recorder:gui"
1562     plugins="yes"
1563     swcodec="yes"
1564     bootoutput="I7_FW.BIN"
1565     # toolset is the tools within the tools directory that we build for
1566     # this particular target.
1567     toolset="$tccbitmaptools"
1568     # architecture, manufacturer and model for the target-tree build
1569     t_cpu="arm"
1570     t_manufacturer="tcc77x"
1571     t_model="iaudio7"
1572     ;;
1574     33|cowond2)
1575     target_id=34
1576     modelname="cowond2"
1577     target="-DCOWON_D2"
1578     memory=32
1579     arm926ejscc
1580     tool="$rootdir/tools/scramble -add=d2"
1581     boottool="cp "
1582     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1583     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1584     output="rockbox.d2"
1585     bootoutput="bootloader-cowond2.bin"
1586     appextra="recorder:gui"
1587     plugins="yes"
1588     swcodec="yes"
1589     toolset="$tccbitmaptools"
1590     # architecture, manufacturer and model for the target-tree build
1591     t_cpu="arm"
1592     t_manufacturer="tcc780x"
1593     t_model="cowond2"
1594     ;;
1595     
1596    34|iaudiom3)
1597     target_id=37
1598     modelname="iaudiom3"
1599     target="-DIAUDIO_M3"
1600     memory=16 # always
1601     coldfirecc
1602     tool="$rootdir/tools/scramble -add=iam3"
1603     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1604     bmp2rb_native="$rootdir/tools/bmp2rb -f 7"
1605     output="rockbox.iaudio"
1606     appextra="recorder:gui"
1607     plugins="yes"
1608     swcodec="yes"
1609     # toolset is the tools within the tools directory that we build for
1610     # this particular target.
1611     toolset="$iaudiobitmaptools"
1612     # architecture, manufacturer and model for the target-tree build
1613     t_cpu="coldfire"
1614     t_manufacturer="iaudio"
1615     t_model="m3"
1616     ;;
1618    40|gigabeatfx)
1619     target_id=20
1620     modelname="gigabeatfx"
1621     target="-DGIGABEAT_F"
1622     memory=32 # always
1623     arm9tdmicc
1624     tool="$rootdir/tools/scramble -add=giga"
1625     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1626     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1627     output="rockbox.gigabeat"
1628     appextra="recorder:gui"
1629     plugins="yes"
1630     swcodec="yes"
1631     toolset=$gigabeatbitmaptools
1632     boottool="$rootdir/tools/scramble -gigabeat"
1633     bootoutput="FWIMG01.DAT"
1634     # architecture, manufacturer and model for the target-tree build
1635     t_cpu="arm"
1636     t_manufacturer="s3c2440"
1637     t_model="gigabeat-fx"
1638     ;;
1640     41|gigabeats)
1641     target_id=26
1642     modelname="gigabeats"
1643     target="-DGIGABEAT_S"
1644     memory=64
1645     arm1136jfscc
1646     tool="$rootdir/tools/scramble -add=gigs"
1647     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1648     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1649     output="rockbox.gigabeat"
1650     appextra="recorder:gui"
1651     plugins="yes"
1652     swcodec="yes"
1653     toolset="$gigabeatbitmaptools"
1654     boottool="$rootdir/tools/scramble -gigabeats"
1655     bootoutput="nk.bin"
1656     # architecture, manufacturer and model for the target-tree build
1657     t_cpu="arm"
1658     t_manufacturer="imx31"
1659     t_model="gigabeat-s"
1660     ;;
1662     70|mrobe500)
1663     target_id=36
1664     modelname="mrobe500"
1665     target="-DMROBE_500"
1666     memory=64 # always
1667     arm926ejscc
1668     tool="$rootdir/tools/scramble -add=m500"
1669     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1670     bmp2rb_native="$rootdir/tools/bmp2rb -f 8"
1671     bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1672     bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
1673     output="rockbox.mrobe500"
1674     appextra="recorder:gui"
1675     plugins="yes"
1676     swcodec="yes"
1677     toolset=$gigabeatbitmaptools
1678     boottool="cp "
1679     bootoutput="rockbox.mrboot"
1680     # architecture, manufacturer and model for the target-tree build
1681     t_cpu="arm"
1682     t_manufacturer="tms320dm320"
1683     t_model="mrobe-500"
1684     ;;
1686    71|mrobe100)
1687     target_id=33
1688     modelname="mrobe100"
1689     target="-DMROBE_100"
1690     memory=32 # always
1691     arm7tdmicc
1692     tool="$rootdir/tools/scramble -mi4v2 -model=m100 -type=RBOS"
1693     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1694     bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
1695     bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
1696     bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
1697     output="rockbox.mi4"
1698     appextra="recorder:gui"
1699     plugins="yes"
1700     swcodec="yes"
1701     boottool="$rootdir/tools/scramble -mi4v2 -model=m100 -type=RBBL"
1702     bootoutput="pp5020.mi4"
1703     # toolset is the tools within the tools directory that we build for
1704     # this particular target.
1705     toolset=$scramblebitmaptools
1706     # architecture, manufacturer and model for the target-tree build
1707     t_cpu="arm"
1708     t_manufacturer="olympus"
1709     t_model="mrobe-100"
1710     ;;
1712    80|logikdax)
1713     target_id=31
1714     modelname="logikdax"
1715     target="-DLOGIK_DAX"
1716     memory=2 # always
1717     arm946cc
1718     tool="$rootdir/tools/scramble -add=ldax"
1719     boottool="$rootdir/tools/scramble -tcc=crc"
1720     bootoutput="player.rom"
1721     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1722     bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
1723     output="rockbox.logik"
1724     appextra="recorder:gui"
1725     plugins=""
1726     swcodec="yes"
1727     # toolset is the tools within the tools directory that we build for
1728     # this particular target.
1729     toolset=$tccbitmaptools
1730     # architecture, manufacturer and model for the target-tree build
1731     t_cpu="arm"
1732     t_manufacturer="tcc77x"
1733     t_model="logikdax"
1734     ;;
1735         
1736     90|zenvisionm30gb)
1737     target_id=35
1738     modelname="zenvisionm30gb"
1739     target="-DCREATIVE_ZVM"
1740     memory=64
1741     arm926ejscc
1742     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1743     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1744     tool="$rootdir/tools/scramble -creative=zvm"
1745     USE_ELF="yes"
1746     output="rockbox.zvm"
1747     appextra="recorder:gui"
1748     plugins="yes"
1749     swcodec="yes"
1750     toolset=$ipodbitmaptools
1751     boottool="$rootdir/tools/scramble -creative=zvm -no-ciff"
1752     bootoutput="rockbox.zvmboot"
1753     # architecture, manufacturer and model for the target-tree build
1754     t_cpu="arm"
1755     t_manufacturer="tms320dm320"
1756     t_model="creative-zvm"
1757     ;;
1758     
1759     91|zenvisionm60gb)
1760     target_id=40
1761     modelname="zenvisionm60gb"
1762     target="-DCREATIVE_ZVM60GB"
1763     memory=64
1764     arm926ejscc
1765     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1766     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1767     tool="$rootdir/tools/scramble -creative=zvm60 -no-ciff"
1768     USE_ELF="yes"
1769     output="rockbox.zvm60"
1770     appextra="recorder:gui"
1771     plugins="yes"
1772     swcodec="yes"
1773     toolset=$ipodbitmaptools
1774     boottool="$rootdir/tools/scramble -creative=zvm60"
1775     bootoutput="rockbox.zvm60boot"
1776     # architecture, manufacturer and model for the target-tree build
1777     t_cpu="arm"
1778     t_manufacturer="tms320dm320"
1779     t_model="creative-zvm"
1780     ;;
1781     
1782     92|zenvision)
1783     target_id=39
1784     modelname="zenvision"
1785     target="-DCREATIVE_ZV"
1786     memory=64
1787     arm926ejscc
1788     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1789     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1790     tool="$rootdir/tools/scramble -creative=zenvision -no-ciff"
1791     USE_ELF="yes"
1792     output="rockbox.zv"
1793     appextra="recorder:gui"
1794     plugins=""
1795     swcodec="yes"
1796     toolset=$ipodbitmaptools
1797     boottool="$rootdir/tools/scramble -creative=zenvision"
1798     bootoutput="rockbox.zvboot"
1799     # architecture, manufacturer and model for the target-tree build
1800     t_cpu="arm"
1801     t_manufacturer="tms320dm320"
1802     t_model="creative-zvm"
1803     ;;
1805    50|sansae200)
1806     target_id=23
1807     modelname="sansae200"
1808     target="-DSANSA_E200"
1809     memory=32 # supposedly
1810     arm7tdmicc
1811     tool="$rootdir/tools/scramble -mi4v3 -model=e200 -type=RBOS"
1812     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1813     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1814     output="rockbox.mi4"
1815     appextra="recorder:gui"
1816     plugins="yes"
1817     swcodec="yes"
1818     boottool="$rootdir/tools/scramble -mi4v3 -model=e200 -type=RBBL"
1819     bootoutput="PP5022.mi4"
1820     # toolset is the tools within the tools directory that we build for
1821     # this particular target.
1822     toolset=$scramblebitmaptools
1823     # architecture, manufacturer and model for the target-tree build
1824     t_cpu="arm"
1825     t_manufacturer="sandisk"
1826     t_model="sansa-e200"
1827     ;;
1829    51|sansae200r)
1830     # the e200R model is pretty much identical to the e200, it only has a
1831     # different option to the scramble tool when building a bootloader and
1832     # makes the bootloader output file name in all lower case.
1833     target_id=27
1834     modelname="sansae200r"
1835     target="-DSANSA_E200"
1836     memory=32 # supposedly
1837     arm7tdmicc
1838     tool="$rootdir/tools/scramble -mi4v3 -model=e20r -type=RBOS"
1839     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1840     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1841     output="rockbox.mi4"
1842     appextra="recorder:gui"
1843     plugins="yes"
1844     swcodec="yes"
1845     boottool="$rootdir/tools/scramble -mi4r -model=e20r -type=RBBL"
1846     bootoutput="pp5022.mi4"
1847     # toolset is the tools within the tools directory that we build for
1848     # this particular target.
1849     toolset=$scramblebitmaptools
1850     # architecture, manufacturer and model for the target-tree build
1851     t_cpu="arm"
1852     t_manufacturer="sandisk"
1853     t_model="sansa-e200"
1854     ;;
1856    52|sansac200)
1857     target_id=30
1858     modelname="sansac200"
1859     target="-DSANSA_C200"
1860     memory=32 # supposedly
1861     arm7tdmicc
1862     tool="$rootdir/tools/scramble -mi4v3 -model=c200 -type=RBOS"
1863     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1864     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1865     output="rockbox.mi4"
1866     appextra="recorder:gui"
1867     plugins="yes"
1868     swcodec="yes"
1869     boottool="$rootdir/tools/scramble -mi4v3 -model=c200 -type=RBBL"
1870     bootoutput="firmware.mi4"
1871     # toolset is the tools within the tools directory that we build for
1872     # this particular target.
1873     toolset=$scramblebitmaptools
1874     # architecture, manufacturer and model for the target-tree build
1875     t_cpu="arm"
1876     t_manufacturer="sandisk"
1877     t_model="sansa-c200"
1878     ;;
1880    53|sansam200)
1881     target_id=48
1882     modelname="sansam200"
1883     target="-DSANSA_M200"
1884     memory=1 # always
1885     arm946cc
1886     tool="$rootdir/tools/scramble -add=m200"
1887     boottool="$rootdir/tools/scramble -tcc=crc"
1888     bootoutput="player.rom"
1889     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1890     bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
1891     output="rockbox.m200"
1892     appextra="recorder:gui"
1893     plugins=""
1894     swcodec="yes"
1895     # toolset is the tools within the tools directory that we build for
1896     # this particular target.
1897     toolset=$tccbitmaptools
1898     # architecture, manufacturer and model for the target-tree build
1899     t_cpu="arm"
1900     t_manufacturer="tcc77x"
1901     t_model="m200"
1902     ;;
1904    54|sansac100)
1905     target_id=42 
1906     modelname="sansac100" 
1907     target="-DSANSA_C100"     
1908     memory=2
1909     arm946cc
1910     tool="$rootdir/tools/scramble -add=c100"
1911     boottool="$rootdir/tools/scramble -tcc=crc"
1912     bootoutput="player.rom"
1913     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1914     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1915     output="rockbox.c100"
1916     appextra="recorder:gui"
1917     plugins=""
1918     swcodec="yes"
1919     # toolset is the tools within the tools directory that we build for
1920     # this particular target.
1921     toolset=$tccbitmaptools
1922     # architecture, manufacturer and model for the target-tree build
1923     t_cpu="arm"
1924     t_manufacturer="tcc77x"
1925     t_model="c100"
1926     ;;
1928    55|sansaclip)
1929     target_id=50
1930     modelname="sansaclip"
1931     target="-DSANSA_CLIP"
1932     memory=2
1933     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1934     bmp2rb_native="$bmp2rb_mono"
1935     tool="$rootdir/tools/scramble -add=clip"
1936     output="rockbox.sansa"
1937     bootoutput="bootloader-clip.sansa"
1938     appextra="recorder:gui"
1939     plugins="yes"
1940     swcodec="yes"
1941     toolset=$scramblebitmaptools
1942     t_cpu="arm"
1943     t_manufacturer="as3525"
1944     t_model="sansa-clip"
1945     arm9tdmicc
1946     ;;
1949    56|sansae200v2)
1950     target_id=51
1951     modelname="sansae200v2"
1952     target="-DSANSA_E200V2"
1953     memory=8
1954     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1955     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1956     tool="$rootdir/tools/scramble -add=e2v2"
1957     output="rockbox.sansa"
1958     bootoutput="bootloader-e200v2.sansa"
1959     appextra="recorder:gui"
1960     plugins="yes"
1961     swcodec="yes"
1962     toolset=$scramblebitmaptools
1963     t_cpu="arm"
1964     t_manufacturer="as3525"
1965     t_model="sansa-e200v2"
1966     arm9tdmicc
1967     ;;
1970    57|sansam200v4)
1971     target_id=52
1972     modelname="sansam200v4"
1973     target="-DSANSA_M200V4"
1974     memory=2
1975     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1976     bmp2rb_native="$bmp2rb_mono"
1977     tool="$rootdir/tools/scramble -add=m2v4"
1978     output="rockbox.sansa"
1979     bootoutput="bootloader-m200v4.sansa"
1980     appextra="recorder:gui"
1981     plugins="yes"
1982     swcodec="yes"
1983     toolset=$scramblebitmaptools
1984     t_cpu="arm"
1985     t_manufacturer="as3525"
1986     t_model="sansa-m200v4"
1987     arm9tdmicc
1988     ;;
1991    58|sansafuze)
1992     target_id=53
1993     modelname="sansafuze"
1994     target="-DSANSA_FUZE"
1995     memory=8
1996     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1997     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
1998     tool="$rootdir/tools/scramble -add=fuze"
1999     output="rockbox.sansa"
2000     bootoutput="bootloader-fuze.sansa"
2001     appextra="recorder:gui"
2002     plugins="yes"
2003     swcodec="yes"
2004     toolset=$scramblebitmaptools
2005     t_cpu="arm"
2006     t_manufacturer="as3525"
2007     t_model="sansa-fuze"
2008     arm9tdmicc
2009     ;;
2012    59|sansac200v2)
2013     target_id=55
2014     modelname="sansac200v2"
2015     target="-DSANSA_C200V2"
2016     memory=2 # as per OF diagnosis mode
2017     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2018     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2019     tool="$rootdir/tools/scramble -add=c2v2"
2020     output="rockbox.sansa"
2021     bootoutput="bootloader-c200v2.sansa"
2022     appextra="recorder:gui"
2023     plugins="yes"
2024     swcodec="yes"
2025     # toolset is the tools within the tools directory that we build for
2026     # this particular target.
2027     toolset=$scramblebitmaptools
2028     # architecture, manufacturer and model for the target-tree build
2029     t_cpu="arm"
2030     t_manufacturer="as3525"
2031     t_model="sansa-c200v2"
2032     arm9tdmicc
2033     ;;
2035    60|sansaclipv2)
2036     target_id=60
2037     modelname="sansaclipv2"
2038     target="-DSANSA_CLIPV2"
2039     memory=8
2040     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2041     bmp2rb_native="$bmp2rb_mono"
2042     tool="$rootdir/tools/scramble -add=clv2"
2043     output="rockbox.sansa"
2044     bootoutput="bootloader-clipv2.sansa"
2045     appextra="recorder:gui"
2046     plugins="yes"
2047     swcodec="yes"
2048     toolset=$scramblebitmaptools
2049     t_cpu="arm"
2050     t_manufacturer="as3525"
2051     t_model="sansa-clipv2"
2052     arm926ejscc
2053     ;;
2055    61|sansaview)
2056     echo "Sansa View is not yet supported!"
2057     exit 1
2058     target_id=63
2059     modelname="sansaview"
2060     target="-DSANSA_VIEW"
2061     memory=32
2062     arm1176jzscc
2063     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2064     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2065     output="rockbox.mi4"
2066     appextra="gui"
2067     plugins=""
2068     swcodec="yes"
2069     boottool="$rootdir/tools/scramble -mi4v3 -model=view -type=RBBL"
2070     bootoutput="firmware.mi4"
2071     # toolset is the tools within the tools directory that we build for
2072     # this particular target.
2073     toolset=$scramblebitmaptools
2074     t_cpu="arm"
2075     t_manufacturer="sandisk"
2076     t_model="sansa-view"
2077     ;;
2079    62|sansaclipplus)
2080     target_id=66
2081     modelname="sansaclipplus"
2082     target="-DSANSA_CLIPPLUS"
2083     memory=8
2084     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2085     bmp2rb_native="$bmp2rb_mono"
2086     tool="$rootdir/tools/scramble -add=cli+"
2087     output="rockbox.sansa"
2088     bootoutput="bootloader-clipplus.sansa"
2089     appextra="recorder:gui"
2090     plugins="yes"
2091     swcodec="yes"
2092     toolset=$scramblebitmaptools
2093     t_cpu="arm"
2094     t_manufacturer="as3525"
2095     t_model="sansa-clipplus"
2096     arm926ejscc
2097     ;;
2099    63|sansafuzev2)
2100     target_id=68
2101     modelname="sansafuzev2"
2102     target="-DSANSA_FUZEV2"
2103     memory=8 # not sure
2104     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2105     bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
2106     tool="$rootdir/tools/scramble -add=fuz2"
2107     output="rockbox.sansa"
2108     bootoutput="bootloader-fuzev2.sansa"
2109     appextra="recorder:gui"
2110     plugins="yes"
2111     swcodec="yes"
2112     toolset=$scramblebitmaptools
2113     t_cpu="arm"
2114     t_manufacturer="as3525"
2115     t_model="sansa-fuzev2"
2116     arm926ejscc
2117     ;;
2119    150|tatungtpj1022)
2120     target_id=25
2121     modelname="tatungtpj1022"
2122     target="-DTATUNG_TPJ1022"
2123     memory=32 # always
2124     arm7tdmicc
2125     tool="$rootdir/tools/scramble -add tpj2"
2126     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2127     bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
2128     output="rockbox.elio"
2129     appextra="recorder:gui"
2130     plugins="yes"
2131     swcodec="yes"
2132     boottool="$rootdir/tools/scramble -mi4v2"
2133     bootoutput="pp5020.mi4"
2134     # toolset is the tools within the tools directory that we build for
2135     # this particular target.
2136     toolset=$scramblebitmaptools
2137     # architecture, manufacturer and model for the target-tree build
2138     t_cpu="arm"
2139     t_manufacturer="tatung"
2140     t_model="tpj1022"
2141     ;;
2143    100|gogearsa9200)
2144     target_id=41
2145     modelname="gogearsa9200"
2146     target="-DPHILIPS_SA9200"
2147     memory=32 # supposedly
2148     arm7tdmicc
2149     tool="$rootdir/tools/scramble -mi4v3 -model=9200 -type=RBOS"
2150     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2151     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2152     output="rockbox.mi4"
2153     appextra="recorder:gui"
2154     plugins=""
2155     swcodec="yes"
2156     boottool="$rootdir/tools/scramble -mi4v3 -model=9200 -type=RBBL"
2157     bootoutput="FWImage.ebn"
2158     # toolset is the tools within the tools directory that we build for
2159     # this particular target.
2160     toolset=$scramblebitmaptools
2161     # architecture, manufacturer and model for the target-tree build
2162     t_cpu="arm"
2163     t_manufacturer="philips"
2164     t_model="sa9200"
2165     ;;
2167    101|gogearhdd1630)
2168     target_id=43
2169     modelname="gogearhdd1630"
2170     target="-DPHILIPS_HDD1630"
2171     memory=32 # supposedly
2172     arm7tdmicc
2173     tool="$rootdir/tools/scramble -mi4v3 -model=1630 -type=RBOS"
2174     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2175     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2176     output="rockbox.mi4"
2177     appextra="recorder:gui"
2178     plugins="yes"
2179     swcodec="yes"
2180     boottool="$rootdir/tools/scramble -mi4v3 -model=1630 -type=RBBL"
2181     bootoutput="FWImage.ebn"
2182     # toolset is the tools within the tools directory that we build for
2183     # this particular target.
2184     toolset=$scramblebitmaptools
2185     # architecture, manufacturer and model for the target-tree build
2186     t_cpu="arm"
2187     t_manufacturer="philips"
2188     t_model="hdd1630"
2189     ;;
2191    102|gogearhdd6330)
2192     target_id=65
2193     modelname="gogearhdd6330"
2194     target="-DPHILIPS_HDD6330"
2195     memory=32 # supposedly
2196     arm7tdmicc
2197     tool="$rootdir/tools/scramble -mi4v3 -model=6330 -type=RBOS"
2198     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2199     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2200     output="rockbox.mi4"
2201     appextra="recorder:gui"
2202     plugins=""
2203     swcodec="yes"
2204     boottool="$rootdir/tools/scramble -mi4v3 -model=6330 -type=RBBL"
2205     bootoutput="FWImage.ebn"
2206     # toolset is the tools within the tools directory that we build for
2207     # this particular target.
2208     toolset=$scramblebitmaptools
2209     # architecture, manufacturer and model for the target-tree build
2210     t_cpu="arm"
2211     t_manufacturer="philips"
2212     t_model="hdd6330"
2213     ;;
2215    110|meizum6sl)
2216     target_id=49
2217     modelname="meizum6sl"
2218     target="-DMEIZU_M6SL"
2219     memory=16 # always
2220     arm940tbecc
2221     tool="cp"
2222     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2223     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2224     output="rockbox.meizu"
2225     appextra="recorder:gui"
2226     plugins="no" #FIXME
2227     swcodec="yes"
2228     toolset=$genericbitmaptools
2229     boottool="cp"
2230     bootoutput="rockboot.ebn"
2231     # architecture, manufacturer and model for the target-tree build
2232     t_cpu="arm"
2233     t_manufacturer="s5l8700"
2234     t_model="meizu-m6sl"
2235     ;;
2236     
2237    111|meizum6sp)
2238     target_id=46
2239     modelname="meizum6sp"
2240     target="-DMEIZU_M6SP"
2241     memory=16 # always
2242     arm940tbecc
2243     tool="cp"
2244     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2245     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2246     output="rockbox.meizu"
2247     appextra="recorder:gui"
2248     plugins="no" #FIXME
2249     swcodec="yes"
2250     toolset=$genericbitmaptools
2251     boottool="cp"
2252     bootoutput="rockboot.ebn"
2253     # architecture, manufacturer and model for the target-tree build
2254     t_cpu="arm"
2255     t_manufacturer="s5l8700"
2256     t_model="meizu-m6sp"
2257     ;;
2258     
2259    112|meizum3)
2260     target_id=47
2261     modelname="meizum3"
2262     target="-DMEIZU_M3"
2263     memory=16 # always
2264     arm940tbecc
2265     tool="cp"
2266     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2267     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2268     output="rockbox.meizu"
2269     appextra="recorder:gui"
2270     plugins="no" #FIXME
2271     swcodec="yes"
2272     toolset=$genericbitmaptools
2273     boottool="cp"
2274     bootoutput="rockboot.ebn"
2275     # architecture, manufacturer and model for the target-tree build
2276     t_cpu="arm"
2277     t_manufacturer="s5l8700"
2278     t_model="meizu-m3"
2279     ;;
2280     
2281     120|ondavx747)
2282     target_id=45
2283     modelname="ondavx747"
2284     target="-DONDA_VX747"
2285     memory=16
2286     mipselcc
2287     tool="$rootdir/tools/scramble -add=x747"
2288     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2289     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2290     output="rockbox.vx747"
2291     appextra="recorder:gui"
2292     plugins="yes"
2293     swcodec="yes"
2294     toolset=$genericbitmaptools
2295     boottool="$rootdir/tools/scramble -ccpmp"
2296     bootoutput="ccpmp.bin"
2297     # architecture, manufacturer and model for the target-tree build
2298     t_cpu="mips"
2299     t_manufacturer="ingenic_jz47xx"
2300     t_model="onda_vx747"
2301     ;;
2302     
2303     121|ondavx767)
2304     target_id=64
2305     modelname="ondavx767"
2306     target="-DONDA_VX767"
2307     memory=16 #FIXME
2308     mipselcc
2309     tool="cp"
2310     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2311     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2312     output="rockbox.vx767"
2313     appextra="recorder:gui"
2314     plugins="" #FIXME
2315     swcodec="yes"
2316     toolset=$genericbitmaptools
2317     boottool="$rootdir/tools/scramble -ccpmp"
2318     bootoutput="ccpmp.bin"
2319     # architecture, manufacturer and model for the target-tree build
2320     t_cpu="mips"
2321     t_manufacturer="ingenic_jz47xx"
2322     t_model="onda_vx767"
2323     ;;
2324     
2325     122|ondavx747p)
2326     target_id=54
2327     modelname="ondavx747p"
2328     target="-DONDA_VX747P"
2329     memory=16
2330     mipselcc
2331     tool="$rootdir/tools/scramble -add=747p"
2332     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2333     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2334     output="rockbox.vx747p"
2335     appextra="recorder:gui"
2336     plugins="yes"
2337     swcodec="yes"
2338     toolset=$genericbitmaptools
2339     boottool="$rootdir/tools/scramble -ccpmp"
2340     bootoutput="ccpmp.bin"
2341     # architecture, manufacturer and model for the target-tree build
2342     t_cpu="mips"
2343     t_manufacturer="ingenic_jz47xx"
2344     t_model="onda_vx747"
2345     ;;
2346     
2347     123|ondavx777)
2348     target_id=61
2349     modelname="ondavx777"
2350     target="-DONDA_VX777"
2351     memory=16
2352     mipselcc
2353     tool="$rootdir/tools/scramble -add=x777"
2354     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2355     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2356     output="rockbox.vx777"
2357     appextra="recorder:gui"
2358     plugins="yes"
2359     swcodec="yes"
2360     toolset=$genericbitmaptools
2361     boottool="$rootdir/tools/scramble -ccpmp"
2362     bootoutput="ccpmp.bin"
2363     # architecture, manufacturer and model for the target-tree build
2364     t_cpu="mips"
2365     t_manufacturer="ingenic_jz47xx"
2366     t_model="onda_vx747"
2367     ;;
2368     
2369     130|lyreproto1)
2370     target_id=56
2371     modelname="lyreproto1"
2372     target="-DLYRE_PROTO1"
2373     memory=64
2374     arm926ejscc
2375     tool="cp"
2376     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2377     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2378     output="rockbox.lyre"
2379     appextra="recorder:gui"
2380     plugins=""
2381     swcodec="yes"
2382     toolset=$scramblebitmaptools
2383     boottool="cp"
2384     bootoutput="bootloader-proto1.lyre"
2385     # architecture, manufacturer and model for the target-tree build
2386     t_cpu="arm"
2387     t_manufacturer="at91sam"
2388     t_model="lyre_proto1"
2389     ;;
2390     
2391    131|mini2440)
2392     target_id=99
2393     modelname="mini2440"
2394     target="-DMINI2440"
2395     memory=64
2396     arm9tdmicc
2397     tool="$rootdir/tools/scramble -add=m244"
2398     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2399     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2400     output="rockbox.mini2440"
2401     appextra="recorder:gui"
2402     plugins=""
2403     swcodec="yes"
2404     toolset=$scramblebitmaptools
2405     boottool="cp"
2406     bootoutput="bootloader-mini2440.lyre"
2407     # architecture, manufacturer and model for the target-tree build
2408     t_cpu="arm"
2409     t_manufacturer="s3c2440"
2410     t_model="mini2440"
2411     ;;
2413    140|samsungyh820)
2414     target_id=57
2415     modelname="samsungyh820"
2416     target="-DSAMSUNG_YH820"
2417     memory=32 # always
2418     arm7tdmicc
2419     tool="$rootdir/tools/scramble -mi4v2 -model=y820 -type=RBOS"
2420     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2421     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2422     output="rockbox.mi4"
2423     appextra="recorder:gui"
2424     plugins="yes"
2425     swcodec="yes"
2426     boottool="$rootdir/tools/scramble -mi4v2 -model=y820 -type=RBBL"
2427     bootoutput="FW_YH820.mi4"
2428     # toolset is the tools within the tools directory that we build for
2429     # this particular target.
2430     toolset=$scramblebitmaptools
2431     # architecture, manufacturer and model for the target-tree build
2432     t_cpu="arm"
2433     t_manufacturer="samsung"
2434     t_model="yh820"
2435     ;;
2437    141|samsungyh920)
2438     target_id=58
2439     modelname="samsungyh920"
2440     target="-DSAMSUNG_YH920"
2441     memory=32 # always
2442     arm7tdmicc
2443     tool="$rootdir/tools/scramble -mi4v2 -model=y920 -type=RBOS"
2444     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2445     bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
2446     output="rockbox.mi4"
2447     appextra="recorder:gui"
2448     plugins="yes"
2449     swcodec="yes"
2450     boottool="$rootdir/tools/scramble -mi4v2 -model=y920 -type=RBBL"
2451     bootoutput="PP5020.mi4"
2452     # toolset is the tools within the tools directory that we build for
2453     # this particular target.
2454     toolset=$scramblebitmaptools
2455     # architecture, manufacturer and model for the target-tree build
2456     t_cpu="arm"
2457     t_manufacturer="samsung"
2458     t_model="yh920"
2459     ;;
2461    142|samsungyh925)
2462     target_id=59
2463     modelname="samsungyh925"
2464     target="-DSAMSUNG_YH925"
2465     memory=32 # always
2466     arm7tdmicc
2467     tool="$rootdir/tools/scramble -mi4v2 -model=y925 -type=RBOS"
2468     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2469     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2470     output="rockbox.mi4"
2471     appextra="recorder:gui"
2472     plugins="yes"
2473     swcodec="yes"
2474     boottool="$rootdir/tools/scramble -mi4v2 -model=y925 -type=RBBL"
2475     bootoutput="FW_YH925.mi4"
2476     # toolset is the tools within the tools directory that we build for
2477     # this particular target.
2478     toolset=$scramblebitmaptools
2479     # architecture, manufacturer and model for the target-tree build
2480     t_cpu="arm"
2481     t_manufacturer="samsung"
2482     t_model="yh925"
2483     ;;
2485    143|samsungyps3)
2486     target_id=60
2487     modelname="samsungyps3"
2488     target="-DSAMSUNG_YPS3"
2489     memory=16 # always
2490     arm940tbecc
2491     tool="cp"
2492     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2493     bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
2494     output="rockbox.yps3"
2495     appextra="recorder:gui"
2496     plugins="no" #FIXME
2497     swcodec="yes"
2498     toolset=$genericbitmaptools
2499     boottool="cp"
2500     bootoutput="rockboot.ebn"
2501     # architecture, manufacturer and model for the target-tree build
2502     t_cpu="arm"
2503     t_manufacturer="s5l8700"
2504     t_model="yps3"
2505     ;;
2506     
2507    160|vibe500)
2508     target_id=67
2509     modelname="vibe500"
2510     target="-DPBELL_VIBE500"
2511     memory=32 # always
2512     arm7tdmicc
2513     tool="$rootdir/tools/scramble -mi4v3 -model=v500 -type=RBOS"
2514     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2515     bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
2516     output="rockbox.mi4"
2517     appextra="recorder:gui"
2518     plugins="yes"
2519     swcodec="yes"
2520     boottool="$rootdir/tools/scramble -mi4v3 -model=v500 -type=RBBL"
2521     bootoutput="jukebox.mi4"
2522     # toolset is the tools within the tools directory that we build for
2523     # this particular target.
2524     toolset=$scramblebitmaptools
2525     # architecture, manufacturer and model for the target-tree build
2526     t_cpu="arm"
2527     t_manufacturer="pbell"
2528     t_model="vibe500"
2529     ;;
2531    170|hd200)
2532     target_id=69
2533     modelname="mpiohd200"
2534     target="-DMPIO_HD200"
2535     memory=16 # always
2536     coldfirecc
2537     tool="$rootdir/tools/scramble -add=hd20"
2538     bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
2539     bmp2rb_native="$rootdir/tools/bmp2rb -f 7"
2540     output="rockbox.mpio"
2541     bootoutput="bootloader.mpio"
2542     appextra="recorder:gui"
2543     plugins="yes"
2544     swcodec="yes"
2545     # toolset is the tools within the tools directory that we build for
2546     # this particular target.
2547     toolset="$genericbitmaptools"
2548     # architecture, manufacturer and model for the target-tree build
2549     t_cpu="coldfire"
2550     t_manufacturer="mpio"
2551     t_model="hd200"
2552     ;;
2554    *)
2555     echo "Please select a supported target platform!"
2556     exit 7
2557     ;;
2559   esac
2561   echo "Platform set to $modelname"
2564 #remove start
2565 ############################################################################
2566 # Amount of memory, for those that can differ. They have $memory unset at
2567 # this point.
2570 if [ -z "$memory" ]; then
2571   case $target_id in
2572   15)
2573     if [ "$ARG_RAM" ]; then
2574       size=$ARG_RAM
2575     else
2576       echo "Enter size of your RAM (in MB): (Defaults to 32)"
2577       size=`input`;
2578     fi
2579     case $size in
2580     60|64)
2581       memory="64"
2582       ;;
2583     *)
2584       memory="32"
2585       ;;
2586     esac
2587     ;;
2588   *)
2589     if [ "$ARG_RAM" ]; then
2590       size=$ARG_RAM
2591     else
2592       echo "Enter size of your RAM (in MB): (Defaults to 2)"
2593       size=`input`;
2594     fi
2595     case $size in
2596     8)
2597       memory="8"
2598       ;;
2599     *)
2600       memory="2"
2601       ;;
2602     esac
2603     ;;
2604   esac
2605   echo "Memory size selected: $memory MB"
2606   [ "$ARG_TYPE" ] || echo ""
2608 #remove end
2610 ##################################################################
2611 # Figure out build "type"
2614   # the ifp7x0 is the only platform that supports building a gdb stub like
2615   # this
2616 case $modelname in
2617   iriverifp7xx)
2618      gdbstub="(G)DB stub, "
2619      ;;
2620   sansae200r|sansae200)
2621      gdbstub="(I)nstaller, "
2622      ;;
2623   sansac200)
2624      gdbstub="(E)raser, "
2625      ;;
2626   *)
2627      ;;
2628 esac
2629 if [ "$ARG_TYPE" ]; then
2630   btype=$ARG_TYPE
2631 else
2632   echo "Build (N)ormal, (A)dvanced, (S)imulator, (B)ootloader, (C)heckWPS, (D)atabase tool, $gdbstub(M)anual: (Defaults to N)"
2633   btype=`input`;
2636   case $btype in
2637     [Ii])
2638       appsdir='\$(ROOTDIR)/bootloader'
2639       apps="bootloader"
2640       extradefines="-DBOOTLOADER -DE200R_INSTALLER -ffunction-sections -fdata-sections"
2641       bootloader="1"
2642       echo "e200R-installer build selected"
2643       ;;
2644     [Ee])
2645       appsdir='\$(ROOTDIR)/bootloader'
2646       apps="bootloader"
2647       echo "C2(4)0 or C2(5)0"
2648       variant=`input`
2649       case $variant in
2650         4)
2651            extradefines="-DBOOTLOADER -DC200_ERASE -DC240_ERASE -ffunction-sections -fdata-sections"
2652            echo "c240 eraser build selected"
2653         ;;
2654         5)
2655            extradefines="-DBOOTLOADER -DC200_ERASE -DC250_ERASE -ffunction-sections -fdata-sections"
2656            echo "c240 eraser build selected"
2657         ;;
2658       esac
2659       bootloader="1"
2660       echo "c200 eraser build selected"
2661       ;;
2662     [Bb])
2663       if test $t_manufacturer = "archos"; then
2664           # Archos SH-based players do this somewhat differently for
2665           # some reason
2666           appsdir='\$(ROOTDIR)/flash/bootbox'
2667           apps="bootbox"
2668       else
2669           appsdir='\$(ROOTDIR)/bootloader'
2670           apps="bootloader"
2671           flash=""
2672           if test -n "$boottool"; then
2673               tool="$boottool"
2674           fi
2675           if test -n "$bootoutput"; then
2676               output=$bootoutput
2677           fi
2678       fi
2679       extradefines="-DBOOTLOADER -ffunction-sections -fdata-sections"
2680       bootloader="1"
2681       echo "Bootloader build selected"
2682       ;;
2683     [Ss])
2684       if [ "$modelname" = "sansae200r" ]; then
2685           echo "Do not use the e200R target for simulator builds.  Use e200 instead."
2686           exit 8
2687       fi
2688       debug="-DDEBUG"
2689       simulator="yes"
2690       extradefines="-DSIMULATOR"
2691       archosrom=""
2692       flash=""
2693       echo "Simulator build selected"
2694       ;;
2695     [Aa]*)
2696       echo "Advanced build selected"
2697       whichadvanced $btype
2698       ;;
2699     [Gg])
2700       extradefines="-DSTUB" # for target makefile symbol EXTRA_DEFINES
2701       appsdir='\$(ROOTDIR)/gdb'
2702       apps="stub"
2703       case $modelname in
2704           iriverifp7xx)
2705               output="stub.wma"
2706               ;;
2707           *)
2708               ;;
2709       esac
2710       echo "GDB stub build selected"
2711       ;;
2712     [Mm])
2713       toolset='';
2714       apps="manual"
2715       echo "Manual build selected"
2716       ;;
2717     [Cc])
2718       uname=`uname`
2719       simcc "checkwps"
2720       toolset='';
2721       t_cpu='';
2722       GCCOPTS='';
2723       extradefines="-DDEBUG"
2724       appsdir='\$(ROOTDIR)/tools/checkwps';
2725       output='checkwps.'${modelname};
2726       archosrom='';
2727       echo "CheckWPS build selected"
2728       ;;
2729     [Dd])
2730       uname=`uname`
2731       simcc "database"
2732       toolset='';
2733       t_cpu='';
2734       GCCOPTS='';
2735       appsdir='\$(ROOTDIR)/tools/database';
2736       archosrom='';
2738       case $uname in
2739           CYGWIN*|MINGW*)
2740               output="database_${modelname}.exe"
2741               ;;
2742           *)
2743               output='database.'${modelname};
2744               ;;
2745       esac
2747       echo "Database tool build selected"
2748       ;;
2749     *)
2750       if [ "$modelname" = "sansae200r" ]; then
2751           echo "Do not use the e200R target for regular builds.  Use e200 instead."
2752           exit 8
2753       fi
2754       debug=""
2755       btype="N" # set it explicitly since RET only gets here as well
2756       echo "Normal build selected"
2757       ;;
2759   esac
2760   # to be able running "make manual" from non-manual configuration
2761   case $modelname in
2762       archosrecorderv2)
2763           manualdev="archosfmrecorder"
2764           ;;
2765       iriverh1??)
2766           manualdev="iriverh100"
2767           ;;
2768       ipodmini2g)
2769           manualdev="ipodmini1g"
2770           ;;
2771       *)
2772           manualdev=$modelname
2773           ;;
2774   esac
2776 if [ -z "$debug" ]; then
2777   GCCOPTS="$GCCOPTS $GCCOPTIMIZE"
2780 echo "Using source code root directory: $rootdir"
2782 # this was once possible to change at build-time, but no more:
2783 language="english"
2785 uname=`uname`
2787 if [ "yes" = "$simulator" ]; then
2788   # setup compiler and things for simulator
2789   simcc "sdl"
2791   if [ -d "simdisk" ]; then
2792     echo "Subdirectory 'simdisk' already present"
2793   else
2794     mkdir simdisk
2795     echo "Created a 'simdisk' subdirectory for simulating the hard disk"
2796   fi
2799 # Now, figure out version number of the (gcc) compiler we are about to use
2800 gccver=`$CC -dumpversion`;
2802 # figure out the binutil version too and display it, mostly for the build
2803 # system etc to be able to see it easier
2804 if [ $uname = "Darwin" ]; then
2805  ldver=`$LD -v 2>&1 | sed -e 's/[^0-9.-]//g'`
2806 else
2807  ldver=`$LD --version | head -n 1 | sed -e 's/[^0-9.]//g'`
2810 if [ -z "$gccver" ]; then
2811   echo "[WARNING] The compiler you must use ($CC) is not in your path!"
2812   echo "[WARNING] this may cause your build to fail since we cannot do the"
2813   echo "[WARNING] checks we want now."
2814 else
2816   # gccver should now be "3.3.5", "3.4.3", "2.95.3-6" and similar, but don't
2817   # DEPEND on it
2819  num1=`echo $gccver | cut -d . -f1`
2820  num2=`echo $gccver | cut -d . -f2`
2821  gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
2823  # This makes:
2824  # 3.3.X  => 303
2825  # 3.4.X  => 304
2826  # 2.95.3 => 295
2828  echo "Using $CC $gccver ($gccnum)"
2830  if test "$gccnum" -ge "400"; then
2831    # gcc 4.0 is just *so* much pickier on arguments that differ in signedness
2832    # so we ignore that warnings for now
2833    # -Wno-pointer-sign
2834    GCCOPTS="$GCCOPTS -Wno-pointer-sign"
2835  fi
2837  if test "$gccnum" -ge "402"; then
2838    # disable warning about "warning: initialized field overwritten" as gcc 4.2
2839    # and later would throw it for several valid cases
2840    GCCOPTS="$GCCOPTS -Wno-override-init"
2841  fi
2843  case $prefix in
2844    "")
2845      # simulator
2846    ;;
2847    i586-mingw32msvc-)
2848      # cross-compile for win32
2849    ;;
2850    *)
2851    # Verify that the cross-compiler is of a recommended version!
2852    if test "$gccver" != "$gccchoice"; then
2853      echo "WARNING: Your cross-compiler $CC $gccver is not of the recommended"
2854      echo "WARNING: version $gccchoice!"
2855      echo "WARNING: This may cause your build to fail since it may be a version"
2856      echo "WARNING: that isn't functional or known to not be the best choice."
2857      echo "WARNING: If you suffer from build problems, you know that this is"
2858      echo "WARNING: a likely source for them..."
2859    fi
2860    ;;
2861  esac
2866 echo "Using $LD $ldver"
2868 # check the compiler for SH platforms
2869 if test "$CC" = "sh-elf-gcc"; then
2870   if test "$gccnum" -lt "400"; then
2871     echo "WARNING: Consider upgrading your compiler to the 4.0.X series!"
2872     echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
2873   else
2874     # figure out patch status
2875     gccpatch=`$CC --version`;
2877     if { echo $gccpatch | grep "rockbox" >/dev/null 2>&1; } then
2878       echo "gcc $gccver is rockbox patched"
2879       # then convert -O to -Os to get smaller binaries!
2880       GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
2881     else
2882       echo "WARNING: You use an unpatched gcc compiler: $gccver"
2883       echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
2884     fi
2885   fi
2888 if test "$CC" = "m68k-elf-gcc"; then
2889   # convert -O to -Os to get smaller binaries!
2890   GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
2893 if [ "$ARG_CCACHE" = "1" ]; then
2894   echo "Enable ccache for building"
2895   ccache="ccache"
2896 elif [ "$ARG_CCACHE" != "0" ]; then
2897   ccache=`findtool ccache`
2898   if test -n "$ccache"; then
2899     echo "Found and uses ccache ($ccache)"
2900   fi
2903 # figure out the full path to the various commands if possible
2904 HOSTCC=`findtool gcc --lit`
2905 HOSTAR=`findtool ar --lit`
2906 CC=`findtool ${CC} --lit`
2907 LD=`findtool ${AR} --lit`
2908 AR=`findtool ${AR} --lit`
2909 AS=`findtool ${AS} --lit`
2910 OC=`findtool ${OC} --lit`
2911 WINDRES=`findtool ${WINDRES} --lit`
2912 DLLTOOL=`findtool ${DLLTOOL} --lit`
2913 DLLWRAP=`findtool ${DLLWRAP} --lit`
2914 RANLIB=`findtool ${RANLIB} --lit`
2916 if test -n "$ccache"; then
2917   CC="$ccache $CC"
2920 if test "X$endian" = "Xbig"; then
2921   defendian="ROCKBOX_BIG_ENDIAN"
2922 else
2923   defendian="ROCKBOX_LITTLE_ENDIAN"
2926 if [ "$ARG_RBDIR" ]; then
2927   rbdir=$ARG_RBDIR
2928   echo "Using alternate rockbox dir: ${rbdir}"
2931 sed > autoconf.h \
2932  -e "s,@ENDIAN@,${defendian},g" \
2933  -e "s,^#undef ROCKBOX_HAS_LOGF,$use_logf,g" \
2934  -e "s,^#undef DO_BOOTCHART,$use_bootchart,g" \
2935  -e "s,@config_rtc@,$config_rtc,g" \
2936  -e "s,@have_rtc_alarm@,$have_rtc_alarm,g" \
2937  -e "s,@RBDIR@,${rbdir},g" \
2938  -e "s,@have_backlight@,$have_backlight,g" \
2939  -e "s,@have_fmradio_in@,$have_fmradio_in,g" \
2940  -e "s,@have_ata_poweroff@,$have_ata_poweroff,g" \
2941 <<EOF
2942 /* This header was made by configure */
2943 #ifndef __BUILD_AUTOCONF_H
2944 #define __BUILD_AUTOCONF_H
2946 /* Define endianess for the target or simulator platform */
2947 #define @ENDIAN@ 1
2949 /* Define this if you build rockbox to support the logf logging and display */
2950 #undef ROCKBOX_HAS_LOGF
2952 /* Define this to record a chart with timings for the stages of boot */
2953 #undef DO_BOOTCHART
2955 /* optional define for a backlight modded Ondio */
2956 @have_backlight@
2958 /* optional define for FM radio mod for iAudio M5 */
2959 @have_fmradio_in@
2961 /* optional define for ATA poweroff on Player */
2962 @have_ata_poweroff@
2964 /* optional defines for RTC mod for h1x0 */
2965 @config_rtc@
2966 @have_rtc_alarm@
2968 /* root of Rockbox */
2969 #define ROCKBOX_DIR "/@RBDIR@"
2971 #endif /* __BUILD_AUTOCONF_H */
2974 if test -n "$t_cpu"; then
2975   TARGET_INC="-I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer/$t_model"
2976   if [ "$simulator" = "yes" ]; then # a few more includes for the sim target tree
2977     TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/sdl/"
2978     TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/"
2979   fi
2980   TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer"
2981   TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu"
2982   GCCOPTS="$GCCOPTS"
2985 if test "$simulator" = "yes"; then
2986   # add simul make stuff on the #SIMUL# line
2987   simmagic1="s,@SIMUL1@,\$(SILENT)\$(MAKE) -C \$(SIMDIR) OBJDIR=\$(BUILDDIR)/sim,"
2988   simmagic2="s,@SIMUL2@,\$(SILENT)\$(MAKE) -C \$(ROOTDIR)/uisimulator/common OBJDIR=\$(BUILDDIR)/comsim,"
2989 else
2990   # delete the lines that match
2991   simmagic1='/@SIMUL1@/D'
2992   simmagic2='/@SIMUL2@/D'
2995 if test "$swcodec" = "yes"; then
2996   voicetoolset="rbspeexenc voicefont wavtrim"
2997 else
2998   voicetoolset="voicefont wavtrim"
3001 if test "$apps" = "apps"; then
3002   # only when we build "real" apps we build the .lng files
3003   buildlangs="langs"
3006 #### Fix the cmdline ###
3007 if test -n "$ccache"; then
3008   cmdline="--ccache "
3010 if [ "$ARG_ARM_EABI" = "1" ]; then
3011   cmdline="$cmdline--eabi "
3014 cmdline="$cmdline--target=\$(MODELNAME) --ram=\$(MEMORYSIZE) --rbdir=\$(RBDIR) --type=$btype$advopts"
3015 ### end of cmdline
3017 sed > Makefile \
3018  -e "s,@ROOTDIR@,${rootdir},g" \
3019  -e "s,@DEBUG@,${debug},g" \
3020  -e "s,@MEMORY@,${memory},g" \
3021  -e "s,@TARGET_ID@,${target_id},g" \
3022  -e "s,@TARGET@,${target},g" \
3023  -e "s,@CPU@,${t_cpu},g" \
3024  -e "s,@MANUFACTURER@,${t_manufacturer},g" \
3025  -e "s,@MODELNAME@,${modelname},g" \
3026  -e "s,@LANGUAGE@,${language},g" \
3027  -e "s:@VOICELANGUAGE@:${voicelanguage}:g" \
3028  -e "s,@PWD@,${pwd},g" \
3029  -e "s,@HOSTCC@,${HOSTCC},g" \
3030  -e "s,@HOSTAR@,${HOSTAR},g" \
3031  -e "s,@CC@,${CC},g" \
3032  -e "s,@LD@,${LD},g" \
3033  -e "s,@AR@,${AR},g" \
3034  -e "s,@AS@,${AS},g" \
3035  -e "s,@OC@,${OC},g" \
3036  -e "s,@WINDRES@,${WINDRES},g" \
3037  -e "s,@DLLTOOL@,${DLLTOOL},g" \
3038  -e "s,@DLLWRAP@,${DLLWRAP},g" \
3039  -e "s,@RANLIB@,${RANLIB},g" \
3040  -e "s,@TOOL@,${tool},g" \
3041  -e "s,@BMP2RB_NATIVE@,${bmp2rb_native},g" \
3042  -e "s,@BMP2RB_MONO@,${bmp2rb_mono},g" \
3043  -e "s,@BMP2RB_REMOTENATIVE@,${bmp2rb_remotenative},g" \
3044  -e "s,@BMP2RB_REMOTEMONO@,${bmp2rb_remotemono},g" \
3045  -e "s,@OUTPUT@,${output},g" \
3046  -e "s,@APPEXTRA@,${appextra},g" \
3047  -e "s,@ARCHOSROM@,${archosrom},g" \
3048  -e "s,@FLASHFILE@,${flash},g" \
3049  -e "s,@PLUGINS@,${plugins},g" \
3050  -e "s,@CODECS@,${swcodec},g" \
3051  -e "s,@PROFILE_OPTS@,${PROFILE_OPTS},g" \
3052  -e "s,@SHARED_FLAG@,${SHARED_FLAG},g" \
3053  -e "s,@GCCOPTS@,${GCCOPTS},g" \
3054  -e "s,@TARGET_INC@,${TARGET_INC},g" \
3055  -e "s!@LDOPTS@!${LDOPTS}!g" \
3056  -e "s,@LOADADDRESS@,${loadaddress},g" \
3057  -e "s,@EXTRADEF@,${extradefines},g" \
3058  -e "s,@APPSDIR@,${appsdir},g" \
3059  -e "s,@FIRMDIR@,${firmdir},g" \
3060  -e "s,@TOOLSDIR@,${toolsdir},g" \
3061  -e "s,@APPS@,${apps},g" \
3062  -e "s,@SIMVER@,${simver},g" \
3063  -e "s,@GCCVER@,${gccver},g" \
3064  -e "s,@GCCNUM@,${gccnum},g" \
3065  -e "s,@UNAME@,${uname},g" \
3066  -e "s,@ENDIAN@,${defendian},g" \
3067  -e "s,@TOOLSET@,${toolset},g" \
3068  -e "${simmagic1}" \
3069  -e "${simmagic2}" \
3070  -e "s,@MANUALDEV@,${manualdev},g" \
3071  -e "s,@ENCODER@,${ENC_CMD},g" \
3072  -e "s,@ENC_OPTS@,${ENC_OPTS},g" \
3073  -e "s,@TTS_ENGINE@,${TTS_ENGINE},g" \
3074  -e "s,@TTS_OPTS@,${TTS_OPTS},g" \
3075  -e "s,@VOICETOOLSET@,${voicetoolset},g" \
3076  -e "s,@LANGS@,${buildlangs},g" \
3077  -e "s,@USE_ELF@,${USE_ELF},g" \
3078  -e "s,@RBDIR@,${rbdir},g" \
3079  -e "s,@PREFIX@,$PREFIX,g" \
3080  -e "s,@CMDLINE@,$cmdline,g" \
3081  -e "s,@SDLCONFIG@,$sdl,g" \
3082 <<EOF
3083 ## Automatically generated. http://www.rockbox.org/
3085 export ROOTDIR=@ROOTDIR@
3086 export FIRMDIR=@FIRMDIR@
3087 export APPSDIR=@APPSDIR@
3088 export TOOLSDIR=@TOOLSDIR@
3089 export DOCSDIR=\$(ROOTDIR)/docs
3090 export MANUALDIR=\${ROOTDIR}/manual
3091 export DEBUG=@DEBUG@
3092 export MODELNAME=@MODELNAME@
3093 export ARCHOSROM=@ARCHOSROM@
3094 export FLASHFILE=@FLASHFILE@
3095 export TARGET_ID=@TARGET_ID@
3096 export TARGET=@TARGET@
3097 export CPU=@CPU@
3098 export MANUFACTURER=@MANUFACTURER@
3099 export OBJDIR=@PWD@
3100 export BUILDDIR=@PWD@
3101 export LANGUAGE=@LANGUAGE@
3102 export VOICELANGUAGE=@VOICELANGUAGE@
3103 export MEMORYSIZE=@MEMORY@
3104 export VERSION:=\$(shell \$(ROOTDIR)/tools/version.sh \$(ROOTDIR))
3105 export BUILDDATE:=\$(shell date -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d')
3106 export MKFIRMWARE=@TOOL@
3107 export BMP2RB_MONO=@BMP2RB_MONO@
3108 export BMP2RB_NATIVE=@BMP2RB_NATIVE@
3109 export BMP2RB_REMOTEMONO=@BMP2RB_REMOTEMONO@
3110 export BMP2RB_REMOTENATIVE=@BMP2RB_REMOTENATIVE@
3111 export BINARY=@OUTPUT@
3112 export APPEXTRA=@APPEXTRA@
3113 export ENABLEDPLUGINS=@PLUGINS@
3114 export SOFTWARECODECS=@CODECS@
3115 export EXTRA_DEFINES=@EXTRADEF@
3116 export HOSTCC=@HOSTCC@
3117 export HOSTAR=@HOSTAR@
3118 export CC=@CC@
3119 export LD=@LD@
3120 export AR=@AR@
3121 export AS=@AS@
3122 export OC=@OC@
3123 export WINDRES=@WINDRES@
3124 export DLLTOOL=@DLLTOOL@
3125 export DLLWRAP=@DLLWRAP@
3126 export RANLIB=@RANLIB@
3127 export PREFIX=@PREFIX@
3128 export PROFILE_OPTS=@PROFILE_OPTS@
3129 export SIMVER=@SIMVER@
3130 export SIMDIR=\$(ROOTDIR)/uisimulator/sdl
3131 export GCCOPTS=@GCCOPTS@
3132 export TARGET_INC=@TARGET_INC@
3133 export LOADADDRESS=@LOADADDRESS@
3134 export SHARED_FLAG=@SHARED_FLAG@
3135 export LDOPTS=@LDOPTS@
3136 export GCCVER=@GCCVER@
3137 export GCCNUM=@GCCNUM@
3138 export UNAME=@UNAME@
3139 export MANUALDEV=@MANUALDEV@
3140 export TTS_OPTS=@TTS_OPTS@
3141 export TTS_ENGINE=@TTS_ENGINE@
3142 export ENC_OPTS=@ENC_OPTS@
3143 export ENCODER=@ENCODER@
3144 export USE_ELF=@USE_ELF@
3145 export RBDIR=@RBDIR@
3146 export SDLCONFIG=@SDLCONFIG@
3148 CONFIGURE_OPTIONS=@CMDLINE@
3150 include \$(TOOLSDIR)/root.make
3154 echo "Created Makefile"