Template:YOCTO ENV SETUP X SHORT FF: Difference between revisions

From Variscite Wiki
No edit summary
No edit summary
 
(26 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Create a bootable SD card =
<includeonly>{{#vardefine:GITHUB_WARNING|{{#ifexpr: {{#var:YOCTO_VERSION}} < 2.3 |{{Note|'''Warning:''' Due to a GitHub policy change, it is necessary to add HTTPS mirrors to local.conf for Yocto Morty and older. Please refer to [[:Yocto_Common_Errors#GitHub Git protocol on port 9418|Yocto Common Errors]].}}}}}}<!--
{{#ifexpr:{{#varexists:DEBIAN_NAME}} | {{#vardefine:OS_TYPE|Debian}} | {{#vardefine:OS_TYPE|yocto}} }}
--> {{PageHeader|{{#var:HARDWARE_NAME}} - Yocto {{#var:YOCTO_NAME}} {{#var:YOCTO_VERSION}} based on {{#varexists:FSLC_BSP_VERSION|FSL Community BSP {{#var:FSLC_BSP_VERSION}}|NXP BSP {{#var:FSL_BSP_VERSION}}}} with {{#var:FSL_BSP_VERSION}} Linux release}} {{DocImage|category1=Yocto|category2={{#var:HARDWARE_NAME}}}} __toc__
{{#vardefine:SHELL_PROMPT|{{#if:{{#var:BUILD_YOCTO_IN_DOCKER_CONTAINER}}|vari@474da3a440cf:/workdir/{{#var:BUILD_FOLDER_ENV}}$|$}}}}
 
== SD Card Structure ==
<!-- Set local variables
{{#switch: {{#var:SOC_SERIES}} | imx8 | imx9=
--> {{#varexists: META_VARISCITE_SDK |
This is the structure of our default SD card programmed from Yocto images:<br>
Disk /dev/sdX: 59.48 GiB, 63864569856 bytes, 124735488 sectors                                                                                             
Disk model: MassStorageClass                                                                                                                               
Units: sectors of 1 * 512 = 512 bytes                                                                                                                     
Sector size (logical/physical): 512 bytes / 512 bytes                                                                                                     
I/O size (minimum/optimal): 512 bytes / 512 bytes                                                                                                         
Disklabel type: dos                                                                                                                                       
Disk identifier: 0x5ebf1617                                                                                                                               
                                                                                                                                                         
Device    Boot Start      End  Sectors  Size Id Type                                                                                                     
/dev/sdX1      16384 15165439 15149056  7.2G 83 Linux
<br>
* At the beginning of the card is 8 MiB of reserved area for the partition table and bootloader.
* The first and only SD card partition begins at offset 16,384 (of 512 byte sectors) which is due to the reserved area explained above. This partition is an ext4 partition that contains the complete root filesystem (including kernel image and device tree files under /boot).<br>
|
|
This is the structure of our Recovery/Extended SD card:<br>
{{#vardefine:META_VARISCITE_SDK | {{#var:META_VARISCITE_REPO}}}}
[[File:SD_card_part_v50.png|SD card partitions]]<br><br>
}}<!--
-->{{#vardefine:UBUNTU_COMPAT|16.04}}<!--
-->{{#vardefine:UBUNTU_COMPAT|{{#ifeq:{{#var:YOCTO_NAME}}|Morty|14.04/16.04|{{#var:UBUNTU_COMPAT}}}}}}<!--
-->{{#vardefine:UBUNTU_COMPAT|{{#ifeq:{{#var:YOCTO_NAME}}|Zeus|18.04|{{#var:UBUNTU_COMPAT}}}}}}<!--
-->{{#vardefine:UBUNTU_COMPAT|{{#ifexpr: {{#var:YOCTO_VERSION}} >= 3.1|18.04/20.04|{{#var:UBUNTU_COMPAT}}}}}}<!--
-->{{#vardefine:UBUNTU_COMPAT|{{#ifexpr: {{#var:YOCTO_VERSION}} >= 4.0|18.04/20.04/22.04|{{#var:UBUNTU_COMPAT}}}}}}<!--
-->{{#vardefine:UBUNTU_COMPAT|{{#ifexpr: {{#var:YOCTO_VERSION}} >= 4.2|20.04/22.04|{{#var:UBUNTU_COMPAT}}}}}}
 
= Installing required packages =
Please make sure your host PC is running Ubuntu {{#var:UBUNTU_COMPAT}} 64-bit and is up to date:
  $ sudo apt-get update && sudo apt-get dist-upgrade
 
Then, install the following packages:
 
  {{#if:{{#var:BUILD_YOCTO_IN_DOCKER_CONTAINER}}|
  $ sudo apt-get install python3 python3-pip python3-pexpect \
  python3-git python3-jinja2 python3-subunit python3-git liblz4-tool \
  python3-jinja2 python3-subunit curl zstd
 
For Ubuntu 20.04 and earlier, install python2:
$ sudo apt-get install python python-pysqlite2


{{#ifexpr:{{#rpos:{{#var:UBUNTU_COMPAT}}|16.04}} >= 0|{{Ubuntu16_Python}}|}}<!--
-->{{#ifexpr:{{#rpos:{{#var:UBUNTU_COMPAT}}|22.04}} >= 0|{{Ubuntu22_Python}}|}}


The SD card is divided into 3 sections as shown in the picture above:<br>
Install Docker:
* The first unallocated 4MiB are saved space for U-Boot. It can be replaced using the dd command as described in the {{Varlink2|Yocto Build U-Boot|{{#var:RELEASE_LINK}}}} section.<br>
* The first partition is a fat16 partition used for the device tree files and the kernel image file. You can copy them as described in the {{Varlink2|Yocto Build Linux|{{#var:RELEASE_LINK}}}} section.<br>
* The second partition is an ext4 partition that contains the complete root filesystem (including the kernel modules).<br><br>
}}
<br>
{{Note|'''Note:''' This partition includes an unallocated area to ensure compatibility with all 8 GB SD cards, as their actual sizes may vary. For instructions on optimizing the usage of your SD card's capacity, refer to the section [[#Extending the SD Card Size|Extending the SD Card Size]].}}


==Yocto pre-built bootable SD card==
$ sudo apt update && sudo apt install docker.io qemu-user-static


The Yocto build products contains many files as explained in the [[#Build_Results | Build Results section]]. For example, {{#var:DEFAULT_IMAGE_BB_NAME|fsl-image-gui}}-{{#var:MACHINE_NAME}}.{{#var:SDCARD_IMG_EXT}}, depending on your build. This is a complete and bootable image ready to be flashed directly to an SD card.<br>
Give permissions to run Docker without sudo:


Example usage:
  $ sudo usermod -aG docker ${USER}
{{#switch: {{#var:SOC_SERIES}} | imx8 | imx9=
  {{#ifexpr:{{#varexists:DEBIAN_NAME|0|1}}| <!-- if not Debian -->
<br>
$ sudo umount /dev/sdX*


# For GUI-XWAYLAND & Qt{{#var:QT_VER}}-XWAYLAND
{{Note|'''Note:''' Logout and login again for permissions to take effect.}}
$ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_XWAYLAND}}
Or
# For GUI-WAYLAND & Qt{{#var:QT_VER}}-WAYLAND
$ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_WAYLAND}}
# For fsl-image-gui image (GUI-XWAYLAND & GUI-WAYLAND)
$ {{#var:UNZIP}} tmp/deploy/images/{{#var:MACHINE_NAME}}/fsl-image-gui-{{#var:MACHINE_NAME}}.{{#var:SDCARD_IMG_EXT|sdcard.gz}} <nowiki>|</nowiki> sudo dd of=/dev/sdX bs=1M conv=fsync
{{#if:{{#var:YOCTO_SUPPORT_CHROMIUM}}|
Or
# For fsl-image-gui-chromium image (GUI-XWAYLAND & GUI-WAYLAND)
$ {{#var:UNZIP}} tmp/deploy/images/{{#var:MACHINE_NAME}}/fsl-image-gui-chromium-{{#var:MACHINE_NAME}}.{{#var:SDCARD_IMG_EXT|sdcard.gz}} <nowiki>|</nowiki> sudo dd of=/dev/sdX bs=1M conv=fsync
|}}
Or
# For fsl-image-qt{{#var:QT_VER}} image (Qt{{#var:QT_VER}}-XWAYLAND & Qt{{#var:QT_VER}}-WAYLAND)
$ {{#var:UNZIP}} tmp/deploy/images/{{#var:MACHINE_NAME}}/fsl-image-qt{{#var:QT_VER}}-{{#var:MACHINE_NAME}}.{{#var:SDCARD_IMG_EXT|sdcard.gz}} <nowiki>|</nowiki> sudo dd of=/dev/sdX bs=1M conv=fsync
|
<br>
$ sudo umount /dev/sdX*
$ cd {{#var:BUILD_FOLDER}}/build_debian_xwayland
$ {{#var:UNZIP}} tmp/deploy/images/{{#var:MACHINE_NAME}}/var-image-debian-{{#var:MACHINE_NAME}}.{{#var:SDCARD_IMG_EXT|sdcard.gz}} <nowiki>|</nowiki> sudo dd of=/dev/sdX bs=1M conv=fsync
}}  
|
|
<br>
$ sudo umount /dev/sdX*


# For GUI-X11 & Qt{{#var:QT_VER}}-X11
  $ sudo apt-get install gawk wget git diffstat unzip texinfo gcc-multilib \
$ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_X11}}
  build-essential chrpath socat cpio python3 python3-pip python3-pexpect \
Or
  xz-utils debianutils iputils-ping libsdl1.2-dev xterm libyaml-dev libssl-dev
# For Qt{{#var:QT_VER}}-FB
 
$ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_FB}}
  $ sudo apt-get install autoconf libtool libglib2.0-dev libarchive-dev \
  sed cvs subversion coreutils texi2html docbook-utils \
# For fsl-image-gui image (GUI-X11)
  help2man make gcc g++ desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev \
{{#ifeq: {{#var:SDCARD_IMG_EXT}} | wic.gz |
  mercurial automake groff curl lzop asciidoc u-boot-tools dos2unix mtd-utils pv \
$ {{#var:UNZIP}} tmp/deploy/images/{{#var:MACHINE_NAME}}/fsl-image-gui-{{#var:MACHINE_NAME}}.{{#var:SDCARD_IMG_EXT}} <nowiki>|</nowiki> sudo dd of=/dev/sdX bs=1M && sync
  libncurses5 libncurses5-dev libncursesw5-dev libelf-dev zlib1g-dev bc rename \
|
  zstd libgnutls28-dev
$ sudo dd if=tmp/deploy/images/{{#var:MACHINE_NAME}}/fsl-image-gui-{{#var:MACHINE_NAME}}.{{#var:SDCARD_IMG_EXT}} of=/dev/sdX bs=1M && sync
 
  }}
  {{#ifexpr: {{#var:YOCTO_VERSION}} >= 3.1|
Or
  $ sudo apt-get install python3-git liblz4-tool python3-jinja2 python3-subunit locales libacl1
# For fsl-image-qt{{#var:QT_VER}} image (Qt{{#var:QT_VER}}-X11 & Qt{{#var:QT_VER}}-FB)
  |
{{#ifeq: {{#var:SDCARD_IMG_EXT}} | wic.gz |
  $ sudo apt-get install python-git
$ {{#var:UNZIP}} tmp/deploy/images/{{#var:MACHINE_NAME}}/fsl-image-qt{{#var:QT_VER}}-{{#var:MACHINE_NAME}}.{{#var:SDCARD_IMG_EXT}} <nowiki>|</nowiki> sudo dd of=/dev/sdX bs=1M && sync
  }}
|
 
$ sudo dd if=tmp/deploy/images/{{#var:MACHINE_NAME}}/fsl-image-qt{{#var:QT_VER}}-{{#var:MACHINE_NAME}}.{{#var:SDCARD_IMG_EXT}} of=/dev/sdX bs=1M && sync
For Ubuntu 20.04 and earlier, install python2:
}}
  $ sudo apt-get install python python-pysqlite2
 
{{#ifexpr:{{#rpos:{{#var:UBUNTU_COMPAT}}|16.04}} >= 0|{{Ubuntu16_Python}}|}}<!--
-->{{#ifexpr:{{#rpos:{{#var:UBUNTU_COMPAT}}|22.04}} >= 0|{{Ubuntu22_Python}}|}}
 
{{Note|'''Note:''' Variscite provides Docker containers that can be used for a development environment as an alternative to using a virtual machine or a dedicated computer.
To learn more, please see Variscite's [[Docker_Build_Environment | Docker Build Environment]] guide.}}
}}
}}


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.
= Reference documentation =
  {{#lst:Yocto_Platform_Customization|YOCTO_DOC_{{#var:YOCTO_VERSION}}}} <!--
-->{{#if:{{#var:FSLC_BSP_VERSION}}|{{#lst:Yocto_Platform_Customization|YOCTO_DOC_FSLC_BSP_{{#var:FSLC_BSP_VERSION}}}}|}} <!--
-->{{#lst:Yocto_Platform_Customization|YOCTO_DOC_FSL_BSP_{{#var:FSL_BSP_VERSION}}}}


{{Note|'''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}}
= Download Yocto {{#var:YOCTO_NAME}} based on {{#varexists:FSLC_BSP_VERSION|Freescale Community BSP {{#var:FSLC_BSP_VERSION}}|NXP BSP {{#var:FSL_BSP_VERSION}}}} =


{{Note|'''Note:''' If using any of the native .{{#var:SDCARD_IMG_EXT}} images output from Yocto, these will only have a default partition size of slightly less than 8 GB in order to fit on most SD cards. In order to maximize all usable space on the SD card, please see the section on [[#Extending the SD Card Size|Extending the SD Card Size]].}}
Configure git user and email:


== Yocto Recovery Image ==
$ git config --global user.name "Your Name"
Beginning in Yocto Langdale, Variscite has released a new recovery Yocto image recipe called "var-recovery-image." This image is used to create a bootable SD card that contains another target image to be programmed to the eMMC. See the {{Varlink2|{{#var:OS_TYPE}} Recovery SD card|{{#var:RELEASE_LINK}}}} or the more manual {{Varlink|Yocto NAND Flash Burning|{{#var:RELEASE_LINK}}|Installing Yocto to the SOM's internal storage}} articles for specifics of installing a recovery image.<br>
$ git config --global user.email "Your Email"
<br>
 
Usage:<br><br>
Fetch and install the Google [https://gerrit.googlesource.com/git-repo/ git-repo] tool:
To create a recovery image, simply run the following from your Yocto environment:
 
<br>
$ mkdir -p ~/bin
  {{#var:SHELL_PROMPT}} var-recovery-image
# For Ubuntu 20.04 and older, install repo 2.32 according to https://gerrit.googlesource.com/git-repo/+/HEAD/docs/python-support.md:
$ curl https://commondatastorage.googleapis.com/git-repo-downloads/repo-2.32 > ~/bin/repo
# For Ubuntu 22.04 and newer, install the latest repo tool:
$ curl https://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
# Give repo execute permissions and add it to the path:
$ chmod a+x ~/bin/repo
$ export PATH=~/bin:$PATH
 
Create a build directory:
  $ mkdir {{#var:BUILD_FOLDER}}
$ cd {{#var:BUILD_FOLDER}}


This will produce an output relative to the build folder of "./tmp/deploy/images/{{#var:MACHINE_NAME}}/var-recovery-image-{{#var:MACHINE_NAME}}.{{#var:SDCARD_IMG_EXT}}" that can be flashed to the SD card. By default, this image boots fsl-image-gui and contains a fsl-image-gui target image to be programmed to eMMC.<br>
Now, choose between downloading a release tag, and downloading the latest revision (recommended) and '''follow only one of the next two bullet sections''', accordingly:<br>
<br>
<br>
You can also specify a different target eMMC image to be embedded in the recovery image by setting VAR_RECOVERY_TARGET_ROOTFS via the command line during build:<br>
* '''Download the latest revision (recommended)'''<br>
i.e.
{{#varexists: YOCTO_MANIFEST |
  {{#var:SHELL_PROMPT}} VAR_RECOVERY_TARGET_ROOTFS="<desired-emmc-image-recipe>" bitbake var-recovery-image
  $ repo init -u {{#var:YOCTO_GIT}} -b {{#var:YOCTO_BRANCH}} -m {{#var:YOCTO_MANIFEST}}
$ repo sync -j$(nproc)
|
$ repo init -u {{#var:YOCTO_GIT}} -b {{#var:YOCTO_BRANCH}}
$ repo sync -j$(nproc)
}}
<br>
<br>
Or alternatively, by setting this variable in local.conf:
or<br>
VAR_RECOVERY_TARGET_ROOTFS = "<desired-emmc-image-recipe>"
<br>
<br>
Additionally, the file name of the recovery image output can be modified by setting something like the following in local.conf:
* Download a release tag<br>
Each release in https://github.com/varigit/variscite-bsp-platform/releases corresponds to a tag.<br>
The tags are also listed in https://github.com/varigit/variscite-bsp-platform/tags<br>
To specify a specific release/tag, run the following:
$ repo init -u https://github.com/varigit/variscite-bsp-platform.git -b refs/tags/TAG_NAME
For example:
{{#varexists: YOCTO_MANIFEST |
$ repo init -u https://github.com/varigit/variscite-bsp-platform.git -b refs/tags/{{#var:RELEASE_NAME}} -m {{#var:YOCTO_MANIFEST}}
$ repo sync -j$(nproc)
|
$ repo init -u https://github.com/varigit/variscite-bsp-platform.git -b refs/tags/{{#var:RELEASE_NAME}}
$ repo sync -j$(nproc)
}}


echo 'VAR_RECOVERY_SD_NAME = "{{#var:RECOVERY_BASE_NAME}}"' >> conf/local.conf
{{#if:{{#var:BUILD_YOCTO_IN_DOCKER_CONTAINER}}|
Start a Ubuntu Docker container:


Would produce a recovery image relative to the build folder of "./tmp/deploy/images/{{#var:MACHINE_NAME}}/{{#var:RECOVERY_BASE_NAME}}.{{#var:SDCARD_IMG_EXT}}"<br>
$ ./var-start-container.sh {{Note|'''Note:''' After Ubuntu Docker container is started you can see the shell prompt similar to: '''vari@yocto-{{#var:DOCKER_CONTAINER_INFO}}:/workdir$'''.}}
}}
 
= Setup and build Yocto =
== Supported images ==
{{#switch: {{#var:SOC_SERIES}} | imx8 | imx9=
The following images are provided by Variscite for evaluation purpose
* '''fsl-image-gui''': Default Variscite demo image with GUI and without any Qt{{#var:QT_VER}} content. This image recipe works for Xwayland and Wayland backends.
{{#if:{{#var:YOCTO_SUPPORT_CHROMIUM}}|
* '''fsl-image-gui-chromium''': Extends fsl-image-gui image with Chromium web browser.
|}}
* '''fsl-image-qt{{#var:QT_VER}}''': Extends fsl-image-gui image with Qt{{#var:QT_VER}} support and various Qt samples for Xwayland and Wayland backends.
|
The following images are provided by Variscite for evaluation purpose
* '''fsl-image-gui''': Default Variscite demo image with GUI and without any Qt{{#var:QT_VER}} content. This image recipe works on all backends for {{#ifeq: {{#var:BUILD_DISTRO}} | fslc-x11 | X11, |}} Frame Buffer, Wayland and XWayland and the content is optimized to fit 512MB NAND flash.
* '''fsl-image-qt{{#var:QT_VER}}''': Extends fsl-image-gui image with Qt{{#var:QT_VER}} support and various Qt samples for {{#ifeq: {{#var:BUILD_DISTRO}} | fslc-x11 | X11, |}} Frame Buffer, Wayland and XWayland backends.
{{Note| Will result in image size greater than 512 MB, which will not fit into NAND flash. Use SD card or eMMC to test.}}
}}
 
{{#switch: {{#var:SOC_SERIES}} | imx8 | imx9=
|
The following images are provided by FSL Community BSP:
* '''fsl-image-machine-test''': A console-only image that includes gstreamer packages{{#if:{{#var:GSTREAMER_SUPPORT}}|, Freescale’s multimedia packages (VPU and GPU),|}} and test and benchmark applications.
* '''fsl-image-mfgtool-initramfs''': Small image to be used with Manufacturing Tool (mfg-tool) in a production environment.
{{#if:{{#var:GSTREAMER_SUPPORT}}|
* '''fsl-image-multimedia'''/'''fsl-image-multimedia-full''': A console-only image that includes gstreamer packages and Freescale’s multimedia packages (VPU and GPU).
|}}
}}
See the list of Yocto Project’s reference images in [https://www.yoctoproject.org/docs/{{#var:YOCTO_VERSION}}/ref-manual/ref-manual.html#ref-images Yocto Project Reference Manual]
 
== Supported distros ==
The following distros can be used:
{{#switch: {{#var:SOC_SERIES}} | imx8 | imx9=
{{#varexists: FSLC_BSP_VERSION |
* '''fslc-xwayland''': Distro for Wayland with X11. This distro includes both wayland and X11 features.
* '''fslc-wayland''': Distro for Wayland without X11. This distro includes wayland feature but doesn’t have x11 support.
|
* '''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 emulation features.
}}
|
{{#ifeq: {{#var:BUILD_DISTRO_FB}} | fslc-framebuffer |
{{#ifeq: {{#var:BUILD_DISTRO}} | fslc-x11 |
* '''fslc-x11''': Distro for X11 without wayland. This distro include x11 feature and doesn’ has wayland support.
|
{{note| For this Yocto release, NXP/Vivante do no longer provide GPU accelerations for X11 native backend.}}
}}
* '''fslc-framebuffer''': Distro for Framebuffer graphical backend. This distro doesn’t include X11 and wayland features.
* '''fslc-wayland''': Distro for Wayland without X11. This distro includes wayland feature but doesn’t have x11 support.
* '''fslc-xwayland''': Distro for Wayland with X11. This distro includes both wayland and X11 emulation features.
|
* '''fsl-imx-x11''': Distro for X11 without wayland. This distro include x11 feature and doesn’ has wayland support.
* '''fsl-imx-fb''': Distro for Framebuffer graphical backend. This distro doesn’t include X11 and wayland features.
* '''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 emulation features.
}}
}}
Note: Also [http://www.informit.com/articles/article.aspx?p=2514911&seqNum=4 standard Poky distros] can be used
 
{{#if:{{#var:GSTREAMER_SUPPORT}}|
== GStreamer support ==
{{#switch: {{#var:SOC_SERIES}} | imx8 | imx9=
|
FSL community BSP comes with [https://github.com/Freescale/gstreamer-imx/blob/master/README.md gstreamer-imx], a set of GStreamer1.0 plugins for i.MX platform, which make use of the i.MX multimedia capabilities.<br>
Some of the multimedia plugins do not work well with X11 and Wayland backends.<br>
To get the most from gstreamer-imx, it is recommended to use fslc-framebufer distro with one of the demo images
}}
|}}
 
== {{#ifeq: {{#var:BUILD_FOLDER_X11}} | build_x11 | Build X11 | Build XWayland }} GUI demo image ==
{{#lst:Yocto_Platform_Customization|YOCTO_ENV_SETUP_X}}
{{#lst:Yocto_Platform_Customization|YOCTO_ENV_SETUP_X_SHORT}}
{{#vardefine:SHELL_PROMPT|{{#if:{{#var:BUILD_YOCTO_IN_DOCKER_CONTAINER}}|vari@yocto-{{#var:DOCKER_CONTAINER_INFO}}:/workdir/{{#var:BUILD_FOLDER_ENV}}$|$}}}}
{{#var:GITHUB_WARNING}}
<br>
<br>
{{Note|'''Note:''' Please see the [{{#var:META_VARISCITE_SDK_GIT}}/blob/{{#var:META_VARISCITE_SDK_BRANCH}}/recipes-core/images/var-recovery-image.bb var-recovery-image recipe source] for advanced usages of the recovery image.}}
Optional steps: [[#local.conf customization|local.conf customization]]
 
launch bitbake:


== Extending the SD Card Size ==
Without Qt content:
Flashing the default .{{#var:SDCARD_IMG_EXT}} images from Yocto results in a rootfs that does not utilize the entire SD card. This section explains how the SD card can be extended on the build host after flashing.<br>
{{#var:SHELL_PROMPT}} bitbake fsl-image-gui
<br>
{{#if:{{#var:YOCTO_SUPPORT_CHROMIUM}}|
Procedure:<br>
Or with Chromium:
<br>
{{#var:SHELL_PROMPT}} bitbake fsl-image-gui-chromium
Begin with an SD card on which you have previously flashed a Yocto .{{#var:SDCARD_IMG_EXT}} image. Ensure the SD card is inserted and the device present (i.e. /dev/sda, /dev/mmcblk0, etc.)<br>
{{Note|'''Note:''' Below replace /dev/sdX with your actual device (i.e. /dev/sda)}}
Start by running fdisk as below and typing "p" and enter to print current partitions. You should see a layout similar to below but numbers may differ depending on card sizes. Note that the partition starts at 16,384 (bytes offset 16384*512) which is to account for the boot content explained above.
$ sudo fdisk /dev/sdX
   
   
Welcome to fdisk (util-linux 2.37.2).
|}}
  Changes will remain in memory only, until you decide to write them.
  Or with Qt content:
  Be careful before using the write command.
  {{#var:SHELL_PROMPT}} bitbake fsl-image-qt{{#var:QT_VER}}
 
{{#switch: {{#var:SOC_SERIES}} | imx8 | imx9=
Command (m for help): p
|
Disk /dev/sdX: 59.48 GiB, 63864569856 bytes, 124735488 sectors                                                                                             
{{#if:{{#var:GSTREAMER_SUPPORT}}|
Disk model: MassStorageClass                                                                                                                               
NOTE: Some of the [https://github.com/Freescale/gstreamer-imx/blob/master/docs/blitter-architecture.md blitter-based i.MX GStreamer plugins] do not work with X11 and Wayland backends. To get the most of the i.MX GPU/VPU acceleration, use the fslc-framebuffer backend.
Units: sectors of 1 * 512 = 512 bytes                                                                                                                     
|}}
Sector size (logical/physical): 512 bytes / 512 bytes                                                                                                     
I/O size (minimum/optimal): 512 bytes / 512 bytes                                                                                                         
Disklabel type: dos                                                                                                                                       
Disk identifier: 0x5ebf1617                                                                                                                               
                                                                                                                                                           
Device    Boot Start      End  Sectors  Size Id Type                                                                                                     
/dev/sdX1      16384 15165439 15149056  7.2G 83 Linux


Next, run the following sequence of commands followed by enter with each step explained with a "-" to the right. Each command/input should be followed by enter:<br>
== Build console-only demo image {{#if:{{#var:GSTREAMER_SUPPORT}}|with Freescale’s multimedia packages (VPU and GPU)|}} ==
* d - Delete current partition (1).<br>
  $ cd {{#var:BUILD_FOLDER}}
* n - Create a new parition.<br>
  $ MACHINE={{#var:MACHINE_NAME}} DISTRO={{#var:BUILD_DISTRO_FB}} {{#var:BUILD_SCR_CMD}} {{#var:BUILD_FOLDER_FB}}
* - Empty, hit enter only which will leave default response p for primary partition.<br>
{{#var:GITHUB_WARNING}}
* - Empty, hit enter only which will leave default response 1 for first partition.<br>
* 16384 - Enter 16384 to begin partition past bootloader section.<br>
*  - Empty, hit enter only which will leave last sector as default which should choose ending size of the SD card.<br>
* N - Answers no to not remove the ext4 signature on the disk<br>
* p - Print output and verify before we write. We should see the starting offset the same and the end expanded to fill the SD card.<br>
* w - Write output to disk<br>
<br>
<br>
See the full log of the above sequence below:<br>
Optional steps: [[#local.conf customization|local.conf customization]]


Command (m for help): d                                                                                                                                   
<pre>
  Selected partition 1                                                                                                                                      
Without Qt content:
Partition 1 has been deleted.
$ bitbake fsl-image-gui
{{#if:{{#var:YOCTO_SUPPORT_CHROMIUM}}|
Or with Chromium:
$ bitbake fsl-image-gui-chromium
 
|}}
Or with Qt content:
$ bitbake fsl-image-qt{{#var:QT_VER}}
</pre>
}}
 
== local.conf customization ==
=== Change the downloads directory ===
 
Create a /opt/yocto_downloads directory and set its permissions:
<pre>
$ sudo mkdir /opt/yocto_downloads
$ sudo chmod 777 /opt/yocto_downloads/
</pre>
 
Direct downloads to it, by replacing 'DL_DIR ?= "${BSPDIR}/downloads/"' with 'DL_DIR = "/opt/yocto_downloads/"' in conf/local.conf under your build directory:
<pre>
$ sed -i 's/DL_DIR ?= "${BSPDIR}\/downloads/DL_DIR = "\/opt\/yocto_downloads/g' conf/local.conf
</pre>
 
=== Add Qt creator and Eclipse debug support to your images ===
{{#ifexpr: {{#var:YOCTO_VERSION}} > 2.4 |
Append the following to the conf/local.conf file in your Yocto build directory, to add Eclipse debug support to your images:
<pre>
EXTRA_IMAGE_FEATURES = " \
    eclipse-debug \
    ssh-server-openssh \
    "
</pre>
 
Append the following to the conf/local.conf file in your Yocto build directory, to add Qt creator debug support to your images:
<pre>
EXTRA_IMAGE_FEATURES = " \
    qtcreator-debug \
    ssh-server-openssh \
    "
</pre>
|
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:
<pre>
EXTRA_IMAGE_FEATURES = " \
    debug-tweaks \
    tools-debug \
    eclipse-debug \
    "
 
IMAGE_INSTALL_append = " \
    tcf-agent \
    openssh-sftp-server \
    "
</pre>
}}
 
{{#switch: {{#var:SOC_SERIES}} | imx8 | imx9=
|
{{#ifeq: {{#var:RELEASE_LINK}} | RELEASE_ZEUS_V1.0_DART-6UL |
=== Use SysV instead of systemd init ===
Apply this [https://github.com/varigit/meta-variscite-imx/commit/209a3615706d472c511e9647c267ded5b314c692 patch] to the meta-variscite-imx layer
|
=== Use systemd instead of SysV init ===
{{#ifeq: {{#rpos:{{#var:RELEASE_LINK}}|RELEASE_ZEUS_V1}} | 0 |
Comment out the last 4 lines of file [https://github.com/varigit/meta-variscite-imx/blob/zeus-imx-5.4.3-var01/conf/machine/imx6ul-var-dart.conf#L82-L85 ~/var-fsl-yocto/sources/meta-variscite-imx/conf/machine/imx6ul-var-dart.conf]
|
Append the following to the conf/local.conf file in your Yocto build directory, to use systemd instead of SysV init in your images:
<pre>
DISTRO_FEATURES_append = " systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED_append = " sysvinit"
VIRTUAL-RUNTIME_init_manager = "systemd"
VIRTUAL-RUNTIME_initscripts = ""
IMX_DEFAULT_DISTRO_FEATURES_append = " systemd"
</pre>
}}
}}
}}
 
=== 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:
<pre>
EXTRA_IMAGE_FEATURES += "read-only-rootfs"
</pre>
 
== Build Results ==
The resulting images are located in tmp/deploy/images/{{#var:MACHINE_NAME}}.
 
{{#lst:Yocto_Platform_Customization|{{#var:YOCTO_BUILD_RESULTS_SECTION}}}}
 
{{#ifexpr: {{#var:YOCTO_VERSION}} < 4.1
    | {{Yocto_Create_Bootable_SD_Legacy}}
    | {{Yocto_Create_Bootable_SD}}
}}
 
= Boot the board with a bootable SD card =
{{#ifeq: {{#var:HARDWARE_NAME}} | DART-6UL |
Note: <span style="color:red">The WiFi is not operational when booting from SD card</span>, as the WiFi and SD card are using the same SDIO interface.<br>
A typical use-case is to boot from an SD card, flash the eMMC/NAND flash, and re-boot from the eMMC/NAND flash to have the WiFi operational.
|}}
{{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M |
Note: <span style="color:red">The WiFi is not operational when booting from SD card</span>, as the WiFi and SD card are using the same SDIO interface.<br>
A typical use-case is to boot from an SD card, flash the eMMC, and re-boot from the eMMC to have the WiFi operational.
|}}
== Setting the Boot Mode ==
{{#lst:Yocto_Platform_Customization|{{#var:YOCTO_BOOT_BOARD_SECTION}}}}
 
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX8X|
|
== Automatic device tree selection in U-Boot ==
As shown in the [[#Build_Results| Build Results]] table above, we have different kernel device trees, corresponding to our different H/W configurations.<br>
{{#ifeq: {{#var:HARDWARE_NAME}} | DART-MX8M |
We implemented a script in U-Boot's environment, which sets the fdt_file environment variable based on the detected version of the carrier board revision.<br>
This file is actually a symbolic link, pointing to the real dtb file. The symbolic link can be set manually and defaults to the LVDS display configuration<br>
(when using the install_yocto.sh script with a display parameter, this script automatically sets this symbolic link to the appropriate dtb file).<br>
|
We implemented a script in U-Boot's environment, which sets the fdt_file environment variable based on the detected hardware.
}}
=== Enable/Disable automatic device tree selection ===
To enable the automatic device tree selection in U-Boot (already enabled by default):
<pre>
$ setenv fdt_file undefined
$ saveenv
</pre>
To disable the automatic device tree selection in U-Boot, set the device tree file manually:
<pre>
$ setenv fdt_file YOUR_DTB_FILE
$ saveenv
</pre>
 
{{#switch: {{#var:SOC_SERIES}} | imx8 | imx9=
Useful example: To list all files in the /boot directory (where the dtb files are by default) of an SD card:
  $ ls mmc {{#var:U-BOOT_SD_DEV}}:1 /boot
|
Useful example: To list all files in the boot partition (where the dtb files are by default) of an SD card:
<pre>
$ ls mmc 0:1
</pre>
}}
<!-- Make NOTE for DART-6UL only -->
{{#ifeq: {{#var:HARDWARE_NAME}} | DART-6UL |
{{note|Comment:<br>Make sure you don't set an inappropriate dtb file, like a dtb with nand on a SOM that has eMMC, or a dtb for mx6ull on a SOM with an mx6ul SOC.|info}}
|}}
}}
 
= Flash images to NAND/eMMC =
Please refer to {{Varlink2|Yocto NAND Flash Burning|{{#var:RELEASE_LINK}}}} guide.
 
= Yocto Image Customization =
== Update Yocto {{#var:YOCTO_NAME}} to latest revision ==
From time to time we update the Yocto sources (especially meta-variscite) with new features and bug fixes.<br>
Follow the '''Download the latest revision (recommended)''' bullet section of the [[#Download Yocto {{#var:YOCTO_NAME}} based on Freescale Community BSP|Download Yocto {{#var:YOCTO_NAME}} based on Freescale Community BSP]] step again to update your tree to the latest revision, and rebuild your image.
 
== Update Yocto {{#var:YOCTO_NAME}} to a release tag ==
Follow the '''Download a release tag''' bullet section of the [[#Download Yocto {{#var:YOCTO_NAME}} based on Freescale Community BSP|Download Yocto {{#var:YOCTO_NAME}} based on Freescale Community BSP]] step to update your tree to a release tag, and rebuild your image.
 
== Forcing Clean Build ==
 
In order to update the kernel, U-Boot and rootfs:
{{#var:SHELL_PROMPT}} bitbake -c cleanall u-boot-variscite linux-variscite kernel-module-imx-gpu-viv ti-compat-wireless-wl18xx wl18xx-firmware cryptodev-module
   
   
  Command (m for help): n
  for GUI image
  Partition type
{{#var:SHELL_PROMPT}} bitbake -c clean fsl-image-gui
    p  primary (0 primary, 0 extended, 4 free)
  for Qt{{#var:QT_VER}} image
    e  extended (container for logical partitions)
{{#var:SHELL_PROMPT}} bitbake -c clean fsl-image-qt{{#var:QT_VER}}
Select (default p):  
 
{{#switch: {{#var:SOC_SERIES}} | imx8 | imx9=
Using default response p.
|
Partition number (1-4, default 1):  
== Qt{{#var:QT_VER}} for Embedded Linux ==
First sector (2048-124735487, default 2048): 16384
To run Qt{{#var:QT_VER}} applications without X11 backend the platform specific plugins (e.g. EGLFS or LinuxFB) should be configured with QT_QPA_PLATFORM environment variable or with -platform command-line.
Last sector, +/-sectors or +/-size{K,M,G,T,P} (16384-124735487, default 124735487):  
{{Note| See more information on Qt{{#var:QT_VER}} customization for Embedded Linux [http://doc.qt.io/qt-5.6/embedded-linux.html here]}}
 
Created a new partition 1 of type 'Linux' and of size 59.5 GiB.
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX6 |
Partition #1 contains a ext4 signature.
=== Configure EGLFS Plugin ===
<pre>
Do you want to remove the signature? [Y]es/[N]o: N
export QT_QPA_EGLFS_PHYSICAL_HEIGHT=95
export QT_QPA_EGLFS_PHYSICAL_WIDTH=160
  Command (m for help): p
export QT_QPA_EGLFS_HEIGHT=480
   
export QT_QPA_EGLFS_WIDTH=800
  Disk /dev/sdX: 59.48 GiB, 63864569856 bytes, 124735488 sectors
export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1
Disk model: MassStorageClass
export QT_QPA_EGLFS_DEPTH=24
Units: sectors of 1 * 512 = 512 bytes
export QT_QPA_PLATFORM=eglfs
Sector size (logical/physical): 512 bytes / 512 bytes
</pre>
I/O size (minimum/optimal): 512 bytes / 512 bytes
|
Disklabel type: dos
=== Configure LinuxFB Plugin ===
identifier: 0x5ebf1617
{{#var:HARDWARE_NAME}} supports only LinuxFB plugin
<pre>
Device     Boot Start      End  Sectors  Size Id Type
export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:size=800x480:mmSize=160x95
/dev/sdX1      16384 124735487 124719104 59.5G 83 Linux
</pre>
 
Command (m for help): w
LinuxFB plugin is optimized for not accelerated platforms, but do not provide rotation capabilities.
 
The partition table has been altered.
If required you may be interested in reading [https://borkedlabs.com/blog/2015/06-01-qt{{#var:QT_VER}}-linuxfb-rotation-for-lcds this article], providing a dedicate patch and usage instructions.
Calling ioctl() to re-read partition table.
 
Syncing disks.
{{#ifeq: {{#var:QT5_FB_SUPPORT_ROTATION}} | true |
The patch proposed in the above article has been ported in the Yocto BSP and the rotation option is available for linuxfb plugin.
|
To integrate the patch in yocto BSP, you are supposed to:
* copy the plane patch in the folder
  {{#var:BUILD_FOLDER}}/sources/{{#var:META_VARISCITE_SDK}}/dynamic-layers/qt{{#var:QT_VER}}-layer/recipes-qt/qt{{#var:QT_VER}}/qtbase
* add the reference patch in the SRC_URI_append section of file
  {{#var:BUILD_FOLDER}}/sources/{{#var:META_VARISCITE_SDK}}/dynamic-layers/qt{{#var:QT_VER}}-layer/recipes-qt/qt{{#var:QT_VER}}/qtbase_%.bbappend
}}
}}
 
=== Configure Touch Input ===
When no windowing system is present, the mouse, keyboard, and touch input are read directly via evdev or tslib.
==== Evdev ====
By default, the Qt{{#var:QT_VER}} uses automatic device discovery based on libudev.
In case you want to override the default touchscreen configuration the following parameters can be used:
*/dev/input/... - Specifies the name of the input device. When not given, Qt looks for a suitable device either via libudev or by walking through the available nodes.
* rotate - On some touch screens the coordinates must be rotated, which is done by setting rotate to 90, 180, or 270.
* invertx and inverty - To invert the X or Y coordinates in the input events, pass invertx or inverty.
<pre>export QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS='/dev/input/touchscreen0'</pre>
 
==== Tslib ====
Tslib is used for resistive single-touch touchscreens and should be pre-configured with:
<pre>
export TSLIB_TSEVENTTYPE='INPUT'
export TSLIB_TSDEVICE='/dev/input/touchscreen0'
export TSLIB_CALIBFILE='/etc/pointercal'
export TSLIB_CONFFILE='/etc/ts.conf'
export TSLIB_CONSOLEDEVICE='none'
export TSLIB_FBDEVICE='/dev/fb0'
export TSLIB_PLUGINDIR='/usr/lib/ts'
export QT_QPA_EGLFS_TSLIB=1
export QT_QPA_FB_TSLIB=1  
</pre>
It is recommended to put the above setup inside /etc/profile.d/tslib.sh.
 
=== Running Qt{{#var:QT_VER}} Applications ===
 
  $ cd /usr/share/cinematicexperience-1.0; ./Qt5_CinematicExperience --platform {{#var:QT_PLATFORM_PLUGIN}}
  $ cd /usr/share/qt5everywheredemo-1.0; ./QtDemo --platform {{#var:QT_PLATFORM_PLUGIN}}
  $ cd /usr/share/qtsmarthome-1.0; ./smarthome --platform {{#var:QT_PLATFORM_PLUGIN}}
 
== UBIFS ==
By default we create ubifs image for 512MB NAND flash size.
You can change the size by editing {{#var:BUILD_FOLDER}}/sources/{{#var:META_VARISCITE_REPO}}/conf/machine/include/variscite.inc <br>and comment / uncomment the relevant section based on size.
}}
 
{{#if:{{#var:GSTREAMER_SUPPORT}}|
== DDR size and Contiguous Memory Allocator ==
By default Freescale allocates 256MB of RAM to the Contiguous Memory allocator.
This is for proper operation of the IPU VPU, X11 etc.
On VAR-SOM-SOLO with 256MB DDR RAM size, it will cause a kernel freeze during boot.
Adding cma=32MB to the bootargs parameters is required to fix.
|}}
 
= Make changes to the rootfs =
The following is usually not the recommended way to work with Yocto.<br>
You should usually create new specific recipes (.bb files) and/or append to specific present recipes by using .bbappend files.<br>
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:
<pre>
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.
</pre>
 
The functions will be called right after the root filesystem is created and right before it is packed to images (.{{#var:SDCARD_IMG_EXT}}, .ubi, .tar.gz, etc.).<br>
 
== 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:
<pre>
my_rootfs_additions/
├── data
│  ├── example.m4v
│  └── example.bin
├── etc
│  └── example.conf
└── home
    └── root
        └── .example
</pre>
And let's say you want to build the fsl-image-gui image.<br>
<br>
<br>
Finally, the file system needs to be resized on the disk to fill the now larger partition. Do that as follows:
Create a file called {{#var:BUILD_FOLDER}}/sources/{{#var:META_VARISCITE_REPO}}/recipes-images/images/fsl-image-gui.bbappend<br>
$ sudo e2fsck -f /dev/sdX1                                                   
with the following content:
e2fsck 1.46.5 (30-Dec-2021)                                                                                                                               
<pre>
root: recovering journal                                                                                                                                   
add_my_files() {
Pass 1: Checking inodes, blocks, and sizes                                                                                                                 
    cp -r /my_rootfs_additions/* ${IMAGE_ROOTFS}/
Pass 2: Checking directory structure                                                                                                                       
}
  Pass 3: Checking directory connectivity                                                                                                                   
 
Pass 4: Checking reference counts                                                                                                                         
ROOTFS_POSTPROCESS_COMMAND += "add_my_files;"
Pass 5: Checking group summary information                                                                                                                 
</pre>
root: 43155/947488 files (0.1% non-contiguous), 674097/1893632 blocks
Now, when you bitbake fsl-image-gui, the files in /my_rootfs_additions will be added to the rootfs (be careful when overwriting files).<br>
 
$ sudo resize2fs /dev/sdX1                                                   
= Useful Bitbake commands =
resize2fs 1.46.5 (30-Dec-2021)                                                                                                                             
 
Resizing the filesystem on /dev/sdX1 to 15589888 (4k) blocks.                                                                                              
[http://elinux.org/Bitbake_Cheat_Sheet Bitbake Cheat Sheet]
The filesystem on /dev/sdX1 is now 15589888 (4k) blocks long.
 
[https://community.freescale.com/docs/DOC-94953 Useful bitbake commands]
$ sync
 
<br>
[https://community.freescale.com/docs/DOC-94874 i.MX Yocto Project: ltib versus bitbake]
Again, numbers and output should differ slightly depending on your card.<br>
</includeonly>
<br>
Your rootfs image should now fill the entire SD card and is ready to boot.

Latest revision as of 21:49, 28 October 2024