[U-Boot] UBIFS will not build for Davinci (2006.06-rc2)

Stefan Roese sr at denx.de
Tue Jun 2 07:09:29 CEST 2009


On Monday 01 June 2009 20:58:39 kevin_springle at telus.net wrote:
> I am trying to add UBIFS support to the davinci_dvevm board (ARCH=arm,
> CPU=arm926ejs, BOARD=dvevm, VENDOR=davinci, SOC=davinci) configuration. 
> However, I encountered a number of issues that lead me to belive that UBIFS
> support is limited to PowerPC architectures.
>
> Has UBIFS support been built and tested on any platform other than PowerPC?

Yes. I don't know of any other tests. Porting to other platforms should be not 
that hard though. I stated this in my original commit text of the lzo 
compressor support:

git-id: b1b4e89a0f3b75854c39a62cae41bad56d210adf
    Add LZO decompressor support
    
    This patch adds LZO decompression support to U-Boot. It is needed for
    the upcoming UBIFS support, since UBIFS uses LZO as default compressor/
    decompressor. Since we only support read-only in UBIFS, only the
    decompressor is needed.
    
    All this is copied with minor changes from the current Linux kernel
    version (2.6.28-rc8).
    
    This patch only implements this LZO decompressor support for PPC.
    Other platforms using UBIFS will have to add the required
    "include/asm/unaligned.h" as well. It should be fairly easy to copy this
    from the Linux source tree as I have done it for PPC in this patch.
    
    Signed-off-by: Stefan Roese <sr at denx.de>


So I suggest that take a look at the commit ID mentioned above and try to move 
the ARM related files for supporting lzo from Linux to U-Boot as well.

> The patch I used to enable UBIFS support on the DVEVM board is:
> ---
> /home/tester/uboot/u-boot-2009.06-rc2.orig/include/configs/davinci_dvevm.h 
>   2009-05-15 14:29:23.000000000 -0700 +++
> /home/tester/uboot/u-boot-2009.06-rc2/include/configs/davinci_dvevm.h   
> 2009-06-01 11:15:59.000000000 -0700 @@ -51,7 +51,7 @@
>  /*=======*/
>  #define DV_EVM
>  #define CONFIG_SYS_NAND_SMALLPAGE
> -#define CONFIG_SYS_USE_NOR
> +#define CONFIG_SYS_USE_NAND
>  /*===================*/
>  /* SoC Configuration */
>  /*===================*/
> @@ -129,6 +129,14 @@
>  #define CONFIG_SYS_MAX_NAND_DEVICE    1    /* Max number of NAND devices
> */ #define CONFIG_ENV_OFFSET        0x0    /* Block 0--not used by bootcode
> */ #define DEF_BOOTM        ""
> +#define CONFIG_MTD_PARTITIONS
> +#define CONFIG_CMD_MTDPARTS
> +#define CONFIG_CMD_UBI
> +#define CONFIG_CMD_UBIFS
> +#define CONFIG_SYS_64BIT_VSPRINTF
> +#define CONFIG_RBTREE
> +#define CONFIG_LZO
>  #elif defined(CONFIG_SYS_USE_NOR)
>  #ifdef CONFIG_NOR_UART_BOOT
>  #define CONFIG_SKIP_LOWLEVEL_INIT    /* U-Boot is loaded by a bootloader
> */
>
>
>
> The first problem I encountered was a compiler error:
> In file included from ubifs.c:27:
> ubifs.h:468: error: conflicting types for '__set_bit'
> /home/tester/uboot/u-boot-2009.06-rc2/include/asm/bitops.h:29: error:
> previous definition of '__set_bit' was here ubifs.h:476: error: conflicting
> types for '__clear_bit'
> /home/tester/uboot/u-boot-2009.06-rc2/include/asm/bitops.h:36: error:
> previous definition of '__clear_bit' was here make[2]: *** [ubifs.o] Error
> 1
>
> The error seems to occur becase fs/ubifs/ubifs.h defines two inline
> functions, __set_bit() and __clear_bit().  For some architectures,
> including ARM, these functions are already defined in bitops.h AND the
> prototypes are different from the ones in ubifs.h:
> __set_bit() & __clear_bit():
>    include/asm-arm/bitops.h
>    include/asm-microblaze/bitops.h
> __set_bit() only:
>    include/asm-blackfin/bitops.h
>    include/asm-i386/bitops.h
>    include/asm-mips/bitops.h
>
> For a quick fix (and probably not the recommended one), I renamed all the
> __set_bit() and __clear_bit() symbols in fs/ubifs to be __ubi_set_bit() and
> __ubi_clear_bit().

I don't like this approach as it changes the UBIFS C files instead of one of 
the headers used as porting layer from Linux to U-Boot. We shouldn't change 
the C files to make it easier to sync UBIFS with later Linux versions. Perhaps 
this __set_bit()(__clear_bit() U-Boot implementation needs to be consolidated 
throughout all platforms.

> The second problem was a compiler error in lzo1x_decompress.c:
> lzo1x_decompress.c:17:27: error: asm/unaligned.h: No such file or directory
> lzo1x_decompress.c: In function 'lzo1x_decompress_safe':
> lzo1x_decompress.c:72: warning: implicit declaration of function
> 'put_unaligned' lzo1x_decompress.c:72: warning: implicit declaration of
> function 'get_unaligned' lzo1x_decompress.c:140: warning: implicit
> declaration of function 'get_unaligned_le16' make[2]: ***
> [lzo1x_decompress.o] Error 1
>
> File unaligned.h is ONLY present in include/asm-ppc.

See statement above.

> So I undefined CONFIG_LZO and now I get linker errors:
> fs/ubifs/libubifs.a(super.o): In function `init_constants_early':
> /home/tester/uboot/u-boot-2009.06-rc2/fs/ubifs/super.c:317: undefined
> reference to `fls' fs/ubifs/libubifs.a(lpt.o): In function
> `dirty_cow_nnode':
> /home/tester/uboot/u-boot-2009.06-rc2/fs/ubifs/lpt.c:893: undefined
> reference to `test_and_set_bit' fs/ubifs/libubifs.a(lpt.o): In function
> `dirty_cow_pnode':
> /home/tester/uboot/u-boot-2009.06-rc2/fs/ubifs/lpt.c:944: undefined
> reference to `test_and_set_bit' fs/ubifs/libubifs.a(lpt.o): In function
> `do_calc_lpt_geom':
> /home/tester/uboot/u-boot-2009.06-rc2/fs/ubifs/lpt.c:81: undefined
> reference to `fls' /home/tester/uboot/u-boot-2009.06-rc2/fs/ubifs/lpt.c:82:
> undefined reference to `fls'
> /home/tester/uboot/u-boot-2009.06-rc2/fs/ubifs/lpt.c:83: undefined
> reference to `fls' /home/tester/uboot/u-boot-2009.06-rc2/fs/ubifs/lpt.c:84:
> undefined reference to `fls'
> /home/tester/uboot/u-boot-2009.06-rc2/fs/ubifs/lpt.c:87: undefined
> reference to `fls'
> fs/ubifs/libubifs.a(lpt.o):/home/tester/uboot/u-boot-2009.06-rc2/fs/ubifs/l
>pt.c:89: more undefined references to `fls' follow
> fs/ubifs/libubifs.a(tnc.o): In function `dirty_cow_znode':
> /home/tester/uboot/u-boot-2009.06-rc2/fs/ubifs/tnc.c:274: undefined
> reference to `test_and_set_bit' fs/ubifs/libubifs.a(ubifs.o):(.data+0xc):
> undefined reference to `lzo1x_decompress_safe'
>
> * Function test_and_set_bit() is declared in include/asm-arm/bitops.h but
> it is never defined, like it is for other architectures. * Function fls()
> is ONLY defined for PowerPC architectures.
> * Function lzo1x_decompress_safe is missing, of course, because I undefined
> CONFIG_LZO.

LZO is the default UBIFS compressor. You should always enable it.

> Also, there are some C library related linker errors:
> /usr/local/WindRiver_3_0/wrlinux-3.0/layers/wrll-toolchain-4.3-85/arm/toolc
>hain/x86-linux2/bin/../lib/gcc/arm-wrs-linux-gnueabi/4.3.2/libgcc.a(_udivsi3
>.o): In function `__aeabi_uidiv': (.text+0x0): multiple definition of
> `__udivsi3'
> lib_arm/libarm.a(_udivsi3.o):/home/tester/uboot/u-boot-2009.06-rc2/lib_arm/
>_udivsi3.S:17: first defined here fs/ubifs/libubifs.a(ubifs.o):(.data+0xc):
> undefined reference to `lzo1x_decompress_safe'
> /usr/local/WindRiver_3_0/wrlinux-3.0/layers/wrll-toolchain-4.3-85/arm/toolc
>hain/x86-linux2/bin/../lib/gcc/arm-wrs-linux-gnueabi/4.3.2/libgcc.a(_dvmd_ln
>x.o): In function `__aeabi_ldiv0': (.text+0x8): undefined reference to
> `raise'
>
> These C library errors are directly related to the
> CONFIG_SYS_64BIT_VSPRINTF option, which I enabled because ubifs.c told me
> to:
>   ubifs.c:30:2: warning: #warning Please define CONFIG_SYS_64BIT_VSPRINTF
> for correct output! Disabling CONFIG_SYS_64BIT_VSPRINTF produced the
> warning, but the linker no longer complains about the symbols.

UBIFS will still work without this. But some printf's will output incorrect 
values because UBIFS used 64bit printf formats at some points. So this arm 
64bit printf issue should be solved but is not essential.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================


More information about the U-Boot mailing list