Search code examples
yoctobitbake

Build all packages for an image


Is it possible to build all of the packages for a specific image? I know I can build packages individually, but ideally would like to build all of them at once, through a single command.

Alternatively, is there a way to prevent the do_rootfs task from being executed for a particular image.

Cheers, Donal


Solution

  • First make an image that contains a packagegroup (or just list your dependencies there).

    $ cat sources/meta-custom/recipes-custom/images/only-packages-image.bb
    SUMMARY = "All dependencies no image"
    LICENSE = "CLOSED"
    version = "@@DISTRO_VERSION@@"
    
    BB_SCHEDULER = "speed"
    
    # option 1 - packagegroup, package list can be reused in real image
    CORE_IMAGE_BASE_INSTALL += "\
        packagegroup_all-depends \
    "
    # option 2 - list deps here, package list can not be reused in real image
    CORE_IMAGE_BASE_INSTALL += "\
        lshw \
        systemd \
        cronie \
        glibc \
        sqlite \
        bash \
        python3-dev \
        python3-2to3 \
        python3-misc \
        python3-pyvenv \
        python3-modules \
        python3-pip \
        wget \
        apt \
        pciutils \
        file \
        tree \
        \
        wpa-supplicant \
        dhcpcd \
        networkmanager \
        curl-dev \
        curl \
        hostapd \
        iw \
    "
    
    # remove the rootfs step
    do_rootfs() {
    }
    

    Second make your packagegroup if you opted to reuse the list of packages

    $ cat sources/meta-custom/recipes-custom/packagegroups/packagegroup-alldeps.bb
    PACKAGE_ARCH = "${MACHINE_ARCH}"
    inherit packagegroup
    
    RDEPENDS_${PN} = " \
        lshw \
        systemd \
        cronie \
        glibc \
        sqlite \
        bash \
        python3-dev \
        python3-2to3 \
        python3-misc \
        python3-pyvenv \
        python3-modules \
        python3-pip \
        wget \
        apt \
        pciutils \
        file \
        tree \
        \
        wpa-supplicant \
        dhcpcd \
        networkmanager \
        curl-dev \
        curl \
        hostapd \
        iw \
    "
    

    Finally build your new image placeholder

    $ bitbake only-packages-image