BSP Documentation 4.14 - WinSystems/c444-manifest GitHub Wiki

Yocto Build Guide 4.14

Development Machine Requirements

• 8GB of memory minimum

• 200GB of Disk Space available

• Needs to be running Ubuntu 16.04

Steps to build

  1. Pull in packages needed for build
    sudo apt install gawk wget git-core diffstat unzip texinfo gcc-multilib \
    build-essential chrpath socat libsdl1.2-dev
    sudo apt install libsdl1.2-dev xterm sed cvs subversion coreutils texi2html \
    docbook-utils python-pysqlite2 help2man make gcc g++ desktop-file-utils \
    libgl1-mesa-dev libglu1-mesa-dev mercurial autoconf automake groff curl lzop asciidoc
    sudo apt install u-boot-tools

  2. Make a directory for the sources and build to take place. Doesn’t have to be ~/winYocto.
    mkdir ~/winYocto

  3. Download the repo tool and add it to the path. Doesn’t have to be in ~/bin
    mkdir ~/bin curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo chmod a+x ~/bin/repo export PATH=~/bin:$PATH

  4. Configure git
    git config --global user.name "Your Name"
    git config --global user.email "Your Email"
    git config --list

  5. Pull down the Yocto Project layers for building a 444 image.
    cd ~/winYocto
    repo init -u https://github.com/WinSystems/c444-manifest.git -b default
    repo sync

  6. Configure the build directory to target the C444
    DISTRO=fsl-imx-xwayland MACHINE=imx8mqpicoitx source winsys-setup-release.sh -b build

  7. Accept the EULA, and begin building the image. In this case the image will be the fsl-image-qt-imx version, but there are other target builds available.
    DISTRO=fsl-imx-xwayland MACHINE=imx8mqpicoitx bitbake --continue fsl-image-qt-imx

  8. Once the build has completed the image will be under tmp/deploy/images/imx8mqpicoitx

The files needed to flash the emmc are imx-boot-imx8mqpicoitx-sd.bin-flash_evk and fsl-image-validation-imx-imx8mqpicoitx-[date code here].rootfs.sdcard.bz2

Steps to program the new BSP image

Updating the BSP on the eMMC

Updating the BSP on the uSD

Image Usage

Accessing U-Boot

U-Boot's console by default is piped out over UART 1 at 115200 baud. Press any key over the console to stop it from running the default boot command. It has a three second delay by default before it runs the boot command.
Common u-boot commands:
?
Prints out help with all the commands it supports

printenv
Prints out a list of all the environment variables

setenv [variable to set] '[value to set it to]'
Sets the environment variable to desired value

saveenv
Preserves all of the current environment variables between resets.

env default -a
Sets all the environment variables back to defaults

Switching Device Trees

The image produced by the fsl-image-qt-imx target comes with two device trees by default. One supports HDMI, and the other supports a 1024x768 panel. Here is how to switch between the two from u-boot.
setenv fdt_file 'fsl-imx8mq-picoitx-lvds-auo.dtb'
saveenv
The above switches to the panel device tree.
setenv fdt_file 'fsl-imx8mq-picoitx.dtb'
saveenv
The above switches to the HDMI device tree

Switching Linux Boot Media

Linux can be booted from the eMMC or uSD. Here are the u-boot commands for switching between the two.
uSD boot:
setenv mmcroot '/dev/mmcblk0p2 rootwait rw'
setenv mmcdev 0
saveenv
boot
eMMC boot:
setenv mmcroot '/dev/mmcblk1p2 rootwait rw'
setenv mmcdev 1
saveenv
boot

Disabling Linux console

Doing the following will make debug without a display extremely difficult without reflashing the image. Proceed with caution.

  1. Stop at uboot and type the following commands
    setenv console 'null'
    setenv silent 1
    saveenv
    boot
  2. Login to linux and run the following from the command line
    sudo systemctl disable [email protected]
    The step above assumes the console was coming out over UART 1

Adjusting U-Boot Delay

U-Boot has a delay before running the boot command. This can be adjusted by changing the bootdelay environment variable. It will be difficult to break into u-boot if this variable is set too small.
setenv bootdelay [desired delay time in seconds]

Device Names in Linux

GPIO

GPIO # on Connector GPIO # in Linux
1 0
2 1
3 3
4 5
5 6
6 7
Blue Status LED 84
Green User_LED 132

One way to access them is via the sysfs interface. Here is how to export them, so they can be accessed using that interface.
sudo sh -c 'echo [GPIO # in Linux] > /sys/class/gpio/export
From there a folder should show up at /sys/class/gpio/gpio[GPIO # in Linux] that contains direction and value files. More information on the sysfs interface to GPIO can be found here.

UARTs

UART1 shows up as /dev/ttymxc0 and UART 2 shows up as /dev/ttymxc1

Using OPKG

OPKG can be used to pull in additional packages. Here are some commands for using it:

Pull in package manifest:
sudo opkg update

List available packages for install:
sudo opkg list

Install a package:
sudo opkg install [insert package name here]