Difference between revisions of "User:Spramanik"

From Gumstix User Wiki
Jump to: navigation, search
(added link)
Line 1: Line 1:
 
<H1>Bitbake on Ubuntu </H1>
 
<H1>Bitbake on Ubuntu </H1>
  
<H2>Getting Started</H2>
+
See my work posted on [http://www.gumstix.net/wiki/index.php?title=Bitbake_on_Ubuntu Bitbake on Ubuntu].
<OL>
+
<LI>Download Ubuntu from: [http://www.ubuntu.com/getubuntu/download]
+
<LI>Burn ISO Image to a disk
+
<LI>Put Disk into machine of your choice (These examples are run on an Acer Aspire Model: KAW60)
+
<LI>Install Ubuntu from Disk
+
</OL>
+
  
Once Ubuntu is up and running Type:
 
<UL>
 
<LI>$ sudo passwd
 
<LI>$ yourpassword
 
</UL>
 
  
Configure internet access using:
+
<H1>Question / Comments</H1>
<UL>
+
<LI>$ ifconfig eth0 xxx.xxx.xxx.xxx
+
OR 
+
<LI>$ net-setup
+
</UL>
+
 
+
Note: On the Acer, Ubuntu automatically connected
+
Note: Every command run with sudo will require yourpassword in order to run
+
Note: Most likely /bin/sh is linked to /bin/dash. If so, then change /bin/sh to link to /bin/bash. If you don't this could cause file corruption and the build image wont work! Run "sudo dpkg-reconfigure dash" and select "no" on the screen when given the option to install dash as /bin/sh.
+
 
+
 
+
<H2>Dependencies</H2>
+
There are a couple of dependencies which must be installed first:
+
<UL>
+
<LI>Monotone (or bitkeeper, but I used monotone)
+
<UL="circle">   
+
<LI>This requires that Boost is installed
+
</UL>
+
<LI>Pyscho JIT Compiler
+
<LI>Python compiler (should come with OS)
+
 
+
Download These from
+
[http://www.monotone.ca/]
+
[http://psyco.sourceforge.net/]
+
[http://www.boost.org/users/download/]
+
</UL>
+
 
+
Create a directory under your home directory called slug
+
<UL>
+
<LI>$cd /home/yourname
+
<LI>$mkdir slug
+
</UL>
+
 
+
Place all of the downloaded files into this directory and extract them.
+
Either by right clicking and choosing extract OR
+
<UL>
+
<LI>$ gunzip –d name followed by $ tar –xfv name
+
</UL>
+
 
+
<H2>Monotone</H2>
+
Monotone will not install without other dependencies.  Run the following:
+
 
+
<UL>
+
<LI>$ sudo apt-get install autoconf
+
<LI>$ sudo apt-get install automake
+
<LI>$ sudo apt-get install gettext
+
<LI>$ sudo apt-get install libboost-dev
+
<LI>$ sudo apt-get install libz-dev
+
<LI>$ sudo apt-get install g++
+
</UL>
+
 
+
Run the commands:
+
<UL>
+
<LI>$ cd boost_1_38_0
+
<LI>$ ./configure
+
<LI>$ make install
+
<LI>$ sudo apt-get install python
+
<LI>$ sudo apt-get install make
+
<LI>$ sudo apt-get install subversion
+
<LI>$ sudo apt-get install psycho 
+
  OR 
+
<LI>$ sudo python setup.py install
+
<LI> Ungunzip monotone-0.42
+
<LI>$ cd monotone-0.42
+
<LI>$ sudo ./configure 
+
<LI>$sudo apt-get install monotone
+
</UL>
+
 
+
<H3>To Configure Monotone:</H3>
+
Create a configure script in /home/yourname/slug if one is not created.
+
Include the following lines in the script:
+
 
+
$aclocal-1.9&&autoreconf –install
+
$AUTOMAKE=automake-1.9 ACLOCAL=aclocal-1.9 autoreconf install
+
 
+
Download automake1.9  (if not installed) from [http://www.filewatcher.com/m/automake-1.9.6.tar.bz2.765505.0.0.html]
+
Extract and run
+
<UL>
+
<LI>$sudo apt-get install automake1.9
+
</UL>
+
 
+
Then run
+
<UL>
+
<LI>$sudo ./configure
+
</UL>
+
 
+
To fetch the monotone sources run:
+
<UL>
+
<LI>mtn --db=mt.mtn db init
+
<LI>mtn --db=mt.mtn pull monotone.ca “net.venge.monotone*”
+
<LI>mtn --db=mt.mtn --branch=net.venge.mnotone checkout monotone-sources
+
</UL>
+
 
+
<H2>Getting Bitbake</H2>
+
 
+
You can either download bitbake from:
+
[http://developer.berlios.de/projects/bitbake/]
+
OR go into /home/yourname/slug and run:
+
<UL>
+
<LI>$sudo mkdir bitbake
+
<LI>$cd bitbake
+
<LI>$sudo svn co svn://svn.berlios.de/bitbake/branches/bitbake-1.4 bitbake 
+
</UL>
+
 
+
Additional help can be found at:
+
<UL>
+
[http://bitbake.berlios.de/manual/]
+
If you downloaded bitbake, then save and extract the files in /home/yourname/slug
+
cd into the bitbake directory
+
You can either run:
+
 
+
<LI>$sudo apt-get install bitbake
+
OR
+
<LI>$ sudo ./setup.py install --prefix=/usr/local
+
</UL>
+
 
+
Run the following:
+
<UL>
+
<LI>$sudo mkdir openembedded
+
<LI>$cd openembedded
+
<LI>$sudo mkdir packages
+
<LI>$cd packages
+
<LI>$sudo mkdir file
+
<LI>$cd file
+
</UL>
+
 
+
<H2>Create the following files</H2>
+
 
+
<H3>Set-env</H3>
+
 
+
OEROOT="/home/yourname/slug" OESYS=$OEROOT/bitbake-1.8.12 PKGDIR=$OEROOT/openembedded OEBUILD=$OEROOT/build BBPATH=$OEBUILD:$PKGDIR:$OESYS PATH=$OESYS/bin:$PATH cd $OEBUILD LD_LIBRARY_PATH= export PATH LD_LIBRARY_PATH BBPATH export LANG=C unset LC_CTYPE unset CC unset CXX alias bb=bitbake echo "Environment set up for OpenEmbedded development."
+
 
+
<H3>Local.conf</H3>
+
 
+
OEROOT = "/home/yourname/slug"
+
DL_DIR = "${OEROOT}/sources"
+
BBFILES = ${OEROOT}/bitbake-1.8.12/openembedded/packages/*/*.bb
+
BBPATH = ${OEROOT}/bitbake-1.8.12
+
OEMASK = ""
+
PREFERRED_PROVIDERS = " virtual/${TARGET_PREFIX}gcc-initial:gcc-cross-initial"
+
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}gcc:gcc-cross"
+
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}g++:gcc-cross"
+
MACHINE = "nslu2"
+
DISTRO = "unslung"
+
OEINCLUDELOGS = "yes"
+
 
+
<H3>Hello-1.0.bb</H3>
+
 
+
DESCRIPTION = "hello world sample program"PR = "r0"DEPENDS = ""SRC_URI = "file://hello.c"S = "${WORKDIR}"do_compile () {    ${CC} ${CFLAGS} ${LDFLAGS} -o hello hello.c}do_install () {    install -d ${D}${bindir}/    install -m 0755 ${S}/hello ${D}${bindir}/}FILES_${PN} = "${bindir}/hello"
+
 
+
<H3>Hello.c</H3>
+
 
+
&#35;include "stdio.h“
+
main(){ printf("Hello World\n");}
+
 
+
<H2>Where to put the files:</H2>
+
<UL>
+
<LI>/home/yourname/slug/set-env
+
<LI>/home/yourname/slug/bitbake-1.8.12/openembedded/packages/hello-1.0.bb
+
<LI>/home/yourname/slug/bitbake-1.8.12/openembedded/packages/file/hello.c
+
<LI>/home/yourname/slug/bitbake-1.8.12/conf/local.conf
+
</UL>
+
 
+
In the bitbake.conf file – located in the conf folder, ensure that OEDIR is set to: /home/yourname/slug
+
Also ensure that you change the path in the files you just created to match your directory structure
+
 
+
 
+
In /home/yourname/slug run:
+
<UL>
+
<LI>$sudo ./set-env
+
</UL>
+
 
+
This sets up the openembedded environment which is needed to finish running everything from bitbake
+
 
+
<H2>Building Hello World</H2>
+
Once all files are in the correct place and the dependencies are installed, run the following:
+
<UL>
+
<LI>$cd /home/yourname/slug/bitbake-1.8.12/openembedded/packages
+
<LI>$bitbake world 
+
OR
+
<LI>$bitbake –b hello
+
</UL>
+
 
+
World will build everything in the folder
+
-b hello will only build the hello package
+
<UL>
+
<LI>$sudo apt-get install hello
+
<LI>$hello
+
</UL>
+
This will print out “hello world!”
+
 
+
<H2>Running on Verdex Pro</H2>
+
The previous instructions will cause problems using Ubuntu8.10 when getting the basic image built.  There is a workaround by installing the old version of gcc, but as this caused other problems, I regressed to Ubuntu 8.4.  Here is how I got the image built to install on the Verdex Pro. Ensure you follow the note at the top of the page and switch the bash pointer. I am also assuming you have your gumstix hardware put together and you have the ability to plug it into your laptop and that you have a keyboard plugged into your verdex pro. (There are some great tutorials on this site on how to build the hardware. Thanks guys!) 
+
 
+
Dependencies
+
<UL>
+
<LI>Follow the Previous instruction on installing Ubuntu, but install version 8.4 
+
<LI> You can setup your own password during installation
+
<LI> Then follow the instructions to download and install the dependencies, but don't download bitbake yet
+
</UL>
+
 
+
Setup
+
<UL>
+
<LI> Go back to your home folder
+
<LI> $mkdir gumstix
+
<LI> $cd gumstix
+
<LI> $svn co https://gumstix.svn.sourceforge.net/svnroot/gumstix/trunk gumstix-oe
+
</UL>
+
 
+
This can take a little bit to download. Once its done then do the following:
+
<UL>
+
<LI> $cat gumstix-oe/extras/profile >> ~/.bashrc
+
<LI> $ sudo groupadd oe
+
<LI> $ sudo usermod -a -G oe your_username
+
<LI> $ sudo mkdir /usr/share/sources
+
<LI> $ sudo chgrp oe /usr/share/sources
+
<LI> $ sudo chmod 0775 /usr/share/sources
+
<LI> $ sudo chmod ug+s /usr/share/sources
+
</UL>
+
I found that I had to change some permissions on folders in order to get everything to run. Make sure that you have full permission to the gumstix folder without having to sudo. Then do the following
+
 
+
<UL>
+
<LI> $bitbake gumstix-basic-image
+
</UL>
+
 
+
On my Acer this build took almost 8 hours, so don't panic if it seems to hang at some points.  There were some points in which my machine would try to connect to the repositories to download info and it would have to try several times, which obviously added time to the build.
+
 
+
When the build is done and you are back at your prompt:
+
<UL>
+
<LI> ls ~/gumstix/gumstix-oe/tmp/deploy/glibc/images/gumstix-custom-verdex/
+
</UL>
+
This will show you several files. You want to ensure that you have the following files:
+
<UL>
+
<LI>gumstix-basic-image-gumstix-custom-verdex.jffs2
+
<LI> uImage-2.6.22-r1-gumstix-custom-verdex.bin
+
</UL>
+
 
+
These are the files you will be shooting over to the verdex pro. Now you have to setup Kermit:
+
<UL>
+
<LI> $ sudo apt-get install ckermit
+
</UL>
+
Then create a script in your home directory (it doesn't really matter where, just somewhere you can get to it easily)
+
I am using a USB adapter to talk to the serial port, so you may need to change the second line and make sure to change the take line to match your path:
+
 
+
<P>
+
<br> &#35;!/usr/bin/kermit +
+
<br> kermit -l /dev/ttyUSB0
+
<br> set speed 115200
+
<br> set reliable
+
<br> fast
+
<br> set carrier-watch off
+
<br> set flow-control none
+
<br> set prefixing all
+
<br> set file type bin
+
<br> set rec pack 4096
+
<br> set send pack 4096
+
<br> set window 5
+
<br> take /home/yourname/gumstix/gumstix-oe/extras/kermit-setup
+
<br> connect
+
</P>
+
Save and run:
+
<UL>
+
<LI> $ ./script
+
</UL>
+
This will bring up the kermit screen. Make sure at this point you have the gumstix plugged into your laptop and connected to keyboard. Now that the kermit setup is running you can plug your gumstix into the power. You have to hit the space bar on your laptop immediately in order to get to the U-boot command line (you will see GUM> ).  The verdex pro comes with the correct version of U-boot so you don't have to risk bricking your gumstix (yea!).  Once you are at the GUM> command line, type (on your laptop):
+
 
+
<UL>
+
<LI> GUM> loadb a2000000
+
</UL>
+
 
+
loadb is the U-boot command to get info from Kermit. (If you choose to use something else like minicom, type help at GUM> to get the correct command to use.) then hit CTRL+\ + c to go back to kermit then:
+
 
+
<UL>
+
<LI> C-Kermit> cd ~/gumstix/gumstix-oe/tmp/deploy/glibc/images/gumstix-custom-verdex/
+
<LI> C-Kermit> send gumstix-basic-image-gumstix-custom-verdex.jffs2
+
<LI> C-Kermit> connect
+
</UL>
+
 
+
This will bring back up the GUM screen. Do NOT replace ${filesize} with a number!:
+
 
+
<UL>
+
<LI> GUM> protect on 1:0-1
+
<LI> GUM> erase all
+
<LI> GUM> cp.b a2000000 40000 ${filesize}
+
<LI> GUM> loadb a2000000
+
</UL>
+
 
+
Then hit CTRL+\ + c to go back to kermit then:
+
 
+
<UL>
+
<LI> C-Kermit> send uImage-2.6.21-r1-gumstix-custom-verdex.bin
+
<LI> C-Kermit> connect
+
</UL>
+
This will go back to GUM>
+
<UL>
+
<LI> GUM> katinstall 100000
+
<LI> GUM> katload 100000
+
<LI> GUM> bootm
+
</UL>
+
 
+
This will boot you up to the command line. username: root, password: gumstix
+
Thankfully in the newest version of the image build, tslib is included, so you don't have to go and get it separately. (yea!)
+
Also on my build, I found that the ts.conf file in /etc had the correct modules called.  If you want to double check, you need to:
+
 
+
<UL>
+
<LI> # cat /etc/ts.conf
+
</UL>
+
 
+
If it has the following, then you are all set:
+
 
+
module_raw input
+
module pthres pmin=1
+
module variance delta=30
+
module dejitter delta=100
+
module linear
+
 
+
Then # vi /etc/profile and add:
+
 
+
export TSLIB_TSDEVICE = /dev/input/event0
+
export TSLIB_TSEVENTTYPE=INPUT
+
export TSLIB_CONFFILE=/etc/ts.conf
+
export TSLIB_CALIBFILE=/etc/pointercal
+
 
+
then :wq
+
 
+
<UL>
+
<LI> # cd /usr/bin/
+
<LI> # ./ts_calibrate
+
</UL>
+
This will bring up a screen for you to calibrate the touchscreen.  The verdex pro does not come with a stylus.  I went and got some cheap ones meant for Nintendo DS ($7 for three of them). I found that I had to run the calibration tool a few times in order to get it properly calibrated. Then if you want to test out if it calibrated correctly try the following:
+
 
+
<UL>
+
<LI> ./ts_test
+
</UL>
+
 
+
<H2>Other Factors</H2>
+
These instructions will change depending on the OS being used.
+
Tutorial was based on information from: [http://www.gumstix.net/Software/view/Build-system-overview/Hello-world-tutorial/111.html]For More information please see the above mentioned site
+
 
+
<H2>Question / Comments</H2>
+
 
For other questions, comments, or if you find anything incorrect, please contact me at:
 
For other questions, comments, or if you find anything incorrect, please contact me at:
 
'''Sarah Pramanik - sarah.pramanik@gmail.com'''
 
'''Sarah Pramanik - sarah.pramanik@gmail.com'''

Revision as of 13:00, 24 March 2009

Bitbake on Ubuntu

See my work posted on Bitbake on Ubuntu.


Question / Comments

For other questions, comments, or if you find anything incorrect, please contact me at: Sarah Pramanik - sarah.pramanik@gmail.com