5b2d874a36
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5964 a1c6a512-1295-4272-9138-f99709370657
590 lines
12 KiB
Bash
Executable file
590 lines
12 KiB
Bash
Executable file
#!/bin/sh
|
|
# __________ __ ___.
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
# \/ \/ \/ \/ \/
|
|
# $Id$
|
|
#
|
|
|
|
# global CC options for all platforms
|
|
CCOPTS="-W -Wall -O -nostdlib -ffreestanding -Wstrict-prototypes"
|
|
|
|
#
|
|
# Begin Function Definitions
|
|
#
|
|
input() {
|
|
read response
|
|
echo $response
|
|
}
|
|
|
|
shcc () {
|
|
CC=sh-elf-gcc
|
|
LD=sh-elf-ld
|
|
AR=sh-elf-ar
|
|
AS=sh-elf-as
|
|
OC=sh-elf-objcopy
|
|
GCCOPTS="$CCOPTS -m1"
|
|
GCCOPTIMIZE="-fomit-frame-pointer -fschedule-insns"
|
|
}
|
|
|
|
calmrisccc () {
|
|
CC=calmrisc16-unknown-elf-gcc
|
|
LD=calmrisc16-unknown-elf-ld
|
|
AR=calmrisc16-unknown-elf-ar
|
|
AS=calmrisc16-unknown-elf-as
|
|
OC=calmrisc16-unknown-elf-objcopy
|
|
GCCOPTS="-Wl\,--no-check-sections $CCOPTS"
|
|
GCCOPTIMIZE="-fomit-frame-pointer"
|
|
}
|
|
|
|
coldfirecc () {
|
|
CC=m68k-elf-gcc
|
|
LD=m68k-elf-ld
|
|
AR=m68k-elf-ar
|
|
AS=m68k-elf-as
|
|
OC=m68k-elf-objcopy
|
|
GCCOPTS="$CCOPTS -g -m5200 -Wa\,-m5249 -malign-int -mstrict-align"
|
|
GCCOPTIMIZE="-fomit-frame-pointer"
|
|
}
|
|
|
|
whichaddr () {
|
|
case $archos in
|
|
gmini120|gminisp)
|
|
echo ""
|
|
echo "Where do you want the firmware to be flashed?"
|
|
echo "WARNING: Do not answer this question lightly,"
|
|
echo "unless you don't plan to flash your gmini."
|
|
echo "In this case, reply '0x10000' (no quotes) and "
|
|
echo "re-configure when you know better."
|
|
loadaddress=`input`
|
|
|
|
if [ "0$loadaddress" = "0" ]; then
|
|
#default
|
|
loadaddress="0x10000";
|
|
fi
|
|
echo "You selected $loadaddress"
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
}
|
|
|
|
whichsim () {
|
|
|
|
if [ -z "$simver" ]; then
|
|
|
|
##################################################################
|
|
# Figure out win32/x11 GUI
|
|
#
|
|
echo ""
|
|
echo "Build (W)in32 or (X)11 GUI version? (X)"
|
|
|
|
option=`input`;
|
|
|
|
case $option in
|
|
[Ww])
|
|
simver="win32"
|
|
;;
|
|
*)
|
|
simver="x11"
|
|
;;
|
|
esac
|
|
echo "Selected $simver simulator"
|
|
fi
|
|
}
|
|
|
|
|
|
simul () {
|
|
|
|
sed > Makefile \
|
|
-e "s,@ROOTDIR@,${rootdir},g" \
|
|
-e "s,@ARCHOS@,${archos},g" \
|
|
-e "s,@DEBUG@,${debug},g" \
|
|
-e "s,@KEYPAD@,${keypad},g" \
|
|
-e "s,@PWD@,${pwd},g" \
|
|
-e "s,@LANGUAGE@,${language},g" \
|
|
-e "s,@TARGET@,${target},g" \
|
|
-e "s,@PLUGINS@,${plugins},g" \
|
|
-e "s,@CODECS@,${codecs},g" \
|
|
-e "s,@SIMVER@,${simver},g" \
|
|
-e "s,@MEMORY@,${memory},g" \
|
|
<<EOF
|
|
## Automaticly generated. http://rockbox.haxx.se
|
|
|
|
export ARCHOS=@ARCHOS@
|
|
export ROOTDIR=@ROOTDIR@
|
|
export FIRMDIR=\$(ROOTDIR)/firmware
|
|
export APPSDIR=\$(ROOTDIR)/apps
|
|
export TOOLSDIR=\$(ROOTDIR)/tools
|
|
export DOCSDIR=\$(ROOTDIR)/docs
|
|
export APPSDIR=@ROOTDIR@/apps
|
|
export SIMDIR=\$(ROOTDIR)/uisimulator/@SIMVER@
|
|
export DEBUG=@DEBUG@
|
|
export KEYPAD=@KEYPAD@
|
|
export OBJDIR=@PWD@
|
|
export SIMVER=@SIMVER@
|
|
export TARGET=@TARGET@
|
|
export LANGUAGE=@LANGUAGE@
|
|
export VERSION=\$(shell date +%y%m%d-%H%M)
|
|
export ENABLEDPLUGINS=@PLUGINS@
|
|
export SOFTWARECODECS=@CODECS@
|
|
export MEMORYSIZE=@MEMORY@
|
|
|
|
.PHONY:
|
|
|
|
all: sim
|
|
|
|
sim:
|
|
\$(MAKE) -C \$(SIMDIR)
|
|
|
|
clean:
|
|
\$(MAKE) -C \$(SIMDIR) clean
|
|
rm -rf rockbox.zip
|
|
|
|
tags:
|
|
@rm -f TAGS
|
|
make -C \$(SIMDIR) tags
|
|
|
|
zip:
|
|
\$(TOOLSDIR)/buildzip.pl -r "\$(ROOTDIR)" sim\$(TARGET)
|
|
|
|
install:
|
|
@echo "installing a full setup in your archos dir"
|
|
@(make zip && cd archos && unzip -oq ../rockbox.zip)
|
|
EOF
|
|
|
|
echo "Created Makefile"
|
|
|
|
if [ -d "archos" ]; then
|
|
echo "sub directory archos already present"
|
|
else
|
|
mkdir archos
|
|
echo "created an archos subdirectory for simulating the hard disk"
|
|
fi
|
|
|
|
}
|
|
|
|
picklang() {
|
|
# figure out which languages that are around
|
|
for file in $rootdir/apps/lang/*.lang; do
|
|
clean=`echo $file | sed -e 's:.*/::g' | cut "-d." -f1`
|
|
langs="$langs $clean"
|
|
done
|
|
|
|
num=1
|
|
for one in $langs; do
|
|
echo "$num. $one"
|
|
num=`expr $num + 1`
|
|
done
|
|
|
|
read pick
|
|
return $pick;
|
|
}
|
|
|
|
whichlang() {
|
|
num=1
|
|
for one in $langs; do
|
|
if [ "$num" = "$pick" ]; then
|
|
echo $one
|
|
return
|
|
fi
|
|
num=`expr $num + 1`
|
|
done
|
|
}
|
|
|
|
target=$1
|
|
debug=$2
|
|
|
|
if test "$1" = "--help"; then
|
|
echo "Rockbox configure script."
|
|
echo "Invoke this in a directory to generate a Makefile to build Rockbox"
|
|
echo "Do *NOT* run this within the tools directory!"
|
|
exit
|
|
fi
|
|
|
|
if test -r "configure"; then
|
|
# this is a check for a configure script in the current directory, it there
|
|
# is one, try to figure out if it is this one!
|
|
|
|
if { grep "^# Jukebox" configure >/dev/null 2>&1 ; } then
|
|
echo "WEEEEEEEEP. Don't run this configure script within the tools directory."
|
|
echo "It will only cause you pain and grief. Instead do this:"
|
|
echo ""
|
|
echo " cd .."
|
|
echo " mkdir build-dir"
|
|
echo " cd build-dir"
|
|
echo " ../tools/configure"
|
|
echo ""
|
|
echo "Much happiness will arise from this. Enjoy"
|
|
exit
|
|
fi
|
|
fi
|
|
|
|
if [ "$target" = "--help" -o \
|
|
"$target" = "-h" ]; then
|
|
echo "Just invoke the script and answer the questions."
|
|
echo "This script will write a Makefile for you"
|
|
exit
|
|
fi
|
|
|
|
# get our current directory
|
|
pwd=`pwd`;
|
|
|
|
if [ "$target" = "update" ]; then
|
|
echo "configure update is unfortunately no longer supported"
|
|
exit
|
|
else
|
|
|
|
echo "This script will setup your Rockbox build environment."
|
|
echo "Further docs here: http://rockbox.haxx.se/docs/"
|
|
echo ""
|
|
|
|
fi
|
|
|
|
if [ -z "$rootdir" ]; then
|
|
##################################################################
|
|
# Figure out where the source code root is!
|
|
#
|
|
|
|
firmfile="crt0.S" # a file to check for in the firmware root dir
|
|
|
|
for dir in . .. ../.. ../rockbox*; do
|
|
if [ -f $dir/firmware/$firmfile ]; then
|
|
rootdir=$dir
|
|
break
|
|
fi
|
|
done
|
|
|
|
if [ -z "$rootdir" ]; then
|
|
echo "This script couldn't find your source code root directory. Please enter the"
|
|
echo "full path to the source code directory here:"
|
|
|
|
firmdir=`input`
|
|
fi
|
|
|
|
#####################################################################
|
|
# Convert the possibly relative directory name to an absolute version
|
|
#
|
|
now=`pwd`
|
|
cd $rootdir
|
|
rootdir=`pwd`
|
|
|
|
echo "Using this source code root directory:"
|
|
echo $rootdir
|
|
echo ""
|
|
|
|
# cd back to the build dir
|
|
cd $now
|
|
fi
|
|
|
|
|
|
appsdir='\$(ROOTDIR)/apps'
|
|
|
|
if [ -z "$archos" ]; then
|
|
|
|
##################################################################
|
|
# Figure out target platform
|
|
#
|
|
|
|
echo "Enter target platform: (default is Archos Recorder)"
|
|
|
|
echo "1 - Archos Player/Studio"
|
|
echo "2 - Archos Recorder"
|
|
echo "3 - Archos FM Recorder"
|
|
echo "4 - Archos Recorder v2"
|
|
echo "5 - Archos Gmini 120"
|
|
echo "6 - Archos Gmini SP"
|
|
echo "7 - Archos Ondio SP"
|
|
echo "8 - Archos Ondio FM"
|
|
echo "9 - Iriver H100"
|
|
|
|
getit=`input`;
|
|
|
|
case $getit in
|
|
|
|
1)
|
|
archos="player"
|
|
target="-DARCHOS_PLAYER"
|
|
shcc
|
|
tool="$rootdir/tools/scramble"
|
|
output="archos.mod"
|
|
appextra="player"
|
|
archosrom="$pwd/rombox.ucl"
|
|
flash="$pwd/rockbox.ucl"
|
|
plugins="yes"
|
|
codecs=""
|
|
;;
|
|
|
|
3)
|
|
archos="fmrecorder"
|
|
target="-DARCHOS_FMRECORDER"
|
|
shcc
|
|
tool="$rootdir/tools/scramble -fm"
|
|
output="ajbrec.ajz"
|
|
appextra="recorder"
|
|
archosrom=""
|
|
flash="$pwd/rockbox.ucl"
|
|
plugins="yes"
|
|
codecs=""
|
|
;;
|
|
|
|
4)
|
|
archos="recorderv2"
|
|
target="-DARCHOS_RECORDERV2"
|
|
shcc
|
|
tool="$rootdir/tools/scramble -v2"
|
|
output="ajbrec.ajz"
|
|
appextra="recorder"
|
|
archosrom="$pwd/rombox.ucl"
|
|
flash="$pwd/rockbox.ucl"
|
|
plugins="yes"
|
|
codecs=""
|
|
;;
|
|
|
|
5)
|
|
archos="gmini120"
|
|
target="-DARCHOS_GMINI120 -DLOADADDRESS=\$(LOADADDRESS)"
|
|
memory=16 # fixed size (16 is a guess, remove comment when checked)
|
|
calmrisccc
|
|
tool="cp" # might work for now!
|
|
output="rockbox.gmini"
|
|
appextra="recorder"
|
|
archosrom=""
|
|
flash=""
|
|
plugins="" # disabled for now, enable later on
|
|
codecs=""
|
|
;;
|
|
|
|
6)
|
|
archos="gminisp"
|
|
target="-DARCHOS_GMINISP -DLOADADDRESS=\$(LOADADDRESS)"
|
|
memory=16 # fixed size (16 is a guess, remove comment when checked)
|
|
calmrisccc
|
|
tool="cp" # might work for now!
|
|
output="rockbox.gmini"
|
|
appextra="recorder"
|
|
archosrom=""
|
|
flash=""
|
|
plugins="" # disabled for now, enable later on
|
|
codecs=""
|
|
;;
|
|
|
|
7)
|
|
archos="ondiosp"
|
|
target="-DARCHOS_ONDIOSP"
|
|
shcc
|
|
tool="$rootdir/tools/scramble -osp"
|
|
output="ajbrec.ajz"
|
|
appextra="recorder"
|
|
archosrom="$pwd/rombox.ucl"
|
|
flash="$pwd/rockbox.ucl"
|
|
plugins="yes"
|
|
codecs=""
|
|
;;
|
|
|
|
8)
|
|
archos="ondiofm"
|
|
target="-DARCHOS_ONDIOFM"
|
|
shcc
|
|
tool="$rootdir/tools/scramble -ofm"
|
|
output="ajbrec.ajz"
|
|
appextra="recorder"
|
|
archosrom="$pwd/rombox.ucl"
|
|
flash="$pwd/rockbox.ucl"
|
|
plugins="yes"
|
|
codecs=""
|
|
;;
|
|
|
|
9)
|
|
archos="h100"
|
|
target="-DIRIVER_H100"
|
|
memory=32 # always
|
|
coldfirecc
|
|
tool="$rootdir/tools/scramble -add=h120"
|
|
output="rockbox.iriver"
|
|
appextra="recorder"
|
|
archosrom=""
|
|
flash=""
|
|
plugins="yes"
|
|
codecs="yes"
|
|
;;
|
|
|
|
*)
|
|
archos="recorder"
|
|
target="-DARCHOS_RECORDER"
|
|
shcc
|
|
tool="$rootdir/tools/scramble"
|
|
output="ajbrec.ajz"
|
|
appextra="recorder"
|
|
archosrom="$pwd/rombox.ucl"
|
|
flash="$pwd/rockbox.ucl"
|
|
plugins="yes"
|
|
codecs=""
|
|
;;
|
|
|
|
esac
|
|
|
|
echo "Platform set to $archos"
|
|
|
|
fi
|
|
|
|
if [ -z "$memory" ]; then
|
|
size="2"
|
|
if [ -z "$update" ]; then
|
|
echo "Enter size of your RAM (in MB): (defaults to 2)"
|
|
size=`input`;
|
|
fi
|
|
|
|
case $size in
|
|
8)
|
|
memory="8"
|
|
;;
|
|
*)
|
|
memory="2"
|
|
;;
|
|
|
|
esac
|
|
echo "Memory size selected: $memory MB"
|
|
fi
|
|
|
|
if [ -z "$debug" ]; then
|
|
##################################################################
|
|
# Figure out debug on/off
|
|
#
|
|
echo "Build (N)ormal, (D)ebug, (S)imulator, (B)ootloader? (N)"
|
|
|
|
option=`input`;
|
|
|
|
case $option in
|
|
[Bb])
|
|
if [ "$archos" != "h100" ]; then
|
|
echo "only the iRiver_h100 platform can build a boot loader";
|
|
exit
|
|
fi
|
|
extradefines="-DBOOTLOADER" # for target makefile symbol EXTRA_DEFINES
|
|
appsdir='\$(ROOTDIR)/bootloader'
|
|
bootloader="1"
|
|
echo "Bootloader build selected"
|
|
;;
|
|
[Ss])
|
|
debug="1"
|
|
simulator="yes"
|
|
echo "Simulator build selected"
|
|
whichsim
|
|
;;
|
|
[Dd])
|
|
debug="1"
|
|
echo "Debug build selected"
|
|
GCCOPTS="$GCCOPTS -g -DDEBUG"
|
|
;;
|
|
*)
|
|
debug=""
|
|
echo "Normal build selected"
|
|
GCCOPTS="$GCCOPTS $GCCOPTIMIZE"
|
|
;;
|
|
|
|
esac
|
|
fi
|
|
|
|
whichaddr
|
|
|
|
if [ -z "$language" ]; then
|
|
|
|
echo "Select a number for the language to use (default is english)"
|
|
|
|
picklang
|
|
language=`whichlang`
|
|
|
|
if [ -z "$language" ]; then
|
|
# pick a default
|
|
language="english"
|
|
fi
|
|
echo "Language set to $language"
|
|
fi
|
|
|
|
if [ "yes" = "$simulator" ]; then
|
|
# we have already dealt with the simulator Makefile separately
|
|
simul
|
|
exit
|
|
fi
|
|
|
|
sed > Makefile \
|
|
-e "s,@ROOTDIR@,${rootdir},g" \
|
|
-e "s,@DEBUG@,${debug},g" \
|
|
-e "s,@MEMORY@,${memory},g" \
|
|
-e "s,@TARGET@,${target},g" \
|
|
-e "s,@ARCHOS@,${archos},g" \
|
|
-e "s,@LANGUAGE@,${language},g" \
|
|
-e "s,@PWD@,${pwd},g" \
|
|
-e "s,@CC@,${CC},g" \
|
|
-e "s,@LD@,${LD},g" \
|
|
-e "s,@AR@,${AR},g" \
|
|
-e "s,@AS@,${AS},g" \
|
|
-e "s,@OC@,${OC},g" \
|
|
-e "s,@TOOL@,${tool},g" \
|
|
-e "s,@OUTPUT@,${output},g" \
|
|
-e "s,@APPEXTRA@,${appextra},g" \
|
|
-e "s,@ARCHOSROM@,${archosrom},g" \
|
|
-e "s,@FLASHFILE@,${flash},g" \
|
|
-e "s,@PLUGINS@,${plugins},g" \
|
|
-e "s,@CODECS@,${codecs},g" \
|
|
-e "s,@GCCOPTS@,${GCCOPTS},g" \
|
|
-e "s,@LOADADDRESS@,${loadaddress},g" \
|
|
-e "s,@EXTRADEF@,${extradefines},g" \
|
|
-e "s,@APPSDIR@,${appsdir},g" \
|
|
<<EOF
|
|
## Automaticly generated. http://rockbox.haxx.se
|
|
|
|
export ROOTDIR=@ROOTDIR@
|
|
export FIRMDIR=\$(ROOTDIR)/firmware
|
|
export APPSDIR=@APPSDIR@
|
|
export TOOLSDIR=\$(ROOTDIR)/tools
|
|
export DOCSDIR=\$(ROOTDIR)/docs
|
|
export DEBUG=@DEBUG@
|
|
export ARCHOS=@ARCHOS@
|
|
export ARCHOSROM=@ARCHOSROM@
|
|
export FLASHFILE=@FLASHFILE@
|
|
export TARGET=@TARGET@
|
|
export OBJDIR=@PWD@
|
|
export LANGUAGE=@LANGUAGE@
|
|
export MEMORYSIZE=@MEMORY@
|
|
export VERSION=\$(shell date +%y%m%d-%H%M)
|
|
export MKFIRMWARE=@TOOL@
|
|
export BINARY=@OUTPUT@
|
|
export APPEXTRA=@APPEXTRA@
|
|
export ENABLEDPLUGINS=@PLUGINS@
|
|
export SOFTWARECODECS=@CODECS@
|
|
export EXTRA_DEFINES=@EXTRADEF@
|
|
export CC=@CC@
|
|
export LD=@LD@
|
|
export AR=@AR@
|
|
export AS=@AS@
|
|
export OC=@OC@
|
|
export GCCOPTS=@GCCOPTS@
|
|
export LOADADDRESS=@LOADADDRESS@
|
|
|
|
.PHONY: all clean tags zip
|
|
|
|
all:
|
|
@\$(MAKE) -C \$(FIRMDIR)
|
|
@\$(MAKE) -C \$(APPSDIR)
|
|
|
|
clean:
|
|
@\$(MAKE) -C \$(FIRMDIR) clean
|
|
@\$(MAKE) -C \$(APPSDIR) clean
|
|
@rm -f rockbox.zip TAGS
|
|
|
|
tags:
|
|
@rm -f TAGS
|
|
\$(MAKE) -C \$(FIRMDIR) tags
|
|
\$(MAKE) -C \$(APPSDIR) tags
|
|
\$(MAKE) -C \$(APPSDIR)/plugins tags
|
|
\$(MAKE) -C \$(APPSDIR)/plugins/lib tags
|
|
|
|
zip:
|
|
\$(TOOLSDIR)/buildzip.pl -r "\$(ROOTDIR)" \$(TARGET)
|
|
EOF
|
|
|
|
echo "Created Makefile"
|