int do_jffs2_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { struct part_info* jffs2_part_info(int); int jffs2_1pass_info(struct part_info *); struct part_info *part; char *fsname; int ret; if ((part=jffs2_part_info(part_num))){ /* check partition type for cramfs */ fsname = (cramfs_check(part) ? "CRAMFS" : "JFFS2"); printf("### filesystem type is %s\n", fsname); if (cramfs_check(part)) { ret = cramfs_info (part); } else { /* if this is not cramfs assume jffs2 */ ret = jffs2_1pass_info(part); } return (ret == 1); } puts ("Active partition not valid\n"); return 0; }
int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { struct part_info* jffs2_part_info(int); int jffs2_1pass_load(char *, struct part_info *,const char *); char *fsname; char *filename; int size; struct part_info *part; ulong offset = load_addr; /* pre-set Boot file name */ if ((filename = getenv("bootfile")) == NULL) { filename = "uImage"; } if (argc == 2) { filename = argv[1]; } if (argc == 3) { offset = simple_strtoul(argv[1], NULL, 16); load_addr = offset; filename = argv[2]; } if (0 != (part=jffs2_part_info(part_num))){ /* check partition type for cramfs */ fsname = (cramfs_check(part) ? "CRAMFS" : "JFFS2"); printf("### %s loading '%s' to 0x%lx\n", fsname, filename, offset); if (cramfs_check(part)) { size = cramfs_load ((char *) offset, part, filename); } else { /* if this is not cramfs assume jffs2 */ size = jffs2_1pass_load((char *)offset, part, filename); } if (size > 0) { char buf[10]; printf("### %s load complete: %d bytes loaded to 0x%lx\n", fsname, size, offset); sprintf(buf, "%x", size); setenv("filesize", buf); } else { printf("### %s LOAD ERROR<%x> for %s!\n", fsname, size, filename); } return !(size > 0); } puts ("Active partition not valid\n"); return 0; }
/** * Routine implementing u-boot ls command which lists content of a given * directory at location 'cramfsaddr'. * cramfsaddr is an evironment variable. * * @param cmdtp command internal data * @param flag command flag * @param argc number of arguments supplied to the command * @param argv arguments list * @return 0 on success, 1 otherwise */ int do_cramfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { char *filename = "/"; int ret; struct part_info part; struct mtd_device dev; struct mtdids id; ulong addr; addr = simple_strtoul(getenv("cramfsaddr"), NULL, 16); /* hack! */ /* cramfs_* only supports NOR flash chips */ /* fake the device type */ id.type = MTD_DEV_TYPE_NOR; id.num = 0; dev.id = &id; part.dev = &dev; /* fake the address offset */ part.offset = addr - flash_info[id.num].start[0]; if (argc == 2) filename = argv[1]; ret = 0; if (cramfs_check(&part)) ret = cramfs_ls (&part, filename); return ret ? 0 : 1; }
int do_jffs2_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { struct part_info* jffs2_part_info(int); int jffs2_1pass_ls(struct part_info *,char *); char *filename = "/"; int ret; struct part_info *part; if (argc == 2) filename = argv[1]; if (0 != (part=jffs2_part_info(part_num))){ /* check partition type for cramfs */ if (cramfs_check(part)) { ret = cramfs_ls (part, filename); } else { /* if this is not cramfs assume jffs2 */ ret = jffs2_1pass_ls(part, filename); } return (ret == 1); } puts ("Active partition not valid\n"); return 0; }
/** * Routine implementing u-boot ls command which lists content of a given * directory at location 'cramfsaddr'. * cramfsaddr is an evironment variable. * * @param cmdtp command internal data * @param flag command flag * @param argc number of arguments supplied to the command * @param argv arguments list * @return 0 on success, 1 otherwise */ int do_cramfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *filename = "/"; int ret; struct part_info part; struct mtd_device dev; struct mtdids id; ulong addr; addr = simple_strtoul(getenv("cramfsaddr"), NULL, 16); #ifdef CONFIG_OCTEON if (addr == 0) addr = getenv_ulong("loadaddr", 16, CONFIG_SYS_LOAD_ADDR); #endif /* hack! */ /* cramfs_* only supports NOR flash chips */ /* fake the device type */ id.type = MTD_DEV_TYPE_NOR; id.num = 0; dev.id = &id; part.dev = &dev; /* fake the address offset */ part.offset = addr - OFFSET_ADJUSTMENT; if (argc == 2) filename = argv[1]; ret = 0; if (cramfs_check(&part)) ret = cramfs_ls (&part, filename); return ret ? 0 : 1; }
/** * Routine implementing fsload u-boot command. This routine tries to load * a requested file from cramfs filesystem at location 'cramfsaddr'. * cramfsaddr is an evironment variable. * * @param cmdtp command internal data * @param flag command flag * @param argc number of arguments supplied to the command * @param argv arguments list * @return 0 on success, 1 otherwise */ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *filename; int size; ulong offset = load_addr; struct part_info part; struct mtd_device dev; struct mtdids id; ulong addr; #ifdef CONFIG_CMD_CRAMFS_ADDR addr = CONFIG_CMD_CRAMFS_ADDR; #else addr = simple_strtoul(getenv("cramfsaddr"), NULL, 16); #endif /* hack! */ /* cramfs_* only supports NOR flash chips */ /* fake the device type */ id.type = MTD_DEV_TYPE_NOR; id.num = 0; dev.id = &id; part.dev = &dev; /* fake the address offset */ part.offset = addr - OFFSET_ADJUSTMENT; /* pre-set Boot file name */ if ((filename = getenv("bootfile")) == NULL) { filename = "uImage"; } if (argc == 2) { filename = argv[1]; } if (argc == 3) { offset = simple_strtoul(argv[1], NULL, 0); load_addr = offset; filename = argv[2]; } size = 0; if (cramfs_check(&part)) size = cramfs_load ((char *) offset, &part, filename); if (size > 0) { char buf[10]; printf("### CRAMFS load complete: %d bytes loaded to 0x%lx\n", size, offset); sprintf(buf, "%x", size); setenv("filesize", buf); } else { printf("### CRAMFS LOAD ERROR<%x> for %s!\n", size, filename); } return !(size > 0); }