Difference between revisions of "Building and Customizing EMAC OE"

From wiki.emacinc.com
Jump to: navigation, search
 
(18 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{todo|Broken Links and info boxes; recommends Debian 5.0; Poor transition from background info into howto steps; tries too hard to be distro neutral; only provides dependency info for Debian; we should mirror bitbake and update the links, so the links won't break; still shows using svn for OE|Michael Gloff|project=oe 4,mg,Review}}
+
{{todo|SEOKWREV <strike>Broken Links and info boxes; recommends Debian 5.0; Poor transition from background info into howto steps; tries too hard to be distro neutral; only provides dependency info for Debian; we should mirror bitbake and update the links, so the links won't break; still shows using svn for OE</strike> (12.31.13-11:15->KY+);(01.02.14-18:20->MD+);(01.03.14-13:10->MD+);(01.03.14-13:45->KY+);(01.03.14-14:15->MW+);(03.04.14-16:30->BS-);(03.27.14-15:30->BS+);(04.02.14-15:50->BS+)|Michael Gloff|project=oe 4,mg,SEOKWREV,ky,md,bs}}
  
An EMAC [OpenEmbedded] Linux build is the end product of several different build systems. These consist of three core components: BitBake, OpenEmbedded, and EMAC . Each one of these tools is built one upon the other: BitBake → OpenEmbedded → EMAC OpenEmbedded. You will need to download each component separately.  
+
{{#seo:
 +
|title=Building and Customizing EMAC OE
 +
|titlemode=append
 +
|keywords=Building EMAC OE,Customizing EMAC OE,Installing BitBake,Installing EMAC OpenEmbedded
 +
|description=Building and Customizing EMAC open embedded.
 +
}}
 +
An EMAC [http://www.openembedded.org/ OpenEmbedded] Linux build is the end product of several different build systems. These consist of three core components: BitBake, OpenEmbedded, and EMAC . Each one of these tools is built one upon the other: BitBake → OpenEmbedded → EMAC OpenEmbedded. You will need to download each component separately.  
  
Please familiarize yourself with [OpenEmbedded's Wiki] before continuing.
+
Please familiarize yourself with [http://www.openembedded.org/wiki/Main_Page OpenEmbedded's Wiki] before continuing.
  
{{ mbox | type = notice | style = margin-bottom: 1em;| text = EMAC, Inc. provides this page for informational use for its customers and will not be held liable for any mistakes or omissions on this page which may cause your computer operating system to fail. Use at your own risk.}}
+
{{ mbox | type = warning | style = margin-bottom: 1em;| text = Caution should be exercised when making changes to a build as outlined below. It is possible, if directions are not followed carefully, to "Brick" the system (potentially requiring the return of the board to EMAC for restoration).}}
  
 
==System Preparation==
 
==System Preparation==
  
{{ mbox | type = warning | style = margin-bottom: 1em;| text = After initial preparation, only run the commands on this page from a user in the oe group. Doing so can do serious damage to the running operating system.}}
+
{{ mbox | type = warning | style = margin-bottom: 1em;| text = After initial preparation, the commands on this page should only be run as a user in the oe group. Doing otherwise can cause serious damage to the running operating system.}}
  
You need to be running a GNU/Linux operating system to use OpenEmbedded. OpenEmbedded requires a large number of development tools to work correctly with your Linux distribution. However due to the large number of distributions available, please see the OpenEmbedded Wiki page [http://www.openembedded.org/wiki/Getting_started_with_OE-Classic OEandYourDistro] for the instruction on the installation of the development packages which are required.
+
You need to be running a GNU/Linux operating system to use OpenEmbedded. OpenEmbedded requires a large number of development tools to work correctly with your Linux distribution. However due to the large number of distributions available, please see the OpenEmbedded Wiki page [http://www.openembedded.org/wiki/Getting_started_with_OE-Classic OE and Your Distro] for the instruction on the installation of the development packages which are required.
  
After installing all of the necessary packages to your distribution you will need to set up the location of EMAC OE. By default EMAC OE expects to be installed in <code>/opt/oe</code>.
+
After installing all of the necessary packages to your distribution you will need to set up the location of EMAC OE. The default EMAC OE install location is <code>/opt/oe</code>.
  
As the superuser (root or as sudo):
+
As the superuser (root or via sudo):
 
# Create a group called <code>oe</code> and add the development users to the group.
 
# Create a group called <code>oe</code> and add the development users to the group.
 
# Make a directory in <code>/opt</code> called <code>oe</code>.
 
# Make a directory in <code>/opt</code> called <code>oe</code>.
Line 22: Line 28:
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
developer@ldc:~$ add-group oe developer
+
root@ldc:~# add-group oe developer
developer@ldc:~$ mkdir /opt/oe
+
root@ldc:~# mkdir /opt/oe
developer@ldc:~$ chmod 6775 /opt/oe
+
root@ldc:~# chmod 6775 /opt/oe
developer@ldc:~$ oe /opt/oe
+
root@ldc:~# oe /opt/oe
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 53: Line 59:
 
===Installing BitBake===
 
===Installing BitBake===
  
This information is from [OpenEmbedded's Getting Started page].
+
This information is from [http://www.openembedded.org/wiki/Getting_started OpenEmbedded's Getting Started page].
  
EMAC OE Linux 4.0 is based on the stable-2009 branch of [OpenEmbedded]. For stable-2009 use BitBake versions between 1.8.12 and 1.8.18. As a user in the oe group, download and extract BitBake:
+
EMAC OE Linux 4.0 is based on the stable-2009 branch of [http://www.openembedded.org/ OpenEmbedded]. For stable-2009 use BitBake versions between 1.8.12 and 1.8.18. As a user in the oe group, download and extract BitBake:
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Line 122: Line 128:
  
 
Run the emac-image image recipe.
 
Run the emac-image image recipe.
 +
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
developer@ldc:~$ ./oe-run.sh emac-image
 
developer@ldc:~$ ./oe-run.sh emac-image
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
  
 
Bitbake performs a sanity check on the system each time that it is run. If any misconfigurations are detected, the user will be notified of the issue and a suggested fix. Depending on the system, there may be several issues to correct on the first run. For example, a common issue is the value of <code>/proc/sys/vm/mmap_min_addr</code>, as illustrated below:  
 
Bitbake performs a sanity check on the system each time that it is run. If any misconfigurations are detected, the user will be notified of the issue and a suggested fix. Depending on the system, there may be several issues to correct on the first run. For example, a common issue is the value of <code>/proc/sys/vm/mmap_min_addr</code>, as illustrated below:  
  
<syntaxhighlight lang="console">
+
 
ERROR:  Openembedded's config sanity checker detected a potential misconfiguration.
+
ERROR:  Openembedded's config sanity checker detected a potential misconfiguration.
 
         Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
 
         Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
 
         Following is the list of potential problems / advisories:
 
         Following is the list of potential problems / advisories:
Line 136: Line 144:
 
         /proc/sys/vm/mmap_min_addr is not 0. This will cause problems with qemu so please fix the value (as root).
 
         /proc/sys/vm/mmap_min_addr is not 0. This will cause problems with qemu so please fix the value (as root).
 
   
 
   
To fix this in later reboots, set vm.mmap_min_addr = 0 in /etc/sysctl.conf.
+
To fix this in later reboots, set vm.mmap_min_addr = 0 in /etc/sysctl.conf.
</syntaxhighlight>
+
 
  
 
EMAC recommends fixing this issue as suggested, but the user should be aware of the possible security implications.
 
EMAC recommends fixing this issue as suggested, but the user should be aware of the possible security implications.
  
On the first build, bitbake will create a cache of the recipes in the build system, which will take a few minutes. After this is complete, bitbake attempts to run all of the recipes required for the image to be built. This is done in multiple threads utilizing the dependencies between recipes to determine which packages are built first. The first task is to “fetch” the software required to build each recipe. This may take a while depending on the network connection speed. After the source is downloaded the first time, any further builds will use the existing local source copy rather than downloading the source again.
+
On the first build, bitbake will create a cache of the recipes in the build system; this will take a few minutes. After this is complete, bitbake attempts to run all of the recipes required for the image to be built. This is done in multiple threads utilizing the dependencies between recipes to determine which packages are built first. The first task is to “fetch” the software required to build each recipe. This may take a while depending on the network connection speed. After the source is downloaded the first time, any further builds will use the existing local source copy rather than downloading the source again.
  
 
Occasionally, project maintainers or mirrors will move or obsolete a source download such that the location specified in the recipe <code>SRC_URI</code> is no longer valid. If this happens, bitbake will print an error and stop the build. For example, the following error occurred when the zlib version 1.2.3 recipe was run:
 
Occasionally, project maintainers or mirrors will move or obsolete a source download such that the location specified in the recipe <code>SRC_URI</code> is no longer valid. If this happens, bitbake will print an error and stop the build. For example, the following error occurred when the zlib version 1.2.3 recipe was run:
  
<syntaxhighlight lang="console">
 
Connecting to www.zlib.net|69.73.181.135|:80... connected.
 
HTTP request sent, awaiting response... 404 Not Found
 
2011-06-26 10:55:33 ERROR 404: Not Found.
 
  
NOTE: Task failed: Fetch failed: http://www.zlib.net/zlib-1.2.3.tar.bz2
+
Connecting to www.zlib.net|69.73.181.135|:80... connected.
ERROR: TaskFailed event exception, aborting
+
HTTP request sent, awaiting response... 404 Not Found
ERROR: Build of /opt/oe-test/openembedded/recipes/zlib/zlib-native_1.2.3.bb do_fetch failed
+
2011-06-26 10:55:33 ERROR 404: Not Found.
ERROR: Task 633 (/opt/oe-test/openembedded/recipes/zlib/zlib-native_1.2.3.bb, do_fetch) failed
+
 
NOTE: Waiting for 1 active tasks to finish
+
NOTE: Task failed: Fetch failed: http://www.zlib.net/zlib-1.2.3.tar.bz2
NOTE: 1: /opt/oe-test/openembedded/recipes/gettext/gettext-native_0.17.bb, do_populate_staging (27565)
+
ERROR: TaskFailed event exception, aborting
NOTE: Tasks Summary: Attempted 160 tasks of which 159 didn't need to be rerun and 1 failed.
+
ERROR: Build of /opt/oe-test/openembedded/recipes/zlib/zlib-native_1.2.3.bb do_fetch failed
ERROR: '/opt/oe-test/openembedded/recipes/zlib/zlib-native_1.2.3.bb' failed
+
ERROR: Task 633 (/opt/oe-test/openembedded/recipes/zlib/zlib-native_1.2.3.bb, do_fetch) failed
</syntaxhighlight>
+
NOTE: Waiting for 1 active tasks to finish
 +
NOTE: 1: /opt/oe-test/openembedded/recipes/gettext/gettext-native_0.17.bb, do_populate_staging (27565)
 +
NOTE: Tasks Summary: Attempted 160 tasks of which 159 didn't need to be rerun and 1 failed.
 +
ERROR: '/opt/oe-test/openembedded/recipes/zlib/zlib-native_1.2.3.bb' failed
 +
 
  
 
Although EMAC attempts to keep up with source availability issues, they still occur due to constant development in the open source community. If you encounter an error like this, please contact EMAC technical support with the error message.
 
Although EMAC attempts to keep up with source availability issues, they still occur due to constant development in the open source community. If you encounter an error like this, please contact EMAC technical support with the error message.
Line 176: Line 184:
 
====x86 Image Install====
 
====x86 Image Install====
  
This example is for x86 based single board computers only using a CompactFlash SSD. For other boards contact EMAC Technical Support. See [[Loading Linux Images to a Compact Flash_Disk]]
+
This example is for x86 based single board computers only using a CompactFlash disk. For other boards contact EMAC Technical Support. See [[Loading Linux Images to a Compact Flash_Disk]]
  
 
====ARM Image Install====
 
====ARM Image Install====
Line 186: Line 194:
 
[[Loading Images with RedBoot]]
 
[[Loading Images with RedBoot]]
  
[[Category:Custom Development]]
+
<!--[[Category:Custom Development]]-->

Latest revision as of 14:53, 2 April 2014

TODO: {{#todo:SEOKWREV Broken Links and info boxes; recommends Debian 5.0; Poor transition from background info into howto steps; tries too hard to be distro neutral; only provides dependency info for Debian; we should mirror bitbake and update the links, so the links won't break; still shows using svn for OE (12.31.13-11:15->KY+);(01.02.14-18:20->MD+);(01.03.14-13:10->MD+);(01.03.14-13:45->KY+);(01.03.14-14:15->MW+);(03.04.14-16:30->BS-);(03.27.14-15:30->BS+);(04.02.14-15:50->BS+)|Michael Gloff|oe 4,mg,SEOKWREV,ky,md,bs}}

An EMAC OpenEmbedded Linux build is the end product of several different build systems. These consist of three core components: BitBake, OpenEmbedded, and EMAC . Each one of these tools is built one upon the other: BitBake → OpenEmbedded → EMAC OpenEmbedded. You will need to download each component separately.

Please familiarize yourself with OpenEmbedded's Wiki before continuing.

System Preparation

You need to be running a GNU/Linux operating system to use OpenEmbedded. OpenEmbedded requires a large number of development tools to work correctly with your Linux distribution. However due to the large number of distributions available, please see the OpenEmbedded Wiki page OE and Your Distro for the instruction on the installation of the development packages which are required.

After installing all of the necessary packages to your distribution you will need to set up the location of EMAC OE. The default EMAC OE install location is /opt/oe.

As the superuser (root or via sudo):

  1. Create a group called oe and add the development users to the group.
  2. Make a directory in /opt called oe.
  3. Change the permissions of /opt/oe to 6775.
  4. Add a umask of 0002 to each account.
root@ldc:~# add-group oe developer
root@ldc:~# mkdir /opt/oe
root@ldc:~# chmod 6775 /opt/oe
root@ldc:~# oe /opt/oe

umask can be run by the user on the command line or added to the user's startup script. These are typically .<shell_name>rc or .profile in the user's home directory. Failure to do so will result in files without write access to group members.

developer@ldc:~$ umask 0002

umask without any argument will show the current environment umask.

After adding the development users to the oe group and modifying the umask, log out of the development system and log back in before continuing.

Installing Dependencies

developer@ldc:~$ 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++ \
		 libxml2-utils xmlto python-psyco \
		 docbook \
		 ccache bash \
		 ncurses-dev fakeroot \
		 qemu kvm

Installing BitBake

This information is from OpenEmbedded's Getting Started page.

EMAC OE Linux 4.0 is based on the stable-2009 branch of OpenEmbedded. For stable-2009 use BitBake versions between 1.8.12 and 1.8.18. As a user in the oe group, download and extract BitBake:

developer@ldc:~$ cd /opt/oe
developer@ldc:~$ wget http://download.berlios.de/bitbake/bitbake-1.8.18.tar.gz
developer@ldc:~$ tar xzvf bitbake-1.8.18.tar.gz
developer@ldc:~$ ln -s bitbake-1.8.18/bin/bitbake bitbake

Installing OpenEmbedded

Checkout the stable-2009 branch of the OpenEmbedded git repository:

developer@ldc:~$ cd /opt/oe
developer@ldc:~$ git clone git://git.openembedded.org/openembedded /opt/oe/openembedded
developer@ldc:~$ cd openembedded
developer@ldc:~$ git checkout -b stable/2009 origin/stable/2009
developer@ldc:~$ git pull
developer@ldc:~$ git status

If everything went correctly, git status should reply as follows:

# On branch stable/2009
nothing to commit (working directory clean)

Installing EMAC OpenEmbedded

  1. Checkout the public build tree of EMAC OE from EMAC's Subversion repository:

    developer@ldc:~$ cd /opt/oe
    developer@ldc:~$ svn checkout https://svn.emacinc.com/public/EMAC-OE-2009.03-STABLE/trunk /opt/oe/emac-oe_stable-2009
    
  2. Download the additional source package from the EMAC FTP server:

    developer@ldc:~$ cd /opt/oe
    developer@ldc:~$ wget ftp://ftp.emacinc.com/Controllers/Development_Kits/EMAC_Open_Tools/Linux/emac-oe_stable-2009_sources.tar.bz2
    developer@ldc:~$ tar xjvf emac-oe_stable-2009_sources.tar.bz2
    

Making the Build

Set the Machine Type

OpenEmbedded uses configuration files to determine the features, recipe versions, architecture, and setup of the build. The local.conf file specifies the machine and distribution configuration to use as well as other settings. EMAC provides default configuration files for all of our supported target machines. The oe-set-machine.sh script is provided to automatically create a symbolic link from local.conf to the configuration file set up for the selected machine. This must be done to configure EMAC OE prior to starting a build.

developer@ldc:~$ cd /opt/oe/emac-oe_stable-2009
developer@ldc:~$ ./oe-set-machine.sh

Type in the selection for the desired target machine and press enter.

Generate a Base Build

The oe-run.sh script is a wrapper script for bitbake which sets all of the environment variables internally on each run. This isolates EMAC OE's bitbake version from other bitbake versions on the system. If directory locations were used that differ from the set up instructions on this page, the variables in oe-run.sh will need to be modified accordingly.

This step will take several hours depending on the time it takes to download and compile the sources. All of the sources will be downloaded and compiled in the order they are called by the build recipes. The default configurations provided by EMAC specify that recipes should be built in parallel when possible, so bitbake will generally be performing multiple fetch / compile operations at any point during the build.

The default headless image for EMAC machines is named emac-image. This recipe is located in recipes/images/emac-image.bb in the EMAC OE tree. This should be the first image built for any target to verify the setup.

Run the emac-image image recipe.


developer@ldc:~$ ./oe-run.sh emac-image


Bitbake performs a sanity check on the system each time that it is run. If any misconfigurations are detected, the user will be notified of the issue and a suggested fix. Depending on the system, there may be several issues to correct on the first run. For example, a common issue is the value of /proc/sys/vm/mmap_min_addr, as illustrated below:


ERROR:  Openembedded's config sanity checker detected a potential misconfiguration.
       Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
       Following is the list of potential problems / advisories:

       /proc/sys/vm/mmap_min_addr is not 0. This will cause problems with qemu so please fix the value (as root).

To fix this in later reboots, set vm.mmap_min_addr = 0 in /etc/sysctl.conf.


EMAC recommends fixing this issue as suggested, but the user should be aware of the possible security implications.

On the first build, bitbake will create a cache of the recipes in the build system; this will take a few minutes. After this is complete, bitbake attempts to run all of the recipes required for the image to be built. This is done in multiple threads utilizing the dependencies between recipes to determine which packages are built first. The first task is to “fetch” the software required to build each recipe. This may take a while depending on the network connection speed. After the source is downloaded the first time, any further builds will use the existing local source copy rather than downloading the source again.

Occasionally, project maintainers or mirrors will move or obsolete a source download such that the location specified in the recipe SRC_URI is no longer valid. If this happens, bitbake will print an error and stop the build. For example, the following error occurred when the zlib version 1.2.3 recipe was run:


Connecting to www.zlib.net|69.73.181.135|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2011-06-26 10:55:33 ERROR 404: Not Found.
NOTE: Task failed: Fetch failed: http://www.zlib.net/zlib-1.2.3.tar.bz2
ERROR: TaskFailed event exception, aborting
ERROR: Build of /opt/oe-test/openembedded/recipes/zlib/zlib-native_1.2.3.bb do_fetch failed
ERROR: Task 633 (/opt/oe-test/openembedded/recipes/zlib/zlib-native_1.2.3.bb, do_fetch) failed
NOTE: Waiting for 1 active tasks to finish
NOTE: 1: /opt/oe-test/openembedded/recipes/gettext/gettext-native_0.17.bb, do_populate_staging (27565)
NOTE: Tasks Summary: Attempted 160 tasks of which 159 didn't need to be rerun and 1 failed.
ERROR: '/opt/oe-test/openembedded/recipes/zlib/zlib-native_1.2.3.bb' failed


Although EMAC attempts to keep up with source availability issues, they still occur due to constant development in the open source community. If you encounter an error like this, please contact EMAC technical support with the error message.

All build files will be generated in the tmp directory. If a tmp directory does not exist it will be created. Image files will be located in tmp/deploy/images after the build has successfully completed.

The default graphical image for EMAC OE is called emac-ppc-image (“ppc” refers to “Panel PC”) and expands on the emac-image recipe to add a GUI using X11 and the Matchbox Desktop environment. If the target machine has support for a graphical interface, this image can be built using the same process as with the emac-image above:

developer@ldc:~$ ./oe-run.sh emac-ppc-image

Install the Build Image

After building the image, it can be loaded to the board for testing. This process differs between target systems based on the architecture, bootloader, and media type. Some general information is provided in this section.

x86 Image Install

This example is for x86 based single board computers only using a CompactFlash disk. For other boards contact EMAC Technical Support. See Loading Linux Images to a Compact Flash_Disk

ARM Image Install

EMAC ARM systems utilize U-Boot for the bootloader. While the procedure differs between each board, images are loaded from a TFTP server on the local network and programmed to flash through U-Boot. EMAC maintains documentation on how to load and program images for each of these bootloaders; please refer to these guides for specific instructions.

Loading Images with U-Boot

Loading Images with RedBoot