1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
#include <common.h>
#include <part.h>
//#include <config.h>
#include <command.h>
//#include <image.h>
//#include <linux/ctype.h>
//#include <asm/byteorder.h>
//#include <linux/stat.h>
//#include <malloc.h>
int do_mkfsfat_32(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
{
int dev=0;
int part=1;
block_dev_desc_t *dev_desc=NULL;
disk_partition_t info;
if (argc < 4) {
printf ("Usage:\n%s\n", cmdtp->help);
return(1);
}
dev = (int)simple_strtoul (argv[2], NULL, 16);
dev_desc=get_dev(argv[1],dev);
if (dev_desc == NULL) {
printf ("\n** Block device %s %d not supported\n", argv[1], dev);
return(1);
}
printf("Using device %s %d, \n", argv[1], dev);
part = (int)simple_strtoul (argv[3], NULL, 10);
if (part<=0) {
printf("Please input a partition number which is from 1 !\n");
return 1;
}
fatpre_register_device(dev_desc,part);
return format_fat32();
}
int do_mkfsfat_16(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
{
int dev=0;
int part=1;
block_dev_desc_t *dev_desc=NULL;
disk_partition_t info;
if (argc < 4) {
printf ("Usage:\n%s\n", cmdtp->help);
return(1);
}
dev = (int)simple_strtoul (argv[2], NULL, 16);
dev_desc=get_dev(argv[1],dev);
if (dev_desc == NULL) {
printf ("\n** Block device %s %d not supported\n", argv[1], dev);
return(1);
}
printf("Using device %s %d, \n", argv[1], dev);
part = (int)simple_strtoul (argv[3], NULL, 10);
if (part<=0) {
printf("Please input a partition number which is from 1 !\n");
return 1;
}
fatpre_register_device(dev_desc,part);
return format_fat16();
}
int do_mkfsfat_12(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
{
int dev=0;
int part=1;
block_dev_desc_t *dev_desc=NULL;
if (argc < 4) {
printf ("Usage:\n%s\n", cmdtp->help);
return(1);
}
dev = (int)simple_strtoul (argv[2], NULL, 16);
dev_desc=get_dev(argv[1],dev);
if (dev_desc == NULL) {
printf ("\n** Block device %s %d not supported\n", argv[1], dev);
return(1);
}
part = (int)simple_strtoul (argv[3], NULL, 10);
if (part<=0) {
printf("Please input a partition number which is from 1 !\n");
return 1;
}
fatpre_register_device(dev_desc,part);
return format_fat12();
}
U_BOOT_CMD(mkfsfat12, 4, 1, do_mkfsfat_12,
"format a partition in the storage device to FAT12",
"<interface> <device number> <partition number>\n"
" - format a primary partition in the storage device to FAT12");
U_BOOT_CMD(mkfsfat16, 4, 1, do_mkfsfat_16,
"format a partition in the storage device to FAT16",
"<interface> <device number> <partition number>\n"
" - format a primary partition in the storage device to FAT16");
U_BOOT_CMD(mkfsfat32, 4, 1, do_mkfsfat_32,
"format a partition in the storage device to FAT32",
"<interface> <device number> <partition number>\n"
" - format a primary partition in the storage device to FAT32");
|