Sintaxa comenzii petalinux-build

De la YO3ITI
Versiunea din 8 noiembrie 2026 21:49, autor: Yo3iti (discuție | contribuții)
(dif) ← Versiunea anterioară | Versiunea curentă (dif) | Versiunea următoare → (dif)
Sari la navigare Sari la căutare

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 utilizarea petalinux-build:

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

Apoi:

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
                        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:
    Build the project:
    $ petalinux-build
    The bootable images are in <PROJECT>/images/linux/.

    Build SDK:
    $ petalinux-build -s | --sdk
    The equivalent bitbake task is do_populate_sdk, Built sdk is deployed at <PROJECT>/images/linux/sdk.sh

    Build Minimal eSDK:
    $ 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:
    $ petalinux-build -a | --archiver

    Build SDK with archiver:
    $ petalinux-build --sdk --archiver

    Build kernel only:
    $ petalinux-build -c kernel

    Compile kernel forcefully:
    $ petalinux-build -c kernel -x compile -f

    Deploy kernel forcefully:
    $ petalinux-build -c kernel -x deploy -f

    Build rootfs only:
    $ petalinux-build -c rootfs

    Build myapp of rootfs only:
    $ petalinux-build -c myapp

    List all rootfs sub-components:
    $ petalinux-build -c rootfs -h

    Clean up u-boot and build again:
    $ petalinux-build -c u-boot -x distclean
    Above command will remove tmp files and sstate cache of u-boot.

    $ petalinux-build -x distclean
    Above command will remove tmp files and sstate cache files.

    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