Sintaxa comenzii petalinux-build: Diferență între versiuni

De la YO3ITI
Sari la navigare Sari la căutare
Pagină nouă: Pentru utilizarea petalinux-build: <syntaxhighlight lang="shell"> petalinux-build --help usage: Use petalinux-build [options] Builds the project or the specified components options: -D, --debug Display the Debug prints. -h, --help Show this help message and exit -p PROJECT_DIR, --project PROJECT_DIR path to PetaLinux SDK project. Default is working project. -c COMPONENT, --component COMPONENT...
 
Fără descriere a modificării
 
(Nu s-au afișat 9 versiuni intermediare efectuate de același utilizator)
Linia 1: Linia 1:
Pentru utilizarea petalinux-build:
Documentația oficială Petalinux pe platforme AMD (Xilinx) se găsește la [https://docs.amd.com/r/2025.2-English/ug1144-petalinux-tools-reference-guide/Overview PetaLinux Tools Documentation: Reference Guide (UG1144)]


<syntaxhighlight lang="shell">
BitBake este un sistem de automatizare a procesului de compilare (build automation engine), utilizat în principal de Yocto Project, OpenEmbedded și AMD PetaLinux pentru construirea distribuțiilor Linux destinate sistemelor embedded.
petalinux-build --help
usage: Use petalinux-build [options]


Builds the project or the specified components
Pentru rularea unei rutine de build pe petalinux, mai jos sunt pașii pentru utilizarea <code>petalinux-build</code>:


options:
<syntaxhighlight lang="shell">
  -D, --debug          Display the Debug prints.
# Allow the user namespaces required by BitBake during the build.
  -h, --help            Show this help message and exit
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
  -p PROJECT_DIR, --project PROJECT_DIR
</syntaxhighlight>
                        path to PetaLinux SDK project.
                        Default is working project.
  -c COMPONENT, --component COMPONENT
                        Specify the component
                        it will build the specified component and its dependencies.
                        E.g. -c rootfs.
                        E.g. -c myapp.
  -x <tasks of BitBake>, --execute <tasks of BitBake>
                        Specify a bitbake task of the component
                        To know the list tasks for a component:
                        E.g. -x do_listtasks.
  -f, --force          Force run a specific task ignoring the stamps
                        Force run has to be for a component or its tasks
                        E.g. -c myapp -f
                        E.g. -c myapp -x compile -f.
  -s, --sdk            Build SDK ==> do_populate_sdk.
  -e, --esdk            Build Minimal eSDK ==> do_populate_sdk_ext.
  -a, --archiver        This will create archiver.tar.gz in the images/linux folder
                        which contains sources and licenses.


Examples:
Copiere sursă listener în Ubuntu:
    Build the project:
    $ petalinux-build
    The bootable images are in <PROJECT>/images/linux/.


    Build SDK:
<syntaxhighlight lang="shell">
     $ petalinux-build -s | --sdk
scp "C:/Users/mianc/Documents/ChatGPT/AAA/iq_udp_decimate8_listener.c" `
    The equivalent bitbake task is do_populate_sdk, Built sdk is deployed at <PROJECT>/images/linux/sdk.sh
     "tom@192.168.10.40:/home/tom/petalinux/arty-z7-iq/project-spec/meta-user/recipes-apps/iq-udp-decimate8-native/files/iq-udp-decimate8-native.c"
</syntaxhighlight>


    Build Minimal eSDK:
Apoi build:
    $ petalinux-build -e | --esdk
    The equivalent bitbake task is do_populate_sdk_ext, Built esdk is deployed at <PROJECT>/images/linux/esdk.sh
    This can be imported to petalinux tool with user source changes


    Build project with archiver:
<syntaxhighlight lang="shell">
    $ petalinux-build -a | --archiver
cd /home/tom/petalinux/arty-z7-iq
petalinux-build -c iq-udp-decimate8-native
</syntaxhighlight>


    Build SDK with archiver:
Check care e rpm-ul care conține fișierul
    $ petalinux-build --sdk --archiver


    Build kernel only:
<syntaxhighlight lang="shell">
    $ petalinux-build -c kernel
tom@tom-ThinkPad-T560:~$ cd /home/tom/petalinux/arty-z7-iq
ls -lt build/tmp/deploy/rpm/cortexa9t2hf_neon/iq-udp-decimate8-native-[0-9]*.rpm
</syntaxhighlight>


    Compile kernel forcefully:
Apoi extrage executabilul cu:
    $ petalinux-build -c kernel -x compile -f


     Deploy kernel forcefully:
<syntaxhighlight lang="shell">
     $ petalinux-build -c kernel -x deploy -f
(
     set -e
     set -o pipefail


     Build rootfs only:
     rpm="$PWD/build/tmp/deploy/rpm/cortexa9t2hf_neon/RPM_FILENAME"
     $ petalinux-build -c rootfs
     stage=$(mktemp -d)
    cd "$stage"


     Build myapp of rootfs only:
     rpm2cpio "$rpm" | cpio -id './usr/bin/iq-udp-decimate8-native'
     $ petalinux-build -c myapp
    binary=./usr/bin/iq-udp-decimate8-native
     file "$binary"
    grep -aFo -- '--chirp' "$binary"


     List all rootfs sub-components:
     scp "$binary" \
    $ petalinux-build -c rootfs -h
        tom@192.168.10.70:/home/tom/iq/active/iq_udp_decimate8_chirp
)
</syntaxhighlight>


    Clean up u-boot and build again:
Unde RPM_FILENAME e rezultatul comenzii de afișare a rpm-ului. <code>grep -aFo -- '--chirp' "$binary"</code> poate fi schimbat pentru a afișa informații legate de tipul aplicației.
    $ petalinux-build -c u-boot -x distclean
    Above command will remove tmp files and sstate cache of u-boot.


    $ petalinux-build -x distclean
=Link-uri externe=
    Above command will remove tmp files and sstate cache files.
* [https://docs.amd.com/r/2025.2-English/ug1144-petalinux-tools-reference-guide/Overview PetaLinux Tools Documentation: Reference Guide (UG1144)]
 
    Clean up the project build and the generated bootable images:
    $ petalinux-build -x mrproper
    Above command will remove tmp files, <PROJECT>/images/,  <PROJECT>/build/
                and <PROJECT>/components/plnx_workspace directories
</syntaxhighlight>


[[category:FPGA]]
[[category:FPGA]]
[[category:petalinux]]
[[category:Doppler IQ App]]
[[category:Petalinux]]
[[category:Arty Z7-20]]
[[category:Bitbake]]

Versiunea curentă din 17 noiembrie 2026 16:13

Documentația oficială Petalinux pe platforme AMD (Xilinx) se găsește la PetaLinux Tools Documentation: Reference Guide (UG1144)

BitBake este un sistem de automatizare a procesului de compilare (build automation engine), utilizat în principal de Yocto Project, OpenEmbedded și AMD PetaLinux pentru construirea distribuțiilor Linux destinate sistemelor embedded.

Pentru rularea unei rutine de build pe petalinux, mai jos sunt pașii pentru utilizarea petalinux-build:

# Allow the user namespaces required by BitBake during the build.
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0

Copiere sursă listener în Ubuntu:

scp "C:/Users/mianc/Documents/ChatGPT/AAA/iq_udp_decimate8_listener.c" `
    "tom@192.168.10.40:/home/tom/petalinux/arty-z7-iq/project-spec/meta-user/recipes-apps/iq-udp-decimate8-native/files/iq-udp-decimate8-native.c"

Apoi build:

cd /home/tom/petalinux/arty-z7-iq
petalinux-build -c iq-udp-decimate8-native

Check care e rpm-ul care conține fișierul

tom@tom-ThinkPad-T560:~$ cd /home/tom/petalinux/arty-z7-iq
ls -lt build/tmp/deploy/rpm/cortexa9t2hf_neon/iq-udp-decimate8-native-[0-9]*.rpm

Apoi extrage executabilul cu:

(
    set -e
    set -o pipefail

    rpm="$PWD/build/tmp/deploy/rpm/cortexa9t2hf_neon/RPM_FILENAME"
    stage=$(mktemp -d)
    cd "$stage"

    rpm2cpio "$rpm" | cpio -id './usr/bin/iq-udp-decimate8-native'
    binary=./usr/bin/iq-udp-decimate8-native
    file "$binary"
    grep -aFo -- '--chirp' "$binary"

    scp "$binary" \
        tom@192.168.10.70:/home/tom/iq/active/iq_udp_decimate8_chirp
)

Unde RPM_FILENAME e rezultatul comenzii de afișare a rpm-ului. grep -aFo -- '--chirp' "$binary" poate fi schimbat pentru a afișa informații legate de tipul aplicației.

Link-uri externe