It is possible to customize existing meta layers by creating an own meta layer with bitbake append files. In this description the meta layer meta-altera for Intel FPGA devices is used as reference.
For more informations about the operating system OS used and the sources and versions of yocto project or meta-altera layer, see Yocto KICKstart#Used source files.
Scroll Ignore |
---|
scroll-pdf | true |
---|
scroll-office | true |
---|
scroll-chm | true |
---|
scroll-docbook | true |
---|
scroll-eclipsehelp | true |
---|
scroll-epub | true |
---|
scroll-html | true |
---|
|
|
Before starting to create a custom meta layer, navigate to the yocto poky directory and initialize the environment with the following commands:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
cd <path_to_yocto>path/to/yocto/poky
source oe-init-build-env
cd ..
|
Scroll Ignore |
---|
scroll-pdf | true |
---|
scroll-office | true |
---|
scroll-chm | true |
---|
scroll-docbook | true |
---|
scroll-eclipsehelp | true |
---|
scroll-epub | true |
---|
scroll-html | true |
---|
|
|
Since the created meta-custom layer should depend on meta-altera, these sources files must be downloaded and added to the yocto project.
Navigate to yocto poky directory and download meta-altera layer:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
cd <path_to_yocto>path/to/yocto/poky
git clone -b dunfell https://github.com/kraj/meta-altera.git |
Add meta-altera to yocto project with:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
cd path/to/yocto/poky/build
bitbake-layers add-layer ./meta-altera |
Scroll Ignore |
---|
scroll-pdf | true |
---|
scroll-office | true |
---|
scroll-chm | true |
---|
scroll-docbook | true |
---|
scroll-eclipsehelp | true |
---|
scroll-epub | true |
---|
scroll-html | true |
---|
|
|
In this example, the created layer is named meta-custom. If you want to use a different name, just replace "custom".
Create own layer "meta-custom" with:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
bitbake-layers create-layer .path/to/yocto/poky/meta-custom |
The created layer contains a sample recipes folder, that can be removed:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
rm -rf .path/to/yocto/poky/meta-custom/recipes-example |
Make meta-custom dependent on meta-altera:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
sed -i '/LAYERDEPENDS_meta-custom/s/core/meta-altera/g' path/to/yocto/poky/meta-custom/conf/layer.conf |
Add the meta-custom layer to the yocto project with:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
bitbake-layers add-layer .path/to/yocto/poky/meta-custom |
Scroll Ignore |
---|
scroll-pdf | true |
---|
scroll-office | true |
---|
scroll-chm | true |
---|
scroll-docbook | true |
---|
scroll-eclipsehelp | true |
---|
scroll-epub | true |
---|
scroll-html | true |
---|
|
|
First the variable "MACHINE" must be redefined in the local.conf file. Several machines are defined in the meta-altera layer (see meta-altera/conf/machine for more information). In this example, the machine 'cyclone5' is used.
Remove the default value and add 'cyclone5':
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
sed -i '/^MACHINE/s/MACHINE/#MACHINE/g' path/to/yocto/poky/build/conf/local.conf
echo -e '\nMACHINE = "cyclone5"' >> path/to/yocto/poky/build/conf/local.conf |
For the linux kernel in the meta-altera layer it's required to define a the preferred provider and version in local.conf (see meta-altera/recipes-kernel/linux for other linux kernel versions):
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
echo -e '\nPREFERRED_PROVIDER_virtual/kernel = "linux-altera-lts"' >> path/to/yocto/poky/build/conf/local.conf
echo -e 'PREFERRED_VERSION_linux-altera-lts = "5.4%"' >> path/to/yocto/poky/build/conf/local.conf
|
Set the preferred u-boot version for meta-altera in local.conf (see meta-altera/recipes-bsp/u-boot for other u-boot versions):
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
echo -e '\nPREFERRED_VERSION_u-boot-socfpga = "v2021.04%"' >> path/to/yocto/poky/build/conf/local.conf |
Configure custom meta layer with devtool
Scroll Ignore |
---|
scroll-pdf | true |
---|
scroll-office | true |
---|
scroll-chm | true |
---|
scroll-docbook | true |
---|
scroll-eclipsehelp | true |
---|
scroll-epub | true |
---|
scroll-html | true |
---|
|
The following command creates the workspace directory and adds it to bblayers.conf:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
devtool create-workspace |
Scroll Ignore |
---|
scroll-pdf | true |
---|
scroll-office | true |
---|
scroll-chm | true |
---|
scroll-docbook | true |
---|
scroll-eclipsehelp | true |
---|
scroll-epub | true |
---|
scroll-html | true |
---|
|
|
To prepare the u-boot sources for modify the default configuration and create patches of u-boot , do the following steps:
It is not possible to call menuconfig if UBOOT_CONFIG is defined. But UBOOT_CONFIG is needed to assign a defconfig file to UBOOT_MACHINE. UBOOT_MACHINE must therefore be defined manually. The variable UBOOT_CONFIG is predefined in the machine configuration file for cyclone5 with the value 'cyclone5-socdk' (see meta-altera/conf/machine/cyclone5.conf). The associated defconfig file is therefore socfpga_cylcone5_defconfig (see meta-altera/recipes-bsp/u-boot/u-boot-socfpga-common.inc). Accordingly these variables must be defined in local.conf:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
echo -e '\nUBOOT_MACHINE = "socfpga_cyclone5_defconfig"' >> path/to/yocto/poky/build/conf/local.conf
echo -e 'UBOOT_CONFIG = ""' >> path/to/yocto/poky/build/conf/local.conf |
Run following command to prepare the workspace and fetch and unpack the sources:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
devtool modify u-boot-socfpga -O |
Make
To make changes to u-boot configuration, follow these steps:
Launch menuconfig with following command and make your changes:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
devtool menuconfig u-boot-socfpga |
- Exit and save your configuration. devtool-fragment.cfg will be created automatically.Make changes to the
Do following steps to create patches for u-boot source files:
Navigate to u-boot-socfpga in the workspace and add, modify or remove files:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
cd path/to/yocto/poky/build/workspace/sources/u-boot-socfpga |
Run a build to test your changes:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
devtool build u-boot-socfpga |
Add the changes made with:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
git add . |
Commit your changes and add a short message. The message is used to name the patch file:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
git commit -m "<message>" |
If you want to generate more patches, repeat
step a steps 1 -
d4, otherwise navigate back to the poky directory:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
cd |
<path_to_yocto>
Add the devtool-fragment.cfg and the patches to the meta-custom layer with:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
devtool update-recipe u-boot-socfpga -a |
.path/to/yocto/poky/meta-custom -O |
Remove the UBOOT_CONFIG and UBOOT_MACHINE variables from local.conf if you use the default defconfig file for the MACHINE 'cyclone5':
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
sed -i '/UBOOT_MACHINE = "socfpga_cyclone5_defconfig"/d' path/to/yocto/poky/build/conf/local.conf
sed -i '/UBOOT_CONFIG = ""/d' path/to/yocto/poky/build/conf/local.conf |
Scroll Ignore |
---|
scroll-pdf | true |
---|
scroll-office | true |
---|
scroll-chm | true |
---|
scroll-docbook | true |
---|
scroll-eclipsehelp | true |
---|
scroll-epub | true |
---|
scroll-html | true |
---|
|
|
To prepare the linux kernel sources for modify the default configuration and create patches of linux kernel , do the following steps:
Run following command to prepare the workspace and fetch and unpack the sources:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
devtool modify linux-altera-lts -O |
Launch menuconfig with following command and make your changes, exit and save your configuration:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
devtool menuconfig linux-altera-lts |
Make changes to the linux-altera-lts configuration
To make changes to linux kernel configuration, follow these steps:
Launch menuconfig with following command and make your changes:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
devtool menuconfig linux-altera-lts |
- Exit and save your configuration. devtool-fragment.cfg will be created automatically.Make changes to
Do following steps to create patches for u-boot source files:
Navigate to linux-altera-lts in the workspace and add, modify or remove files:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
cd path/to/yocto/poky/build/workspace/sources/linux-altera-lts |
Run a build to test your changes:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
devtool build linux-altera-lts |
Add the changes made with:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
git add . |
Commit your changes and add a short message. The message is used to name the patch file:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
git commit -m "<message>" |
If you want to generate more patches, repeat step
a 1 -
d4, otherwise navigate back to the poky directory:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
cd |
<path_to_yocto>
Add the devtool-fragment.cfg and the patches to the meta-custom layer with:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
devtool update-recipe linux-altera-lts -a |
.path/to/yocto/poky/meta-custom -O |
Scroll Ignore |
---|
scroll-pdf | true |
---|
scroll-office | true |
---|
scroll-chm | true |
---|
scroll-docbook | true |
---|
scroll-eclipsehelp | true |
---|
scroll-epub | true |
---|
scroll-html | true |
---|
|
|
Remove the workspace from bblayers.conf and delete the workspace folder:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
cd path/to/yocto/poky/build
bitbake-layers remove-layer workspace
rm -rf path/to/yocto/poky/build/workspace |
custom Scroll Ignore |
---|
scroll-pdf | true |
---|
scroll-office | true |
---|
scroll-chm | true |
---|
scroll-docbook | true |
---|
scroll-eclipsehelp | true |
---|
scroll-epub | true |
---|
scroll-html | true |
---|
|
|
If you create a u-boot file for an Intel Cyclone V / Arria V with quartus version 20.1 you have to convert the handoff data into source code.
- compile your quartus project
run the embedded command shell (Intel SoC EDS):
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
~/intelFPGA_lite/20.1/embedded/embedded_command_shell.sh |
navigate to your quartus project directory and convert the handoff data into source code:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
cd path/to/quartus/project
mkdir -p build
bsp-create-settings --type spl --bsp-dir build \
--preloader-settings-dir hps_isw_handoff/soc_system_hps_0/ \
--settings build/settings.bsp |
Next you have to run the qts_filter to take the sources from the handoff folder, format them and copy them to u-boot source code.
Fetch qts_filter.sh from github:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
wget https://github.com/altera-opensource/u-boot-socfpga/blob/socfpga_v2021.04/arch/arm/mach-socfpga/qts-filter.sh |
Run qts_filter for cyclone5 to format and copy the handoff files to custom meta layer:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
mkdir -p path/to/yocto/poky/meta-custom/recipes-bsp/u-boot/u-boot-socfpga/qts
./qts_filter.sh cyclone5 \
path/to/quartus/project \
path/to/quartus/project/build \
path/to/yocto/poky/meta-custom/recipes-bsp/u-boot/u-boot-socfpga/qts |
Add the generated files to the u-boot bbappend file:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
cd path/to/yocto/poky
recipetool edit u-boot-socfpga |
Add qts_filter files and the following task to copy the qts_filter files to the correct place in u-boot sources during build image (if your are using another board, you have to adjust the file path):
Code Block |
---|
|
SRC_URI += "file://qts/iocsr_config.h \
file://qts/pinmux_config.h \
file://qts/pll_config.h \
file://qts/sdram_config.h \
"
do_configure_prepend () {
install -m 0644 ${WORKDIR}/qts/iocsr_config.h ${S}/board/altera/cyclone5-socdk/qts/
install -m 0644 ${WORKDIR}/qts/pinmux_config.h ${S}/board/altera/cyclone5-socdk/qts/
install -m 0644 ${WORKDIR}/qts/pll_config.h ${S}/board/altera/cyclone5-socdk/qts/
install -m 0644 ${WORKDIR}/qts/sdram_config.h ${S}/board/altera/cyclone5-socdk/qts/
} |
For more information see u-boot-socfpga/doc/README.socfpga.
Scroll Ignore |
---|
scroll-pdf | true |
---|
scroll-office | true |
---|
scroll-chm | true |
---|
scroll-docbook | true |
---|
scroll-eclipsehelp | true |
---|
scroll-epub | true |
---|
scroll-html | true |
---|
|
|
- Linux Kernel Development Manual
- Reference Manual#devtool Quick Reference
- u-boot-socfpga/doc/README.socfpga
- Patching _ the _ source _ for _ a _ recipe