Re: Directory mirroring

2017-04-06 Thread Daniel Schultz

Hi Sascha,

Am 06.04.2017 um 09:06 schrieb Sascha Hauer:

Hi Daniel,

On Tue, Apr 04, 2017 at 12:11:09PM +0200, Daniel Schultz wrote:

Hi everyone,

my boot partition is mounted to /boot/. Now, I want to make it accessible in
/mnt/ as mmc or emmc, depending to the bootsource. Sadly, ln can only create
symlinks for files and two mounts for one device seems not to work.

Are there other ways to mirror a file system?


Not that I know of. You could implement directory links, but why do you
want to have it accessible under /mnt in the first place?

I think it would be good, if all mountable boot devices are accessible 
in /mnt, but the boot source still remains at /boot.

1) All boot scripts can use /mnt
2) Barebox environment always lies in /boot

--
Mit freundlichen Grüßen,
With best regards,
  Daniel Schultz

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] new make helper to decode binaries using base64

2017-04-06 Thread Uwe Kleine-König
This is helpful to provide mvebu binary.0 images with a patch. When
added directly a binary patch is needed which isn't understood by
patch(1).

As it's (at least) unclear if these images are distributable in general
I don't provide a patch making use of this, but the pattern is as
follows: Add

$(obj)/start_netgear_rn2120.pblx.kwbimg: 
$(board)/netgear-rn2120/binary.0

to images/Makefile.mvebu and then put a binary.0.base64 into the board
folder.

Signed-off-by: Uwe Kleine-König 
---
 scripts/Makefile.lib | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index e79998c1b9ae..b084bacabe84 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -448,3 +448,9 @@ quiet_cmd_cboot_bct = BCT $@
 
 $(obj)/%.bct: $(obj)/%.bct.cfg
$(call cmd,cboot_bct)
+
+quiet_cmd_b64dec = B64DEC  $@
+  cmd_b64dec = base64 -d $< > $@
+
+%: %.base64
+   $(call cmd,b64dec)
-- 
2.11.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 3/4] bootchooser: register as bootentry provider

2017-04-06 Thread Sascha Hauer
Instead of using a global function called by
bootentry_create_from_name(), register the bootchooser as bootentry
provider.

Signed-off-by: Sascha Hauer 
---
 common/boot.c |  6 --
 common/bootchooser.c  | 11 +--
 include/bootchooser.h |  2 --
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/common/boot.c b/common/boot.c
index 3280ac4f54..cef3d5e514 100644
--- a/common/boot.c
+++ b/common/boot.c
@@ -289,12 +289,6 @@ int bootentry_create_from_name(struct bootentries 
*bootentries,
found += ret;
}
 
-   if (IS_ENABLED(CONFIG_BOOTCHOOSER) && !strcmp(name, "bootchooser")) {
-   ret = bootchooser_create_bootentry(bootentries);
-   if (ret > 0)
-   found += ret;
-   }
-
if (!found) {
char *path;
 
diff --git a/common/bootchooser.c b/common/bootchooser.c
index 9c110f267e..f2174a1348 100644
--- a/common/bootchooser.c
+++ b/common/bootchooser.c
@@ -863,10 +863,14 @@ static void bootchooser_release(struct bootentry *entry)
  *
  * Return: The number of entries added to the list
  */
-int bootchooser_create_bootentry(struct bootentries *entries)
+static int bootchooser_add_entry(struct bootentries *entries, const char *name)
 {
-   struct bootchooser *bc = bootchooser_get();
+   struct bootchooser *bc;
+
+   if (strcmp(name, "bootchooser"))
+   return 0;
 
+   bc = bootchooser_get();
if (IS_ERR(bc))
return PTR_ERR(bc);
 
@@ -904,6 +908,9 @@ static int bootchooser_init(void)
  reset_attempts_names, 
ARRAY_SIZE(reset_attempts_names));
globalvar_add_simple_bitmask("bootchooser.reset_priorities", 
_priorities,
  reset_priorities_names, 
ARRAY_SIZE(reset_priorities_names));
+
+   bootentry_register_provider(bootchooser_add_entry);
+
return 0;
 }
 device_initcall(bootchooser_init);
diff --git a/include/bootchooser.h b/include/bootchooser.h
index c948247722..246258e8c9 100644
--- a/include/bootchooser.h
+++ b/include/bootchooser.h
@@ -19,8 +19,6 @@ struct bootchooser_target *bootchooser_target_by_name(struct 
bootchooser *bootch
  const char *name);
 void bootchooser_target_force_boot(struct bootchooser_target *target);
 
-int bootchooser_create_bootentry(struct bootentries *entries);
-
 int bootchooser_target_set_attempts(struct bootchooser_target *target, int 
attempts);
 int bootchooser_target_set_priority(struct bootchooser_target *target, int 
priority);
 
-- 
2.11.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/4] blspec: register as bootentry provider

2017-04-06 Thread Sascha Hauer
Instead of using a global function called by
bootentry_create_from_name(), register blspec as bootentry
provider.

Signed-off-by: Sascha Hauer 
---
 common/blspec.c | 24 
 common/boot.c   | 12 
 2 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/common/blspec.c b/common/blspec.c
index ec63ddb407..8132d141ab 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -732,3 +732,27 @@ int blspec_scan_devicename(struct bootentries 
*bootentries, const char *devname)
 
return blspec_scan_device(bootentries, dev);
 }
+
+static int blspec_bootentry_provider(struct bootentries *bootentries,
+const char *name)
+{
+   int ret, found = 0;
+
+   ret = blspec_scan_devicename(bootentries, name);
+   if (ret > 0)
+   found += ret;
+
+   if (*name == '/' || !strncmp(name, "nfs://", 6)) {
+   ret = blspec_scan_directory(bootentries, name);
+   if (ret > 0)
+   found += ret;
+   }
+
+   return found;
+}
+
+static int blspec_init(void)
+{
+   return bootentry_register_provider(blspec_bootentry_provider);
+}
+device_initcall(blspec_init);
\ No newline at end of file
diff --git a/common/boot.c b/common/boot.c
index f0359cff38..3280ac4f54 100644
--- a/common/boot.c
+++ b/common/boot.c
@@ -283,18 +283,6 @@ int bootentry_create_from_name(struct bootentries 
*bootentries,
struct bootentry_provider *p;
int found = 0, ret;
 
-   if (IS_ENABLED(CONFIG_BLSPEC)) {
-   ret = blspec_scan_devicename(bootentries, name);
-   if (ret > 0)
-   found += ret;
-
-   if (*name == '/' || !strncmp(name, "nfs://", 6)) {
-   ret = blspec_scan_directory(bootentries, name);
-   if (ret > 0)
-   found += ret;
-   }
-   }
-
list_for_each_entry(p, _providers, list) {
ret = p->fn(bootentries, name);
if (ret > 0)
-- 
2.11.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 4/4] bootchooser: export bootchooser_boot

2017-04-06 Thread Sascha Hauer
Some boards that boot directly from C code do already know that
they want to boot from bootchooser and nothing else. For these
it's easiest to call bootchooser_boot directly, so export this
function.

Signed-off-by: Sascha Hauer 
---
 common/bootchooser.c  | 19 ---
 include/bootchooser.h |  2 ++
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/common/bootchooser.c b/common/bootchooser.c
index f2174a1348..455f290fa2 100644
--- a/common/bootchooser.c
+++ b/common/bootchooser.c
@@ -827,15 +827,10 @@ out:
return ret;
 }
 
-static int bootchooser_boot(struct bootentry *entry, int verbose, int dryrun)
+int bootchooser_boot(struct bootchooser *bc)
 {
-   struct bootchooser *bc = container_of(entry, struct bootchooser,
-  entry);
int ret, tryagain;
 
-   bc->verbose = verbose;
-   bc->dryrun = dryrun;
-
do {
ret = bootchooser_boot_one(bc, );
 
@@ -846,6 +841,16 @@ static int bootchooser_boot(struct bootentry *entry, int 
verbose, int dryrun)
return ret;
 }
 
+static int bootchooser_entry_boot(struct bootentry *entry, int verbose, int 
dryrun)
+{
+   struct bootchooser *bc = container_of(entry, struct bootchooser,
+  entry);
+   bc->verbose = verbose;
+   bc->dryrun = dryrun;
+
+   return bootchooser_boot(bc);
+}
+
 static void bootchooser_release(struct bootentry *entry)
 {
struct bootchooser *bc = container_of(entry, struct bootchooser,
@@ -874,7 +879,7 @@ static int bootchooser_add_entry(struct bootentries 
*entries, const char *name)
if (IS_ERR(bc))
return PTR_ERR(bc);
 
-   bc->entry.boot = bootchooser_boot;
+   bc->entry.boot = bootchooser_entry_boot;
bc->entry.release = bootchooser_release;
bc->entry.title = xstrdup("bootchooser");
bc->entry.description = xstrdup("bootchooser");
diff --git a/include/bootchooser.h b/include/bootchooser.h
index 246258e8c9..7822c01459 100644
--- a/include/bootchooser.h
+++ b/include/bootchooser.h
@@ -13,6 +13,8 @@ int bootchooser_put(struct bootchooser *bootchooser);
 
 void bootchooser_info(struct bootchooser *bootchooser);
 
+int bootchooser_boot(struct bootchooser *bc);
+
 struct bootchooser_target *bootchooser_get_last_chosen(struct bootchooser 
*bootchooser);
 const char *bootchooser_target_name(struct bootchooser_target *target);
 struct bootchooser_target *bootchooser_target_by_name(struct bootchooser 
*bootchooser,
-- 
2.11.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/4] boot: Allow to register boot entry providers

2017-04-06 Thread Sascha Hauer
bootentry_create_from_name() takes a name and creates bootentries
for it. It tries different providers that interpret the name:
blspec, bootchooser or script pathes. Instead of hardcoding the
different providers in the function, allow the providers to register
themselves.

Signed-off-by: Sascha Hauer 
---
 common/boot.c  | 26 ++
 include/boot.h |  2 ++
 2 files changed, 28 insertions(+)

diff --git a/common/boot.c b/common/boot.c
index 4306319331..f0359cff38 100644
--- a/common/boot.c
+++ b/common/boot.c
@@ -244,6 +244,25 @@ static int bootscript_scan_path(struct bootentries 
*bootentries, const char *pat
return ret;
 }
 
+static LIST_HEAD(bootentry_providers);
+
+struct bootentry_provider {
+   int (*fn)(struct bootentries *bootentries, const char *name);
+   struct list_head list;
+};
+
+int bootentry_register_provider(int (*fn)(struct bootentries *bootentries, 
const char *name))
+{
+   struct bootentry_provider *p;
+
+   p = xzalloc(sizeof(*p));
+   p->fn = fn;
+
+   list_add_tail(>list, _providers);
+
+   return 0;
+}
+
 /*
  * bootentry_create_from_name - create boot entries from a name
  *
@@ -261,6 +280,7 @@ static int bootscript_scan_path(struct bootentries 
*bootentries, const char *pat
 int bootentry_create_from_name(struct bootentries *bootentries,
  const char *name)
 {
+   struct bootentry_provider *p;
int found = 0, ret;
 
if (IS_ENABLED(CONFIG_BLSPEC)) {
@@ -275,6 +295,12 @@ int bootentry_create_from_name(struct bootentries 
*bootentries,
}
}
 
+   list_for_each_entry(p, _providers, list) {
+   ret = p->fn(bootentries, name);
+   if (ret > 0)
+   found += ret;
+   }
+
if (IS_ENABLED(CONFIG_BOOTCHOOSER) && !strcmp(name, "bootchooser")) {
ret = bootchooser_create_bootentry(bootentries);
if (ret > 0)
diff --git a/include/boot.h b/include/boot.h
index a855cbe1e5..4f7612ab80 100644
--- a/include/boot.h
+++ b/include/boot.h
@@ -36,6 +36,8 @@ struct bootentry {
 
 int bootentries_add_entry(struct bootentries *entries, struct bootentry 
*entry);
 
+int bootentry_register_provider(int (*fn)(struct bootentries *bootentries, 
const char *name));
+
 #define bootentries_for_each_entry(bootentries, entry) \
list_for_each_entry(entry, >entries, list)
 
-- 
2.11.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: Directory mirroring

2017-04-06 Thread Sascha Hauer
Hi Daniel,

On Tue, Apr 04, 2017 at 12:11:09PM +0200, Daniel Schultz wrote:
> Hi everyone,
> 
> my boot partition is mounted to /boot/. Now, I want to make it accessible in
> /mnt/ as mmc or emmc, depending to the bootsource. Sadly, ln can only create
> symlinks for files and two mounts for one device seems not to work.
> 
> Are there other ways to mirror a file system?

Not that I know of. You could implement directory links, but why do you
want to have it accessible under /mnt in the first place?

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] usb: uhci-hcd: fix uhci_alloc_int_td()

2017-04-06 Thread Sascha Hauer
On Wed, Apr 05, 2017 at 01:05:47PM +0300, Peter Mamonov wrote:
> Hi Sasha,
> 
> On Fri, Mar 24, 2017 at 07:20:55AM +0100, Sascha Hauer wrote:
> > Hi Peter,
> > 
> > On Thu, Mar 23, 2017 at 12:36:15AM +0300, Peter Mamonov wrote:
> > > Signed-off-by: Peter Mamonov 
> > > ---
> > >  drivers/usb/host/uhci-hcd.c | 6 +-
> > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
> > > index 9ad4644e8..04d167ee3 100644
> > > --- a/drivers/usb/host/uhci-hcd.c
> > > +++ b/drivers/usb/host/uhci-hcd.c
> > > @@ -554,8 +554,12 @@ static int submit_bulk_msg(struct usb_device *dev, 
> > > unsigned long pipe,
> > >   */
> > >  static struct uhci_td *uhci_alloc_int_td(struct uhci_priv *uhci)
> > >  {
> > > - return >tmp_int_td[0];
> > > + int i;
> > >  
> > > + for (i = 0; i < USB_MAX_TEMP_INT_TD; i++)
> > > + if (uhci->tmp_int_td[i].dev_ptr == 0)
> > > + return >tmp_int_td[i];
> > > + return NULL;
> > 
> > You have to upstream the uhci driver first before I can apply fixes for
> > it ;)
> 
> Right =)
> 
> I've just realized it was not accepted... for a good reason: 
> http://lists.infradead.org/pipermail/barebox/2016-January/026016.html

Well the driver doesn't look bad from a first glance. You could repost
it with your fixup applied and see what the maintainer says ;)

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] sandbox_defconfig: enable squashfs support

2017-04-06 Thread Sascha Hauer
On Wed, Apr 05, 2017 at 01:03:36PM +0300, Antony Pavlov wrote:
> Signed-off-by: Antony Pavlov 
> ---
>  arch/sandbox/configs/sandbox_defconfig | 1 +
>  1 file changed, 1 insertion(+)

Applied, thanks

Sascha

> 
> diff --git a/arch/sandbox/configs/sandbox_defconfig 
> b/arch/sandbox/configs/sandbox_defconfig
> index c20dd15a0..dbaff12bf 100644
> --- a/arch/sandbox/configs/sandbox_defconfig
> +++ b/arch/sandbox/configs/sandbox_defconfig
> @@ -79,6 +79,7 @@ CONFIG_FS_FAT_WRITE=y
>  CONFIG_FS_FAT_LFN=y
>  CONFIG_FS_BPKFS=y
>  CONFIG_FS_UIMAGEFS=y
> +CONFIG_FS_SQUASHFS=y
>  CONFIG_BZLIB=y
>  CONFIG_LZ4_DECOMPRESS=y
>  CONFIG_XZ_DECOMPRESS=y
> -- 
> 2.11.0
> 
> 

-- 
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] commands: digest: show area info only if necessary

2017-04-06 Thread Sascha Hauer
On Wed, Apr 05, 2017 at 01:02:38PM +0300, Antony Pavlov wrote:
> Area info "0x ... 0x" in digest
> commands output is something strange and misleading, e.g.
> 
>   barebox@barebox sandbox:/ md5sum logo/barebox-logo-240.png
>   d3226a0eba3fd49af6bd190b077a3466  logo/barebox-logo-240.png 0x ... 
> 0x
> 
> Also skipping area info in the barebox digets commands
> output for every file makes it more similar to traditional
> *nix digest commands output.
> 
> Signed-off-by: Antony Pavlov 

Applied, thanks. This really looks nicer now.

Sascha

> ---
>  commands/digest.c | 14 +++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/commands/digest.c b/commands/digest.c
> index 02a9f6f0d..0edbbec32 100644
> --- a/commands/digest.c
> +++ b/commands/digest.c
> @@ -36,12 +36,16 @@ int __do_digest(struct digest *d, unsigned char *sig,
>   while (*argv) {
>   char *filename = "/dev/mem";
>   loff_t start = 0, size = ~0;
> + int show_area = 1;
>  
>   /* arguments are either file, file+area or area */
>   if (parse_area_spec(*argv, , )) {
>   filename = *argv;
> - if (argv[1] && !parse_area_spec(argv[1], , ))
> + show_area = 0;
> + if (argv[1] && !parse_area_spec(argv[1], , 
> )) {
>   argv++;
> + show_area = 1;
> + }
>   }
>  
>   ret = digest_file_window(d, filename,
> @@ -53,8 +57,12 @@ int __do_digest(struct digest *d, unsigned char *sig,
>   for (i = 0; i < digest_length(d); i++)
>   printf("%02x", hash[i]);
>  
> - printf("  %s\t0x%08llx ... 0x%08llx\n",
> - filename, start, start + size);
> + printf("  %s", filename);
> + if (show_area)
> + printf("\t0x%08llx ... 0x%08llx",
> + start, start + size);
> +
> + puts("\n");
>   }
>   }
>  
> -- 
> 2.11.0
> 
> 

-- 
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 v2] usb: gadget: set otg to peripheral mode on autostart

2017-04-06 Thread Sascha Hauer
On Mon, Apr 03, 2017 at 10:31:01AM +0200, Oleksij Rempel wrote:
> we won't be able to start if otg is not properly configured.
> 
> Signed-off-by: Oleksij Rempel 
> ---
>  drivers/usb/gadget/autostart.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks

Sascha

> 
> diff --git a/drivers/usb/gadget/autostart.c b/drivers/usb/gadget/autostart.c
> index 43c2ba23d..4ad1dd6be 100644
> --- a/drivers/usb/gadget/autostart.c
> +++ b/drivers/usb/gadget/autostart.c
> @@ -14,6 +14,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -35,6 +36,8 @@ static int usbgadget_autostart(void)
>   if (!autostart)
>   return 0;
>  
> + setenv("otg.mode", "peripheral");
> +
>   if (fastboot_function)
>   opts.fastboot_opts.files = file_list_parse(fastboot_function);
>  
> -- 
> 2.11.0
> 
> 
> ___
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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