Both sides previous revisionPrevious revisionNext revision | Previous revision |
resources:tools-software:linux-build:generic:zynq [14 Feb 2018 12:13] – [Building the Zynq boot image] Michael Hennerich | resources:tools-software:linux-build:generic:zynq [02 Feb 2024 16:08] (current) – update: master -> main Marcelo Schmitt |
---|
===== The script method ===== | ===== The script method ===== |
| |
We provide [[https://raw.githubusercontent.com/analogdevicesinc/wiki-scripts/master/linux/build_zynq_kernel_image.sh|a script that does automates]] the build for Zynq using the Linaro toolchain. | We provide [[https://raw.githubusercontent.com/analogdevicesinc/wiki-scripts/main/linux/build_zynq_kernel_image.sh|a script that does automates]] the build for Zynq using the Linaro toolchain. |
| |
The script takes 4 parameters: | The script takes up to 3 parameters, but if left blank, it uses defaults: |
- **<zynq|zynqmp>** - default is **zynq** if left blank | |
- **<local_kernel_dir>** - default is **linux-adi** if left blank ; use this, if you want to use an already cloned kernel repo | - **<local_kernel_dir>** - default is **linux-adi** if left blank ; use this, if you want to use an already cloned kernel repo |
- **<devicetree_file>** - which device tree should be exported/copied from the build ; default is ''zynq-zc702-adv7511-ad9361-fmcomms2-3.dtb'' for Zynq | - **<devicetree_file>** - which device tree should be exported/copied from the build ; default is ''zynq-zc702-adv7511-ad9361-fmcomms2-3.dtb'' for Zynq |
==== Running the script in one line [with defaults] ==== | ==== Running the script in one line [with defaults] ==== |
<code> | <code> |
wget https://raw.githubusercontent.com/analogdevicesinc/wiki-scripts/master/linux/build_zynq_kernel_image.sh && chmod +x build_zynq_kernel_image.sh && ./build_zynq_kernel_image.sh | wget https://raw.githubusercontent.com/analogdevicesinc/wiki-scripts/main/linux/build_zynq_kernel_image.sh && chmod +x build_zynq_kernel_image.sh && ./build_zynq_kernel_image.sh |
</code> | </code> |
| |
| |
| ===== Building using Petalinux ===== |
| |
| Please see here: [[resources:tools-software:linux-build:generic:petalinux|Building with Petalinux]] |
| |
===== On the development host ===== | ===== On the development host ===== |
| |
<note tip> | <note tip> |
If not otherwise required always use the latest release! | Use the latest release, if not required otherwise! |
</note> | </note> |
| |
| 2016_R2 | | | 2016_R2 | |
| 2017_R1 | | | 2017_R1 | |
| | 2018_R1 | |
| | 2018_R2 | |
| | 2019_R1 | |
| | 2019_R2 | |
| | 2021_R1 | |
| |
| |
<code> | <code> |
dave@hal9000:~/github-linux-build/linux$ git checkout origin/2015_R2 -b 2015_R2 | dave@hal9000:~/github-linux-build/linux$ git checkout origin/2021_R1 -b 2021_R1 |
Branch 2015_R2 set up to track remote branch 2015_R2 from origin. | Branch 2021_R1 set up to track remote branch 2021_R1from origin. |
Switched to a new branch '2015_R2' | Switched to a new branch '2021_R1' |
</code> | </code> |
| |
==== Setup cross compile environment variables ==== | ==== Setup cross compile environment variables ==== |
| |
| |
There are a few toolchains that can be used. The Xilinx toolchain is recommended, but the Linaro toolchain can also be used. | There are a few toolchains that can be used. The Xilinx toolchain is recommended, but the Linaro toolchain can also be used. |
=== Using the Xilinx toolchain === | === Using the Xilinx toolchain === |
| |
^ Release names and Branches ^ Required Vivado/SDK versions ^ | ^ Release names and Branches ^ Required Vivado/Vitis versions ^ |
| 2014_R2 | Vivado 2014.2 | | | 2014_R2 | Vivado 2014.2 | |
| 2015_R2 | Vivado 2015.2 | | | 2015_R2 | Vivado 2015.2 | |
| 2016_R2 | Vivado 2016.2 | | | 2016_R2 | Vivado 2016.2 | |
| 2017_R1 | Vivado 2016.4 | | | 2017_R1 | Vivado 2016.4 | |
| | 2018_R1 | Vivado 2017.4 | |
Vivado 2015.2 SDK may be installed into a different directory | | 2018_R2 | Vivado 2018.2 | |
| | 2019_R1 | Vivado 2018.3 | |
| | 2019_R2 | Vivado 2019.1 | |
| | 2021_R1 | Vivado 2021.1 | |
| |
<code> | <code> |
dave@hal9000:~/github-linux-build/linux$ source /opt/Xilinx/SDK/2015.2/settings64.sh | dave@hal9000:~/github-linux-build/linux$ source $PATH_to_Xilinx/Xilinx/Vitis/$Vitis_version/settings64.sh |
</code> | </code> |
| |
<code> | <code> |
dave@hal9000:~/github-linux-build/linux$ export ARCH=arm | dave@hal9000:~/github-linux-build/linux$ export ARCH=arm |
dave@hal9000:~/github-linux-build/linux$ export CROSS_COMPILE=arm-xilinx-linux-gnueabi- | dave@hal9000:~/github-linux-build/linux$ export CROSS_COMPILE="arm-linux-gnueabihf-" |
</code> | </code> |
| |
| <note important> |
| Find the path to the Xilinx installation folder, and then use it to replace this string: **$PATH_to_Xilinx** that is written above. Same goes for the **$Vitis_version**, where you choose the Vitis version. |
| </note> |
| |
=== Using the Linaro toolchain === | === Using the Linaro toolchain === |
| |
Alternatively, the Linaro toolchain/compiler can be used to compile to kernel. | Alternatively, the Linaro toolchain/compiler can be used to compile to kernel. |
Linaro compilers (that work with Zynq) can be downloaded from: https://releases.linaro.org/components/toolchain/binaries/latest-5/arm-linux-gnueabi/ | Linaro compilers (that work with Zynq) can be downloaded from: |
| https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabi/ . Always use the latest release just in case. |
| |
Example: | Example: |
<code> | <code> |
wget https://releases.linaro.org/components/toolchain/binaries/latest-5/arm-linux-gnueabi/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabi.tar.xz | wget https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabi/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi.tar.xz |
tar -xvf gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabi.tar.xz | tar -xvf gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi.tar.xz |
</code> | </code> |
| |
<code> | <code> |
export ARCH=arm | export ARCH=arm |
export CROSS_COMPILE=$(pwd)/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi- | export CROSS_COMPILE=$(pwd)/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi- |
</code> | </code> |
| |
==== Configure the kernel ==== | ==== Configure the kernel ==== |
| Inside the repository, generate the configuration file before building the kernel tree. The command shown below is generic and is not project specific. As long as the board is a ZYNQ FPGA, use the configuration below. |
<code> | <code> |
dave@hal9000:~/github-linux-build/linux$ make zynq_xcomm_adv7511_defconfig | dave@hal9000:~/github-linux-build/linux$ make zynq_xcomm_adv7511_defconfig |
dave@hal9000:~/github-linux-build/linux$ | dave@hal9000:~/github-linux-build/linux$ |
</code> | </code> |
==== Build the kernel ==== | |
| |
| ==== Build the kernel ==== |
| Build the kernel via 'make'. This is the same for all Xilinx ZYNQ FPGAs. |
<code> | <code> |
dave@hal9000:~/github-linux-build/linux$ make -j5 UIMAGE_LOADADDR=0x8000 uImage | dave@hal9000:~/github-linux-build/linux$ make -j5 UIMAGE_LOADADDR=0x8000 uImage |
| |
=== Build the one that fits your FPGA carrier and FMC card === | === Build the one that fits your FPGA carrier and FMC card === |
| ^ device tree ^ board ^ chip ^ |
| | zynq-adrv9361-z7035-bob | [[adi>ADRV1CRR-BOB]] | [[adi>ADRV9361]] | |
| | zynq-adrv9361-z7035-bob-cmos | [[adi>ADRV1CRR-BOB]] | [[adi>ADRV9361]] | |
| | zynq-adrv9361-z7035-packrf | [[adi>ADRV-PACKRF]] | [[adi>ADRV9361]] | |
| | zynq-adrv9361-z7035-fmc | [[adi>ADRV1CRR-FMC]] | the on-board [[adi>ADV7511]] and the [[adi>ADRV9361]] | |
| | zynq-adrv9361-z7035-fmc-rfcard-tdd | [[adi>ADRV1CRR-FMC]] | the on-board [[adi>ADV7511]], [[adi>ADRV9361]] and the [[adi>AD-PZSDR2400TDD-EB]] | |
| | zynq-adrv9364-z7020-bob | [[adi>ADRV1CRR-BOB]] | [[adi>ADRV9364]] | |
| | zynq-adrv9364-z7020-bob-cmos | [[adi>ADRV1CRR-BOB]] | [[adi>ADRV9364]] | |
| | zynq-adrv9364-z7020-packrf | [[adi>ADRV-PACKRF]] | [[adi>ADRV9364]] | |
| | zynq-coraz7s | [[https://digilent.com/reference/programmable-logic/cora-z7/start|cora-z7]] | |
| | zynq-mini-itx-adv7511 | [[http://zedboard.org/product/mini-itx-board|Mini-ITX]] | the on-board [[adi>ADV7511]] | |
| | zynq-mini-itx-adv7511-ad9361-fmcomms2-3 | [[http://zedboard.org/product/mini-itx-board|Mini-ITX]] | on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms2-ebz|AD-FMCOMMS2-EBZ]] or [[/resources/eval/user-guides/ad-fmcomms3-ebz|AD-FMCOMMS3-EBZ]] board | |
| | zynq-mini-itx-adv7511-ad9364-fmcomms4 | [[http://zedboard.org/product/mini-itx-board|Mini-ITX]] | the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms4-ebz|AD-FMCOMMS4-EBZ]] board | |
| | zynq-zc702-adv7511 | [[xilinx>ZC702]] | the on-board [[adi>ADV7511]] | |
| | zynq-zc702-adv7511-ad9361-fmcomms2-3 | [[xilinx>ZC702]] | the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms2-ebz|AD-FMCOMMS2-EBZ]] or [[/resources/eval/user-guides/ad-fmcomms3-ebz|AD-FMCOMMS3-EBZ]] board | |
| | zynq-zc702-adv7511-ad9361-fmcomms5 | [[xilinx>ZC702]] | the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms5-ebz|AD-FMCOMMS5-EBZ]] | |
| | zynq-zc702-adv7511-ad9364-fmcomms4 | [[xilinx>ZC702]] | the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms4-ebz|AD-FMCOMMS4-EBZ]] board | |
| | zynq-zc706-adv7511 | [[xilinx>ZC706]] | the on-board [[adi>ADV7511]] | |
| | zynq-zc706-adv7511-ad6676-fmc | [[xilinx>ZC706]] | the on-board [[adi>ADV7511]] and the [[/resources/eval/ad6676-wideband_rx_subsystem_ad6676ebz|AD6676-FMC-EBZ]] board | |
| | zynq-zc706-adv7511-ad9265-fmc-125ebz | [[xilinx>ZC706]] | the on-board [[adi>ADV7511]] and the [[/resources/fpga/xilinx/fmc/ad9265|AD9265-FMC-125EBZ]] board | |
| | zynq-zc706-adv7511-ad9361-fmcomms2-3 | [[xilinx>ZC706]] | the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms2-ebz|AD-FMCOMMS2-EBZ]] or [[/resources/eval/user-guides/ad-fmcomms3-ebz|AD-FMCOMMS3-EBZ]] board | |
| | zynq-zc706-adv7511-ad9361-fmcomms5 | [[xilinx>ZC706]] | the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms5-ebz|AD-FMCOMMS5-EBZ]] board | |
| | zynq-zc706-adv7511-ad9361-fmcomms5-ext-lo-adf5355 | [[xilinx>ZC706]] | the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms5-ebz|AD-FMCOMMS5-EBZ]] board | |
| | zynq-zc706-adv7511-ad9364-fmcomms4 | [[xilinx>ZC706]] | the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms4-ebz|AD-FMCOMMS4-EBZ]] board | |
| | zynq-zc706-adv7511-ad9434-fmc-500ebz | [[xilinx>ZC706]] | the on-board [[adi>ADV7511]] and the [[/resources/fpga/xilinx/fmc/ad9434|AD9434-FMC-500EBZ]] board | |
| | zynq-zc706-adv7511-ad9625-fmcadc2 | [[xilinx>ZC706]] | the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcdaq2-ebz|AD-FMCADC2-EBZ]] board | |
| | zynq-zc706-adv7511-ad9739a-fmc | [[xilinx>ZC706]] | the on-board [[adi>ADV7511]] and the [[adi>EVAL-AD9739A]] | |
| | zynq-zc706-adv7511-adrv9371 | [[xilinx>ZC706]] | the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/mykonos|ADRV9371]] board | |
| | zynq-zc706-adv7511-adrv9375 | [[xilinx>ZC706]] | the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/mykonos|ADRV9375]] board | |
| | zynq-zc706-adv7511-fmcadc4 | [[xilinx>ZC706]] | the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcadc4-ebz|AD-FMCADC4-EBZ]] board | |
| | zynq-zc706-adv7511-fmcdaq2 | [[xilinx>ZC706]] | the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcdaq2-ebz|AD-FMCDAQ2-EBZ]] board | |
| | zynq-zc706-adv7511-fmcdaq3 | [[xilinx>ZC706]] | the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcdaq3-ebz|AD-FMCDAQ3-EBZ]] board | |
| | zynq-zc706-adv7511-fmcjesdadc1 | [[xilinx>ZC706]] | the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcjesdadc1-ebz|AD-FMCJESDADC1-EBZ]] board | |
| | zynq-zc706-imageon | [[xilinx>ZC706]] | FMC-IMAGEON | |
| | zynq-zed-adv7511 | [[http://zedboard.org/product/zedboard|Zed Board]] | the on-board [[adi>ADV7511]] | |
| | zynq-zed-adv7511-ad9361-fmcomms2-3 | [[http://zedboard.org/product/zedboard|Zed Board]] | the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms2-ebz|AD-FMCOMMS2-EBZ]] or [[/resources/eval/user-guides/ad-fmcomms3-ebz|AD-FMCOMMS3-EBZ]] board | |
| | zynq-zed-adv7511-ad9364-fmcomms4 | [[http://zedboard.org/product/zedboard|Zed Board]] | the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms4-ebz|AD-FMCOMMS4-EBZ]] board | |
| | zynq-zed-adv7511-ad9467-fmc-250ebz | [[http://zedboard.org/product/zedboard|Zed Board]] | the on-board [[adi>ADV7511]] and the [[/resources/eval/ad9467-fmc-250ebz|AD9467-FMC-250EBZ]] board | |
| | zynq-zed-adv7511-cn0363 | [[http://zedboard.org/product/zedboard|Zed Board]] | the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/eval-cn0363-pmdz|EVAL-CN0363-PMDZ]] board | |
| | zynq-zed-imageon | [[http://zedboard.org/product/zedboard|Zed Board]] | FMC-IMAGEON | |
| |
| zynq-zc702-adv7511-ad9361-fmcomms2-3.dts | [[xilinx>ZC702]], the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms2-ebz|AD-FMCOMMS2-EBZ]] or [[/resources/eval/user-guides/ad-fmcomms3-ebz|AD-FMCOMMS3-EBZ]] board | | Building the device tree uses 'make' by turning the .dts file to a .dtb. The command is simply 'make' plus the device tree name with a .dtb file extension. |
| zynq-zc702-adv7511-ad9361-fmcomms5.dts | [[xilinx>ZC702]], the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms5-ebz|AD-FMCOMMS5-EBZ]] | | |
| zynq-zc702-adv7511-ad9364-fmcomms4.dts | [[xilinx>ZC702]], the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms4-ebz|AD-FMCOMMS4-EBZ]] board | | |
| zynq-zc706-adv7511-ad9361-fmcomms2-3.dts | [[xilinx>ZC706]], the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms2-ebz|AD-FMCOMMS2-EBZ]] or [[/resources/eval/user-guides/ad-fmcomms3-ebz|AD-FMCOMMS3-EBZ]] board | | |
| zynq-zc706-adv7511-ad9361-fmcomms2-3-pr.dts | [[xilinx>ZC706]], the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms2-ebz|AD-FMCOMMS2-EBZ]] or [[/resources/eval/user-guides/ad-fmcomms3-ebz|AD-FMCOMMS3-EBZ]] board | | |
| zynq-zc706-adv7511-ad9361-fmcomms5.dts | [[xilinx>ZC706]], the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms5-ebz|AD-FMCOMMS5-EBZ]] board | | |
| zynq-zc706-adv7511-ad9364-fmcomms4.dts | [[xilinx>ZC706]], the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms4-ebz|AD-FMCOMMS4-EBZ]] board | | |
| zynq-zc706-adv7511-ad9434-fmc-500ebz.dts | [[xilinx>ZC706]], the on-board [[adi>ADV7511]] and the [[/resources/fpga/xilinx/fmc/ad9434?s[]=ad9434&s[]=fmc&s[]=500ebz|AD9434-FMC-500EBZ]] board | | |
| zynq-zed-adv7511-ad9361-fmcomms2-3.dts | [[http://zedboard.org/product/zedboard|Zed Board]], the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms2-ebz|AD-FMCOMMS2-EBZ]] or [[/resources/eval/user-guides/ad-fmcomms3-ebz|AD-FMCOMMS3-EBZ]] board | | |
| zynq-zed-adv7511-ad9364-fmcomms4.dts | [[http://zedboard.org/product/zedboard|Zed Board]], the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms4-ebz|AD-FMCOMMS4-EBZ]] board | | |
| zynq-zed-adv7511-ad9467-fmc-250ebz.dts | [[http://zedboard.org/product/zedboard|Zed Board]], the on-board [[adi>ADV7511]] and the [[/resources/eval/ad9467-fmc-250ebz|AD9467-FMC-250EBZ]] board | | |
| zynq-mini-itx-adv7511-ad9361-fmcomms2-3.dts | [[http://zedboard.org/product/mini-itx|Mini-ITX]], the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms2-ebz|AD-FMCOMMS2-EBZ]] or [[/resources/eval/user-guides/ad-fmcomms3-ebz|AD-FMCOMMS3-EBZ]] board | | |
| zynq-mini-itx-adv7511-ad9361-fmcomms2-3-pr.dts | [[http://zedboard.org/product/mini-itx|Mini-ITX]], the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms2-ebz|AD-FMCOMMS2-EBZ]] or [[/resources/eval/user-guides/ad-fmcomms3-ebz|AD-FMCOMMS3-EBZ]] board | | |
| zynq-mini-itx-adv7511-ad9364-fmcomms4.dts | [[http://zedboard.org/product/mini-itx|Mini-ITX]], the on-board [[adi>ADV7511]] and the [[/resources/eval/user-guides/ad-fmcomms4-ebz|AD-FMCOMMS4-EBZ]] board | | |
| |
| |
<code> | <code> |
| |
==== Copy the generated files to your SD Card ==== | ==== Copy the generated files to your SD Card ==== |
| The output files for building the kernel and device tree are **uImage** and **<device_tree_name>.dtb**. Refer to the code below to find their respective output directories. Take note that the device tree file needs to be renamed to **devicetree.dtb**. See [[:resources:tools-software:linux-software:kuiper-linux]] for more information in configuring the SD card. |
<code> | <code> |
dave@hal9000:~/github-linux-build/linux$ cp arch/arm/boot/uImage /media/BOOT/uImage | dave@hal9000:~/github-linux-build/linux$ cp arch/arm/boot/uImage /media/BOOT/uImage |