Emdebian Quick Start

This is intended to be a quick start guide to Emdebian and emdebian-tools.


You will need to install a package called emdebian-tools, either from Debian repositories or the Emdebian repository. emdebian-tools also brings in apt-cross and dpkg-cross. subversion is recommended by emdebian-tools and used by emsource later.

$ sudo apt-get install emdebian-tools subversion

This will ask you where you want to build packages, your username for emdebian svn access if you have one and whether you want to use apt-get or aptitude for toolchain package installation. dpkg-cross will offer you the chance to set a default cross-building architecture which saves a lot of typing later on. If you choose None, you will need to add '--arch ARCH' to all the emdebian-tools commands.

After you have the tools, you need to setup an emdebian environment using emsetup. This sets up the ~/.dpkg-cross dir which contains apt caches and configuration files and adds the Emdebian toolchain repository to your apt sources list. apt will then keep your toolchain updated as normal.

New users are recommended to use at least one -v|--verbose option to all emdebian-tools commands.

$ emsetup --verbose --simulate

Check that the output is acceptable, nothing changed yet. If you have dpkg-cross earlier than 1.32 then you are likely to get some harmless "Use of uninitialized value in string eq at /usr/share/perl5/dpkg-cross.pl line 226, <F> line 59." whinges. Just ignore these, and upgrade to 1.33 if you can.

$ emsetup -v

emsetup, like the rest of emdebian-tools does NOT need to be run as root or under sudo. Tools include code to avoid root as much as possible and the package depends on sudo so that sudo usage can be controlled within the script and used only when absolutely necessary. Using at least one -v|--verbose option will ensure that you will be reminded when emdebian-tools needs to use sudo so that you can enter the sudo passphrase if it is not already cached. Running emdebian-tools as root or under sudo may complicate the subsequent use of emdebian-tools as a normal user. This includes installing the cross-building toolchain - you should let emsetup do that step rather than running sudo apt-get install yourself.

If ~/.dpkg_cross/cross_compile isn't fully configured yet, (hint in the manpage), or you have chosen to have no default cross-building architecture, then emsetup requests the use of --arch to determine the target architecture:

$ emsetup -v -s --arch m68k
$ emsetup -a m68k

Once emsetup is complete, you can use sudo apt-get update; sudo apt-get upgrade to ensure you have the latest versions of apt-cross and emdebian-tools as updates are uploaded to Emdebian between Debian versions.

Now you can run emsource <package> to get a debian package, unpack it and apply / generate any emdebian patches. This is directly equivalent to apt-get source in mainstream debian and then applying some patches. emsource tells you where the package has been unpacked - in an SVN tree beneath your emdebian working directory. (target denotes that these packages are intended for installation directly onto the target embedded device.)

$ emsource -v foo
Using foo
Working directory: '/path/to/working/dir'
Checking for existing emdebian patches
Checking out working copies of existing emdebian patches
Checked out revision 1234.
Checking for existing build tree in foo-

Emdebianised source tree for 'foo' exists at '/path/to/working/dir/target/trunk/f/foo/trunk/foo-'
Change to this directory before running 'emdebuild'

Now you can cd into the package directory and do emdebuild to actually build the package. As with any automated packaging process, take a moment to read through amended debian/rules before attempting to build. You will need to install any build dependencies as needed with apt-get or aptitude. emdebuild creates a .build log for you. e.g. for a package foo:

$ cd /path/to/working/dir/target/trunk/f/foo/trunk/foo-

Check debian/rules and take a look at the changed files.

$ emdebuild -v

Packages, .changes, .dsc, .diff.gz, patch files and the .build log are created in the directory above:

$ ls /path/to/working/dir/target/trunk/f/foo/trunk/

You could check the [http://linux.codehelp.co.uk/emdebian/man/ Emdebian manpages] and the ["Embedded_Debian"] wiki pages for documentation.

All questions to the debian-embedded mailing list - emdebian developers are also available on IRC. See the [http://www.emdebian.org/ emdebian website] for details.

The next stage is the [:EmdebianGuide: Emdebian Developer Guide].