Search code examples
linux-kernelbuildroot

Buildroot doesn't have uImage option for kernel


I'm building a Linux kernel for the c-sky platform, and in "Kernel binary format", there is no option for uImage, only vmlinux. But my board requires a uImage. And if it can't find it it will boot to default rom, which is not what I want. So I'm wondering, what do I need to do to get the uImage option? I noticed that it is there for some other architectures/platforms like ARM. But not for my arch, c-sky.

Can anyone help me?

Thanks!


Solution

  • In the Linux kernel, different architectures have different available image formats. uImage is available in Linux, but not enabled in Buildroot.

    There are 2 ways you can produce uImage.


    The Manual way (OK for preliminary testing):

    1. In menuconfig -> Kernel, set:
      • Kernel binary format = custom target
      • Kernel image target name = uImage
    2. make host-uboot-tools
    3. make linux

    Step 2 is required because to build uImage you need the mkimage tool from host-uboot-tools. Using a "custom image" Buildroot is unaware of that and the build would fail without step 2.


    The correct way:

    Just enable the uImage format in Buildroot for the C-Sky architecture. This simple patch should be enough:

    diff --git a/linux/Config.in b/linux/Config.in
    index 1a50958ea146..c89c12b433be 100644
    --- a/linux/Config.in
    +++ b/linux/Config.in
    @@ -211,7 +211,7 @@ config BR2_LINUX_KERNEL_UIMAGE
            depends on BR2_arc || BR2_arm || BR2_armeb || \
                       BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le || \
                       BR2_sh || BR2_mips || BR2_mipsel || \
    -                  BR2_mips64 || BR2_mips64el || BR2_xtensa
    +                  BR2_mips64 || BR2_mips64el || BR2_xtensa || BR2_csky
            select BR2_PACKAGE_HOST_UBOOT_TOOLS
    
     config BR2_LINUX_KERNEL_APPENDED_UIMAGE
    
    

    This allows to select Kernel binary format = uImage and build normally without the need to manually build host-uboot-tools before Linux.