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



Search | Go
Wiki > Main > RockboxDevelopment > InterixDevelopment (r4)

Setting up a Rockbox development environment using Interix

Overview

This is a description of how to set up a development environment using Interix. Interix is also known as Microsoft Services for Unix (SFU) resp. Microsoft Services for Unix Applications (SUA).

%W% WARNING: This method is not recommended for users unfamiliar with the Unix command line. It is meant as an alternative to using Cygwin for users who want to experiment. Also, this method is only usable on the Windows versions stated in step 1, other versions won't work.

Note that this environment is currently limited to making target builds. No simulator support, SAPI voice file build support, or manual build support yet. SAPI support will be added soon (requires adapting voice.pl).

Step 1: Download the SFU main package and required hotfixes

For Windows 2000 Professional, Windows 2000 Server, Windows XP Professional, and Windows Server 2003 (non-R2) you will need to download SFU 3.5 from Microsoft. SFU 3.5 is what this description is based on.

Windows Server 2003 R2 includes SUA 5.2, which can be enabled via Software->Add/Remove Windows features. It will prompt to download the tools package after enabling the basic functionality. You will need to adjust the following steps a bit, but the basic method should be the same. Likewise, Windows Vista Business and Ultimate include SUA 6.0.

For SFU 3.5, you will also need to request and download the following hotfixes (they're provided free of charge, but you need to give a valid email address):

Step 2: Install the basic environment

infoThe following steps need to be performed as a local administrator!

Run the SFU installer. You need to perform a custom installation, and select the following components:

  • Utilities/Base Utilities.
  • Interix GNU Components/Interix GNU Utilities
  • Interix GNU Components/Interix GNU SDK

Deselect all others. Not selecting UNIX Perl here is on purpose. It's oudated, and we'll install a newer one later.

  • Enable the 2 options "Enable setuid behavior for Interix programs" and "Change the default behavior to case sensitive."
  • User name mapping: just accept the defaults (2 pages)
  • Installation location: it can be installed anywhere, but avoid spaces in the path. This guide assumes C:\SFU
  • Reboot as requested

Now install the 3 hotfixes, in the order given above. Each hotfix requests a reboot after installation. After installing the hotfixes, check whether the following directories exist on the volume where you installed SFU: C:\<long-hexadecimal-number> , C:\temp\ext<NNNN> (there will be two ext<NNNN> folders in temp). These exist because the hotfixes do not clean up properly. Delete them.

Now you need to check and (very likely) fix /etc/resolv.conf to point to your DNS server, otherwise the following steps won't work.

Step 3: Download and install the Interopsystems developer bundle

Download the developer bundle from www.suacommunity.com into a directory with no spaces in the path.

infoThe following steps need to be performed as a local administrator!

Install the package. It will take some time, and ask a few questions during the process:
  • "An update for this bootstrap contents may be available now... would you like to update now?" Choose "yes"
  • "Would you like to install the X-Server now?" If you do not have Xming installed and want to, install it. It's not needed for rockbox builds, and probably won't be needed for simulator builds once that's supported (we'll probably build native Win32 SDL simulators).

Using Windows explorer, go to <C:\Documents and Settings>\All Users\<Start menu>\<Programs>\Windows Services for UNIX (replace parts in <> with the correct values for your language version of Windows), and duplicate the "Korn Shell" shortcut. Rename the duplicate shortcut to "Bourne Again Shell", and edit the following properties:
  • Target: C:\WINDOWS\system32\posix.exe /u /c /usr/local/bin/bash -l
  • Comment: Runs the Interix Bource again shell

Step 4: Configure and fix up the environment

infoThe following steps need to be performed as a local administrator! You can use "su" to become Administrator within bash. Since the default shell in Interix is ksh, but you probably want bash, use the following command: su Administrator -c bash

Check whether perl is properly installed: which perl
If perl isn't found (happened reproducably during my tests) the bundle installer goofed, and you need to fix it: pkg_update -Lr perl

Make a symlink so that perl is found where many scripts expect it: ln -s /usr/local/bin/perl /usr/bin/perl

SFU 3.5 only: SFU 3.5 comes without inttypes.h and stdint.h, however, these are needed for rockbox tools and sims and all kinds of other stuff. Download inttypes-sfu3.5.zip, extract it and put both .h files into /usr/include.

Edit /etc/profile.lcl You'll probably want the following settings:

# Set a home directory within the SFU path if available
if [ -d /home/$USERNAME ]; then
    export HOME="/home/$USERNAME"
    cd $HOME
fi

# Shell dependent settings
case "`echo "_$0" | /usr/bin/tr '[:upper:]' '[:lower:]' | /usr/bin/sed -e 's/^_//'`" in
bash     | -bash     | */bash )
    # Set a default prompt of: user@host and current_directory
    export PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '
    ;;
* )
    # Sorry, this shell has no defaults in /etc/profile.lcl
    #  feel free to add your own.
    export PS1='$ '
    ;;
esac

Using a directory without spaces as the home directory for users will avoid a lot of trouble. You need to create the directories and set the proper permissions. Note that the username must be capitalized the exact same way as it is used for logging into windows.

Step 5: Build an up-to-date GNU make

infoThe following steps need to be performed as a local administrator!

The version of GNU make shipped with the Interopsystems developer bundle is outdated. We want GNU make 3.81 for optimum build performance.

Check the installed version: pkg_info gmake
If it shows GNU make version 3.81, skip the rest of step 5

Uninstall the bundled version of GNU make: pkg_delete gmake-3.80.1-bin

Download the GNU make sources

Unpack the source and cd into the directory
./configure --program-prefix=g
make
make install

Step 6: Perform initial SVN checkout and build the crosscompilers

Start bash, and check out rockbox SVN. Then cd into tools/. Since Interix already has a lot of stuff in /usr/local, and also puts its own GCC unter /opt, it is recommended to put the crosscompilers under /opt as well. Edit rockboxdev.sh accordingly.

  • Become Administrator
  • The developer bundle adds a few include paths to CPPFLAGS which would confuse the crosscompiler build. Deactivate them temporarily: export CPPFLAGS=-D_ALL_SOURCE
  • Build the crosscompilers as normal: ./rockboxdev.sh
  • exit from the Administrator shell

Step 7: Adjust the user environment

Edit ~/.profile, and add the path(s) to the crosscompiler(s) you've just built.

In order to be able to use non-ASCII characters in bash (e.g. German umlauts), edit ~/.inputrc and add the follwing lines:

set meta-flag on
set convert-meta off
set input-meta on
set output-meta on

Close bash and restart it.

Done. happy hacking :-)

Usage hints

  • Interix provides the BSD tools by default, but e.g. BSD make isn't suitable for rockbox. We installed a current GNU make earlier because of this. You need to call it using 'gmake'.
  • This guide includes the installation of 'ccache'. If your system is fast, the first-time builds might be a bit slower than on Cygwin. If you want to see the effect of ccache, time the second build for the same target after a 'make clean'. You can also build without ccache, by using the --no-ccache option to 'configure'
  • Defragmenting the hard drive can have a fairly big effect on build times. This also applies to Cygwin.
Edit | Attach | Print version | History: r5 < r4 < r3 < r2 | Backlinks | View wiki text | More topic actions...
r4 - 07 Oct 2008 - 05:37:30 - JensArnold
Copyright by the contributing authors.