Busybox Bitbake Config does not save

I am trying to add devmem to my yocto image. I do this I run the command

bitbake -c menuconfig busybox

I go to Miscellaneous Utilities and place a * in the devmem menu. Exit and save the config then perform a

bitbake busybox

Followed by

bitbake core-image-full-cmdline

When I boot my device the devmem program is not there, when I re-run the menuconfig for busybox the devmem option is no longer selected! What can I do to fix this?


  • Busybox is like other projects that are using a .config to define the features needed to be compiled into the final output, just like the Linux kernel and U-boot, etc.

    So, here how to deal with them in Yocto:

    When you run:

    bitbake busybox -c menuconfig

    it will run make menuconfig into its working directory and opens the configuration menu for you.

    Now, if you save and exit, only the .config in the working directory will be changed, meaning that if the recipe get unpacked again your modification will be lost.

    In addition, when you change the .config via menuconfig you need to force the compilation of the busybox recipe, because for bitbake it is already built:

    bitbake busybox -c compile -f

    But, for the best practices, here what I suggest to you if you want your modification to be a feature that you can easily enable or disable from a recipe:

    1. Run: bitbake busybox -c menuconfig
    2. Edit and save your modification
    3. Run: bitbake busybox -c diffconfig

    The diffconfig command will give you a fragment.cfg file that contains the modifications you just did.

    The file should contain:


    A quick explaination about the fragment:

    When you opened menuconfig it backed up .config to .config.old, and then diffconfig will give you the difference between them after saving your modification into .config.

    Now, Busybox like other recipes that are using configuration files, they understand that if a .cfg file exists in their working directory, they need to apply it to their main .config file before compilation.

    So, what you need to do after getting the fragment.cfg is to create a .bbappend recipe to busybox in your custom recipe and specify your new fragment:

         | recipes-core/
             | busybox/
                 | busybox_%.bbappend
                 | busybox/
                     | devmem.cfg

    Now, busybox_%.bbappend contains:

    FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
    SRC_URI += "file://devmem.cfg"

    Now, when you re-bitbake Busybox again, it will unpack the fragment and apply it.

    To check if the fragment is applied after the bitbake completes, you can check the .config file:

    1. First get the Build directory path of Busybox
    bitbake -e busybox | grep ^B=
    1. Grep for CONFIG_DEVMEM
    grep CONFIG_DEVMEM <path_of_previous_command>/.config

    You should see: