[U-Boot] U-Boot v2009.08 & JFFS2 (NOR)

Jon Diekema diekema at cideas.com
Tue Sep 15 03:36:41 CEST 2009


On Mon, 2009-09-14 at 20:08 -0500, Tommy Wang wrote:
> Hello U-Boot Users,
> 
> I am working on updating a EP8248 based board from a very old U-Boot
> 1.1.2 to v2009.08.
> 
> The board has 2 banks of 32MB/256 sector NOR flash at 0xFC000000 and
> 0xFE000000.  The (single) JFFS2 partition is located at 0xFE020000 to
> 0xFFEFFFFF.
> 
> Using U-Boot 1.1.2, the files within the partition show up just fine
> w/ the ls command.  Using U-Boot v2009.08, when booting Linux via
> TFTP, the JFFS2 partition can be mounted (mount -t jffs2
> /dev/mtdblock2 /mnt), and the files show up fine.  I cannot seem to
> get U-Boot to recognize the JFFS2 partition, however.
> 
> The existing JFFS2 configuration in U-Boot 1.1.2 is:
> 
> #define CFG_JFFS2_FIRST_BANK 1
> #define CFG_JFFS2_FIRST_SECTOR 1
> #define CFG_JFFS2_NUM_BANKS 1
> 
> In v2009.08, I have tried:
> 
> #define CONFIG_SYS_JFFS2_FIRST_BANK 1
> #define CONFIG_SYS_JFFS2_FIRST_SECTOR 1
> #define CONFIG_SYS_JFFS2_NUM_BANKS 1
> 
> My debug output shows me:
> 
> start_phys: fc000000
> end_phys: fbffffff
> part->size: ffffffff
> 
> Looking through code, I saw that the above macros were no longer used.
>  The doc/README.JFFS2 seemed to be out of date.  I tried copying from
> configurations that look like they may work from other platforms:
> 
> #define CONFIG_JFFS2_DEV "nor1"
> #define CONFIG_JFFS2_PART_SIZE 0x01edffff
> #define CONFIG_JFFS2_PART_OFFSET 0x00020000
> #define CONFGI_SYS_JFFS2_SORT_FRAGMENTS
> 
> This gives me the correct start and end address, but it still does not
> recognize the JFFS2 partition:
> 
> => ls
> start_phys: fe020000
> end_phys: ffefffff
> part->size: 1edffff
> size: 131072
> Scanning JFFS2 FS: .  add_node: malloc failed
> add_node failed!
> ls: Failed to scan JFFSv2 file structure
> 
> Next, I tried setting up the mtd partitions:
> 
> #define CONFIG_CMD_MTDPARTS
> #define CONFIG_MTD_DEVICE
> #define CONFIG_FLASH_CFI_MTD
> #define MTDIDS_DEFAULT "nor1=primary"
> #define MTDPARTS_DEFAULT "mtdparts=primary:31616k at 128k(mypart)"
> #define CONFIG_EXTRA_ENV_SETTINGS \
>   "mtdids=nor1=primary \0" \
>   "mtdparts=" MK_STR(MTDPARTS_DEFAULT) "\0"
> 
> But, again, the JFFS2 fails to load with the same error as above.
> 
> I am kind of out of ideas.  Can anyone give some advice?

How about using something like the following:

> #undef  CONFIG_SYS_USE_UBI              /* Define to use UBI */
> #undef  CONFIG_SYS_USE_UBIFS            /* Define to Use UBIFS */
> #define CONFIG_CMD_JFFS2                /* Turn on the "fsload", "ls", and "fsinfo" commands */
> 
> 
> #ifdef CONFIG_SYS_USE_UBIFS
> 
> #define CONFIG_CMD_UBIFS                /* Turn on the "ubifsmount", "ubifsls", */
>                                         /* and "ubifsload" commands. */
> #define CONFIG_LZO                      /* Use LZO library - needed for UBIFS */
> #define CONFIG_SYS_USE_UBI              /* Use UBI */
> 
> #endif /* CONFIG_SYS_USE_UBIFS */
> 
> 
> #ifdef CONFIG_SYS_USE_UBI
> 
> #ifdef CONFIG_SYS_MALLOC_LEN
> #undef CONFIG_SYS_MALLOC_LEN
> #endif
> #define CONFIG_SYS_MALLOC_LEN           (CONFIG_ENV_SIZE + 1 * (1024 * 1024))
> 
> #define CONFIG_CMD_UBI                  /* Turn on the "ubi" command */
> #define CONFIG_RBTREE                   /* Red-black tree support - needed for UBI */
> #define CONFIG_MTD_UBI_DEBUG            /* Enable UBI debugging */
> #define CONFIG_MTD_PARTITIONS           /* Support MTD partitions */
> 
> #endif /* CONFIG_SYS_USE_UBI */
> 
> 
> #ifdef CONFIG_CMD_JFFS2
> #ifndef CONFIG_MTD_PARTITIONS
> #define CONFIG_MTD_PARTITIONS           /* Support MTD partitions */
> #define CONFIG_MTD_DEVICE               /* Support MTD devices */
> #endif /* CONFIG_MTD_PARTITIONS */
> #endif /* CONFIG_CMD_JFFS2 */
> 
> 
> #ifdef CONFIG_MTD_PARTITIONS
> 
> /* MTD partition support */
> #define CONFIG_FLASH_CFI_MTD		/* Export CFI flash to the MTD layer */ 
> #define CONFIG_CMD_MTDPARTS		/* Turn on the "chpart" and "mtdparts" commands */
> 
> /* Default MTD partition table */
> #define MTDIDS_DEFAULT		"nor0=yourBoard-0"
> #define MTDPARTS_DEFAULT	"mtdparts=yourBoard-0:" \
> 				"384k(U-Boot),128k(U-Boot Env)," \
> 				"384k(Backup U-Boot),128k(Backup U-Boot Env)," \
> 				"13m(FIT Image)," \
> 				"2m(Backup JFFS),112m(Data JFFS);"
> 
> #endif /* CONFIG_MTD_PARTITIONS */



More information about the U-Boot mailing list