X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=cmd%2Fjffs2.c;h=13c533cf12992bc2532f90b668806a614ed19e7d;hb=335f7b1290ce24a729a9689a1db834c743226ca8;hp=9be198eddce44b638f76477308860bbabf012ec4;hpb=821560fd8e43eecc208c1c52ad24faadb6b52703;p=u-boot diff --git a/cmd/jffs2.c b/cmd/jffs2.c index 9be198eddc..13c533cf12 100644 --- a/cmd/jffs2.c +++ b/cmd/jffs2.c @@ -80,7 +80,7 @@ #include #if defined(CONFIG_CMD_NAND) -#include +#include #include #endif @@ -166,8 +166,9 @@ static int mtd_device_validate(u8 type, u8 num, u32 *size) #endif } else if (type == MTD_DEV_TYPE_NAND) { #if defined(CONFIG_JFFS2_NAND) && defined(CONFIG_CMD_NAND) - if (num < CONFIG_SYS_MAX_NAND_DEVICE) { - *size = nand_info[num]->size; + struct mtd_info *mtd = get_nand_dev_by_index(num); + if (mtd) { + *size = mtd->size; return 0; } @@ -244,7 +245,7 @@ static inline u32 get_part_sector_size_nand(struct mtdids *id) #if defined(CONFIG_JFFS2_NAND) && defined(CONFIG_CMD_NAND) struct mtd_info *mtd; - mtd = nand_info[id->num]; + mtd = get_nand_dev_by_index(id->num); return mtd->erasesize; #else @@ -478,9 +479,9 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ulong offset = load_addr; /* pre-set Boot file name */ - if ((filename = getenv("bootfile")) == NULL) { + filename = env_get("bootfile"); + if (!filename) filename = "uImage"; - } if (argc == 2) { filename = argv[1]; @@ -511,7 +512,7 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (size > 0) { printf("### %s load complete: %d bytes loaded to 0x%lx\n", fsname, size, offset); - setenv_hex("filesize", size); + env_set_hex("filesize", size); } else { printf("### %s LOAD ERROR<%x> for %s!\n", fsname, size, filename); }