Difference between revisions of "User:Spramanik"

From Gumstix User Wiki
Jump to: navigation, search
(New page: == Bitbake on Ubuntu == Installing and Running Hello World By Sarah Pramanik Getting Started Download Ubuntu from: [http://www.ubuntu.com/getubuntu/download] Burn ISO Image to a disk ...)
 
Line 1: Line 1:
 
 
== Bitbake on Ubuntu ==
 
== Bitbake on Ubuntu ==
  
  
Installing and Running
+
Installing and Running Hello World
Hello World
+
 
By
 
By
 
Sarah Pramanik
 
Sarah Pramanik
  
Getting Started
+
'''Getting Started'''
 
+
 
Download Ubuntu from:
 
Download Ubuntu from:
 
[http://www.ubuntu.com/getubuntu/download]
 
[http://www.ubuntu.com/getubuntu/download]
Line 18: Line 15:
  
 
Once Ubuntu is up and running Type:
 
Once Ubuntu is up and running Type:
 +
 
$ sudo passwd
 
$ sudo passwd
 
$ yourpassword
 
$ yourpassword
 +
 
Configure internet access using:
 
Configure internet access using:
 +
 
$ ifconfig eth0 xxx.xxx.xxx.xxx
 
$ ifconfig eth0 xxx.xxx.xxx.xxx
OR  $ net-setup
+
OR   
 +
$ net-setup
 +
 
 
Note: On the Acer, Ubuntu automatically connected  
 
Note: On the Acer, Ubuntu automatically connected  
 
Note: Every command run with sudo will require yourpassword in order to run
 
Note: Every command run with sudo will require yourpassword in order to run
Line 30: Line 32:
 
There are a couple of dependencies which must be installed first:
 
There are a couple of dependencies which must be installed first:
 
Monotone (or bitkeeper, but I used monotone)
 
Monotone (or bitkeeper, but I used monotone)
This requires that Boost is installed
+
    This requires that Boost is installed
 
Pyscho JIT Compiler
 
Pyscho JIT Compiler
 
Python compiler (should come with OS)
 
Python compiler (should come with OS)
Line 40: Line 42:
  
 
Create a directory under your home directory called slug
 
Create a directory under your home directory called slug
 +
 
cd /home/yourname
 
cd /home/yourname
 
mkdir slug
 
mkdir slug
 +
 
Place all of the downloaded files into this directory and extract them.
 
Place all of the downloaded files into this directory and extract them.
 
Either by right clicking and choosing extract OR
 
Either by right clicking and choosing extract OR
 +
 
$ gunzip –d name followed by $ tar –xfv name
 
$ gunzip –d name followed by $ tar –xfv name
  
Line 49: Line 54:
 
Monotone
 
Monotone
 
Monotone will not install without other dependencies.  Run the following:
 
Monotone will not install without other dependencies.  Run the following:
 +
 
$ sudo apt-get install autoconf
 
$ sudo apt-get install autoconf
 
$ sudo apt-get install automake
 
$ sudo apt-get install automake
Line 58: Line 64:
  
 
Run the commands:
 
Run the commands:
 +
 
$ sudo apt-get install boost_1_38_0
 
$ sudo apt-get install boost_1_38_0
 
$ sudo apt-get install python
 
$ sudo apt-get install python
Line 63: Line 70:
 
$ sudo apt-get install subversion
 
$ sudo apt-get install subversion
 
$ sudo apt-get install psycho   
 
$ sudo apt-get install psycho   
OR
+
  OR $ sudo ./setup.py install   
$ sudo ./setup.py install   
+
 
$sudo apt-get install mtn-0.42-linux-x86
 
$sudo apt-get install mtn-0.42-linux-x86
  
Configuring
+
 
To configure monotone:
+
'''To configure monotone:'''
 
Create a configure script in /home/yourname/slug if one is not created.
 
Create a configure script in /home/yourname/slug if one is not created.
 
Include the following lines in the script:
 
Include the following lines in the script:
 +
 
$aclocal-1.9&&autoreconf –install
 
$aclocal-1.9&&autoreconf –install
 
$AUTOMAKE=automake-1.9 ACLOCAL=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]
 
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 $sudo apt-get install automake1.9
+
Extract and run  
Then run $sudo ./configure
+
 
 +
$sudo apt-get install automake1.9
 +
 
 +
Then run  
 +
 
 +
$sudo ./configure
  
 
To fetch the monotone sources run:
 
To fetch the monotone sources run:
 +
 
mtn --db=mt.mtn db init
 
mtn --db=mt.mtn db init
 
mtn --db=mt.mtn pull monotone.ca “net.venge.monotone*”
 
mtn --db=mt.mtn pull monotone.ca “net.venge.monotone*”
 
mtn --db=mt.mtn --branch=net.venge.mnotone checkout monotone-sources
 
mtn --db=mt.mtn --branch=net.venge.mnotone checkout monotone-sources
  
Getting Bitbake
+
'''Getting Bitbake'''
 +
 
 
You can either download bitbake from:
 
You can either download bitbake from:
 
[http://developer.berlios.de/projects/bitbake/]
 
[http://developer.berlios.de/projects/bitbake/]
 
  OR  in /home/yourname/slug and run:
 
  OR  in /home/yourname/slug and run:
 +
 
$sudo mkdir bitbake
 
$sudo mkdir bitbake
 
$cd bitbake
 
$cd bitbake
 
$sudo svn co svn://svn.berlios.de/bitbake/branches/bitbake-1.4 bitbake   
 
$sudo svn co svn://svn.berlios.de/bitbake/branches/bitbake-1.4 bitbake   
 +
 
Additional help can be found at
 
Additional help can be found at
 
[http://bitbake.berlios.de/manual/]
 
[http://bitbake.berlios.de/manual/]
Line 94: Line 111:
 
cd into the bitbake directory
 
cd into the bitbake directory
 
You can either run:
 
You can either run:
 +
 
$sudo apt-get install bitbake
 
$sudo apt-get install bitbake
 
OR
 
OR
Line 99: Line 117:
  
 
Run the following:
 
Run the following:
 +
 
$sudo mkdir openembedded
 
$sudo mkdir openembedded
 
$cd openembedded
 
$cd openembedded
Line 105: Line 124:
 
$sudo mkdir file
 
$sudo mkdir file
 
$cd file
 
$cd file
Create the following files
 
  
Set-env
+
'''Create the following files'''
 +
 
 +
'''''Set-env'''''
 +
 
 
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."
 
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."
  
Local.conf
+
'''''Local.conf'''''
 +
 
 
OEROOT = "/home/yourname/slug"
 
OEROOT = "/home/yourname/slug"
DL_DIR = "${OEROOT}/sources"
+
DL_DIR = "${OEROOT}/sources"
BBFILES = ${OEROOT}/bitbake-1.8.12/openembedded/packages/*/*.bb
+
BBFILES = ${OEROOT}/bitbake-1.8.12/openembedded/packages/*/*.bb
BBPATH = ${OEROOT}/bitbake-1.8.12
+
BBPATH = ${OEROOT}/bitbake-1.8.12
OEMASK = ""
+
OEMASK = ""
PREFERRED_PROVIDERS = " virtual/${TARGET_PREFIX}gcc-initial:gcc-cross-initial"
+
PREFERRED_PROVIDERS = " virtual/${TARGET_PREFIX}gcc-initial:gcc-cross-initial"
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}gcc:gcc-cross"
+
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}gcc:gcc-cross"
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}g++:gcc-cross"
+
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}g++:gcc-cross"
MACHINE = "nslu2"
+
MACHINE = "nslu2"
DISTRO = "unslung"
+
DISTRO = "unslung"
OEINCLUDELOGS = "yes"
+
OEINCLUDELOGS = "yes"
 +
 
 +
'''''Hello-1.0.bb'''''
  
Hello-1.0.bb
 
 
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"
 
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"
  
Hello.c
+
'''''Hello.c'''''
 +
 
 
#include "stdio.h“
 
#include "stdio.h“
 
main()
 
main()
Line 133: Line 157:
 
}
 
}
  
Where to put the files
+
Where to put the files:
 +
 
 
/home/yourname/slug/set-env
 
/home/yourname/slug/set-env
 
/home/yourname/slug/bitbake-1.8.12/openembedded/packages/hello-1.0.bb
 
/home/yourname/slug/bitbake-1.8.12/openembedded/packages/hello-1.0.bb
Line 145: Line 170:
  
 
In /home/yourname/slug run:
 
In /home/yourname/slug run:
 +
 
$sudo ./set-env
 
$sudo ./set-env
 +
 
This sets up the openembedded environment which is needed to finish running everything from bitbake
 
This sets up the openembedded environment which is needed to finish running everything from bitbake
  
 
Building Hello World
 
Building Hello World
 
Once all files are in the correct place and the dependencies are installed, run the following:
 
Once all files are in the correct place and the dependencies are installed, run the following:
 +
 
$cd /home/yourname/slug/bitbake-1.8.12/openembedded/packages
 
$cd /home/yourname/slug/bitbake-1.8.12/openembedded/packages
$bitbake world  OR run: $bitbake –b hello
+
$bitbake world   
 +
OR
 +
$bitbake –b hello
 +
 
 
World will build everything in the folder
 
World will build everything in the folder
 
-b hello will only build the hello package
 
-b hello will only build the hello package
$sudo apt-get install hello
+
 
 +
$sudo apt-get install hello
 
$hello
 
$hello
 +
 
This will print out “hello world!”
 
This will print out “hello world!”
  
Line 165: Line 198:
 
Question / Comments
 
Question / Comments
 
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@gmail.com
+
'''sarah.pramanik@gmail.com'''

Revision as of 15:14, 9 February 2009

Bitbake on Ubuntu

Installing and Running Hello World By Sarah Pramanik

Getting Started Download Ubuntu from: [1] Burn ISO Image to a disk Put Disk into machine of your choice (These examples are run on an Acer Aspire Model: KAW60) Install Ubuntu from Disk

Once Ubuntu is up and running Type:

$ sudo passwd $ yourpassword

Configure internet access using:

$ ifconfig eth0 xxx.xxx.xxx.xxx OR $ net-setup

Note: On the Acer, Ubuntu automatically connected Note: Every command run with sudo will require yourpassword in order to run


Dependencies There are a couple of dependencies which must be installed first: Monotone (or bitkeeper, but I used monotone)

   This requires that Boost is installed

Pyscho JIT Compiler Python compiler (should come with OS) Download These from [2] [3] [4]


Create a directory under your home directory called slug

cd /home/yourname mkdir slug

Place all of the downloaded files into this directory and extract them. Either by right clicking and choosing extract OR

$ gunzip –d name followed by $ tar –xfv name


Monotone Monotone will not install without other dependencies. Run the following:

$ sudo apt-get install autoconf $ sudo apt-get install automake $ sudo apt-get install gettext $ sudo apt-get install libboost-dev $ sudo apt-get install libz-dev $ sudo apt-get install g++


Run the commands:

$ sudo apt-get install boost_1_38_0 $ sudo apt-get install python $ sudo apt-get install make $ sudo apt-get install subversion $ sudo apt-get install psycho

  OR  $ sudo ./setup.py install  

$sudo apt-get install mtn-0.42-linux-x86


To configure monotone: 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 [5] Extract and run

$sudo apt-get install automake1.9

Then run

$sudo ./configure

To fetch the monotone sources run:

mtn --db=mt.mtn db init mtn --db=mt.mtn pull monotone.ca “net.venge.monotone*” mtn --db=mt.mtn --branch=net.venge.mnotone checkout monotone-sources

Getting Bitbake

You can either download bitbake from: [6]

OR  in /home/yourname/slug and run:

$sudo mkdir bitbake $cd bitbake $sudo svn co svn://svn.berlios.de/bitbake/branches/bitbake-1.4 bitbake

Additional help can be found at [7] If you downloaded bitbake, then save and extract the files in /home/yourname/slug cd into the bitbake directory You can either run:

$sudo apt-get install bitbake OR $ sudo ./setup.py install --prefix=/usr/local

Run the following:

$sudo mkdir openembedded $cd openembedded $sudo mkdir packages $cd packages $sudo mkdir file $cd file

Create the following files

Set-env

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."

Local.conf

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"

Hello-1.0.bb

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"

Hello.c

  1. include "stdio.h“

main() {

 printf("Hello World\n");

}

Where to put the files:

/home/yourname/slug/set-env /home/yourname/slug/bitbake-1.8.12/openembedded/packages/hello-1.0.bb /home/yourname/slug/bitbake-1.8.12/openembedded/packages/file/hello.c /home/yourname/slug/bitbake-1.8.12/conf/local.conf

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:

$sudo ./set-env

This sets up the openembedded environment which is needed to finish running everything from bitbake

Building Hello World Once all files are in the correct place and the dependencies are installed, run the following:

$cd /home/yourname/slug/bitbake-1.8.12/openembedded/packages $bitbake world OR $bitbake –b hello

World will build everything in the folder -b hello will only build the hello package

$sudo apt-get install hello $hello

This will print out “hello world!”


Other Factors These instructions will change depending on the OS being used. Tutorial was based on information from: [8]For More information please see the above mentioned site

Question / Comments For other questions, comments, or if you find anything incorrect, please contact me at: sarah.pramanik@gmail.com