1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2011 - 2012 Samsung Electronics
4 * EXT4 filesystem implementation in Uboot by
5 * Uma Shankar <uma.shankar@samsung.com>
6 * Manjunatha C Achar <a.manjunatha@samsung.com>
9 * made from existing cmd_ext2.c file of Uboot
12 * esd gmbh <www.esd-electronics.com>
13 * Reinhard Arlt <reinhard.arlt@esd-electronics.com>
15 * made from cmd_reiserfs by
17 * (C) Copyright 2003 - 2004
18 * Sysgo Real-Time Solutions, AG <www.elinos.com>
19 * Pavel Bartusek <pba@sysgo.com>
24 * 0.1 - Newly created file for ext4fs support. Taken from cmd_ext2.c
25 * file in uboot. Added ext4fs ls load and write support.
33 #include <linux/ctype.h>
34 #include <asm/byteorder.h>
36 #include <linux/stat.h>
40 #if defined(CONFIG_CMD_USB) && defined(CONFIG_USB_STORAGE)
44 int do_ext4_size(cmd_tbl_t *cmdtp, int flag, int argc,
47 return do_size(cmdtp, flag, argc, argv, FS_TYPE_EXT);
50 int do_ext4_load(cmd_tbl_t *cmdtp, int flag, int argc,
53 return do_load(cmdtp, flag, argc, argv, FS_TYPE_EXT);
56 int do_ext4_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
58 return do_ls(cmdtp, flag, argc, argv, FS_TYPE_EXT);
61 #if defined(CONFIG_CMD_EXT4_WRITE)
62 int do_ext4_write(cmd_tbl_t *cmdtp, int flag, int argc,
65 return do_save(cmdtp, flag, argc, argv, FS_TYPE_EXT);
68 U_BOOT_CMD(ext4write, 7, 1, do_ext4_write,
69 "create a file in the root directory",
70 "<interface> <dev[:part]> <addr> <absolute filename path>\n"
71 " [sizebytes] [file offset]\n"
72 " - create a file in / directory");
77 ext4size, 4, 0, do_ext4_size,
78 "determine a file's size",
79 "<interface> <dev[:part]> <filename>\n"
80 " - Find file 'filename' from 'dev' on 'interface'\n"
81 " and determine its size."
84 U_BOOT_CMD(ext4ls, 4, 1, do_ext4_ls,
85 "list files in a directory (default /)",
86 "<interface> <dev[:part]> [directory]\n"
87 " - list files from 'dev' on 'interface' in a 'directory'");
89 U_BOOT_CMD(ext4load, 7, 0, do_ext4_load,
90 "load binary file from a Ext4 filesystem",
91 "<interface> [<dev[:part]> [addr [filename [bytes [pos]]]]]\n"
92 " - load binary file 'filename' from 'dev' on 'interface'\n"
93 " to address 'addr' from ext4 filesystem");