Yocto Linux BSP User Guide
Introduction
Getting Started
Conventions
${PREBUILT_IMAGE} : compressed prebuilt image (.img.gz)
${BSP_TARBALL} : BSP tarball (.tgz)
${BSP_HOME} : home directory of the BSP
${BDIR} : build directory (e.g. build_x11)
${MX6PROC} : i.MX6 Processor
- mx6q for iMX6 Quad Core / Dual Core
- mx6dl for iMX6 Dual Lite / Solo
${IMX6PROC} : i.MX6 Processor (imx6q / imx6dl)
${BOARD} : available target boards (rom5420, rom7421, ubc220, rom3420, rom7420, rsb4410, rsb4411, rsb6410, ubcds31, wise3310)
${BOARD_REV} : board revision (a1 / a2 / b1)
${MC} : machine code = ${IMX6PROC}${BOARD}${BOARD_REV}
${MEM_SIZE} : memory size (1G / 2G / 512M)
${SD_DEVICE} : device name of SD card in Linux (e.g. /dev/sdf)
${SDCARD_IMAGE} : sdcard image built by bitbake (*.sdcard)
${UBOOT} : u-boot version (e.g. 2015.04)
${KERNEL} : linux kernel version (e.g. 4.1.15)
${TOOLCHAIN} : toolchain installed directory (e.g. /opt/fsl-imx-x11/4.1.15-1.1.0)
Debug console / serial console: serial terminal program (minicom, putty, teraterm, …) with baudrate 115200 8N1
Terminal console: terminal program (gnome-terminal, xfce4-terminal, …)
Prerequisites
Install Docker Engine
Refer to Docker Installation Guide.
Pull ubuntu 12.04 image from Docker Hub & run
$ docker pull advrisc/u12.04-imx6lbv3
$ docker run --privileged --name imx6LBV7000 -it -v ${SD_DEVICE}:${SD_DEVICE} advrisc/u12.04-imx6lbv3 /bin/bash
Copy BSP to container
$ docker cp ${BSP_PACK} imx6LBV7000:/home/adv/
Copy files from container to host
$ docker cp imx6LBV7000:/home/adv/${BSP_HOME}/yocto_build/tmp/deploy/images/${MC} ~
Get BSP
Official Release BSP
Example: 4410A1LBV7000_2016-06-23.tgz is i.MX6 Yocto BSP file.
Download BSP
Install repo utility
$ mkdir ~/bin
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
export PATH=~/bin:$PATH
Yocto Project Setup
$ mkdir adv-release-bsp
$ cd adv-release-bsp
$ repo init -u git://github.com/ADVANTECH-Corp/adv-arm-yocto-bsp.git -b jethro_4.1.15-1.0.0_ga
$ repo sync
Introducing BSP
The BSP is based on Yocto Project with Freescale enhancements for i.MX6 and Advantech support.
Naming Rule
Example: 4410A1LBV7000_2016-06-23.tgz
- 4410A1 = RSB-4410 A1
- LB = Linux BSP
- V7000 = Version 7.000
Example: 4410A1LIV7000_DualQuad_2016-06-23.img.gz
- LI = Linux Image
- DualQuad = Dual/Quad support
BSP tarball
$ tar xvf ${BSP_TARBALL} -C ~/
Prebuilt image
$ gunzip -c ${PREBUILT_IMAGE} | dd of=${SD_DEVICE} bs=1M
Build Instructions
New build environment
$ cd ${BSP_HOME}
$ MACHINE=${MC} source fsl-setup-release.sh -b ${BDIR} -e x11
Existing build environment
$ cd ${BSP_HOME}
$ source setup-environment ${BDIR}
Build sdcard image
$ bitbake fsl-image-qt5
Build toolchain installer
$ bitbake meta-toolchain-qt5
Build u-boot
$ bitbake u-boot-imx
Build linux kernel
$ bitbake linux-imx -c menuconfig
$ sudo apt-get install tmux
$ bitbake linux-imx
Flashing to target
From prebuilt image
$ gunzip -c ${PREBUILT_IMAGE} | dd of=${SD_DEVICE} bs=1M
$ sync
On target:
# cd /mk_inand
# ./mksd-linux.sh /dev/mmcblk0
From built sdcard image
$ pushd ${BSP_HOME}/${BDIR}/tmp/deploy/images/${MC}
$ dd if=${SDCARD_IMAGE} of=${SD_DEVICE} bs=1M
$ sync
$ popd
On target with USB stick:
# umount /dev/mmcblk0p?
# cd /run/media/sda1
# dd if=${SDCARD_IMAGE} of=/dev/mmcblk0 bs=4M conv=fsync
# P2START=$(fdisk -lu | grep mmcblk0p2 | awk '{print $2}')
# echo -e "d
2
n
p
2
${P2START}
w
" | fdisk -u /dev/mmcblk0
# e2fsck -f -y /dev/mmcblk0p2
# resize2fs /dev/mmcblk0p2
# poweroff
Customization
Add tcf-agent & sftp
IMAGE_INSTALL += " tcf-agent openssh-sftp-server "
Add Chromium
CORE_IMAGE_EXTRA_INSTALL += "chromium"
LICENSE_FLAGS_WHITELIST="commercial"
SDK
Build SDK installer
$ cd ${BSP_HOME}/${BDIR}/tmp/deploy/sdk
$ sudo ./fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-vfp-neon-toolchain-${KERNEL}-1.1.0.sh
Setup cross-compile environment
$ source ${TOOLCHAIN}/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
Manual U-Boot
$ mkdir -p ~/code
$ cp -a ${BSP_HOME}/${BDIR}/tmp/work/${MC}-poky-linux-gnueabi/u-boot-imx/${UBOOT}/git ~/code/u-boot-imx
$ cd ~/code/u-boot-imx
$ make distclean
$ make ${MX6PROC}${BOARD}${BOARD_REV}_${MEM_SIZE}_config
$ make -j4
Flash:
$ dd if=u-boot_crc.bin.crc of=${SD_DEVICE} bs=512 seek=2 conv=fsync
$ dd if=u-boot-crc.bin of=${SD_DEVICE} bs=512 seek=3 conv=fsync
Manual Kernel
$ mkdir -p ~/code
$ cp -a ${BSP_HOME}/${BDIR}/tmp/work-shared/${MC}/kernel-source ~/code/linux-imx
$ cd ~/code/linux-imx
$ make distclean
$ make imx_v7_adv_defconfig
$ make menuconfig
$ make -j4 zImage LOADADDR=0x10008000
$ make -j4 modules
$ make modules_install INSTALL_MOD_PATH=~/temp/rootfs
$ make -j4 ${IMX6PROC}-${BOARD}-${BOARD_REV}.dtb
System Recovery
Recreate SD and re-flash system as described above.