summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <klto@zhaw.ch>2009-12-14 17:50:35 +0100
committerTobias Klauser <klto@zhaw.ch>2009-12-14 17:50:35 +0100
commit64b810b41989876099b3c461b3ac91d4b3813d9d (patch)
tree76c34d5fffd784af3e5218c98608665eb119d8a5
parentbc22fb970ec9f3725e5d46d467798897610354e4 (diff)
Add README and example directory, correct usage
-rw-r--r--README45
-rw-r--r--example/uboot_env.binbin0 -> 247 bytes
-rw-r--r--example/uboot_env.env10
-rw-r--r--mkubootenv.c2
4 files changed, 56 insertions, 1 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..e63eba3
--- /dev/null
+++ b/README
@@ -0,0 +1,45 @@
+mkubootenv
+==========
+
+Create an U-Boot environmet image suitable for flashing. The input is a text
+file containing environment variable definitions in the format “name=value”,
+separeated by newlines.
+
+Usage
+-----
+
+usage: mkubootenv [-s <size>] <source file> <target file>
+
+Options:
+ -s <size> set size of the target image file to <size> bytes. If <size> is
+ bigger than the source file, the target image gets padded with
+ null bytes. If <size> is smaller than the source file, an error is
+ emitted.
+ -r reverse operation: get plaintext env file (target) from binary
+ image file (source)
+
+File formats
+------------
+
+The U-Boot environment is stored in a simple file format, described in
+include/environment.h of the U-Boot source tree as follows:
+
+/**************************************************************************
+ *
+ * The "environment" is stored as a list of '\0' terminated
+ * "name=value" strings. The end of the list is marked by a double
+ * '\0'. New entries are always added at the end. Deleting an entry
+ * shifts the remaining entries to the front. Replacing an entry is a
+ * combination of deleting the old value and adding the new one.
+ *
+ * The environment is preceeded by a 32 bit CRC over the data part.
+ *
+ **************************************************************************
+ */
+
+The input file format for mkubootenv is a simple text file containing
+'name=value' pairs, separated by newlines ('\n'). This means, there are _no
+newlines allowed_ inside the variable names or values.
+
+See the example/ directory for an example input file (uboot_env.env) and its
+corresponding output file (uboot_env.bin).
diff --git a/example/uboot_env.bin b/example/uboot_env.bin
new file mode 100644
index 0000000..9c4138c
--- /dev/null
+++ b/example/uboot_env.bin
Binary files differ
diff --git a/example/uboot_env.env b/example/uboot_env.env
new file mode 100644
index 0000000..35330e8
--- /dev/null
+++ b/example/uboot_env.env
@@ -0,0 +1,10 @@
+baudrate=115200
+kernel_addr=4050000
+bootcmd=run flash_ram
+ramargs=setenv bootargs root=/dev/ram rw panic=1
+bootdelay=3
+flash_ram=run set_mac;run ramargs;bootm ${kernel_addr}
+stdin=serial
+stdout=serial
+stderr=serial
+ethaddr=00:15:12:00:20:01
diff --git a/mkubootenv.c b/mkubootenv.c
index 8a1b10c..8e49cbb 100644
--- a/mkubootenv.c
+++ b/mkubootenv.c
@@ -205,7 +205,7 @@ static void uboot_img_to_env(struct file *s, struct file *t)
static void usage_and_exit(int status)
{
- printf("usage: mkenv [-s <size>] <source file> <target file>\n"
+ printf("usage: mkubootenv [-s <size>] <source file> <target file>\n"
" -s <size> set size of the target image file to <size> bytes. If <size> is\n"
" bigger than the source file, the target image gets padded with null\n"
" bytes. If <size> is smaller than the source file, an error is emitted.\n"