Personal tools

1-1-1-1-2-1-3

From ICOP tech wiki

Revision as of 08:32, 6 March 2020 by Viky6 (talk | contribs) (Created page with " <div class="portlet" id="p-tb" role="navigation" > <h3>Tools</h3> <div class="pBody"> <ul>...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

<a id="top"></a>

Yocto Build Release

From Variscite Wiki

Jump to: <a href="#column-one">navigation</a>, <a href="#searchInput">search</a>


DART-MX8M-MINI - Yocto Sumo 2.5 based on FSL Community BSP with L4.14.98-2.0.0_ga Linux release


Contents

  • <a href="#Installing_required_packages">1 Installing required packages</a>
  • <a href="#Reference_documentation">2 Reference documentation</a>
  • <a href="#Download_Yocto_Sumo_based_on_Freescale_Community_BSP">3 Download Yocto Sumo based on Freescale Community BSP</a>
  • <a href="#Setup_and_build_Yocto">4 Setup and build Yocto</a>
    • <a href="#Supported_images">4.1 Supported images</a>
    • <a href="#Supported_distros">4.2 Supported distros</a>
    • <a href="#Build_XWayland_GUI_demo_image">4.3 Build XWayland GUI demo image</a>
    • <a href="#local.conf_customization">4.4 local.conf customization</a>
      • <a href="#Change_the_downloads_directory">4.4.1 Change the downloads directory</a>
      • <a href="#Add_Eclipse_debug_and_Qt_creator_support_to_your_images">4.4.2 Add Eclipse debug and Qt creator support to your images</a>
      • <a href="#Create_a_read-only_root_file_system">4.4.3 Create a read-only root file system</a>
    • <a href="#Build_Results">4.5 Build Results</a>
  • <a href="#Create_a_bootable_SD_card">5 Create a bootable SD card</a>
    • <a href="#SD_card_structure">5.1 SD card structure</a>
    • <a href="#Yocto_pre-built_bootable_SD_card">5.2 Yocto pre-built bootable SD card</a>
    • <a href="#Create_an_extended_SD_card">5.3 Create an extended SD card</a>
  • <a href="#Boot_the_board_with_a_bootable_SD_card">6 Boot the board with a bootable SD card</a>
    • <a href="#Setting_the_Boot_Mode">6.1 Setting the Boot Mode</a>
  • <a href="#Flash_images_to_NAND.2FeMMC">7 Flash images to NAND/eMMC</a>
  • <a href="#Yocto_Image_Customization">8 Yocto Image Customization</a>
    • <a href="#Update_Yocto_Sumo_to_latest_revision">8.1 Update Yocto Sumo to latest revision</a>
    • <a href="#Update_Yocto_Sumo_to_a_Release_Tag">8.2 Update Yocto Sumo to a Release Tag</a>
    • <a href="#Forcing_Clean_Build">8.3 Forcing Clean Build</a>
  • <a href="#Make_changes_to_the_rootfs">9 Make changes to the rootfs</a>
    • <a href="#Example">9.1 Example</a>
  • <a href="#Useful_Bitbake_commands">10 Useful Bitbake commands</a>

1 Installing required packages

Please make sure your host PC is running Ubuntu 16.04 64-bit and install the following packages:

$ sudo apt-get install gawk wget git diffstat unzip texinfo gcc-multilib \
build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \
xz-utils debianutils iputils-ping libsdl1.2-dev xterm

$ sudo apt-get install autoconf libtool libglib2.0-dev libarchive-dev python-git \
sed cvs subversion coreutils texi2html docbook-utils python-pysqlite2 \
help2man make gcc g++ desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev \
mercurial automake groff curl lzop asciidoc u-boot-tools dos2unix mtd-utils pv \
libncurses5 libncurses5-dev libncursesw5-dev libelf-dev zlib1g-dev

2 Reference documentation

  • Yocto Project Core - Sumo 2.5

Documentation is available from <a rel="nofollow" class="external text" href="https://www.yoctoproject.org/docs/2.5/ref-manual/ref-manual.html">www.yoctoproject.org</a>


3 Download Yocto Sumo based on Freescale Community BSP

$ git config --global user.name "Your Name"
$ git config --global user.email "Your Email"

$ mkdir ~/bin (this step may not be needed if the bin folder already exists)
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ export PATH=~/bin:$PATH
$ mkdir ~/var-fsl-yocto
$ cd ~/var-fsl-yocto

Now, choose between downloading a release tag, and downloading the latest revision (recommended) and follow only one of the next two bullet sections, accordingly:

  • Download a release tag

Each release in <a rel="nofollow" class="external free" href="https://github.com/varigit/variscite-bsp-platform/releases">https://github.com/varigit/variscite-bsp-platform/releases</a> corresponds to a tag.
The tags are also listed in <a rel="nofollow" class="external free" href="https://github.com/varigit/variscite-bsp-platform/tags">https://github.com/varigit/variscite-bsp-platform/tags</a>
To specify a specific release/tag, run the following:

$ repo init -u <a rel="nofollow" class="external free" href="https://github.com/varigit/variscite-bsp-platform.git">https://github.com/varigit/variscite-bsp-platform.git</a> -b refs/tags/TAG_NAME

For example:
$ repo init -u <a rel="nofollow" class="external free" href="https://github.com/varigit/variscite-bsp-platform.git">https://github.com/varigit/variscite-bsp-platform.git</a> -b refs/tags/sumo-fsl-4.14.98-mx8mm-v2.2 -m imx-4.14.98-2.0.1_patch-var01.xml
$ repo sync -j4


or

  • Download the latest revision (recommended)
$ repo init -u <a rel="nofollow" class="external free" href="https://github.com/varigit/variscite-bsp-platform.git">https://github.com/varigit/variscite-bsp-platform.git</a> -b fsl-sumo -m imx-4.14.98-2.0.1_patch-var01.xml
$ repo sync -j4

4 Setup and build Yocto

4.1 Supported images

The following images are provided by Variscite for evaluation purpose

  • fsl-image-gui: Default Variscite demo image with GUI and without any Qt5 content. This image recipe works for Xwayland and Wayland backends.
  • fsl-image-qt5: Extends fsl-image-gui image with Qt5 support and various Qt samples for Xwayland and Wayland backends.


See the list of Yocto Project’s reference images in <a rel="nofollow" class="external text" href="http://www.yoctoproject.org/docs/current/ref-manual/ref-manual.html#ref-images">Yocto Project Reference Manual</a>

4.2 Supported distros

The following distros can be used:

  • fsl-imx-wayland: Distro for Wayland without X11. This distro includes wayland feature but doesn’t have X11 support.
  • fsl-imx-xwayland: Distro for Wayland with X11. This distro includes both wayland and X11 features.

Note: Also <a rel="nofollow" class="external text" href="http://www.informit.com/articles/article.aspx?p=2514911&seqNum=4">standard Poky distros</a> can be used


4.3 Build XWayland GUI demo image

$ cd ~/var-fsl-yocto
$ MACHINE=imx8mm-var-dart DISTRO=fsl-imx-xwayland . var-setup-release.sh -b build_xwayland


Optional steps: <a href="#local.conf_customization">local.conf customization</a>

launch bitbake:

Without Qt content:
$ bitbake fsl-image-gui

Or with Qt content:
$ bitbake fsl-image-qt5


4.4 local.conf customization

4.4.1 Change the downloads directory

Create a /opt/yocto_downloads directory and set its permissions:

$ sudo mkdir /opt/yocto_downloads
$ sudo chmod 777 /opt/yocto_downloads/

Direct downloads to it, by replacing 'DL_DIR ?= "${BSPDIR}/downloads/"' with 'DL_DIR = "/opt/yocto_downloads/"' in conf/local.conf under your build directory:

$ sed -i 's/DL_DIR ?= "${BSPDIR}\/downloads/DL_DIR = "\/opt\/yocto_downloads/g' conf/local.conf

4.4.2 Add Eclipse debug and Qt creator support to your images

Append the following to the conf/local.conf file in your Yocto build directory, to add Eclipse debug and Qt creator support to your images:

EXTRA_IMAGE_FEATURES = " \
    debug-tweaks \
    tools-debug \
    eclipse-debug \
    "

IMAGE_INSTALL_append = " \
    tcf-agent \
    openssh-sftp-server \
    "


4.4.3 Create a read-only root file system

Append the following to the conf/local.conf file in your Yocto build directory, to create a read-only rootfs:

EXTRA_IMAGE_FEATURES += "read-only-rootfs"

4.5 Build Results

The resulted images are located in tmp/deploy/images/imx8mm-var-dart.


Image Name
How to use
fsl-image-gui-imx8mm-var-dart.sdcard.gz This image is for SD card boot.
It can be flashed as-is on an SD card that can then be used to boot your system,
according to the relevant startup-guide of your product
(usually requires to press the boot select button, or toggle a DIP switch).
For detailed information refer to the <a href="/index.php?title=Yocto_Build_Release#Create_a_bootable_SD_card" title="Yocto Build Release"> Create a bootable SD card</a> section below.
fsl-image-gui-imx8mm-var-dart.tar.gz Tarball with rootfs files.
Can be used to create an NFS root file system on the host.
See the <a rel="nofollow" class="external text" href="http://variwiki.com/index.php?title=Yocto_Setup_TFTP/NFS&release=RELEASE_SUMO_V2.2_DART-MX8M-MINI">Yocto Setup TFTP/NFS</a> section for more info.
Also used to create our extended SD card.
See the <a href="/index.php?title=Yocto_Build_Release#Create_a_bootable_SD_card" title="Yocto Build Release"> Create a bootable SD card</a> section below.
Image.gz Linux kernel image, same binary for SD card and eMMC.
imx-boot-sd.bin U-Boot built for SD card boot or eMMC boot.
File Name
Description
Image.gz-imx8mm-var-dart.dtb Device tree blob for SD, eMMC, WIFI and LVDS display configuration.


5 Create a bootable SD card

5.1 SD card structure

This is the structure of our Recovery/Extended SD card:
<a href="/index.php?title=File:SD_card_part_mx8m.png" class="image"><img alt="SD card part mx8m.png" src="/images/1/17/SD_card_part_mx8m.png" width="633" height="315" /></a>


The SD card is divided into 2 sections as shown in the picture above:

Note:
The last unallocated area is not used. It is there so that the rootfs will fit on any 4GB SD card, as not all 4GB SD cards are really the same size. If you want, you can use a program such as GParted to resize the roofs partition and make it end at the end of your specific SD card (of course, you can also use SD cards with much bigger capacity than 4GB, and then it makes more sense to resize the partition).
Also, if you create the extended SD card yourself by following the <a href="#Create_an_extended_SD_card"> Create an extended SD card</a> section below, and you use the '-a' option, the rootfs partition will end at the end of your specific SD card automatically.

5.2 Yocto pre-built bootable SD card

The Yocto build products contains many files as explained in the <a href="#Build_Results"> Build Results section</a>. For example, fsl-image-gui-imx8mm-var-dart., depending on your build. This is a complete image to be flashed directly to an SD card.

Example usage:


$ sudo umount /dev/sdX*
# For GUI-XWAYLAND & Qt5-XWAYLAND
$ cd ~/var-fsl-yocto/build_xwayland
Or
# For GUI-WAYLAND & Qt5-WAYLAND
$ cd ~/var-fsl-yocto/build_wayland

# For fsl-image-gui image (GUI-XWAYLAND & GUI-WAYLAND)
$ zcat tmp/deploy/images/imx8mm-var-dart/fsl-image-gui-imx8mm-var-dart.sdcard.gz | sudo dd of=/dev/sdX bs=1M conv=fsync
Or
# For fsl-image-qt5 image (Qt5-XWAYLAND & Qt5-WAYLAND)
$ zcat tmp/deploy/images/imx8mm-var-dart/fsl-image-qt5-imx8mm-var-dart.sdcard.gz | sudo dd of=/dev/sdX bs=1M conv=fsync
Replace sdX with the right device name. This can be obtained by "dmesg" command on your host Linux PC, after the SD card reader is inserted.
  • Note: Booting your system from an SD card requires pressing the boot-select button, or switching the relevant DIP switch to "Boot from SD card", according to the relevant start-up guide of your system


Drawbacks of the native . yocto-built image, (relative to the Recovery/Extended SD card):

  • The rootfs partition doesn't use the entire SD card.
  • The rootfs partition is not labeled as rootfs.
  • The NAND flash and eMMC installation scripts and images are not included.

5.3 Create an extended SD card

Variscite provides the var-create-yocto-sdcard.sh script which creates our NAND/eMMC recovery SD card - an SD card based on the fsl-image-gui filesystem, which copies the NAND flash burning scripts and relevant binaries for your convenience.
Later, you will be able to follow either the more automatic <a rel="nofollow" class="external text" href="http://variwiki.com/index.php?title=Yocto_Recovery_SD_card&release=RELEASE_SUMO_V2.2_DART-MX8M-MINI">Yocto Recovery SD card</a> guide or the more manual <a href="/index.php?title=VAR-SOM-MX6_NAND_Flash_Burning" title="VAR-SOM-MX6 NAND Flash Burning"> VAR-SOM-MX6 NAND flash burning</a> guide to burn your images to NAND flash or eMMC.

Note:

This is essentially the same as our pre-built Recovery SD image, with the following main differences:

  • The pre-built image's rootfs partition size is 3700MiB, which is also the default size when using the script, but the script also has an option to set the rootfs partition size to fill the whole free space of the used SD card. Anyway, you can always resize the partition later with an external tool such as gparted.

Naturally, the pre-built image is more straight forward and easier to use, while the script method is easier to customize.

Usage:

  • Follow the <a href="#Setup_and_build_Yocto">Setup and build Yocto</a> guide, and bitbake fsl-image-gui.
  • Plug-in the SD card to your Linux HOST PC, run dmesg and see which device is added (i.e. /dev/sdX or /dev/mmcblkX)


$ cd ~/var-fsl-yocto
$ sudo MACHINE=imx8mm-var-dart sources/meta-variscite-imx/scripts/var_mk_yocto_sdcard/var-create-yocto-sdcard.sh <options> /dev/sdX
(Replace /dev/sdX with your actual device)
options:
 -h            Display help message
 -s            Only show partition sizes to be written, without actually write them
 -a            Automatically set the rootfs partition size to fill the SD card
 -r            Select alternative rootfs for recovery images (default: /tmp/deploy/images/imx8mm-var-dart/fsl-image-gui-imx8mm-var-dart.*)
If you don't use the '-a' option, a default rootfs size of 3700MiB will be used
The '-r' option allows you to create a bootable SD card with an alternative image for the installation to NAND flash or eMMC.
Example: "-r tmp/deploy/images/imx8mm-var-dart/fsl-image-qt5-imx8mm-var-dart" -- selected the "Qt5 image with X11" recovery image

6 Boot the board with a bootable SD card

6.1 Setting the Boot Mode

Make sure the BOOT SELECT DIP switch on the carrier board is set correctly before you power on the board.

SW7
 0 : Boot from SD card
 1 : Boot from eMMC



7 Flash images to NAND/eMMC

Please refer to <a rel="nofollow" class="external text" href="http://variwiki.com/index.php?title=Yocto_NAND_Flash_Burning&release=RELEASE_SUMO_V2.2_DART-MX8M-MINI">Yocto NAND Flash Burning</a> guide.

8 Yocto Image Customization

8.1 Update Yocto Sumo to latest revision

From time to time we update the Yocto sources (especially meta-variscite) with new features and bug fixes.
Follow the Download the latest revision (recommended) bullet section of the <a href="#Download_Yocto_Sumo_based_on_Freescale_Community_BSP">Download Yocto Sumo based on Freescale Community BSP</a> step again to update your tree to the latest revision, and rebuild your image.

8.2 Update Yocto Sumo to a Release Tag

Follow the Download a release tag bullet section of the <a href="#Download_Yocto_Sumo_based_on_Freescale_Community_BSP">Download Yocto Sumo based on Freescale Community BSP</a> step to update your tree to a release tag, and rebuild your image.

8.3 Forcing Clean Build

In order to update the kernel, U-Boot and rootfs:
$ bitbake -c cleanall u-boot-variscite linux-variscite kernel-module-imx-gpu-viv ti-compat-wireless-wl18xx wl18xx-firmware cryptodev-module

for GUI image
$ bitbake -c clean fsl-image-gui
for Qt5 image
$ bitbake -c clean fsl-image-qt5



9 Make changes to the rootfs

The following is usually not the recommended way to work with Yocto.
You should usually create new specific recipes (.bb files) and/or append to specific present recipes by using .bbappend files.
However, if you are not yet experienced enough with Yocto, and you just want to quickly add your files to the resultant file system (or make any other change to it), you can do it in a general way, by using the following variable:

ROOTFS_POSTPROCESS_COMMAND

    Specifies a list of functions to call once the OpenEmbedded build system has created the root filesystem.
    You can specify functions separated by semicolons:

         ROOTFS_POSTPROCESS_COMMAND += "function; ... "                  

    If you need to pass the root filesystem path to a command within a function, you can use ${IMAGE_ROOTFS},
    which points to the directory that becomes the root filesystem image. See the IMAGE_ROOTFS variable for more information. 

The functions will be called right after the root filesystem is created and right before it is packed to images (., .ubi, .tar.gz, etc.).

9.1 Example

Let's say you have your files that you want to put in the filesystem arranged on your host under a directory called /my_rootfs_additions, like the following:

my_rootfs_additions/
├── data
│   ├── example.m4v
│   └── example.bin
├── etc
│   └── example.conf
└── home
    └── root
        └── .example

And let's say you want to build the fsl-image-gui image.

Create a file called ~/var-fsl-yocto/sources/meta-variscite-fslc/recipes-images/images/fsl-image-gui.bbappend
with the following content:

add_my_files() {
    cp -r /my_rootfs_additions/*  ${IMAGE_ROOTFS}/
}

ROOTFS_POSTPROCESS_COMMAND += "add_my_files;"

Now, when you bitbake fsl-image-gui, the files in /my_rootfs_additions will be added to the rootfs (be careful when overwriting files).

10 Useful Bitbake commands

<a rel="nofollow" class="external text" href="http://elinux.org/Bitbake_Cheat_Sheet">Bitbake Cheat Sheet</a>

<a rel="nofollow" class="external text" href="https://community.freescale.com/docs/DOC-94953">Useful bitbake commands</a>

<a rel="nofollow" class="external text" href="https://community.freescale.com/docs/DOC-94874">i.MX Yocto Project: ltib versus bitbake</a>