OpenEmbedded Setup Script

Paul
Hi guys,
here after is a script I wrote to setup and bitbake stuff under
Ubuntu.

HOW TO USE:
DO NOT RUN THIS ON A MOUNTED NTFS PARTITION, you will get errors and it
will take weeks to figure out why (I learnt the hard way).

The script is configured to use dual core processors which speeds things up
a bit.
Just download and run the script, it will ask you where what folder you
want to make the main folder.

NOTE: The script will then open up .bashrc with gedit, this is to allow you
to remove additional OE_HOME entries if you add them accidentally, if there
is only one entry at the bottom of the file, just close gedit.

Once it has finished, if you go to 
cd ${OE_HOME}/build
source profile
bitbake -k <some image>

TO DO:
I haven't implemented testing for some of the folders, but I don't have
time to revise it now, so feel free to add to the script and repost it.
I have some hard coded branches of OE and bitbake because I know these work
properly. Feel free to update and repost, just please make sure they work
properly.

OTHER STUFF:
I suggest you use the kernel provided by this website, as the OE one will
work but is lacking a lot of the mini2440 specific driver modules.

It took me days to setup OE the first time, the learning curve is just
terrible, so hopefully this will help.

Thanks to all of those guys who posted tutorials for OpenEmbedded.
Especially those who were working hard at this stuff 6 months ago when I
started out, and naturally to BusError.

Cheers
Paul

-----------------------------
COPY THE FOLLOWING TO A FILE
-----------------------------

#!/bin/sh

echo "Cleaning up first..."
rm $OE_HOME/build/conf/local.conf
rm $OE_HOME/build/profile
rm $OE_HOME/openembedded/conf/machine/mini2440.conf

echo "OE_HOME=$OE_HOME"
echo "Is OE_HOME set above? (y,n): "
read x
if [ "$x" = "n" ] ; then
  echo "Enter path to OE_HOME: "
  read oepath
  export OE_HOME=$oepath
  echo export OE_HOME=$oepath >> $HOME/.bashrc
  gedit $HOME/.bashrc
  source $HOME/.bashrc
fi

mkdir -p $OE_HOME
mkdir -p $OE_HOME/build
mkdir -p $OE_HOME/build/conf
mkdir -p $OE_HOME/custom_recipies/

sudo apt-get install sed wget cvs subversion git-core \
   coreutils unzip texi2html texinfo libsdl1.2-dev docbook-utils \
   gawk python-pysqlite2 diffstat help2man make gcc build-essential g++ \
   texi2html libncurses5-dev python-dev python-psyco \
   gnome-doc-utils gettext automake docbook bison flex libxml2-utils xmlto
python-psyco

echo
echo "Please choose a repository:"
echo "1. STABLE git://repo.or.cz/openembedded/mini2440.git";;
echo "2. DEV git://repo.or.cz/openembedded/mini2440.git";;
echo "3. git://git.openembedded.org/openembedded";;
read x
cd $OE_HOME
if [ "$x" = "1" ] ; then
  git clone git://repo.or.cz/openembedded/mini2440.git openembedded
  cd openembedded
  git checkout -b mini2440-stable --track origin/mini2440-stable
  git branch
elif [ "$x" = "2" ] ; then
  git clone git://repo.or.cz/openembedded/mini2440.git openembedded
elif [ "$x" = "3" ] ; then
  git clone git://git.openembedded.org/openembedded
else
  echo "defaulting to repo.or.cz stable"   
  git clone git://repo.or.cz/openembedded/mini2440.git openembedded
  cd openembedded
  git checkout -b mini2440-stable --track origin/mini2440-stable
  git branch
fi

echo "Downloading Bitbake 1.8"
cd $OE_HOME
git clone git://git.openembedded.org/bitbake.git
cd bitbake
git checkout -b 1.8 --track origin/1.8
git branch
cd ..

cp $OE_HOME/openembedded/conf/local.conf.sample
$OE_HOME/build/conf/local.conf 

################################################################################




################
echo "Generating $OE_HOME/build/profile"

cat > $OE_HOME/build/profile << ENDOFFILE
export OE_HOME="$OE_HOME"
export PATH=${OE_HOME}/bitbake/bin:$PATH
BBPATH=${OE_HOME}/:${OE_HOME}/build/:${OE_HOME}/openembedded/
PKGDIR=${OE_HOME}/build/ 
DL_DIR=${OE_HOME}/downloads
echo Setting up dev env for Angstrom

cd $PKGDIR

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

echo "Altered environment for OE Development"

umask 0002

if [ "\$PS1" ]; then
  if [ "\$BASH" ]; then
    export PS1="\[\033[01;32m\]OE:\$MY_OE_CONF\[\033[00m\] \${PS1}"
  fi
fi

cd ${OE_HOME}/build
ENDOFFILE
################################################################################




################
echo "Generating $OE_HOME/build/conf/local.conf"
# Local Configuration File
cat > $OE_HOME/build/conf/local.conf << ENDOFFILE
MACHINE = "mini2440"

DISTRO = "angstrom-2008.1"

# Where to store sources
DL_DIR = "${OE_HOME}/downloads"

# Removes work files
# 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 := "${OE_HOME}/openembedded/recipes/*/*.bb
${OE_HOME}/custom_recipies/*.bb ${OE_HOME}/custom_recipies/*/*.bb"
BBMASK = ""
 
# What kind of images do we want?
IMAGE_FSTYPES += " tar.bz2 "

# Set TMPDIR instead of defaulting it to $pwd/tmp
TMPDIR = "${OE_HOME}/build"

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

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

ENDOFFILE
################################################################################




################
echo "sysctl vm.mmap_min_addr=0"
sudo sysctl vm.mmap_min_addr=0

echo "Adding mini2440 to ${OE_HOME}/build/conf/local.conf"
echo "MACHINE = \"mini2440\"" >> ${OE_HOME}/build/conf/local.conf

################################################################################




################
echo "Generating ${OE_HOME}/openembedded/conf/machine/mini2440.conf"
cat > ${OE_HOME}/openembedded/conf/machine/mini2440.conf << ENDOFFILE
#@TYPE: Machine
#@Name: Samsung MINI2440 Dev Board
#@DESCRIPTION: Machine configuration for MINI2440 Dev Board

TARGET_ARCH = "arm"

PREFERRED_VERSION_u-boot = "git"
UBOOT_ENTRYPOINT = "30008000"
PREFERRED_PROVIDER_virtual/kernel = "linux-mini2440"

# used by sysvinit_2
SERIAL_CONSOLE = "115200 ttySAC0"

IMAGE_DEVICE_TABLES = "files/device_table-minimal.txt \
                       files/device_table_add-s3c_serial.txt"

IMAGE_FSTYPES = "jffs2 ext3 tar.gz"

MACHINE_FEATURES = "kernel26 uboot touchscreen screen lcd rgb16"
MACHINE_FEATURES += "usbhost usbgadget"
MACHINE_FEATURES += "i2c spi"
MACHINE_FEATURES += "mmc mmcroot vfat"
MACHINE_FEATURES += "ethernet"
MACHINE_FEATURES += "sound alsa"

KERNEL_IMAGETYPE = "uImage"

require conf/machine/include/tune-arm920t.inc

MACHINE_EXTRA_RDEPENDS = "rt73-firmware"
EXTRA_IMAGEDEPENDS += "u-boot"
EXTRA_IMAGECMD_jffs2 = "--pad --little-endian --squash -s 0x200 -n -e
16KiB"
ENDOFFILE

sudo dpkg-reconfigure dash

Paul
Forgot, when asked, say that you want to reconfigure to use BASH, not dash,
otherwise bitbake will complain.

Here are some useful commands:
 bitbake -k <recipe>   
continues building even if there are errors, ideal for overnight builds.

 bitbake <recipe> -c clean
deletes the built recipe

 bitbake <recipe> -c rebuild
rebuilds the recipe

 bitbake <recipe> -c deploy
redeploys the selected recipe

I never figured out how to install ipk files, so I would be very grateful
if someone could clarify.
Cheers
Paul

Olivier
Thx for this script....but my problem is that i need the Prolific 2303
driver in my kernel and i don't know what is the best way to do this ...
Could you help ?
Thanks

Giray
Hey Paul

You can install .ipk files by:

opkg install <nameofpack>.ipk
or
ipkg install <nameofpack>.ipk

Thank you for the script.

Fernando
Hi, I've used this script, I was also loosing much time with the OE
learning curve and the script at least created a base installation without
many issues. My problem now is that when bitbaking some recipes I got
errors extracting some of the downloaded packages. I've tried to do a
bitbake -c clean world but it didn't download the package again. Then
trying to force it to download the packages I deleted the files in the
'download' folder, but it still don't try to download them again, now it
generates file not found errors. What could I do to really clean and force
the download of the packages mentioned in the recipes? I've tried to
bitbake a package not build before and it downloaded and compiled it with
no problems, so at least the basics are working, I suppose that the errors
that I had when extracting the downloaded packages could be caused by
network problems during the package transfer. i could also delete
everything and install OE again, but i suppose that there should be an
easier way to clean the build...

Best regards

Fernando

Piyush
hello guys

and special thanks to you paul for writing such a wonderful script for the
developement of the openembedded and bitbake for the ubuntu system.

I am configuring the system and instaling the openembedded and bittbake on
my ubuntu 10.04 , but I have to ask one question about the error I have
encountered during the building and installing of openembedded on my
system.

Here is the description of my problem:

actually when it started it completing the process in tasks and showing
each time which task it is completing and the total number of the tasks is
2705.


upto the task no.916 it is ok but when it moves to task 917 and 918 it gave
out the errors as follows:

NOTE: Running task 916 of 2705 (ID: 1600,
/home/piyush/oe/openembedded/recipes/module-init-tools/module-init-tools-cross_3
.2.2.bb,
do_configure)
NOTE: generating locale sl_SI (UTF-8)
NOTE: Running task 917 of 2705 (ID: 709,
/home/piyush/oe/openembedded/recipes/linux/linux-mini2440_2.6.32+git.bb,
do_setscene)
NOTE: Running task 918 of 2705 (ID: 710,
/home/piyush/oe/openembedded/recipes/linux/linux-mini2440_2.6.32+git.bb,
do_fetch)
ERROR: Error in executing:
/home/piyush/oe/openembedded/recipes/linux/linux-mini2440_2.6.32+git.bb
ERROR: Exception:<class 'bb.fetch.FetchError'> Message:Fetch command export
HOME=/home/piyush; export SSH_AUTH_SOCK=/tmp/keyring-oblKDf/ssh; export
PATH=/home/piyush/oe/build/staging/i686-linux/usr/bin/mini2440-angstrom-linux-gn
ueabi:/home/piyush/oe/build/staging/i686-linux/usr/bin/armv4t-angstrom-linux-gnu
eabi:/home/piyush/oe/build/staging/i686-linux/usr/sbin:/home/piyush/oe/build/sta
ging/i686-linux/usr/bin:/home/piyush/oe/build/cross/armv4t/bin:/home/piyush/oe/b
uild/staging/i686-linux/sbin:/home/piyush/oe/build/staging/i686-linux/bin:/home/
piyush/oe/bitbake/bin:/home/piyush/work/oe/bitbake/bin:/home/piyush/work/oe/bitb
ake/bin:/opt/qte-4.5.3/lib:/opt/qte-4.5.3/bin:/usr/local/arm/4.3.2/bin:/usr/loca
l/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/arm/4.
3.2/bin:/usr/local/gnuarm/install/bin;
git ls-remote git://repo.or.cz/linux-2.6/mini2440.git
mini2440-stable-v2.6.32 failed with signal 128, output:
fatal: read error (Connection reset by peer)

ERROR: Printing the environment of the function
ERROR: Error in executing:
/home/piyush/oe/openembedded/recipes/linux/linux-mini2440_2.6.32+git.bb
ERROR: Exception:<class 'bb.fetch.FetchError'> Message:Fetch command export
HOME=/home/piyush; export SSH_AUTH_SOCK=/tmp/keyring-oblKDf/ssh; export
PATH=/home/piyush/oe/build/staging/i686-linux/usr/bin/mini2440-angstrom-linux-gn
ueabi:/home/piyush/oe/build/staging/i686-linux/usr/bin/armv4t-angstrom-linux-gnu
eabi:/home/piyush/oe/build/staging/i686-linux/usr/sbin:/home/piyush/oe/build/sta
ging/i686-linux/usr/bin:/home/piyush/oe/build/cross/armv4t/bin:/home/piyush/oe/b
uild/staging/i686-linux/sbin:/home/piyush/oe/build/staging/i686-linux/bin:/home/
piyush/oe/bitbake/bin:/home/piyush/work/oe/bitbake/bin:/home/piyush/work/oe/bitb
ake/bin:/opt/qte-4.5.3/lib:/opt/qte-4.5.3/bin:/usr/local/arm/4.3.2/bin:/usr/loca
l/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/arm/4.
3.2/bin:/usr/local/gnuarm/install/bin;
git ls-remote git://repo.or.cz/linux-2.6/mini2440.git
mini2440-stable-v2.6.32 failed with signal 128, output:
fatal: read error (Connection reset by peer)

ERROR: Printing the environment of the function
ERROR: Build of
/home/piyush/oe/openembedded/recipes/linux/linux-mini2440_2.6.32+git.bb
do_fetch failed
Traceback (most recent call last):
  File "/home/piyush/oe/bitbake/bin/bitbake", line 143, in <module>
    main()
  File "/home/piyush/oe/bitbake/bin/bitbake", line 140, in main
    cooker.cook()
  File "/home/piyush/oe/bitbake/lib/bb/cooker.py", line 640, in cook
    return self.buildTargets(pkgs_to_build)
  File "/home/piyush/oe/bitbake/lib/bb/cooker.py", line 547, in
buildTargets
    failures = rq.execute_runqueue()
  File "/home/piyush/oe/bitbake/lib/bb/runqueue.py", line 841, in
execute_runqueue
    self.execute_runqueue_internal()
  File "/home/piyush/oe/bitbake/lib/bb/runqueue.py", line 950, in
execute_runqueue_internal
    self.cooker.tryBuild(fn)
  File "/home/piyush/oe/bitbake/lib/bb/cooker.py", line 136, in tryBuild
    return self.tryBuildPackage(fn, item, self.configuration.cmd, the_data)
  File "/home/piyush/oe/bitbake/lib/bb/cooker.py", line 110, in
tryBuildPackage
    bb.build.exec_task('do_%s' % task, the_data)
  File "/home/piyush/oe/bitbake/lib/bb/build.py", line 283, in exec_task
    exec_func(task, localdata)
  File "/home/piyush/oe/bitbake/lib/bb/build.py", line 120, in exec_func
    exec_func_python(func, d)
  File "/home/piyush/oe/bitbake/lib/bb/build.py", line 141, in
exec_func_python
    utils.better_exec(comp, g, tmp, bbfile)
  File "/home/piyush/oe/bitbake/lib/bb/utils.py", line 185, in better_exec
    exec code in context
  File "do_fetch", line 4, in <module>
  File "do_fetch", line 2, in do_fetch
  File "/home/piyush/oe/bitbake/lib/bb/build.py", line 120, in exec_func
    exec_func_python(func, d)
  File "/home/piyush/oe/bitbake/lib/bb/build.py", line 141, in
exec_func_python
    utils.better_exec(comp, g, tmp, bbfile)
  File "/home/piyush/oe/bitbake/lib/bb/utils.py", line 185, in better_exec
    exec code in context
  File "base_do_fetch", line 69, in <module>
  File "base_do_fetch", line 12, in base_do_fetch
  File "/home/piyush/oe/bitbake/lib/bb/fetch/__init__.py", line 126, in
init
    urldata[url].setup_localpath(d) 
  File "/home/piyush/oe/bitbake/lib/bb/fetch/__init__.py", line 339, in
setup_localpath
    self.localpath = self.method.localpath(self.url, self, d)
  File "/home/piyush/oe/bitbake/lib/bb/fetch/git.py", line 51, in localpath
    ud.tag = self.latest_revision(url, ud, d)  
  File "/home/piyush/oe/bitbake/lib/bb/fetch/__init__.py", line 531, in
latest_revision
    rev = self._latest_revision(url, ud, d)
  File "/home/piyush/oe/bitbake/lib/bb/fetch/git.py", line 143, in
_latest_revision
    output = runfetchcmd("git ls-remote %s://%s%s%s %s" % (ud.proto,
username, ud.host, ud.path, ud.branch), d, True)
  File "/home/piyush/oe/bitbake/lib/bb/fetch/__init__.py", line 305, in
runfetchcmd
    raise FetchError("Fetch command %s failed with signal %s, output:\n%s"
% (cmd, signal, output))
bb.fetch.FetchError: Fetch command export HOME=/home/piyush; export
SSH_AUTH_SOCK=/tmp/keyring-oblKDf/ssh; export
PATH=/home/piyush/oe/build/staging/i686-linux/usr/bin/mini2440-angstrom-linux-gn
ueabi:/home/piyush/oe/build/staging/i686-linux/usr/bin/armv4t-angstrom-linux-gnu
eabi:/home/piyush/oe/build/staging/i686-linux/usr/sbin:/home/piyush/oe/build/sta
ging/i686-linux/usr/bin:/home/piyush/oe/build/cross/armv4t/bin:/home/piyush/oe/b
uild/staging/i686-linux/sbin:/home/piyush/oe/build/staging/i686-linux/bin:/home/
piyush/oe/bitbake/bin:/home/piyush/work/oe/bitbake/bin:/home/piyush/work/oe/bitb
ake/bin:/opt/qte-4.5.3/lib:/opt/qte-4.5.3/bin:/usr/local/arm/4.3.2/bin:/usr/loca
l/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/arm/4.
3.2/bin:/usr/local/gnuarm/install/bin;
git ls-remote git://repo.or.cz/linux-2.6/mini2440.git
mini2440-stable-v2.6.32 failed with signal 128, output:
fatal: read error (Connection reset by peer)

ERROR: Task 710
(/home/piyush/oe/openembedded/recipes/linux/linux-mini2440_2.6.32+git.bb,
do_fetch) failed
NOTE: Waiting for 1 active tasks to finish

So I want to know that why it is getting problem in the
linux-mini2440_2.6.32+git.bb file of the receipe of the openembedded.

Please tell me guys what is this and what to do to rectify this, I am
asking this because I know that lots of you people must have tried this on
your ubuntu system and since it's not possible to debug the entire
repository for a single person like me.


Thank you

Ben
Hi,
had some problems running the script, did add some libraries to make
bitbake run and had to give root access to all folders in the oeroot
directory.

Sadly, Bitbake stops at line 2008 with this error:

NOTE: Running task 2008 of 2159 (ID: 42,
/oeroot/openembedded/recipes/quilt/quilt-native_0.46.bb, do_package_stage)
NOTE: Tasks Summary: Attempted 2008 tasks of which 3 didn't need to be
rerun and 1 failed.
ERROR: '/oeroot/openembedded/recipes/perl/perl-native_5.8.8.bb' failed


Now, I am out of ideas....

Any help ?

TnX,
Ben

girish2k44
Hey ben,

follow the link
http://ubuntuforums.org/showthread.php?p=11246852

i have the same problem but after following link its successful

Regards
Girish

Ben
Girish,
thanks for reminding me to read the answer on the ubuntuforum. It did solve
a great deal of the problem. However, one other problem appears, so I am
pasting my reply from the ubuntuforum also on this forum and I hope someone
recognizes this problem and can give me a working solution.

Thanks a lot for your reply. It solved a big part of my problem.

However, some other problem shows up:

NOTE: Running task 590 of 2159 (ID: 1041,
/oeroot/openembedded/recipes/intltool/intltool-native_0.40.3.bb,
do_configure)
ERROR: function do_configure failed
ERROR: see log in
/oeroot/build/work/i686-linux/intltool-native-0.40.3-r2/temp/log.do_configure.19
465
NOTE: Task failed:
/oeroot/build/work/i686-linux/intltool-native-0.40.3-r2/temp/log.do_configure.19
465
ERROR: TaskFailed event exception, aborting
ERROR: Build of
/oeroot/openembedded/recipes/intltool/intltool-native_0.40.3.bb
do_configure failed
ERROR: Task 1041
(/oeroot/openembedded/recipes/intltool/intltool-native_0.40.3.bb,
do_configure) failed
NOTE: Tasks Summary: Attempted 2024 tasks of which 2024 didn't need to be
rerun and 1 failed.
ERROR: '/oeroot/openembedded/recipes/intltool/intltool-native_0.40.3.bb'
failed

The log file which it point to tells me:
checking for XML::Parser... configure: error: XML::Parser perl module is
required for intltool
FATAL: oe_runconf failed

libxml-parser-perl is installed. Checked (as found on different Google
results) with

bitbake libxml-parser-perl-native but with the same error.

Did remove libxml-parser-perl and re-installed it, but the same result.
Did find one page with a test for checking the libxml-parser-perl
availability
with /usr/bin/perl -e "require XML::Parser"
but this test was passing without errors so it IS there..

Did read about 100 pages on the WWW about this error but none comes to the
right solution for me.

Any help anyone ?

Thanks in advance,
Ben

Ben
Now, I tried it completely different. Installed VMWare player, downloaded
Ubuntu9 from VMPLanet and did run the script on that system.

Installation went quite well,bitbake -k console-image gives me the first
error within 2 minutes:

unable to parse conf/bitbake.conf ( /oeroot/build/conf/local.conf:13
unparsed line: 'librsvg-native" ')

So I tried to locate librsvg-native for installation but I can only find
librsvg2-2 and librsvg2-dev but they are installed allready.

I have been trying to solve the XML::Parser error for one hour each day for
the last four weeks now, with no solution, but bitbaking OpenEmbedded on
the VMWare player with Ubunty 9 does make me worry also within the first 2
minutes,

Does anyone have an idea how to solve this librsvg-native problem ?

Thanks in advance,

Ben

Senacharim
After a little editing of the script (thank you! btw...)

I'm getting the exact same error as Ben above:

unable to parse conf/bitbake.conf ( /oeroot/build/conf/local.conf:13
unparsed line: 'librsvg-native" ')


Aside from that, everything went as it should on the script (I think...)

Where do I go from here??