Tag Angstrom

Bitbaking the kernel, Angstrom and qt4-embedded all at once

This is what i should have done to begin with! The instructions are very similar to previous ones except this time we clone the right git repository!

On a fresh copy of Fedora 11 I updated the system and installed the packages reccommended by OE:

su -c “yum install python m4 make wget curl ftp cvs subversion tar bzip2 gzip unzip
python-psyco perl texinfo texi2html diffstat openjade docbook-style-dsssl
docbook-style-xsl docbook-dtds docbook-utils sed bison bc glibc-devel glibc-static
gcc binutils pcre pcre-devel git quilt groff linuxdoc-tools patch linuxdoc-tools
gcc-c++ help2man perl-ExtUtils-MakeMaker”

I then made a folder called OE in my home directory and git cloned the mini2440 repo:

cd ~
mkdir OE
cd OE
git clone git://repo.or.cz/openembedded/mini2440.git openembedded

I then setup the source-me.txt similar to before:

gedit source-me.txt

I put the following in:

export OETREE="/home/doug/OE"

BBPATH=${OETREE}/:${OETREE}/openembedded/

echo Setting up dev env for Ångström

if [ -z ${ORG_PATH} ] ; then
ORG_PATH=${PATH}
export ORG_PATH
fi

if [ -z ${ORG_LD_LIBRARY_PATH} ] ; then
ORG_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
export ORG_LD_LIBRARY_PATH
fi

PATH=${OETREE}/openembedded/bitbake/bin:${ORG_PATH}

LD_LIBRARY_PATH=
export PATH LD_LIBRARY_PATH BBPATH
export LANG=C
export BB_ENV_EXTRAWHITE="MACHINE DISTRO OETREE ANGSTROM_MODE ANGSTROMLIBC LIBC"

su -c 'sysctl vm.mmap_min_addr=0'

echo "Altered environment for OE Development"

Now all you need to do is setup the local.conf. Simply edit the example and copy it to the right place:

cd openembedded
gedit mini2440_local_conf_example.conf

Read this file and edit as appropriate. I have attached mine as an example. Now copy it to the conf/local.conf

cp mini2440_local_conf_example.conf conf/local.conf

If you want qt4-embedded or any other package included in the build simply edit the recipe in:

openembedded/recipes/images/mini2440-image.bb

I added qt4-embedded:

#Angstrom bootstrap image

IMAGE_PREPROCESS_COMMAND = "create_etc_timestamp"

ANGSTROM_EXTRA_INSTALL ?= ""

DEPENDS = "task-base-extended
psplash-zap
esekeyd u-boot-utils tslib
i2c-tools i2c screen rsync nfs-utils
directfb gdbserver directfb mtd-utils
"

IMAGE_INSTALL = "task-base-extended
${ANGSTROM_EXTRA_INSTALL}
psplash-zap qt4-embedded
esekeyd u-boot-utils tslib-calibrate tslib-tests
i2c-tools i2c screen rsync nfs-utils-client
directfb gdbserver directfb mtd-utils
rsvg pango
"

export IMAGE_BASENAME = "mini2440-image"
IMAGE_LINGUAS = ""

inherit image

Then all you have to do is source the script from wherever you put it:

source source-me.txt

and run bitbake:

bitbake mini2440-image

from the ~/OE/openembedded/ directory..

If you get an error trying to build a package try cleaning it:

bitbake -c clean INSERTPACKAGENAME

Then try and build the image again. Maybe you won't have this problem. I guess it's either because the checksum parser failed to build or my hdd is dodgy. It only happened once on binutils but worked fine after cleaning it.

A few hours later if all goes well you should have images in:

~/OE/oetmp/deploy/glibc/images/mini2440/

Obviously that directory depends on what you setup in the local.conf.

Good luck!

Configuring Open Embedded to bake Angstrom images for the mini2440

Please Note: I noticed a few people were having trouble with the Angstrom build using Doug's article, so I thought I'd post the exact method I used (which seemed to work!) so others can retrace my steps with out confusing anyone by editing the previous article! If you have already successfully baked an Angstrom image please ignore this post!

First off I'd like to point out that this article is essentially an amalgamation of the Open Embedded Wiki (Getting Started) and Angstrom's 'Building Angstrom' articles but in context relating to the mini2440 Embedded PC. If you would like a more detailed and probably better written explanation please refer to these two articles.

Make sure you have the packages needed for Open Embedded(OE) by visiting here and looking under the section relating to your distro. Running fedora 11 I did:

su -c "yum install python m4 make wget curl ftp cvs subversion tar bzip2 gzip unzip
python-psyco perl texinfo texi2html diffstat openjade docbook-style-dsssl
docbook-style-xsl docbook-dtds docbook-utils sed bison bc glibc-devel glibc-static
gcc binutils pcre pcre-devel git quilt groff linuxdoc-tools patch linuxdoc-tools
gcc-c++ help2man perl-ExtUtils-MakeMaker"

Getting down to business...

Open up a terminal. Issue these commands:

su -
mkdir -p /stuff2/build/conf
chmod 777 -Rf /stuff2/
exit
cd /stuff2/

Download latest bitbake from here and extract the bitbake directory in the archive (eg. bitbake-1.8.16) to /stuff2/

A few more commands:

mv bitbake-1.8.16/ bitbake
git clone git://git.openembedded.org/openembedded
cp openembedded/conf/local.conf.sample build/conf/local.conf

Edit the config you have just copied using your favourite text editor.

gedit build/conf/local.conf

It is important that you read the config carefully so that you understand what everything does...

Next edit it to look something like this (which is just a slightly modified version of openembedded/contrib/angstrom/local.conf) :

Note: Do not copy and paste from this article due to formatting issues. You can download a pre-made local.conf here.Just extract to /stuff2/build/conf/ ...

MACHINE = "mini2440"

# Where to store sources
DL_DIR = "/stuff2/downloads"

INHERIT += " rm_work "

# Make sure you have these installed
ASSUME_PROVIDED += "gdk-pixbuf-csource-native imagemagick-native librsvg-native"

# Which files do we want to parse:
BBFILES := "/stuff2/openembedded/recipes/\*/\*.bb"
BBMASK = ""

# What kind of images do we want?
IMAGE_FSTYPES += " tar.bz2 "

# Set TMPDIR instead of defaulting it to $pwd/tmp
TMPDIR = "/stuff2/${DISTRO}-dev"

# Make use of SMP and fast disks
PARALLEL_MAKE = "-j2"
BB_NUMBER_THREADS = "2"

#tinderbox
#INHERIT += "oestats-client"
OESTATS_BUILDER = "myname"

DISTRO = "angstrom-2008.1"

Save and exit the editor. Download this script and move it to the directory /stuff2/ .

Check it is ok:

gedit /stuff2/source-me.txt

It should look something like this:

export OETREE="/stuff2"
export PATH=/stuff2/bitbake/bin:$PATH
BBPATH=${OETREE}/:${OETREE}/build/:${OETREE}/openembedded/
PKGDIR=${OETREE}/build/
DL_DIR=${OETREE}/downloads
echo Setting up dev env for Ångström

if [ -z ${ORG_PATH} ] ; then
ORG_PATH=${PATH}
export ORG_PATH
fi

if [ -z ${ORG_LD_LIBRARY_PATH} ] ; then
ORG_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
export ORG_LD_LIBRARY_PATH
fi

PATH=${OETREE}/openembedded/bitbake/bin:${ORG_PATH}

cd $PKGDIR

LD_LIBRARY_PATH=
export PATH LD_LIBRARY_PATH BBPATH
export LANG=C
export BB_ENV_EXTRAWHITE="MACHINE DISTRO OETREE ANGSTROM_MODE ANGSTROMLIBC LIBC"

echo "Altered environment for OE Development"

save, and start the script:

cd /stuff2/
source source-me.txt
cd ../openembedded

one last update:

git pull

Issue a few commands to fix build issues:

su
sysctl vm.mmap_min_addr=0
setenforce 0 (Fixes an SELINUX problem during building)
exit

issue build commands:

bitbake base-image ; bitbake console-image ; bitbake x11-image

Be prepared to saturate your internet connection, wait a long time and take up a lot of disk space! The result ends up in:

stuff2/angstrom-dev/deploy/glibc/images/mini2440

You should have the image(s) in .jffs2 for flashing and .tar.gz for mounting using NFS.

Building Angstrom

I've been meaning to put this up for a while. Providing nothing goes wrong the whole process is actually very easy! This is basically a rehash of the Angstrom webpage so you might prefer to follow that taking notes of the minor deviations below:

export OETREE="/home/doug/OE"
mkdir -p ${OETREE}

cd ${OETREE}
git clone git://git.openembedded.org/openembedded.git openembedded
cd openembedded
git checkout origin/stable/2009 -b stable/2009

To update the OE metadata simply:

cd ${OETREE}/openembedded
git pull

Now make the suggested script source-me.txt changing OETREE to suit your needs:

export OETREE="/home/doug/OE"

BBPATH=${OETREE}/:${OETREE}/build/:${OETREE}/openembedded/
PKGDIR=${OETREE}/build/
DL_DIR=${OETREE}/downloads
echo Setting up dev env for Ångström

if [ -z ${ORG_PATH} ] ; then
ORG_PATH=${PATH}
export ORG_PATH
fi

if [ -z ${ORG_LD_LIBRARY_PATH} ] ; then
ORG_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
export ORG_LD_LIBRARY_PATH
fi

PATH=${OETREE}/openembedded/bitbake/bin:${ORG_PATH}

cd $PKGDIR

LD_LIBRARY_PATH=
export PATH LD_LIBRARY_PATH BBPATH
export LANG=C
export BB_ENV_EXTRAWHITE="MACHINE DISTRO OETREE ANGSTROM_MODE ANGSTROMLIBC LIBC"

echo "Altered environment for OE Development"

I also had to set:

sudo sysctl vm.mmap_min_addr=0

Then setup local.conf:

mkdir -p ${OETREE}/build/conf
cp ${OETREE}/openembedded/contrib/angstrom/local.conf ${OETREE}/build/conf/

Now edit ${OETREE}/build/conf/local.conf and add this to the end:

MACHINE = "mini2440"

Now download the mini2440 config file from openembedded. Put this in:

${OETREE}/openembedded/conf/machine/

Now source the source-me.txt, go to the OE tree, check it's up to date

source source-me.txt
cd ${OETREE}/openembedded
git pull - -rebase

Now build the images, you can build all of them or just one. I used the base image for running Qt but i also built the gpe image which worked nicely if you need it.

bitbake base-image ; bitbake console-image ; bitbake x11-image ; bitbake gpe-image

Be prepared to saturate your internet connection, wait a long time and take up a lot of disk space!

The result ends up in:

${OETREE}/angstrom-dev/deploy/glibc/images/mini2440

You should have the image(s) in .jffs2 for flashing and .tar.gz for mounting using NFS.

Booting using NFS and TFTP (updated)

Rather than slowly wearing out your NAND flash you can boot the mini2440 over a network by loading the kernel using TFTP and the OS from an NFS share. This also makes it much faster to test changes. Using Fedora 11 you can use YUM to install tftp, tftp-server and nfs-utils.

yum install tftp tftp-server nfs-utils

I created a folder /home/doug/mini2440/root_fs and added the following line to /etc/exports to allow r/w access from 192.168.1.*:

/home/doug/mini2440/root_fs 192.168.1.1/24(rw,sync,no_root_squash)

..and extracted the Angstrom file system as root to /home/doug/mini2440/root_fs

You'll need to edit /etc/xinetd.d/tftp to setup TFTP. Mine is posted below for reference, you at least need to set disable = no.

# default: off
# description: The tftp server serves files using the trivial file transfer
# protocol. The tftp protocol is often used to boot diskless
# workstations, download configuration files to network-aware printers,
# and to start the installation process for some operating systems.
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /home/doug/mini2440/kernel
per_source = 11
cps = 100 2
flags = IPv4
}

I then started the services :

/etc/init.d/nfs start

/sbin/service xinetd start

To automate these i think you can do:

chkconfig tftp on

chkconfig xinetd on

chkconfig nfs on

Next i edited the uboot environment. Use the command setenv to modify or add entries and savenev when you're finished. I ended up with the following:

MINI2440 # printenv
bootdelay=3
baudrate=115200
ethaddr=08:08:11:18:12:27
usbtty=cdc_acm
mtdparts=mtdparts=mini2440-nand:256k@0(u-boot),128k(env),5m(kernel),-(root)
mini2440=mini2440=0tb
bootargs_base=console=ttySAC0,115200 noinitrd
bootargs_init=init=/sbin/init
root_nand=root=/dev/mtdblock3 rootfstype=jffs2
root_mmc=root=/dev/mmcblk0p2 rootdelay=2
root_nfs=/mnt/nfs
set_root_nfs=setenv root_nfs root=/dev/nfs rw nfsroot=${serverip}:${root_nfs}
ifconfig_static=run setenv ifconfig ip=${ipaddr}:${serverip}::${netmask}:mini2440:eth0
ifconfig_dhcp=run setenv ifconfig ip=dhcp
ifconfig=ip=dhcp
set_bootargs_mmc=setenv bootargs ${bootargs_base} ${bootargs_init} ${mini2440} ${root_mmc}
set_bootargs_nand=setenv bootargs ${bootargs_base} ${bootargs_init} ${mini2440} ${root_nand}
set_bootargs_nfs=run set_root_nfs; setenv bootargs ${bootargs_base} ${bootargs_init} ${mini2440} ${root_nfs} ${ifconfig}
mtdids=nand0=mini2440-nand
bootargs=console=ttySAC0,115200 noinitrd init=/sbin/init mini2440=0tb ip=192.168.1.85 root=/dev/nfs rw nfsroot=192.168.1.10:/home/doug/mini2440/root_fs
bootfile="uImage"
filesize=1E9088
fileaddr=32000000
gatewayip=192.168.1.100
netmask=255.255.255.0
ipaddr=192.168.1.85
serverip=192.168.1.10
bootcmd=tftp;bootm 32000000
partition=nand0,0
mtddevnum=0
mtddevname=u-boot

Note when you setenv you have to omit the = sign. Obviously you'll want to change some of this to suit your network setup. Here my laptop is 192.168.1.10 and 192.168.1.100 is my pfsense box which is assigning 192.168.1.85 to the mini2440 by DHCP.

When you boot the system uboot will download the kernel over TFTP and then mount the NFS share.

If you have DHCP on your network Angstrom should automatically get an IP. You can skip the rest in this case!

If you want a static address you can change /etc/network/interfaces. I simply changed dhcp to static for eth0:

iface eth0 inet static

And after this the system booted up fine. Lastly i have a note which says I deleted the symlink /etc/resolve.conf and replaced it with:

domain local
search local
nameserver 192.168.1.100

Be warned that the the entire of above needs to be compliant with your firewall and selinux, it won't work otherwise!

I found the following Links helpful:

TFTP

NFS

U-boot NFS / TFTP boot

Cross compiling Qt-embedded 4.5.3

Cross compiling Qt was actually very easy. I used the same machine described in the mini2440 kernel post.  If you have a vanilla install of Fedora 11  it's more than likely you'll get some errors due to missing packages so check the list i posted if you can't figure out which ones you need. This is what i did:

  1. Download the Qt source from Trolltech
  2. Untar the archive somewhere, i simply used the desktop
  3. Edit the file mkspecs/qws/linux-arm-g++/qmake.conf according to your toolchain. I have attached mine here as an example. I used the toolchain from OpenEmbedded.
  4. Now run the following commands within the Qt directory:
  • .\ */configure -embedded arm -xplatform qws/linux-arm-g++ -prefix /usr/local/Qt -qt-mouse-tslib -little-endian*
  • *gmake -j 2* (or however many CPUs you have)
  • sudo gmake install

The resulting ~74MB  will be located in /usr/local/Qt. At first i ran the library from an SD card using a system wide link but later i used NFS.

I ran the library using BusError's mini2440 kernel and an Angstrom base image I cross compiled using OpenEmbedded apriori. In my next post i'll describe how to compile Angstrom Linux for this purpose which also provides the toolchain i used here. Finally when i get access to my mini2440 i'll explain how to use the examples and setup the touch screen which was a little fiddly.

Big thanks to Cor for his post on building Qt which i've relied on heavily here.

Qt 4.5 for Embedded Linux: Fluid Launcher Demo

After a lot of messing around i cross compiled the mini2440 kernel (massive thanks to buserror) , the Angstrom Linux distribution and Qt 4.5 for Embedded Linux. I was impressed by how quickly the demos run, check out the video below  if you're interested:

When i get some time  i'll post up some more information on how i got this to work.