summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorStefano Babic <sbabic@denx.de>2013-09-13 12:04:54 +0200
committerStefano Babic <sbabic@denx.de>2013-09-13 12:10:07 +0200
commitc4a7ece02046f647019cc0aaddf530833a8db29c (patch)
tree06342cd9b8cc41b95442a992fb38a1bc8671b05c /tools
parentb5e7f1bc4b899ea34e838d5d60b3e6f8e479d0a9 (diff)
parent8386ca8bea7a6a8469c3b6a99313afb642e6cbeb (diff)
downloadblackbird-obmc-uboot-c4a7ece02046f647019cc0aaddf530833a8db29c.tar.gz
blackbird-obmc-uboot-c4a7ece02046f647019cc0aaddf530833a8db29c.zip
Merge branch 'master' of git://git.denx.de/u-boot-arm
Conflicts: MAINTAINERS boards.cfg Signed-off-by: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile3
-rw-r--r--tools/buildman/board.py2
-rw-r--r--tools/env/fw_env.c73
-rwxr-xr-xtools/reformat.py132
4 files changed, 180 insertions, 30 deletions
diff --git a/tools/Makefile b/tools/Makefile
index 0a29147847..c36cde2007 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -52,7 +52,7 @@ BIN_FILES-$(CONFIG_CMD_LOADS) += img2srec$(SFX)
BIN_FILES-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes$(SFX)
BIN_FILES-y += mkenvimage$(SFX)
BIN_FILES-y += mkimage$(SFX)
-BIN_FILES-$(CONFIG_SMDK5250) += mksmdk5250spl$(SFX)
+BIN_FILES-$(CONFIG_EXYNOS5250) += mk$(BOARD)spl$(SFX)
BIN_FILES-$(CONFIG_MX23) += mxsboot$(SFX)
BIN_FILES-$(CONFIG_MX28) += mxsboot$(SFX)
BIN_FILES-$(CONFIG_NETCONSOLE) += ncb$(SFX)
@@ -87,6 +87,7 @@ NOPED_OBJ_FILES-y += ublimage.o
OBJ_FILES-$(CONFIG_BUILD_ENVCRC) += envcrc.o
OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o
+OBJ_FILES-$(CONFIG_EXYNOS5250) += mkexynosspl.o
OBJ_FILES-$(CONFIG_KIRKWOOD) += kwboot.o
OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o
OBJ_FILES-$(CONFIG_MX23) += mxsboot.o
diff --git a/tools/buildman/board.py b/tools/buildman/board.py
index cc7b5d011f..a388896417 100644
--- a/tools/buildman/board.py
+++ b/tools/buildman/board.py
@@ -63,7 +63,7 @@ class Boards:
for upto in range(len(fields)):
if fields[upto] == '-':
fields[upto] = ''
- while len(fields) < 7:
+ while len(fields) < 9:
fields.append('')
board = Board(*fields)
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 44607b164a..577ce2de47 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -727,27 +727,39 @@ static int flash_write_buf (int dev, int fd, void *buf, size_t count,
MEMGETBADBLOCK needs 64 bits */
int rc;
- blocklen = DEVESIZE (dev);
+ /*
+ * For mtd devices only offset and size of the environment do matter
+ */
+ if (mtd_type == MTD_ABSENT) {
+ blocklen = count;
+ top_of_range = offset + count;
+ erase_len = blocklen;
+ blockstart = offset;
+ block_seek = 0;
+ write_total = blocklen;
+ } else {
+ blocklen = DEVESIZE(dev);
- top_of_range = ((DEVOFFSET(dev) / blocklen) +
- ENVSECTORS (dev)) * blocklen;
+ top_of_range = ((DEVOFFSET(dev) / blocklen) +
+ ENVSECTORS(dev)) * blocklen;
- erase_offset = (offset / blocklen) * blocklen;
+ erase_offset = (offset / blocklen) * blocklen;
- /* Maximum area we may use */
- erase_len = top_of_range - erase_offset;
+ /* Maximum area we may use */
+ erase_len = top_of_range - erase_offset;
- blockstart = erase_offset;
- /* Offset inside a block */
- block_seek = offset - erase_offset;
+ blockstart = erase_offset;
+ /* Offset inside a block */
+ block_seek = offset - erase_offset;
- /*
- * Data size we actually have to write: from the start of the block
- * to the start of the data, then count bytes of data, and to the
- * end of the block
- */
- write_total = ((block_seek + count + blocklen - 1) /
- blocklen) * blocklen;
+ /*
+ * Data size we actually write: from the start of the block
+ * to the start of the data, then count bytes of data, and
+ * to the end of the block
+ */
+ write_total = ((block_seek + count + blocklen - 1) /
+ blocklen) * blocklen;
+ }
/*
* Support data anywhere within erase sectors: read out the complete
@@ -818,17 +830,18 @@ static int flash_write_buf (int dev, int fd, void *buf, size_t count,
continue;
}
- erase.start = blockstart;
- ioctl (fd, MEMUNLOCK, &erase);
- /* These do not need an explicit erase cycle */
- if (mtd_type != MTD_ABSENT &&
- mtd_type != MTD_DATAFLASH)
- if (ioctl (fd, MEMERASE, &erase) != 0) {
- fprintf (stderr, "MTD erase error on %s: %s\n",
- DEVNAME (dev),
- strerror (errno));
- return -1;
- }
+ if (mtd_type != MTD_ABSENT) {
+ erase.start = blockstart;
+ ioctl(fd, MEMUNLOCK, &erase);
+ /* These do not need an explicit erase cycle */
+ if (mtd_type != MTD_DATAFLASH)
+ if (ioctl(fd, MEMERASE, &erase) != 0) {
+ fprintf(stderr,
+ "MTD erase error on %s: %s\n",
+ DEVNAME(dev), strerror(errno));
+ return -1;
+ }
+ }
if (lseek (fd, blockstart, SEEK_SET) == -1) {
fprintf (stderr,
@@ -847,7 +860,8 @@ static int flash_write_buf (int dev, int fd, void *buf, size_t count,
return -1;
}
- ioctl (fd, MEMLOCK, &erase);
+ if (mtd_type != MTD_ABSENT)
+ ioctl(fd, MEMLOCK, &erase);
processed += blocklen;
block_seek = 0;
@@ -1136,6 +1150,9 @@ int fw_env_open(void)
} else if (DEVTYPE(dev_current) == MTD_UBIVOLUME &&
DEVTYPE(!dev_current) == MTD_UBIVOLUME) {
environment.flag_scheme = FLAG_INCREMENTAL;
+ } else if (DEVTYPE(dev_current) == MTD_ABSENT &&
+ DEVTYPE(!dev_current) == MTD_ABSENT) {
+ environment.flag_scheme = FLAG_INCREMENTAL;
} else {
fprintf (stderr, "Incompatible flash types!\n");
return -1;
diff --git a/tools/reformat.py b/tools/reformat.py
new file mode 100755
index 0000000000..7e038905c2
--- /dev/null
+++ b/tools/reformat.py
@@ -0,0 +1,132 @@
+#! /usr/bin/python
+########################################################################
+#
+# reorder and reformat a file in columns
+#
+# this utility takes lines from its standard input and reproduces them,
+# partially reordered and reformatted, on its standard output.
+#
+# It has the same effect as a 'sort | column -t', with the exception
+# that empty lines, as well as lines which start with a '#' sign, are
+# not affected, i.e. they keep their position and formatting, and act
+# as separators, i.e. the parts before and after them are each sorted
+# separately (but overall field widths are computed across the whole
+# input).
+#
+# Options:
+# -i:
+# --ignore-case:
+# Do not consider case when sorting.
+# -d:
+# --default:
+# What to chage empty fields to.
+# -s <N>:
+# --split=<N>:
+# Treat only the first N whitespace sequences as separators.
+# line content after the Nth separator will count as only one
+# field even if it contains whitespace.
+# Example : '-s 2' causes input 'a b c d e' to be split into
+# three fields, 'a', 'b', and 'c d e'.
+#
+# boards.cfg requires -ids 6.
+#
+########################################################################
+
+import sys, getopt, locale
+
+# ensure we sort using the C locale.
+
+locale.setlocale(locale.LC_ALL, 'C')
+
+# check options
+
+maxsplit = 0
+ignore_case = 0
+default_field =''
+
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "id:s:",
+ ["ignore-case","default","split="])
+except getopt.GetoptError as err:
+ print str(err) # will print something like "option -a not recognized"
+ sys.exit(2)
+
+for o, a in opts:
+ if o in ("-s", "--split"):
+ maxsplit = eval(a)
+ elif o in ("-i", "--ignore-case"):
+ ignore_case = 1
+ elif o in ("-d", "--default"):
+ default_field = a
+ else:
+ assert False, "unhandled option"
+
+# collect all lines from standard input and, for the ones which must be
+# reformatted and sorted, count their fields and compute each field's
+# maximum size
+
+input_lines = []
+field_width = []
+
+for line in sys.stdin:
+ # remove final end of line
+ input_line = line.strip('\n')
+ if (len(input_line)>0) and (input_line[0] != '#'):
+ # sortable line: split into fields
+ fields = input_line.split(None,maxsplit)
+ # if there are new fields, top up field_widths
+ for f in range(len(field_width), len(fields)):
+ field_width.append(0)
+ # compute the maximum witdh of each field
+ for f in range(len(fields)):
+ field_width[f] = max(field_width[f],len(fields[f]))
+ # collect the line for next stage
+ input_lines.append(input_line)
+
+# run through collected input lines, collect the ones which must be
+# reformatted and sorted, and whenever a non-reformattable, non-sortable
+# line is met, sort the collected lines before it and append them to the
+# output lines, then add the non-sortable line too.
+
+output_lines = []
+sortable_lines = []
+for input_line in input_lines:
+ if (len(input_line)>0) and (input_line[0] != '#'):
+ # this line should be reformatted and sorted
+ input_fields = input_line.split(None,maxsplit)
+ output_fields = [];
+ # reformat each field to this field's column width
+ for f in range(len(input_fields)):
+ output_field = input_fields[f];
+ output_fields.append(output_field.ljust(field_width[f]))
+ # any missing field is set to default if it exists
+ if default_field != '':
+ for f in range(len(input_fields),len(field_width)):
+ output_fields.append(default_field.ljust(field_width[f]))
+ # join fields using two spaces, like column -t would
+ output_line = ' '.join(output_fields);
+ # collect line for later
+ sortable_lines.append(output_line)
+ else:
+ # this line is non-sortable
+ # sort collected sortable lines
+ if ignore_case!=0:
+ sortable_lines.sort(key=lambda x: str.lower(locale.strxfrm(x)))
+ else:
+ sortable_lines.sort(key=lambda x: locale.strxfrm(x))
+ # append sortable lines to the final output
+ output_lines.extend(sortable_lines)
+ sortable_lines = []
+ # append non-sortable line to the final output
+ output_lines.append(input_line)
+# maybe we had sortable lines pending, so append them to the final output
+if ignore_case!=0:
+ sortable_lines.sort(key=lambda x: str.lower(locale.strxfrm(x)))
+else:
+ sortable_lines.sort(key=lambda x: locale.strxfrm(x))
+output_lines.extend(sortable_lines)
+
+# run through output lines and print them, except rightmost whitespace
+
+for output_line in output_lines:
+ print output_line.rstrip()
OpenPOWER on IntegriCloud