X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=cmd%2Fjffs2.c;h=b47cd3d98930a4a80ee4fbdc55d4afaad036c795;hb=4dd520b36bce9b35f7a12f3ffd9a95269d425170;hp=f00d53a6c8331f80e18633f882e8722369bef10d;hpb=dc557e9a1fe00ca9d884bd88feef5bebf23fede4;p=oweals%2Fu-boot.git diff --git a/cmd/jffs2.c b/cmd/jffs2.c index f00d53a6c8..b47cd3d989 100644 --- a/cmd/jffs2.c +++ b/cmd/jffs2.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2002 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. @@ -17,8 +18,6 @@ * * $Id: cmdlinepart.c,v 1.17 2004/11/26 11:18:47 lavinen Exp $ * Copyright 2002 SYSGO Real-Time Solutions GmbH - * - * SPDX-License-Identifier: GPL-2.0+ */ /* @@ -73,6 +72,7 @@ */ #include #include +#include #include #include #include @@ -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); } @@ -606,7 +607,7 @@ U_BOOT_CMD( " with offset 'off'" ); U_BOOT_CMD( - ls, 2, 1, do_jffs2_ls, + fsls, 2, 1, do_jffs2_ls, "list files in a directory (default /)", "[ directory ]" );