Difference between revisions of "Advanced use of Yocto build system (BELK/BXELK)"

From DAVE Developer's Wiki
Jump to: navigation, search
(Introduction)
Line 22: Line 22:
 
*Make sure that all the prerequisites are met
 
*Make sure that all the prerequisites are met
 
*Initialize the build environment, as described in [[#Initializing the build environment|here]].
 
*Initialize the build environment, as described in [[#Initializing the build environment|here]].
Optionally ensure the <code>conf/local.conf</code> configuration file, which is found in the Build Directory, is set up how you want it. This file defines many aspects of the build environment including the target machine architecture through the <code>MACHINE</code> variable, the development machine's processor use through the <code>BB_NUMBER_THREADS</code> and <code>PARALLEL_MAKE</code> variables, and a centralized tarball download directory through the <code>DL_DIR</code> variable.
+
*Optionally ensure the <code>conf/local.conf</code> configuration file, which is found in the Build Directory, is set up how you want it. This file defines many aspects of the build environment including the target machine architecture through the <code>MACHINE</code> variable, the development machine's processor use through the <code>BB_NUMBER_THREADS</code> and <code>PARALLEL_MAKE</code> variables, and a centralized tarball download directory through the <code>DL_DIR</code> variable.
Build the image using the <code>bitbake</code> command. For more information about BitBake, please refer to the BitBake User Manual.
+
*Build the image using the <code>bitbake</code> command. For more information about BitBake, please refer to the BitBake User Manual.
  
 
==Prerequisites==
 
==Prerequisites==
The following prerequisites are required and only need to be done once.
+
The following prerequisites are required. They need to be done once only.
 
Some generic development tools are required on the host Linux machine:
 
Some generic development tools are required on the host Linux machine:
git
+
*<code>git</code>
curl
+
*<code>curl</code>
build-essential
+
*<code>build-essential</code>
diffstat
+
*<code>diffstat</code>
texinfo
+
*<code>texinfo</code>
gawk
+
*<code>gawk</code>
chrpath
+
*<code>chrpath</code>
ia32-libs (if the host machine is running a 64-bit OS)
+
*<code>ia32-libs</code> (if the host machine is running a 64-bit OS)
python-m2crypto
+
*<code>python-m2crypto</code>.
 
These packages can be installed with the following command:
 
These packages can be installed with the following command:
sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm
+
<code>sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm</code>.
It is also recommended to switch the system shell from Ubuntu's standard dash to more universal bash:
+
It is also recommended to switch the system shell from Ubuntu's standard dash to more universal bash: <code>:~$ sudo dpkg-reconfigure dash</code>
:~$ sudo dpkg-reconfigure dash
 
 
==Initializing the build environment==
 
==Initializing the build environment==
In the BELK, we have simplified the Yocto initialization phase, relying on the repo tool and on a BORA bsp git repository, so that the initialization can be completed with a few commands as reported below:
+
In the BELK, we have simplified the Yocto initialization phase, relying on the <code>repo</code> tool and on a BORA BSP git repository, so that the initialization can be completed with a few commands as reported below:
 +
<pre>
 
:~$ mkdir belk && cd belk
 
:~$ mkdir belk && cd belk
 
:~/belk$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > repo
 
:~/belk$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > repo
Line 48: Line 48:
 
:~/belk$ ./repo init -u git@git.dave.eu:dave/bora/bora-bsp.git -b bora
 
:~/belk$ ./repo init -u git@git.dave.eu:dave/bora/bora-bsp.git -b bora
 
:~/belk$ ./repo sync
 
:~/belk$ ./repo sync
 +
</pre>
 
==Build the Yocto image==
 
==Build the Yocto image==
 
Please note that even building the basic root file system requires a few hours to complete the process on a mid-hi range desktop PC (4-6 cores, 8-12 GiB RAM), also depending on the Internet connection speed (all source are fetched from the network). Nearly 20GiB of disk space is required for the build.  
 
Please note that even building the basic root file system requires a few hours to complete the process on a mid-hi range desktop PC (4-6 cores, 8-12 GiB RAM), also depending on the Internet connection speed (all source are fetched from the network). Nearly 20GiB of disk space is required for the build.  
 
Once completed the initialization phase, developers can launch the Yocto image build process with the following commands:
 
Once completed the initialization phase, developers can launch the Yocto image build process with the following commands:
 +
<pre>
 
:~$ cd ~/belk
 
:~$ cd ~/belk
 
:~/belk$ source bora-bsp-init-env.sh build
 
:~/belk$ source bora-bsp-init-env.sh build
 
:~/belk/build$ bitbake base-rootfs-image
 
:~/belk/build$ bitbake base-rootfs-image
Please note that even the basic root file system requires a few hours to build on a mid-hi range desktop (4-6 cores, 8-12 GiB RAM) also depending on your Internet connection speed (all sources are fetched from the network). Nearly 20GiB of disk space is required for the build.
+
</pre>.
The resulting files (kernel, devicetree and u-boot binaries, plus .tar.gz root file system) will then be available inside build/tmp/deploy/images/bora.
+
 
 +
The resulting files (kernel, devicetree and u-boot binaries, plus .tar.gz root file system) will then be available inside <code>build/tmp/deploy/images/bora</code>.
 
==Build additional packages==
 
==Build additional packages==
To build additional packages the user must first enter the directory where the bora-bsp-init-env.sh is placed and source it:
+
To build additional packages the user must first enter the directory where the <code>bora-bsp-init-env.sh</code> is placed and source it:
 +
<pre>
 
:~$ cd ~/belk
 
:~$ cd ~/belk
 
:~/belk$ source bora-bsp-init-env.sh build
 
:~/belk$ source bora-bsp-init-env.sh build
And then can run any of the bitbake commands:
+
</pre>
 +
And then he/she can run any of the bitbake commands:
 +
<pre>
 
:~/belk/build$ bitbake memtester
 
:~/belk/build$ bitbake memtester
The resulting packages (the default format is ipk) can be found inside build/tmp/deploy/ipk.
+
</pre>
 +
The resulting packages (the default format is ipk) can be found inside <code>build/tmp/deploy/ipk</code>.

Revision as of 11:18, 30 October 2015

Info Box
Bora5-small.jpg Applies to Bora
BORA Xpress.png Applies to BORA Xpress

History[edit | edit source]

Version Date BELK version Notes
1.0.0 November 2015 3.0.0 First release

Introduction[edit | edit source]

The build process creates an entire Linux distribution from source. The build process can be summarized as follows:

  • Make sure that all the prerequisites are met
  • Initialize the build environment, as described in here.
  • Optionally ensure the conf/local.conf configuration file, which is found in the Build Directory, is set up how you want it. This file defines many aspects of the build environment including the target machine architecture through the MACHINE variable, the development machine's processor use through the BB_NUMBER_THREADS and PARALLEL_MAKE variables, and a centralized tarball download directory through the DL_DIR variable.
  • Build the image using the bitbake command. For more information about BitBake, please refer to the BitBake User Manual.

Prerequisites[edit | edit source]

The following prerequisites are required. They need to be done once only. Some generic development tools are required on the host Linux machine:

  • git
  • curl
  • build-essential
  • diffstat
  • texinfo
  • gawk
  • chrpath
  • ia32-libs (if the host machine is running a 64-bit OS)
  • python-m2crypto.

These packages can be installed with the following command: sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm. It is also recommended to switch the system shell from Ubuntu's standard dash to more universal bash: :~$ sudo dpkg-reconfigure dash

Initializing the build environment[edit | edit source]

In the BELK, we have simplified the Yocto initialization phase, relying on the repo tool and on a BORA BSP git repository, so that the initialization can be completed with a few commands as reported below:

:~$ mkdir belk && cd belk
:~/belk$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > repo
:~/belk$ chmod a+x repo
:~/belk$ ./repo init -u git@git.dave.eu:dave/bora/bora-bsp.git -b bora
:~/belk$ ./repo sync

Build the Yocto image[edit | edit source]

Please note that even building the basic root file system requires a few hours to complete the process on a mid-hi range desktop PC (4-6 cores, 8-12 GiB RAM), also depending on the Internet connection speed (all source are fetched from the network). Nearly 20GiB of disk space is required for the build. Once completed the initialization phase, developers can launch the Yocto image build process with the following commands:

:~$ cd ~/belk
:~/belk$ source bora-bsp-init-env.sh build
:~/belk/build$ bitbake base-rootfs-image

.

The resulting files (kernel, devicetree and u-boot binaries, plus .tar.gz root file system) will then be available inside build/tmp/deploy/images/bora.

Build additional packages[edit | edit source]

To build additional packages the user must first enter the directory where the bora-bsp-init-env.sh is placed and source it:

:~$ cd ~/belk
:~/belk$ source bora-bsp-init-env.sh build

And then he/she can run any of the bitbake commands:

:~/belk/build$ bitbake memtester

The resulting packages (the default format is ipk) can be found inside build/tmp/deploy/ipk.