[U-Boot] Hanging in kmalloc of nand_scan_tail() function

terry gliumailenator at gmail.com
Sun Nov 14 14:18:57 CET 2010


在 2010-11-13六的 10:24 -0600,Kumar Gala写道:
> On Nov 12, 2010, at 9:43 PM, terry wrote:
> 
> >>> 
> >>> by the way,I cann't find the prototype of malloc in the whole project,it
> >>> seems that it is encapsulated in some libs.
> >> 
> >> It's in common/malloc.c.  There's weird preprocessor renaming going on,
> >> so it's called mALLOc in that file, but it shows up as malloc in the
> >> binary.
> > Thanks very much for your carefully instruction.
> > 
> >> 
> >> -Scott
> >> 
> > 
> 
> I haven't been following this thread, but just debugging a malloc/nand "corruption" issue myself.  I'm going to start a new thread on the subject since its more related to malloc.  However can you try the following and see what happens:
> 
> diff --git a/include/malloc.h b/include/malloc.h

I'm sorry, but I cann't understand you clearly. what do you mean by
writting this? compare two different versions? if so, which two version?

> index 3e145ad..19f0f0b 100644
> --- a/include/malloc.h
> +++ b/include/malloc.h
> @@ -850,7 +850,7 @@ extern Void_t*     sbrk();
>  #endif
>  
>  #ifndef MORECORE_CLEARS
> -#define MORECORE_CLEARS 1
> +#define MORECORE_CLEARS 0
>  #endif
>  
>  #endif /* INTERNAL_LINUX_C_LIB */
I read the malloc.h file in u-boot-2010.09. it's content like below:
#ifdef INTERNAL_LINUX_C_LIB
819 
820 #if __STD_C
821 
822 Void_t * __default_morecore_init (ptrdiff_t);
823 Void_t *(*__morecore)(ptrdiff_t) = __default_morecore_init;
824 
825 #else
826 
827 Void_t * __default_morecore_init ();
828 Void_t *(*__morecore)() = __default_morecore_init;
829 
830 #endif /* __STD_C */
831 
832 #define MORECORE (*__morecore)
833 #define MORECORE_FAILURE 0
834 #define MORECORE_CLEARS 1

#else /* INTERNAL_LINUX_C_LIB */
837 
838 #if __STD_C
839 extern Void_t*     sbrk(ptrdiff_t);
840 #else
841 extern Void_t*     sbrk();
842 #endif
843 
844 #ifndef MORECORE
845 #define MORECORE sbrk
846 #endif
847 
848 #ifndef MORECORE_FAILURE
849 #define MORECORE_FAILURE -1
850 #endif
851 
852 #ifndef MORECORE_CLEARS
853 #define MORECORE_CLEARS 1
854 #endif
855 
856 #endif /* INTERNAL_LINUX_C_LIB */
Do you mean that I should change MORECORE_CLEARS from 1 to 0?
-- 
Best regards,
terry



More information about the U-Boot mailing list