NSLU2-Linux
view · edit · print · history

The Master Makefile is for developing and building the latest and greatest HEAD! These instructions do not apply if all you want to do is build packages. Here are instructions for building Optware packages

For SlugOS development, you should read some OpenEmbedded bitbake recipe documentation.

Contents

Standard steps

This is very simple if you have the required software dependencies (if unsure see below):

  1. mkdir -p ~/slug
  2. cd ~/slug
  3. wget --cache=off http://www.nslu2-linux.org/Makefile
  4. make <optional target>

NB 1: Don't even think about doing make as root. Chances are it will screw up your system libraries and executables. Best practise is to set up a new normal user and build using that.

Warning:When choosing a path to contain the build enviroment make sure to choose a path that contains NO SYMLINKS, otherwise building will fail (see also OpenSlugBuildFailsDueToSymlinks). Also make sure the volume on which you are working is mounted with the exec attribute (pmount, by default mounts volumes with noexec). Also make sure your path contains no spaces in any part of the path.

There's a bucketload of valid targets. For a complete list, peruse the Makefile. It should be quite easy to figure out what target you want to build.
Example targets include slugosle-image, slugos-image, unslung-image, optware-nslu2, optware-wl500g.

Before building you may need to download the two zip files from Intel. Check carefully to see what versions your environment will need; the versions are not interchangeable, nor are they upwards compatible. See the partial list below to see which ones you'll need.

  • IPL_ixp400AccessLibrary-2_1.zip (25.03.2006: Intel has changed the name of the file into BSD_ixp400AccessLibrary-2_1.zip, however, renaming the file works fine; they also released 2.1.1, but that's just a patch against 2.1 and not yet compatible with this environment, so stay with 2.1 for now)
  • IPL_ixp400NpeLibrary-2_3.zip
Alternative version instructions for getting the 2 required intel libs
  1. Go to http://www.intel.com/design/network/products/npfamily/download_ixp400.htm
  2. Agree to the license and download "2.1 Download" of Intel Hardware Access Software (this gives you BSD_ixp400AccessLibrary-2_1.zip which must be renamed to IPL_ixp400AccessLibrary-2_1)
  3. Go to http://www.intel.com/design/network/products/npfamily/download_ixp400.htm
  4. Agree to the license and download "2.3 Download" of NPE Microcode (this gives you IPL_ixp400NpeLibrary-2_3.zip)

If you're building Openslug 3.10 then you need the 2.3 versions of the Intel libs from http://www.intel.com/design/network/products/npfamily/ixp400_current.htm

If you're building Openslug 4.8 and newer, then you need the 2.4 versions of the Intel libs from http://www.intel.com/design/network/products/npfamily/download_ixp400.htm

''DO NOT download the 3.0 versions -- this version is not used by any current firmware, and will not build.

Place these files along with their md5s in the downloads directroy. You can download these files from http://www.intel.com/design/network/products/npfamily/ixp425swr1.htm after logging in and supplying a lot of personal information, or you can use the Alternative method suggested above.

To generate the md5sums, you can use the md5sum utility like this:
md5sum -b IPL_ixp400AccessLibrary-2_1.zip | awk '{print $1}' > IPL_ixp400AccessLibrary-2_1.zip.md5
md5sum -b IPL_ixp400NpeLibrary-2_3.zip | awk '{print $1}' > IPL_ixp400NpeLibrary-2_3.zip.md5

If you have already done a majority of the MasterMakefile build, saw the error about the missing Intel drivers and did the fix above; you don't need to restart the build! Just go to the 'slugos/tmp/stamps' directory and remove the 'ixp4xx*' files. Then all you need to do is go back to the top level and restart your 'make'. It will continue where it left off.

If you use ccache, then it's important that CCACHE_PATH is not set because then the cross-compiler cannot be found.

A quick start is to run

make setup

followed by

make slugos-image

It will download all the files necessary for building a complete cross development environment. After that it will download all packages and the kernel needed for the slugos firmware, crosscompile them and combine them into a firmware package.

The Makefile builds the latest HEAD: if you want the stable version, make a target like debianslug-3.10-beta or slugos-4.8-beta.

If you have lots of time (out for the night?) and disk space (as of September 2005: 7GB), you can easily kick off make build-slugos, too. That will do the development environment and firmware (as above), too. After that it will then download and compile every application package that can be installed. It should work quite automagically. (If you would rather not build all the application packages, there are a lot, then you can edit the file openembedded/packages/meta/slugos-packages.bb to build only the ones you want. This file is fetched in the build process so you will have to break the build in order to edit it -- maybe running 'make update' first will fetch the file. You can build individual packages using bitbake as described below.)

Another handy target is: make update (it could require a prior make setup or make setup-unslung setup-debianslug setup-slugos) You will get a directory structure, that looks like this:

Makefilethis is the master makefile
bitbake/bitbake is the tool for building OE packages, they have the extension .bb
downloads/in this dir go all the downloaded sources
downloads/*.md5these md5sums are generated once a source code is downloaded. A bitbake file might check that sum somewhere in the future (with SRC_URI="protocoll://blabla/...tar.gz;md5=11112345678abdef1234567")
openembedded/this is the openembedded distribution
openembedded/conf/distro/slugos.confwhat belongs to SlugOS itself
openembedded/packages/here are all packages known to openembedded
openembedded/packages/meta/slugos-image.bbthis is a meta package for building the image
openembedded/packages/meta/slugos-packages.bbwhich packages are actually build for slugos
slugos/this directory is for building all the stuff
slugos/conf/local.confslugos local conf
slugos/tmp/here happens everything, action at its best :-)
slugos/tmp/cross/complete cross compile toolchain
slugos/tmp/deploy/place where the freshly baken packages and images go to
slugos/tmp/rootfs/it's the to be compressed root filesystem
slugos/tmp/staging/everything else needed for compiling
slugos/tmp/stamps/empty files, the pure existance indicates the status of process
slugos/tmp/work/here are the packages compiled, one directory for each package
scripts/here is only one script
unslung/--explanation to be done--

If you encounter any problems while building this, please check, if there is already a bug filed at Trac or email your bug report to the nslu2-linux mailiing list. You might also check the OpenEmbedded Eventcounter to see, if any of your problem have been fixed since your last update.
#nslu2-linux at irc.freenode.org is where your chances to get some first aid are the best. :)

OpenEmbedded contains much more packages than SlugOS, so you can add a package to openembedded/packages/meta/slugos-packages.bb, if there is already a bitbake file for it. After that, you can rerun make build-slugos and this time your package will be included in the feed. Alternatively you can do a
$ cd slugos; source setup-env; bb -b openembedded/packages/mynewpackage/mynewpackage_0.1.bb
or
$ cd slugos; . ./setup-env; bb -b openembedded/packages/mynewpackage/mynewpackage_0.1.bb

If you get kicked out of your shell when running one of the above commands, you should run make in the slugos directory, which will set up a file in the slugos directory. This file is parsed by setup-env and contains the right configuration that prevents you from being kicked out of your shell.

If you're making changes to the code, config files, or other items, please be aware that when you commit your changes, your work is indelibly preserved for the community. Please follow the guidelines on the CommitGuidelines page; doing so is very helpful to others who might need to understand the nature of the changes you've made. Requirements:
boost - http://www.boost.org/
cvs - http://www.gnu.org/software/cvs/
subversion - http://subversion.tigris.org/
python, bison, bzip2, unzip, texinfo, diffstat

Recommended:
ccache - http://ccache.samba.org/
psyco - http://psyco.sourceforge.net/

Development with Windows (CoLinux)

You can build the Master Makefile on a Windows system using 'coLinux' (http://www.colinux.org). Their wiki has various quick start guides.
A working solution would be to choose the Debian root fs image, increase the filesystem image size using 'toporesize.zip' to 5Gb at a minimum.
Once coLinux is up and running and you have used 'adduser' to add a non-root build account then apt-get install <package> the following packages:
gcc-3.3, cvs, flex, bison, make, pkg-config, rsync, gettext, libglib2.0-dev, autoconf, libtool, automake1.9, sudo and while your at it, your favourite editor e.g. emacs.
Your best bet (worked for me) is:

  • get coLinux
  • get the debian fs
  • log in as root and adduser nslu2
  • configure networking ("bridged" is easy)
  • log in as nslu2
  • mkdir slug; cd slug
  • wget http://www.nslu2-linux.org/Makefile
  • make setup-host-debian
  • make setup

Development with Debian

It is recommended, but not essential, to make a new user, to build using the Master Makefile.
Install Debian Sarge (Stable) or Etch (Testing)
Ensure you are using a testing repository (edit /etc/apt/sources.list or follow paragraph 5.2 on
http://www.debian.org/doc/manuals/reference/ch-woody.en.html#s-testing-transition)
Download the makefile as above and run:
make setup-host-debian
NB: Root access required

Development with Ubuntu 7.04 Feisty Fawn

Make a directory for your build and change to it ('mkdir slug' and then 'cd slug' perhaps).
Run: wget http://www.nslu2-linux.org/Makefile to download the MasterMakefile.
Run: make setup-host-ubuntu to set up the environment.
Run: make update to make sure the database is current.
Run: make slugosbe-image to build the tools and build the images.

There are many different things you can build, I have worked with Openslug in the past and it was changed to slugosbe. To build Unslung, the command would be make unslung-image. To build the packages that can be installed, the command would be make slugosle-packages for example. This will take a while...:)

Development with Ubuntu 9.10 Karmic

Make a directory for your build and change to it ('mkdir slug' and then 'cd slug' perhaps).
Run: wget http://www.nslu2-linux.org/Makefile to download the MasterMakefile.
Run: make setup-host-debian to set up the environment. You need to be root.

At this point, some edits to the Makefile need to be made to get it to work. Locate the text beginning with
.PHONY: setup-bitbake.
Place a '#' in front of lines 4-6 to comment them out:

# [ -d bitbake/.svn ] && \
# mv bitbake bitbake_svn_obsolete
# [ -e bitbake/.git/config ] || \

This will get setup-bitbake to run. Not sure why those lines fail. Now you can run make setup and make slugosbe-image etc.

To get openwrt to setup, you need to change the url in line 6 of .PHONY: setup-openwrt to:

( svn co svn://svn.openwrt.org/openwrt/trunk openwrt )
Then make setup-openwrt will work.

To get openwrt to build, you need to remove sablevm-sdk from the feeds/packages/lang directory. It requires jikes to build and apparently jikes is not available on 9.10. Then make openwrt will work. Alternatively, you can install jikes from the debian download site by hand.

Run: make update to make sure the database is current.
Run: make slugosbe-image to build the tools and build the images.

Development with Ubuntu 10.10 Maverick MeerKat

Make a directory for your build and change to it ('mkdir slug' and then 'cd slug' perhaps).
Run: wget http://www.nslu2-linux.org/Makefile to download the MasterMakefile.
Run: make setup-host-debian to set up the environment. You need to be root.

At this point, some edits to the Makefile need to be made to get it to work:

Toward the beginning of the file, change BITBAKE_BRANCH to 1.10 and BITBAKE_VERSION to 1.10.1

 Locate the text beginning with 
.PHONY: setup-bitbake.
Place a '#' in front of lines 4-6 to comment them out:
# [ -d bitbake/.svn ] && \
# mv bitbake bitbake_svn_obsolete
# [ -e bitbake/.git/config ] || \

This will get setup-bitbake to run. Not sure why those lines fail. Now you can run make setup and make slugosbe-image etc.

To get openwrt to setup, you need to change the url in line 6 of .PHONY: setup-openwrt to:

( svn co svn://svn.openwrt.org/openwrt/trunk openwrt )
Then make setup-openwrt will work.

To get openwrt to build, you need to remove sablevm-sdk from the feeds/packages/lang directory. It requires jikes to build and apparently jikes is not available on 9.10. Then make openwrt will work. Alternatively, you can install jikes from the debian download site by hand.

Run: make update to make sure the database is current.
Run: make slugosbe-image to build the tools and build the images.

Development with Gentoo

It is recommended, but not essential, to make a new user, to build using the Master Makefile.
Download the makefile as above and run:
make setup-host-gentoo
This will unmask boost-1.32.0 NB: Root access required
Note: After a 2005.1 installation, the permissions of my root drive turned out to be wrong (340?). The correct permissions are 755 - if you do not check and correct this, the perl and boost builds will fail.

Alternatively, you can emerge required packages in Gentoo with (As of 2006.1, Jan-2007):
At /etc/portage/package.keywords:
dev-embedded/bitbake ~amd64
dev-libs/boost ~amd64
dev-embedded/bitbake ~amd64
dev-python/PyQt? ~amd64
dev-python/sip ~amd64
emerge boost bitbake PyQt? sip
In addition, it needs another two packages:
emerge app-misc/git dev-util/diffstat
Then:
make update
Now you are ready to build the packages.
make slugos
for the whole nine yards or
make slugos-packages
just for the slugos packages

Development with Fedora Core 4

Install the needed packages through yum. The native compiler of FC 4 is gcc 4.0.2 but with that compiler it is possible to build the needed cross compiler (tested for optware and unslung image)

Development with MAC OS X (Intel)

It might be that during provessing of the file errors occuring about missing tools (like git and gawk). Use port (can be downloaded form http://www.macports.org) to install these additional tools)

Completing the Makefile failed with the following messages:

NOTE: package quilt-native-0.45-r0: task do_configure: started ERROR: Information not available for target 'i386-darwin' NOTE: exceptions.TypeError?:iterable argument required while evaluating: ${@siteinfo_get_endianess(d)} ERROR: Information not available for target 'i386-darwin'

Don't know how to proceed

Development with Unslung

See NativelyCompileUnslungPackages

  1. ipkg install unslung-devel

(But will this really work to recompile the kernel?)

Development with slugos

See SlugOSNativeCompileEnvironment

Development with Windows (VMWare Player and Ubuntu 5.10)

  • Download and install VMWare Playerhttp://www.vmware.com/download/player/
  • Download and unzip Ubuntu Virtual Machine: http://www.vmware.com/vmtn/vm/ubuntu.html
  • Note: You'll need at least 4 GB disk space on the partition you're going to use it. My VMWare Virtual Machine takes approximately 6.1 GB, so if you're still using FAT32, it's propably a good idea to convert it to NTFS, because FAT32 can't handle files > 4 GB.
    (e.g. convert drive D to NTFS: Start -> Run -> convert d: /FS:NTFS)
  • Load the Ubuntu Virtual Machine into the VMWare Player
  • Open a Terminal
  • Edit /etc/apt/sources.list sudo gedit /etc/apt/sources.list (password: ubuntu)
  • Put a # in front of the line that starts with deb cdrom:)
  • Add deb http://us.archive.ubuntu.com/ubuntu breezy universe main restricted multiverse
    deb http://security.ubuntu.com/ubuntu breezy-security universe main restricted multiverse
    deb http://us.archive.ubuntu.com/ubuntu breezy-updates main restricted universe multiverse
    and save the file
  • The above 'sources.list' entries did not work for me. I replaced the 'sources.list' file with the alternative on at <<http://www.psychocats.net/ubuntu/sources>>
  • Run sudo apt-get update
  • Run sudo apt-get upgrade
  • Run sudo apt-get install autoconf automake automake1.9 bison \
    ccache cvs docbook flex gcc g++ gawk gcj gettext libc6-dev libglib2.0-dev \
    libtool m4 make patch pkg-config python python-dev python2.4 \
    python2.4-dev sed texinfo unzip subversion bzip2 python2.4-psyco \
    fakeroot dpkg-dev cdbs debhelper libboost-date-time-dev libboost-filesystem-dev \
    libboost-regex-dev libboost-test-dev libboost-dev libz-dev \
    diffstat texi2html
  • Continue as described on the top of this page

If a package can't be downloaded

If a package can not be found (for example, at the moment the homepage of xinetd, http://www.xinetd.org is down so the build tools can't download xinetd-2.3.13.tar.gz from there) but you have a copy of the package file (for example, xinetd-2.3.13.tar.gz can be downloaded from ftp://gd.tuwien.ac.at/infosys/servers/xinetd/xinetd-2.3.13.tar.gz):

You may also use http://sources.nslu2-linux.org/sources/ as an alternate location of package files. (Example: wget http://sources.nslu2-linux.org/sources/foo.tar.gz)

1. Download the package file to ~/slug/slugos/downloads/PACKAGENAME.tar.gz
2. Run:

 md5sum ~/slug/slugos/downloads/PACKAGENAME.tar.gz | \ 
sed s/\ .*$// > ~/slug/slugos/downloads/PACKAGENAME.tar.gz.md5

3. Try running:

 make build-slugos

Build a package (plus dependencies)

To build a package for openslug or unslung, simply execute the following commands (in a bash shell) from the MasterMakefile directory (after checking out the repository):

% cd [slugos|unslung]
% source ./setup-env
% bitbake <package-name>

or if you are working on your own bitbake file

% bitbake -b my_file_0.00.bb

This will build the package represented by "<package-name>", if the package exists as a part of the distribution. If the package you want to build is not a part of the given distribution, you can try adding it by editing openembedded/packages/meta/slugos-packages.bb.

If you want to rebuild after making changes then use the bitbake command bitbake -c clean <package-name>.

The openembedded file format for .bb files is not well documented, I found useful this set of lecture notes http://www.vanille.de/tools/FOSDEM2005.pdf and http://docs.openembedded.org/usermanual/usermanual.html(approve sites).

Build notes

I have just attempted the build from the source and encountered two issues.

1. Sleepycat does not have the db-4.3.27.tar.gz for download.

   I searched the net and found a copy. Dumped into download dir.
   Then created a checksum with md5sum.

2. There is an issue with your cvs download of irssi from your cvs.

   Edit the file openembedded/packages/irssi/irssi_cvs.bb 
   Add a line near the top
    CVSDATE = "20050930"
   Force the date and the build continues.