From: hedwin Date: Sat, 19 Dec 2009 13:56:50 +0100 Subject: [U-Boot] ubi part failing on NAND In-Reply-To: <4B2B9ABC.2000701@theptrgroup.com> References: <4B2A9DEF.3070408@theptrgroup.com> <200912180916.07602.sr@denx.de> <2daf59620912180435u1c0331b2m57de65ed11cbfea9@mail.gmail.com> <200912181341.04646.sr@denx.de> <4B2B9ABC.2000701@theptrgroup.com> Message-ID: <2daf59620912190456x52fddacaq5d67807e10959fda@mail.gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de A bit on the reason why this amount of memory is needed. I had the same problem jeff mentions. After tracing where dlmalloc allocates its memory chunks I found out that it started allocating memory in code space. Overwritting code space eventually resultated in uboot crashing. Looking into dlmalloc I did not find any code that checks whether it allocates memory outside its boundary. Since I use a 2009.01 release I need to verify this against the latest release. There is also another problem with ubi. If you repeat the following statements more than once uboot also crashed. nand erase /aPartition ubi part nand /aPartition ubi create aVolume I did not check yet if this is also an allocation problem or something totally different. Hedwin On Fri, Dec 18, 2009 at 4:07 PM, Jeff Angielski wrote: > Stefan Roese wrote: >> >> On Friday 18 December 2009 13:35:26 hedwin wrote: >>> >>> Jeff, what is the size of your allocateble memory. Had to increase it to >>> ?4MB to get it working. >> >> I've got 1MByte for my test on Kilauea. This should be enough. There >> is already a compile-time check in the UBI code: >> >> >> #if (CONFIG_SYS_MALLOC_LEN < (512 << 10)) >> #error Malloc area too small for UBI, increase CONFIG_SYS_MALLOC_LEN to >= >> 512k >> #endif >> >> Please let me know if this really is not enough. But for me, 1MB is >> working. > > As per Hedwin's suggestion I increased my CONFIG_SYS_MALLOC_LEN to 4MB and > the error disappeared. ?Thanks Hedwin! ?And now the UBI output matches my > part (e.g. PEB size). > > > => nand erase 0x0 0x40000000 > > => ubi part fs1 > Creating 1 MTD partitions on "nand0": > 0x000000000000-0x000020000000 : "mtd=0" > UBI: attaching mtd2 to ubi0 > UBI: physical eraseblock size: ? 262144 bytes (256 KiB) > UBI: logical eraseblock size: ? ?253952 bytes > UBI: smallest flash I/O unit: ? ?4096 > UBI: VID header offset: ? ? ? ? ?4096 (aligned 4096) > UBI: data offset: ? ? ? ? ? ? ? ?8192 > UBI: empty MTD device detected > UBI: create volume table (copy #1) > UBI: create volume table (copy #2) > UBI: attached mtd2 to ubi0 > UBI: MTD device name: ? ? ? ? ? ?"mtd=0" > UBI: MTD device size: ? ? ? ? ? ?512 MiB > UBI: number of good PEBs: ? ? ? ?2045 > UBI: number of bad PEBs: ? ? ? ? 3 > UBI: max. allowed volumes: ? ? ? 128 > UBI: wear-leveling threshold: ? ?4096 > UBI: number of internal volumes: 1 > UBI: number of user volumes: ? ? 0 > UBI: available PEBs: ? ? ? ? ? ? 2021 > UBI: total number of reserved PEBs: 24 > UBI: number of PEBs reserved for bad PEB handling: 20 > UBI: max/mean erase counter: 0/0 > => > > -- > Jeff Angielski > The PTR Group > www.theptrgroup.com >