BSP Documentation 5.4 - WinSystems/c444-manifest GitHub Wiki
Yocto Build Guide 5.4
Development Machine Requirements
-
8GB of memory minimum
-
300GB of Disk Space available
-
Ubuntu 20.04
Steps to build
-
Pull in packages needed for the 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 zstd curl lzop asciidoc
sudo apt install u-boot-tools
sudo apt install python
-
Create a project directory. Doesn’t have to be ~/winYocto.
mkdir ~/winYocto
-
Configure git.
git config --global user.name "Your Name"
git config --global user.email "Your Email"
git config --list
-
Install repo tool
mkdir ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
export PATH=~/bin:$PATH
-
Download the Yocto Project layers for building the c444 image.
cd ~/winYocto
repo init -u https://github.com/WinSystems/c444-manifest.git -b master -m itx-p-c444_5.4.24.xml
repo sync
-
Configure the build directory to target the c444.
MACHINE=imx8mq-itx-p-c444 DISTRO=c444-xwayland source winsys-setup-release.sh -b build
-
Run the following to avoid Chromium build failures.
ulimit -n 10000
-
Accept the EULA, and begin building the image. In this case the image will be the winsys-image-demo, but there are other target builds available.
bitbake -k winsys-image-demo
bitbake NOTES:
a. Thebitbake -k
option allows bitbake to continue building as much as it can if there is an error.
b. bitbake will need to be executed multiple times before successfully completing.
c. If a package continues to fail bitbake, run the code below, then rerun the bitbake command from Step 8.
bitbake -c cleanall <recipe-name>
-
Once the build has completed the image will be under tmp/deploy/images/imx8mq-itx-p-c444.
The files needed to flash a μSD are winsys-image-demo-imx8mq-itx-p-c444.wic.bz2 and winsys-image-demo-imx8mq-itx-p-c444.wic.bmap
The files needed to flash the eMMC using uuu are winsys-image-demo-imx8mq-itx-p-c444.rootfs.tar.bz2 and imx-boot-imx8mq-itx-p-c444-sd.bin-flash_evk
Steps to program the new BSP image
Image Usage
Accessing U-Boot
The U-Boot console by default is piped out over UART1 at 115200 baud. Press any key during boot 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 winsys-image-demo target provides two device trees. One supports HDMI and the other supports a 1024x768 LVDS panel. This is how to select the desired device tree from the u-boot prompt.
setenv fdtfile 'imx8mq-itx-p-c444-lvds-auo.dtb'
saveenv
The above switches to the panel device tree.
setenv fdtfile 'imx8mq-itx-p-c444.dtb'
saveenv
The above switches to the HDMI device tree
Switching Linux Boot Media
Linux can be booted from the eMMC or the μSD. Here are the u-boot commands for switching between the two boot media.
μSD 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
Adjusting HDMI Resolution
HDMI supports the following resolutions: 640x480p60, 720x480p60, 1280x720p60, 1920x1080p60,3840x2160p60, 4096x2160p60, Here is how to change the resolution at the u-boot prompt.
setenv mmcargs 'setenv bootargs ${jh_clk} console=${console} root=${mmcroot} video=HDMI-A-1:[resolution goes here]@[refresh rate goes here]
saveenv
- Boot Linux
- Edit /etc/xdg/weston/weston.ini and make sure the following is present in the file:
[output]
name=HDMI-A-1
mode=[resolution goes here]
Disabling Linux console
Doing the following will disable the console and make debug extremely difficult without reflashing the image. Proceed with caution.
- Stop at uboot and type the following commands
setenv console 'null'
setenv silent 1
saveenv
boot
- 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 UART1
Adjusting U-Boot Delay
U-Boot inserts a time delay before running the boot command. The pause 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 configure and control the GPIO 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 new folder at /sys/class/gpio/gpio[GPIO # in Linux]
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