tools: env: introduce setenv/printenv argument structs
[platform/kernel/u-boot.git] / tools / env / fw_env.h
1 /*
2  * (C) Copyright 2002-2008
3  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4  *
5  * SPDX-License-Identifier:     GPL-2.0+
6  */
7
8 /* Pull in the current config to define the default environment */
9 #include <linux/kconfig.h>
10
11 #ifndef __ASSEMBLY__
12 #define __ASSEMBLY__ /* get only #defines from config.h */
13 #include <config.h>
14 #undef  __ASSEMBLY__
15 #else
16 #include <config.h>
17 #endif
18
19 /*
20  * To build the utility with the static configuration
21  * comment out the next line.
22  * See included "fw_env.config" sample file
23  * for notes on configuration.
24  */
25 #define CONFIG_FILE     "/etc/fw_env.config"
26
27 #ifndef CONFIG_FILE
28 #define HAVE_REDUND /* For systems with 2 env sectors */
29 #define DEVICE1_NAME      "/dev/mtd1"
30 #define DEVICE2_NAME      "/dev/mtd2"
31 #define DEVICE1_OFFSET    0x0000
32 #define ENV1_SIZE         0x4000
33 #define DEVICE1_ESIZE     0x4000
34 #define DEVICE1_ENVSECTORS     2
35 #define DEVICE2_OFFSET    0x0000
36 #define ENV2_SIZE         0x4000
37 #define DEVICE2_ESIZE     0x4000
38 #define DEVICE2_ENVSECTORS     2
39 #endif
40
41 #ifndef CONFIG_BAUDRATE
42 #define CONFIG_BAUDRATE         115200
43 #endif
44
45 #ifndef CONFIG_BOOTDELAY
46 #define CONFIG_BOOTDELAY        5       /* autoboot after 5 seconds     */
47 #endif
48
49 #ifndef CONFIG_BOOTCOMMAND
50 #define CONFIG_BOOTCOMMAND                                                      \
51         "bootp; "                                                               \
52         "setenv bootargs root=/dev/nfs nfsroot=${serverip}:${rootpath} "        \
53         "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; "   \
54         "bootm"
55 #endif
56
57 struct printenv_args {
58 };
59 extern struct printenv_args printenv_args;
60
61 struct setenv_args {
62         char *script_file;
63 };
64 extern struct setenv_args setenv_args;
65
66 extern int   fw_printenv(int argc, char *argv[]);
67 extern char *fw_getenv  (char *name);
68 extern int fw_setenv  (int argc, char *argv[]);
69 extern int fw_parse_script(char *fname);
70 extern int fw_env_open(void);
71 extern int fw_env_write(char *name, char *value);
72 extern int fw_env_close(void);
73
74 extern unsigned long  crc32      (unsigned long, const unsigned char *, unsigned);