Setting up the cross compiling environment in Ubuntu

5,852 views
Skip to first unread message

Juha Lumme

unread,
Aug 14, 2011, 2:07:56 AM8/14/11
to Beagle Board
Hi all,

I'm stuck with how to get cross compiling environment running for
beagle board on Ubuntu Linux.
I've been using Linux for few years already, so I'm fairly familiar
with working in the OS, but never really used it for any "serious
development". (I have only made c++/Qt programs, but setting that up
was just matter of apt-get...)

Thus, I'm completely lost what I should do to get cross compiling
environment running for Beagleboard/Angstrom.
My BB is running Ansgrom from SD card that came with the device, and I
can login to the OS ok via serial port.
Can you provide simple instructions and necessary information in
general to cross compiling ?

I tried following instructions in http://www.angstrom-distribution.org/building-angstrom
and have cloned the setup scripts, and executed
"./oebb.sh machine beagleboard" and "./oebb.sh update" - but after
this I don't understand what I should do.
Am I correct in assuming that I just downloaded the kernel sources,
and configured them to beagleboard ? What should I do now ? Compile
another Angstrom kernel, and replace the one in the SD card currently?

At what point should I set some environment variables defining that g+
+ should compile for ARM ?

Thanks a lot!

Koen Kooi

unread,
Aug 14, 2011, 1:32:32 PM8/14/11
to beagl...@googlegroups.com

Op 14 aug. 2011, om 08:07 heeft Juha Lumme het volgende geschreven:

> Hi all,
>
> I'm stuck with how to get cross compiling environment running for
> beagle board on Ubuntu Linux.
> I've been using Linux for few years already, so I'm fairly familiar
> with working in the OS, but never really used it for any "serious
> development". (I have only made c++/Qt programs, but setting that up
> was just matter of apt-get...)
>
> Thus, I'm completely lost what I should do to get cross compiling
> environment running for Beagleboard/Angstrom.
> My BB is running Ansgrom from SD card that came with the device, and I
> can login to the OS ok via serial port.
> Can you provide simple instructions and necessary information in
> general to cross compiling ?
>
> I tried following instructions in http://www.angstrom-distribution.org/building-angstrom
> and have cloned the setup scripts, and executed
> "./oebb.sh machine beagleboard" and "./oebb.sh update" - but after
> this I don't understand what I should do.

Follow the rest of that guide, you stopped halfway step 2

Derek Kane

unread,
Aug 14, 2011, 11:18:12 AM8/14/11
to beagl...@googlegroups.com
These are the steps that I used to set up cross compiling (It also has getting Eclipse and QT for the sake of completeness. Also I have wholesale copied instructions from various websites that showed how to do some of the individual bits. I apologize for not properly attributing these, but I originally wrote this list for my own memory and have since forgotten where I borrowed from.):

  1. Load Eclipse using the Applications->Ubuntu Software Center application.
    1. In the search box type eclipse
    2. Select the Eclipse IDE item from the list
    3. Press the “Install” button
    4. Open Eclipse (by typing eclipse at the command line)
    5. Ensure the C/C++ development tools are part of Eclipse

                                                               i.      Select the “Help->About Eclipse SDK” menu option

                                                             ii.      The About dialog displays icons representing all plugins which are part of Eclipse.

    1. If “Eclipse CDT” is not one of the icons, install it

                                                               i.      Select the “Help->Install New Software…” menu option

                                                             ii.      Select “Work with: All Available Sites” from the site list near the top of the dialog

                                                            iii.      Select “Programming Tools->Eclipse C/C++ Development Tools” from the software list.

                                                           iv.      Follow the dialog steps to install the tools.

  1. Load QT using the Applications->Ubuntu Software Center application
    1. Select the “Developer Tools” item from the Departments list
    2. In the search box type QT
    3. Select the QT 4 Designer item and press the “Install” button.
    4. Optionally, select the QT 4 Assistant item and press the “Install” button
  2. Download the QT Eclipse Integration for C++ package from http://qt.nokia.com/developer/eclipse-integration/
    1. Use the Linux x86 32bit version.
    2. Find the eclipse/plugins directory, likely /usr/lib/eclipse/plugins
    3. Change to the base directory, e.g. /usr/lib and extract the package:

                                                               i.      cd /usr/lib

                                                             ii.      sudo tar xzf ~/Downloads/qt-eclipse-integration-linux-x86-<version>.tar.gz

    1. Start a clean configuration of Eclipse:

                                                               i.      eclipse –clean

                                                             ii.      Exit eclipse

  1. Extract the cross-compiler
    1. Get one of the pre-made toolchains from Angstrom (http://www.angstrom-distribution.org/toolchains/) or build your own toolchain. 
    2. Extract the cross-compiler

                                                               i.      cd /

                                                             ii.      sudo tar –xjvf  pathname/to/your/Angstrom/toolchain/tarball

  1. Set up a cross-compiled “Hello World” program:
    1. Run eclipse
    2. Create a “New C Project”

                                                               i.      File->New->C Project

    1. Call the project “HelloBeagle”
    2. Select “Hello World ANSI C Project”
    3. Select “Finish”
    4. Right-click on the “HelloBeagle” project folder and create a new Build Configuration:

                                                               i.      Build Configurations->Manage…

                                                             ii.      Select “New”

                                                            iii.      Set the Name: to BeagleBoardRelease

                                                           iv.      Set the Existing configuration to “Release”

                                                             v.      Press “OK” and “OK” to leave the dialog

    1. Right-click on the “HelloBeagle” project folder and set the properties of the cross-compiled target:

                                                               i.      Select Properties

                                                             ii.      Select C/C++ Build->Settings

                                                            iii.      Reset the GCC C Compiler “Command:” to

/usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-gcc

 

                                                           iv.      Add the following include path to the “Directories”

/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/include

 

                                                             v.      Reset the GCC C Linker “Command:” to

/usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-gcc

 

                                                           vi.      Add the following library path to the “Libraries”

/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/lib

 

                                                          vii.      Reset the GCC Assembler “Command:” to

/usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-as

 

    1. Set the active target to BeagleBoardRelease

                                                               i.      Right-click on the “HelloBeagle” project folder

                                                             ii.      Select “Build Configurations->Set Active->BeagleBoardRelease”

    1. Right-click on the “HelloBeagle” project and select “Build Project”
    2. If you copy the resulting executable to a Beagleboard running Angstrom, the executable will perform as expected. (at least on my machine.)

I hope this helps.

Derek


--
You received this message because you are subscribed to the Google Groups "Beagle Board" group.
To post to this group, send email to beagl...@googlegroups.com.
To unsubscribe from this group, send email to beagleboard...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/beagleboard?hl=en.


zamek

unread,
Aug 15, 2011, 8:59:50 AM8/15/11
to beagl...@googlegroups.com
hello,

08/13/2011 06:29 PM keltez�ssel, David Brault �rta:


> I got Angstrom booting on my BB-xM with DVI output, but I have run
> into a problem in attempting to change the output to s-video (for
> "Myvu Crystal personal media viewer" video glasses, which accept RCA
> composite video).
>
>
I have a beagleboard xm rev C too and I want to use it with an S-video
lcd display.
I use buildroot, I can make a system to works well on s-video, but eth
cannot works.
Unfortunately the original and Ubuntu kernel images isn't contains
/proc/config.gz, so I cannot get a good .config.

When I try to stand up eth0 with
ifconfig eth0 up it says: no such device
usb0 can start, but it cannot connect, because its want to use OTG port.

What is the magic with the ethernet on BB? What driver needs to load?
Where can I download a_working_ kernel config?

I found a lot of config files, but none of them can works on eth:(

-- thx Zoltan (Zamek) Zidarics programmer email:zam...@gmail.com
skype:zamek_z


Juha Lumme

unread,
Aug 16, 2011, 2:15:56 AM8/16/11
to Beagle Board
Hi Derek,

Thank you so much, my server app is now running on the BB.
This was exactly the type of clear instructions needed for newbies!
It indeed turns out to be quite simple, once you give up trying to
compile in command line ;)

Btw. only one issue was with the linker's library path, at least I had
to use "library search path" (-L) instead "library" (-l)


Juha

On Aug 15, 12:18 am, Derek Kane <dgkan...@gmail.com> wrote:
> These are the steps that I used to set up cross compiling (It also has
> getting Eclipse and QT for the sake of completeness. Also I have wholesale
> copied instructions from various websites that showed how to do some of the
> individual bits. I apologize for not properly attributing these, but I
> originally wrote this list for my own memory and have since forgotten where
> I borrowed from.):
>
>    1. Load Eclipse using the Applications->Ubuntu Software Center
>    application.
>       1. In the search box type eclipse
>       2. Select the Eclipse IDE item from the list
>       3. Press the “Install” button
>       4. Open Eclipse (by typing eclipse at the command line)
>       5. Ensure the C/C++ development tools are part of Eclipse
>
>                                                                i.      Select
> the “Help->About Eclipse SDK” menu option
>
>                                                              ii.      The
> About dialog displays icons representing all plugins which are part of
> Eclipse.
>
>     1. If “Eclipse CDT” is not one of the icons, install it
>
>                                                                i.      Select
> the “Help->Install New Software…” menu option
>
>                                                              ii.      Select
> “Work with: All Available Sites” from the site list near the top of the
> dialog
>
>                                                             iii.      Select
> “Programming Tools->Eclipse C/C++ Development Tools” from the software list.
>
>                                                            iv.      Follow
> the dialog steps to install the tools.
>
>    1. Load QT using the Applications->Ubuntu Software Center application
>       1. Select the “Developer Tools” item from the Departments list
>       2. In the search box type QT
>       3. Select the QT 4 Designer item and press the “Install” button.
>       4. Optionally, select the QT 4 Assistant item and press the “Install”
>       button
>    2. Download the QT Eclipse Integration for C++ package from
>    http://qt.nokia.com/developer/eclipse-integration/
>       1. Use the Linux x86 32bit version.
>       2. Find the eclipse/plugins directory, likely /usr/lib/eclipse/plugins
>       3. Change to the base directory, e.g. /usr/lib and extract the
>       package:
>
>                                                                i.      cd
> /usr/lib
>
>                                                              ii.      sudo
> tar xzf ~/Downloads/qt-eclipse-integration-linux-x86-<*version*>.tar.gz
>
>     1. Start a clean configuration of Eclipse:
>
>                                                                i.      eclipse
> –clean
>
>                                                              ii.      Exit
> eclipse
>
>    1. Extract the cross-compiler
>       1. Get one of the pre-made toolchains from Angstrom (
>      http://www.angstrom-distribution.org/toolchains/) or build your own
>       toolchain.
>       2. Extract the cross-compiler
>
>                                                                i.      cd /
>
>                                                              ii.      sudo
> tar –xjvf  *pathname/to/your/Angstrom/toolchain/tarball*
>
>    1. Set up a cross-compiled “Hello World” program:
>       1. Run eclipse
>       2. Create a “New C Project”
>
>                                                                i.
> File->New->C
> Project
>
>     1. Call the project “HelloBeagle”
>       2. Select “Hello World ANSI C Project”
>       3. Select “Finish”
>       4. Right-click on the “HelloBeagle” project folder and create a new
>       Build Configuration:
>
>                                                                i.      Build
> Configurations->Manage…
>
>                                                              ii.      Select
> “New”
>
>                                                             iii.      Set
> the Name: to BeagleBoardRelease
>
>                                                            iv.      Set the
> Existing configuration to “Release”
>
>                                                              v.      Press
> “OK” and “OK” to leave the dialog
>
>     1. Right-click on the “HelloBeagle” project folder and set the
>       properties of the cross-compiled target:
>
>                                                                i.      Select
> Properties
>
>                                                              ii.      Select
> C/C++ Build->Settings
>
>                                                             iii.      Reset
> the GCC C Compiler “Command:” to
>
> /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-gcc
>
> * *
>
>                                                            iv.      Add the
> following include path to the “Directories”
>
> /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/include
>
>                                                              v.      Reset
> the GCC C Linker “Command:” to
>
> /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-gcc
>
>                                                            vi.      Add the
> following library path to the “Libraries”
>
> /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/lib
>
>                                                           vii.      Reset
> the GCC Assembler “Command:” to
>
> /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-as
>
>     1. Set the active target to BeagleBoardRelease
>
>                                                                i.
> Right-click
> on the “HelloBeagle” project folder
>
>                                                              ii.      Select
> “Build Configurations->Set Active->BeagleBoardRelease”
>
>     1. Right-click on the “HelloBeagle” project and select “Build Project”
>       2. If you copy the resulting executable to a Beagleboard running
Reply all
Reply to author
Forward
0 new messages