0

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

Donal M
  • 1,305
  • 2
  • 11
  • 23
  • 1
    What do you mean by all packages. When you say bitbake it will build all the packages right. You can stop before the do_rootfs task by running bitbake -c imagename – md.jamal Mar 01 '19 at 01:25
  • @md.jamal It's just the ipk packages, which I would like to build for an ipk repository. I didn't want to do the full build, as do_rootfs can take a while for my image. – Donal M Mar 01 '19 at 10:25
  • 2
    You could create a [packagegroup](https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#usingpoky-extend-customimage-customtasks) with all your packages, but then you'll have a big dependency on it, or a meta-recipe that depends on every packages. You can also create a custom image type and remove do_rootfs step. – Nayfe Mar 02 '19 at 07:41

2 Answers2

1

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
JBirdVegas
  • 10,855
  • 2
  • 44
  • 50
0

In Yocto >=4.0 this is actually pretty easy to achieve. The packagegroup method did not work for me at all.

I don't know if this works in older versions though.

Create a new file in your custom layer, e.g. meta-custom/classes/norootfs.bbclass and put the following lines in there (as far as I noticed the order does not matter):

Either use

deltask do_deploy
deltask do_image
deltask do_rootfs
deltask do_image_complete
deltask do_image_setscene

or

noexec do_deploy
noexec do_image
noexec do_rootfs
noexec do_image_complete
noexec do_image_setscene

(noexec: What is the difference between do_compile[noexec] and empty function in bitbake recipe?)

then in your meta-custom/recipes-core/images/myimage.bb add norootfs to your other inherit commands e.g. the most basic one

inherit core-image norootfs

You will notice your number of tasks decreasing by a fair amount (mine from ~4700 to ~3000) and there is no complete rootfs image anymore in build/tmp/deploy/images, except for bzImage and modules, just the plain ipk files in build/tmp/deploy/ipk.

I got this information by looking at https://docs.yoctoproject.org/ref-manual/tasks.html?highlight=do_image and .bbclass files in meta/classes where deltask is frequently used.

muhgo
  • 1
  • 1