Difference between revisions of "Build Environment Ubuntu 9.04"

From Gumstix User Wiki
Jump to: navigation, search
(Setup Build Environment)
m (Redirect overo users)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
== Overo Users ==
 +
 +
These instructions are not for the Gumstix Overo.
 +
 +
Overo users should use the instructions here - [http://www.gumstix.net/Setup-and-Programming/view/Overo-Setup-and-Programming/Setting-up-a-build-environment/111.html Overo-Setup-and-Programming/Setting-up-a-build-environment].
 +
 +
== Overview ==
 +
 
This is based on the set-up for Ubuntu 8.10 with file modifications as described [http://www.nabble.com/Ubuntu-8.10-and-Open-Embeded-td21136352.html on this thread]. gumstix-oe version is 318.
 
This is based on the set-up for Ubuntu 8.10 with file modifications as described [http://www.nabble.com/Ubuntu-8.10-and-Open-Embeded-td21136352.html on this thread]. gumstix-oe version is 318.
 +
 +
This HOWTO has also been tested and found to work with Ubuntu 9.10.
  
 
== Setup Build Environment ==
 
== Setup Build Environment ==
Line 14: Line 24:
 
  sudo apt-get install build-essential help2man diffstat texi2html texinfo libncurses5-dev cvs gawk  
 
  sudo apt-get install build-essential help2man diffstat texi2html texinfo libncurses5-dev cvs gawk  
 
  sudo apt-get install python-dev python-pysqlite2 python-psyco ckermit lrzsz subversion
 
  sudo apt-get install python-dev python-pysqlite2 python-psyco ckermit lrzsz subversion
 +
 +
See [[Bitbake_on_Ubuntu|Bitbake On Ubuntu]] for directions on how to setup Bitbake.
  
 
3) Download the source from svn, caching the source code
 
3) Download the source from svn, caching the source code
Line 26: Line 38:
 
  sudo chmod 0775 /usr/share/sources
 
  sudo chmod 0775 /usr/share/sources
 
  sudo chmod ug+s /usr/share/sources
 
  sudo chmod ug+s /usr/share/sources
 +
 +
3.5) Modify ~/gumstix/gumstix-oe/org.openembedded.snapshot/classes/base.bbclass to correct a common SIGPIPE error (fix is in OE trunk, but not yet in gumstix-oe). basically we are adding a small function called subprocess_setup() which removes the SIGPIPE handler and then modifying oe_unpack_file() to call the function instead of system():
 +
 +
<pre>--- a/classes/base.bbclass
 +
+++ b/classes/base.bbclass
 +
@@ -728,9 +728,14 @@
 +
:
 +
}
 +
 +
+def subprocess_setup():
 +
+ import signal, subprocess
 +
+ # Python installs a SIGPIPE handler by default. This is usually not what
 +
+ # non-Python subprocesses expect.
 +
+ signal.signal(signal.SIGPIPE, signal.SIG_DFL)
 +
 +
def oe_unpack_file(file, data, url = None):
 +
- import bb, os
 +
+ import bb, os, signal, subprocess
 +
if not url:
 +
url = "file://%s" % file
 +
dots = file.split(".")
 +
@@ -799,7 +804,7 @@
 +
 +
cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', data, 1), cmd)
 +
bb.note("Unpacking %s to %s/" % (base_path_out(file, data), base_path_out(os.getcwd(), data)))
 +
- ret = os.system(cmd)
 +
+ ret = subprocess.call(cmd, preexec_fn=subprocess_setup, shell=True)
 +
 +
os.chdir(save_cwd)
 +
</pre>
 +
 +
(source: kergoth on #oe on irc.freenode.net. [http://gitorious.org/gumstix-oe/mainline/commit/f73c64e7295be1e1065f898b49f50a02e812161c original commit])
  
 
4) Downgrade to gcc-4.1 and g++-4.1 and change the links:
 
4) Downgrade to gcc-4.1 and g++-4.1 and change the links:

Latest revision as of 07:16, 14 June 2010

Overo Users

These instructions are not for the Gumstix Overo.

Overo users should use the instructions here - Overo-Setup-and-Programming/Setting-up-a-build-environment.

Overview

This is based on the set-up for Ubuntu 8.10 with file modifications as described on this thread. gumstix-oe version is 318.

This HOWTO has also been tested and found to work with Ubuntu 9.10.

Setup Build Environment

1) Get Ubuntu linux 9.04, and install it on your computer; you can install a vmware version of Ubuntu too, but it will be slow during the building process.

Reconfigure sh to point to bash, not dash:

 sudo dpkg-reconfigure dash

Answer no when asked whether you want to install dash as /bin/sh.

2) Install (build-essential, help2man, diffstat, texi2html, texinfo, libncurses5-dev, cvs, gawk, python-dev, python-pysqlite2, python-psyco, ckermit, lrzsz, subversion) by using apt-get. i.e:

sudo apt-get update
sudo apt-get install build-essential help2man diffstat texi2html texinfo libncurses5-dev cvs gawk 
sudo apt-get install python-dev python-pysqlite2 python-psyco ckermit lrzsz subversion

See Bitbake On Ubuntu for directions on how to setup Bitbake.

3) Download the source from svn, caching the source code

mkdir ~/gumstix 
cd ~/gumstix 
svn co https://gumstix.svn.sourceforge.net/svnroot/gumstix/trunk gumstix-oe
cat gumstix-oe/extras/profile >> ~/.bashrc
sudo groupadd oe
sudo usermod -a -G oe YOUR_CURRENT_USERNAME
sudo mkdir /usr/share/sources
sudo chgrp oe /usr/share/sources
sudo chmod 0775 /usr/share/sources
sudo chmod ug+s /usr/share/sources

3.5) Modify ~/gumstix/gumstix-oe/org.openembedded.snapshot/classes/base.bbclass to correct a common SIGPIPE error (fix is in OE trunk, but not yet in gumstix-oe). basically we are adding a small function called subprocess_setup() which removes the SIGPIPE handler and then modifying oe_unpack_file() to call the function instead of system():

--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -728,9 +728,14 @@
 	:
 }
 
+def subprocess_setup():
+	import signal, subprocess
+	# Python installs a SIGPIPE handler by default. This is usually not what
+	# non-Python subprocesses expect.
+	signal.signal(signal.SIGPIPE, signal.SIG_DFL)
 
 def oe_unpack_file(file, data, url = None):
-	import bb, os
+	import bb, os, signal, subprocess
 	if not url:
 		url = "file://%s" % file
 	dots = file.split(".")
@@ -799,7 +804,7 @@
 
 	cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', data, 1), cmd)
 	bb.note("Unpacking %s to %s/" % (base_path_out(file, data), base_path_out(os.getcwd(), data)))
-	ret = os.system(cmd)
+	ret = subprocess.call(cmd, preexec_fn=subprocess_setup, shell=True)
 
 	os.chdir(save_cwd)

(source: kergoth on #oe on irc.freenode.net. original commit)

4) Downgrade to gcc-4.1 and g++-4.1 and change the links:

sudo aptitude install gcc-4.1 g++-4.1
sudo ln -sf /usr/bin/gcc-4.1 /usr/bin/gcc
sudo ln -sf /usr/bin/g++-4.1 /usr/bin/g++

Check the links are correct using:

ls -l /usr/bin/gcc
ls -l /usr/bin/g++

5) Log out and log in again.

6) Build the basic image, it will fail with an error in dbus:

bitbake gumstix-basic-image

Edit gumstix/gumstix-oe/tmp/work/i686-linux/dbus-native-1.0.1-r0/dbus-1.0.1/dbus/dbus-sysdeps-unix.c

Add this struct,

struct ucred { 
   unsigned int pid; 
   unsigned int uid; 
   unsigned int gid; 
};

after the macros.

7) Build the basic image, it will fail with an error in sumversion:

bitbake gumstix-basic-image

Edit gumstix/gumstix-oe/tmp/work/gumstix-custom-verdex-angstrom-linux-gnueabi/gumstix-kernel-2.6.21-r1/linux-2.6.21/scripts/mod/sumversion.c

Add this line,

 #include <limits.h> 

after all of the other includes.

8) Build the basic image again. If it fails with an error in gconf-dbus, do the following:

a. download file http://download.gnome.org/sources/GConf-dbus/2.16/GConf-dbus-2.16.0.tar.gz

b. move and rename this file to:

/usr/share/sources/trunk_developer.imendio.com_.svn.gconf-dbus_606_.tar.gz

9) Build the basic image again, this time it should work:

bitbake gumstix-basic-image

10) If everything builds ok, it could be a good idea to modify the dbus-sysdeps-unix.c and sumversion.c files in their respective packages in /usr/share/sources as otherwise everytime you do a rebuild they will be wiped. Note that dbus-sysdeps-unix.c is found in package dbus-1.0.1.tar.gz, and sumversion.c is found in package linux-2.6.21.tar.bz2.