B2QT Build Release: Difference between revisions

From Variscite Wiki
(16 intermediate revisions by 3 users not shown)
Line 2: Line 2:
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{#lst:B2QT_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_MORTY_V1.0_VAR-SOM-MX6}}}} <!--
--> {{#lst:B2QT_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_MORTY_V1.0_VAR-SOM-MX6}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Boot to QT {{#var:B2QT_BSP_VERSION}} based on Yocto {{#var:YOCTO_NAME}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=B2QT}} }}__toc__
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Boot to Qt {{#var:B2QT_BSP_VERSION}} based on Yocto {{#var:YOCTO_NAME}} {{DocImage|category1=Boot2Qt|category2={{#var:HARDWARE_NAME}}}} }}__toc__




=About Boot to Qt=
= About Boot to Qt =


Boot to Qt is a light-weight, Qt-optimized, full software stack for embedded Linux systems that is installed into the actual target device.
Boot to Qt is a light-weight, Qt-optimized, full software stack for embedded Linux systems that is installed into the actual target device.
Line 13: Line 13:
[[File:B2QTstack.png]]
[[File:B2QTstack.png]]


The full B2QT documentation is available at [http://doc.qt.io/QtForDeviceCreation Qt for Device Creation] official page.
The full B2Qt documentation is available at [http://doc.qt.io/QtForDeviceCreation Qt for Device Creation] official page.


=Requirements=
= Requirements =


You should be familiar with the Yocto tools and the concept of recipes. For more information, see Yocto Project [https://www.yoctoproject.org/documentation/current documentation].
You should be familiar with the Yocto tools and the concept of recipes. For more information, see Yocto Project [https://www.yoctoproject.org/documentation/current documentation].
Line 22: Line 22:


* Install the dependencies for the Yocto tools. In Ubuntu, the following packages are required:
* Install the dependencies for the Yocto tools. In Ubuntu, the following packages are required:
  sudo apt-get install gawk curl git-core diffstat unzip p7zip texinfo \
  $ sudo apt-get install gawk curl git-core diffstat unzip p7zip gcc-multilib \
  gcc-multilib build-essential chrpath libsdl1.2-dev xterm gperf bison \
  g++-multilib build-essential chrpath libsdl1.2-dev xterm gperf bison texinfo
g++-multilib


=Setting Up Yocto Build Environment=
$ which git-lfs > /dev/null || sudo apt-get install git-lfs || \
  (curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash &&
  sudo apt-get install git-lfs)


Run the setup script that initializes the Yocto environment. Using Variscite VAR-SOM-MX6 as an example:
= Setting Up Yocto Build Environment =


  mkdir ~/var-b2qt
{{#if: {{#var:MACHINE_NAME_ALT}} |
  cd ~/var-b2qt
{{note| The instructions in the following sections, apply for machine '''{{#var:MACHINE_NAME}}'''. If you have '''{{#var:MACHINE_DESC_ALT}}''' remind to use machine '''{{#var:MACHINE_NAME_ALT}}'''.}}
  git clone {{#var:B2QT_GIT}} -b {{#var:B2QT_BRANCH}}
| }}
  cd meta-variscite-boot2qt
 
  ./b2qt-init-build-env init --device {{#var:MACHINE_NAME}}
Run the setup script that initializes the Yocto environment.
 
  $ mkdir ~/var-b2qt
  $ cd ~/var-b2qt
  $ git clone {{#var:B2QT_GIT}} -b {{#var:B2QT_BRANCH}}
  $ cd meta-variscite-boot2qt
  $ ./b2qt-init-build-env init --device {{#var:MACHINE_NAME}}


b2qt-init-build-env has the following additional command line options:
b2qt-init-build-env has the following additional command line options:
Line 43: Line 50:
For all command line options, see:
For all command line options, see:


  ./b2qt-init-build-env help
  $ ./b2qt-init-build-env help


=Building the Image and Toolchain=
= Building the Image and Toolchain =


After the Yocto environment is set up, you need to configure the build environment for your target device:
After the Yocto environment is set up, you need to configure the build environment for your target device:


  MACHINE={{#var:MACHINE_NAME}} source ./setup-environment.sh
  $ MACHINE={{#var:MACHINE_NAME}} source ./setup-environment.sh


Yocto recipes for Boot to Qt for embedded Linux have two main targets to build: The target image, and the external toolchain that can be used with Qt Creator for building Qt applications.
Yocto recipes for Boot to Qt for embedded Linux have two main targets to build: The target image, and the external toolchain that can be used with Qt Creator for building Qt applications.


  MACHINE={{#var:MACHINE_NAME}} bitbake b2qt-embedded-qt5-image
  $ MACHINE={{#var:MACHINE_NAME}} bitbake b2qt-embedded-qt5-image
  MACHINE={{#var:MACHINE_NAME}} bitbake meta-toolchain-b2qt-embedded-qt5-sdk
  $ MACHINE={{#var:MACHINE_NAME}} bitbake meta-toolchain-b2qt-embedded-qt5-sdk


The target rootfs image is located in the
The target rootfs image is located at:


  ~/var-b2qt/meta-variscite-boot2qt/build-{{#var:MACHINE_NAME}}/tmp/deploy/images/{{#var:MACHINE_NAME}}/b2qt-embedded-qt5-image-{{#var:MACHINE_NAME}}.img
  ~/var-b2qt/meta-variscite-boot2qt/build-{{#var:MACHINE_NAME}}/tmp/deploy/images/{{#var:MACHINE_NAME}}/b2qt-embedded-qt5-image-{{#var:MACHINE_NAME}}.img


and the new toolchain is in
and the new toolchain installation file is:
  ~/var-b2qt/meta-variscite-boot2qt/build-{{#var:MACHINE_NAME}}/tmp/deploy/sdk/b2qt-x86_64-meta-toolchain-b2qt-embedded-qt5-sdk-{{#var:MACHINE_NAME}}.sh
  ~/var-b2qt/meta-variscite-boot2qt/build-{{#var:MACHINE_NAME}}/tmp/deploy/sdk/b2qt-x86_64-meta-toolchain-b2qt-embedded-qt5-sdk-{{#var:MACHINE_NAME}}.sh


=Flashing the SD card image=
= Flashing the SD card image =


Plug the SD card into your Linux HOST PC, run "dmesg|tail" and see which device is added (i.e. /dev/sdX or /dev/mmcblkX)
Plug the SD card into your Linux HOST PC, run "dmesg|tail" and see which device is added (i.e. /dev/sdX or /dev/mmcblkX)


  $ sudo umount /dev/sdX*
  $ sudo umount /dev/sdX*
$ sudo dd if=tmp/deploy/images/{{#var:MACHINE_NAME}}/b2qt-embedded-qt5-image-{{#var:MACHINE_NAME}}.img of=/dev/sdX bs=1M && sync
   
   
  Replace /dev/sdX with your actual device name, e.g. /dev/sdb
  $ sudo dd if=tmp/deploy/images/{{#var:MACHINE_NAME}}/b2qt-embedded-qt5-image-{{#var:MACHINE_NAME}}.{{#var:SDCARD_IMG_EXT}} of=/dev/sdX bs=1M && sync
 
Replace /dev/sdX with your actual device name, e.g. /dev/sdb


=Creating an extended SD card=
= Creating an extended SD card =


Variscite provides the var-create-yocto-sdcard.sh script which creates our NAND/eMMC recovery SD card. The script copies the NAND/eMMC flash burning scripts and relevant binaries for your convenience.<br>
Variscite provides the var-create-yocto-sdcard.sh script which creates our NAND/eMMC recovery SD card. The script copies the NAND/eMMC flash burning scripts and relevant binaries for your convenience.<br>
Later, you will be able to follow either the more automatic {{Varlink2|Yocto Recovery SD card|{{#var:YOCTO_RELEASE_LINK}}}} guide to burn your images to NAND flash or eMMC.<br><br>
Later, you will be able to follow {{Varlink2|Yocto Recovery SD card|{{#var:YOCTO_RELEASE_LINK}}}} guide to burn your images to NAND flash or eMMC.<br><br>


Plug the SD card into your Linux HOST PC, run "dmesg|tail" and see which device is added (i.e. /dev/sdX or /dev/mmcblkX)
Plug the SD card into your Linux HOST PC, run "dmesg|tail" and see which device is added (i.e. /dev/sdX or /dev/mmcblkX)


  $ cd ~/var-b2qt/meta-variscite-boot2qt
  $ cd ~/var-b2qt/meta-variscite-boot2qt
  $ sudo MACHINE={{#var:MACHINE_NAME}} sources/meta-variscite-fslc/scripts/var_mk_yocto_sdcard/var-create-yocto-sdcard.sh /dev/sdX
  $ sudo MACHINE={{#var:MACHINE_NAME}} sources/meta-variscite-{{#ifeq: {{#var:SOC_SERIES}} | imx8 |imx|fslc}}/scripts/var_mk_yocto_sdcard/var-create-yocto-sdcard.sh /dev/sdX
   
   
  Replace /dev/sdX with your actual device name, e.g. /dev/sdb
  Replace /dev/sdX with your actual device name, e.g. /dev/sdb
== Create an extended SD card image using a loop device ==
It is also possible to use the var-create-yocto-sdcard.sh script to create an extended SD card image, while using a loop device instead of attaching a real SD card.<br>
<br>
$ cd ~/var-b2qt/meta-variscite-boot2qt
Create an empty file using the following command:
$ dd if=/dev/zero of={{#var:MACHINE_NAME}}-extended-sd.img bs=1M count=3700
The above command creates a 3700MiB file representing the SD card.<br>
<br>
Attach the first available loop device to this file:
$ sudo losetup -Pf {{#var:MACHINE_NAME}}-extended-sd.img
To find the actual loop device being used, run:
$ losetup -a | grep {{#var:MACHINE_NAME}}-extended-sd.img
Write the content to the loop device to generate the SD card image:
$ sudo MACHINE={{#var:MACHINE_NAME}} sources/meta-variscite-{{#ifeq: {{#var:SOC_SERIES}} | imx8 |imx|fslc}}/scripts/var_mk_yocto_sdcard/var-create-yocto-sdcard.sh <options> /dev/loopX
(Replace /dev/loopX with your actual loop device, e.g. /dev/loop0)<br>
<br>
Detach the loop device from the file:
$ sudo losetup -d /dev/loopX
To compress the SD card image file use the following command:
$ gzip -9 {{#var:MACHINE_NAME}}-extended-sd.img
To write the SD card image to a real SD card device use the following command:
$ zcat {{#var:MACHINE_NAME}}-extended-sd.img.gz | sudo dd of=/dev/sdX bs=1M && sync
(Replace /dev/sdX with your actual SD device, e.g. /dev/sdb)

Revision as of 00:29, 1 August 2020

- Boot to Qt based on Yocto


About Boot to Qt

Boot to Qt is a light-weight, Qt-optimized, full software stack for embedded Linux systems that is installed into the actual target device.

The stack can be customized to production with Build-Your-Own-Stack tooling, including proprietary Yocto Project recipes.

B2QTstack.png

The full B2Qt documentation is available at Qt for Device Creation official page.

Requirements

You should be familiar with the Yocto tools and the concept of recipes. For more information, see Yocto Project documentation.

To get started, you need the following:

  • Install the dependencies for the Yocto tools. In Ubuntu, the following packages are required:
$ sudo apt-get install gawk curl git-core diffstat unzip p7zip gcc-multilib \
g++-multilib build-essential chrpath libsdl1.2-dev xterm gperf bison texinfo
$ which git-lfs > /dev/null || sudo apt-get install git-lfs || \
  (curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash &&
  sudo apt-get install git-lfs)

Setting Up Yocto Build Environment

Run the setup script that initializes the Yocto environment.

$ mkdir ~/var-b2qt
$ cd ~/var-b2qt
$ git clone  -b 
$ cd meta-variscite-boot2qt
$ ./b2qt-init-build-env init --device 

b2qt-init-build-env has the following additional command line options:

  • list-devices: show all supported devices that can be used for a Boot to Qt build
  • mirror: create a local mirror of the yocto repositories. This enables you to use the same repository downloads for multiple build environments, when initializing with init --reference <mirror path>.

For all command line options, see:

$ ./b2qt-init-build-env help

Building the Image and Toolchain

After the Yocto environment is set up, you need to configure the build environment for your target device:

$ MACHINE= source ./setup-environment.sh

Yocto recipes for Boot to Qt for embedded Linux have two main targets to build: The target image, and the external toolchain that can be used with Qt Creator for building Qt applications.

$ MACHINE= bitbake b2qt-embedded-qt5-image
$ MACHINE= bitbake meta-toolchain-b2qt-embedded-qt5-sdk

The target rootfs image is located at:

~/var-b2qt/meta-variscite-boot2qt/build-/tmp/deploy/images//b2qt-embedded-qt5-image-.img

and the new toolchain installation file is:

~/var-b2qt/meta-variscite-boot2qt/build-/tmp/deploy/sdk/b2qt-x86_64-meta-toolchain-b2qt-embedded-qt5-sdk-.sh

Flashing the SD card image

Plug the SD card into your Linux HOST PC, run "dmesg|tail" and see which device is added (i.e. /dev/sdX or /dev/mmcblkX)

$ sudo umount /dev/sdX*

$ sudo dd if=tmp/deploy/images//b2qt-embedded-qt5-image-. of=/dev/sdX bs=1M && sync

Replace /dev/sdX with your actual device name, e.g. /dev/sdb

Creating an extended SD card

Variscite provides the var-create-yocto-sdcard.sh script which creates our NAND/eMMC recovery SD card. The script copies the NAND/eMMC flash burning scripts and relevant binaries for your convenience.
Later, you will be able to follow Yocto Recovery SD card guide to burn your images to NAND flash or eMMC.

Plug the SD card into your Linux HOST PC, run "dmesg|tail" and see which device is added (i.e. /dev/sdX or /dev/mmcblkX)

$ cd ~/var-b2qt/meta-variscite-boot2qt
$ sudo MACHINE= sources/meta-variscite-fslc/scripts/var_mk_yocto_sdcard/var-create-yocto-sdcard.sh /dev/sdX

Replace /dev/sdX with your actual device name, e.g. /dev/sdb

Create an extended SD card image using a loop device

It is also possible to use the var-create-yocto-sdcard.sh script to create an extended SD card image, while using a loop device instead of attaching a real SD card.

$ cd ~/var-b2qt/meta-variscite-boot2qt

Create an empty file using the following command:

$ dd if=/dev/zero of=-extended-sd.img bs=1M count=3700

The above command creates a 3700MiB file representing the SD card.

Attach the first available loop device to this file:

$ sudo losetup -Pf -extended-sd.img

To find the actual loop device being used, run:

$ losetup -a | grep -extended-sd.img

Write the content to the loop device to generate the SD card image:

$ sudo MACHINE= sources/meta-variscite-fslc/scripts/var_mk_yocto_sdcard/var-create-yocto-sdcard.sh <options> /dev/loopX

(Replace /dev/loopX with your actual loop device, e.g. /dev/loop0)

Detach the loop device from the file:

$ sudo losetup -d /dev/loopX

To compress the SD card image file use the following command:

$ gzip -9 -extended-sd.img

To write the SD card image to a real SD card device use the following command:

$ zcat -extended-sd.img.gz | sudo dd of=/dev/sdX bs=1M && sync

(Replace /dev/sdX with your actual SD device, e.g. /dev/sdb)