TS-4900 - Build Yocto Distribution: Difference between revisions

From embeddedTS Manuals
No edit summary
m (Non-link text auto-updated for 2022 re-branding ( https://github.com/embeddedarm/ts-oe-bsp.git →‎ https://github.com/embeddedTS/ts-oe-bsp.git))
 
(9 intermediate revisions by 2 users not shown)
Line 2: Line 2:
* [https://www.yoctoproject.org/documentation/current Yocto Documentation]
* [https://www.yoctoproject.org/documentation/current Yocto Documentation]
* [http://www.yoctoproject.org/docs/current/yocto-project-qs/yocto-project-qs.html Yocto quick start guide]
* [http://www.yoctoproject.org/docs/current/yocto-project-qs/yocto-project-qs.html Yocto quick start guide]
* [https://community.freescale.com/docs/DOC-1616 Freescale Yocto instructions]
* [https://www.nxp.com/docs/en/user-guide/IMX_YOCTO_PROJECT_USERS_GUIDE.pdf Freescale Yocto instructions]
 
= Prerequisites =
This will change depending on your system.  Refer to the Yocto documentation for more information, but for building from Debian Jessie or Ubuntu Wily these are the required apt-get packages:
<source lang=bash>
sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm
</source>
 
If you plan on building our images we recommend using a 64-bit Linux distribution to build Yocto.  Chromium will require a significant amount of RAM to link which is expected to fail on i686.


= Build Yocto =
= Build Yocto =
Line 18: Line 26:
mkdir ts-bsp
mkdir ts-bsp
cd ts-bsp
cd ts-bsp
repo init -u https://github.com/embeddedarm/ts-oe-bsp.git -b daisy
# Fido is the most tested branch for the TS-4900.  We also have a Jethro and Fido branch
repo sync # This will take a while while it downloads several git repositories
# TS-7970/TS-7990 should use at least Krogoth.
repo init -u https://github.com/embeddedTS/ts-oe-bsp.git -b fido
repo sync # This will take a while while it downloads around 10 git repos
</source>
</source>


Line 28: Line 38:
#export SDKMACHINE="x86_64"
#export SDKMACHINE="x86_64"
#export SDKMACHINE="i686"
#export SDKMACHINE="i686"
## These can be changed later by modifying build/conf/local.conf
# Generate the image based on quad or solo
export MACHINE="tsimx6"
## The SDK and MACHINE can be changed later by modifying build/conf/local.conf


export MACHINE='ts4900-quad'
source ./setup-environment build
source ./setup-environment build
</source>
Next replace the newly generated contents of conf/bblayers.conf with this:
<pre>
LCONF_VERSION = "6"
BBPATH = "${TOPDIR}"
BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}"
BBFILES ?= ""
BBLAYERS = " \
  ${BSPDIR}/sources/poky/meta \
  ${BSPDIR}/sources/poky/meta-yocto \
  ${BSPDIR}/sources/poky/meta-yocto-bsp \
  \
  ${BSPDIR}/sources/meta-openembedded/meta-oe \
  ${BSPDIR}/sources/meta-openembedded/meta-systemd \
  ${BSPDIR}/sources/meta-openembedded/meta-multimedia \
  ${BSPDIR}/sources/meta-openembedded/meta-networking \
  ${BSPDIR}/sources/meta-openembedded/meta-ruby \
  ${BSPDIR}/sources/meta-openembedded/meta-python \
  ${BSPDIR}/sources/meta-openembedded/meta-gnome \
  \
  ${BSPDIR}/sources/meta-fsl-arm \
  ${BSPDIR}/sources/meta-fsl-arm-extra \
  ${BSPDIR}/sources/meta-fsl-demos \
  ${BSPDIR}/sources/meta-ts \
  ${BSPDIR}/sources/meta-qt5 \
  ${BSPDIR}/sources/meta-browser \
"
</pre>
Edit the file conf/local.conf.  To match our image, add these lines:
<pre>
LICENSE_FLAGS_WHITELIST = "commercial_libav commercial"
PACKAGECONFIG_append_pn-qtbase = " icu accessibility"


#Install our BB layers file.  This includes a set of common layers used
# Skip these three if you do not want systemd
#in our images.
DISTRO_FEATURES_append = " systemd"
cp ../.repo/manifests/bblayers.conf conf/bblayers.conf
DISTRO_FEATURES_remove = " wayland"
</source>
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
</pre>


You will need to select which image to build.  You can view the images we provide with:
You will need to select which image to build.  Our default image is ts-x11-image.  You can view the images we provide with:
<source lang=bash>
<source lang=bash>
ls -l sources/meta-ts/recipes-*/images/*
ls -l ../sources/meta-ts/recipes-*/images/*
</source>
</source>


Line 50: Line 99:
#bitbake ts-headless-image
#bitbake ts-headless-image


 
After the build has finished, it will be available in "tmp/deploy/images/tsimx6".  Use gparted or fdisk+mkfs to format an SD card with a single partition. From your pc, mount the SD card.  Assuming /dev/sdc is the SD card
After the build has finished, it will be available in:
<source lang=bash>
cd tmp/deploy/images/ts4900-quad
</source>
 
Use gparted or fdisk+mkfs to format an SD card with a single ext4 partition.
 
From your pc, mount the SD card.  Assuming /dev/sdc
<source lang=bash>
<source lang=bash>
mkdir /mnt/sd
mkdir /mnt/sd
mount /dev/sdc1 /mnt/sd
sudo mount /dev/sdc1 /mnt/sd
sudo tar -xf ts-x11-image-ts4900-quad.tar.bz2 -C /mnt/sd
sudo mkfs.ext4 /dev/sdc1
</source>
sudo tar -xf ts-x11-image-tsimx6.tar.bz2 -C /mnt/sd
 
sudo umount /mnt/sd/
This will install the rootfs, but the kernel, device tree (dtb), and FPGA bitstream must be manually installed.
sync
<source lang=bash>
sudo cp uImage /mnt/sd/boot/
sudo cp uImage-imx6q-ts4900*.dtb /mnt/sd/boot/
sudo rename 's/uImage-imx6q/imx6q/' /mnt/sd/boot/*.dtb
sudo umount /mnt/sd
</source>
</source>



Latest revision as of 14:22, 18 January 2022

Recommended reading

Prerequisites

This will change depending on your system. Refer to the Yocto documentation for more information, but for building from Debian Jessie or Ubuntu Wily these are the required apt-get packages:

sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm

If you plan on building our images we recommend using a 64-bit Linux distribution to build Yocto. Chromium will require a significant amount of RAM to link which is expected to fail on i686.

Build Yocto

To get started, install repo. This is a tool for downloading and updating a set of git repositories.

mkdir ~/bin
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
export PATH=${PATH}:~/bin

Check out our BSP:

mkdir ts-bsp
cd ts-bsp
# Fido is the most tested branch for the TS-4900.  We also have a Jethro and Fido branch
# TS-7970/TS-7990 should use at least Krogoth.
repo init -u https://github.com/embeddedTS/ts-oe-bsp.git -b fido 
repo sync # This will take a while while it downloads around 10 git repos

Once it is downloaded the environment needs to bet set up:

## The SDK will default to the architecture of the build system
## or you can override it with one of the following:
#export SDKMACHINE="x86_64"
#export SDKMACHINE="i686"
# Generate the image based on quad or solo
export MACHINE="tsimx6"
## The SDK and MACHINE can be changed later by modifying build/conf/local.conf

source ./setup-environment build

Next replace the newly generated contents of conf/bblayers.conf with this:

LCONF_VERSION = "6"

BBPATH = "${TOPDIR}"
BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}"

BBFILES ?= ""
BBLAYERS = " \
  ${BSPDIR}/sources/poky/meta \
  ${BSPDIR}/sources/poky/meta-yocto \
  ${BSPDIR}/sources/poky/meta-yocto-bsp \
  \
  ${BSPDIR}/sources/meta-openembedded/meta-oe \
  ${BSPDIR}/sources/meta-openembedded/meta-systemd \
  ${BSPDIR}/sources/meta-openembedded/meta-multimedia \
  ${BSPDIR}/sources/meta-openembedded/meta-networking \
  ${BSPDIR}/sources/meta-openembedded/meta-ruby \
  ${BSPDIR}/sources/meta-openembedded/meta-python \
  ${BSPDIR}/sources/meta-openembedded/meta-gnome \
  \
  ${BSPDIR}/sources/meta-fsl-arm \
  ${BSPDIR}/sources/meta-fsl-arm-extra \
  ${BSPDIR}/sources/meta-fsl-demos \
  ${BSPDIR}/sources/meta-ts \
  ${BSPDIR}/sources/meta-qt5 \
  ${BSPDIR}/sources/meta-browser \
"

Edit the file conf/local.conf. To match our image, add these lines:

LICENSE_FLAGS_WHITELIST = "commercial_libav commercial"
PACKAGECONFIG_append_pn-qtbase = " icu accessibility"

# Skip these three if you do not want systemd
DISTRO_FEATURES_append = " systemd"
DISTRO_FEATURES_remove = " wayland"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"

You will need to select which image to build. Our default image is ts-x11-image. You can view the images we provide with:

ls -l ../sources/meta-ts/recipes-*/images/*

These images may change in the future, or more may be added. There are descriptions in the top comments of each file.

  1. Build our common image with X11/QT support

bitbake ts-x11-image

  1. Alternatively, this is a smaller image with X11/QT omitted
  2. bitbake ts-headless-image

After the build has finished, it will be available in "tmp/deploy/images/tsimx6". Use gparted or fdisk+mkfs to format an SD card with a single partition. From your pc, mount the SD card. Assuming /dev/sdc is the SD card

mkdir /mnt/sd
sudo mount /dev/sdc1 /mnt/sd
sudo mkfs.ext4 /dev/sdc1
sudo tar -xf ts-x11-image-tsimx6.tar.bz2 -C /mnt/sd
sudo umount /mnt/sd/
sync

Updating the distribution

Occasionally we will make updates to Yocto. To pull these down:

export PATH=${PATH}:~/bin
cd ts-bsp
repo sync

source ./setup-environment build

From here, you can bitbake your desired image which will include any updates.