Difference between revisions of "BELK-TN-006: Using PetaLinux to Build BELK/BXELK Software Components"

From DAVE Developer's Wiki
Jump to: navigation, search
(Introduction)
(Building the Linux kernel)
Line 105: Line 105:
 
Create the <code>uImage</code> file:
 
Create the <code>uImage</code> file:
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
 +
dvdk@osboxes:~/devel/bora/prj/bora1$ petalinux-package --image -c kernel --format uImage
 +
SDK environment now set up; additionally you may now run devtool to perform development tasks.
 +
Run devtool --help for further details.
 +
 +
### Shell environment set up for builds. ###
 +
 +
You can now run 'bitbake <target>'
 +
 +
Common targets are:
 +
    core-image-minimal
 +
    core-image-sato
 +
    meta-toolchain
 +
    meta-ide-support
 +
 +
You can also run generated qemu images with a command like 'runqemu qemux86'
 +
INFO: Adding user layer: /home/dvdk/devel/bora/prj/bora1/project-spec/meta-user
 +
INFO: generating uImage
 +
INFO: bitbake -R /home/dvdk/devel/bora/prj/bora1/build/conf/kerneltype.conf virtual/kernel
 +
Parsing recipes: 100% |####################################################################################################################| Time: 0:01:56
 +
Parsing of 2446 .bb files complete (0 cached, 2446 parsed). 3236 targets, 224 skipped, 0 masked, 0 errors.
 +
NOTE: Resolving any missing task queue dependencies
 +
Initialising tasks: 100% |#################################################################################################################| Time: 0:00:16
 +
Checking sstate mirror object availability: 100% |#########################################################################################| Time: 0:00:12
 +
NOTE: Executing SetScene Tasks
 +
NOTE: Executing RunQueue Tasks
 +
linux-xlnx-4.9-belk-4.0.0+git999-r0 do_compile: NOTE: linux-xlnx: compiling from external source tree /home/dvdk/devel/bora/prj/bora1/build/../components/ext_sources/linux-xlnx
 +
NOTE: Tasks Summary: Attempted 2410 tasks of which 2374 didn't need to be rerun and all succeeded.
 
</pre>
 
</pre>
  
 
After the build is completed, the <code>uImage</code> file and the device tree blob are located in the <code>images/linux</code> directory.
 
After the build is completed, the <code>uImage</code> file and the device tree blob are located in the <code>images/linux</code> directory.

Revision as of 10:34, 21 September 2018

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

History[edit | edit source]

Version Date Notes
1.0.0 September 2018 First public release

Introduction[edit | edit source]

As explained here, BELK/BXELK structure is not based on PetaLinux build system. Instead, BELK/BXELK make use of a standardized Yocto-based build system to build all the software components—U-Boot, Linux kernel, and root filesystem—that run on the Processing System (PS). This choice is more flexible and more modularized but it requires a little bit more knowledge of embedded Linux systems.

That being said, there are cases in which it can be convenient to build such components with PetaLinux build system, however. This technical note shows how to build the Linux kernel image released with BELK/BXELK with PetaLinux build system.

The procedure was tested with the following configuration.

Component Version
PetaLinux 2017.2
BELK/BXELK 4.0.0

Building the Linux kernel[edit | edit source]

First of all, PetaLinux environment has to be set up.


Then, create a project from the zynq template:

petalinux-create --type project --template zynq --name bora_1

Import the hardware specification file (.hdf) generated by your Vivado project:

petalinux-config --get-hw-description=/home/dvdk/devel/bora/bora-minimal/bora-minimal.sdk/

Your project tree should look like this:


Clone the Linux kernel sources from DAVE's git repisitory in the :

kernel directory


Replace the file xilinx_zynq_defconfig with a symbolic link to bora_defconfig:


dvdk@osboxes:~/devel/bora/prj/bora1/components/ext_sources/linux-xlnx$ cd arch/arm/configs/ dvdk@osboxes:~/devel/bora/prj/bora1/components/ext_sources/linux-xlnx/arch/arm/configs$ rm xilinx_zynq_defconfig dvdk@osboxes:~/devel/bora/prj/bora1/components/ext_sources/linux-xlnx/arch/arm/configs$ ln -s bora_defconfig xilinx_zynq_defconfig dvdk@osboxes:~/devel/bora/prj/bora1/components/ext_sources/linux-xlnx/arch/arm/configs$ ll xilinx_zynq_defconfig lrwxrwxrwx 1 dvdk dvdk 14 set 21 10:30 xilinx_zynq_defconfig -> bora_defconfig


Add in project-spec/meta-user/conf/petalinuxbsp.conf

LINUX_VERSION_EXTENSION = "-belk-4.0.0"
KERNEL_DEVICETREE = "bora.dtb"

Configure the build system in order to use an external kernel:

Configure the build system in order to use a custom directory for device tree include files: DTS include directory

Build the kernel:

dvdk@osboxes:~/devel/bora/prj/bora1$ petalinux-build -v -c kernel
[INFO] building kernel
[INFO] sourcing bitbake
INFO: bitbake virtual/kernel
Parsing recipes: 100% |####################################################################################################################| Time: 0:02:14
Parsing of 2446 .bb files complete (0 cached, 2446 parsed). 3236 targets, 224 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
Initialising tasks: 100% |#################################################################################################################| Time: 0:00:22
Checking sstate mirror object availability: 100% |#########################################################################################| Time: 0:00:13
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
linux-xlnx-4.9-belk-4.0.0+git999-r0 do_compile: NOTE: linux-xlnx: compiling from external source tree /home/dvdk/devel/bora/prj/bora1/build/../components/ext_sources/linux-xlnx
NOTE: Tasks Summary: Attempted 2410 tasks of which 2349 didn't need to be rerun and all succeeded.
INFO: Copying Images from deploy to images
INFO: Creating images/linux directory
[INFO] successfully built kernel

Create the uImage file:

dvdk@osboxes:~/devel/bora/prj/bora1$ petalinux-package --image -c kernel --format uImage
SDK environment now set up; additionally you may now run devtool to perform development tasks.
Run devtool --help for further details.

### Shell environment set up for builds. ###

You can now run 'bitbake <target>'

Common targets are:
    core-image-minimal
    core-image-sato
    meta-toolchain
    meta-ide-support

You can also run generated qemu images with a command like 'runqemu qemux86'
INFO: Adding user layer: /home/dvdk/devel/bora/prj/bora1/project-spec/meta-user
INFO: generating uImage
INFO: bitbake -R /home/dvdk/devel/bora/prj/bora1/build/conf/kerneltype.conf virtual/kernel 
Parsing recipes: 100% |####################################################################################################################| Time: 0:01:56
Parsing of 2446 .bb files complete (0 cached, 2446 parsed). 3236 targets, 224 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
Initialising tasks: 100% |#################################################################################################################| Time: 0:00:16
Checking sstate mirror object availability: 100% |#########################################################################################| Time: 0:00:12
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
linux-xlnx-4.9-belk-4.0.0+git999-r0 do_compile: NOTE: linux-xlnx: compiling from external source tree /home/dvdk/devel/bora/prj/bora1/build/../components/ext_sources/linux-xlnx
NOTE: Tasks Summary: Attempted 2410 tasks of which 2374 didn't need to be rerun and all succeeded.

After the build is completed, the uImage file and the device tree blob are located in the images/linux directory.