Contents:
Introduction
Makerootfs automatically builds a toolchain (optional; only if no existing one
can be found) and cross-compiles Linux applications for ARM embedded
machines. It also installs kernel modules, toolchain libraries and
creates a jffs2 root filesystem, which can be flashed directly to the
embedded hardware.
The functionality is similar to
buildroot, which
creates a root filesystem based on the
uClibc libraries.
makerootfs
uses the full
glibc libraries, thus not imposing
feature restrictions for
hardware where functionality is more important than saving space. A
script to cross-compile
qt-embedded
and
opie is also included.
Unlike
openembedded, which
requires a huge amount of memory and often fails to build if a
non-default configuration is used, makerootfs is based on a set of
shell scripts, that can also be called manually. So, makerootfs is
useful for any embedded system developer,
who doesn't want to use uClibc, but still wants to keep an overview
over the rootfs and make changes of his own to the software without the
full-blown
"openembedded" environment. All applications can also be built
separately.
Configuration is easy and is done through a single configuration file,
allowing a quick start.
Several configuration files can co-exist.
Package sources are automatically downloaded from their corresponding
websites. Patches and configure/make options necessary for a clean
compile for ARM are included in makerootfs. Some of them are based on
files from
gumstix-buildroot,
buildroot and
openembedded.
A
default configuration for
/etc allows a quick start and produces a
usable small Linux distribution with (almost) no additional changes.
Size: A complete build without
opie produces a compressed jffs2 filesystem of
about 10MB. Qte and opie take additional 12MB. On a 2.4 GHz machine,
the complete build process can take about 2-3 hours.
This build system was tested on an Intel XScale CPU (PXA270), but
should work for any ARM architecture, and with few modifications might
even work for different architectures. If you try it, please let me
know of your experiences!
Documentation - Download
makerootfs
makerootfs is hosted on Sourceforge.net.
Check out the latest sources:
$ cvs
-d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/makerootfs
login
$ cvs -z3
-d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/makerootfs co
-P makerootfs
or download a snapshot
$
wget http://makerootfs.sourceforge.net/makerootfs.tar.gz
and unpack it
$
tar xfvz makerootfs.tar.gz
Enter makerootfs
$
cd makerootfs
You will find the following
directories
and files:
patches/ |
contains patches, configfiles
and initscripts that do not come with the original software package |
makescripts/ |
shell scripts, which download,
cross-compile and
install selected packages into staging directory |
1build-toolchain.sh |
build a toolchain first using
crosstool (only if no toolchain is found in PATH) |
2build-rootfs_staging.sh |
run selected scripts
(MYMAKE_LIST) in makescripts/, configured in makerootfs.conf
|
3create-rootfs-fromstaging.sh
|
create skeleton root filesystem
from patches/rootfs-skel.tar.gz and
copy binaries (libraries, executables, config files, ...) into final
root filesystem
|
4create-rootfs-toolchainlibraries.sh
|
copy libraries from current
toolchain into final root filesystem
|
5create-rootfs-kernelmodules.sh
|
copy kernel modules into final
root filesystem
NOTE: As the kernel highly
device specific, makerootfs DOES NOT build a kernel automatically. Make
sure you have a compiled device kernel and update KERNELPATH in
makerootfs.conf
|
6create-jffs2-fromrootfs.sh
|
create final jffs2 including
device nodes and the files in rootfs/
|
The source code for actual software packages is downloaded during the
build process directly from the different project pages, so there is no
big tar.gz'ed "distribution" archive coming with makerootfs.
The software versions are not the latest CVS code, but tested release
versions.
An internet connection allowing downloads is therefore required. wget
is used for the majority of downloads, so it also works behind a proxy.
Currently, the sources for three projects are mirrored here and not downloaded
from their original web page by default. These are busybox, tslib and alsa. If
you need the latest version, edit the makescripts to switch to using CVS/snapshots.
All downloads are stored locally and reused later if the sources are recompiled
(default location: makerootfs/download)
Beside
the package specific make tools, wget, patch and are the only
additionally needed software on the build system, and therefore the
scripts work on any Linux system without requiring a complex setup,
like for openembedded.
Documentation - Configure makerootfs
The default configuration configuration file is
makerootfs/makerootfs.conf
Edit this file to change the following:
- directory names
- toolchain versions
- paths (e.g. Linux kernel)
- compiler-flags
- additional options for wget
...and of course...
- select packages to be cross-compiled and included in the root
filesystem
Some packages (like pcmcia-cs or hostap) need compiled kernel sources,
so make sure you set the correct paths or comment out these packages.
Otherwise you can go with the default settings.
Documentation - Run and use makerootfs
-
How to do a complete build to
get a final jffs2 root filesystem
If you don't want to build a toolchain,
but use an existing one, make
sure, it can be found in PATH.
The whole build process can be done in a few easy steps:
- To build a toolchain, run
$ ./1build-toolchain.sh
If you want to use that toolchain, you need to source the
makerootfs/set-env-arm-linux script, which puts it into your PATH
- Cross-compile your kernel (configured and compiled kernel is
required
by some packages to build correctly)
- Build packages:
$ ./2build-rootfs_staging.sh
- Create rootfs skeleton and fill it
$
./3create-rootfs-fromstaging.sh
$
./4create-rootfs-toolchainlibraries.sh
$
./5create-rootfs-kernelmodules.sh
- Check device-specific settings within the root filesystem (see below) and/or add own files to rootfs/
- Create jffs2 root filesystem from rootfs/
$
./6create-jffs2-fromrootfs.sh
You will find the final jffs2-file in
makerootfs/.
For your convenience, you can also run scripts #2-#6 in a single line:
$ ./2build-rootfs_staging.sh && ./3create-rootfs-fromstaging.sh
&& ./4create-rootfs-toolchainlibraries.sh
&& ./5create-rootfs-kernelmodules.sh
&& ./6create-jffs2-fromrootfs.sh
-
How to cross-compile single
libraries and applications
You may not always want to rebuild a
complete root filesystem, but just
need a single library or program. If you want to
cross-compile just a few single applications, you can also run
the scripts in makerootfs/makescripts/ directly.
If you don't want to build a toolchain, but use an existing one, make
sure, it can be found in PATH.
There are two ways of building single applications with makerootfs:
- Modifying makerootfs.conf
- Create a copy of makerootfs.conf:
$ cp makerootfs.conf
makerootfs-small.conf
- Edit makerootfs-small.conf and comment out all packages from
MYMAKE_LIST you don't need
- Select makerootfs-small.conf as configuration file:
$ export
MAKEROOTFS_CONFIG=makerootfs-small.conf
- Run build-script:
$ ./2build-rootfs_staging.sh
Of course, you can also just edit the original makerootfs.conf.
- Directly calling the actual
make_ script
- Make sure the downloads/ and build/ directory exists
$ mkdir -p downloads build
- Run the make script (keep in mind that you must the scripts from the
makerootfs directory. Do not enter
makescripts/ !!!)
$
./makescripts/make_busybox.sh
Keep in mind that dependencies are not resolved automatically when you
call the scripts directly! So make sure you call the right make_-script
to compile the required libraries before
your actual program.
You will find the final files in rootfs_staging.
- New files and directories
A few new files and directories will be
created during the whole process:
- arm-linux-*/: toolchain, if created
- build/: the sources are cross-compiled here. Additional host
tools (like mkfs.jffs2) are also kept here
- rootfs_staging/: contains (almost) everything that "make install"
would install, i.e. binaries, libraries, header files, man-files, ...
- roofs/: created from rootfs_staging/, only required files along
with stripped binaries go here.
- set-env-arm-linux-*.sh: source this if you want to use the
previously created toolchain.
Documentation - Adapt the root filesystem to
specific hardware
There are always slight differences on every device, so there no thing
like a generic root filesystem. But rootfilesystems can be adopted
pretty quickly if you know what to change where.
So here is a list of what you should check: (please drop me a line if
you found something not listed here)
- /dev device entries (special kernels may offer special devices)
created through mkfs.jffs2 and defined in patches/device-table.txt
- Serial ports: /etc/inittab (login-shell), /etc/conf.d/inputattach
(serial keyboard), /etc/init.d/bluetooth&/etc/conf.d/bluetooth
(serial BT dongle)
- Root device on flash: /etc/init.d/rcS (default /dev/mtdblock2),
- Modules: /etc/modprobe.conf, /etc/init.d/alsa&/etc/init.d/oss
(sound), /etc/modules.autoload
- Touchscreen: /etc/ts.conf /etc/profile-qpe
- IP addresses: /etc/hosts, /etc/conf.d/usb
Documentation - FAQ
-
A download failed once for a file, but now that package won't
build anymore. Do I have to start all over again?
No. Delete the downloaded file if it was incomplete (rm
downloads/package.tar.gz). Then delete any remains of an incomplete
build directory (rm -rf build/<package>/). Then just run 2build-rootfs_staging.sh again.
-
Can I build my rootfs without being online?
Yes, but you need to download the appropriate packages by hand
in advance and put them into your download directory
(default: makerootfs/downloads/)
For alsa-lib, tslib and busybox (the first two use cvs, busybox svn),
find working snapshots here
-
How can I use a different config file?
Set MAKEROOTFS_CONFIG environment variable to your new config file
-
Even if I commented out packages from makerootfs.conf, they are
still included in the final rootfilesystem. Why?
MYMAKE_LIST only controls which
packages to cross-compile and installed in rootfs_staging. The
createrootfs-scripts work directly on rootfs_staging, so need to remove
the binaries from here before creating your jffs2 file. Or remove your
rootfs_staging directory and rebuild everything.
-
Can I use an existing toolchain?
Yes, just put it in your PATH, the
scripts will use it automatically.
NOTE: Some toolchains may lack certain programs or use different
versions of include files, which may result in compile errors. Just
keep that in mind when cross-compiling!
Contact
This build system came to life as part of a research collaboration
between Carnegie Mellon University and Intel.
If you have questions, comments, suggestions, bugs or new
make_files.sh, feel free to mail them to <m.ihmig _a t_ mytum.de>
Last Change - 2005/08/11 by Matthias Ihmig