Table of Contents
Mamona Development Setup
To start building Mamona yourself, hacking the packages and etc you first need to install the Mamona build environment. Mamona is nothing more that a custom OpenEmbedded distribution, so to build it you'll just need the bb files and BitBake to actually build the packages.
Basic Requirements
- Git >= 1.5.5
- Python
- Subversion
- Quilt
We suggest using a git version >= 1.5.5 because it has some new commands that probably will be useful to you (it was for us). The mamona_setup.sh script checks if this version is installed and offers the option to upgrade if you're using Ubuntu. If you want to install the back ported newer version prior to running mamona_setup.sh, and you are running Ubuntu your script could install them from http://dev.openbossa.org/mamona/download/git-gutsy-backport/ . You need to install just "git-core" and "gitk" packages to replace default installed ubuntu packages.
Installing the Mamona build environment
To install the Mamona build environment basically you'll just need to run the mamona_setup.sh script. This script will only work if you're using a Debian or Ubuntu distro as the host machine, because it'll check for packages in debian mode (a generic script is on the way).
We recommend you to install Mamona as a normal user, don't try installing or building it with root.
Installing using the mamona_setup.sh:
user@localhost ~ $ export INSTALL_PATH=/opt/mamona/ # or whatever you want/have permission to write user@localhost ~ $ wget http://dev.openbossa.org/mamona/tools/mamona_setup.sh user@localhost ~ $ chmod +x mamona_setup.sh user@localhost ~ $ ./mamona_setup.sh install -p $INSTALL_PATH
*NOTES FOR UBUNTU USERS*
- Be sure that your are not using dash, but bash as your default shell.
user@localhost ~ $ ls -l `which sh`
- If the result is /bin/sh -> dash you need to change (Ubuntu uses dash as your default shell). To change this configuration use the following command:
user@localhost ~ $ sudo dpkg-reconfigure dash # and select 'No'
The mamona_setup.sh script will:
- Clone mamona.git repository (packages repository based on OE)
- Clone tools.git repository (scripts and configuration files)
- Add OE git server as remote repository in mamona.git and fetch its branches
- Create mamonarc source file (see details below) with Mamona definitions
Setting the mamonarc file
The mamonarc source file basically export all needed variables to setup BitBake, the tool responsible for building Mamona packages.
You have to configure it based on your needs, because you probably want to build packages:
- Using different machines (nokia800, nokia770, i586-generic, ...)
- Using different branches (mamona, oe, user-defined, ...)
- From different workdirs (not common, probably you will use mamona.git one)
And to set up your mamonarc you can use mamonarc itself to do the job (or you can just modify the file, putting your options.
Using mamonarc to edit itself:
$ source mamonarc -h
Create OE/Mamona environment
** NOTE ** This help is from mamona_setup.sh script but the front-end mamonarc can show it
Usage: ./mamona_setup.sh install [-p MAMONA_PATH]
./mamona_setup.sh update [-b BRANCH_NAME | -c] [-m MACHINE] [-g GIT_REPO_PATH] [-j BUILD_METHOD] [-s] [-t]
source mamonarc [-b BRANCH_NAME | -c] [-m MACHINE] [-g GIT_REPO_PATH] [-j BUILD_METHOD] [-s] [-t]
Overview:
* mamona_setup.sh:
This script was created to automate the setup of mamona environment.
The 'install' option create a workdir with mamona and oe branches. It also pull the tools repository and
create the mamonarc source.
The 'update' option updates the mamonarc script. Usually this option will be called by mamonarc. So if
you want to update Mamona variables and/or mamonarc script, please use the mamonarc script.
* mamonarc:
Source file to set required Mamona variables.
Use it without options to just set the variables.
Use the options to set the variables overwriting the default values.
Use -s to make the values default.
Options:
-b BRANCH_NAME | -c
Set the branch to be used. You can pass either the name in BRANCH_NAME using -b parameter or the currently selected branch using -c
If you DON'T use any of this arguments the value set in mamonarc will be used.
-m MACHINE
Set the target machine (nokia800, nokia770, i586-generic, ...)
If you DON'T use this argument the value set in mamonarc will be used.
-g GIT_REPO_PATH
Set the path to git repository.
If you DON'T use this argument the value set in mamonarc will be used.
-j BUILD_METHOD
Set the best configurations to build to single-core (singlecore), multi-core (muilticore)
-s
Set the data passed as default (write to mamonarc file)
-t
Test if the current variables are valid to be used. This option is used when you don't want to change any variable but ensure that the correct branch is set and make other checks.
-p MAMONA_PATH
Path to Mamona home directory (default: $PWD/mamona)
As you can see, mamonarc uses mamona_setup.sh to configure the environment. Don't use mamona_setup.sh directly because it CAN'T export shell variables.
To explain better how does this work, take a look in some examples:
- To just export the configuration at mamonarc file:
user@localhost ~/mamona/build $ source mamonarc
- To export the configuration to build a different branch. This will automatically change the current branch in workdir (if it's clean):
user@localhost ~/mamona/build $ source mamonarc -b <branch_name>
- To export the configuration to build a different machine.
user@localhost ~/mamona/build $ source mamonarc -m <machine_name>
- To change both options and make these options as default (overwriting mamonarc file)
user@localhost ~/mamona/build $ source mamonarc -s -b <branch_name> -m <machine_name>
Building Mamona
After exporting the configuration at mamonarc you can call BitBake to build your packages.
To build it just go to the directory of your Mamona environment, and run BitBake with package you want:
user@localhost ~/mamona/build $ source mamonarc # ## Exported MAMONA variables: # # PATH = /home/user/mamona/build/bitbake/bin:/usr/kde/3.5/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i486-pc-linux-gnu/gcc-bin/4.1.2:/usr/i686-pc-linux-gnu/gcc-bin/4.1.2:/usr/qt/3/bin # BBPATH = /home/user/mamona/build/mamona.git:/home/user/mamona/build/ # MAMONA_HOME = /home/user/mamona/build/ # MAMONA_REPO_PATH = /home/user/mamona/build/mamona.git # MAMONA_BRANCH = master # MAMONA_MACHINE = nokia800 # MAMONA_BUILD_METHOD = singlecore *INFO* Your local.conf is in /home/user/mamona/build/conf user@localhost ~/mamona/build $ bitbake <package>
Building everything supported by Mamona
Inside OpenEmbedded there are the officially supported packages by Mamona.
We have a meta package that covers everything we support. If you want to build all of them just give:
user@localhost ~/mamona/build $ bitbake meta-mamona
Building the Mamona rootfs
To create the Mamona rootfs you need to follow a few additional steps:
Create a debian repository
The result of Bitbake builds are debian packages containing all the different components. You can take a look at all generated packages by going into your deploy directory (tmp/<branch>/<machine>/deploy/deb).
As we use debootstrap to create the root file system, we first should create a valid debian repository with all packages created during the build process.
To make your life easier, we provide one script that will get every deb package you built and create the repository. To use it, just give:
user@localhost ~/mamona/build $ ./tools.git/scripts/gen_repository.sh
Notes:
- if you didn't run source mamonarc before running ./tools.git/scripts/gen_repository.sh it'll ask you all parameters it needs to get your environment configuration.
- if you had a error like "ERROR: reprepro not found" then you should install reprepro first (sudo apt-get install reprepro Debian/Ubuntu)
Prepare debootstrap
To create the root file system we use the debootstrap tool. This tool uses a file containing information about how to bootstrap a new debian based system. First we copy this file to where debootstrap will search for it:
sudo cp $MAMONA_HOME/tools.git/scripts/debootstrap/mamona /usr/share/debootstrap/scripts/
Run debootstrap
After that we are ready to create the new root file system, this is done by giving debootstrap the mamona script and the location of our just created repository:
sudo debootstrap --arch arm mamona mamona-root file://$MAMONA_HOME/tmp/$MAMONA_BRANCH/$MAMONA_MACHINE/deploy/deb-repository
Optionally to get a headstart you can specify additional packages to install with debootstrap by using --include, like:
sudo debootstrap --include=task-mamona,task-mamona-wm --arch arm mamona mamona-root file://$MAMONA_HOME/tmp/$MAMONA_BRANCH/$MAMONA_MACHINE/deploy/deb-repository
Chroot into your new rootfs
To chroot at your newly created rootfs you just need to mount proc and bind /dev and give chroot (taking from the point that you're ok with Qemu). To make your life easier we created one script that will do this for you, besides setting everything up with Qemu.
To use it just give the rootfs path as the first parameter:
sudo ./$MAMONA_HOME/tools.git/scripts/mamona_chroot.sh mamona-root
Installing additional packages
At this point we suggest you two ways of accessing your packages inside your chroot environment, one is to export the debian repository at your web server and the other is to copy the repository to a location inside the chroot (this is handy because it will allow us later copy the full root file system containing the full repository).
Accessing the repository by a valid web address
After you export your deb-repository at a valid web address, you just need to set up your sources.list and update apt.
Updating your source.list:
bash-3.2# vi /etc/apt/sources.list deb http://youraddress/deb-repository mamona main
Update the list of repository:
apt-get update
And install the packages:
apt-get install task-mamona-wm
Accessing the repository by coping it to your rootfs
Copy your deb-repository inside your rootfs:
sudo cp -r $MAMONA_HOME/tmp/$MAMONA_BRANCH/$MAMONA_MACHINE/deploy/deb-repository mamona-root/media/repo
Go into the chroot, edit /etc/apt/sources.list and a link to the local copy of the repository and replace deb http://ftp.us.debian.org/debian mamona main with
#/etc/apt/sources.list deb file:///media/repo mamona main
Update the list of repository
apt-get update
And install the packages
apt-get install task-mamona-wm
Finishing installation
We now can perform some cleanup operations. Inside the chroot you can perform:
- apt-get clean to clean up temporary files used by the setup.
- passwd to change the root password
Creating rootfs image and flashing Mamona to the device
Now you can just follow the guide at Running Mamona to generate the rootfs jffs2 image and to flash it at your device.
Additional info
Read Meta Mamona to know more about Mamona meta packages.
Read Speed up to learn how to improve the build performance.
