├── README.md ├── licenses ├── LICENSE.MIT ├── Petalinux_EULA.txt └── Third_Party_Software_EULA.tar.xz ├── scripts ├── bash │ ├── livetool_setup.sh │ └── petalinux-env-check ├── libs │ ├── bitbake_utils.py │ ├── boot_common.py │ ├── boot_jtag.py │ ├── boot_qemu.py │ ├── common_utils.py │ ├── config_component.py │ ├── create_component.py │ ├── examples.py │ ├── gen_bootbin.py │ ├── gen_downloadbit.py │ ├── gen_mbbootbin.py │ ├── logger_setup.py │ ├── package_boot.py │ ├── package_bsp.py │ ├── package_common.py │ ├── package_prebuilt.py │ ├── package_sysroot.py │ ├── package_wic.py │ ├── plnx_utils.py │ └── plnx_vars.py ├── petalinux-boot ├── petalinux-build ├── petalinux-config ├── petalinux-create ├── petalinux-devtool ├── petalinux-package ├── petalinux-upgrade └── petalinux-util ├── settings.csh ├── settings.sh └── templates ├── apps ├── template-autoconf │ ├── .gdbinit │ ├── @appname@.bb │ ├── README │ └── files │ │ └── @appname@ │ │ ├── AUTHORS │ │ ├── ChangeLog │ │ ├── Makefile.am │ │ ├── NEWS │ │ ├── README │ │ ├── THANKS │ │ ├── configure.ac │ │ ├── doc │ │ ├── @appname@.man │ │ └── Makefile.am │ │ └── src │ │ ├── @appname@.c │ │ └── Makefile.am ├── template-c++ │ ├── .gdbinit │ ├── @appname@.bb │ ├── README │ └── files │ │ ├── @appname@.cpp │ │ └── Makefile ├── template-c │ ├── .gdbinit │ ├── @appname@.bb │ ├── README │ └── files │ │ ├── @appname@.c │ │ └── Makefile ├── template-dfx_dtg_versal_full │ ├── @appname@.bb │ └── README ├── template-dfx_dtg_versal_partial │ ├── @appname@.bb │ └── README ├── template-dfx_dtg_versal_static │ ├── @appname@.bb │ └── README ├── template-dfx_dtg_zynq_full │ ├── @appname@.bb │ └── README ├── template-dfx_dtg_zynqmp_full │ ├── @appname@.bb │ └── README ├── template-dfx_dtg_zynqmp_partial │ ├── @appname@.bb │ └── README ├── template-dfx_dtg_zynqmp_static │ ├── @appname@.bb │ └── README ├── template-dfx_user_dts │ ├── @appname@.bb │ └── README ├── template-install │ ├── .gdbinit │ ├── @appname@.bb │ ├── README │ └── files │ │ └── @appname@ └── template-source │ ├── .gdbinit │ ├── Kconfig │ ├── Makefile │ └── README ├── modules └── template-c │ ├── @modname@.bb │ ├── README │ └── files │ ├── @modname@.c │ ├── COPYING │ └── Makefile └── project ├── common └── project-spec │ └── meta-user │ ├── COPYING.MIT │ ├── README │ ├── conf │ ├── layer.conf │ ├── petalinuxbsp.conf │ └── user-rootfsconfig │ ├── meta-xilinx-tools │ └── recipes-bsp │ │ └── uboot-device-tree │ │ ├── files │ │ └── system-user.dtsi │ │ └── uboot-device-tree.bbappend │ ├── recipes-bsp │ ├── device-tree │ │ ├── device-tree-sdt.inc │ │ ├── device-tree.bbappend │ │ └── files │ │ │ └── system-user.dtsi │ └── u-boot │ │ ├── files │ │ ├── bsp.cfg │ │ └── platform-top.h │ │ └── u-boot-xlnx_%.bbappend │ └── recipes-kernel │ └── linux │ ├── linux-xlnx │ └── bsp.cfg │ └── linux-xlnx_%.bbappend ├── template-microblaze └── project-spec │ ├── attributes │ ├── configs │ ├── config │ └── rootfs_config │ └── hw-description │ └── metadata ├── template-versal-net └── project-spec │ ├── attributes │ ├── configs │ ├── config │ └── rootfs_config │ └── hw-description │ └── metadata ├── template-versal └── project-spec │ ├── attributes │ ├── configs │ ├── config │ └── rootfs_config │ ├── hw-description │ └── metadata │ └── meta-user │ └── recipes-bsp │ └── u-boot │ └── files │ └── 0001-xilinx_versal.h-ubifs-distroboot-support.patch ├── template-zynq └── project-spec │ ├── attributes │ ├── configs │ ├── config │ └── rootfs_config │ ├── hw-description │ └── metadata │ └── meta-user │ └── recipes-bsp │ └── u-boot │ └── files │ └── bsp.cfg └── template-zynqMP └── project-spec ├── attributes ├── configs ├── config └── rootfs_config ├── hw-description └── metadata └── meta-user └── recipes-bsp └── u-boot └── files └── 0001-ubifs-distroboot-support.patch /README.md: -------------------------------------------------------------------------------- 1 | # PetaLinux 2 | PetaLinux CMD utils and Templates. 3 | 4 | ## PetaLinux Live Tool Setup 5 | When PetaLinux Tool installed On Shared Location and want to update PetaLinux util scripts, 6 | use the livetool_setup.sh script to use the PetaLinux Repo as local Tool. 7 | This will map the Buildtools, trim-xsct and other dependencies as simbolic links from PetaLinux installed area. 8 | ``` 9 | ./scripts/bash/livetool_setup.sh 10 | ``` 11 | 12 | ## Maintainers, Patches/Submissions, Community 13 | 14 | Please open pull requests for any changes. 15 | 16 | For more details follow the AMD community patch submission guidelines, as described in: 17 | https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842172/Create+and+Submit+a+Patch 18 | 19 | > **Note:** When creating patches, please use below format. To follow best practice, 20 | > if you have more than one patch use `--cover-letter` option while generating the 21 | > patches. Edit the 0000-cover-letter.patch and change the title and top of the 22 | > body as appropriate. 23 | 24 | **Syntax:** 25 | `git format-patch -s --subject-prefix="PETALINUX][][PATCH" -1` 26 | 27 | **Example:** 28 | `git format-patch -s --subject-prefix="PETALINUX][xlnx_rel_v2024.1][PATCH" -1` 29 | 30 | **Submit your patch:** 31 | Send the email patch to git@amd.com for review and incorporation back into the Git tree. 32 | `git send-email --to git@amd.com *.patch` 33 | 34 | **Maintainers:** 35 | 36 | Varalaxmi Bingi 37 | Raju Kumar Pothuraju 38 | Swagath Gadde 39 | Ashwini Lomate 40 | 41 | 42 | > **Note:** We have Limited support from AMD or Technical Support Team for any custom modifications 43 | > done to the released scripts or templates. 44 | -------------------------------------------------------------------------------- /licenses/LICENSE.MIT: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining a 2 | copy of this software and associated documentation files (the 3 | "Software"), to deal in the Software without restriction, including 4 | without limitation the rights to use, copy, modify, merge, publish, 5 | distribute, sublicense, and/or sell copies of the Software, and to 6 | permit persons to whom the Software is furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included 9 | in all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 12 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 13 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 14 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 15 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 16 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 17 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | Note: 20 | Individual files contain the following tag instead of the full license text. 21 | 22 | SPDX-License-Identifier: MIT 23 | 24 | This enables machine processing of license information based on the 25 | SPDX License Identifiers that are here available: 26 | -------------------------------------------------------------------------------- /licenses/Petalinux_EULA.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xilinx/PetaLinux/44644a911c4ee47be5a3ed412c154126b1bc4ea8/licenses/Petalinux_EULA.txt -------------------------------------------------------------------------------- /licenses/Third_Party_Software_EULA.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xilinx/PetaLinux/44644a911c4ee47be5a3ed412c154126b1bc4ea8/licenses/Third_Party_Software_EULA.tar.xz -------------------------------------------------------------------------------- /scripts/bash/livetool_setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (C) 2021-2022, Xilinx, Inc. All rights reserved. 4 | # Copyright (C) 2022-2024, Advanced Micro Devices, Inc. All rights reserved. 5 | # 6 | # SPDX-License-Identifier: MIT 7 | # 8 | # DESCRIPTION: 9 | # This script helps to setup the live tool when you have a pre installed tool 10 | # and want to do some updates on the scripts. 11 | # 12 | # cp livetool_setup.sh / 13 | # cd PetaLinux_repo/ 14 | # ./scripts/bash/livetool_setup.sh 15 | # Example: 16 | # ./scripts/bash/livetool_setup.sh /opt/PetaLinuxTool/ 17 | # 18 | 19 | PetaLinuxRepo=`pwd` 20 | PetaLinuxTool="$1" 21 | 22 | if [ -z $PetaLinuxTool ] || [ ! -e $PetaLinuxTool ]; then 23 | echo "ERROR: Please Specify valid PetaLinux Tool Dir $PetaLinuxTool" 24 | exit 255 25 | fi 26 | 27 | LINK_DIRS="components/yocto components/xsct \ 28 | .environment-setup-x86_64-petalinux-linux sysroots \ 29 | " 30 | 31 | echo "INFO: Unlinking existing tool links if any" 32 | for Dir in $LINK_DIRS; do 33 | if [ -L "$PetaLinuxRepo/$Dir" ]; then 34 | unlink "$PetaLinuxRepo/$Dir" 35 | fi 36 | done 37 | echo "INFO: Unlinking Done" 38 | 39 | 40 | echo "INFO: Linking the components" 41 | for Dir in $LINK_DIRS; do 42 | Input=${Dir%%:*} 43 | Output=${Dir##*:} 44 | if [ -e $PetaLinuxTool/$Input ]; then 45 | if [ ! -d $(dirname $Output) ]; then 46 | mkdir -p $(dirname $Output) 47 | fi 48 | ln -s $PetaLinuxTool/$Input $PetaLinuxRepo/$Output 49 | fi 50 | done 51 | echo "INFO: Linking Done" 52 | 53 | 54 | -------------------------------------------------------------------------------- /scripts/bash/petalinux-env-check: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (C) 2021-2022, Xilinx, Inc. All rights reserved. 4 | # Copyright (C) 2022-2024, Advanced Micro Devices, Inc. All rights reserved. 5 | # 6 | # SPDX-License-Identifier: MIT 7 | 8 | COMMON_TOOLS="bash 9 | gcc:7 10 | xterm 11 | autoconf 12 | libtool 13 | python3 14 | tar 15 | tail 16 | less 17 | rsync 18 | bc" 19 | 20 | UBUNTU_TOOLS=" 21 | texinfo 22 | zlib1g-dev 23 | gcc-multilib 24 | lsb_release 25 | build-essential" 26 | 27 | CENTOS_TOOLS=" 28 | perl 29 | zlib-devel 30 | cpp 31 | gcc-c++ 32 | glibc-devel 33 | texinfo 34 | automake 35 | glib2-devel" 36 | 37 | ALMALINUX_TOOLS="$CENTOS_TOOLS" 38 | 39 | SUSE_TOOLS="$CENTOS_TOOLS 40 | lsb_release" 41 | 42 | NEEDED_HEADERS="zlib.h ncurses.h" 43 | 44 | UBUNTUVERSIONS="20.04.2 20.04.3 \ 45 | 20.04.4 20.04.5 20.04.6 22.04 \ 46 | 22.04.1 22.04.2 22.04.3" 47 | 48 | SUSEVERSIONS="15.3 15.4" 49 | 50 | ALMALINUXVERSIONS="8.7 9.1" 51 | 52 | function find_dist { 53 | Dist=$(lsb_release -i 2>/dev/null) 54 | if [ ! -z "$Dist" ]; then 55 | IFS=':' read -ra List <<<"$Dist" #Convert string to array 56 | IFS=' ' read -ra List <<<"${List[1]}" #Convert string to array 57 | Dist=$(echo ${List[0]} | tr -d ' ') 58 | else 59 | Dist=$(cat /etc/os-release | grep "^NAME" | cut -d '"' -f 2 | tr -d ' ' 2>/dev/null) 60 | fi 61 | echo "$Dist" 62 | } 63 | 64 | function find_release { 65 | OS_TYPE=$1 66 | if [ $OS_TYPE = "Ubuntu" ]; then 67 | release=$(lsb_release -d 2>/dev/null) 68 | IFS=':' read -ra List <<<"$release" #Convert string to array 69 | release=$(echo "${List[1]}" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') 70 | [ -z "${release}" ] && release=$(echo "${List[1]}" | grep -oE '[0-9]+\.[0-9]+') 71 | elif [ $OS_TYPE = "openSUSELeap" ] || [ $OS_TYPE = "openSUSE" ]; then 72 | release=$(lsb_release -r 2>/dev/null) 73 | IFS=':' read -ra List <<<"$release" #Convert string to array 74 | release=$(echo "${List[1]}" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') 75 | [ -z "${release}" ] && release=$(echo "${List[1]}" | grep -oE '[0-9]+\.[0-9]+') 76 | else 77 | release=$(grep -oE '[0-9]+\.[0-9]+' /etc/redhat-release 2>/dev/null) 78 | fi 79 | echo "$release" 80 | } 81 | 82 | dpkg_check() { 83 | install_status=$(dpkg -s "$1" 2>/dev/null | grep Status | awk -F ":" '{print $2}' | awk -F " " '{print $1}') 84 | [ "$install_status" == "install" ] && return 0 || return 255 85 | } 86 | 87 | function test_tool_installed { 88 | tool=$1 89 | Dist=$(find_dist) 90 | if [ $Dist = "Ubuntu" ]; then 91 | if which ${tool} 1>/dev/null 2>/dev/null; then 92 | return 0 93 | elif dpkg_check "$tool"; then 94 | return 0 95 | fi 96 | return 255 97 | else 98 | if which ${tool} 1>/dev/null 2>/dev/null; then 99 | return 0 100 | elif rpm -qi "$tool" 1>/dev/null 2>/dev/null; then 101 | return 0 102 | fi 103 | return 255 104 | fi 105 | } 106 | 107 | function check_os { 108 | OSTYPE=$(find_dist) 109 | release=$(find_release $OSTYPE) 110 | if echo "$OSTYPE" | grep -i "ubuntu" >/dev/null; then 111 | VERSIONS=$UBUNTUVERSIONS 112 | elif echo "$OSTYPE" | grep -i "almalinux" >/dev/null; then 113 | VERSIONS=$ALMALINUXVERSIONS 114 | elif echo "$OSTYPE" | grep -i "opensuse" >/dev/null; then 115 | VERSIONS=$SUSEVERSIONS 116 | 117 | else 118 | return 1 119 | fi 120 | if ! echo $VERSIONS | grep -w $release >/dev/null; then 121 | return 1 122 | fi 123 | } 124 | 125 | 126 | function test_tool_version { 127 | local tool=$1 128 | local req_version=$2 129 | if [ -z "${version}" ]; then 130 | return 0 131 | fi 132 | local version_ins="" 133 | Dist=$(find_dist) 134 | # gcc dpkg not giving actual tool version so using --version in ubuntu also 135 | if [ $Dist = "Ubuntu" ] && [ "$tool" != "gcc" ]; then 136 | version_ins=$(dpkg -s "$tool" | grep "Version" | awk '{print $2}') 137 | else 138 | version_ins=$(${tool} --version | head -1 | awk '{print $NF}') 139 | fi 140 | act_version=$(echo $version_ins | cut -d'-' -f 1 | cut -d~ -f 1 | tr -d [a-z]) 141 | 142 | if [[ $act_version == $req_version ]]; then 143 | return 0 144 | fi 145 | local IFS=. 146 | local i ver1=($act_version) ver2=($req_version) 147 | # fill empty fields in ver1 with zeros 148 | for ((i = ${#ver1[@]}; i < ${#ver2[@]}; i++)); do 149 | ver1[i]=0 150 | done 151 | 152 | for ((i = 0; i < ${#ver1[@]}; i++)); do 153 | if [[ -z ${ver2[i]} ]]; then 154 | # fill empty fields in ver2 with zeros 155 | ver2[i]=0 156 | fi 157 | if ((10#${ver1[i]} > 10#${ver2[i]})); then 158 | return 0 159 | fi 160 | if ((10#${ver1[i]} < 10#${ver2[i]})); then 161 | return 255 162 | fi 163 | done 164 | return 0 165 | 166 | } 167 | 168 | function check_tools { 169 | plnx_info "Checking installed tools" 170 | Dist=$(find_dist) 171 | if [ $Dist == "Ubuntu" ]; then 172 | COMMON_TOOLS=$COMMON_TOOLS$UBUNTU_TOOLS 173 | elif [ $Dist == "AlmaLinux" ]; then 174 | COMMON_TOOLS=$COMMON_TOOLS$ALMALINUX_TOOLS 175 | elif [ $Dist = "openSUSELeap" ] || [ $Dist = "openSUSE" ]; then 176 | COMMON_TOOLS=$COMMON_TOOLS$SUSE_TOOLS 177 | 178 | fi 179 | 180 | local MISSING="" 181 | local INVALID_VERSION="" 182 | while read -r line; do 183 | local tools=${line%%:*} 184 | local version=${line##*:} 185 | if [ "${version}" == "${tools}" ]; then 186 | version="" 187 | fi 188 | local is_tool_installed="" 189 | for t in ${tools}; do 190 | if ! test_tool_installed ${t}; then 191 | continue 192 | elif ! test_tool_version ${t} ${version}; then 193 | INVALID_VERSION="${INVALID_VERSION}\n -Detected ${t} version ${act_version} is less than the expected ${version}" 194 | is_tool_installed=y 195 | break 196 | else 197 | is_tool_installed=y 198 | fi 199 | done 200 | if [ -z "${is_tool_installed}" ]; then 201 | local missing_tools=$(echo "${tools}" | tr " " "/") 202 | MISSING="${MISSING}\n - ${missing_tools}" 203 | fi 204 | done < <(echo "${COMMON_TOOLS}") 205 | 206 | local has_error="" 207 | if [ -n "${MISSING}" ]; then 208 | plnx_err "You are missing the following system tools required by PetaLinux:" 209 | echo -e $MISSING 210 | echo "Please check PetaLinux installation guide - required tools and libraries package section for detailed information" | tee -a ${INSTALL_LOG} 211 | echo "" 212 | has_error=y 213 | fi 214 | 215 | if [ -n "${INVALID_VERSION}" ]; then 216 | plnx_err "You have tools that don't meet the version requirements:" 217 | echo -e ${INVALID_VERSION} 218 | echo "" 219 | has_error=y 220 | fi 221 | 222 | if [ -z "${has_error}" ]; then 223 | return 0 224 | else 225 | return 255 226 | fi 227 | } 228 | 229 | function add_file_cleanup { 230 | CLEANUP_FILES="${CLEANUP_FILES} $*" 231 | } 232 | 233 | function do_file_cleanup { 234 | rm -rf ${CLEANUP_FILES} 235 | } 236 | 237 | function plnx_info { 238 | echo "[INFO] $@" 239 | } 240 | 241 | function plnx_err { 242 | echo "[ERROR] $@" 1>&2 243 | } 244 | 245 | function plnx_err_exit { 246 | echo "[ERROR] $@" 1>&2 247 | exit 255 248 | } 249 | 250 | function plnx_warning { 251 | echo "[WARNING] $@" 2>&1 252 | } 253 | 254 | function check_libs { 255 | plnx_info "Checking installed development libraries" 256 | local MISSING= 257 | for l in ${NEEDED_HEADERS}; do 258 | local lib_name=${l##*:} 259 | if [ "${lib_name}" == "$l" ]; then 260 | lib_name=$(basename $l .h) 261 | fi 262 | local lib_header=${l%%:*} 263 | local out=$(mktemp) || plnx_err_exit "Failed to create temp file, Temp folder is full or is inaccessible" 264 | add_file_cleanup "${out}" 265 | mv ${out} ${out}.c 266 | add_file_cleanup "${out}.c" 267 | out=${out}.c 268 | cat >${out} <<__EOF 269 | #include <${lib_header}> 270 | int main(void) 271 | { return 0; } 272 | __EOF 273 | local obj="/tmp/$$" 274 | add_file_cleanup "${obj}" 275 | gcc -o "${obj}" ${out} 2>/dev/null 1>/dev/null 276 | if [ $? != 0 ]; then 277 | MISSING="${MISSING}\n - ${lib_name}" 278 | fi 279 | rm -f "${out}" "${obj}" 280 | done 281 | 282 | if [ -n "${MISSING}" ]; then 283 | plnx_err "You are missing these development libraries required by PetaLinux:" 284 | echo -e $MISSING 285 | echo "" 286 | return 255 287 | fi 288 | 289 | return 0 290 | } 291 | 292 | function check_services { 293 | plnx_info "Checking network and other services" 294 | # In latest distro's netstat deprecated so using ss 295 | netstat_util=`which netstat` 296 | netstat_args="--numeric-hosts" 297 | if [ -z "$netstat_util" ]; then 298 | netstat_util=`which ss` 299 | netstat_args="" 300 | fi 301 | # Check for tftp 302 | if [ -n "$netstat_util" ]; then 303 | if ! $netstat_util -l $netstat_args 2>/dev/null | grep tftp 2>/dev/null 1>/dev/null; then 304 | plnx_warning "No tftp server found - please refer to \"UG1144 $PETALINUX_VER PetaLinux Tools Documentation Reference Guide\" for its impact and solution" 305 | fi 306 | fi 307 | 308 | return 0 309 | } 310 | 311 | function warn_free_space { 312 | plnx_info "Checking free disk space" 313 | 314 | DF=$(df -B 1M . | tail -1 | awk '{print $4}') 315 | 316 | if [ ${DF} -le 1024 ]; then 317 | plnx_warning "You have less than 1Gbyte free space on the installation drive" 318 | fi 319 | } 320 | 321 | trap do_file_cleanup EXIT KILL QUIT SEGV INT HUP TERM ERR 322 | 323 | check_os 324 | [ $? -ne 0 ] && plnx_warning "This is not a supported OS" 325 | 326 | warn_free_space || exit 255 327 | 328 | # Check tools and libs 329 | check_tools 330 | rc1=$? 331 | check_libs 332 | rc2=$? 333 | [ $rc1 -ne 0 -o $rc2 -ne 0 ] && echo "Please install them with your operating system package manager, and try again" && exit 255 334 | 335 | check_services || exit 255 336 | -------------------------------------------------------------------------------- /scripts/libs/config_component.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (C) 2021-2022, Xilinx, Inc. All rights reserved. 4 | # Copyright (C) 2022-2024, Advanced Micro Devices, Inc. All rights reserved. 5 | # 6 | # Author: 7 | # Raju Kumar Pothuraju 8 | # 9 | # SPDX-License-Identifier: MIT 10 | 11 | import logging 12 | import os 13 | import re 14 | import sys 15 | import bitbake_utils 16 | import plnx_utils 17 | import plnx_vars 18 | 19 | logger = logging.getLogger('PetaLinux') 20 | 21 | 22 | def config_handler(proot, fragment_path, component, logfile): 23 | '''Check if fragment.cfg exists and has contents''' 24 | '''then rename it as user-timestamp.cfg and add it into''' 25 | '''recipe file as SRC_URI''' 26 | import datetime 27 | timestamp = datetime.datetime.now().replace(second=0, microsecond=0) 28 | timestamp = str(timestamp) 29 | timestamp = timestamp.replace(' ', '-').replace(':', '-') 30 | user_fragmentcfg = 'user_%s.cfg' % timestamp 31 | 32 | if fragment_path and not fragment_path.isspace() and \ 33 | os.path.getsize(fragment_path) > 0: 34 | user_fragmentcfg_path = os.path.join( 35 | os.path.dirname(fragment_path), str(user_fragmentcfg)) 36 | plnx_utils.RenameFile(fragment_path, user_fragmentcfg_path) 37 | cmd = 'recipetool appendsrcfile -wW %s %s %s' % ( 38 | plnx_vars.MetaUserDir.format(proot), 39 | component, user_fragmentcfg_path) 40 | logger.info(cmd) 41 | bitbake_utils.run_bitbakecmd(cmd, proot, shell=True, logfile=logfile) 42 | 43 | 44 | def get_hw_file(hw_file, hw_ext, proot): 45 | '''Copy HW file into project and rename to system.xsa''' 46 | plnx_utils.RemoveDir(plnx_vars.HWDescDir.format(proot)) 47 | plnx_utils.CreateDir(plnx_vars.HWDescDir.format(proot)) 48 | plnx_utils.update_config_value('HARDWARE_PATH', hw_file, 49 | plnx_vars.MetaDataFile.format(proot)) 50 | plnx_utils.update_config_value('HDF_EXT', hw_ext, 51 | plnx_vars.MetaDataFile.format(proot)) 52 | if hw_ext == 'sdt': 53 | plnx_utils.CopyDir(os.path.dirname(hw_file), 54 | plnx_vars.HWDescDir.format(proot), 55 | exclude='*.xsa') 56 | else: 57 | plnx_utils.CopyFile(hw_file, plnx_vars.HWDescDir.format(proot)) 58 | base_filename = os.path.basename(hw_file) 59 | dest_filename = 'system.xsa' 60 | if base_filename != dest_filename: 61 | logger.info('Renaming %s to %s' % (base_filename, dest_filename)) 62 | plnx_utils.RenameFile( 63 | os.path.join(plnx_vars.HWDescDir.format(proot), base_filename), 64 | plnx_vars.DefXsaPath.format(proot)) 65 | return True 66 | 67 | 68 | def validate_hw_file(args, proot): 69 | '''Validated given HW file or directory and give error''' 70 | logger.info('Getting hardware description') 71 | if not os.path.exists(args.get_hw_description): 72 | logger.error('Unable to get "%s": No Such File or Directory' % 73 | args.get_hw_description) 74 | sys.exit(255) 75 | hw_file = [] 76 | hw_ext = '' 77 | if os.path.isfile(args.get_hw_description): 78 | hw_file.append(args.get_hw_description) 79 | elif os.path.isdir(args.get_hw_description): 80 | for _file in os.listdir(args.get_hw_description): 81 | if _file.endswith('.dts'): 82 | hw_file.append(os.path.join(args.get_hw_description, _file)) 83 | if _file.endswith('.xsa'): 84 | hw_file.append(os.path.join(args.get_hw_description, _file)) 85 | if hw_file: 86 | if len(hw_file) > 1: 87 | logger.error('More than one ".xsa/.dts" are found in %s' 88 | '\nThere should be only one .xsa/.dts file to describe the hardware' 89 | 'in the Vivado export to SDK directory.' % (args.get_hw_description)) 90 | logger.error('Please use --get-hw-description=' 91 | 'to specify the hardware file location.') 92 | sys.exit(255) 93 | import pathlib 94 | hw_file = ''.join(hw_file) 95 | hw_ext = pathlib.Path(hw_file).suffix 96 | hw_ext = ''.join(hw_ext.split('.')) 97 | if hw_ext == 'dts': 98 | hw_ext = 'sdt' 99 | old_hw_ext = plnx_utils.is_hwflow_sdt(proot) 100 | if old_hw_ext and hw_ext != old_hw_ext: 101 | logger.error('This Project was configured with "%s", you may see issues ' 102 | 'if you use the same project for "%s" flow' % ( 103 | old_hw_ext, hw_ext)) 104 | sys.exit(255) 105 | get_hw_file(hw_file, hw_ext, proot) 106 | else: 107 | logger.error('No XSA or DTS found in %s' % (args.get_hw_description)) 108 | logger.error( 109 | 'Please use --get-hw-description= to specify \ 110 | the location of Vivado export to SDK directory.') 111 | sys.exit(255) 112 | return True 113 | 114 | 115 | def config_yocto_component(proot, component, config_target, logfile): 116 | '''Config yocto components''' 117 | arch = plnx_utils.get_system_arch(proot) 118 | if component not in ('project', 'rootfs'): 119 | logger.info('Configuring: %s' % (component)) 120 | if component in plnx_vars.GUI_Components.keys(): 121 | component = plnx_vars.GUI_Components[component] 122 | if component in plnx_vars.CMD_Components.keys(): 123 | component = plnx_vars.CMD_Components[component] 124 | if component == 'bootloader': 125 | if arch == 'microblaze': 126 | component = 'virtual/fsboot' 127 | else: 128 | component = 'virtual/fsbl' 129 | bitbake_task = 'menuconfig' 130 | if config_target == 'silentconfig' or \ 131 | component in plnx_vars.CMD_Components.keys() or \ 132 | component in plnx_vars.CMD_Components.values(): 133 | bitbake_task = 'configure' 134 | bitbake_cmd = '' 135 | if component == 'virtual/kernel': 136 | bitbake_cmd = 'bitbake %s -c %s' % (component, 'cleansstate') 137 | logger.info(bitbake_cmd) 138 | bitbake_utils.run_bitbakecmd( 139 | bitbake_cmd, proot, shell=True, logfile=logfile) 140 | 141 | bitbake_cmd = 'bitbake %s -c %s' % (component, bitbake_task) 142 | logger.info(bitbake_cmd) 143 | bitbake_utils.run_bitbakecmd( 144 | bitbake_cmd, proot, shell=True, logfile=logfile) 145 | 146 | if bitbake_task == 'menuconfig': 147 | bitbake_cmd = 'bitbake %s -c %s' % (component, 'diffconfig') 148 | logger.info(bitbake_cmd) 149 | bb_tasklog = bitbake_utils.run_bitbakecmd( 150 | bitbake_cmd, proot, shell=True, logfile=logfile) 151 | lines = [] 152 | fragment_path = '' 153 | with open(bb_tasklog, 'r') as log_data: 154 | lines = log_data.readlines() 155 | for line in lines: 156 | if re.search('fragment.cfg', line): 157 | fragment_path = line.replace(' ', '').strip() 158 | config_handler(proot, fragment_path, component, logfile) 159 | if component == 'virtual/kernel': 160 | bitbake_cmd = 'bitbake %s -c %s' % (component, 'cleansstate') 161 | logger.info(bitbake_cmd) 162 | bitbake_utils.run_bitbakecmd( 163 | bitbake_cmd, proot, shell=True, logfile=logfile) 164 | return fragment_path, component 165 | -------------------------------------------------------------------------------- /scripts/libs/gen_bootbin.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (C) 2021-2022, Xilinx, Inc. All rights reserved. 4 | # Copyright (C) 2022-2024, Advanced Micro Devices, Inc. All rights reserved. 5 | # 6 | # Author: 7 | # Raju Kumar Pothuraju 8 | # 9 | # SPDX-License-Identifier: MIT 10 | 11 | import logging 12 | import os 13 | import sys 14 | import plnx_utils 15 | import plnx_vars 16 | from package_common import (AddedLinuxId, AddedSubBootId, BootFilesSeq, 17 | BootParams) 18 | 19 | logger = logging.getLogger('PetaLinux') 20 | 21 | 22 | def AddBifSubsystemId(Attribute, Value, xilinx_arch, notfile=False): 23 | ''' Bif format as per the xilinx arch 24 | For versal{-net} image file should be { attrs, file } 25 | For others image file should be [attrs] file''' 26 | string = '' 27 | if xilinx_arch in ('versal', 'versal-net'): 28 | string += '' 29 | if not notfile: 30 | Value = 'file=%s' % Value 31 | if Attribute and Value: 32 | string += '{ %s, %s }' % (Attribute, Value) 33 | elif Value: 34 | string += '{ %s }' % Value 35 | else: 36 | if Attribute and Value: 37 | string += '[%s] %s' % (Attribute, Value) 38 | elif Value: 39 | string += '%s' % Value 40 | return string 41 | 42 | 43 | def GenQemuBootImage(args, proot): 44 | ''' Generate the qemu-boot.img file for versal{-net} qemu boot''' 45 | BootBinDir = os.path.dirname(args.output) 46 | Bootscript = os.path.join(plnx_vars.BuildImagesDir.format(proot), 47 | plnx_vars.BootFileNames['BOOTSCRIPT'] 48 | ) 49 | if not os.path.isfile(Bootscript): 50 | Bootscript = os.path.join(plnx_vars.PreBuildsImagesDir.format(proot), 51 | plnx_vars.BootFileNames['BOOTSCRIPT'] 52 | ) 53 | logger.info('Generating QEMU boot images...') 54 | BootBinTmpDir = os.path.join(plnx_vars.BuildDir.format(proot), 55 | 'bootbin') 56 | plnx_utils.CreateDir(BootBinTmpDir) 57 | plnx_utils.CopyFile(args.output, os.path.join(BootBinTmpDir, 58 | plnx_vars.BootFileNames['BOOTBIN'])) 59 | logger.info('File in qemu_boot.img: %s' % args.output) 60 | plnx_utils.CopyFile(Bootscript, os.path.join(BootBinTmpDir, 61 | os.path.basename(Bootscript))) 62 | logger.info('File in qemu_boot.img: %s' % Bootscript) 63 | QemuRootfs = args.qemu_rootfs 64 | initramfs_image = plnx_utils.get_config_value( 65 | 'CONFIG_SUBSYSTEM_INITRAMFS_IMAGE_NAME', 66 | plnx_vars.SysConfFile.format(proot)) 67 | if not QemuRootfs: 68 | if initramfs_image.find('initramfs') != -1 and not QemuRootfs: 69 | QemuRootfs = os.path.join(plnx_vars.BuildImagesDir.format(proot), 70 | plnx_vars.BootFileNames['TINY_RFS_FILE']) 71 | else: 72 | QemuRootfs = os.path.join(plnx_vars.BuildImagesDir.format(proot), 73 | plnx_vars.BootFileNames['RFS_FILE']) 74 | 75 | if QemuRootfs and QemuRootfs not in ('no', 'none'): 76 | if not os.path.isabs(QemuRootfs): 77 | QemuRootfs = os.path.join(proot, QemuRootfs) 78 | 79 | if not os.path.isfile(QemuRootfs): 80 | logger.warning('Missing file %s, Specify it using ' 81 | '--qemu-rootfs ' % QemuRootfs) 82 | else: 83 | QemuRootfs = os.path.realpath(QemuRootfs) 84 | plnx_utils.CopyFile(QemuRootfs, os.path.join(BootBinTmpDir, 85 | os.path.basename(QemuRootfs))) 86 | logger.info('File in qemu_boot.img: %s' % QemuRootfs) 87 | 88 | plnx_utils.check_tool('mkfatimg') 89 | MkFatCmd = 'mkfatimg %s %s %s' % (BootBinTmpDir, 90 | os.path.join( 91 | BootBinDir, 'qemu_boot.img'), 92 | '262144') 93 | plnx_utils.runCmd(MkFatCmd, os.getcwd(), shell=True) 94 | plnx_utils.RemoveDir(BootBinTmpDir) 95 | 96 | 97 | def RunBootGen(biffile, args, proot): 98 | ''' Run bootgen command with given biffile path ''' 99 | logger.info('Generating %s binary package %s...' % ( 100 | args.xilinx_arch, os.path.basename(args.output)) 101 | ) 102 | extra_bootargs = '' 103 | bootgen_arch = args.xilinx_arch.replace('-', '') 104 | if args.xilinx_arch in ('versal', 'versal-net'): 105 | extra_bootargs = '-w -dump bh' 106 | if args.bootgen_extra_args: 107 | extra_bootargs += ' %s' % args.bootgen_extra_args 108 | BootGenCmd = 'bootgen -arch %s -image %s -o %s %s' % ( 109 | bootgen_arch, biffile, 110 | args.output, extra_bootargs) 111 | stdout = plnx_utils.runCmd(BootGenCmd, os.getcwd(), 112 | failed_msg='Fail to create BOOT image', shell=True) 113 | logger.info(''.join(stdout)) 114 | if args.xilinx_arch in ('versal', 'versal-net') and \ 115 | args.format == 'BIN': 116 | GenQemuBootImage(args, proot) 117 | logger.info('Binary is ready.') 118 | 119 | 120 | def GenerateBif(args, proot): 121 | ''' Generate the Bif file fir Build Images ''' 122 | global AddedSubBootId 123 | global AddedLinuxId 124 | # Parse BootParams to create Bif file 125 | bif_content = '%s:\n{\n' % plnx_vars.BifImagePrefix 126 | for File in BootFilesSeq[args.xilinx_arch]: 127 | FilteredFiles = [key for key in BootParams.keys() 128 | if key.startswith(File)] 129 | for File in FilteredFiles: 130 | File_Attr_ = '' 131 | File_content = '' 132 | if BootParams[File].get('FileAttribute'): 133 | File_Attr_ += BootParams[File].get('FileAttribute') 134 | if args.xilinx_arch == 'zynqmp' and \ 135 | File_Attr_.find('bootloader') == '-1': 136 | File_Attr_ = '%s, destination_cpu=a53-0' % File_Attr_ 137 | else: 138 | if args.xilinx_arch == 'zynqmp' and \ 139 | File_Attr_.find('bootloader') == '-1': 140 | File_Attr_ += 'destination_cpu=a53-0' 141 | if BootParams[File].get('Cpu'): 142 | DestCpu = 'destination_cpu=%s' % BootParams[File].get( 143 | 'Cpu') 144 | if args.xilinx_arch in ('versal', 'versal-net'): 145 | DestCpu = 'core=%s' % BootParams[File].get('Cpu') 146 | Tmp_Attr_ = '' 147 | if File_Attr_.find('destination_cpu=') != -1 or \ 148 | File_Attr_.find('core=') != -1: 149 | for _Attr in File_Attr_.split(','): 150 | if _Attr.find('destination_cpu=') != -1 or \ 151 | _Attr.find('core=') != -1: 152 | Tmp_Attr_ += ', %s' % DestCpu 153 | else: 154 | Tmp_Attr_ += ', %s' % _Attr 155 | File_Attr_ = ' '.join(Tmp_Attr_.split()) 156 | else: 157 | File_Attr_ += ', %s' % DestCpu 158 | if BootParams[File].get('Offset'): 159 | offset = BootParams[File].get('Offset') 160 | if File_Attr_: 161 | File_Attr_ += ', offset=%s' % offset 162 | else: 163 | File_Attr_ += 'offset=%s' % offset 164 | if BootParams[File].get('Load'): 165 | load = BootParams[File].get('Load') 166 | if File_Attr_: 167 | File_Attr_ += ', load=%s' % load 168 | else: 169 | File_Attr_ += 'load=%s' % load 170 | if args.xilinx_arch in ('versal', 'versal-net') and \ 171 | BootParams[File].get('AddBootId'): 172 | if not AddedSubBootId: 173 | AddedSubBootId = True 174 | bif_content += 'image {\n' 175 | elif args.xilinx_arch in ('versal', 'versal-net'): 176 | if not AddedLinuxId: 177 | AddedLinuxId = True 178 | if AddedSubBootId: 179 | bif_content += '\n}' 180 | bif_content += '\nimage {\n' 181 | bif_content += '\tid = 0x1c000000, name=apu_subsystem\n' 182 | 183 | if BootParams[File].get('Path'): 184 | FilePath = BootParams[File].get('Path') 185 | if not os.path.isabs(FilePath): 186 | FilePath = os.path.join(proot, FilePath) 187 | plnx_utils.CheckFileExists( 188 | FilePath, 'Failed to generate BIF file, ') 189 | File_content = AddBifSubsystemId( 190 | File_Attr_.strip(',').strip(), 191 | FilePath, args.xilinx_arch) 192 | logger.info('File in BOOT BIN: "%s"' % FilePath) 193 | if BootParams[File].get('BifAttr'): 194 | File_Attr_ += BootParams[File].get('BifAttr') 195 | if BootParams[File].get('Value'): 196 | logger.info('Adding Bif Attribute %s' % File_Attr_) 197 | File_content = AddBifSubsystemId( 198 | File_Attr_, 199 | BootParams[File].get('Value'), 200 | args.xilinx_arch, notfile=True 201 | ) 202 | 203 | bif_content += '\t%s\n' % File_content 204 | if args.fsblconfig: 205 | logger.info('Adding fsbl_config %s' % args.fsblconfig) 206 | bif_content += '\t[fsbl_config] %s\n' % args.fsblconfig 207 | bif_content += '}\n' 208 | if args.xilinx_arch in ('versal', 'versal-net'): 209 | bif_content += '}\n' 210 | logger.debug(bif_content) 211 | plnx_utils.RemoveFile(plnx_vars.BifFile.format(proot)) 212 | plnx_utils.CreateFile(plnx_vars.BifFile.format(proot)) 213 | plnx_utils.add_str_to_file(plnx_vars.BifFile.format(proot), 214 | bif_content) 215 | RunBootGen(plnx_vars.BifFile.format(proot), args, proot) 216 | -------------------------------------------------------------------------------- /scripts/libs/gen_downloadbit.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (C) 2021-2022, Xilinx, Inc. All rights reserved. 4 | # Copyright (C) 2022-2024, Advanced Micro Devices, Inc. All rights reserved. 5 | # 6 | # Author: 7 | # Raju Kumar Pothuraju 8 | # 9 | # SPDX-License-Identifier: MIT 10 | 11 | import logging 12 | import os 13 | import re 14 | import sys 15 | import package_common 16 | import plnx_utils 17 | import plnx_vars 18 | from package_common import BootParams 19 | 20 | logger = logging.getLogger('PetaLinux') 21 | 22 | 23 | def CreateDownloadbit(args, proot, download_bit_out): 24 | ''' Creating DOWNLOAD.BIT file ''' 25 | if not BootParams.get('FSBL'): 26 | logger.warning('You have specified no for First Stage Bootloader, ' 27 | 'we will not add bootloader to block RAM') 28 | return 0 29 | FsblFile = BootParams['FSBL'].get('Path') 30 | if not os.path.isfile(FsblFile): 31 | logger.error('Specified or Default First Stage Bootloader ' 32 | 'not found. Use "--fsbl" option to specify one.') 33 | sys.exit(255) 34 | if not BootParams.get('FPGA'): 35 | logger.error('Failed to generate download.bit file ' 36 | 'because no bitstream file is specified') 37 | sys.exit(255) 38 | SystemBitFile = BootParams['FPGA']['Path'] 39 | download_bit_prefix = 'DOWNLOAD_BIT_image_CONTENT' 40 | package_common.CheckOutFile(download_bit_out, args.force) 41 | plnx_utils.check_tool('updatemem', 42 | 'Please source Xilinx Tools settings first.') 43 | if args.mmi: 44 | mmi_filename = args.mmi 45 | else: 46 | mmi_filename = plnx_utils.GetFileFromXsa(proot, bootfile_ext='mmi') 47 | if not mmi_filename: 48 | logger.error('Unable to find file with mmi TYPE in HW file') 49 | sys.exit(255) 50 | mmi_filepath = os.path.join(plnx_vars.HWDescDir.format(proot), 51 | mmi_filename) 52 | if not os.path.isfile(mmi_filepath): 53 | logger.warning('Default MMI file not found') 54 | logger.warning('Auto Detecting MMI file from %s' % 55 | os.path.dirname(SystemBitFile)) 56 | import glob 57 | mmi_filepath = glob.glob(os.path.join(os.path.dirname(SystemBitFile), 58 | '*.mmi'))[0] 59 | if not os.path.isfile(mmi_filepath): 60 | logger.error( 61 | 'Failed to detect MMI file, please use --mmi to specify one') 62 | sys.exit(255) 63 | logger.info('Creating download.bit') 64 | logger.info('Fpga bitstream: %s' % SystemBitFile) 65 | logger.info('Fpga bitstream %s file: %s' % ('MMI', mmi_filepath)) 66 | logger.info('Fsbl file: %s' % FsblFile) 67 | logger.info('Output download.bit: %s' % download_bit_out) 68 | if args.updatemem_extra_args: 69 | logger.info('Updatemem Extra Args: %s' % (args.updatemem_extra_args)) 70 | proc_ipname = plnx_utils.get_config_value( 71 | plnx_vars.ProcConfs['Prefix'] + 72 | '_', plnx_vars.SysConfFile.format(proot), 73 | 'choice', plnx_vars.ProcConfs['Select']) 74 | proc_ipindex = plnx_utils.get_config_value( 75 | plnx_vars.ProcConfs['Prefix'], plnx_vars.SysConfFile.format(proot), 76 | 'choice', '%s="%s"' % (plnx_vars.ProcConfs['IpName'], 77 | proc_ipname) 78 | ) 79 | proc_inst_name = plnx_utils.get_config_value( 80 | '%s%s%s' % (plnx_vars.ProcConfs['Prefix'], proc_ipindex, 81 | plnx_vars.ProcConfs['InstanceName']), 82 | plnx_vars.SysConfFile.format(proot) 83 | ) 84 | updatemem_cmd = 'updatemem -meminfo %s -bit %s -data %s \ 85 | -proc %s %s -out %s' % (mmi_filepath, SystemBitFile, 86 | FsblFile, proc_inst_name, args.updatemem_extra_args, 87 | download_bit_out) 88 | stdout, stderr = plnx_utils.runCmd(updatemem_cmd, 89 | plnx_vars.BuildDir.format(proot), shell=True) 90 | if re.search('Usage:', stdout) or re.search('ERROR:', stdout): 91 | logger.error(stdout) 92 | logger.error(stderr) 93 | logger.error('Unable to perform updatemem') 94 | logger.error( 95 | 'Failed to create download bit file for MicroBlaze %s file.' % args.format) 96 | sys.exit(255) 97 | 98 | return 99 | -------------------------------------------------------------------------------- /scripts/libs/gen_mbbootbin.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (C) 2021-2022, Xilinx, Inc. All rights reserved. 4 | # Copyright (C) 2022-2024, Advanced Micro Devices, Inc. All rights reserved. 5 | # 6 | # Author: 7 | # Raju Kumar Pothuraju 8 | # 9 | # SPDX-License-Identifier: MIT 10 | 11 | import logging 12 | import os 13 | import shutil 14 | import sys 15 | import gen_downloadbit 16 | import plnx_utils 17 | import plnx_vars 18 | from package_common import BootParams 19 | 20 | logger = logging.getLogger('PetaLinux') 21 | 22 | 23 | def ValidateFlashSize(flash_size_arg, flash_type, flash_size): 24 | ''' Validate the Flash size between user given flash_size 25 | and auto detected flash_size ''' 26 | if not flash_size_arg: 27 | if not flash_size: 28 | flash_size = '16' 29 | logger.warning('User hasnot specified flash size, and the tool failed ' 30 | 'to detect the size of the system flash, will use the default value ' 31 | '"16 Mbytes".') 32 | else: 33 | flash_size = int(int(flash_size, base=16) / 1024 / 1024) 34 | logger.info('User hasnot specified flash size, will use the auto ' 35 | 'detected system flash size: %s MBytes.' % (flash_size)) 36 | else: 37 | flash_size = flash_size_arg 38 | if flash_size and not (1 == bin(int(flash_size)).count('1')): 39 | logger.error( 40 | 'Flash size "%s" is invalid, it should be the power of 2.' % flash_size) 41 | sys.exit(255) 42 | return flash_size 43 | 44 | 45 | def GetFlashInterface(flash_intf_arg, flash_type, flash_width, bitfile): 46 | ''' Getting Flash Interface using the bitstream file 47 | if not use the default flash as SPIx1 ''' 48 | auto_flash_intf = '' 49 | if flash_type == 'spi': 50 | auto_flash_intf = 'SPIx1' 51 | if bitfile: 52 | spi_width = '' 53 | if not shutil.which('xxd'): 54 | logger.warning( 55 | 'Failed to detect SPI width from bitstream since xxd is not in your path.') 56 | logger.warning('Using default one: %s' % auto_flash_intf) 57 | else: 58 | for i in range(24, 49): 59 | # Check the first 1024 bytes from the bitstream only 60 | spi_widthcmd = 'xxd -p -c %s -l 1024 %s' % (i, bitfile) 61 | stdout = plnx_utils.runCmd( 62 | spi_widthcmd, os.getcwd(), shell=True) 63 | for line in ''.join(stdout).splitlines(): 64 | try: 65 | line = line.decode('utf-8') 66 | except AttributeError: 67 | pass 68 | if line.upper().startswith('FFFFFFFFFFFFFFFFAA99556620000000'): 69 | n = 2 70 | spi_width_ = [(line[i:i + n]) 71 | for i in range(0, len(line), n)] 72 | if spi_width_: 73 | spi_width = '0x%s' % spi_width_[22] 74 | spi_width = int(spi_width, base=16) 75 | break 76 | if spi_width: 77 | break 78 | 79 | if spi_width == '': 80 | logger.warning( 81 | 'Failed to detect SPI width from bitstream.') 82 | logger.warning('Using default one: %s' % auto_flash_intf) 83 | elif spi_width == 0: 84 | auto_flash_intf = 'SPIx1' 85 | elif spi_width == 1: 86 | auto_flash_intf = 'SPIx2' 87 | elif spi_width == 2: 88 | auto_flash_intf = 'SPIx4' 89 | else: 90 | logger.warning( 91 | 'Unknown SPI width detected: %s.' % spi_width) 92 | logger.warning('Using default one: %s' % auto_flash_intf) 93 | elif flash_type == 'parallel': 94 | if flash_width in ('8', '16'): 95 | auto_flash_intf = 'BPIx%s' % flash_width 96 | else: 97 | logger.warning( 98 | 'Auto detect: Unsupported parallel system flash width: %s.' % flash_width) 99 | if flash_intf_arg: 100 | if flash_intf_arg not in ('SERIALx1', 'SPIx1', 'SPIx2', 101 | 'SPIx4', 'SPIx8', 'BPIx8', 'BPIx16', 102 | 'SMAPx8', 'SMAPx16', 'SMAPx32'): 103 | logger.error( 104 | 'Unsupported user specified flash interface: %s' % flash_intf_arg) 105 | sys.exit(255) 106 | if auto_flash_intf and flash_intf_arg != auto_flash_intf: 107 | logger.warning('User specified Flash interface %s is different to the ' 108 | 'auto detected one %s. Will use the user specified one.' % ( 109 | flash_intf_arg, auto_flash_intf)) 110 | return flash_intf_arg 111 | elif auto_flash_intf: 112 | logger.info( 113 | 'User hasnot specified flash interface, will use the auto detected one %s' % auto_flash_intf) 114 | return auto_flash_intf 115 | else: 116 | logger.warning('User hasnot specified flash interface, and failed to detect ' 117 | 'it from system flash settings, will use the default one %s.' % auto_flash_intf) 118 | return auto_flash_intf 119 | 120 | 121 | def CreateMBBootBin(args, proot): 122 | ''' Creating MCS/BIN file for Microblaze ''' 123 | download_bit_out = os.path.join(os.path.dirname(args.output), 124 | 'download.bit') 125 | gen_downloadbit.CreateDownloadbit(args, proot, download_bit_out) 126 | BootParams['FPGA']['Path'] = download_bit_out 127 | # Read the offsets if flash select from flash_info.txt(generated from sysconfig) 128 | if not os.path.isfile(plnx_vars.HsmOutFile.format(proot)): 129 | plnx_utils.CreateFile(plnx_vars.HsmOutFile.format(proot)) 130 | flash_type = plnx_utils.get_config_value('flash_type', 131 | plnx_vars.HsmOutFile.format(proot) 132 | ) 133 | flash_width = plnx_utils.get_config_value('flash_width', 134 | plnx_vars.HsmOutFile.format( 135 | proot) 136 | ) 137 | flash_size = plnx_utils.get_config_value('flash_size', 138 | plnx_vars.HsmOutFile.format(proot) 139 | ) 140 | fpga_prop = plnx_utils.get_config_value('fpga', 141 | plnx_vars.HsmOutFile.format(proot) 142 | ) 143 | uboot_prop = plnx_utils.get_config_value('boot', 144 | plnx_vars.HsmOutFile.format(proot) 145 | ) 146 | kernel_prop = plnx_utils.get_config_value('kernel', 147 | plnx_vars.HsmOutFile.format( 148 | proot) 149 | ) 150 | jffs2_prop = plnx_utils.get_config_value('jffs2', 151 | plnx_vars.HsmOutFile.format(proot) 152 | ) 153 | flash_size = ValidateFlashSize(args.flash_size, flash_type, flash_size) 154 | flash_intf = GetFlashInterface(args.flash_intf, flash_type, 155 | flash_width, BootParams['FPGA'].get('Path')) 156 | 157 | cfgmem_args = '' 158 | fpga_args = '' 159 | data_args = '' 160 | # Check the Offset value for given keys 161 | for file_ in BootParams.keys(): 162 | if file_ in ('FSBL', 'DTB'): 163 | continue 164 | file_path = BootParams[file_].get('Path') 165 | if not os.path.isabs(file_path): 166 | file_path = os.path.join(proot, file_path) 167 | plnx_utils.CheckFileExists( 168 | file_path, 'Failed to generate %s file, ' % args.format) 169 | if not BootParams[file_].get('Offset'): 170 | bootfile_offset = '' 171 | bootfile_size = '' 172 | if file_ in ('FPGA', 'UBOOT', 'KERNEL', 'JFFS2'): 173 | file_prop = eval('%s_prop' % file_.lower()) 174 | if file_prop: 175 | try: 176 | bootfile_offset = file_prop.split()[0] 177 | except IndexError: 178 | bootfile_offset = '' 179 | BootParams[file_]['Offset'] = bootfile_offset 180 | try: 181 | bootfile_size = file_prop.split()[1] 182 | except IndexError: 183 | bootfile_size = '' 184 | file_size = os.path.getsize(file_path) 185 | if bootfile_size and file_size > int(bootfile_size, base=16): 186 | logger.error('Size of BootFile "%s" is %s larger than the %s partition size %s.' % ( 187 | file_path, bootfile_size, file_.lower(), int(file_path, base=16))) 188 | sys.exit(255) 189 | if not BootParams[file_].get('Offset'): 190 | logger.error('Offset of file "%s" is empty. ' 191 | 'Please use "--offset" to specify the offset.' % ( 192 | BootParams[file_].get('Path'))) 193 | sys.exit(255) 194 | 195 | file_offset = BootParams[file_].get('Offset') 196 | if flash_intf == 'BPIx16': 197 | # Devide offset by 2 if BPIx16 198 | file_offset = hex(int(int(file_offset, base=16) / 2)) 199 | 200 | logger.info('Add File %s at %s' % (file_path, file_offset)) 201 | if file_ == 'FPGA': 202 | fpga_args = '-loadbit "up %s %s"' % (file_offset, file_path) 203 | else: 204 | data_args += ' up %s %s' % (file_offset, file_path) 205 | if data_args: 206 | data_args = '-loaddata "%s"' % data_args 207 | cfgmem_args = '-force -format %s -size %s -interface %s' % ( 208 | args.format, flash_size, flash_intf) 209 | writecfg_cmd = 'write_cfgmem %s %s %s %s' % ( 210 | cfgmem_args, fpga_args, data_args, args.output) 211 | plnx_utils.RemoveDir(plnx_vars.CfgMemDir.format(proot)) 212 | plnx_utils.CreateDir(plnx_vars.CfgMemDir.format(proot)) 213 | write_cfgmemfile = os.path.join(plnx_vars.CfgMemDir.format(proot), 214 | 'write_cfgmem_hsm.tcl') 215 | plnx_utils.CreateFile(write_cfgmemfile) 216 | plnx_utils.add_str_to_file(write_cfgmemfile, writecfg_cmd) 217 | cfgmemlog = os.path.join(plnx_vars.CfgMemDir.format(proot), 'cfgmem.log') 218 | cfgmemjou = os.path.join(plnx_vars.CfgMemDir.format(proot), 'cfgmem.jou') 219 | vivado_cmd = 'vivado -log %s -jou %s -mode batch -s %s' % ( 220 | cfgmemlog, cfgmemjou, write_cfgmemfile) 221 | logger.info('Generating %s file...' % args.format) 222 | stdout, stderr = plnx_utils.runCmd(vivado_cmd, 223 | plnx_vars.CfgMemDir.format(proot), shell=True) 224 | return 225 | -------------------------------------------------------------------------------- /scripts/libs/logger_setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (C) 2021-2022, Xilinx, Inc. All rights reserved. 4 | # Copyright (C) 2022-2024, Advanced Micro Devices, Inc. All rights reserved. 5 | # 6 | # Author: 7 | # Raju Kumar Pothuraju 8 | # 9 | # SPDX-License-Identifier: MIT 10 | 11 | import logging 12 | import sys 13 | 14 | logger = None 15 | format = logging.Formatter("[%(levelname)s] %(message)s") 16 | 17 | 18 | def plain(self, message, *args, **kwargs): 19 | print(message) 20 | 21 | 22 | def note(self, message, *args, **kwargs): 23 | self._log(logging.INFO + 2, message, args, **kwargs) 24 | 25 | 26 | logging.addLevelName(logging.INFO + 2, 'NOTE') 27 | logging.Logger.plain = plain 28 | logging.Logger.note = note 29 | 30 | 31 | def setup_logger(name): 32 | global logger 33 | if logger: 34 | return logger 35 | logger = logging.getLogger(name) 36 | logger.setLevel(logging.DEBUG) 37 | 38 | console_h = logging.StreamHandler(sys.stdout) 39 | console_h.setLevel(logging.INFO) 40 | console_h.setFormatter(format) 41 | logger.addHandler(console_h) 42 | 43 | return logger, console_h 44 | 45 | 46 | def setup_logger_file(filename): 47 | global logger 48 | file_h = logging.FileHandler(filename) 49 | file_h.setLevel(logging.DEBUG) 50 | file_h.setFormatter(format) 51 | logger.addHandler(file_h) 52 | -------------------------------------------------------------------------------- /scripts/libs/package_bsp.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (C) 2021-2022, Xilinx, Inc. All rights reserved. 4 | # Copyright (C) 2022-2024, Advanced Micro Devices, Inc. All rights reserved. 5 | # 6 | # Author: 7 | # Raju Kumar Pothuraju 8 | # 9 | # SPDX-License-Identifier: MIT 10 | 11 | import argparse 12 | import logging 13 | import os 14 | import random 15 | import string 16 | import sys 17 | import tempfile 18 | import bitbake_utils 19 | import package_common 20 | import plnx_utils 21 | import plnx_vars 22 | 23 | logger = logging.getLogger('PetaLinux') 24 | 25 | 26 | ProjectEssentials = 'pre-built project-spec components .petalinux user .gitignore README README.hw' 27 | PackageBspDict = {} 28 | 29 | 30 | def AddProjectData(proj_key): 31 | ''' Adding Project path to Dictionary''' 32 | def f(arg): 33 | if arg: 34 | arg = plnx_utils.argreadlink(arg) 35 | if arg and proj_key: 36 | rmdstr = ''.join(random.choices( 37 | string.ascii_uppercase + string.digits, k=5) 38 | ) 39 | tmp_key = proj_key + '@' + rmdstr 40 | plnx_utils.add_dictkey(PackageBspDict, tmp_key, 'Path', arg) 41 | return arg 42 | return f 43 | 44 | 45 | def AddHwProjData(hw_key, append=False): 46 | ''' Adding HW Path to Project in Dictionary''' 47 | def f(arg): 48 | if arg: 49 | arg = plnx_utils.argreadlink(arg) 50 | if arg and hw_key: 51 | ProjectKeys = [key for key in PackageBspDict.keys() 52 | if key.startswith('Project')] 53 | if ProjectKeys: 54 | lastprojkey = ProjectKeys[-1] 55 | plnx_utils.add_dictkey(PackageBspDict, lastprojkey, 56 | hw_key, arg, append, sep=' ') 57 | else: 58 | raise argparse.ArgumentTypeError( 59 | '-p/--project option must be specified before --hwsource %s' % (arg)) 60 | 61 | return arg 62 | return f 63 | 64 | 65 | def AddWorkspaceRecipes(args, project): 66 | ''' Add Devtool Workspace recipe changes''' 67 | output = bitbake_utils.run_bitbakecmd( 68 | 'devtool status', project, shell=True, checkcall=False) 69 | DevtoolStatusDict = {} 70 | for line in output[0].splitlines(): 71 | if not line.startswith(('NOTE', 'ERROR', 'INFO', 'WARNING')): 72 | comp, path = line.split(':') 73 | DevtoolStatusDict[comp] = path 74 | if DevtoolStatusDict: 75 | logger.info('Applying workspace changes. This may take time !') 76 | plnx_utils.setup_plnwrapper(args, project, '', '') 77 | for recipe in DevtoolStatusDict.keys(): 78 | devtool_cmd = 'devtool finish %s %s -f' % ( 79 | recipe, plnx_vars.MetaUserDir.format(project)) 80 | bitbake_utils.run_bitbakecmd( 81 | devtool_cmd, project, shell=True, checkcall=False) 82 | DevtoolAtticDir = os.path.join( 83 | plnx_utils.get_workspace_path(project), 'attic', 'sources', recipe) 84 | plnx_utils.RemoveDir(DevtoolAtticDir) 85 | 86 | 87 | def ResetVivadoProj(HwProj): 88 | ''' Resetting HW project to pack bsp''' 89 | logger.info('\tTrying to cleanup the copied hardware project.') 90 | plnx_utils.check_tool('vivado', 'Please source Xilinx Tools settings first.') 91 | import glob 92 | HwXprFile = glob.glob(os.path.join(HwProj, '*.xpr')) 93 | if HwXprFile: 94 | import tempfile 95 | filehandle = tempfile.NamedTemporaryFile() 96 | VivadoTcl = filehandle.name 97 | plnx_utils.add_str_to_file(VivadoTcl, 'reset_project') 98 | VivadoCmd = 'vivado -mode batch -nojournal -nolog -s %s %s' % (VivadoTcl, HwXprFile[0]) 99 | plnx_utils.runCmd(VivadoCmd, out_dir=os.getcwd(), shell=True) 100 | 101 | else: 102 | logger.warning('Unable to find a valid hardware project file') 103 | 104 | 105 | def PackageBsp(args, proot): 106 | ''' Package the BSP for given projects''' 107 | if not args.project: 108 | logger.error('Please specify a PetaLinux project to package the BSP') 109 | sys.exit(255) 110 | # Output file not endswith .bsp add it 111 | PackageName = args.output 112 | if not PackageName.endswith('.bsp'): 113 | PackageName = '%s.bsp' % args.output 114 | package_common.CheckOutFile(PackageName, args.force) 115 | 116 | logger.info('Target BSP "%s" will contain the following projects' % 117 | PackageName) 118 | # Get the Exclude file 119 | ExcludeFile = args.exclude_from_file 120 | if ExcludeFile and not os.path.isfile(ExcludeFile): 121 | logger.error('BSP filter file "%s" doesnot exist.' % ExcludeFile) 122 | sys.exit(255) 123 | else: 124 | filehandle = tempfile.NamedTemporaryFile() 125 | ExcludeFile = filehandle.name 126 | plnx_utils.add_str_to_file(ExcludeFile, plnx_vars.BspFilesExcludeStr) 127 | 128 | # Create Tmp Directory for project 129 | Dirhandle = tempfile.TemporaryDirectory() 130 | TmpBspDir = Dirhandle.name 131 | plnx_utils.CreateDir(TmpBspDir) 132 | ProjBaseNames = '' 133 | # Get Project keys which starts with Project@ from Dict 134 | ProjectKeys = [key for key in PackageBspDict.keys() 135 | if key.startswith('Project@')] 136 | # Itirate through each key to get Path and Hw project 137 | for projkey in ProjectKeys: 138 | for proj in PackageBspDict[projkey].get('Path').split(): 139 | if not os.path.exists(proj): 140 | logger.error( 141 | 'Failed to package BSP! Failed to locate project %s!' % proj) 142 | sys.exit(255) 143 | logger.info('PetaLinux project: %s' % proj) 144 | # Add workspace changes 145 | if not args.exclude_workspace and \ 146 | os.path.exists(plnx_vars.EsdkInstalledDir.format(proj)): 147 | AddWorkspaceRecipes(args, proj) 148 | # Add Project Dirs/Files 149 | TmpProjDir = os.path.join(TmpBspDir, os.path.basename(proj)) 150 | plnx_utils.CreateDir(TmpProjDir) 151 | for Dir in ProjectEssentials.split(): 152 | act_file = os.path.join(proj, Dir) 153 | if os.path.exists(act_file): 154 | logger.info(' Copying %s' % act_file) 155 | rsync_cmd = 'rsync -a --exclude-from="%s" "%s" "%s/"' % ( 156 | ExcludeFile, act_file, TmpProjDir) 157 | plnx_utils.runCmd( 158 | rsync_cmd, out_dir=os.getcwd(), shell=True) 159 | ProjBaseNames += ' %s' % (os.path.basename(proj)) 160 | plnx_utils.update_config_value('CONFIG_TMP_DIR_LOCATION', 161 | '"${PROOT}/build/tmp"', 162 | plnx_vars.SysConfFile.format(TmpProjDir)) 163 | plnx_utils.remove_str_from_file( 164 | plnx_vars.MetaDataFile.format(TmpProjDir), 165 | 'HARDWARE_PATH') 166 | # Add Hwprojects 167 | for HwDir in PackageBspDict[projkey].get('HWSource', '').split(): 168 | TmpHwProjDir = os.path.join(TmpProjDir, 'hardware') 169 | plnx_utils.CreateDir(TmpHwProjDir) 170 | logger.info(' Copying Hardware Project %s' % HwDir) 171 | rsync_cmd = 'rsync -a --exclude-from="%s" \ 172 | --exclude={"*.log","*.jou","workspace","implementation"} "%s" "%s/"' % ( 173 | ExcludeFile, HwDir, TmpHwProjDir) 174 | plnx_utils.runCmd( 175 | rsync_cmd, out_dir=os.getcwd(), shell=True) 176 | if args.clean: 177 | ResetVivadoProj(os.path.join(TmpHwProjDir, os.path.basename(HwDir))) 178 | 179 | # Create a tar file 180 | logger.info('Creating BSP') 181 | logger.info('Generating package %s' % os.path.basename(PackageName)) 182 | plnx_utils.CreateDir(os.path.dirname(PackageName)) 183 | tar_cmd = 'tar -C "%s" -cf - %s | xz -9 -T%s > %s' % ( 184 | TmpBspDir, ProjBaseNames, args.threads, PackageName) 185 | plnx_utils.runCmd(tar_cmd, out_dir=os.getcwd(), shell=True) 186 | 187 | 188 | def pkgbsp_args(bsp_parser): 189 | bsp_parser.add_argument('-o', '--output', default='BSP0', 190 | help='BSP package name - .bsp', type=os.path.realpath) 191 | bsp_parser.add_argument('-p', '--project', metavar='PROJECT_DIR', type=AddProjectData('Project'), 192 | help='Specify full path to a PetaLinux project to include in BSP' 193 | '(Allow Multiple).', action='append') 194 | bsp_parser.add_argument('--hwsource', action='append', default=[], 195 | type=AddHwProjData('HWSource', append=True), 196 | help='Include a hardware source for PetaLinux project' 197 | ) 198 | bsp_parser.add_argument('--clean', action='store_true', help='Force clean hardware project' 199 | 'Vivado Installation is required for this option.') 200 | bsp_parser.add_argument('--exclude-from-file', metavar='EXCLUDE_FILE', 201 | help='Excludes the files specified in EXCLUDE_FILE' 202 | ) 203 | bsp_parser.add_argument('--exclude-workspace', action='store_true', 204 | help='Excludes the changes in workspace' 205 | ) 206 | bsp_parser.add_argument('-T', '--threads', metavar='NUM', type=int, default=0, 207 | help='Use at most NUM threads while packaging the BSP.' 208 | '\nDefault is 0 which uses as many threads as there are processor cores.' 209 | ) 210 | bsp_parser.set_defaults(func=PackageBsp) 211 | 212 | return 213 | -------------------------------------------------------------------------------- /scripts/libs/package_prebuilt.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (C) 2021-2022, Xilinx, Inc. All rights reserved. 4 | # Copyright (C) 2022-2024, Advanced Micro Devices, Inc. All rights reserved. 5 | # 6 | # Author: 7 | # Raju Kumar Pothuraju 8 | # 9 | # SPDX-License-Identifier: MIT 10 | 11 | import argparse 12 | import logging 13 | import os 14 | import sys 15 | import bitbake_utils 16 | import package_common 17 | import plnx_utils 18 | import plnx_vars 19 | 20 | logger = logging.getLogger('PetaLinux') 21 | 22 | PrebuiltDirDefList = 'images implementation' 23 | 24 | 25 | def PackagePrebuilt(args, proot): 26 | ''' Copy image/linux to prebuilts folder''' 27 | args.arch = plnx_utils.get_system_arch(proot) 28 | args.xilinx_arch = plnx_utils.get_xilinx_arch(proot) 29 | global PrebuiltDirDefList 30 | package_common.CheckOutDir(plnx_vars.PreBuildsDir.format(proot), 31 | args.force) 32 | logger.info('Updating software prebuilt') 33 | for Dir in PrebuiltDirDefList.split(): 34 | plnx_utils.CreateDir( 35 | os.path.join(plnx_vars.PreBuildsDir.format(proot), 36 | Dir) 37 | ) 38 | logger.info('Installing software images') 39 | if os.path.exists(plnx_vars.BuildImagesDir.format(proot)) and \ 40 | os.listdir(plnx_vars.BuildImagesDir.format(proot)): 41 | plnx_utils.CopyDir(plnx_vars.BuildImagesDir.format(proot), 42 | plnx_vars.PreBuildsImagesDir.format(proot)) 43 | else: 44 | logger.error( 45 | 'Fail to update the pre-built, No images/linux folder found.') 46 | sys.exit(255) 47 | 48 | # Update prebuilts with user added files 49 | for fromadd in args.add: 50 | src_ = fromadd.split(':') 51 | src = os.path.realpath(src_[0]) 52 | dest = src_[0] 53 | if len(src_) >= 2 and src_[1]: 54 | dest = src_[1] 55 | dest = os.path.join(plnx_vars.PreBuildsDir.format(proot), 56 | dest) 57 | if os.path.exists(src): 58 | user_dir = os.path.dirname(dest) 59 | plnx_utils.CreateDir(user_dir) 60 | if os.path.isfile(src): 61 | plnx_utils.CopyFile(src, dest) 62 | elif os.path.isdir(src): 63 | plnx_utils.CopyDir(src, dest) 64 | else: 65 | logger.warning('Failed to copy %s, File not found.' % src) 66 | 67 | # Update prebuilts with fpga bitstream paths 68 | FpgaDir = os.path.join(plnx_vars.PreBuildsDir.format(proot), 69 | 'implementation') 70 | for fpgafile in args.fpga: 71 | if os.path.isfile(fpgafile): 72 | plnx_utils.CopyFile(fpgafile, FpgaDir) 73 | logger.info('Pre-built directory is updated.') 74 | 75 | 76 | def pkgprebuilt_args(prebuilt_parser): 77 | prebuilt_parser.add_argument('-p', '--project', metavar='PROJECT_DIR', type=os.path.realpath, 78 | help='Specify full path to a PetaLinux project.' 79 | '\nDefault is the working project.') 80 | prebuilt_parser.add_argument('--fpga', action='append', type=os.path.realpath, 81 | help='FPGA bitstream Path', default=[]) 82 | prebuilt_parser.add_argument('-a', '--add', metavar='src:dest', action='append', 83 | default=[], 84 | help='Add file/folder to prebuilt directory "src" with "dest"' 85 | ) 86 | 87 | prebuilt_parser.set_defaults(func=PackagePrebuilt) 88 | 89 | return 90 | -------------------------------------------------------------------------------- /scripts/libs/package_sysroot.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (C) 2021-2022, Xilinx, Inc. All rights reserved. 4 | # Copyright (C) 2022-2024, Advanced Micro Devices, Inc. All rights reserved. 5 | # 6 | # Author: 7 | # Raju Kumar Pothuraju 8 | # 9 | # SPDX-License-Identifier: MIT 10 | 11 | import argparse 12 | import logging 13 | import os 14 | import sys 15 | import plnx_utils 16 | import plnx_vars 17 | 18 | logger = logging.getLogger('PetaLinux') 19 | 20 | 21 | def PackageSysroot(args, proot): 22 | ''' Extract the sdk.sh to images/linux Directory''' 23 | args.arch = plnx_utils.get_system_arch(proot) 24 | args.xilinx_arch = plnx_utils.get_xilinx_arch(proot) 25 | # Add default files if not user given 26 | if not args.sdk: 27 | args.sdk = plnx_vars.SdkOutFile.format(proot) 28 | if not args.dir: 29 | args.dir = plnx_vars.SdkInstallDir.format(proot) 30 | 31 | # Add proot if its not absolute path 32 | if not os.path.isfile(args.sdk): 33 | logger.error('SDK file not found: %s' % args.sdk) 34 | sys.exit(255) 35 | if args.sdk and not os.path.isabs(args.sdk): 36 | args.sdk = os.path.join(proot, args.sdk) 37 | 38 | if args.dir and not os.path.isabs(args.dir): 39 | args.dir = os.path.join(proot, args.dir) 40 | sdk_command = 'unset LD_LIBRARY_PATH;' 41 | sdk_command += '%s -p -y -d "%s"' % (args.sdk, args.dir) 42 | plnx_utils.runCmd(sdk_command, proot, shell=True, checkcall=True) 43 | 44 | 45 | def pkgsysroot_args(sysroot_parser): 46 | sysroot_parser.add_argument('-p', '--project', metavar='PROJECT_DIR', type=os.path.realpath, 47 | help='Specify full path to a PetaLinux project.' 48 | '\nDefault is the working project.') 49 | sysroot_parser.add_argument('-s', '--sdk', metavar='', 50 | nargs='?', const=plnx_vars.SdkFile, 51 | type=os.path.realpath, help='SDK installer path'), 52 | sysroot_parser.add_argument('-d', '--dir', metavar='', 53 | nargs='?', const=plnx_vars.SdkDir, 54 | type=os.path.realpath, help='Directory path' 55 | ) 56 | 57 | sysroot_parser.set_defaults(func=PackageSysroot) 58 | 59 | return 60 | -------------------------------------------------------------------------------- /scripts/petalinux-boot: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (C) 2021-2022, Xilinx, Inc. All rights reserved. 4 | # Copyright (C) 2022-2024, Advanced Micro Devices, Inc. All rights reserved. 5 | # 6 | # Author: 7 | # Raju Kumar Pothuraju 8 | # 9 | # SPDX-License-Identifier: MIT 10 | 11 | 12 | import argparse 13 | import logging 14 | import os 15 | import sys 16 | 17 | scripts_path = os.path.dirname(os.path.realpath(__file__)) 18 | libs_path = os.path.join(scripts_path, 'libs') 19 | sys.path = sys.path + [libs_path] 20 | import boot_common 21 | import boot_jtag 22 | import boot_qemu 23 | import examples 24 | import logger_setup 25 | import plnx_utils 26 | import plnx_vars 27 | 28 | 29 | logger, console_h = logger_setup.setup_logger('PetaLinux') 30 | 31 | 32 | def PreProcessArgs(): 33 | # Shell used to support --qemu|--jtag 34 | # To support those adding preprocessor for args 35 | # which will read the args and find any deprecated args 36 | # and rearrange them as per the python argparser 37 | DeprecatedArgs = ('--qemu', '--jtag') 38 | parser_value = '' 39 | for arg in DeprecatedArgs: 40 | if arg in sys.argv: 41 | parser_value = sys.argv[sys.argv.index(arg)].replace('-', '', 2) 42 | logger.note('Argument: "%s" has been deprecated. ' 43 | 'It is recommended to start using new python command line Argument.' 44 | % (sys.argv[sys.argv.index(arg)])) 45 | logger.note('Use: %s %s [OPTIONS]' % (os.path.basename(sys.argv[0]), 46 | parser_value)) 47 | del sys.argv[sys.argv.index(arg)] 48 | if parser_value: 49 | sys.argv.insert(1, parser_value) 50 | 51 | 52 | def main(): 53 | PreProcessArgs() 54 | parser = argparse.ArgumentParser( 55 | description='This command boots the MicroBlaze, Zynq , Zynq UltraScale+ ,' 56 | 'versal and versal-net systems with Petalinux images through JTAG/QEMU.', 57 | formatter_class=argparse.RawTextHelpFormatter, 58 | add_help=False, 59 | epilog='Use %(prog)s --help to get help on a specific command', 60 | ) 61 | 62 | # Global args 63 | parser.add_argument('-D', '-v', '--debug', '--verbose', action='store_true', 64 | help='Display the Debug prints') 65 | parser.add_argument('-p', '--project', metavar='PROJECT_DIR', type=os.path.realpath, 66 | help='Specify full path to a PetaLinux project.') 67 | global_args, unparsed_args = parser.parse_known_args() 68 | 69 | parser.add_argument('-h', '--help', action='help', default=argparse.SUPPRESS, 70 | help='Show this help message and exit') 71 | subparsers = parser.add_subparsers(dest="command", 72 | title='subcommands', metavar='') 73 | subparsers.required = True 74 | 75 | # --jtag parser args 76 | jtag_parser = subparsers.add_parser('jtag', help='Load images via JTAG', 77 | epilog=examples.PBootJtag, 78 | formatter_class=argparse.RawTextHelpFormatter) 79 | boot_jtag.JtagBootArgs(jtag_parser) 80 | 81 | # --qemu parser args 82 | qemu_parser = subparsers.add_parser('qemu', help='Load images via QEMU', 83 | epilog=examples.PBootQemu, 84 | formatter_class=argparse.RawTextHelpFormatter) 85 | boot_qemu.QemuBootArgs(qemu_parser) 86 | 87 | # Display help if no args specified 88 | if len(sys.argv) == 1: 89 | parser.print_help(sys.stderr) 90 | sys.exit(1) 91 | 92 | args = parser.parse_args(unparsed_args, namespace=global_args) 93 | 94 | # Display help if no args specified for parser ex: petalinux-boot jtag 95 | # parser name should start with command to make this work 96 | if len(sys.argv) == 2: 97 | eval('%s_parser.print_help(sys.stderr)' % args.command) 98 | logger.error('Image type not specified to boot.') 99 | sys.exit(1) 100 | 101 | proot = '' 102 | # Exit if PROOT is not PetaLinux project 103 | if args.project: 104 | proot = plnx_utils.exit_not_plnx_project(args.project) 105 | else: 106 | proot = plnx_utils.exit_not_plnx_project(proot='') 107 | 108 | # Print debug prints if debug selected 109 | if args.debug: 110 | console_h.setLevel(logging.DEBUG) 111 | plnx_vars.EnablePlnxTraceback = True 112 | 113 | ret = args.func(args, proot) 114 | return ret 115 | 116 | 117 | if __name__ == "__main__": 118 | try: 119 | ret = main() 120 | except Exception as e: 121 | ret = 1 122 | plnx_utils.PlnxTraceback(e) 123 | finally: 124 | plnx_utils.PlnxCleanup() 125 | sys.exit(ret) 126 | -------------------------------------------------------------------------------- /scripts/petalinux-config: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (C) 2021-2022, Xilinx, Inc. All rights reserved. 4 | # Copyright (C) 2022-2024, Advanced Micro Devices, Inc. All rights reserved. 5 | # 6 | # Author: 7 | # Raju Kumar Pothuraju 8 | # 9 | # SPDX-License-Identifier: MIT 10 | 11 | import argparse 12 | import logging 13 | import os 14 | import sys 15 | 16 | scripts_path = os.path.dirname(os.path.realpath(__file__)) 17 | libs_path = os.path.join(scripts_path, 'libs') 18 | sys.path = sys.path + [libs_path] 19 | import config_component 20 | import examples 21 | import logger_setup 22 | import plnx_utils 23 | import plnx_vars 24 | 25 | logger, console_h = logger_setup.setup_logger('PetaLinux') 26 | 27 | 28 | def _config(args, proot): 29 | '''Run config setup for given component''' 30 | gen_confargs = '' 31 | config_target = 'silentconfig' 32 | if not args.silentconfig: 33 | if args.component in ('project', 'rootfs'): 34 | gen_confargs = '--menuconfig %s' % args.component 35 | config_target = 'config' 36 | if args.debug: 37 | gen_confargs += ' --debug' 38 | plnx_utils.update_config_value('VALIDATE_HW_CHKSUM', '1', 39 | plnx_vars.MetaDataFile.format(proot)) 40 | if args.get_hw_description: 41 | config_component.validate_hw_file(args, proot) 42 | plnx_utils.setup_plnwrapper(args, proot, config_target, gen_confargs) 43 | config_component.config_yocto_component( 44 | proot, args.component, config_target, args.logfile) 45 | logger.info('Successfully configured %s' % args.component) 46 | 47 | 48 | def main(): 49 | parser = argparse.ArgumentParser( 50 | description='Configures the project or the specified component with menuconfig', 51 | formatter_class=argparse.RawTextHelpFormatter, 52 | usage='Use %(prog)s [options] {--component |--get-hw-description[=SRC]}', 53 | epilog=examples.PConfig) 54 | 55 | # Global args 56 | parser.add_argument('-D', '--debug', action='store_true', 57 | help='Display the Debug prints') 58 | parser.add_argument('-p', '--project', metavar='PROJECT_DIR', type=os.path.realpath, 59 | help='Specify full path to a PetaLinux project.' 60 | '\nDefault is the working project.') 61 | parser.add_argument('-c', '--component', metavar='RECIPE_NAME', default='project', 62 | help='Specify the component If no component is specified, ' 63 | '\nit will do top level project configuration.' 64 | '\nIf you specify a component, it will configure it ' 65 | '\nwith menuconfig and saves user\'s config fragments in meta-user.' 66 | '\nE.g. -c rootfs, -c busybox') 67 | parser.add_argument('--silentconfig', action='store_true', 68 | help='Takes the default configuration and skips the GUI.') 69 | parser.add_argument('--get-hw-description', metavar='HW_FILE', type=os.path.realpath, 70 | help='Get hardware description file/path.') 71 | parser.set_defaults(func=_config) 72 | 73 | args = parser.parse_args() 74 | 75 | # Exit if PROOT is not PetaLinux project 76 | proot = plnx_utils.exit_not_plnx_project(args.project) 77 | 78 | # Exit if PetaLinux version mismatch 79 | if not plnx_utils.petalinux_version_check(proot): 80 | sys.exit(255) 81 | 82 | args.command = os.path.basename(sys.argv[0]) 83 | args.builddir = plnx_vars.BuildDir.format(proot) 84 | plnx_utils.CreateDir(args.builddir) 85 | 86 | plnx_utils.CreateDir(plnx_vars.PlnxWorkspace.format(proot)) 87 | 88 | args.logfile = plnx_vars.ConfigLogFile.format(proot) 89 | plnx_utils.RenameFile(args.logfile, args.logfile + '.old') 90 | 91 | # Setup logger to file 92 | logger_setup.setup_logger_file(args.logfile) 93 | # Print debug prints if debug selected 94 | if args.debug: 95 | console_h.setLevel(logging.DEBUG) 96 | plnx_vars.EnablePlnxTraceback = True 97 | 98 | ret = args.func(args, proot) 99 | return ret 100 | 101 | 102 | if __name__ == "__main__": 103 | try: 104 | ret = main() 105 | except Exception as e: 106 | ret = 1 107 | plnx_utils.PlnxTraceback(e) 108 | sys.exit(ret) 109 | -------------------------------------------------------------------------------- /scripts/petalinux-create: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (C) 2021-2022, Xilinx, Inc. All rights reserved. 4 | # Copyright (C) 2022-2024, Advanced Micro Devices, Inc. All rights reserved. 5 | # 6 | # Author: 7 | # Raju Kumar Pothuraju 8 | # 9 | # SPDX-License-Identifier: MIT 10 | 11 | import argparse 12 | import logging 13 | import os 14 | import sys 15 | 16 | scripts_path = os.path.dirname(os.path.realpath(__file__)) 17 | libs_path = os.path.join(scripts_path, 'libs') 18 | sys.path = sys.path + [libs_path] 19 | import bitbake_utils 20 | import create_component 21 | import examples 22 | import logger_setup 23 | import plnx_utils 24 | import plnx_vars 25 | 26 | logger, console_h = logger_setup.setup_logger('PetaLinux') 27 | 28 | 29 | def PreProcessArgs(): 30 | # Shell used to support -t/--type project/apps/modules 31 | # To support those adding preprocessor for args 32 | # which will read the args and find any deprecated args 33 | # and rearrange them as per the python argparser 34 | DeprecatedArgs = ('-t', '--type') 35 | parser_value = '' 36 | for arg in DeprecatedArgs: 37 | if arg in sys.argv: 38 | parser_value = sys.argv[sys.argv.index(arg) + 1] 39 | logger.note('Argument: "%s %s" has been deprecated. ' 40 | 'It is recommended to start using new python command line Argument.' 41 | % (sys.argv[sys.argv.index(arg)], sys.argv[sys.argv.index(arg) + 1])) 42 | logger.note('Use: %s %s [OPTIONS]' % (os.path.basename(sys.argv[0]), 43 | sys.argv[sys.argv.index(arg) + 1])) 44 | del sys.argv[sys.argv.index(arg) + 1] 45 | del sys.argv[sys.argv.index(arg)] 46 | if parser_value: 47 | sys.argv.insert(1, parser_value) 48 | 49 | 50 | def main(): 51 | PreProcessArgs() 52 | parser = argparse.ArgumentParser( 53 | description='This creates a new PetaLinux Project or component ', 54 | formatter_class=argparse.RawTextHelpFormatter, 55 | add_help=False, 56 | epilog='Use %(prog)s --help to get help on a specific command') 57 | 58 | # Global args 59 | parser.add_argument('-f', '--force', action='store_true', 60 | help='Force overwriting an existing component directory') 61 | parser.add_argument('-D', '--debug', action='store_true', 62 | help='Display the Debug prints') 63 | parser.add_argument('--out', default=os.getcwd(), type=os.path.realpath, 64 | help=argparse.SUPPRESS) 65 | parser.add_argument('-n', '--name', default='', 66 | help='Specify a name for the component or project.' 67 | '\nIt is OPTIONAL to create a PROJECT when you specify a' 68 | ' source BSP to create a project') 69 | global_args, unparsed_args = parser.parse_known_args() 70 | 71 | parser.add_argument('-h', '--help', action='help', default=argparse.SUPPRESS, 72 | help='Show this help message and exit') 73 | subparsers = parser.add_subparsers(dest="command", 74 | title='subcommands', metavar='') 75 | subparsers.required = True 76 | 77 | # Project parser args 78 | project_parser = subparsers.add_parser('project', help='Create PetaLinux project', 79 | epilog=examples.PCreateProject, 80 | formatter_class=argparse.RawTextHelpFormatter) 81 | project_parser.add_argument('-s', '--source', type=os.path.realpath, 82 | help='Specify a PetaLinux BSP as a project source') 83 | project_parser.add_argument('--template', default='', 84 | help='Specify the template name to use.', 85 | choices=['versal-net', 'versal', 'zynqMP', 'zynq', 'microblaze']) 86 | project_parser.add_argument('--tmpdir', 87 | help='Specify the local drive path as TMPDIR location when creating project.' 88 | '\nDefault TMPDIR cannot be under NFS. By default.' 89 | '\nPetaLinux sets the TMPDIR under /tmp when project is on NFS.' 90 | '\nYou can set your own local drive as TMPDIR PATH using --tmpdir option.') 91 | project_parser.set_defaults(func=create_component.CreateComponent) 92 | 93 | # Apps parser args 94 | apps_parser = subparsers.add_parser('apps', help='Create User applications', 95 | epilog=examples.PcreateApps, 96 | formatter_class=argparse.RawTextHelpFormatter) 97 | apps_parser.add_argument('--static-pn', metavar='', 98 | help='Specify the package name created with ' 99 | 'dfx_dtg_zynqmp_static or dfx_dtg_versal_static' 100 | '\nto use with in dfx_dtg_zynqmp_partial or dfx_dtg_versal_partial.' 101 | '\nNote: This supports only for versal and zynqmp.') 102 | apps_parser.add_argument('--template', metavar='', default='c', type=str, 103 | choices=['c', 'c++', 'autoconf', 'install'] + 104 | list(plnx_vars.DFX_Templates.keys()), 105 | help='Specify the template name to create apps' 106 | '\nc : c user application(default)' 107 | '\nc++ : c++ user application' 108 | '\nautoconf : autoconf user application' 109 | '\ninstall : install data only' 110 | '\n%s' % "\n".join( 111 | ['{0}{1}: {2}'.format(k, ' ' * (23 - len(k)), 112 | v.replace('\n', '\n' + ' ' * 25)) 113 | for k, v in plnx_vars.DFX_Templates.items()]) 114 | ) 115 | apps_parser.add_argument('--srcuri', nargs='*', action='append', 116 | help='This option is to specify the source files' 117 | '\nfrom outside project.This will copy specified' 118 | '\nfiles into recipe files directory and add to' 119 | '\nSRC_URI variable in .bb file. Specify the multiple files with space.' 120 | ) 121 | apps_parser.add_argument('--enable', action='store_true', 122 | help='Enable the Application') 123 | apps_parser.add_argument('-p', '--project', metavar='PROJECT_DIR', type=os.path.realpath, 124 | help='Specify full path to a PetaLinux project.' 125 | '\nDefault is the working project.') 126 | apps_parser.set_defaults(func=create_component.CreateComponent) 127 | 128 | # Modules parser args 129 | modules_parser = subparsers.add_parser('modules', help='Create Linux user module', 130 | epilog=examples.PCreateModules, 131 | formatter_class=argparse.RawTextHelpFormatter) 132 | modules_parser.add_argument('--srcuri', nargs='*', action='append', 133 | help='This option is to specify the source files' 134 | '\nfrom outside project.This will copy specified' 135 | '\nfiles into recipe files directory and add to' 136 | '\nSRC_URI variable in .bb file. Specify the multiple files with space.' 137 | ) 138 | modules_parser.add_argument('--enable', action='store_true', 139 | help='Enable the Module') 140 | modules_parser.add_argument('-p', '--project', metavar='PROJECT_DIR', type=os.path.realpath, 141 | help='Specify full path to a PetaLinux project.' 142 | '\nDefault is the working project.') 143 | modules_parser.set_defaults(func=create_component.CreateComponent) 144 | 145 | # Display help if no args specified 146 | if len(sys.argv) == 1: 147 | parser.print_help(sys.stderr) 148 | sys.exit(1) 149 | 150 | args = parser.parse_args(unparsed_args, namespace=global_args) 151 | 152 | # Print debug prints if debug selected 153 | if args.debug: 154 | console_h.setLevel(logging.DEBUG) 155 | plnx_vars.EnablePlnxTraceback = True 156 | # static_pn name should be specified for dfx_dtg_zynqmp_partial 157 | # or dfx_dtg_versal_partial 158 | if args.command == 'apps' and not args.static_pn and \ 159 | args.template in ['dfx_dtg_zynqmp_partial', 'dfx_dtg_versal_partial']: 160 | logger.error('Creating "%s" template app requires ' 161 | '--static-pn to be defined' % (args.template)) 162 | sys.exit(255) 163 | 164 | # DFx-Template apps required srcuri to be specified or use force 165 | if args.command == 'apps' and not args.srcuri and \ 166 | args.template in plnx_vars.DFX_Templates.keys(): 167 | if not args.force: 168 | logger.error('Creating "%s" template app requires ' 169 | '--srcuri to be specified or use --force to ' 170 | 'skip adding SRCURI' % (args.template)) 171 | sys.exit(255) 172 | else: 173 | logger.warning( 174 | 'Creating "%s" template app without SRCURI variable' % (args.template)) 175 | 176 | proot = '' 177 | args.local_srcuris = '' 178 | args.network_srcuris = '' 179 | if args.command in ['apps', 'modules']: 180 | # For apps or modules, name should be specified 181 | if not args.name: 182 | logger.error('Component name is not specified!') 183 | sys.exit(255) 184 | # Check apps or modules name to not have special chars 185 | reason = bitbake_utils.validate_pn(args.name) 186 | if reason: 187 | logger.error(reason) 188 | sys.exit(255) 189 | 190 | # Exit if PROOT is not PetaLinux project 191 | proot = plnx_utils.exit_not_plnx_project(args.project) 192 | 193 | # Exit if PetaLinux version mismatch 194 | if not plnx_utils.petalinux_version_check(proot): 195 | sys.exit(255) 196 | 197 | # Validate SRCURI given by users 198 | if args.srcuri: 199 | # Convert nested list to list elements [[file files1] [file3] to 200 | # [file files1 file3] 201 | args.srcuri = [item for args in args.srcuri for item in args] 202 | args.local_srcuris, args.network_srcuris = bitbake_utils.validate_srcuri( 203 | args.srcuri) 204 | else: 205 | # Give error if source not found 206 | if args.source and not os.path.exists(args.source): 207 | logger.error('BSP file "%s" doesnot exists' % args.source) 208 | sys.exit(255) 209 | 210 | logger.info('Create %s: %s' % (args.command, args.name)) 211 | ret = args.func(args, proot) 212 | return ret 213 | 214 | 215 | if __name__ == "__main__": 216 | try: 217 | ret = main() 218 | except Exception as e: 219 | ret = 1 220 | plnx_utils.PlnxTraceback(e) 221 | sys.exit(ret) 222 | -------------------------------------------------------------------------------- /scripts/petalinux-devtool: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (C) 2021-2022, Xilinx, Inc. All rights reserved. 4 | # Copyright (C) 2022-2024, Advanced Micro Devices, Inc. All rights reserved. 5 | # 6 | # Author: 7 | # Raju Kumar Pothuraju 8 | # 9 | # SPDX-License-Identifier: MIT 10 | 11 | import argparse 12 | import logging 13 | import os 14 | import sys 15 | 16 | scripts_path = os.path.dirname(os.path.realpath(__file__)) 17 | libs_path = os.path.join(scripts_path, 'libs') 18 | sys.path = sys.path + [libs_path] 19 | import bitbake_utils 20 | import logger_setup 21 | import plnx_utils 22 | import plnx_vars 23 | 24 | logger, console_h = logger_setup.setup_logger('PetaLinux') 25 | 26 | 27 | def _Devtool(args, unknown_args, proot): 28 | '''Run devtool setup for given component''' 29 | gen_confargs = '' 30 | config_target = 'silentconfig' 31 | if args.debug: 32 | gen_confargs += ' --debug' 33 | devtool_cmd = 'devtool %s %s' % ( 34 | ' '.join(unknown_args), gen_confargs) 35 | plnx_utils.setup_plnwrapper(args, proot, config_target, gen_confargs) 36 | logger.info(devtool_cmd) 37 | bitbake_utils.run_bitbakecmd(devtool_cmd, 38 | proot, shell=True, logfile=args.logfile) 39 | 40 | 41 | def main(): 42 | parser = argparse.ArgumentParser( 43 | description='PetaLinux wrapper to Run the Devtool Commands', 44 | add_help=False, 45 | formatter_class=argparse.RawTextHelpFormatter, 46 | usage='Use %(prog)s [options]') 47 | 48 | # Global args 49 | parser.add_argument('-D', '--debug', action='store_true', 50 | help='Display the Debug prints') 51 | parser.add_argument('-p', '--project', metavar='PROJECT_DIR', type=os.path.realpath, 52 | help='Specify full path to a PetaLinux project.' 53 | '\nDefault is the working project.') 54 | parser.set_defaults(func=_Devtool) 55 | 56 | args, unknown_args = parser.parse_known_args() 57 | 58 | # Display help if no args specified 59 | if len(sys.argv) == 1: 60 | parser.print_help(sys.stderr) 61 | sys.exit(1) 62 | 63 | # Exit if PROOT is not PetaLinux project 64 | proot = plnx_utils.exit_not_plnx_project(args.project) 65 | 66 | # Exit if PetaLinux version mismatch 67 | if not plnx_utils.petalinux_version_check(proot): 68 | sys.exit(255) 69 | 70 | args.command = os.path.basename(sys.argv[0]) 71 | args.builddir = plnx_vars.BuildDir.format(proot) 72 | plnx_utils.CreateDir(args.builddir) 73 | 74 | args.logfile = plnx_vars.DevtoolLogFile.format(proot) 75 | plnx_utils.RenameFile(args.logfile, args.logfile + '.old') 76 | 77 | # Setup logger to file 78 | logger_setup.setup_logger_file(args.logfile) 79 | # Print debug prints if debug selected 80 | if args.debug: 81 | console_h.setLevel(logging.DEBUG) 82 | plnx_vars.EnablePlnxTraceback = True 83 | 84 | ret = args.func(args, unknown_args, proot) 85 | return ret 86 | 87 | 88 | if __name__ == "__main__": 89 | try: 90 | ret = main() 91 | except Exception as e: 92 | ret = 1 93 | plnx_utils.PlnxTraceback(e) 94 | sys.exit(ret) 95 | -------------------------------------------------------------------------------- /scripts/petalinux-package: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (C) 2021-2022, Xilinx, Inc. All rights reserved. 4 | # Copyright (C) 2022-2024, Advanced Micro Devices, Inc. All rights reserved. 5 | # 6 | # Author: 7 | # Raju Kumar Pothuraju 8 | # 9 | # SPDX-License-Identifier: MIT 10 | 11 | 12 | import argparse 13 | import logging 14 | import os 15 | import sys 16 | 17 | scripts_path = os.path.dirname(os.path.realpath(__file__)) 18 | libs_path = os.path.join(scripts_path, 'libs') 19 | sys.path = sys.path + [libs_path] 20 | import examples 21 | import logger_setup 22 | import package_boot 23 | import package_bsp 24 | import package_prebuilt 25 | import package_sysroot 26 | import package_wic 27 | import plnx_utils 28 | import plnx_vars 29 | 30 | logger, console_h = logger_setup.setup_logger('PetaLinux') 31 | 32 | 33 | def PreProcessArgs(): 34 | # Shell used to support --boot|--bsp|--prebuilt|--sysroot|--wic 35 | # To support those adding preprocessor for args 36 | # which will read the args and find any deprecated args 37 | # and rearrange them as per the python argparser 38 | DeprecatedArgs = ('--boot', '--bsp', '--prebuilt', '--sysroot', '--wic') 39 | parser_value = '' 40 | for arg in DeprecatedArgs: 41 | if arg in sys.argv: 42 | parser_value = sys.argv[sys.argv.index(arg)].replace('-', '', 2) 43 | logger.note('Argument: "%s" has been deprecated. ' 44 | 'It is recommended to start using new python command line Argument.' 45 | % (sys.argv[sys.argv.index(arg)])) 46 | logger.note('Use: %s %s [OPTIONS]' % (os.path.basename(sys.argv[0]), 47 | parser_value)) 48 | del sys.argv[sys.argv.index(arg)] 49 | if parser_value: 50 | sys.argv.insert(1, parser_value) 51 | 52 | 53 | def main(): 54 | PreProcessArgs() 55 | parser = argparse.ArgumentParser( 56 | description='This command packages various image format, prebuilt and bsps', 57 | formatter_class=argparse.RawTextHelpFormatter, 58 | add_help=False, 59 | epilog='Use %(prog)s --help to get help on a specific command', 60 | ) 61 | 62 | # Global args 63 | parser.add_argument('--force', action='store_true', 64 | help='Force overwriting an existing component directory') 65 | parser.add_argument('-D', '--debug', action='store_true', 66 | help='Display the Debug prints') 67 | global_args, unparsed_args = parser.parse_known_args() 68 | 69 | parser.add_argument('-h', '--help', action='help', default=argparse.SUPPRESS, 70 | help='Show this help message and exit') 71 | subparsers = parser.add_subparsers(dest="command", 72 | title='subcommands', metavar='') 73 | subparsers.required = True 74 | 75 | # --boot parser args 76 | boot_parser = subparsers.add_parser('boot', help='Packages the boot file', 77 | epilog=examples.PPackageBoot, 78 | formatter_class=argparse.RawTextHelpFormatter) 79 | package_boot.pkgboot_args(boot_parser) 80 | 81 | # --bsp parser args 82 | bsp_parser = subparsers.add_parser('bsp', help='Packages the BSP file', 83 | epilog=examples.PPackageBsp, 84 | formatter_class=argparse.RawTextHelpFormatter) 85 | package_bsp.pkgbsp_args(bsp_parser) 86 | 87 | # --prebuilt parser args 88 | prebuilt_parser = subparsers.add_parser('prebuilt', help='Packages prebuilts for project', 89 | epilog=examples.PPackagePrebuilts, 90 | formatter_class=argparse.RawTextHelpFormatter) 91 | package_prebuilt.pkgprebuilt_args(prebuilt_parser) 92 | 93 | # --sysroot parser args 94 | sysroot_parser = subparsers.add_parser('sysroot', help='Install the SDK', 95 | epilog=examples.PPackageSysroot, 96 | formatter_class=argparse.RawTextHelpFormatter) 97 | package_sysroot.pkgsysroot_args(sysroot_parser) 98 | 99 | # --wic parser args 100 | wic_parser = subparsers.add_parser('wic', help='Packages the SD bootable image', 101 | epilog=examples.PPackageWic, 102 | formatter_class=argparse.RawTextHelpFormatter) 103 | package_wic.pkgwic_args(wic_parser) 104 | 105 | # Display help if no args specified 106 | if len(sys.argv) == 1: 107 | parser.print_help(sys.stderr) 108 | sys.exit(1) 109 | 110 | args = parser.parse_args(unparsed_args, namespace=global_args) 111 | 112 | # Display help if no args specified for parser ex: petalinux-package bsp 113 | # parser name should start with command to make this work 114 | if len(sys.argv) == 2 and \ 115 | args.command == 'bsp': 116 | eval('%s_parser.print_help(sys.stderr)' % args.command) 117 | sys.exit(1) 118 | 119 | proot = '' 120 | if args.command != 'bsp': 121 | # Exit if PROOT is not PetaLinux project 122 | if args.project: 123 | proot = plnx_utils.exit_not_plnx_project(args.project) 124 | else: 125 | proot = plnx_utils.exit_not_plnx_project(proot='') 126 | 127 | args.builddir = plnx_vars.BuildDir.format(proot) 128 | plnx_utils.CreateDir(args.builddir) 129 | args.command = os.path.basename(sys.argv[0]) 130 | args.logfile = plnx_vars.PkgFileName 131 | if proot: 132 | args.logfile = plnx_vars.PackageLogFile.format(proot) 133 | plnx_utils.RenameFile(args.logfile, args.logfile + '.old') 134 | 135 | # Setup logger to file 136 | logger_setup.setup_logger_file(args.logfile) 137 | 138 | # Print debug prints if debug selected 139 | if args.debug: 140 | console_h.setLevel(logging.DEBUG) 141 | plnx_vars.EnablePlnxTraceback = True 142 | 143 | ret = args.func(args, proot) 144 | return ret 145 | 146 | 147 | if __name__ == "__main__": 148 | try: 149 | ret = main() 150 | except Exception as e: 151 | ret = 1 152 | plnx_utils.PlnxTraceback(e) 153 | sys.exit(ret) 154 | -------------------------------------------------------------------------------- /scripts/petalinux-upgrade: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # Copyright (C) 2021-2022, Xilinx, Inc. All rights reserved. 4 | # Copyright (C) 2022-2024, Advanced Micro Devices, Inc. All rights reserved. 5 | # 6 | # Author: 7 | # Raju Kumar Pothuraju 8 | # 9 | # SPDX-License-Identifier: MIT 10 | 11 | 12 | import argparse 13 | import logging 14 | import os 15 | import re 16 | import stat 17 | import sys 18 | 19 | scripts_path = os.path.dirname(os.path.realpath(__file__)) 20 | libs_path = os.path.join(scripts_path, 'libs') 21 | sys.path = sys.path + [libs_path] 22 | import logger_setup 23 | import plnx_utils 24 | import plnx_vars 25 | import examples 26 | 27 | logger, console_h = logger_setup.setup_logger('PetaLinux') 28 | 29 | DefaultPlatForm = ('aarch64', 'aarch64_dt', 'arm', 'microblaze', 'buildtools') 30 | 31 | 32 | def GetVersion(Filename): 33 | ''' Get eSDK version''' 34 | with open(Filename, 'rb') as f: 35 | lines = f.readlines() 36 | NewVersion = '' 37 | for line in lines: 38 | if re.search(b'^titlestr', line): 39 | NewVersion = line.decode("utf-8").split()[-1].strip('"') 40 | return NewVersion 41 | if not NewVersion: 42 | logger.error('Falied to Get Version for eSDK') 43 | sys.exit(255) 44 | 45 | 46 | def FetchEsdk(url, esdk, wget_args): 47 | ''' Fetch eSDK from local or remote''' 48 | EsdkFile = url 49 | if '://' in url: 50 | import tempfile 51 | Dirhandle = tempfile.TemporaryDirectory() 52 | WgetOutDir = Dirhandle.name 53 | plnx_utils.runCmd('wget %s -O %s %s' % (wget_args, 54 | os.path.join(WgetOutDir, esdk), url), 55 | os.getcwd(), failed_msg='Failed to get %s eSDK file' % esdk, 56 | shell=True) 57 | EsdkFile = os.path.join(WgetOutDir, esdk) 58 | if not os.path.exists(EsdkFile): 59 | logger.warning('Failed to get %s eSDK file' % esdk) 60 | return 61 | NewVersion = GetVersion(EsdkFile) 62 | if plnx_vars.Petainux_Major_Ver != NewVersion.split('.')[0]: 63 | logger.error('PetaLinux will not support major upgrade versions') 64 | sys.exit(255) 65 | logger.info('Start updating %s eSDK' % esdk) 66 | if esdk in ('buildtools'): 67 | os.chmod(EsdkFile, 68 | stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) 69 | plnxupgrade_path = os.path.dirname(os.path.realpath( 70 | plnx_vars.PetaLinuxSysroot)) 71 | hosttools_cmd = '%s -p -y -d %s' % (EsdkFile, plnxupgrade_path) 72 | plnx_utils.RemoveDir(os.path.join(plnxupgrade_path, 'sysroot')) 73 | plnx_utils.runCmd(hosttools_cmd, os.getcwd(), 74 | failed_msg='Failed to install %s eSDK file' % esdk, 75 | shell=True) 76 | plnx_utils.RemoveFile(os.path.join(plnxupgrade_path, 77 | 'version-x86_64-petalinux-linux')) 78 | envscript = 'environment-setup-x86_64-petalinux-linux' 79 | # No csh conversion 80 | plnx_utils.RenameFile(os.path.join(plnxupgrade_path, envscript), 81 | os.path.join(plnxupgrade_path, '.%s' % envscript)) 82 | else: 83 | esdk_metadata_dir = os.path.join(plnx_vars.YoctoSrcPath, '.statistics') 84 | esdk_metadata_file = os.path.join(esdk_metadata_dir, esdk) 85 | OldHash = plnx_utils.get_config_value( 86 | 'BASE_SDK', esdk_metadata_file) 87 | NewHash = plnx_utils.get_filehashvalue(EsdkFile) 88 | 89 | if OldHash == NewHash: 90 | logger.info('%s eSDK is upto date' % esdk) 91 | return 92 | plnx_utils.CopyFile(EsdkFile, plnx_vars.YoctoSrcPath) 93 | 94 | plnx_utils.CreateDir(esdk_metadata_dir) 95 | plnx_utils.CreateFile(esdk_metadata_file) 96 | plnx_utils.update_config_value( 97 | 'BASE_SDK', NewHash, esdk_metadata_file) 98 | os.chmod(os.path.join(plnx_vars.YoctoSrcPath, esdk), 99 | stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) 100 | 101 | plnx_utils.add_str_to_file(plnx_vars.VersionFile, 102 | 'PETALINUX_NEW_VER = "%s"\n' % NewVersion, mode='a+') 103 | logger.info('Updating %s eSDK succeeded' % esdk) 104 | 105 | 106 | def UpgradeEsdk(args): 107 | ''' Upgrade setup for eSDK''' 108 | if not os.access(plnx_vars.YoctoSrcPath, os.W_OK): 109 | logger.error('User doesnot have write access to: %s' % 110 | plnx_vars.YoctoSrcPath) 111 | sys.exit(255) 112 | if not args.url: 113 | logger.error('No --file/--url specified.') 114 | sys.exit(255) 115 | logger.info('Upgrading esdks from %s...' % args.url) 116 | # Add default list if not provided 117 | if not args.platform: 118 | args.platform = list(DefaultPlatForm) 119 | # Merge nested lists 120 | if any(isinstance(i, list) for i in args.platform): 121 | args.platform = sum(args.platform, []) 122 | # Add buildtools as default 123 | args.platform.append('buildtools') 124 | # Remove duplicates from list 125 | args.platform = list(set(args.platform)) 126 | for esdk in args.platform: 127 | FetchEsdk(os.path.join(args.url, esdk), esdk, args.wget_args) 128 | 129 | 130 | def ValidatePath(path): 131 | ''' Validate the use specified path or url''' 132 | if '://' in path: 133 | wgetcmd = 'wget --delete-after --timeout=10 --tries=5 --retry-connrefused %s' % path 134 | plnx_utils.runCmd(wgetcmd, os.getcwd(), 135 | failed_msg='Specified URL: %s is not reachable or does not exist' % path, 136 | shell=True) 137 | else: 138 | path = os.path.realpath(path) 139 | if not os.path.exists(path): 140 | raise argparse.ArgumentTypeError( 141 | 'Specified path does not exist: %s' % path) 142 | path = path if path.endswith('/') else path + '/' 143 | return path 144 | 145 | 146 | def main(): 147 | parser = argparse.ArgumentParser( 148 | description='Upgrade the system software without changing the host tool components', 149 | formatter_class=argparse.RawTextHelpFormatter, 150 | add_help=False, 151 | usage='Use %(prog)s --help to get help on a specific command', 152 | epilog=examples.PUpgrade) 153 | 154 | parser.add_argument('-f', '--file', metavar='', type=ValidatePath, dest='url', 155 | help='Specify the directory which contains upgradable esdk files.') 156 | parser.add_argument('-w', '--wget-args', default='', 157 | help='Specify additional wget arguments to use with -u/--url option') 158 | parser.add_argument('-D', '--debug', action='store_true', 159 | help=argparse.SUPPRESS) 160 | parser.add_argument('-u', '--url', type=ValidatePath, dest='url', 161 | help='Specify the URL which contains upgradable esdk content.') 162 | parser.add_argument('-p', '--platform', choices=DefaultPlatForm, default=[], 163 | nargs='+', action='append', 164 | help='Specifies the architecture name to upgrade' 165 | '\naarch64 : sources for zynqMP and versal' 166 | '\naarch64_dt : system device-tree(SDT) sources for zynqMP and versal' 167 | '\narm : sources for zynq' 168 | '\nmicroblaze : sources for microblaze' 169 | '\nbuildtools : Native(x86) SDK tools') 170 | parser.add_argument('-h', '--help', action='help', 171 | help='Show help message and exit') 172 | parser.set_defaults(func=UpgradeEsdk) 173 | 174 | args = parser.parse_args() 175 | 176 | # Display help if no args specified 177 | if len(sys.argv) == 1: 178 | parser.print_help(sys.stderr) 179 | sys.exit(1) 180 | 181 | args = parser.parse_args() 182 | 183 | # Setup logger to file 184 | plnx_utils.RenameFile(plnx_vars.UpgradeLog, plnx_vars.UpgradeLog + '.old') 185 | logger_setup.setup_logger_file(plnx_vars.UpgradeLog) 186 | 187 | # Print debug prints if debug selected 188 | if args.debug: 189 | console_h.setLevel(logging.DEBUG) 190 | plnx_vars.EnablePlnxTraceback = True 191 | 192 | ret = args.func(args) 193 | return ret 194 | 195 | 196 | if __name__ == "__main__": 197 | try: 198 | ret = main() 199 | except Exception as e: 200 | ret = 1 201 | plnx_utils.PlnxTraceback(e) 202 | sys.exit(ret) 203 | -------------------------------------------------------------------------------- /scripts/petalinux-util: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (C) 2021-2022, Xilinx, Inc. All rights reserved. 4 | # Copyright (C) 2022-2024, Advanced Micro Devices, Inc. All rights reserved. 5 | # 6 | # Authors: 7 | # Swagath Gadde 8 | # Raju Kumar Pothuraju 9 | # 10 | # SPDX-License-Identifier: MIT 11 | 12 | import os 13 | import sys 14 | import argparse 15 | 16 | scripts_path = os.path.dirname(os.path.realpath(__file__)) 17 | libs_path = os.path.join(scripts_path, 'libs') 18 | sys.path = sys.path + [libs_path] 19 | import plnx_vars 20 | import plnx_utils 21 | import logger_setup 22 | 23 | logger, console_h = logger_setup.setup_logger('PetaLinux') 24 | 25 | 26 | def GdbUtil(args, unknown_args, proot): 27 | '''Gdb util to debug applications''' 28 | CrossCompilerDict = {'aarch64': 'aarch64-linux-gnu-gdb', 29 | 'arm': 'arm-linux-gnueabihf-gdb'} 30 | CrossCompiler = CrossCompilerDict.get(args.arch) 31 | if not CrossCompiler: 32 | logger.error('Unable to detect the cross compiler prefix') 33 | sys.exit(255) 34 | plnx_utils.check_tool(CrossCompiler, 'Unable to find gdb client binary') 35 | gdbcmd = CrossCompiler 36 | gdbcmd += ' %s' % ' '.join(unknown_args) 37 | if '-iex' not in unknown_args: 38 | gdbcmd += ' -iex "set auto-load safe-path %s:/tmp"' % proot 39 | logger.info(gdbcmd) 40 | plnx_utils.runCmd(gdbcmd, os.getcwd(), 41 | failed_msg='Fail to launch gdb cmd', 42 | shell=True, checkcall=True) 43 | 44 | 45 | def FindXsaBitstreamUtil(args, unknown_args, proot): 46 | ''' Find Bitstream or pdi file name from xsa or sdt''' 47 | filename = plnx_utils.GetFileFromXsa(proot, args.xsa_file) 48 | logger.plain(filename) 49 | 50 | 51 | def XsdbConnectUtil(args, unknown_args, proot): 52 | '''xsdb connect to debug the qemu using gdb''' 53 | QemuHost = '' 54 | QemuPort = '' 55 | if unknown_args: 56 | QemuHost = unknown_args[0].split(':')[0] 57 | if len(unknown_args[0].split(':')) > 1: 58 | QemuPort = unknown_args[0].split(':')[1] 59 | if not QemuHost: 60 | # Default to local host if the host is blank 61 | QemuHost = 'localhost' 62 | if not QemuPort: 63 | logger.error( 64 | 'No QEMU port specified. Please ensure that the debugging port for QEMU is specified') 65 | sys.exit(255) 66 | import tempfile 67 | filehandle = tempfile.NamedTemporaryFile() 68 | XsdbFile = filehandle.name 69 | GdbServerCmd = plnx_vars.XsdbConnectCmd.format( 70 | QemuHost, QemuPort, ' '.join(unknown_args[1:])) 71 | 72 | plnx_utils.add_str_to_file(XsdbFile, GdbServerCmd) 73 | XsdbCmd = 'xsdb -interactive %s' % XsdbFile 74 | logger.plain(GdbServerCmd) 75 | plnx_utils.runCmd(XsdbCmd, os.getcwd(), 76 | failed_msg='Fail to launch xsdb', shell=True, checkcall=True) 77 | 78 | 79 | def DfuConnectUtil(args, unknown_args, proot): 80 | '''Dfu util to load the images''' 81 | if not unknown_args: 82 | logger.error('You need to specify one of -D or -U') 83 | sys.exit(255) 84 | DfuUtilCmd = '%s %s' % (plnx_vars.DfuUtilBin, ' '.join(unknown_args)) 85 | logger.info(DfuUtilCmd) 86 | plnx_utils.runCmd(DfuUtilCmd, os.getcwd(), 87 | failed_msg='Fail to launch dfu-util', shell=True, checkcall=True) 88 | 89 | 90 | def PreProcessArgs(): 91 | # Shell used to support --gdb, --find-xsa-bitstream, --xsdb-connect, --dfu-util 92 | # To support those adding preprocessor for args 93 | # which will read the args and find any deprecated args 94 | # and rearrange them as per the python argparser 95 | DeprecatedArgs = ('--gdb', '--find-xsa-bitstream', 96 | '--xsdb-connect', '--dfu-util') 97 | parser_value = '' 98 | for arg in DeprecatedArgs: 99 | if arg in sys.argv: 100 | parser_value = sys.argv[sys.argv.index(arg)].replace('-', '', 2) 101 | logger.note('Argument: "%s" has been deprecated. ' 102 | 'It is recommended to start using new python command line Argument.' 103 | % (sys.argv[sys.argv.index(arg)])) 104 | logger.note('Use: %s %s [OPTIONS]' % (os.path.basename(sys.argv[0]), 105 | parser_value)) 106 | del sys.argv[sys.argv.index(arg)] 107 | if parser_value: 108 | sys.argv.insert(1, parser_value) 109 | 110 | 111 | def main(): 112 | PreProcessArgs() 113 | parser = argparse.ArgumentParser( 114 | description='This command provides the misc utilities which are packed as part of Tool ', 115 | formatter_class=argparse.RawTextHelpFormatter, 116 | add_help=False, 117 | epilog='Use %(prog)s --help to get help on a specific command') 118 | 119 | # Global args 120 | parser.add_argument('-p', '--project', metavar='PROJECT_DIR', type=os.path.realpath, 121 | help='Specify full path to a PetaLinux project.' 122 | '\nDefault is the working project.') 123 | global_args, unparsed_args = parser.parse_known_args() 124 | 125 | parser.add_argument('-h', '--help', action='help', default=argparse.SUPPRESS, 126 | help='Show this help message and exit') 127 | 128 | subparsers = parser.add_subparsers(dest="command", 129 | title='subcommands', metavar='') 130 | subparsers.required = True 131 | 132 | # gdb parser args 133 | gdb_parser = subparsers.add_parser( 134 | 'gdb', help='PetaLinux gdb Debug wrapper', add_help=False, 135 | formatter_class=argparse.RawTextHelpFormatter) 136 | gdb_parser.set_defaults(func=GdbUtil) 137 | 138 | # find-xsa-bitstream parser args 139 | findxsabitstream_parser = subparsers.add_parser( 140 | 'find-xsa-bitstream', help='Find the bistream from inside a XSA file', 141 | formatter_class=argparse.RawTextHelpFormatter) 142 | findxsabitstream_parser.add_argument('--xsa-file', metavar='', type=os.path.realpath, 143 | help='Optional argument to specify the XSA file to use.' 144 | '\nDefaults to the system.xsa file in the subsystem directory.') 145 | findxsabitstream_parser.set_defaults(func=FindXsaBitstreamUtil) 146 | 147 | # xsdb-connect parser args 148 | xsdbconnect_parser = subparsers.add_parser( 149 | 'xsdb-connect', help='Connect XSDB to a running instance of QEMU', 150 | formatter_class=argparse.RawTextHelpFormatter) 151 | xsdbconnect_parser.set_defaults(func=XsdbConnectUtil) 152 | 153 | # dfu-util parser args 154 | dfuutil_parser = subparsers.add_parser( 155 | 'dfu-util', help='Invoke dfu-util and parse arguments specified with it', 156 | add_help=False, formatter_class=argparse.RawTextHelpFormatter) 157 | dfuutil_parser.set_defaults(func=DfuConnectUtil) 158 | 159 | # Display help if no args specified 160 | if len(sys.argv) == 1: 161 | parser.print_help(sys.stderr) 162 | sys.exit(1) 163 | 164 | args, unknown_args = parser.parse_known_args( 165 | unparsed_args, namespace=global_args) 166 | 167 | # Exit if PROOT is not PetaLinux project 168 | proot = plnx_utils.exit_not_plnx_project(args.project) 169 | 170 | # Exit if PetaLinux version mismatch 171 | if not plnx_utils.petalinux_version_check(proot): 172 | sys.exit(255) 173 | 174 | args.arch = plnx_utils.get_system_arch(proot) 175 | args.xilinx_arch = plnx_utils.get_xilinx_arch(proot) 176 | 177 | if '-h' in sys.argv or '--help' in sys.argv: 178 | if args.command in ('xsdb-connect', 'find-xsa-bitstream'): 179 | eval('%s_parser.print_help(sys.stderr)' % 180 | args.command.replace('-', '')) 181 | sys.exit(1) 182 | 183 | ret = args.func(args, unknown_args, proot) 184 | return ret 185 | 186 | 187 | if __name__ == "__main__": 188 | try: 189 | ret = main() 190 | except Exception as e: 191 | ret = 1 192 | plnx_utils.PlnxTraceback(e) 193 | sys.exit(ret) 194 | -------------------------------------------------------------------------------- /settings.csh: -------------------------------------------------------------------------------- 1 | # 2 | # C-shell setup script for PetaLinux development environment. 3 | # Run using 'source ./settings.csh' 4 | # 5 | # Copyright (c) 2013-2022 Xilinx, Inc. All rights reserved. 6 | # Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved. 7 | # 8 | set SETTINGS_FILE=./settings.csh 9 | set XIL_SCRIPT_LOC="./" 10 | if ( $# != 0 ) then 11 | # The first argument is the location of Xilinx Installation. 12 | # Don't detect the installation location. 13 | set XIL_SCRIPT_LOC="$1" 14 | else 15 | # XIL_SCRIPT_LOC should point to script location 16 | set XIL_SCRIPT_LOC_TMP_UNI=`echo $_ | cut -d" " -f 2` 17 | set XIL_SCRIPT_LOC_TMP_UNI_TAIL=${XIL_SCRIPT_LOC_TMP_UNI:t} 18 | set XIL_SCRIPT_LOC_TMP_UNI=${XIL_SCRIPT_LOC_TMP_UNI:h} 19 | if ( "$XIL_SCRIPT_LOC_TMP_UNI" != "" ) then 20 | if ( "$XIL_SCRIPT_LOC_TMP_UNI" == "$XIL_SCRIPT_LOC_TMP_UNI_TAIL" ) then 21 | set XIL_SCRIPT_LOC_TMP_UNI="./" 22 | endif 23 | set XIL_SCRIPT_LOC_TMP_UNI=`readlink -f ${XIL_SCRIPT_LOC_TMP_UNI}` 24 | if ( $? == 0 ) then 25 | set XIL_SCRIPT_LOC=${XIL_SCRIPT_LOC_TMP_UNI} 26 | endif 27 | endif 28 | unset XIL_SCRIPT_LOC_TMP_UNI_TAIL 29 | unset XIL_SCRIPT_LOC_TMP_UNI 30 | endif 31 | 32 | setenv PETALINUX `readlink -f "${XIL_SCRIPT_LOC}"` 33 | 34 | setenv PETALINUX_VER 2024.1 35 | setenv PETALINUX_MAJOR_VER `echo $PETALINUX_VER | cut -d"." -f 1` 36 | 37 | setenv XSCT_TOOLCHAIN "${PETALINUX}/components/xsct" 38 | 39 | # 40 | # Add toolchains to user's search path 41 | # 42 | setenv PATH "${XSCT_TOOLCHAIN}/gnu/aarch32/lin/aarch64-none-elf/bin:${PATH}" 43 | setenv PATH "${XSCT_TOOLCHAIN}/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin:${PATH}" 44 | setenv PATH "${XSCT_TOOLCHAIN}/gnu/aarch64/lin/aarch64-none/bin:${PATH}" 45 | setenv PATH "${XSCT_TOOLCHAIN}/gnu/aarch64/lin/aarch64-linux/bin:${PATH}" 46 | setenv PATH "${XSCT_TOOLCHAIN}/gnu/armr5/lin/gcc-arm-none-eabi/bin:${PATH}" 47 | setenv PATH "${XSCT_TOOLCHAIN}/gnu/microblaze/lin/bin:${PATH}" 48 | 49 | # 50 | # Add required binary tools to the user's search path 51 | # 52 | setenv PATH "${PETALINUX}/scripts:${PATH}" 53 | 54 | # 55 | # Check for "." or ".\" in the path - it's broken 56 | # 57 | echo ${PATH} | tr ":" "\n" | grep '^\./*$' > /dev/null && echo "WARNING: '.' detected in PATH - fixing it." 58 | setenv PATH `echo ${PATH} | tr ":" "\n" | grep -v '^\./*$' | tr "\n" ":"` 59 | # Strip any trailing or multi-colons - they are interpreted as '.' 60 | setenv PATH `echo ${PATH} | sed -e 's/:*$//g' -e 's/::*/:/g'` 61 | 62 | set plnxbanner="The PetaLinux source code and images provided/generated are for demonstration purposes only." 63 | set plnxbanner_url="Please refer to https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/2741928025/Moving+from+PetaLinux+to+Production+Deployment for more details." 64 | set length=`expr "$plnxbanner_url" : '.*'` 65 | printf '%*s\n' $length | tr ' ' '*' 66 | printf "${plnxbanner}\n" 67 | printf "${plnxbanner_url}\n" 68 | printf '%*s\n' $length | tr ' ' '*' 69 | 70 | echo "[WARNING] Deprecating cshell support in upcoming releases. It is recommended to use settings.sh" 71 | 72 | echo PetaLinux environment set to \'${PETALINUX}\' 73 | 74 | foreach s (/bin/sh sh) 75 | $s --version |& grep -q "^GNU bash" 76 | if ( $status != 0 ) then 77 | echo "WARNING: ${s} is not bash! " 78 | echo "bash is PetaLinux recommended shell. Please set your default shell to bash." 79 | break 80 | endif 81 | end 82 | 83 | if ( $SHELL != "/bin/bash" ) then 84 | echo "WARNING: $SHELL is not bash! " 85 | echo "/bin/bash is Petalinux recommended SHELL variable. Please set your SHELL variable to /bin/bash." 86 | endif 87 | 88 | 89 | # Has this installation been completed? 90 | source ${PETALINUX}/.environment-setup-x86_64-petalinux-linux_csh 91 | ${PETALINUX}/scripts/bash/petalinux-env-check 92 | # 93 | # Not to generate the pycache files in tool 94 | setenv PYTHONDONTWRITEBYTECODE 1 95 | -------------------------------------------------------------------------------- /settings.sh: -------------------------------------------------------------------------------- 1 | # 2 | # Setup script for PetaLinux development environment. 3 | # 4 | # Copyright (c) 1995-2022 Xilinx, Inc. All rights reserved. 5 | # Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved. 6 | # 7 | 8 | SETTINGS_FILE='settings.sh' 9 | # The right location will be replaced by the installer 10 | XIL_SCRIPT_LOC="./" 11 | 12 | if [ $# != 0 ]; then 13 | # The first argument is the location of PetaLinux Installation 14 | # Don't detect the installation location 15 | XIL_SCRIPT_LOC="$1" 16 | else 17 | # XIL_SCRIPT_LOC should point to script location 18 | if [ "$0" == "ksh" ]; then 19 | XIL_SCRIPT_LOC_TMP_UNI=`readlink -f ${XIL_ARG_}` 20 | else 21 | XIL_SCRIPT_LOC_TMP_UNI=$BASH_SOURCE 22 | fi 23 | XIL_SCRIPT_LOC_TMP_UNI=${XIL_SCRIPT_LOC_TMP_UNI%/*} 24 | if [ "$XIL_SCRIPT_LOC_TMP_UNI" != "" ]; then 25 | if [ "$XIL_SCRIPT_LOC_TMP_UNI" == "settings.sh" ]; then 26 | XIL_SCRIPT_LOC_TMP_UNI="./" 27 | fi 28 | XIL_SCRIPT_LOC_TMP_UNI=`readlink -f ${XIL_SCRIPT_LOC_TMP_UNI}` 29 | if [ $? == 0 ]; then 30 | XIL_SCRIPT_LOC=${XIL_SCRIPT_LOC_TMP_UNI} 31 | fi 32 | fi 33 | unset XIL_SCRIPT_LOC_TMP_UNI 34 | fi 35 | 36 | export PETALINUX=`readlink -f "${XIL_SCRIPT_LOC}"` 37 | 38 | if echo "${PETALINUX}" | grep -q ' '; then 39 | echo "********************************************************" 40 | echo "WARNING: PetaLinux SDK installation path contains spaces" 41 | echo "WARNING: You are STRONGLY recommend to fix this". 42 | echo "********************************************************" 43 | fi 44 | export PETALINUX_VER=2024.1 45 | export PETALINUX_MAJOR_VER=${PETALINUX_VER%%.*} 46 | 47 | export XSCT_TOOLCHAIN="${PETALINUX}/components/xsct" 48 | 49 | # Figure out host system architecture 50 | # for now, only linux-i386 supported 51 | 52 | # 53 | # Add toolchains to user's search path 54 | # 55 | PATH="${XSCT_TOOLCHAIN}/gnu/aarch32/lin/gcc-arm-none-eabi/bin:${PATH}" 56 | PATH="${XSCT_TOOLCHAIN}/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin:${PATH}" 57 | PATH="${XSCT_TOOLCHAIN}/gnu/aarch64/lin/aarch64-none/bin:${PATH}" 58 | PATH="${XSCT_TOOLCHAIN}/gnu/aarch64/lin/aarch64-linux/bin:${PATH}" 59 | PATH="${XSCT_TOOLCHAIN}/gnu/armr5/lin/gcc-arm-none-eabi/bin:${PATH}" 60 | PATH="${XSCT_TOOLCHAIN}/gnu/microblaze/lin/bin:${PATH}" 61 | 62 | # 63 | # Add required binary tools to the user's search path 64 | # 65 | PATH="${PETALINUX}/scripts:${PATH}" 66 | 67 | # 68 | # Check for "." or ".\" in the path - it's broken 69 | # 70 | echo "${PATH}" | tr ":" "\n" | grep '^\./*$' > /dev/null && 71 | echo "WARNING: '.' detected in PATH - fixing it." 1>&2 72 | PATH=`echo ${PATH} | tr ":" "\n" | grep -v '^\./*$' | tr "\n" ":"` 73 | 74 | # Strip any trailing or multi-colons - they are interpreted as '.' 75 | PATH=$(echo ${PATH} | sed -e 's/:*$//g' -e 's/::*/:/g') 76 | 77 | plnxbanner="The PetaLinux source code and images provided/generated are for demonstration purposes only." 78 | plnxbanner_url="Please refer to https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/2741928025/Moving+from+PetaLinux+to+Production+Deployment 79 | for more details" 80 | printf "%${#plnxbanner_url}s\n" | tr " " "*" 81 | printf "${plnxbanner}\n" 82 | printf "${plnxbanner_url}\n" 83 | printf "%${#plnxbanner_url}s\n" | tr " " "*" 84 | 85 | echo PetaLinux environment set to \'${PETALINUX}\' 86 | 87 | for s in /bin/sh sh; do 88 | if ! $s --version 2>/dev/null | grep -q "^GNU bash"; then 89 | echo "WARNING: $s is not bash! " 90 | echo "bash is PetaLinux recommended shell. Please set your default shell to bash." 91 | break 92 | fi 93 | done 94 | 95 | if ! echo $SHELL | grep -q "bash"; then 96 | echo "WARNING: $SHELL is not bash! " 97 | echo "/bin/bash is Petalinux recommended SHELL variable. Please set your SHELL variable to /bin/bash." 98 | fi 99 | 100 | 101 | export PATH 102 | 103 | source "${PETALINUX}"/.environment-setup-x86_64-petalinux-linux 104 | "${PETALINUX}"/scripts/bash/petalinux-env-check 105 | # 106 | # Not to generate the pycache files in tool 107 | export PYTHONDONTWRITEBYTECODE=1 108 | -------------------------------------------------------------------------------- /templates/apps/template-autoconf/.gdbinit: -------------------------------------------------------------------------------- 1 | # Load the PetaLinux SDK main gdbinit script 2 | source plnx_gdbinit 3 | 4 | -------------------------------------------------------------------------------- /templates/apps/template-autoconf/@appname@.bb: -------------------------------------------------------------------------------- 1 | # 2 | # This is the GPIO-DEMO apllication recipe 3 | # 4 | # 5 | 6 | SUMMARY = "@appname@ autoconf application" 7 | SECTION = "PETALINUX/apps" 8 | LICENSE = "MIT" 9 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 10 | SRC_URI = "file://@appname@ \ 11 | " 12 | S = "${WORKDIR}/@appname@" 13 | CFLAGS:prepend = "-I ${S}/include" 14 | inherit autotools 15 | -------------------------------------------------------------------------------- /templates/apps/template-autoconf/README: -------------------------------------------------------------------------------- 1 | PetaLinux User Application Template 2 | =================================== 3 | 4 | This directory contains a PetaLinux user application created from a template. 5 | 6 | If you are developing your application from scratch, simply start editing the 7 | file @appname@.c. 8 | 9 | You can easily import any existing application code by copying it into this 10 | directory, and editing the automatically generated Makefile as described below. 11 | 12 | Before building the application, you will need to enable the application 13 | from PetaLinux menuconfig by running: 14 | "petalinux-config -c rootfs" 15 | You will see your application in the "apps --->" submenu. 16 | 17 | To build your application, simply run "petalinux-build -c @appname@". 18 | This command will build your application and will install your application 19 | into the target file system host copy. 20 | 21 | You will also need to rebuild PetaLinux bootable images so that the images 22 | is updated with the updated target filesystem copy, run this command: 23 | "petalinux-build -c rootfs" 24 | 25 | You can also run one PetaLinux command to install the application to the 26 | target filesystem host copy and update the bootable images as follows: 27 | "petalinux-build" 28 | 29 | To add extra source code files (for example, to split a large application into 30 | multiple source files), add the relevant .o files to the list in the local 31 | Makefile where indicated. 32 | 33 | -------------------------------------------------------------------------------- /templates/apps/template-autoconf/files/@appname@/AUTHORS: -------------------------------------------------------------------------------- 1 | [ Sample AUTHORS file as suggested by the "Learning the GNU 2 | development tools", written originallly by Eleftherios 3 | Gkioulekas, and later maintained by Marcelo Roberto Jimenez 4 | This tutorial can be found at: 5 | http://autotoolset.sourceforge.net/tutorial.html 6 | ] 7 | 8 | Authors of hello 9 | 10 | The following contributions warranted legal paper exchanges 11 | with the Free Software Foundation. Also see files ChangeLog 12 | and THANKS. 13 | 14 | Ima Koder 15 | entire files -> @appname@.c 16 | modifications -> all 17 | 18 | Kode Vicious 19 | modifications-> @appname@.c (specific changes here) 20 | -------------------------------------------------------------------------------- /templates/apps/template-autoconf/files/@appname@/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xilinx/PetaLinux/44644a911c4ee47be5a3ed412c154126b1bc4ea8/templates/apps/template-autoconf/files/@appname@/ChangeLog -------------------------------------------------------------------------------- /templates/apps/template-autoconf/files/@appname@/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = configure doc/@appname@.man 2 | SUBDIRS = doc src 3 | -------------------------------------------------------------------------------- /templates/apps/template-autoconf/files/@appname@/NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xilinx/PetaLinux/44644a911c4ee47be5a3ed412c154126b1bc4ea8/templates/apps/template-autoconf/files/@appname@/NEWS -------------------------------------------------------------------------------- /templates/apps/template-autoconf/files/@appname@/README: -------------------------------------------------------------------------------- 1 | This package is designed as a sample GNU build, to 2 | learn GNU auto* tools and procedures. It is 3 | adapted from the "Learning the GNU development tools", 4 | written by Eleftherios Gkioulekas. This tutorial can 5 | be found at: 6 | http://autotoolset.sourceforge.net/tutorial.html 7 | 8 | The README file contains the information an experienced 9 | developer needs to know about the package in general 10 | and any special steps on how to build and/or configure it. 11 | (New developers should read the standard INSTALL file, 12 | and run "./configure --help" to see which options are 13 | available.) 14 | 15 | This package produces a simple hello world program. 16 | You can build it the usual way: 17 | ./configure 18 | make 19 | make install 20 | (It is suggested you use the "--prefix" option to 21 | configure to install in your home directory, like this: 22 | ./configure --prefix=/home/rkakarla 23 | 24 | -Ima Koder, anytown USA. 2/11/2005 25 | -------------------------------------------------------------------------------- /templates/apps/template-autoconf/files/@appname@/THANKS: -------------------------------------------------------------------------------- 1 | [ This is a fictious sample THANKS file ] 2 | @appname@ THANKS file 3 | This hello package was originally written by Ima Koder. 4 | Many people further contributed to hello by reporting problems, 5 | suggesting various improvements or submitting actual code. 6 | Here is a list of these people. Please help me keep it 7 | complete and accurate by reporting any additions and 8 | corrections to the current maintainer at: 9 | 10 | hello-maintainer@fake.org 11 | 12 | My apologies to anyone I've inadverntently overlooked! 13 | 14 | Contributors: 15 | Kode Vicious 16 | The Shell Answer Man 17 | Nathan Detroit 18 | -------------------------------------------------------------------------------- /templates/apps/template-autoconf/files/@appname@/configure.ac: -------------------------------------------------------------------------------- 1 | AC_INIT([hello world program], [1.0], [Ima Koder ], [@appname@]) 2 | AC_CONFIG_SRCDIR([src/@appname@.c]) 3 | AC_CONFIG_HEADER([config.h]) 4 | AC_CHECK_HEADER([stdio.h]) 5 | AC_REVISION([: 1.0 $]) 6 | AM_INIT_AUTOMAKE 7 | AC_PROG_CC 8 | AC_PROG_INSTALL 9 | AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile]) 10 | AC_OUTPUT 11 | -------------------------------------------------------------------------------- /templates/apps/template-autoconf/files/@appname@/doc/@appname@.man: -------------------------------------------------------------------------------- 1 | .\" This is a man page for the hello command. It is intended to 2 | .\" be a model for writting man pages. 3 | . 4 | .\" Written by Ima Koder, Tampa Florida USA, 3/2005. 5 | .TH HELLO 1 "3/27/2005" "(C) IK ShellScript Co." "Ima Koder" 6 | . 7 | .SH NAME 8 | hello \- Display a friendly greeting 9 | . 10 | .SH SYNOPSIS 11 | .B hello 12 | . 13 | .SH DESCRIPTION 14 | The 15 | .B hello 16 | command simply displays a short greeting to the world. 17 | . 18 | .SH AUTHOR 19 | Ima Koder 30 | #endif 31 | 32 | #include 33 | 34 | int main ( void ) 35 | { 36 | printf( "Hey there, world!\n" ); 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /templates/apps/template-autoconf/files/@appname@/src/Makefile.am: -------------------------------------------------------------------------------- 1 | bin_PROGRAMS = @appname@ 2 | @appname@_SOURCES = @appname@.c 3 | -------------------------------------------------------------------------------- /templates/apps/template-c++/.gdbinit: -------------------------------------------------------------------------------- 1 | # Load the PetaLinux SDK main gdbinit script 2 | source plnx_gdbinit 3 | 4 | -------------------------------------------------------------------------------- /templates/apps/template-c++/@appname@.bb: -------------------------------------------------------------------------------- 1 | # 2 | # This file is the @appname@ recipe. 3 | # 4 | 5 | SUMMARY = "Simple @appname@ application" 6 | SECTION = "PETALINUX/apps" 7 | LICENSE = "MIT" 8 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 9 | 10 | SRC_URI = "file://@appname@.cpp \ 11 | file://Makefile \ 12 | " 13 | 14 | S = "${WORKDIR}" 15 | 16 | do_compile() { 17 | oe_runmake 18 | } 19 | 20 | do_install() { 21 | install -d ${D}${bindir} 22 | install -m 0755 @appname@ ${D}${bindir} 23 | } 24 | -------------------------------------------------------------------------------- /templates/apps/template-c++/README: -------------------------------------------------------------------------------- 1 | PetaLinux User Application Template 2 | =================================== 3 | 4 | This directory contains a PetaLinux user application created from a template. 5 | 6 | If you are developing your application from scratch, simply start editing the 7 | file @appname@.c. 8 | 9 | You can easily import any existing application code by copying it into this 10 | directory, and editing the automatically generated Makefile. 11 | 12 | Before building the application, you will need to enable the application 13 | from PetaLinux menuconfig by running: 14 | "petalinux-config -c rootfs" 15 | You will see your application in the "apps --->" submenu. 16 | 17 | To build your application, simply run "petalinux-build -c @appname@". 18 | This command will build your application and will install your application 19 | into the target file system host copy. 20 | 21 | You will also need to rebuild PetaLinux bootable images so that the images 22 | is updated with the updated target filesystem copy, run this command: 23 | "petalinux-build -c rootfs" 24 | 25 | You can also run one PetaLinux command to install the application to the 26 | target filesystem host copy and update the bootable images as follows: 27 | "petalinux-build" 28 | 29 | To add extra source code files (for example, to split a large application into 30 | multiple source files), add the relevant .o files to the list in the local 31 | Makefile where indicated. 32 | 33 | -------------------------------------------------------------------------------- /templates/apps/template-c++/files/@appname@.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Placeholder PetaLinux user application. 3 | * 4 | * Replace this with your application code 5 | 6 | * Copyright (C) 2013-2022 Xilinx, Inc. All rights reserved. 7 | * Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved. 8 | * 9 | * Permission is hereby granted, free of charge, to any person 10 | * obtaining a copy of this software and associated documentation 11 | * files (the "Software"), to deal in the Software without restriction, 12 | * including without limitation the rights to use, copy, modify, merge, 13 | * publish, distribute, sublicense, and/or sell copies of the Software, 14 | * and to permit persons to whom the Software is furnished to do so, 15 | * subject to the following conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be included 18 | * in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 23 | * IN NO EVENT SHALL XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 25 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * Except as contained in this notice, the name of the Xilinx shall not be used 28 | * in advertising or otherwise to promote the sale, use or other dealings in this 29 | * Software without prior written authorization from Xilinx. 30 | * 31 | */ 32 | 33 | #include 34 | using namespace std; 35 | 36 | int main(int argc, char *argv[]) 37 | { 38 | cout << "Hello, PetaLinux World!\n"; 39 | cout << "cmdline args:\n"; 40 | while(argc--) 41 | cout << *argv++ << endl; 42 | 43 | return 0; 44 | } 45 | 46 | 47 | -------------------------------------------------------------------------------- /templates/apps/template-c++/files/Makefile: -------------------------------------------------------------------------------- 1 | APP = @appname@ 2 | 3 | # Add any other object files to this list below 4 | APP_OBJS = @appname@.o 5 | 6 | all: build 7 | 8 | build: $(APP) 9 | 10 | $(APP): $(APP_OBJS) 11 | $(CXX) -o $@ $(APP_OBJS) $(LDFLAGS) $(LDLIBS) 12 | clean: 13 | rm -f $(APP) *.o 14 | -------------------------------------------------------------------------------- /templates/apps/template-c/.gdbinit: -------------------------------------------------------------------------------- 1 | # Load the PetaLinux SDK main gdbinit script 2 | source plnx_gdbinit 3 | -------------------------------------------------------------------------------- /templates/apps/template-c/@appname@.bb: -------------------------------------------------------------------------------- 1 | # 2 | # This file is the @appname@ recipe. 3 | # 4 | 5 | SUMMARY = "Simple @appname@ application" 6 | SECTION = "PETALINUX/apps" 7 | LICENSE = "MIT" 8 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 9 | 10 | SRC_URI = "file://@appname@.c \ 11 | file://Makefile \ 12 | " 13 | 14 | S = "${WORKDIR}" 15 | 16 | do_compile() { 17 | oe_runmake 18 | } 19 | 20 | do_install() { 21 | install -d ${D}${bindir} 22 | install -m 0755 @appname@ ${D}${bindir} 23 | } 24 | -------------------------------------------------------------------------------- /templates/apps/template-c/README: -------------------------------------------------------------------------------- 1 | PetaLinux User Application Template 2 | =================================== 3 | 4 | This directory contains a PetaLinux user application created from a template. 5 | 6 | If you are developing your application from scratch, simply start editing the 7 | file @appname@.c. 8 | 9 | You can easily import any existing application code by copying it into this 10 | directory, and editing the automatically generated Makefile. 11 | 12 | Before building the application, you will need to enable the application 13 | from PetaLinux menuconfig by running: 14 | "petalinux-config -c rootfs" 15 | You will see your application in the "apps --->" submenu. 16 | 17 | To build your application, simply run "petalinux-build -c @appname@". 18 | This command will build your application and will install your application 19 | into the target file system host copy. 20 | 21 | You will also need to rebuild PetaLinux bootable images so that the images 22 | is updated with the updated target filesystem copy, run this command: 23 | "petalinux-build -c rootfs" 24 | 25 | You can also run one PetaLinux command to install the application to the 26 | target filesystem host copy and update the bootable images as follows: 27 | "petalinux-build" 28 | 29 | To add extra source code files (for example, to split a large application into 30 | multiple source files), add the relevant .o files to the list in the local 31 | Makefile where indicated. 32 | 33 | -------------------------------------------------------------------------------- /templates/apps/template-c/files/@appname@.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013-2022 Xilinx, Inc. All rights reserved. 3 | * Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without restriction, 8 | * including without limitation the rights to use, copy, modify, merge, 9 | * publish, distribute, sublicense, and/or sell copies of the Software, 10 | * and to permit persons to whom the Software is furnished to do so, 11 | * subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included 14 | * in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | * IN NO EVENT SHALL XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | * Except as contained in this notice, the name of the Xilinx shall not be used 24 | * in advertising or otherwise to promote the sale, use or other dealings in this 25 | * Software without prior written authorization from Xilinx. 26 | * 27 | */ 28 | 29 | #include 30 | 31 | int main(int argc, char **argv) 32 | { 33 | printf("Hello World!\n"); 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /templates/apps/template-c/files/Makefile: -------------------------------------------------------------------------------- 1 | APP = @appname@ 2 | 3 | # Add any other object files to this list below 4 | APP_OBJS = @appname@.o 5 | 6 | all: build 7 | 8 | build: $(APP) 9 | 10 | $(APP): $(APP_OBJS) 11 | $(CC) -o $@ $(APP_OBJS) $(LDFLAGS) $(LDLIBS) 12 | clean: 13 | rm -f $(APP) *.o 14 | 15 | -------------------------------------------------------------------------------- /templates/apps/template-dfx_dtg_versal_full/@appname@.bb: -------------------------------------------------------------------------------- 1 | # 2 | # This file is the @appname@ recipe. 3 | # 4 | 5 | SUMMARY = "Simple @appname@ to use dfx_dtg_versal_full class" 6 | SECTION = "PETALINUX/apps" 7 | LICENSE = "MIT" 8 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 9 | 10 | inherit dfx_dtg_versal_full 11 | 12 | COMPATIBLE_MACHINE:versal = ".*" 13 | 14 | -------------------------------------------------------------------------------- /templates/apps/template-dfx_dtg_versal_full/README: -------------------------------------------------------------------------------- 1 | PetaLinux Firmware Application Template 2 | =================================== 3 | 4 | This directory contains a PetaLinux firmware application created from a template. 5 | 6 | Adding a xsa to srcuri, the dfx_dtg_versal_full class will assume no 7 | other dependencies and automatically pack the ${PN}.dtbo ${PN}.bit.bin into rootfs. 8 | 9 | 1.Before building the application, you will need to enable the application 10 | from PetaLinux menuconfig by running below command if you do not specify --enable option 11 | while creating the application. 12 | "petalinux-config -c rootfs" 13 | You will see your application in the "User Packages --->" submenu 14 | to pack this firmware artifacts as part of rootfs. 15 | 16 | 2.You will need to rebuild PetaLinux bootable images so that the images 17 | is updated with the updated target filesystem copy, run this command: 18 | "petalinux-build -c rootfs" 19 | or 20 | You can also run one PetaLinux command to install the application to the 21 | target filesystem host copy and update the bootable images as follows: 22 | "petailinux-build" 23 | 24 | To generate only rpm with firmware artifacts and not packing in rootfs 25 | no need to give --enable option while creating, run this command: 26 | "petalinux-build -c @appname@" 27 | you can find the rpm in build/tmp/deploy/rpm directory. 28 | 29 | Based on the design type shell.json content 30 | "shell_type" and num_slots might vary please refer below dfx_mgr doc 31 | for more details. 32 | https://github.com/Xilinx/dfx-mgr/blob/master/README.md 33 | -------------------------------------------------------------------------------- /templates/apps/template-dfx_dtg_versal_partial/@appname@.bb: -------------------------------------------------------------------------------- 1 | # 2 | # This file is the @appname@ recipe. 3 | # 4 | 5 | SUMMARY = "Simple @appname@ to use dfx_dtg_versal_partial class" 6 | SECTION = "PETALINUX/apps" 7 | LICENSE = "MIT" 8 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 9 | 10 | inherit dfx_dtg_versal_partial 11 | 12 | COMPATIBLE_MACHINE:versal = ".*" 13 | 14 | -------------------------------------------------------------------------------- /templates/apps/template-dfx_dtg_versal_partial/README: -------------------------------------------------------------------------------- 1 | PetaLinux Firmware Application Template 2 | =================================== 3 | 4 | This directory contains a PetaLinux firmware application created from a template. 5 | 6 | Adding a xsa to srcuri, the dfx_dtg_versal_partial class will assume no 7 | other dependencies and automatically pack the ${PN}.dtbo ${PN}.bit.bin into rootfs. 8 | 9 | 1.Before building the application, you will need to enable the application 10 | from PetaLinux menuconfig by running below command if you do not specify --enable option 11 | while creating the application. 12 | "petalinux-config -c rootfs" 13 | You will see your application in the "User Packages --->" submenu 14 | to pack this firmware artifacts as part of rootfs. 15 | 16 | 2.You will need to rebuild PetaLinux bootable images so that the images 17 | is updated with the updated target filesystem copy, run this command: 18 | "petalinux-build -c rootfs" 19 | or 20 | You can also run one PetaLinux command to install the application to the 21 | target filesystem host copy and update the bootable images as follows: 22 | "petailinux-build" 23 | 24 | To generate only rpm with firmware artifacts and not packing in rootfs 25 | no need to give --enable option while creating, run this command: 26 | "petalinux-build -c @appname@" 27 | you can find the rpm in build/tmp/deploy/rpm directory. 28 | 29 | Based on the design type accel.json content like 30 | "accel_type" might vary please refer below dfx_mgr doc 31 | for more details. 32 | https://github.com/Xilinx/dfx-mgr/blob/master/README.md 33 | -------------------------------------------------------------------------------- /templates/apps/template-dfx_dtg_versal_static/@appname@.bb: -------------------------------------------------------------------------------- 1 | # 2 | # This file is the @appname@ recipe. 3 | # 4 | 5 | SUMMARY = "Simple @appname@ to use dfx_dtg_versal_static class" 6 | SECTION = "PETALINUX/apps" 7 | LICENSE = "MIT" 8 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 9 | 10 | inherit dfx_dtg_versal_static 11 | 12 | COMPATIBLE_MACHINE:versal = ".*" 13 | 14 | -------------------------------------------------------------------------------- /templates/apps/template-dfx_dtg_versal_static/README: -------------------------------------------------------------------------------- 1 | PetaLinux Firmware Application Template 2 | =================================== 3 | 4 | This directory contains a PetaLinux firmware application created from a template. 5 | 6 | Adding a xsa to srcuri, the dfx_dtg_versal_static class will assume no 7 | other dependencies and automatically pack the ${PN}.dtbo ${PN}.bit.bin into rootfs. 8 | 9 | 1.Before building the application, you will need to enable the application 10 | from PetaLinux menuconfig by running below command if you do not specify --enable option 11 | while creating the application. 12 | "petalinux-config -c rootfs" 13 | You will see your application in the "User Packages --->" submenu 14 | to pack this firmware artifacts as part of rootfs. 15 | 16 | 2.You will need to rebuild PetaLinux bootable images so that the images 17 | is updated with the updated target filesystem copy, run this command: 18 | "petalinux-build -c rootfs" 19 | or 20 | You can also run one PetaLinux command to install the application to the 21 | target filesystem host copy and update the bootable images as follows: 22 | "petailinux-build" 23 | 24 | To generate only rpm with firmware artifacts and not packing in rootfs 25 | no need to give --enable option while creating, run this command: 26 | "petalinux-build -c @appname@" 27 | you can find the rpm in build/tmp/deploy/rpm directory. 28 | 29 | Based on the design type shell.json content 30 | "shell_type" and num_slots might vary please refer below dfx_mgr doc 31 | for more details. 32 | https://github.com/Xilinx/dfx-mgr/blob/master/README.md 33 | -------------------------------------------------------------------------------- /templates/apps/template-dfx_dtg_zynq_full/@appname@.bb: -------------------------------------------------------------------------------- 1 | # 2 | # This file is the @appname@ recipe. 3 | # 4 | 5 | SUMMARY = "Simple @appname@ to use dfx_dtg_zynq_full class" 6 | SECTION = "PETALINUX/apps" 7 | LICENSE = "MIT" 8 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 9 | 10 | inherit dfx_dtg_zynq_full 11 | 12 | COMPATIBLE_MACHINE:zynq = ".*" 13 | 14 | -------------------------------------------------------------------------------- /templates/apps/template-dfx_dtg_zynq_full/README: -------------------------------------------------------------------------------- 1 | PetaLinux Firmware Application Template 2 | =================================== 3 | 4 | This directory contains a PetaLinux firmware application created from a template. 5 | 6 | Adding a xsa to srcuri, the dfx_dtg_zynq_full class will assume no 7 | other dependencies and automatically pack the ${PN}.dtbo ${PN}.bit.bin into rootfs. 8 | 9 | 1.Before building the application, you will need to enable the application 10 | from PetaLinux menuconfig by running below command if you do not specify --enable option 11 | while creating the application. 12 | "petalinux-config -c rootfs" 13 | You will see your application in the "User Packages --->" submenu 14 | to pack this firmware artifacts as part of rootfs. 15 | 16 | 2.You will need to rebuild PetaLinux bootable images so that the images 17 | is updated with the updated target filesystem copy, run this command: 18 | "petalinux-build -c rootfs" 19 | or 20 | You can also run one PetaLinux command to install the application to the 21 | target filesystem host copy and update the bootable images as follows: 22 | "petailinux-build" 23 | 24 | To generate only rpm with firmware artifacts and not packing in rootfs 25 | no need to give --enable option while creating, run this command: 26 | "petalinux-build -c @appname@" 27 | you can find the rpm in build/tmp/deploy/rpm directory. 28 | -------------------------------------------------------------------------------- /templates/apps/template-dfx_dtg_zynqmp_full/@appname@.bb: -------------------------------------------------------------------------------- 1 | # 2 | # This file is the @appname@ recipe. 3 | # 4 | 5 | SUMMARY = "Simple @appname@ to use dfx_dtg_zynqmp_full class" 6 | SECTION = "PETALINUX/apps" 7 | LICENSE = "MIT" 8 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 9 | 10 | inherit dfx_dtg_zynqmp_full 11 | 12 | COMPATIBLE_MACHINE:zynqmp = ".*" 13 | 14 | -------------------------------------------------------------------------------- /templates/apps/template-dfx_dtg_zynqmp_full/README: -------------------------------------------------------------------------------- 1 | PetaLinux Firmware Application Template 2 | =================================== 3 | 4 | This directory contains a PetaLinux firmware application created from a template. 5 | 6 | Adding a xsa to srcuri, the dfx_dtg_zynqmp_full class will assume no 7 | other dependencies and automatically pack the ${PN}.dtbo ${PN}.bit.bin into rootfs. 8 | 9 | 1.Before building the application, you will need to enable the application 10 | from PetaLinux menuconfig by running below command if you do not specify --enable option 11 | while creating the application. 12 | "petalinux-config -c rootfs" 13 | You will see your application in the "User Packages --->" submenu 14 | to pack this firmware artifacts as part of rootfs. 15 | 16 | 2.You will need to rebuild PetaLinux bootable images so that the images 17 | is updated with the updated target filesystem copy, run this command: 18 | "petalinux-build -c rootfs" 19 | or 20 | You can also run one PetaLinux command to install the application to the 21 | target filesystem host copy and update the bootable images as follows: 22 | "petailinux-build" 23 | 24 | To generate only rpm with firmware artifacts and not packing in rootfs 25 | no need to give --enable option while creating, run this command: 26 | "petalinux-build -c @appname@" 27 | you can find the rpm in build/tmp/deploy/rpm directory. 28 | 29 | Based on the design type shell.json content 30 | "shell_type" and num_slots might vary please refer below dfx_mgr doc 31 | for more details. 32 | https://github.com/Xilinx/dfx-mgr/blob/master/README.md 33 | -------------------------------------------------------------------------------- /templates/apps/template-dfx_dtg_zynqmp_partial/@appname@.bb: -------------------------------------------------------------------------------- 1 | # 2 | # This file is the @appname@ recipe. 3 | # 4 | 5 | SUMMARY = "Simple @appname@ to use dfx_dtg_zynqmp_partial class" 6 | SECTION = "PETALINUX/apps" 7 | LICENSE = "MIT" 8 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 9 | 10 | inherit dfx_dtg_zynqmp_partial 11 | 12 | COMPATIBLE_MACHINE:zynqmp = ".*" 13 | 14 | -------------------------------------------------------------------------------- /templates/apps/template-dfx_dtg_zynqmp_partial/README: -------------------------------------------------------------------------------- 1 | PetaLinux Firmware Application Template 2 | =================================== 3 | 4 | This directory contains a PetaLinux firmware application created from a template. 5 | 6 | Adding a xsa to srcuri, the dfx_dtg_zynqmp_partial class will assume no 7 | other dependencies and automatically pack the ${PN}.dtbo ${PN}.bit.bin into rootfs. 8 | 9 | 1.Before building the application, you will need to enable the application 10 | from PetaLinux menuconfig by running below command if you do not specify --enable option 11 | while creating the application. 12 | "petalinux-config -c rootfs" 13 | You will see your application in the "User Packages --->" submenu 14 | to pack this firmware artifacts as part of rootfs. 15 | 16 | 2.You will need to rebuild PetaLinux bootable images so that the images 17 | is updated with the updated target filesystem copy, run this command: 18 | "petalinux-build -c rootfs" 19 | or 20 | You can also run one PetaLinux command to install the application to the 21 | target filesystem host copy and update the bootable images as follows: 22 | "petailinux-build" 23 | 24 | To generate only rpm with firmware artifacts and not packing in rootfs 25 | no need to give --enable option while creating, run this command: 26 | "petalinux-build -c @appname@" 27 | you can find the rpm in build/tmp/deploy/rpm directory. 28 | 29 | Based on the design type accel.json content like 30 | "accel_type" might vary please refer below dfx_mgr doc 31 | for more details. 32 | https://github.com/Xilinx/dfx-mgr/blob/master/README.md 33 | -------------------------------------------------------------------------------- /templates/apps/template-dfx_dtg_zynqmp_static/@appname@.bb: -------------------------------------------------------------------------------- 1 | # 2 | # This file is the @appname@ recipe. 3 | # 4 | 5 | SUMMARY = "Simple @appname@ to use dfx_dtg_zynqmp_static class" 6 | SECTION = "PETALINUX/apps" 7 | LICENSE = "MIT" 8 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 9 | 10 | inherit dfx_dtg_zynqmp_static 11 | 12 | COMPATIBLE_MACHINE:zynqmp = ".*" 13 | 14 | -------------------------------------------------------------------------------- /templates/apps/template-dfx_dtg_zynqmp_static/README: -------------------------------------------------------------------------------- 1 | PetaLinux Firmware Application Template 2 | =================================== 3 | 4 | This directory contains a PetaLinux firmware application created from a template. 5 | 6 | Adding a xsa to srcuri, the dfx_dtg_zynqmp_static class will assume no 7 | other dependencies and automatically pack the ${PN}.dtbo ${PN}.bit.bin into rootfs. 8 | 9 | 1.Before building the application, you will need to enable the application 10 | from PetaLinux menuconfig by running below command if you do not specify --enable option 11 | while creating the application. 12 | "petalinux-config -c rootfs" 13 | You will see your application in the "User Packages --->" submenu 14 | to pack this firmware artifacts as part of rootfs. 15 | 16 | 2.You will need to rebuild PetaLinux bootable images so that the images 17 | is updated with the updated target filesystem copy, run this command: 18 | "petalinux-build -c rootfs" 19 | or 20 | You can also run one PetaLinux command to install the application to the 21 | target filesystem host copy and update the bootable images as follows: 22 | "petailinux-build" 23 | 24 | To generate only rpm with firmware artifacts and not packing in rootfs 25 | no need to give --enable option while creating, run this command: 26 | "petalinux-build -c @appname@" 27 | you can find the rpm in build/tmp/deploy/rpm directory. 28 | 29 | Based on the design type shell.json content 30 | "shell_type" and num_slots might vary please refer below dfx_mgr doc 31 | for more details. 32 | https://github.com/Xilinx/dfx-mgr/blob/master/README.md 33 | -------------------------------------------------------------------------------- /templates/apps/template-dfx_user_dts/@appname@.bb: -------------------------------------------------------------------------------- 1 | # 2 | # This file is the @appname@ recipe. 3 | # 4 | 5 | SUMMARY = "Simple @appname@ to use dfx_user_dts class" 6 | SECTION = "PETALINUX/apps" 7 | LICENSE = "MIT" 8 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 9 | 10 | inherit dfx_user_dts 11 | 12 | COMPATIBLE_MACHINE:versal = ".*" 13 | COMPATIBLE_MACHINE:zynqmp = ".*" 14 | COMPATIBLE_MACHINE:zynq = ".*" 15 | 16 | -------------------------------------------------------------------------------- /templates/apps/template-dfx_user_dts/README: -------------------------------------------------------------------------------- 1 | PetaLinux Firmware Application Template 2 | =================================== 3 | 4 | This directory contains a PetaLinux firmware application created from a template. 5 | 6 | Adding a xsa to srcuri, the dfx_user_dts class will assume no 7 | other dependencies and automatically pack the ${PN}.dtbo ${PN}.bit.bin into rootfs. 8 | 9 | 1.Before building the application, you will need to enable the application 10 | from PetaLinux menuconfig by running below command if you do not specify --enable option 11 | while creating the application. 12 | "petalinux-config -c rootfs" 13 | You will see your application in the "User Packages --->" submenu 14 | to pack this firmware artifacts as part of rootfs. 15 | 16 | 2.You will need to rebuild PetaLinux bootable images so that the images 17 | is updated with the updated target filesystem copy, run this command: 18 | "petalinux-build -c rootfs" 19 | or 20 | You can also run one PetaLinux command to install the application to the 21 | target filesystem host copy and update the bootable images as follows: 22 | "petailinux-build" 23 | 24 | To generate only rpm with firmware artifacts and not packing in rootfs 25 | no need to give --enable option while creating, run this command: 26 | "petalinux-build -c @appname@" 27 | you can find the rpm in build/tmp/deploy/rpm directory. 28 | 29 | Note: The shell.json will not applicable for zynq platforms 30 | as the file will be used while loading with dfx_mgr and dfx_mgr 31 | support not added for zynq. 32 | 33 | For versal and zynqmp based on the design type shell.json content 34 | "shell_type" and num_slots might vary please refer below dfx_mgr doc 35 | for more details. 36 | https://github.com/Xilinx/dfx-mgr/blob/master/README.md 37 | -------------------------------------------------------------------------------- /templates/apps/template-install/.gdbinit: -------------------------------------------------------------------------------- 1 | # Load the PetaLinux SDK main gdbinit script 2 | source plnx_gdbinit 3 | 4 | -------------------------------------------------------------------------------- /templates/apps/template-install/@appname@.bb: -------------------------------------------------------------------------------- 1 | # 2 | # This file is the @appname@ recipe. 3 | # 4 | 5 | SUMMARY = "Simple @appname@ application" 6 | SECTION = "PETALINUX/apps" 7 | LICENSE = "MIT" 8 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 9 | 10 | SRC_URI = "file://@appname@ \ 11 | " 12 | 13 | S = "${WORKDIR}" 14 | 15 | do_install() { 16 | install -d ${D}/${bindir} 17 | install -m 0755 ${S}/@appname@ ${D}/${bindir} 18 | } 19 | -------------------------------------------------------------------------------- /templates/apps/template-install/README: -------------------------------------------------------------------------------- 1 | PetaLinux User Application Template 2 | =================================== 3 | 4 | This directory contains a PetaLinux user application created from a template. 5 | 6 | You can easily import any already built application or script by copying 7 | it into this directory, and editing the automatically generated Makefile 8 | as described below. 9 | 10 | Modify the "install:" target in Makefile to use $(TARGETINST) to install your 11 | prebuilt application or script to the host copy of the target file system 12 | referring to the comments of the "install:" target. 13 | 14 | Before building the application, you will need to enable the application 15 | from PetaLinux menuconfig by running: 16 | "petalinux-config -c rootfs" 17 | You will see your application in the "apps --->" submenu. 18 | 19 | To install your prebuilt application or script to the target file system 20 | copy on the host, simply run the command. 21 | "petalinux-build -c rootfs/@appname@" 22 | 23 | You will also need to rebuild PetaLinux bootable images so that the images 24 | is updated with the updated target filesystem copy, run this command: 25 | "petalinux-build -c rootfs" 26 | 27 | You can also run one PetaLinux command to install the application to the 28 | target filesystem host copy and update the bootable images as follows: 29 | "petalinux-build" 30 | 31 | -------------------------------------------------------------------------------- /templates/apps/template-install/files/@appname@: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "Hello PetaLinux World" 4 | 5 | -------------------------------------------------------------------------------- /templates/apps/template-source/.gdbinit: -------------------------------------------------------------------------------- 1 | # Load the PetaLinux SDK main gdbinit script 2 | source plnx_gdbinit 3 | 4 | -------------------------------------------------------------------------------- /templates/apps/template-source/Kconfig: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Please modify this file if you want to configure your own application. 3 | # You can uncommon and/or change the following Kconfig elements. 4 | ############################################################################### 5 | 6 | 7 | if ROOTFS_COMPONENT_@DIRPREFIX@_NAME_@APPNAME@ 8 | comment "No additional options for @APPNAME@" 9 | 10 | # config @DIRPREFIX@_@APPNAME@_OPTION0 11 | # bool "option0" 12 | # help 13 | # Help text 14 | endif 15 | -------------------------------------------------------------------------------- /templates/apps/template-source/Makefile: -------------------------------------------------------------------------------- 1 | ifndef PETALINUX 2 | $(error "Error: PETALINUX environment variable not set. Change to the root of your PetaLinux install, and source the settings.sh file") 3 | endif 4 | include apps.common.mk 5 | 6 | all: build install 7 | 8 | build: 9 | make -C @source@ $@ 10 | 11 | clean: 12 | make -C @source@ $@ 13 | 14 | .PHONY: install image 15 | 16 | install: build 17 | # Please add commands below the comments to install your app to target file system. 18 | # Use $(TARGETINST) to copy data into the target 19 | # E.g. there is @appname@ user app in the current directory, and I want 20 | # to copy it into the target "/bin" directory: 21 | #$(TARGETINST) -d @appname@ /bin/@appname@ 22 | 23 | help: 24 | @echo "" 25 | @echo "Quick reference for various supported build targets for $(INSTANCE)." 26 | @echo "----------------------------------------------------" 27 | @echo " clean clean out build objects" 28 | @echo " all build $(INSTANCE) and install to rootfs host copy" 29 | @echo " build build subsystem" 30 | @echo " install install built objects to rootfs host copy" 31 | -------------------------------------------------------------------------------- /templates/apps/template-source/README: -------------------------------------------------------------------------------- 1 | PetaLinux User Application Template 2 | =================================== 3 | 4 | This directory contains a PetaLinux user application created from a template. 5 | 6 | You can easily import any existing application code by copying it into this 7 | directory, and editing the automatically generated Makefile as described below. 8 | 9 | The "all:" target in the Makefile template will go to source directory to 10 | compile the application source. 11 | 12 | Before building the application, you will need to enable the application 13 | from PetaLinux menuconfig by running: 14 | "petalinux-config -c rootfs" 15 | You will see your application in the "apps --->" submenu. 16 | 17 | To build your application, simply run "petalinux-build -c @appname@". 18 | This command will build your application and will install your application 19 | into the target file system host copy. 20 | 21 | You will also need to rebuild PetaLinux bootable images so that the images 22 | is updated with the updated target filesystem copy, run this command: 23 | "petalinux-build -c rootfs" 24 | 25 | You can also run one PetaLinux command to install the application to the 26 | target filesystem host copy and update the bootable images as follows: 27 | "petalinux-build" 28 | -------------------------------------------------------------------------------- /templates/modules/template-c/@modname@.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "Recipe for build an external @modname@ Linux kernel module" 2 | SECTION = "PETALINUX/modules" 3 | LICENSE = "GPLv2" 4 | LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e" 5 | 6 | inherit module 7 | 8 | INHIBIT_PACKAGE_STRIP = "1" 9 | 10 | SRC_URI = "file://Makefile \ 11 | file://@modname@.c \ 12 | file://COPYING \ 13 | " 14 | 15 | S = "${WORKDIR}" 16 | 17 | # The inherit of module.bbclass will automatically name module packages with 18 | # "kernel-module-" prefix as required by the oe-core build environment. 19 | -------------------------------------------------------------------------------- /templates/modules/template-c/README: -------------------------------------------------------------------------------- 1 | PetaLinux User Module Template 2 | =================================== 3 | 4 | This directory contains a PetaLinux kernel module created from a template. 5 | 6 | If you are developing your module from scratch, simply start editing the 7 | file @modname@.c. 8 | 9 | You can easily import any existing module code by copying it into this 10 | directory, and editing the automatically generated Makefile as described below. 11 | 12 | The "all:" target in the Makefile template will compile compile the module. 13 | 14 | Before building the module, you will need to enable the module from 15 | PetaLinux menuconfig by running: 16 | "petalinux-config -c rootfs" 17 | You will see your module in the "modules --->" submenu. 18 | 19 | To compile and install your module to the target file system copy on the host, 20 | simply run the command. 21 | "petalinux-build -c kernel" to build kernel first, and then run 22 | "petalinux-build -c @modname@" to build the module 23 | 24 | You will also need to rebuild PetaLinux bootable images so that the images 25 | is updated with the updated target filesystem copy, run this command: 26 | "petalinux-build -c rootfs" 27 | 28 | You can also run one PetaLinux command to compile the module, install it 29 | to the target filesystem host copy and update the bootable images as follows: 30 | "petalinux-build" 31 | 32 | If OF(OpenFirmware) is configured, you need to add the device node to the 33 | DTS(Device Tree Source) file so that the device can be probed when the module is 34 | loaded. Here is an example of the device node in the device tree: 35 | 36 | @modname@_instance: @modname@@XXXXXXXX { 37 | compatible = "vendor,@modname@"; 38 | reg = ; 39 | interrupt-parent = <&INTR_CONTROLLER_INSTANCE>; 40 | interrupts = < INTR_NUM INTR_SENSITIVITY >; 41 | }; 42 | Notes: 43 | * "@modname@@XXXXXXXX" is the label of the device node, it is usually the "DEVICE_TYPE@PHYSICAL_START_ADDRESS". E.g. "@modname@@89000000". 44 | * "compatible" needs to match one of the the compatibles in the module's compatible list. 45 | * "reg" needs to be pair(s) of the physical start address of the device and the address range. 46 | * If the device has interrupt, the "interrupt-parent" needs to be the interrupt controller which the interrupt connects to. and the "interrupts" need to be pair(s) of the interrupt ID and the interrupt sensitivity. 47 | 48 | For more information about the the DTS file, please refer to this document in the Linux kernel: linux-2.6.x/Documentation/powerpc/booting-without-of.txt 49 | 50 | 51 | To add extra source code files (for example, to split a large module into 52 | multiple source files), add the relevant .o files to the list in the local 53 | Makefile where indicated. 54 | -------------------------------------------------------------------------------- /templates/modules/template-c/files/@modname@.c: -------------------------------------------------------------------------------- 1 | /* @modname@.c - The simplest kernel module. 2 | 3 | * Copyright (C) 2013-2022 Xilinx, Inc 4 | * Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program. If not, see . 18 | 19 | */ 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | /* Standard module information, edit as appropriate */ 32 | MODULE_LICENSE("GPL"); 33 | MODULE_AUTHOR 34 | ("Xilinx Inc."); 35 | MODULE_DESCRIPTION 36 | ("@modname@ - loadable module template generated by petalinux-create -t modules"); 37 | 38 | #define DRIVER_NAME "@modname@" 39 | 40 | /* Simple example of how to receive command line parameters to your module. 41 | Delete if you don't need them */ 42 | unsigned myint = 0xdeadbeef; 43 | char *mystr = "default"; 44 | 45 | module_param(myint, int, S_IRUGO); 46 | module_param(mystr, charp, S_IRUGO); 47 | 48 | struct @mod_name@_local { 49 | int irq; 50 | unsigned long mem_start; 51 | unsigned long mem_end; 52 | void __iomem *base_addr; 53 | }; 54 | 55 | static irqreturn_t @mod_name@_irq(int irq, void *lp) 56 | { 57 | printk("@modname@ interrupt\n"); 58 | return IRQ_HANDLED; 59 | } 60 | 61 | static int @mod_name@_probe(struct platform_device *pdev) 62 | { 63 | struct resource *r_irq; /* Interrupt resources */ 64 | struct resource *r_mem; /* IO mem resources */ 65 | struct device *dev = &pdev->dev; 66 | struct @mod_name@_local *lp = NULL; 67 | 68 | int rc = 0; 69 | dev_info(dev, "Device Tree Probing\n"); 70 | /* Get iospace for the device */ 71 | r_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 72 | if (!r_mem) { 73 | dev_err(dev, "invalid address\n"); 74 | return -ENODEV; 75 | } 76 | lp = (struct @mod_name@_local *) kmalloc(sizeof(struct @mod_name@_local), GFP_KERNEL); 77 | if (!lp) { 78 | dev_err(dev, "Cound not allocate @modname@ device\n"); 79 | return -ENOMEM; 80 | } 81 | dev_set_drvdata(dev, lp); 82 | lp->mem_start = r_mem->start; 83 | lp->mem_end = r_mem->end; 84 | 85 | if (!request_mem_region(lp->mem_start, 86 | lp->mem_end - lp->mem_start + 1, 87 | DRIVER_NAME)) { 88 | dev_err(dev, "Couldn't lock memory region at %p\n", 89 | (void *)lp->mem_start); 90 | rc = -EBUSY; 91 | goto error1; 92 | } 93 | 94 | lp->base_addr = ioremap(lp->mem_start, lp->mem_end - lp->mem_start + 1); 95 | if (!lp->base_addr) { 96 | dev_err(dev, "@modname@: Could not allocate iomem\n"); 97 | rc = -EIO; 98 | goto error2; 99 | } 100 | 101 | /* Get IRQ for the device */ 102 | r_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 103 | if (!r_irq) { 104 | dev_info(dev, "no IRQ found\n"); 105 | dev_info(dev, "@modname@ at 0x%08x mapped to 0x%08x\n", 106 | (unsigned int __force)lp->mem_start, 107 | (unsigned int __force)lp->base_addr); 108 | return 0; 109 | } 110 | lp->irq = r_irq->start; 111 | rc = request_irq(lp->irq, &@mod_name@_irq, 0, DRIVER_NAME, lp); 112 | if (rc) { 113 | dev_err(dev, "testmodule: Could not allocate interrupt %d.\n", 114 | lp->irq); 115 | goto error3; 116 | } 117 | 118 | dev_info(dev,"@modname@ at 0x%08x mapped to 0x%08x, irq=%d\n", 119 | (unsigned int __force)lp->mem_start, 120 | (unsigned int __force)lp->base_addr, 121 | lp->irq); 122 | return 0; 123 | error3: 124 | free_irq(lp->irq, lp); 125 | error2: 126 | release_mem_region(lp->mem_start, lp->mem_end - lp->mem_start + 1); 127 | error1: 128 | kfree(lp); 129 | dev_set_drvdata(dev, NULL); 130 | return rc; 131 | } 132 | 133 | static int @mod_name@_remove(struct platform_device *pdev) 134 | { 135 | struct device *dev = &pdev->dev; 136 | struct @mod_name@_local *lp = dev_get_drvdata(dev); 137 | free_irq(lp->irq, lp); 138 | iounmap(lp->base_addr); 139 | release_mem_region(lp->mem_start, lp->mem_end - lp->mem_start + 1); 140 | kfree(lp); 141 | dev_set_drvdata(dev, NULL); 142 | return 0; 143 | } 144 | 145 | #ifdef CONFIG_OF 146 | static struct of_device_id @mod_name@_of_match[] = { 147 | { .compatible = "vendor,@modname@", }, 148 | { /* end of list */ }, 149 | }; 150 | MODULE_DEVICE_TABLE(of, @mod_name@_of_match); 151 | #else 152 | # define @mod_name@_of_match 153 | #endif 154 | 155 | 156 | static struct platform_driver @mod_name@_driver = { 157 | .driver = { 158 | .name = DRIVER_NAME, 159 | .owner = THIS_MODULE, 160 | .of_match_table = @mod_name@_of_match, 161 | }, 162 | .probe = @mod_name@_probe, 163 | .remove = @mod_name@_remove, 164 | }; 165 | 166 | static int __init @mod_name@_init(void) 167 | { 168 | printk("<1>Hello module world.\n"); 169 | printk("<1>Module parameters were (0x%08x) and \"%s\"\n", myint, 170 | mystr); 171 | 172 | return platform_driver_register(&@mod_name@_driver); 173 | } 174 | 175 | 176 | static void __exit @mod_name@_exit(void) 177 | { 178 | platform_driver_unregister(&@mod_name@_driver); 179 | printk(KERN_ALERT "Goodbye module world.\n"); 180 | } 181 | 182 | module_init(@mod_name@_init); 183 | module_exit(@mod_name@_exit); 184 | -------------------------------------------------------------------------------- /templates/modules/template-c/files/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := @modname@.o 2 | 3 | MY_CFLAGS += -g -DDEBUG 4 | ccflags-y += ${MY_CFLAGS} 5 | 6 | SRC := $(shell pwd) 7 | 8 | all: 9 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) 10 | 11 | modules_install: 12 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install 13 | 14 | clean: 15 | rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c 16 | rm -f Module.markers Module.symvers modules.order 17 | rm -rf .tmp_versions Modules.symvers 18 | -------------------------------------------------------------------------------- /templates/project/common/project-spec/meta-user/COPYING.MIT: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining a copy 2 | of this software and associated documentation files (the "Software"), to deal 3 | in the Software without restriction, including without limitation the rights 4 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 5 | copies of the Software, and to permit persons to whom the Software is 6 | furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in 9 | all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17 | THE SOFTWARE. 18 | -------------------------------------------------------------------------------- /templates/project/common/project-spec/meta-user/README: -------------------------------------------------------------------------------- 1 | This README file contains information on the contents of the 2 | meta-user layer. 3 | 4 | Please see the corresponding sections below for details. 5 | 6 | 7 | Dependencies 8 | ============ 9 | 10 | This layer depends on: 11 | 12 | URI: git://git.openembedded.org/bitbake 13 | branch: master 14 | 15 | URI: git://git.openembedded.org/openembedded-core 16 | layers: meta 17 | branch: master 18 | 19 | URI: git://git.yoctoproject.org/xxxx 20 | layers: xxxx 21 | branch: master 22 | 23 | 24 | Patches 25 | ======= 26 | 27 | Please submit any patches against the meta-user layer to the 28 | xxxx mailing list (xxxx@zzzz.org) and cc: the maintainer: 29 | 30 | Maintainer: XXX YYYYYY 31 | 32 | 33 | Table of Contents 34 | ================= 35 | 36 | I. Adding the meta-user layer to your build 37 | II. Misc 38 | 39 | 40 | I. Adding the meta-user layer to your build 41 | ================================================= 42 | 43 | --- replace with specific instructions for the meta-user layer --- 44 | 45 | In order to use this layer, you need to make the build system aware of 46 | it. 47 | 48 | Assuming the meta-user layer exists at the top-level of your 49 | yocto build tree, you can add it to the build system by adding the 50 | location of the meta-user layer to bblayers.conf, along with any 51 | other layers needed. e.g.: 52 | 53 | BBLAYERS ?= " \ 54 | /path/to/yocto/meta \ 55 | /path/to/yocto/meta-poky \ 56 | /path/to/yocto/meta-yocto-bsp \ 57 | /path/to/yocto/meta-meta-user \ 58 | " 59 | 60 | 61 | II. Misc 62 | ======== 63 | 64 | --- replace with specific information about the meta-user layer --- 65 | -------------------------------------------------------------------------------- /templates/project/common/project-spec/meta-user/conf/layer.conf: -------------------------------------------------------------------------------- 1 | # We have a conf and classes directory, add to BBPATH 2 | BBPATH .= ":${LAYERDIR}" 3 | 4 | # We have recipes-* directories, add to BBFILES 5 | BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ 6 | ${LAYERDIR}/recipes-*/*/*.bbappend" 7 | 8 | # Define dynamic layers 9 | BBFILES_DYNAMIC += " \ 10 | xilinx-tools:${LAYERDIR}/meta-xilinx-tools/recipes-*/*/*.bbappend \ 11 | " 12 | 13 | BBFILE_COLLECTIONS += "meta-user" 14 | BBFILE_PATTERN_meta-user = "^${LAYERDIR}/" 15 | BBFILE_PRIORITY_meta-user = "7" 16 | LAYERSERIES_COMPAT_meta-user = "langdale" 17 | -------------------------------------------------------------------------------- /templates/project/common/project-spec/meta-user/conf/petalinuxbsp.conf: -------------------------------------------------------------------------------- 1 | #User Configuration 2 | 3 | #OE_TERMINAL = "tmux" 4 | -------------------------------------------------------------------------------- /templates/project/common/project-spec/meta-user/conf/user-rootfsconfig: -------------------------------------------------------------------------------- 1 | #Note: Mention Each package in individual line 2 | #These packages will get added into rootfs menu entry 3 | 4 | CONFIG_gpio-demo 5 | CONFIG_peekpoke 6 | -------------------------------------------------------------------------------- /templates/project/common/project-spec/meta-user/meta-xilinx-tools/recipes-bsp/uboot-device-tree/files/system-user.dtsi: -------------------------------------------------------------------------------- 1 | /include/ "system-conf.dtsi" 2 | / { 3 | }; 4 | -------------------------------------------------------------------------------- /templates/project/common/project-spec/meta-user/meta-xilinx-tools/recipes-bsp/uboot-device-tree/uboot-device-tree.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS:prepend := "${THISDIR}/files:" 2 | 3 | SRC_URI:append = " file://system-user.dtsi" 4 | 5 | -------------------------------------------------------------------------------- /templates/project/common/project-spec/meta-user/recipes-bsp/device-tree/device-tree-sdt.inc: -------------------------------------------------------------------------------- 1 | SRC_URI:append = " file://system-conf.dtsi" 2 | EXTRA_OVERLAYS:append:linux = " system-user.dtsi" 3 | -------------------------------------------------------------------------------- /templates/project/common/project-spec/meta-user/recipes-bsp/device-tree/device-tree.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS:prepend := "${THISDIR}/files:" 2 | 3 | SRC_URI:append = " file://system-user.dtsi" 4 | 5 | require ${@'device-tree-sdt.inc' if d.getVar('SYSTEM_DTFILE') != '' else ''} 6 | -------------------------------------------------------------------------------- /templates/project/common/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi: -------------------------------------------------------------------------------- 1 | /include/ "system-conf.dtsi" 2 | / { 3 | }; 4 | -------------------------------------------------------------------------------- /templates/project/common/project-spec/meta-user/recipes-bsp/u-boot/files/bsp.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_SYS_CONFIG_NAME="platform-top" 2 | -------------------------------------------------------------------------------- /templates/project/common/project-spec/meta-user/recipes-bsp/u-boot/files/platform-top.h: -------------------------------------------------------------------------------- 1 | #if defined(CONFIG_MICROBLAZE) 2 | #include 3 | #define CONFIG_SYS_BOOTM_LEN 0xF000000 4 | #endif 5 | #if defined(CONFIG_ARCH_ZYNQ) 6 | #include 7 | #endif 8 | #if defined(CONFIG_ARCH_ZYNQMP) 9 | #include 10 | #endif 11 | #if defined(CONFIG_ARCH_VERSAL) 12 | #include 13 | #endif 14 | #if defined(CONFIG_ARCH_VERSAL_NET) 15 | #include 16 | #endif 17 | -------------------------------------------------------------------------------- /templates/project/common/project-spec/meta-user/recipes-bsp/u-boot/u-boot-xlnx_%.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS:prepend := "${THISDIR}/files:" 2 | 3 | SRC_URI:append = " file://platform-top.h file://bsp.cfg" 4 | -------------------------------------------------------------------------------- /templates/project/common/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/bsp.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xilinx/PetaLinux/44644a911c4ee47be5a3ed412c154126b1bc4ea8/templates/project/common/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/bsp.cfg -------------------------------------------------------------------------------- /templates/project/common/project-spec/meta-user/recipes-kernel/linux/linux-xlnx_%.bbappend: -------------------------------------------------------------------------------- 1 | FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" 2 | 3 | SRC_URI:append = " file://bsp.cfg" 4 | KERNEL_FEATURES:append = " bsp.cfg" 5 | -------------------------------------------------------------------------------- /templates/project/template-microblaze/project-spec/attributes: -------------------------------------------------------------------------------- 1 | #Virtual Providers 2 | 3 | 4 | 5 | #defconfigs 6 | 7 | UBOOT_DEFAULT_DEFCONFIG="microblaze-generic_defconfig" 8 | -------------------------------------------------------------------------------- /templates/project/template-microblaze/project-spec/configs/config: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated file; DO NOT EDIT. 3 | # linux Configuration 4 | # 5 | CONFIG_SUBSYSTEM_TYPE_LINUX=y 6 | CONFIG_SYSTEM_MICROBLAZE=y 7 | 8 | # 9 | # linux Components Selection 10 | # 11 | CONFIG_SUBSYSTEM_COMPONENT_DEVICE__TREE_NAME_DEVICE__TREE__GENERATOR=y 12 | CONFIG_SUBSYSTEM_COMPONENT_BOOTLOADER_AUTO_FSBL=y 13 | CONFIG_SUBSYSTEM_COMPONENT_BOOTLOADER_NAME_FS__BOOT=y 14 | CONFIG_SUBSYSTEM_COMPONENT_U__BOOT_NAME_U__BOOT__PLNX=y 15 | # CONFIG_SUBSYSTEM_COMPONENT_U__BOOT_NAME_REMOTE is not set 16 | # CONFIG_SUBSYSTEM_COMPONENT_U__BOOT_NAME_NONE is not set 17 | CONFIG_SUBSYSTEM_COMPONENT_LINUX__KERNEL_INSTANCE_KERNEL_NAME_XLNX__4___4=y 18 | # CONFIG_SUBSYSTEM_COMPONENT_LINUX__KERNEL_INSTANCE_KERNEL_NAME_REMOTE is not set 19 | CONFIG_SUBSYSTEM_COMPONENT_ROOTFS_NAME_PETALINUX__ROOTFS=y 20 | 21 | # 22 | # Generic Components 23 | # 24 | 25 | # 26 | # Auto Config Settings 27 | # 28 | CONFIG_SUBSYSTEM_AUTOCONFIG_DEVICE__TREE=y 29 | CONFIG_SUBSYSTEM_AUTOCONFIG_KERNEL=y 30 | CONFIG_SUBSYSTEM_AUTOCONFIG_U__BOOT=y 31 | CONFIG_SUBSYSTEM_HARDWARE_AUTO=y 32 | CONFIG_SUBSYSTEM_PROCESSOR_MICROBLAZE_0_SELECT=y 33 | CONFIG_SUBSYSTEM_ARCH_MICROBLAZE=y 34 | 35 | # 36 | # Serial Settings 37 | # 38 | CONFIG_SUBSYSTEM_FSBOOT_SERIAL_RS232_UART_SELECT=y 39 | CONFIG_SUBSYSTEM_SERIAL_RS232_UART_SELECT=y 40 | # CONFIG_SUBSYSTEM_SERIAL_MANUAL_SELECT is not set 41 | # CONFIG_SUBSYSTEM_SERIAL_RS232_UART_BAUDRATE_9600 is not set 42 | # CONFIG_SUBSYSTEM_SERIAL_RS232_UART_BAUDRATE_19200 is not set 43 | # CONFIG_SUBSYSTEM_SERIAL_RS232_UART_BAUDRATE_38400 is not set 44 | # CONFIG_SUBSYSTEM_SERIAL_RS232_UART_BAUDRATE_57600 is not set 45 | CONFIG_SUBSYSTEM_SERIAL_RS232_UART_BAUDRATE_115200=y 46 | # CONFIG_SUBSYSTEM_SERIAL_RS232_UART_BAUDRATE_230400 is not set 47 | 48 | # 49 | # Ethernet Settings 50 | # 51 | CONFIG_SUBSYSTEM_ETHERNET_AXI_ETHERNET_ETH_BUF_SELECT=y 52 | # CONFIG_SUBSYSTEM_ETHERNET_MANUAL_SELECT is not set 53 | CONFIG_SUBSYSTEM_ETHERNET_AXI_ETHERNET_ETH_BUF_MAC_AUTO=y 54 | CONFIG_SUBSYSTEM_ETHERNET_AXI_ETHERNET_ETH_BUF_MAC_PATTERN="00:0a:35:00:??:??" 55 | CONFIG_SUBSYSTEM_ETHERNET_AXI_ETHERNET_ETH_BUF_USE_DHCP=y 56 | 57 | # 58 | # Flash Settings 59 | # 60 | CONFIG_SUBSYSTEM_FLASH_LINEAR_FLASH_BANK0_SELECT=y 61 | # CONFIG_SUBSYSTEM_FLASH_MANUAL_SELECT is not set 62 | # CONFIG_SUBSYSTEM_FLASH__ADVANCED_AUTOCONFIG is not set 63 | 64 | # 65 | # Timer Settings 66 | # 67 | CONFIG_SUBSYSTEM_TIMER_AXI_TIMER_0_SELECT=y 68 | # CONFIG_SUBSYSTEM_TIMER_MANUAL_SELECT is not set 69 | 70 | # 71 | # Reset GPIO Settings 72 | # 73 | CONFIG_SUBSYSTEM_RESET_GPIO_RESET_GPIO_SELECT=y 74 | # CONFIG_SUBSYSTEM_RESET_GPIO_NONE is not set 75 | CONFIG_SUBSYSTEM_RESET_GPIO_RESET_GPIO_CHANNEL0_SELECT=y 76 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG is not set 77 | CONFIG_SUBSYSTEM_ENDIAN_LITTLE=y 78 | 79 | # 80 | # Kernel Bootargs 81 | # 82 | CONFIG_SUBSYSTEM_BOOTARGS_AUTO=y 83 | CONFIG_SUBSYSTEM_BOOTARGS_EARLYPRINTK=y 84 | CONFIG_SUBSYSTEM_BOOTARGS_GENERATED="console=ttyS0,115200 earlycon" 85 | 86 | # 87 | # u-boot Configuration 88 | # 89 | CONFIG_SUBSYSTEM_UBOOT_CONFIG_TARGET="microblaze-generic_defconfig" 90 | CONFIG_SUBSYSTEM_NETBOOT_OFFSET=0x1000000 91 | CONFIG_SUBSYSTEM_U__BOOT_TFTPSERVER_IP="AUTO" 92 | 93 | # 94 | # Image Packaging Configuration 95 | # 96 | # CONFIG_SUBSYSTEM_ROOTFS_INITRAMFS is not set 97 | CONFIG_SUBSYSTEM_ROOTFS_INITRD=y 98 | # CONFIG_SUBSYSTEM_ROOTFS_JFFS2 is not set 99 | # CONFIG_SUBSYSTEM_ROOTFS_NFS is not set 100 | # CONFIG_SUBSYSTEM_ROOTFS_EXT4 is not set 101 | # CONFIG_SUBSYSTEM_ROOTFS_OTHER is not set 102 | CONFIG_SUBSYSTEM_UIMAGE_NAME="image.ub" 103 | # CONFIG_SUBSYSTEM_UIMAGE_HASH_NONE is not set 104 | CONFIG_SUBSYSTEM_UIMAGE_HASH_CRC32=y 105 | # CONFIG_SUBSYSTEM_UIMAGE_HASH_SHA1 is not set 106 | # CONFIG_SUBSYSTEM_UIMAGE_HASH_BOTH is not set 107 | CONFIG_SUBSYSTEM_COMPRESS_IMAGE=y 108 | CONFIG_SUBSYSTEM_DTB_PADDING_SIZE=0x1000 109 | CONFIG_SUBSYSTEM_COPY_TO_TFTPBOOT=y 110 | CONFIG_SUBSYSTEM_TFTPBOOT_DIR="/tftpboot" 111 | 112 | # 113 | # Firmware Version Configuration 114 | # 115 | CONFIG_SUBSYSTEM_HOSTNAME="@projname@" 116 | CONFIG_SUBSYSTEM_PRODUCT="@projname@" 117 | CONFIG_SUBSYSTEM_FW_VERSION="1.00" 118 | CONFIG_SUBSYSTEM_MACHINE_NAME="template" 119 | CONFIG_SUBSYSTEM_DT_XSCT_WORKSPACE="${PROOT}/components/plnx_workspace/device-tree" 120 | 121 | # 122 | # Yocto Settings 123 | # 124 | # PetaLinux Images Deploy Directory 125 | CONFIG_PLNX_IMAGES_LOCATION="${PROOT}/images/linux" 126 | CONFIG_TMP_DIR_LOCATION="${PROOT}/build/tmp" 127 | CONFIG_PRE_MIRROR_URL="http://petalinux.xilinx.com/sswreleases/rel-v${PETALINUX_MAJOR_VER}/downloads" 128 | CONFIG_YOCTO_NETWORK_SSTATE_FEEDS_URL="http://petalinux.xilinx.com/sswreleases/rel-v${PETALINUX_MAJOR_VER}/microblaze/sstate-cache" 129 | -------------------------------------------------------------------------------- /templates/project/template-microblaze/project-spec/configs/rootfs_config: -------------------------------------------------------------------------------- 1 | CONFIG_mtd-utils=y 2 | CONFIG_can-utils=y 3 | CONFIG_pciutils=y 4 | CONFIG_dosfstools=y 5 | CONFIG_run-postinsts=y 6 | CONFIG_packagegroup-core-boot=y 7 | CONFIG_packagegroup-core-ssh-dropbear=y 8 | CONFIG_tcf-agent=y 9 | CONFIG_bridge-utils=y 10 | CONFIG_ADD_EXTRA_USERS="root:root;petalinux::passwd-expire;" 11 | CONFIG_CREATE_NEW_GROUPS="aie;" 12 | CONFIG_ADD_USERS_TO_GROUPS="petalinux:audio,video,aie,input;" 13 | CONFIG_ADD_USERS_TO_SUDOERS="petalinux" 14 | CONFIG_nfs-utils=y 15 | -------------------------------------------------------------------------------- /templates/project/template-microblaze/project-spec/hw-description/metadata: -------------------------------------------------------------------------------- 1 | HARDWARE_SOURCE= 2 | -------------------------------------------------------------------------------- /templates/project/template-versal-net/project-spec/attributes: -------------------------------------------------------------------------------- 1 | #Virtual Providers 2 | 3 | 4 | 5 | #defconfigs 6 | 7 | UBOOT_DEFAULT_DEFCONFIG="xilinx_versal_net_virt_defconfig" 8 | 9 | #atf 10 | CONFIG_SUBSYSTEM_PRELOADED_BL33_BASE="0x8000000" 11 | -------------------------------------------------------------------------------- /templates/project/template-versal-net/project-spec/configs/config: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated file; DO NOT EDIT. 3 | # linux System Configuration 4 | # 5 | CONFIG_SUBSYSTEM_TYPE_LINUX=y 6 | CONFIG_SYSTEM_VERSAL=y 7 | 8 | # 9 | # linux Components Selection 10 | # 11 | CONFIG_SUBSYSTEM_COMPONENT_DEVICE__TREE_NAME_DEVICE__TREE__GENERATOR=y 12 | CONFIG_SUBSYSTEM_COMPONENT_BOOTLOADER_AUTO_PS_INIT=y 13 | CONFIG_SUBSYSTEM_COMPONENT_U__BOOT_NAME_U__BOOT__PLNX=y 14 | # CONFIG_SUBSYSTEM_COMPONENT_U__BOOT_NAME_REMOTE is not set 15 | # CONFIG_SUBSYSTEM_COMPONENT_U__BOOT_NAME_NONE is not set 16 | CONFIG_SUBSYSTEM_COMPONENT_TRUSTED__FIRMWARE__ARM_NAME_TF-A=y 17 | # CONFIG_SUBSYSTEM_COMPONENT_TRUSTED__FIRMWARE__ARM_NAME_REMOTE is not set 18 | # CONFIG_SUBSYSTEM_COMPONENT_TRUSTED__FIRMWARE__ARM_NAME_NONE is not set 19 | CONFIG_SUBSYSTEM_COMPONENT_LINUX__KERNEL_INSTANCE_KERNEL_NAME_XLNX__4___4=y 20 | # CONFIG_SUBSYSTEM_COMPONENT_LINUX__KERNEL_INSTANCE_KERNEL_NAME_REMOTE is not set 21 | CONFIG_SUBSYSTEM_COMPONENT_ROOTFS_NAME_PETALINUX__ROOTFS=y 22 | 23 | # 24 | # Generic Components 25 | # 26 | 27 | # 28 | # Auto Config Settings 29 | # 30 | CONFIG_SUBSYSTEM_AUTOCONFIG_DEVICE__TREE=y 31 | # CONFIG_SUBSYSTEM_DEVICE_TREE_MANUAL_INCLUDE is not set 32 | CONFIG_SUBSYSTEM_HARDWARE_AUTO=y 33 | CONFIG_SUBSYSTEM_PROCESSOR_PSXL_CORTEXA78_0_SELECT=y 34 | CONFIG_SUBSYSTEM_ARCH_AARCH64=y 35 | 36 | # 37 | # Serial Settings 38 | # 39 | CONFIG_SUBSYSTEM_PLM_SERIAL_PSXL_SBSAUART_0_SELECT=y 40 | CONFIG_SUBSYSTEM_ATF_SERIAL_PSXL_SBSAUART_0_SELECT=y 41 | CONFIG_SUBSYSTEM_SERIAL_PSXL_SBSAUART_0_SELECT=y 42 | # 43 | # 44 | 45 | # 46 | # Ethernet Settings 47 | # 48 | CONFIG_SUBSYSTEM_ETHERNET_PSX_WIZARD_0_PSXL_0_PSX_ETHERNET_0_SELECT=y 49 | CONFIG_SUBSYSTEM_ETHERNET_PSX_WIZARD_0_PSXL_0_PSX_ETHERNET_0_MAC="ff:ff:ff:ff:ff:ff" 50 | CONFIG_SUBSYSTEM_ETHERNET_PSX_WIZARD_0_PSXL_0_PSX_ETHERNET_0_USE_DHCP=y 51 | # CONFIG_SUBSYSTEM_ETHERNET_MANUAL_SELECT is not set 52 | 53 | # 54 | # Flash Settings 55 | # 56 | CONFIG_SUBSYSTEM_FLASH_PSXL_PMC_QSPI_0_BANKLESS_SELECT=y 57 | # CONFIG_SUBSYSTEM_FLASH_MANUAL_SELECT is not set 58 | 59 | # 60 | # SD/SDIO Settings 61 | # 62 | # CONFIG_SUBSYSTEM_PRIMARY_SD_PSXL_SD_0_SELECT is not set 63 | # CONFIG_SUBSYSTEM_PRIMARY_SD_PSXL_SD_1_SELECT is not set 64 | CONFIG_SUBSYSTEM_PRIMARY_SD_MANUAL_SELECT=y 65 | CONFIG_SUBSYSTEM_SD_PSXL_SD_0_SELECT=y 66 | CONFIG_SUBSYSTEM_SD_PSXL_SD_1_SELECT=y 67 | 68 | # 69 | # RTC Settings 70 | # 71 | CONFIG_SUBSYSTEM_RTC_MANUAL_SELECT=y 72 | CONFIG_SUBSYSTEM_I2C_PSXL_I2C_0_SELECT=y 73 | CONFIG_SUBSYSTEM_I2C_PSXL_I2C_1_SELECT=y 74 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG=y 75 | 76 | # 77 | # boot image settings 78 | # 79 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_MEDIA_FLASH_SELECT is not set 80 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_MEDIA_SD_SELECT=y 81 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_MEDIA_MANUAL_SELECT is not set 82 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_IMAGE_NAME="BOOT.BIN" 83 | 84 | # 85 | # u-boot env partition settings 86 | # 87 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOTENV_MEDIA_FLASH_SELECT=y 88 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOTENV_MEDIA_MANUAL_SELECT is not set 89 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOTENV_PART_NAME="bootenv" 90 | 91 | # 92 | # kernel image settings 93 | # 94 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_MEDIA_FLASH_SELECT is not set 95 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_MEDIA_SD_SELECT=y 96 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_MEDIA_ETHERNET_SELECT is not set 97 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_MEDIA_MANUAL_SELECT is not set 98 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_IMAGE_NAME="image.ub" 99 | 100 | # 101 | # jffs2 rootfs image settings 102 | # 103 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_JFFS2_MEDIA_FLASH_SELECT=y 104 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_JFFS2_MEDIA_MANUAL_SELECT is not set 105 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_JFFS2_PART_NAME="jffs2" 106 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_JFFS2_IMAGE_NAME="rootfs.jffs2" 107 | 108 | # 109 | # dtb image settings 110 | # 111 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_BOOTIMAGE_SELECT=y 112 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_FLASH_SELECT is not set 113 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_SD_SELECT is not set 114 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_ETHERNET_SELECT is not set 115 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_MANUAL_SELECT is not set 116 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_IMAGE_NAME="system.dtb" 117 | CONFIG_SUBSYSTEM_ENDIAN_LITTLE=y 118 | CONFIG_SUBSYSTEM_DEVICETREE_COMPILER_FLAGS="-@" 119 | 120 | # 121 | # Kernel Bootargs 122 | # 123 | CONFIG_SUBSYSTEM_BOOTARGS_GENERATED="console=ttyAMA0 earlycon=pl011,mmio32,0xFF000000,115200n8 clk_ignore_unused" 124 | 125 | # 126 | # ARM Trusted Firmware Compilation Configuration 127 | # 128 | CONFIG_SUBSYSTEM_ATF_EXTRA_COMPILER_FLAGS="" 129 | 130 | # 131 | # u-boot Configuration 132 | # 133 | CONFIG_SUBSYSTEM_UBOOT_CONFIG_TARGET="xilinx_versal_net_virt_defconfig" 134 | 135 | # 136 | # Image Packaging Configuration 137 | # 138 | # CONFIG_SUBSYSTEM_ROOTFS_INITRAMFS is not set 139 | CONFIG_SUBSYSTEM_ROOTFS_INITRD=y 140 | # CONFIG_SUBSYSTEM_ROOTFS_JFFS2 is not set 141 | # CONFIG_SUBSYSTEM_ROOTFS_NFS is not set 142 | # CONFIG_SUBSYSTEM_ROOTFS_EXT4 is not set 143 | # CONFIG_SUBSYSTEM_ROOTFS_OTHER is not set 144 | CONFIG_SUBSYSTEM_UIMAGE_NAME="image.ub" 145 | # CONFIG_SUBSYSTEM_UIMAGE_HASH_NONE is not set 146 | CONFIG_SUBSYSTEM_UIMAGE_HASH_CRC32=y 147 | # CONFIG_SUBSYSTEM_UIMAGE_HASH_SHA1 is not set 148 | # CONFIG_SUBSYSTEM_UIMAGE_HASH_BOTH is not set 149 | CONFIG_SUBSYSTEM_COMPRESS_IMAGE=y 150 | CONFIG_SUBSYSTEM_DTB_PADDING_SIZE=0x1000 151 | CONFIG_SUBSYSTEM_COPY_TO_TFTPBOOT=y 152 | CONFIG_SUBSYSTEM_TFTPBOOT_DIR="/tftpboot" 153 | 154 | # 155 | # Firmware Version Configuration 156 | # 157 | CONFIG_SUBSYSTEM_HOSTNAME="@projname@" 158 | CONFIG_SUBSYSTEM_PRODUCT="@projname@" 159 | CONFIG_SUBSYSTEM_FW_VERSION="1.00" 160 | CONFIG_SUBSYSTEM_MACHINE_NAME="template" 161 | CONFIG_SUBSYSTEM_DT_XSCT_WORKSPACE="${PROOT}/components/plnx_workspace/device-tree" 162 | # 163 | # Yocto Settings 164 | # 165 | # PetaLinux Images Deploy Directory 166 | CONFIG_PLNX_IMAGES_LOCATION="${PROOT}/images/linux" 167 | CONFIG_TMP_DIR_LOCATION="${PROOT}/build/tmp" 168 | CONFIG_PRE_MIRROR_URL="http://petalinux.xilinx.com/sswreleases/rel-v${PETALINUX_MAJOR_VER}/downloads" 169 | CONFIG_YOCTO_NETWORK_SSTATE_FEEDS_URL="http://petalinux.xilinx.com/sswreleases/rel-v${PETALINUX_MAJOR_VER}/aarch64/sstate-cache" 170 | -------------------------------------------------------------------------------- /templates/project/template-versal-net/project-spec/configs/rootfs_config: -------------------------------------------------------------------------------- 1 | CONFIG_e2fsprogs-mke2fs=y 2 | CONFIG_mtd-utils=y 3 | CONFIG_packagegroup-core-boot=y 4 | CONFIG_bridge-utils=y 5 | CONFIG_can-utils=y 6 | CONFIG_dosfstools=y 7 | CONFIG_pciutils=y 8 | CONFIG_run-postinsts=y 9 | CONFIG_fpga-manager-script=y 10 | CONFIG_imagefeature-ssh-server-openssh=y 11 | CONFIG_tcf-agent=y 12 | CONFIG_udev-extraconf=y 13 | CONFIG_imagefeature-hwcodecs=y 14 | CONFIG_ADD_EXTRA_USERS="root:root;petalinux::passwd-expire;" 15 | CONFIG_CREATE_NEW_GROUPS="aie;" 16 | CONFIG_ADD_USERS_TO_GROUPS="petalinux:audio,video,aie,input;" 17 | CONFIG_ADD_USERS_TO_SUDOERS="petalinux" 18 | CONFIG_linux-xlnx-udev-rules=y 19 | CONFIG_libdfx=y 20 | CONFIG_nfs-utils=y 21 | -------------------------------------------------------------------------------- /templates/project/template-versal-net/project-spec/hw-description/metadata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xilinx/PetaLinux/44644a911c4ee47be5a3ed412c154126b1bc4ea8/templates/project/template-versal-net/project-spec/hw-description/metadata -------------------------------------------------------------------------------- /templates/project/template-versal/project-spec/attributes: -------------------------------------------------------------------------------- 1 | #Virtual Providers 2 | 3 | 4 | 5 | #defconfigs 6 | 7 | UBOOT_DEFAULT_DEFCONFIG="xilinx_versal_virt_defconfig" 8 | 9 | #atf 10 | CONFIG_SUBSYSTEM_PRELOADED_BL33_BASE="0x8000000" 11 | -------------------------------------------------------------------------------- /templates/project/template-versal/project-spec/configs/config: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated file; DO NOT EDIT. 3 | # linux System Configuration 4 | # 5 | CONFIG_SUBSYSTEM_TYPE_LINUX=y 6 | CONFIG_SYSTEM_VERSAL=y 7 | 8 | # 9 | # linux Components Selection 10 | # 11 | CONFIG_SUBSYSTEM_COMPONENT_DEVICE__TREE_NAME_DEVICE__TREE__GENERATOR=y 12 | CONFIG_SUBSYSTEM_COMPONENT_BOOTLOADER_AUTO_PS_INIT=y 13 | CONFIG_SUBSYSTEM_COMPONENT_U__BOOT_NAME_U__BOOT__PLNX=y 14 | # CONFIG_SUBSYSTEM_COMPONENT_U__BOOT_NAME_REMOTE is not set 15 | # CONFIG_SUBSYSTEM_COMPONENT_U__BOOT_NAME_NONE is not set 16 | CONFIG_SUBSYSTEM_COMPONENT_TRUSTED__FIRMWARE__ARM_NAME_TF-A=y 17 | # CONFIG_SUBSYSTEM_COMPONENT_TRUSTED__FIRMWARE__ARM_NAME_REMOTE is not set 18 | # CONFIG_SUBSYSTEM_COMPONENT_TRUSTED__FIRMWARE__ARM_NAME_NONE is not set 19 | CONFIG_SUBSYSTEM_COMPONENT_LINUX__KERNEL_INSTANCE_KERNEL_NAME_XLNX__4___4=y 20 | # CONFIG_SUBSYSTEM_COMPONENT_LINUX__KERNEL_INSTANCE_KERNEL_NAME_REMOTE is not set 21 | CONFIG_SUBSYSTEM_COMPONENT_ROOTFS_NAME_PETALINUX__ROOTFS=y 22 | 23 | CONFIG_SUBSYSTEM_COMPONENT_PLM_NAME_PLM=y 24 | # CONFIG_SUBSYSTEM_COMPONENT_PLM_NAME_REMOTE is not set 25 | # CONFIG_SUBSYSTEM_COMPONENT_PLM_NAME_EXT__LOCAL__SRC is not set 26 | CONFIG_SUBSYSTEM_COMPONENT_PSM__FIRMWARE_NAME_PSM__FIRMWARE=y 27 | # CONFIG_SUBSYSTEM_COMPONENT_PSM__FIRMWARE_NAME_REMOTE is not set 28 | # CONFIG_SUBSYSTEM_COMPONENT_PSM__FIRMWARE_NAME_EXT__LOCAL__SRC is not set 29 | 30 | # 31 | # Generic Components 32 | # 33 | 34 | # 35 | # Auto Config Settings 36 | # 37 | CONFIG_SUBSYSTEM_AUTOCONFIG_DEVICE__TREE=y 38 | # CONFIG_SUBSYSTEM_DEVICE_TREE_MANUAL_INCLUDE is not set 39 | CONFIG_SUBSYSTEM_HARDWARE_AUTO=y 40 | CONFIG_SUBSYSTEM_PROCESSOR_PSU_CORTEXA72_0_SELECT=y 41 | CONFIG_SUBSYSTEM_ARCH_AARCH64=y 42 | 43 | # Serial Settings 44 | # 45 | CONFIG_SUBSYSTEM_PLM_SERIAL_PSV_SBSAUART_0_SELECT=y 46 | CONFIG_SUBSYSTEM_ATF_SERIAL_PSV_SBSAUART_0_SELECT=y 47 | CONFIG_SUBSYSTEM_SERIAL_PSV_SBSAUART_0_SELECT=y 48 | # 49 | # 50 | 51 | # 52 | # Ethernet Settings 53 | # 54 | CONFIG_SUBSYSTEM_ETHERNET_PSV_ETHERNET_0_SELECT=y 55 | CONFIG_SUBSYSTEM_ETHERNET_PSV_ETHERNET_0_MAC="ff:ff:ff:ff:ff:ff" 56 | CONFIG_SUBSYSTEM_ETHERNET_PSV_ETHERNET_0_USE_DHCP=y 57 | # CONFIG_SUBSYSTEM_ETHERNET_MANUAL_SELECT is not set 58 | 59 | # 60 | # Flash Settings 61 | # 62 | CONFIG_SUBSYSTEM_FLASH_PSV_PMC_QSPI_0_BANKLESS_SELECT=y 63 | # CONFIG_SUBSYSTEM_FLASH_MANUAL_SELECT is not set 64 | 65 | # 66 | # SD/SDIO Settings 67 | # 68 | # CONFIG_SUBSYSTEM_PRIMARY_SD_PSU_SD_0_SELECT is not set 69 | # CONFIG_SUBSYSTEM_PRIMARY_SD_PSU_SD_1_SELECT is not set 70 | CONFIG_SUBSYSTEM_PRIMARY_SD_MANUAL_SELECT=y 71 | CONFIG_SUBSYSTEM_SD_PSU_SD_0_SELECT=y 72 | CONFIG_SUBSYSTEM_SD_PSU_SD_1_SELECT=y 73 | 74 | # 75 | # RTC Settings 76 | # 77 | CONFIG_SUBSYSTEM_RTC_MANUAL_SELECT=y 78 | CONFIG_SUBSYSTEM_I2C_PSU_I2C_0_SELECT=y 79 | CONFIG_SUBSYSTEM_I2C_PSU_I2C_1_SELECT=y 80 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG=y 81 | 82 | # 83 | # boot image settings 84 | # 85 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_MEDIA_FLASH_SELECT is not set 86 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_MEDIA_SD_SELECT=y 87 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_MEDIA_MANUAL_SELECT is not set 88 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_IMAGE_NAME="BOOT.BIN" 89 | 90 | # 91 | # u-boot env partition settings 92 | # 93 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOTENV_MEDIA_FLASH_SELECT=y 94 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOTENV_MEDIA_MANUAL_SELECT is not set 95 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOTENV_PART_NAME="bootenv" 96 | 97 | # 98 | # kernel image settings 99 | # 100 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_MEDIA_FLASH_SELECT is not set 101 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_MEDIA_SD_SELECT=y 102 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_MEDIA_ETHERNET_SELECT is not set 103 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_MEDIA_MANUAL_SELECT is not set 104 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_IMAGE_NAME="image.ub" 105 | 106 | # 107 | # jffs2 rootfs image settings 108 | # 109 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_JFFS2_MEDIA_FLASH_SELECT=y 110 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_JFFS2_MEDIA_MANUAL_SELECT is not set 111 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_JFFS2_PART_NAME="jffs2" 112 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_JFFS2_IMAGE_NAME="rootfs.jffs2" 113 | 114 | # 115 | # dtb image settings 116 | # 117 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_BOOTIMAGE_SELECT=y 118 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_FLASH_SELECT is not set 119 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_SD_SELECT is not set 120 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_ETHERNET_SELECT is not set 121 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_MANUAL_SELECT is not set 122 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_IMAGE_NAME="system.dtb" 123 | CONFIG_SUBSYSTEM_ENDIAN_LITTLE=y 124 | CONFIG_SUBSYSTEM_DEVICETREE_COMPILER_FLAGS="-@" 125 | 126 | # 127 | # Kernel Bootargs 128 | # 129 | CONFIG_SUBSYSTEM_BOOTARGS_GENERATED="console=ttyAMA0 earlycon=pl011,mmio32,0xFF000000,115200n8 clk_ignore_unused" 130 | 131 | # 132 | # ARM Trusted Firmware Compilation Configuration 133 | # 134 | CONFIG_SUBSYSTEM_ATF_EXTRA_COMPILER_FLAGS="" 135 | 136 | # 137 | # u-boot Configuration 138 | # 139 | CONFIG_SUBSYSTEM_UBOOT_CONFIG_TARGET="xilinx_versal_virt_defconfig" 140 | 141 | # 142 | # Image Packaging Configuration 143 | # 144 | # CONFIG_SUBSYSTEM_ROOTFS_INITRAMFS is not set 145 | CONFIG_SUBSYSTEM_ROOTFS_INITRD=y 146 | # CONFIG_SUBSYSTEM_ROOTFS_JFFS2 is not set 147 | # CONFIG_SUBSYSTEM_ROOTFS_NFS is not set 148 | # CONFIG_SUBSYSTEM_ROOTFS_EXT4 is not set 149 | # CONFIG_SUBSYSTEM_ROOTFS_OTHER is not set 150 | CONFIG_SUBSYSTEM_UIMAGE_NAME="image.ub" 151 | # CONFIG_SUBSYSTEM_UIMAGE_HASH_NONE is not set 152 | CONFIG_SUBSYSTEM_UIMAGE_HASH_CRC32=y 153 | # CONFIG_SUBSYSTEM_UIMAGE_HASH_SHA1 is not set 154 | # CONFIG_SUBSYSTEM_UIMAGE_HASH_BOTH is not set 155 | CONFIG_SUBSYSTEM_COMPRESS_IMAGE=y 156 | CONFIG_SUBSYSTEM_DTB_PADDING_SIZE=0x1000 157 | CONFIG_SUBSYSTEM_COPY_TO_TFTPBOOT=y 158 | CONFIG_SUBSYSTEM_TFTPBOOT_DIR="/tftpboot" 159 | 160 | # 161 | # Firmware Version Configuration 162 | # 163 | CONFIG_SUBSYSTEM_HOSTNAME="@projname@" 164 | CONFIG_SUBSYSTEM_PRODUCT="@projname@" 165 | CONFIG_SUBSYSTEM_FW_VERSION="1.00" 166 | CONFIG_SUBSYSTEM_MACHINE_NAME="template" 167 | CONFIG_SUBSYSTEM_DT_XSCT_WORKSPACE="${PROOT}/components/plnx_workspace/device-tree" 168 | # 169 | # Yocto Settings 170 | # 171 | # PetaLinux Images Deploy Directory 172 | CONFIG_PLNX_IMAGES_LOCATION="${PROOT}/images/linux" 173 | CONFIG_MC_PLNX_IMAGES_LOCATION="${PROOT}/images/${BB_CURRENT_MC}" 174 | CONFIG_TMP_DIR_LOCATION="${PROOT}/build/tmp" 175 | CONFIG_PRE_MIRROR_URL="http://petalinux.xilinx.com/sswreleases/rel-v${PETALINUX_MAJOR_VER}/downloads" 176 | CONFIG_YOCTO_NETWORK_SSTATE_FEEDS_URL="http://petalinux.xilinx.com/sswreleases/rel-v${PETALINUX_MAJOR_VER}/aarch64/sstate-cache" 177 | -------------------------------------------------------------------------------- /templates/project/template-versal/project-spec/configs/rootfs_config: -------------------------------------------------------------------------------- 1 | CONFIG_e2fsprogs-mke2fs=y 2 | CONFIG_mtd-utils=y 3 | CONFIG_packagegroup-core-boot=y 4 | CONFIG_bridge-utils=y 5 | CONFIG_can-utils=y 6 | CONFIG_dosfstools=y 7 | CONFIG_pciutils=y 8 | CONFIG_run-postinsts=y 9 | CONFIG_fpga-manager-script=y 10 | CONFIG_tcf-agent=y 11 | CONFIG_udev-extraconf=y 12 | CONFIG_imagefeature-ssh-server-openssh=y 13 | CONFIG_imagefeature-hwcodecs=y 14 | CONFIG_linux-xlnx-udev-rules=y 15 | CONFIG_ADD_EXTRA_USERS="root:root;petalinux::passwd-expire;" 16 | CONFIG_CREATE_NEW_GROUPS="aie;" 17 | CONFIG_ADD_USERS_TO_GROUPS="petalinux:audio,video,aie,input;" 18 | CONFIG_ADD_USERS_TO_SUDOERS="petalinux" 19 | CONFIG_nfs-utils=y 20 | CONFIG_libdfx=y 21 | -------------------------------------------------------------------------------- /templates/project/template-versal/project-spec/hw-description/metadata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xilinx/PetaLinux/44644a911c4ee47be5a3ed412c154126b1bc4ea8/templates/project/template-versal/project-spec/hw-description/metadata -------------------------------------------------------------------------------- /templates/project/template-versal/project-spec/meta-user/recipes-bsp/u-boot/files/0001-xilinx_versal.h-ubifs-distroboot-support.patch: -------------------------------------------------------------------------------- 1 | From 08ecfa8ea773efe21e130434b875126e18a3eeb9 Mon Sep 17 00:00:00 2001 2 | From: Varalaxmi Bingi 3 | Date: Mon, 7 Sep 2020 11:45:37 +0530 4 | Subject: [UBOOT PATCH] xilinx_versal.h: ubifs distroboot support 5 | 6 | This patch will add ubifs support for versal. 7 | 8 | Signed-off-by: Varalaxmi Bingi 9 | --- 10 | include/configs/xilinx_versal.h | 5 ++++- 11 | 1 file changed, 4 insertions(+), 1 deletion(-) 12 | 13 | diff --git a/include/configs/xilinx_versal.h b/include/configs/xilinx_versal.h 14 | index 2054bf5..6039276 100644 15 | --- a/include/configs/xilinx_versal.h 16 | +++ b/include/configs/xilinx_versal.h 17 | @@ -112,7 +112,10 @@ 18 | 19 | #define BOOTENV_DEV_XSPI(devtypeu, devtypel, instance) \ 20 | "bootcmd_xspi0=sf probe 0 0 0 && " \ 21 | - "sf read $scriptaddr $script_offset_f $script_size_f && " \ 22 | + "setenv mtdids 'nor0=nor0' && " \ 23 | + "setenv mtdparts 'mtdparts=nor0:16m(raw),-(boot)' && " \ 24 | + "mtdparts && " \ 25 | + "ubi part boot; ubifsmount ubi0:boot; ubifsload $scriptaddr boot.scr; && " \ 26 | "echo XSPI: Trying to boot script at ${scriptaddr} && " \ 27 | "source ${scriptaddr}; echo XSPI: SCRIPT FAILED: continuing...;\0" 28 | 29 | -- 30 | 2.7.4 31 | -------------------------------------------------------------------------------- /templates/project/template-zynq/project-spec/attributes: -------------------------------------------------------------------------------- 1 | #Virtual Providers 2 | 3 | 4 | 5 | #defconfigs 6 | 7 | UBOOT_DEFAULT_DEFCONFIG="xilinx_zynq_virt_defconfig" 8 | -------------------------------------------------------------------------------- /templates/project/template-zynq/project-spec/configs/config: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated file; DO NOT EDIT. 3 | # linux System Configuration 4 | # 5 | CONFIG_SUBSYSTEM_TYPE_LINUX=y 6 | CONFIG_SYSTEM_ZYNQ=y 7 | 8 | # 9 | # linux Components Selection 10 | # 11 | CONFIG_SUBSYSTEM_COMPONENT_DEVICE__TREE_NAME_DEVICE__TREE__GENERATOR=y 12 | CONFIG_SUBSYSTEM_COMPONENT_BOOTLOADER_AUTO_FSBL=y 13 | CONFIG_SUBSYSTEM_COMPONENT_BOOTLOADER_NAME_ZYNQ_FSBL=y 14 | CONFIG_SUBSYSTEM_COMPONENT_BOOTLOADER_AUTO_PS_INIT=y 15 | CONFIG_SUBSYSTEM_COMPONENT_U__BOOT_NAME_U__BOOT__PLNX=y 16 | # CONFIG_SUBSYSTEM_COMPONENT_U__BOOT_NAME_REMOTE is not set 17 | # CONFIG_SUBSYSTEM_COMPONENT_U__BOOT_NAME_NONE is not set 18 | CONFIG_SUBSYSTEM_COMPONENT_LINUX__KERNEL_INSTANCE_KERNEL_NAME_XLNX__4___4=y 19 | # CONFIG_SUBSYSTEM_COMPONENT_LINUX__KERNEL_INSTANCE_KERNEL_NAME_REMOTE is not set 20 | CONFIG_SUBSYSTEM_COMPONENT_ROOTFS_NAME_PETALINUX__ROOTFS=y 21 | 22 | # 23 | # Generic Components 24 | # 25 | 26 | # 27 | # Auto Config Settings 28 | # 29 | CONFIG_SUBSYSTEM_AUTOCONFIG_DEVICE__TREE=y 30 | # CONFIG_SUBSYSTEM_DEVICE_TREE_MANUAL_INCLUDE is not set 31 | CONFIG_SUBSYSTEM_HARDWARE_AUTO=y 32 | CONFIG_SUBSYSTEM_PROCESSOR_PS7_CORTEXA9_0_SELECT=y 33 | CONFIG_SUBSYSTEM_ARCH_ARM=y 34 | 35 | # 36 | # Serial Settings 37 | # 38 | CONFIG_SUBSYSTEM_FSBL_SERIAL_PS7_UART_1_SELECT=y 39 | CONFIG_SUBSYSTEM_SERIAL_PS7_UART_1_SELECT=y 40 | # CONFIG_SUBSYSTEM_SERIAL_MANUAL_SELECT is not set 41 | # CONFIG_SUBSYSTEM_SERIAL_PS7_UART_1_BAUDRATE_9600 is not set 42 | # CONFIG_SUBSYSTEM_SERIAL_PS7_UART_1_BAUDRATE_19200 is not set 43 | # CONFIG_SUBSYSTEM_SERIAL_PS7_UART_1_BAUDRATE_38400 is not set 44 | # CONFIG_SUBSYSTEM_SERIAL_PS7_UART_1_BAUDRATE_57600 is not set 45 | CONFIG_SUBSYSTEM_SERIAL_PS7_UART_1_BAUDRATE_115200=y 46 | # CONFIG_SUBSYSTEM_SERIAL_PS7_UART_1_BAUDRATE_230400 is not set 47 | 48 | # 49 | # Ethernet Settings 50 | # 51 | CONFIG_SUBSYSTEM_ETHERNET_PS7_ETHERNET_0_SELECT=y 52 | # CONFIG_SUBSYSTEM_ETHERNET_MANUAL_SELECT is not set 53 | # CONFIG_SUBSYSTEM_ETHERNET_PS7_ETHERNET_0_MAC_AUTO is not set 54 | CONFIG_SUBSYSTEM_ETHERNET_PS7_ETHERNET_0_MAC="00:0a:35:00:1e:53" 55 | CONFIG_SUBSYSTEM_ETHERNET_PS7_ETHERNET_0_USE_DHCP=y 56 | 57 | # 58 | # Flash Settings 59 | # 60 | CONFIG_SUBSYSTEM_FLASH_PS7_QSPI_0_BANKLESS_SELECT=y 61 | # CONFIG_SUBSYSTEM_FLASH_MANUAL_SELECT is not set 62 | # CONFIG_SUBSYSTEM_FLASH__ADVANCED_AUTOCONFIG is not set 63 | # 64 | # SD/SDIO Settings 65 | # 66 | CONFIG_SUBSYSTEM_PRIMARY_SD_PS7_SD_0_SELECT=y 67 | # CONFIG_SUBSYSTEM_SD_MANUAL_SELECT is not set 68 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG=y 69 | 70 | # 71 | # boot image settings 72 | # 73 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_MEDIA_FLASH_SELECT is not set 74 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_MEDIA_SD_SELECT=y 75 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_MEDIA_MANUAL_SELECT is not set 76 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_IMAGE_NAME="BOOT.BIN" 77 | 78 | # 79 | # u-boot env partition settings 80 | # 81 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOTENV_MEDIA_FLASH_SELECT=y 82 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOTENV_MEDIA_MANUAL_SELECT is not set 83 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOTENV_PART_NAME="bootenv" 84 | 85 | # 86 | # kernel image settings 87 | # 88 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_MEDIA_FLASH_SELECT is not set 89 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_MEDIA_SD_SELECT=y 90 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_MEDIA_ETHERNET_SELECT is not set 91 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_MEDIA_MANUAL_SELECT is not set 92 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_IMAGE_NAME="image.ub" 93 | 94 | # 95 | # jffs2 rootfs image settings 96 | # 97 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_JFFS2_MEDIA_FLASH_SELECT=y 98 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_JFFS2_MEDIA_MANUAL_SELECT is not set 99 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_JFFS2_PART_NAME="jffs2" 100 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_JFFS2_IMAGE_NAME="rootfs.jffs2" 101 | 102 | # 103 | # dtb image settings 104 | # 105 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_BOOTIMAGE_SELECT=y 106 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_FLASH_SELECT is not set 107 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_SD_SELECT is not set 108 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_ETHERNET_SELECT is not set 109 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_MANUAL_SELECT is not set 110 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_IMAGE_NAME="system.dtb" 111 | CONFIG_SUBSYSTEM_ENDIAN_LITTLE=y 112 | CONFIG_SUBSYSTEM_DEVICETREE_COMPILER_FLAGS="-@" 113 | 114 | # 115 | # Kernel Bootargs 116 | # 117 | CONFIG_SUBSYSTEM_BOOTARGS_AUTO=y 118 | CONFIG_SUBSYSTEM_BOOTARGS_EARLYPRINTK=y 119 | CONFIG_SUBSYSTEM_BOOTARGS_GENERATED="console=ttyPS0,115200 earlycon" 120 | 121 | # 122 | # u-boot Configuration 123 | # 124 | CONFIG_SUBSYSTEM_UBOOT_CONFIG_TARGET="xilinx_zynq_virt_defconfig" 125 | CONFIG_SUBSYSTEM_NETBOOT_OFFSET=0x10000000 126 | CONFIG_SUBSYSTEM_U__BOOT_TFTPSERVER_IP="AUTO" 127 | 128 | # 129 | # Image Packaging Configuration 130 | # 131 | # CONFIG_SUBSYSTEM_ROOTFS_INITRAMFS is not set 132 | CONFIG_SUBSYSTEM_ROOTFS_INITRD=y 133 | # CONFIG_SUBSYSTEM_ROOTFS_JFFS2 is not set 134 | # CONFIG_SUBSYSTEM_ROOTFS_NFS is not set 135 | # CONFIG_SUBSYSTEM_ROOTFS_EXT4 is not set 136 | # CONFIG_SUBSYSTEM_ROOTFS_OTHER is not set 137 | CONFIG_SUBSYSTEM_UIMAGE_NAME="image.ub" 138 | # CONFIG_SUBSYSTEM_UIMAGE_HASH_NONE is not set 139 | CONFIG_SUBSYSTEM_UIMAGE_HASH_CRC32=y 140 | # CONFIG_SUBSYSTEM_UIMAGE_HASH_SHA1 is not set 141 | # CONFIG_SUBSYSTEM_UIMAGE_HASH_BOTH is not set 142 | CONFIG_SUBSYSTEM_COMPRESS_IMAGE=y 143 | CONFIG_SUBSYSTEM_DTB_PADDING_SIZE=0x1000 144 | CONFIG_SUBSYSTEM_COPY_TO_TFTPBOOT=y 145 | CONFIG_SUBSYSTEM_TFTPBOOT_DIR="/tftpboot" 146 | 147 | # 148 | # Firmware Version Configuration 149 | # 150 | CONFIG_SUBSYSTEM_HOSTNAME="@projname@" 151 | CONFIG_SUBSYSTEM_PRODUCT="@projname@" 152 | CONFIG_SUBSYSTEM_FW_VERSION="1.00" 153 | CONFIG_SUBSYSTEM_MACHINE_NAME="template" 154 | CONFIG_SUBSYSTEM_DT_XSCT_WORKSPACE="${PROOT}/components/plnx_workspace/device-tree" 155 | # 156 | # Yocto Settings 157 | # 158 | # PetaLinux Images Deploy Directory 159 | CONFIG_PLNX_IMAGES_LOCATION="${PROOT}/images/linux" 160 | CONFIG_TMP_DIR_LOCATION="${PROOT}/build/tmp" 161 | CONFIG_PRE_MIRROR_URL="http://petalinux.xilinx.com/sswreleases/rel-v${PETALINUX_MAJOR_VER}/downloads" 162 | CONFIG_YOCTO_NETWORK_SSTATE_FEEDS_URL="http://petalinux.xilinx.com/sswreleases/rel-v${PETALINUX_MAJOR_VER}/arm/sstate-cache" 163 | -------------------------------------------------------------------------------- /templates/project/template-zynq/project-spec/configs/rootfs_config: -------------------------------------------------------------------------------- 1 | CONFIG_e2fsprogs-mke2fs=y 2 | CONFIG_mtd-utils=y 3 | CONFIG_can-utils=y 4 | CONFIG_pciutils=y 5 | CONFIG_dosfstools=y 6 | CONFIG_run-postinsts=y 7 | CONFIG_fpga-manager-script=y 8 | CONFIG_packagegroup-core-boot=y 9 | CONFIG_tcf-agent=y 10 | CONFIG_bridge-utils=y 11 | CONFIG_udev-extraconf=y 12 | CONFIG_imagefeature-ssh-server-openssh=y 13 | CONFIG_imagefeature-hwcodecs=y 14 | CONFIG_linux-xlnx-udev-rules=y 15 | CONFIG_ADD_EXTRA_USERS="root:root;petalinux::passwd-expire;" 16 | CONFIG_CREATE_NEW_GROUPS="aie;" 17 | CONFIG_ADD_USERS_TO_GROUPS="petalinux:audio,video,aie,input;" 18 | CONFIG_ADD_USERS_TO_SUDOERS="petalinux" 19 | CONFIG_nfs-utils=y 20 | -------------------------------------------------------------------------------- /templates/project/template-zynq/project-spec/hw-description/metadata: -------------------------------------------------------------------------------- 1 | HARDWARE_SOURCE= 2 | -------------------------------------------------------------------------------- /templates/project/template-zynq/project-spec/meta-user/recipes-bsp/u-boot/files/bsp.cfg: -------------------------------------------------------------------------------- 1 | CONFIG_SYS_CONFIG_NAME="platform-top" 2 | CONFIG_BOOT_SCRIPT_OFFSET=0x9C0000 3 | -------------------------------------------------------------------------------- /templates/project/template-zynqMP/project-spec/attributes: -------------------------------------------------------------------------------- 1 | #Virtual Providers 2 | 3 | 4 | 5 | #defconfigs 6 | 7 | UBOOT_DEFAULT_DEFCONFIG="xilinx_zynqmp_virt_defconfig" 8 | 9 | #atf 10 | CONFIG_SUBSYSTEM_PRELOADED_BL33_BASE="0x8000000" 11 | -------------------------------------------------------------------------------- /templates/project/template-zynqMP/project-spec/configs/config: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated file; DO NOT EDIT. 3 | # linux System Configuration 4 | # 5 | CONFIG_SUBSYSTEM_TYPE_LINUX=y 6 | CONFIG_SYSTEM_ZYNQMP=y 7 | 8 | # 9 | # linux Components Selection 10 | # 11 | CONFIG_SUBSYSTEM_COMPONENT_DEVICE__TREE_NAME_DEVICE__TREE__GENERATOR=y 12 | # CONFIG_SUBSYSTEM_COMPONENT_IMG_SEL is not set 13 | CONFIG_SUBSYSTEM_COMPONENT_BOOTLOADER_AUTO_FSBL=y 14 | CONFIG_SUBSYSTEM_COMPONENT_BOOTLOADER_AUTO_PS_INIT=y 15 | CONFIG_SUBSYSTEM_COMPONENT_BOOTLOADER_NAME_ZYNQMP_FSBL=y 16 | CONFIG_SUBSYSTEM_COMPONENT_U__BOOT_NAME_U__BOOT__PLNX=y 17 | # CONFIG_SUBSYSTEM_COMPONENT_U__BOOT_NAME_REMOTE is not set 18 | # CONFIG_SUBSYSTEM_COMPONENT_U__BOOT_NAME_NONE is not set 19 | CONFIG_SUBSYSTEM_COMPONENT_TRUSTED__FIRMWARE__ARM_NAME_TF-A=y 20 | # CONFIG_SUBSYSTEM_COMPONENT_TRUSTED__FIRMWARE__ARM_NAME_REMOTE is not set 21 | # CONFIG_SUBSYSTEM_COMPONENT_TRUSTED__FIRMWARE__ARM_NAME_NONE is not set 22 | CONFIG_SUBSYSTEM_COMPONENT_LINUX__KERNEL_INSTANCE_KERNEL_NAME_XLNX__4___4=y 23 | # CONFIG_SUBSYSTEM_COMPONENT_LINUX__KERNEL_INSTANCE_KERNEL_NAME_REMOTE is not set 24 | CONFIG_SUBSYSTEM_COMPONENT_ROOTFS_NAME_PETALINUX__ROOTFS=y 25 | 26 | # 27 | # Generic Components 28 | # 29 | 30 | # 31 | # Auto Config Settings 32 | # 33 | CONFIG_SUBSYSTEM_AUTOCONFIG_DEVICE__TREE=y 34 | # CONFIG_SUBSYSTEM_DEVICE_TREE_MANUAL_INCLUDE is not set 35 | CONFIG_SUBSYSTEM_HARDWARE_AUTO=y 36 | CONFIG_SUBSYSTEM_PROCESSOR_PSU_CORTEXA53_0_SELECT=y 37 | CONFIG_SUBSYSTEM_ARCH_AARCH64=y 38 | 39 | # 40 | # Serial Settings 41 | # 42 | CONFIG_SUBSYSTEM_PMUFW_SERIAL_PSU_UART_0_SELECT=y 43 | CONFIG_SUBSYSTEM_FSBL_SERIAL_PSU_UART_0_SELECT=y 44 | CONFIG_SUBSYSTEM_ATF_SERIAL_PSU_UART_0_SELECT=y 45 | CONFIG_SUBSYSTEM_SERIAL_PSU_UART_0_SELECT=y 46 | # CONFIG_SUBSYSTEM_SERIAL_MANUAL_SELECT is not set 47 | # CONFIG_SUBSYSTEM_SERIAL_PSU_UART_0_BAUDRATE_9600 is not set 48 | # CONFIG_SUBSYSTEM_SERIAL_PSU_UART_0_BAUDRATE_19200 is not set 49 | # CONFIG_SUBSYSTEM_SERIAL_PSU_UART_0_BAUDRATE_38400 is not set 50 | # CONFIG_SUBSYSTEM_SERIAL_PSU_UART_0_BAUDRATE_57600 is not set 51 | CONFIG_SUBSYSTEM_SERIAL_PSU_UART_0_BAUDRATE_115200=y 52 | # CONFIG_SUBSYSTEM_SERIAL_PSU_UART_0_BAUDRATE_230400 is not set 53 | 54 | # 55 | # Ethernet Settings 56 | # 57 | CONFIG_SUBSYSTEM_ETHERNET_PSU_ETHERNET_3_SELECT=y 58 | # CONFIG_SUBSYSTEM_ETHERNET_MANUAL_SELECT is not set 59 | # CONFIG_SUBSYSTEM_ETHERNET_PSU_ETHERNET_3_MAC_AUTO is not set 60 | CONFIG_SUBSYSTEM_ETHERNET_PSU_ETHERNET_3_MAC="ff:ff:ff:ff:ff:ff" 61 | CONFIG_SUBSYSTEM_ETHERNET_PSU_ETHERNET_3_USE_DHCP=y 62 | 63 | # 64 | # Flash Settings 65 | # 66 | CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_SELECT=y 67 | # CONFIG_SUBSYSTEM_FLASH_MANUAL_SELECT is not set 68 | # CONFIG_SUBSYSTEM_FLASH__ADVANCED_AUTOCONFIG is not set 69 | 70 | # 71 | 72 | # 73 | # SD/SDIO Settings 74 | # 75 | CONFIG_SUBSYSTEM_PRIMARY_SD_PSU_SD_0_SELECT=y 76 | # CONFIG_SUBSYSTEM_SD_MANUAL_SELECT is not set 77 | 78 | # 79 | # RTC Settings 80 | # 81 | CONFIG_SUBSYSTEM_RTC_PSU_RTC_SELECT=y 82 | # CONFIG_SUBSYSTEM_RTC_MANUAL_SELECT is not set 83 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG=y 84 | 85 | # 86 | # boot image settings 87 | # 88 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_MEDIA_FLASH_SELECT is not set 89 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_MEDIA_SD_SELECT=y 90 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_MEDIA_MANUAL_SELECT is not set 91 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_IMAGE_NAME="BOOT.BIN" 92 | 93 | # 94 | # u-boot env partition settings 95 | # 96 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOTENV_MEDIA_FLASH_SELECT=y 97 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOTENV_MEDIA_MANUAL_SELECT is not set 98 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOTENV_PART_NAME="bootenv" 99 | 100 | # 101 | # kernel image settings 102 | # 103 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_MEDIA_FLASH_SELECT is not set 104 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_MEDIA_SD_SELECT=y 105 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_MEDIA_ETHERNET_SELECT is not set 106 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_MEDIA_MANUAL_SELECT is not set 107 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_IMAGE_NAME="image.ub" 108 | 109 | # 110 | # jffs2 rootfs image settings 111 | # 112 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_JFFS2_MEDIA_FLASH_SELECT=y 113 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_JFFS2_MEDIA_MANUAL_SELECT is not set 114 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_JFFS2_PART_NAME="jffs2" 115 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_JFFS2_IMAGE_NAME="rootfs.jffs2" 116 | 117 | # 118 | # dtb image settings 119 | # 120 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_BOOTIMAGE_SELECT=y 121 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_FLASH_SELECT is not set 122 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_SD_SELECT is not set 123 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_ETHERNET_SELECT is not set 124 | # CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_MANUAL_SELECT is not set 125 | CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_IMAGE_NAME="system.dtb" 126 | CONFIG_SUBSYSTEM_ENDIAN_LITTLE=y 127 | CONFIG_SUBSYSTEM_BOOTARGS_GENERATED="earlycon clk_ignore_unused" 128 | CONFIG_SUBSYSTEM_DEVICETREE_COMPILER_FLAGS="-@" 129 | 130 | # 131 | # ARM Trusted Firmware Compilation Configuration 132 | # 133 | CONFIG_SUBSYSTEM_ATF_EXTRA_COMPILER_FLAGS="" 134 | 135 | # 136 | # u-boot Configuration 137 | # 138 | CONFIG_SUBSYSTEM_UBOOT_CONFIG_TARGET="xilinx_zynqmp_virt_defconfig" 139 | CONFIG_SUBSYSTEM_NETBOOT_OFFSET=0x10000000 140 | CONFIG_SUBSYSTEM_U__BOOT_TFTPSERVER_IP="AUTO" 141 | 142 | # 143 | # Image Packaging Configuration 144 | # 145 | # CONFIG_SUBSYSTEM_ROOTFS_INITRAMFS is not set 146 | CONFIG_SUBSYSTEM_ROOTFS_INITRD=y 147 | # CONFIG_SUBSYSTEM_ROOTFS_JFFS2 is not set 148 | # CONFIG_SUBSYSTEM_ROOTFS_NFS is not set 149 | # CONFIG_SUBSYSTEM_ROOTFS_EXT4 is not set 150 | # CONFIG_SUBSYSTEM_ROOTFS_OTHER is not set 151 | CONFIG_SUBSYSTEM_UIMAGE_NAME="image.ub" 152 | # CONFIG_SUBSYSTEM_UIMAGE_HASH_NONE is not set 153 | CONFIG_SUBSYSTEM_UIMAGE_HASH_CRC32=y 154 | # CONFIG_SUBSYSTEM_UIMAGE_HASH_SHA1 is not set 155 | # CONFIG_SUBSYSTEM_UIMAGE_HASH_BOTH is not set 156 | CONFIG_SUBSYSTEM_COMPRESS_IMAGE=y 157 | CONFIG_SUBSYSTEM_DTB_PADDING_SIZE=0x1000 158 | CONFIG_SUBSYSTEM_COPY_TO_TFTPBOOT=y 159 | CONFIG_SUBSYSTEM_TFTPBOOT_DIR="/tftpboot" 160 | 161 | # 162 | # Firmware Version Configuration 163 | # 164 | CONFIG_SUBSYSTEM_HOSTNAME="@projname@" 165 | CONFIG_SUBSYSTEM_PRODUCT="@projname@" 166 | CONFIG_SUBSYSTEM_FW_VERSION="1.00" 167 | CONFIG_SUBSYSTEM_MACHINE_NAME="template" 168 | CONFIG_SUBSYSTEM_DT_XSCT_WORKSPACE="${PROOT}/components/plnx_workspace/device-tree" 169 | # 170 | # Yocto Settings 171 | # 172 | # PetaLinux Images Deploy Directory 173 | CONFIG_PLNX_IMAGES_LOCATION="${PROOT}/images/linux" 174 | CONFIG_MC_PLNX_IMAGES_LOCATION="${PROOT}/images/${BB_CURRENT_MC}" 175 | CONFIG_TMP_DIR_LOCATION="${PROOT}/build/tmp" 176 | CONFIG_PRE_MIRROR_URL="http://petalinux.xilinx.com/sswreleases/rel-v${PETALINUX_MAJOR_VER}/downloads" 177 | CONFIG_YOCTO_NETWORK_SSTATE_FEEDS_URL="http://petalinux.xilinx.com/sswreleases/rel-v${PETALINUX_MAJOR_VER}/aarch64/sstate-cache" 178 | -------------------------------------------------------------------------------- /templates/project/template-zynqMP/project-spec/configs/rootfs_config: -------------------------------------------------------------------------------- 1 | CONFIG_e2fsprogs-mke2fs=y 2 | CONFIG_mtd-utils=y 3 | CONFIG_can-utils=y 4 | CONFIG_dosfstools=y 5 | CONFIG_pciutils=y 6 | CONFIG_run-postinsts=y 7 | CONFIG_fpga-manager-script=y 8 | CONFIG_packagegroup-core-boot=y 9 | CONFIG_tcf-agent=y 10 | CONFIG_bridge-utils=y 11 | CONFIG_hellopm=y 12 | CONFIG_udev-extraconf=y 13 | CONFIG_imagefeature-ssh-server-openssh=y 14 | CONFIG_imagefeature-hwcodecs=y 15 | CONFIG_linux-xlnx-udev-rules=y 16 | CONFIG_ADD_EXTRA_USERS="root:root;petalinux::passwd-expire;" 17 | CONFIG_CREATE_NEW_GROUPS="aie;" 18 | CONFIG_ADD_USERS_TO_GROUPS="petalinux:audio,video,aie,input;" 19 | CONFIG_ADD_USERS_TO_SUDOERS="petalinux" 20 | CONFIG_nfs-utils=y 21 | CONFIG_libdfx=y 22 | -------------------------------------------------------------------------------- /templates/project/template-zynqMP/project-spec/hw-description/metadata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xilinx/PetaLinux/44644a911c4ee47be5a3ed412c154126b1bc4ea8/templates/project/template-zynqMP/project-spec/hw-description/metadata -------------------------------------------------------------------------------- /templates/project/template-zynqMP/project-spec/meta-user/recipes-bsp/u-boot/files/0001-ubifs-distroboot-support.patch: -------------------------------------------------------------------------------- 1 | From 357b3eebaa54be1ec8d14b306625eb73732ee5dc Mon Sep 17 00:00:00 2001 2 | From: Ashok Reddy Soma 3 | Date: Wed, 19 Aug 2020 05:29:40 -0600 4 | Subject: [UBOOT PATCH] ubifs: distroboot support 5 | 6 | Signed-off-by: Ashok Reddy Soma 7 | --- 8 | include/configs/xilinx_zynqmp.h | 5 ++++- 9 | 1 file changed, 4 insertions(+), 1 deletion(-) 10 | 11 | diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h 12 | index d3f465a..dc231b8 100644 13 | --- a/include/configs/xilinx_zynqmp.h 14 | +++ b/include/configs/xilinx_zynqmp.h 15 | @@ -154,7 +154,10 @@ 16 | 17 | #define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \ 18 | "bootcmd_" #devtypel #instance "=sf probe " #instance " 0 0 && " \ 19 | - "sf read $scriptaddr $script_offset_f $script_size_f && " \ 20 | + "setenv mtdids 'nor0=nor0' && " \ 21 | + "setenv mtdparts 'mtdparts=nor0:16m(raw),-(boot)' && " \ 22 | + "mtdparts && " \ 23 | + "ubi part boot; ubifsmount ubi0:boot; ubifsload $scriptaddr boot.scr; && " \ 24 | "echo QSPI: Trying to boot script at ${scriptaddr} && " \ 25 | "source ${scriptaddr}; echo QSPI: SCRIPT FAILED: continuing...;\0" 26 | 27 | -- 28 | 2.7.4 29 | --------------------------------------------------------------------------------