release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Search | Go
Wiki > Main > PortingHowTo (r7)

How to Create a New Build Target



Introduction

When starting to port Rockbox to a new platform, the first thing to do is create a new build target. This will allow Rockbox to be configured and built for the new platform. In order to do this, you need to edit some files, and create some new ones.



Files to edit

tools/configure

This is the tool that creates a build tree for a target. It creates a Makefile and an autoconf.h file. Find the "# Figure out target platform" comment in the script and add an entry for your target, preferably by copying an existing one. You will then need to set up a bunch of variables for your specific target. Here is the iAudio X5 target:

   30|x5)
    target_id=12 # a unique number identifying this target, IS NOT the menu number.
                          # Just use the currently highest number+1 when you add a new target.
    modelname="x5" # This is the name of the target, used later on in the script
    target="-DIAUDIO_X5" # The #define used in firmware/export/config.h for conditional compilation
    memory=16  # how many megabytes of RAM
    coldfirecc # Which compiler to use, see the beginning of the file
    tool="$rootdir/tools/scramble -add=iax5" # Which command to use for creating a rockbox binary to be loaded by the boot loader
    bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" # How to create a monochrome bitmap
    bmp2rb_native="$rootdir/tools/bmp2rb -f 4" # How to create a native bitmap
    bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0" # How to create a monochrome bitmap for the remote lcd
    bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0" # How to create a native bitmap for the remote lcd
    output="rockbox.iaudio" # The name of the Rockbox binary file
    appextra="recorder:gui" # What directories in the apps/ tree to include in compilation
    archosrom="" # The name of the binary file if the device supports running directly from flash (mostly Archos related)
    flash="" # The name of the Rockbox binary file if the device supports having the binary in flash (mostly Archos related)
    plugins="yes" # Does it support plugins?
    codecs="libmad liba52 libffmpegFLAC libTremor libwavpack dumb libmusepack libalac libfaad libm4a" # What codecs it supports
    # toolset is the tools within the tools directory that we build for
    # this particular target.
    toolset="$iaudiobitmaptools"
    # architecture, manufacturer and model for the target-tree build
    t_cpu="coldfire"
    t_manufacturer="iaudio"
    t_model="x5" 
    ;; %BR%

firmware/export/config.h

Here you need to add #define statements for the special hardware your target has, for which we need conditional compilation in the code. You will most likely have to add an entry to most of the lists of macros in that file. Also add an entry to include your target specific firmware/export/config-xxxx.h file.

tools/scramble.c

Here you might need to add or change a few things to create binaries for your platform.

firmware/SOURCES

This file dictates which source files are compiled into the firmware. Make sure all files you need to be build are listed here. Also add all new drivers you add to the target tree to the bottom of this file. Use #ifdef to ensure that drivers specific to your device are only compiled for your device.

apps/SOURCES

This file dictates which features and plugins are compiled. Make sure all features and plugins you need for your target are included here and use #ifdef statements to include or exclude ones as required.



Files to create:

firmware/export/config-[platform].h

Here [platform] is the name of the system (eg. config-ipodmini.h). This file should contain all #define statements your target needs for conditional compilation.

firmware/target/[cpu]/[manufacturer]/[model]/*.c

firmware/target/[cpu]/[manufacturer]/[model]/*.h

Add drivers specific to your device's hardware here. Replace [cpu], [manufacturer] and [model] with your device's details. For more details, see TargetTree.



References


Edit | Attach | Print version | History: r13 | r8 < r7 < r6 < r5 | Backlinks | View wiki text | More topic actions...
r7 - 02 Oct 2008 - 17:25:58 - RobertMenes
Copyright by the contributing authors.