Re: [PATCH 0/3] MIPS Malta serial port fixups
On Mon, 16 Feb 2015 06:32:42 +0100 Sascha Hauer wrote: > Hi Antony, > > On Fri, Feb 13, 2015 at 08:53:11AM +0300, Antony Pavlov wrote: > > Yesterday I tested qemu-malta barebox on a real MIPS Malta board. > > Barebox runs on real board with some limitations. > > This patchseries fixes trivial serial port errors > > found during barebox real board experiments. > > Applied all, thanks. > > Do you plan to add real hardware support? It depends on aviability of real hardware and my free time. Just now I can work with this Malta board remotly from time to time. YAMON-02.22 sources are available at official MIPS site, so some information on system controller can be obtained there. Full YAMON replacement may be difficult but I think I can try to add PCI support on real hardware. -- Best regards, Antony Pavlov ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH RFT 17/24] net: orion-gbe: convert to streaming DMA ops
On 12.02.2015 23:40, Sebastian Hesselbarth wrote: I really enjoy reading commit logs, but I cannot find any on this one. ;) Mind adding a few words for the final patch set? I'll give it a go on Dove and Kirkwood in the next few days, but be aware that there is still no cache support on both anyway. As expected, the patches do no harm to the driver due to the missing cache support for MVEBU. Tested-by: Sebastian Hesselbarth on SolidRun CuBox (Dove). Thanks! ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH] defaultenv-2: init: don't call timeout again if the user intervened
With autoboot_timeout=0 the second 'timeout' might not get another character even if the user keeps a key pressed. So just reuse the key from the first call. Signed-off-by: Michael Olbrich --- defaultenv/defaultenv-2-base/bin/init | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/defaultenv/defaultenv-2-base/bin/init b/defaultenv/defaultenv-2-base/bin/init index 34807bcf585d..30651e55d277 100644 --- a/defaultenv/defaultenv-2-base/bin/init +++ b/defaultenv/defaultenv-2-base/bin/init @@ -37,6 +37,7 @@ fi # allow to stop the boot before execute the /env/init/* # but without waiting timeout -s -a -v key 0 +autoboot="$?" if [ "${key}" = "q" ]; then ${login_cmd} @@ -57,8 +58,10 @@ fi [ -n ${login_cmd} ] && global.console.input_allow=1 -timeout -a $global.autoboot_timeout -v key -autoboot="$?" +if [ "$autoboot" = 0 ]; then + timeout -a $global.autoboot_timeout -v key + autoboot="$?" +fi [ -n ${login_cmd} ] && global.console.input_allow=0 -- 2.1.4 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH] commands/digest: add verify support
From: Hubert Feurstein Signed-off-by: Hubert Feurstein [EB]: reworked based on Sascha's comments and tested with md5sum Signed-off-by: Eric Bénard --- commands/digest.c | 120 +- 1 file changed, 110 insertions(+), 10 deletions(-) diff --git a/commands/digest.c b/commands/digest.c index 092fda2..2a982e5 100644 --- a/commands/digest.c +++ b/commands/digest.c @@ -23,26 +23,99 @@ #include #include #include +#include #include #include +#include +#include + +static inline unsigned char parse_hexchar(char c) +{ + if (!isxdigit(c)) + return 0; + + return isdigit(c) ? (c - '0') : ((islower(c) ? toupper(c) : c) - 'A' + 0xA); +} + +static inline unsigned char parse_hexbyte(const char *p) +{ + return (parse_hexchar(*p) << 4) | parse_hexchar(*(p + 1)); +} + +static unsigned char *parse_hash(int hash_len, const char *hexstr) +{ + int i; + unsigned char *p; + + p = calloc(hash_len, sizeof(unsigned char)); + if (!p) { + perror("calloc"); + return NULL; + } + + for (i = 0; i < hash_len; i++) + p[i] = parse_hexbyte(&hexstr[i * 2]); + + return p; +} static int do_digest(char *algorithm, int argc, char *argv[]) { struct digest *d; int ret = 0; int i; - unsigned char *hash; + unsigned char *hash = NULL; + int opt; + unsigned char *verify_hash = NULL; + int verify = 0; + int min_argc = 2; + int len = 0; + ssize_t bufsz; d = digest_get_by_name(algorithm); BUG_ON(!d); - if (argc < 2) - return COMMAND_ERROR_USAGE; + while ((opt = getopt(argc, argv, "v:V:")) > 0) { + switch (opt) { + case 'v': + verify++; + free(verify_hash); + hash = xstrdup(optarg); + len = strlen(hash); + break; + case 'V': + verify++; + free(verify_hash); + hash = read_file(optarg, &bufsz); + len = bufsz; + break; + default: + ret = COMMAND_ERROR_USAGE; + goto out; + } + + if (verify == 1 && (d->length * 2) <= len && hash != NULL) { + min_argc += 2; + verify_hash = parse_hash(d->length, hash); + if (!verify_hash) + return -ENOMEM; + free(hash); + } else + return COMMAND_ERROR_USAGE; + } + + if (argc < min_argc) { + ret = COMMAND_ERROR_USAGE; + goto out; + } + + argv += min_argc - 2; hash = calloc(d->length, sizeof(unsigned char)); if (!hash) { perror("calloc"); - return COMMAND_ERROR_USAGE; + ret = -ENOMEM; + goto out; } argv++; @@ -60,17 +133,32 @@ static int do_digest(char *algorithm, int argc, char *argv[]) if (digest_file_window(d, filename, hash, start, size) < 0) { ret = 1; } else { - for (i = 0; i < d->length; i++) + for (i = 0; i < d->length; i++) { printf("%02x", hash[i]); + if (verify > 0 && hash[i] != verify_hash[i]) + verify = -1; + } - printf(" %s\t0x%08llx ... 0x%08llx\n", + printf(" %s\t0x%08llx ... 0x%08llx", filename, start, start + size); + + if (verify < 0) { + printf(" ** ERROR ** "); + ret = 1; + } + + printf("\n"); + + if (verify) + break; } argv++; } +out: free(hash); + free(verify_hash); return ret; } @@ -84,12 +172,15 @@ static int do_md5(int argc, char *argv[]) BAREBOX_CMD_HELP_START(md5sum) BAREBOX_CMD_HELP_TEXT("Calculate a MD5 digest over a FILE or a memory area.") +BAREBOX_CMD_HELP_TEXT("Options:") +BAREBOX_CMD_HELP_OPT ("-v hash", "verify") +BAREBOX_CMD_HELP_OPT ("-V hash-file", "verify hash file") BAREBOX_CMD_HELP_END BAREBOX_CMD_START(md5sum) .cmd= do_md5, BAREBOX_CMD_DESC("calculate MD5 checksum") - BAREBOX_CMD_OPTS("FILE|AREA...") + BAREBOX_CMD_OPTS("[-vV] FILE|AREA...") BAREBOX_CMD_GROUP(CMD_GRP_FILE) BAREBOX_CMD_HELP(cmd_md5sum_help) BAREBOX_CMD_END @@ -105,12 +196,15 @@ static
[PATCH] common/bootargs: add blkdevparts variables
From: Hubert Feurstein The kernel command line option blkdevparts works like mtdparts, but for all block devices. So it can be used for eMMC devices without the need of a traditional partition table. Signed-off-by: Hubert Feurstein --- common/bootargs.c | 24 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/common/bootargs.c b/common/bootargs.c index 6624f72..803736f 100644 --- a/common/bootargs.c +++ b/common/bootargs.c @@ -38,7 +38,7 @@ static int linux_bootargs_overwritten; */ const char *linux_bootargs_get(void) { - char *bootargs, *mtdparts; + char *bootargs, *parts; if (linux_bootargs_overwritten) return linux_bootargs; @@ -49,14 +49,21 @@ const char *linux_bootargs_get(void) if (!strlen(bootargs)) return getenv("bootargs"); - mtdparts = globalvar_get_match("linux.mtdparts.", ";"); + linux_bootargs = bootargs; - if (strlen(mtdparts)) { - linux_bootargs = asprintf("%s mtdparts=%s", bootargs, mtdparts); - free(bootargs); - free(mtdparts); - } else { - free(mtdparts); + parts = globalvar_get_match("linux.mtdparts.", ";"); + if (strlen(parts)) { + bootargs = asprintf("%s mtdparts=%s", linux_bootargs, parts); + free(linux_bootargs); + free(parts); + linux_bootargs = bootargs; + } + + parts = globalvar_get_match("linux.blkdevparts.", ";"); + if (strlen(parts)) { + bootargs = asprintf("%s blkdevparts=%s", linux_bootargs, parts); + free(linux_bootargs); + free(parts); linux_bootargs = bootargs; } @@ -78,3 +85,4 @@ int linux_bootargs_overwrite(const char *bootargs) BAREBOX_MAGICVAR_NAMED(global_linux_bootargs_, global.linux.bootargs.*, "Linux bootargs variables"); BAREBOX_MAGICVAR_NAMED(global_linux_mtdparts_, global.linux.mtdparts.*, "Linux mtdparts variables"); +BAREBOX_MAGICVAR_NAMED(global_linux_blkdevparts_, global.linux.blkdevparts.*, "Linux blkdevparts variables"); -- 2.3.0 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH] led: gpio: add support for default-state dt-property
From: Hubert Feurstein This patch adds support for the default-state device tree property. Signed-off-by: Hubert Feurstein --- drivers/led/led-gpio.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/led/led-gpio.c b/drivers/led/led-gpio.c index a1a6617..69ad7e7 100644 --- a/drivers/led/led-gpio.c +++ b/drivers/led/led-gpio.c @@ -204,6 +204,7 @@ static int led_gpio_of_probe(struct device_d *dev) for_each_child_of_node(dev->device_node, child) { struct gpio_led *gled; + const char *default_state; enum of_gpio_flags flags; int gpio; const char *label; @@ -225,6 +226,18 @@ static int led_gpio_of_probe(struct device_d *dev) led_gpio_register(gled); led_of_parse_trigger(&gled->led, child); + + if (!of_property_read_string(child, "default-state", &default_state)) { + int state = -1; + + if (!strcmp(default_state, "on")) + state = 1; + else if (!strcmp(default_state, "off")) + state = 0; + + if (state >= 0) + led_gpio_set(&gled->led, state ^ gled->active_low); + } } return 0; -- 2.3.0 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH] commands/digest: add verify support
Hi Hubert, On Mon, Feb 16, 2015 at 02:02:35PM +0100, h.feurst...@gmail.com wrote: > From: Hubert Feurstein > > Signed-off-by: Hubert Feurstein > [EB]: reworked based on Sascha's comments and tested with md5sum > Signed-off-by: Eric Bénard > --- > - if (argc < 2) > - return COMMAND_ERROR_USAGE; > + while ((opt = getopt(argc, argv, "v:V:")) > 0) { > + switch (opt) { > + case 'v': > + verify++; > + free(verify_hash); > + hash = xstrdup(optarg); > + len = strlen(hash); > + break; > + case 'V': > + verify++; > + free(verify_hash); > + hash = read_file(optarg, &bufsz); > + len = bufsz; > + break; > + default: > + ret = COMMAND_ERROR_USAGE; > + goto out; > + } > + > + if (verify == 1 && (d->length * 2) <= len && hash != NULL) { > + min_argc += 2; > + verify_hash = parse_hash(d->length, hash); > + if (!verify_hash) > + return -ENOMEM; > + free(hash); > + } else > + return COMMAND_ERROR_USAGE; This code in the option parsing loop looks odd. Could you just parse options in the loop, store the hash(file) in a variable and do the processing outside the loop? > + } > + > + if (argc < min_argc) { > + ret = COMMAND_ERROR_USAGE; > + goto out; > + } > + > + argv += min_argc - 2; > > hash = calloc(d->length, sizeof(unsigned char)); xzalloc should be safe here. > if (!hash) { > perror("calloc"); > - return COMMAND_ERROR_USAGE; > + ret = -ENOMEM; > + goto out; > } > > argv++; > @@ -60,17 +133,32 @@ static int do_digest(char *algorithm, int argc, char > *argv[]) > if (digest_file_window(d, filename, hash, start, size) < 0) { > ret = 1; > } else { > - for (i = 0; i < d->length; i++) > + for (i = 0; i < d->length; i++) { > printf("%02x", hash[i]); > + if (verify > 0 && hash[i] != verify_hash[i]) > + verify = -1; > + } > > - printf(" %s\t0x%08llx ... 0x%08llx\n", > + printf(" %s\t0x%08llx ... 0x%08llx", > filename, start, start + size); > + > + if (verify < 0) { > + printf(" ** ERROR ** "); Printing the real hash and the expected hash would be nice here. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH] common/bootargs: add blkdevparts variables
On Mon, Feb 16, 2015 at 02:03:18PM +0100, h.feurst...@gmail.com wrote: > From: Hubert Feurstein > > The kernel command line option blkdevparts works like mtdparts, but for all > block devices. So it can be used for eMMC devices without the need of a > traditional partition table. Uh, wrong world. For mtd devices I would be glad if the partition table would be stored on the device. Now we get support for separating the partition tables for block devices. Anyway, applied, thanks Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox