Рубрики
dev

yocto / nxp

0. Готовим каталог пользователя
mkdir ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

1. скачиваем слои от nxp
export PATH=${PATH}:~/bin
mkdir yocto-sdk
cd yocto-sdk
repo init -u https://source.codeaurora.org/external/qoriq/qoriq-components/yocto-sdk -b dunfell
repo sync --no-clone-bundle

1.Список используемых слоев и ручное добавление слоев
mkdir yocto-sdk
cd yocto-sdk
mkdir sources
git clone git://git.yoctoproject.org/poky sources/poky
git clone git://git.yoctoproject.org/meta-cloud-services sources/meta-cloud-services
git clone git://git.yoctoproject.org/meta-freescale sources/meta-freescale
git clone git://git.yoctoproject.org/meta-security sources/meta-security
git clone git://git.yoctoproject.org/meta-selinux sources/meta-selinux
git clone git://git.yoctoproject.org/meta-virtualization sources/meta-virtualization
git clone https://github.com/OSSystems/meta-browser sources/meta-browser
git clone https://github.com/kraj/meta-clang sources/meta-clang
git clone https://github.com/Freescale/meta-freescale-distro sources/meta-freescale-distro
git clone https://github.com/openembedded/meta-openembedded sources/meta-openembedded
git clone https://github.com/TimesysGit/meta-timesys sources/meta-timesys
git clone https://source.codeaurora.org/external/qoriq/qoriq-components/meta-qoriq sources/meta-qoriq
cp sources/meta-qoriq/tools/setup-env .


1.1 Приветствие:
Добро пожаловать в Freescale QorIQ SDK (эталонный дистрибутив)
Yocto Project имеет обширную документацию по OE, включая справочное руководство, которое можно найти по адресу:
     http://yoctoproject.org/documentation
Для получения дополнительной информации об OpenEmbedded посетите их веб-сайт:
     http://www.openembedded.org/
Теперь вы можете запустить 'bitbake '
    fsl-image-networking
    fsl-image-networking-full


2. Производим сборку 
cd ~/yocto-sdk
. ./setup-env -m ls1046afrwy
!!! fsl-image-networking - офф образ nxp
!!! fsl-image-networking-full  - офф образ nxp
!!! core-image-sato - будет собран дистрибутив с GUI
!!! core-image-base - базовая версия
!!! core-image-minimal - что то там минимальное
!!! ovs-dpdk - что то там с openvswitch и dpdk
 
bitbake fsl-image-networking

Настройка  fsl-image-multimedia-full убираем x11 и сборка
vim conf/local.conf 
-------------------
DISTRO_FEATURES_remove = " x11" <--- убираем #, раскомментировать строку, тем самым сборка будет без x11
-------------------
Производим сборку:
bitbake fsl-image-multimedia-full

Сборка под sdcard:
wic create ls104x-uboot-bootpart --no-fstab-update -e fsl-image-networking

ссылки:

err: lxc-4.0.1-r
https://github.com/intel/iotg-yocto-ese-manifest/issues/3
http://linuxcontainers.org/downloads/lxc/lxc-4.0.1.tar.gz
https://github.com/WindRiver-Labs/wrlinux-x/issues/14

ERROR: lxc-4.0.1-r0 do_fetch: Fetcher failure for URL: 'http://linuxcontainers.org/downloads/lxc-4.0.1.tar.gz'. Unable to fetch URL from any source.

err: lxc-4.0.1-r
https://github.com/intel/iotg-yocto-ese-manifest/issues/3


fix изменяем слой отредактировав ссылку "SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz":
vim ~/yocto-sdk/sources/meta-virtualization/recipes-containers/lxc/lxc_4.0.1.bb
---------------------------------------------------------------------
#SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz - ищем это и изменяем !!! эту стоку удаляем
SRC_URI = "http://linuxcontainers.org/downloads/lxc/${BPN}-${PV}.tar.gz
---------------------------------------------------------------------

ERROR: go-systemd-4+gitAUTOINC+b4a58d9518-r0 do_fetch: Fetcher failure for URL: 'git://github.com/coreos/go-systemd.git'. Unable to fetch URL from any source.

https://github.com/WindRiver-Labs/wrlinux-x/issues/14

vim ~/yocto-sdk/sources/meta-virtualization/recipes-devtools/go/go-systemd_git.bb
---------------------------------------------------------------------------------
#SRC_URI = "git://${PKG_NAME}.git" - это меняем и не забываем что комментарии тут оставлять не льзя
SRC_URI = "git://${PKG_NAME}.git;branch=main" 
---------------------------------------------------------------------------------

ERROR git

Иногда встречаются ошибки связанные с git и yocto подсказывает что надо сделать, и пишет какую надо сделать команду git.
Пример:
git config --global --add safe.directory ~/yocto-sdk/build_ls1046afrwy/tmp/work/aarch64-fsl-linux/gnulib/2018-03-07.03-r0/git

ERROR: Task (~/yocto-sdk/sources/meta-virtualization/recipes-devtools/go/go-systemd_git.bb:do_deploy_source_date_epoch) failed with exit code '1'

#https://community.nxp.com/t5/i-MX-Processors/ERROR-do-fetch-Fetcher-failure-for-URL-git-github-com-fsnotify/m-p/1401484

vim ~/yocto-sdk/sources/meta-virtualization/recipes-devtools/go/go-systemd_git.bb
---------------------------------------------------------------------------------
#SRC_URI = "git://${PKG_NAME}.git;branch=master;protocol=https""  - меняем это
SRC_URI = "git://${PKG_NAME}.git;branch=main;protocol=https" 
---------------------------------------------------------------------------------

u-boot tftp

=> setenv ipaddr 
=> setenv serverip 
LS1046ARDB и FRWY-LS1046A
=> setenv bootargs root=/dev/ram0 rw console=ttyS0,115200 earlycon=uart8250,mmio,0x21c0500 ramdisk_size=0x10000000
LX2160ARDB (rev1.0 and rev2.0)
=> setenv bootargs console=ttyAMA0,115200 root=/dev/ram0 rw earlycon=pl011,mmio32,0x21c0000 ramdisk_size=0x2000000 default_hugepagesz=1024m hugepagesz=1024m hugepages=2 pci=pcie_bus_perf
Download:
LS1046ARDB:
=> tftp 0x8f000000 fsl-ls1046a-rdb-sdk.dtb
LX2160ARDB:
=> tftp 0x8f000000 fsl-lx2160a-rdb.dtb
=> booti 0x82000000 0xa0000000 0x8f000000

Booting board with full rootfs from large storage device

1. Prepare the media (SD/USB/SATA) and format it to ext2 format.
2. Mount the ext2 partition, extract a full rootfs into this partition, and unmount the partition.
3. Power up or reset the board.
4. Press a key on the keyboard when prompted on the terminal to enter into the U-Boot command line.
5. Set up the environment in U-Boot using command described in the table below.

LS1046ARDB and  FRWY-LS1046A
=> setenv bootargs root=/dev/sda* rootdelay=5 rw console=ttyS0,115200 earlycon=uart8250,mmio,0x21c0500

LX2160ARDB
=> setenv bootargs console=ttyAMA0,115200 root=/dev/sda* rw rootdelay=10 earlycon=pl011,mmio32,0x21c0000 ramdisk_size=0x2000000 default_hugepagesz=1024m hugepagesz=1024m hugepages=2 pci=pcie_bus_perf

enable DPAA2 Ethernet in Linux using commands

LX2160ARDB:
=> sf probe 0:0
=> sf read 0x80a00000 0xa00000 0x300000
=> sf read 0x80e00000 0xe00000 0x100000
=> fsl_mc start mc 0x80a00000 0x80e00000
=> sf read 0x80d00000 0xd00000 0x100000
=> fsl_mc lazyapply dpl 0x80d00000

Download images and boot up:

LS1046ARDB:
=> tftp 0x8f000000 fsl-ls1046a-rdb-sdk.dtb

FRWY-LS1046A:
=> tftp 0x8f000000 fsl-ls1046a-frwy-sdk.dtb

LX2160ARDB:
=> tftp 0x8f000000 fsl-lx2160a-rdb.dtb
=> booti 0x82000000 - 0x8f000000

Program TF-A binaries on NAND flash:

1. Boot the board from default bank.
2. Flash bl2_nand.pbl to NAND flash:
=> tftp 82000000 $path/bl2_nand.pbl
=> nand erase 0x0 $filesize;nand write 0x82000000 0x0 $filesize;
3. Flash fip_uboot.bin to NAND flash:
=> tftp 82000000 $path/fip_uboot.bin
=> nand erase 0x100000 $filesize;nand write 0x82000000 0x100000 $filesize;
4. Boot the board from NAND flash. The board boots with TF-A.

Question:

Question 1: How can I compile ATF with OPTEE?
Answer: For compiling ATF with OPTEE, add the below line in your conf/local.conf file:
DISTRO_FEATURES_append = " optee"

Question 2: How can I compile ATF with RCW image that is different from default image?
Answer: Modify RCWNOR or RCWSD and RCWNAND in .conf file. 
For example, update ls1043ardb.conf file in meta-freescale layer as follows:
RCWNOR ?= "RR_FQPP_1455/rcw_1600"

Question 3: How can I add custom additional packages to default rootfs?
Answer: Set IMAGE_INSTALL_append in the conf/local.conf file.