U-Boot v2009.08 & JFFS2 (NOR)
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: fc000000end_phys: fbffffffpart->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:
=> lsstart_phys: fe020000end_phys: ffefffffpart->size: 1edffff
size: 131072
Scanning JFFS2 FS: . add_node: malloc failedadd_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?
Thanks,
Tommy
Quoted 65 lines · Tommy Wang
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
0xFC000000and0xFE000000. The (single) JFFS2 partition is located at0xFE020000to0xFFEFFFFF.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_BANK1
#defineCFG_JFFS2_FIRST_SECTOR1
#defineCFG_JFFS2_NUM_BANKS1In v2009.08, I have tried:
#define
CONFIG_SYS_JFFS2_FIRST_BANK1
#defineCONFIG_SYS_JFFS2_FIRST_SECTOR1
#defineCONFIG_SYS_JFFS2_NUM_BANKS1My debug output shows me:
start_phys:fc000000end_phys: fbffffffpart->size: ffffffffLooking 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"
#defineCONFIG_JFFS2_PART_SIZE0x01edffff
#defineCONFIG_JFFS2_PART_OFFSET0x00020000
#defineCONFGI_SYS_JFFS2_SORT_FRAGMENTSThis gives me the correct start and end address, but it still does not recognize the JFFS2 partition:
=> ls
start_phys:fe020000end_phys: ffefffffpart->size: 1edffff
size: 131072
Scanning JFFS2 FS: .add_node: malloc failedadd_nodefailed!
ls: Failed to scan JFFSv2 file structureNext, I tried setting up the mtd partitions:
#define
CONFIG_CMD_MTDPARTS
#defineCONFIG_MTD_DEVICE
#defineCONFIG_FLASH_CFI_MTD
#defineMTDIDS_DEFAULT"nor1=primary"
#defineMTDPARTS_DEFAULT"mtdparts=primary:31616k at 128k(mypart)" #defineCONFIG_EXTRA_ENV_SETTINGS\
"mtdids=nor1=primary \0" \
"mtdparts="MK_STR(MTDPARTS_DEFAULT)"\0"
Quoted 3 lines
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:
Quoted 53 lines
#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 */
#defineCONFIG_SYS_USE_UBI/* Use UBI */#endif /*
CONFIG_SYS_USE_UBIFS*/#ifdef
CONFIG_SYS_USE_UBI#ifdef
CONFIG_SYS_MALLOC_LEN
#undefCONFIG_SYS_MALLOC_LEN
#endif
#defineCONFIG_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
#ifndefCONFIG_MTD_PARTITIONS
#defineCONFIG_MTD_PARTITIONS/* Support MTD partitions */
#defineCONFIG_MTD_DEVICE/* Support MTD devices */
#endif /*CONFIG_MTD_PARTITIONS*/
#endif /*CONFIG_CMD_JFFS2*/#ifdef
CONFIG_MTD_PARTITIONS/* MTD partition support */
#defineCONFIG_FLASH_CFI_MTD/* Export CFI flash to the MTD layer */
#defineCONFIG_CMD_MTDPARTS/* Turn on the "chpart" and "mtdparts" commands *//* Default MTD partition table */
#defineMTDIDS_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*/