Search code examples
embeddedfilesystems

Enabling udev package in the Buildroot seems to be breaking the build


I am trying to move my buildroot from using mdev to udev. I have removed the following config parameter from the v5 build-root dev_defconfig to remove mdev:

-BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y

and enabled the config required for enabling udev in the system:

+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y

And then tried building the kernel in the following way:

make dev_defconfig
make

But this seems to be getting me into the following compilation error:

Loading RAMDisk Image
Image too large: increase CONFIG_SYS_BOOTM_LEN
Must RESET board to recover
Signature check Bad (error 1)
make[1]: *** [Makefile:817: target-post-image] Error 1
make: *** [Makefile:84: _all] Error 2

Does anyone has any idea where should I look to fix this? Looks like the image size including the udev has gone beyond the limit. But not sure where is this set and how to increase that?


Solution

  • This turns out to be a problem with the gunzip size and uboot restriction on the size. The default gunzip size defined in the uboot code is the below: (I am working with this uboot version u-boot-2021.07):

    common/bootm.c
    #define CONFIG_SYS_BOOTM_LEN   0x800000
    

    which is 8MB. My gunzip size of the image was going over 27MB and hence I had to change the above size to 30MB. I achieved this through a patch which is as follows:

    diff --git a/common/bootm.c b/common/bootm.c
    index ea71522d..8347316f 100644
    --- a/common/bootm.c
    +++ b/common/bootm.c
    @@ -34,8 +34,8 @@
     #include <image.h>
     
     #ifndef CONFIG_SYS_BOOTM_LEN
    -/* use 8MByte as default max gunzip size */
    -#define CONFIG_SYS_BOOTM_LEN   0x800000
    +/* changing the default 8MByte gunzip size to ~27MB */
    +#define CONFIG_SYS_BOOTM_LEN   0x1AE0000
     #endif
     
     #define MAX_CMDLINE_SIZE       SZ_4K
    

    So the overall structure I used is the following:

    1. Having the following package in the buildroot:

      package/uboot-tools/

    2. Having the following patch file in the buildroot:

      board/xxxx/yyyy/patches/uboot-tools/0004-max-gunzip-size-increased-from-8-MByte-to-30-MByte.patch

    And then building the stack doesn't throw the compilation error anymore.