mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] login: add timeout support
@ 2011-08-10 10:47 Jean-Christophe PLAGNIOL-VILLARD
  2011-08-10 10:47 ` [PATCH 2/3] defaultenv: move common env to defaultenv/common Jean-Christophe PLAGNIOL-VILLARD
  2011-08-10 10:47 ` [PATCH 3/3] defaultenv: add login autoboot support Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-08-10 10:47 UTC (permalink / raw)
  To: barebox

If a timeout is specified and expired the command will be executed
by default boot

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 commands/login.c   |   26 ++++++++++++++--
 commands/passwd.c  |    4 +-
 common/password.c  |   87 ++++++++++++++++++++++++++++-----------------------
 include/password.h |    2 +-
 4 files changed, 74 insertions(+), 45 deletions(-)

diff --git a/commands/login.c b/commands/login.c
index 7d99b73..610fb9e 100644
--- a/commands/login.c
+++ b/commands/login.c
@@ -21,6 +21,7 @@
 #include <common.h>
 #include <command.h>
 #include <password.h>
+#include <getopt.h>
 
 #define PASSWD_MAX_LENGTH	(128 + 1)
 
@@ -35,16 +36,32 @@
 static int do_login(struct command *cmdtp, int argc, char *argv[])
 {
 	unsigned char passwd[PASSWD_MAX_LENGTH];
-	int passwd_len;
+	int passwd_len, opt;
+	int timeout = 0;
+	char *timeout_cmd = "boot";
 
 	if (!is_passwd_enable()) {
 		puts("login: password not set\n");
 		return 0;
 	}
 
+	while((opt = getopt(argc, argv, "t:")) > 0) {
+		switch(opt) {
+		case 't':
+			timeout = simple_strtoul(optarg, NULL, 10);
+			break;
+		}
+	}
+
+	if (optind != argc)
+		timeout_cmd = argv[optind];
+
 	do {
 		puts("Password: ");
-		passwd_len = password(passwd, PASSWD_MAX_LENGTH, LOGIN_MODE);
+		passwd_len = password(passwd, PASSWD_MAX_LENGTH, LOGIN_MODE, timeout);
+
+		if (passwd_len < 0)
+			run_command(timeout_cmd, 0);
 
 		if (check_passwd(passwd, passwd_len))
 			return 0;
@@ -54,7 +71,10 @@ static int do_login(struct command *cmdtp, int argc, char *argv[])
 }
 
 static const __maybe_unused char cmd_login_help[] =
-"";
+"Usage: login [[-t timeout] <command>]\n"
+"If a timeout is specified and expired the command will be executed\n"
+"by default boot\n"
+;
 
 BAREBOX_CMD_START(login)
 	.cmd		= do_login,
diff --git a/commands/passwd.c b/commands/passwd.c
index 9435091..9a07873 100644
--- a/commands/passwd.c
+++ b/commands/passwd.c
@@ -42,13 +42,13 @@ static int do_passwd(struct command *cmdtp, int argc, char *argv[])
 	int ret = 1;
 
 	puts("Enter new password: ");
-	passwd1_len = password(passwd1, PASSWD_MAX_LENGTH, PASSWD_MODE);
+	passwd1_len = password(passwd1, PASSWD_MAX_LENGTH, PASSWD_MODE, 0);
 
 	if (passwd1_len < 0)
 		return 1;
 
 	puts("Retype new password: ");
-	passwd2_len = password(passwd2, PASSWD_MAX_LENGTH, PASSWD_MODE);
+	passwd2_len = password(passwd2, PASSWD_MAX_LENGTH, PASSWD_MODE, 0);
 
 	if (passwd2_len < 0)
 		return 1;
diff --git a/common/password.c b/common/password.c
index 20e398f..ece7704 100644
--- a/common/password.c
+++ b/common/password.c
@@ -27,6 +27,7 @@
 #include <digest.h>
 #include <malloc.h>
 #include <xfuncs.h>
+#include <clock.h>
 
 #if defined(CONFIG_PASSWD_SUM_MD5)
 #define PASSWD_SUM "md5"
@@ -36,56 +37,64 @@
 #define PASSWD_SUM "sha256"
 #endif
 
-int password(unsigned char *passwd, size_t length, int flags)
+int password(unsigned char *passwd, size_t length, int flags, int timeout)
 {
 	unsigned char *buf = passwd;
 	int pos = 0;
 	unsigned char ch;
+	uint64_t start, second;
 
 	if (!passwd)
 		return -EINVAL;
 
+	start = get_time_ns();
+	second = start;
+
 	do {
-		ch = getc();
-
-		switch (ch) {
-		case '\r':
-		case '\n':
-			*buf = '\0';
-			puts("\r\n");
-			return pos;
-		case '\0':
-		case '\t':
-			continue;
-		case CTL_CH('c'):
-			passwd[0] = '\0';
-			puts("\r\n");
-			return 0;
-		case CTL_CH('h'):
-		case KEY_DEL7:
-		case KEY_DEL:
-			if (flags & STAR && pos > 0)
-				puts("\b \b");
-			*buf = '\0';
-			buf--;
-			pos--;
-			continue;
-		default:
-			if (pos < length - 1) {
-				if (flags & STAR)
-					putchar('*');
-				else if (flags & CLEAR)
-					putchar(ch);
-
-				*buf = ch;
-				buf++;
-				pos++;
-			} else {
-				if (flags & STAR)
-					putchar('\a');
+		if (tstc()) {
+			ch = getc();
+
+			switch (ch) {
+			case '\r':
+			case '\n':
+				*buf = '\0';
+				puts("\r\n");
+				return pos;
+			case '\0':
+			case '\t':
+				continue;
+			case CTL_CH('c'):
+				passwd[0] = '\0';
+				puts("\r\n");
+				return 0;
+			case CTL_CH('h'):
+			case KEY_DEL7:
+			case KEY_DEL:
+				if (flags & STAR && pos > 0)
+					puts("\b \b");
+				*buf = '\0';
+				buf--;
+				pos--;
+				continue;
+			default:
+				if (pos < length - 1) {
+					if (flags & STAR)
+						putchar('*');
+					else if (flags & CLEAR)
+						putchar(ch);
+
+					*buf = ch;
+					buf++;
+					pos++;
+				} else {
+					if (flags & STAR)
+						putchar('\a');
+				}
 			}
 		}
-	} while(1);
+	} while (!is_timeout(start, timeout * SECOND) || timeout == 0);
+
+	return -1;
 }
 EXPORT_SYMBOL(password);
 
diff --git a/include/password.h b/include/password.h
index 32301eb..540ab05 100644
--- a/include/password.h
+++ b/include/password.h
@@ -28,7 +28,7 @@
 #define STAR	(1 << 1)
 #define CLEAR	(1 << 2)
 
-int password(unsigned char *passwd, size_t length, int flags);
+int password(unsigned char *passwd, size_t length, int flags, int timeout);
 
 int read_passwd(unsigned char *sum, size_t length);
 int write_passwd(unsigned char *sum, size_t length);
-- 
1.7.5.4


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/3] defaultenv: move common env to defaultenv/common
  2011-08-10 10:47 [PATCH 1/3] login: add timeout support Jean-Christophe PLAGNIOL-VILLARD
@ 2011-08-10 10:47 ` Jean-Christophe PLAGNIOL-VILLARD
  2011-08-10 10:47 ` [PATCH 3/3] defaultenv: add login autoboot support Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 0 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-08-10 10:47 UTC (permalink / raw)
  To: barebox

this will allow later to add custom part depending on option

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 common/Makefile                          |    2 +-
 defaultenv/{ => common}/bin/_update      |    0
 defaultenv/{ => common}/bin/_update_help |    0
 defaultenv/{ => common}/bin/boot         |    0
 defaultenv/{ => common}/bin/hush_hack    |    0
 defaultenv/{ => common}/bin/init         |    0
 defaultenv/{ => common}/bin/update       |    0
 7 files changed, 1 insertions(+), 1 deletions(-)
 rename defaultenv/{ => common}/bin/_update (100%)
 rename defaultenv/{ => common}/bin/_update_help (100%)
 rename defaultenv/{ => common}/bin/boot (100%)
 rename defaultenv/{ => common}/bin/hush_hack (100%)
 rename defaultenv/{ => common}/bin/init (100%)
 rename defaultenv/{ => common}/bin/update (100%)

diff --git a/common/Makefile b/common/Makefile
index 9fed2ae..531000a 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -32,7 +32,7 @@ $(obj)/startup.o: include/generated/barebox_default_env.h
 $(obj)/env.o: include/generated/barebox_default_env.h
 
 ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_GENERIC),y)
-DEFAULT_ENVIRONMENT_PATH = "defaultenv"
+DEFAULT_ENVIRONMENT_PATH = "defaultenv/common"
 endif
 
 ifneq ($(CONFIG_DEFAULT_ENVIRONMENT_PATH),"")
diff --git a/defaultenv/bin/_update b/defaultenv/common/bin/_update
similarity index 100%
rename from defaultenv/bin/_update
rename to defaultenv/common/bin/_update
diff --git a/defaultenv/bin/_update_help b/defaultenv/common/bin/_update_help
similarity index 100%
rename from defaultenv/bin/_update_help
rename to defaultenv/common/bin/_update_help
diff --git a/defaultenv/bin/boot b/defaultenv/common/bin/boot
similarity index 100%
rename from defaultenv/bin/boot
rename to defaultenv/common/bin/boot
diff --git a/defaultenv/bin/hush_hack b/defaultenv/common/bin/hush_hack
similarity index 100%
rename from defaultenv/bin/hush_hack
rename to defaultenv/common/bin/hush_hack
diff --git a/defaultenv/bin/init b/defaultenv/common/bin/init
similarity index 100%
rename from defaultenv/bin/init
rename to defaultenv/common/bin/init
diff --git a/defaultenv/bin/update b/defaultenv/common/bin/update
similarity index 100%
rename from defaultenv/bin/update
rename to defaultenv/common/bin/update
-- 
1.7.5.4


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/3] defaultenv: add login autoboot support
  2011-08-10 10:47 [PATCH 1/3] login: add timeout support Jean-Christophe PLAGNIOL-VILLARD
  2011-08-10 10:47 ` [PATCH 2/3] defaultenv: move common env to defaultenv/common Jean-Christophe PLAGNIOL-VILLARD
@ 2011-08-10 10:47 ` Jean-Christophe PLAGNIOL-VILLARD
  2011-08-11  7:31   ` Sascha Hauer
  1 sibling, 1 reply; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-08-10 10:47 UTC (permalink / raw)
  To: barebox

if the login command is enable and a password set use login with timeout
to stop the boot

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 common/Makefile                    |   10 ++++++----
 defaultenv/common/bin/boot_timeout |   10 ++++++++++
 defaultenv/common/bin/init         |    9 +--------
 defaultenv/login/bin/boot_timeout  |   15 +++++++++++++++
 4 files changed, 32 insertions(+), 12 deletions(-)
 create mode 100644 defaultenv/common/bin/boot_timeout
 create mode 100644 defaultenv/login/bin/boot_timeout

diff --git a/common/Makefile b/common/Makefile
index 531000a..5eeb944 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -32,19 +32,21 @@ $(obj)/startup.o: include/generated/barebox_default_env.h
 $(obj)/env.o: include/generated/barebox_default_env.h
 
 ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_GENERIC),y)
-DEFAULT_ENVIRONMENT_PATH = "defaultenv/common"
+DEFAULT_ENVIRONMENT_PATH-y = "defaultenv/common"
+
+DEFAULT_ENVIRONMENT_PATH-$(CONFIG_CMD_LOGIN) += "defaultenv/login"
 endif
 
 ifneq ($(CONFIG_DEFAULT_ENVIRONMENT_PATH),"")
-DEFAULT_ENVIRONMENT_PATH += $(CONFIG_DEFAULT_ENVIRONMENT_PATH)
+DEFAULT_ENVIRONMENT_PATH-y += $(CONFIG_DEFAULT_ENVIRONMENT_PATH)
 endif
 
-ENV_FILES := $(shell cd $(srctree); for i in $(DEFAULT_ENVIRONMENT_PATH); do find $${i} -type f -exec readlink -f '{}' \;; done)
+ENV_FILES := $(shell cd $(srctree); for i in $(DEFAULT_ENVIRONMENT_PATH-y); do find $${i} -type f -exec readlink -f '{}' \;; done)
 
 endif # ifdef CONFIG_DEFAULT_ENVIRONMENT
 
 barebox_default_env: $(ENV_FILES)
-	$(Q)$(srctree)/scripts/genenv $(srctree) $(objtree) $(DEFAULT_ENVIRONMENT_PATH)
+	$(Q)$(srctree)/scripts/genenv $(srctree) $(objtree) $(DEFAULT_ENVIRONMENT_PATH-y)
 
 include/generated/barebox_default_env.h: barebox_default_env
 	$(Q)cat $< | $(objtree)/scripts/bin2c default_environment > $@
diff --git a/defaultenv/common/bin/boot_timeout b/defaultenv/common/bin/boot_timeout
new file mode 100644
index 0000000..a469ef3
--- /dev/null
+++ b/defaultenv/common/bin/boot_timeout
@@ -0,0 +1,10 @@
+. /env/config
+
+echo
+echo -n "Hit any key to stop autoboot: "
+timeout -a $autoboot_timeout
+if [ $? != 0 ]; then
+	exit
+fi
+
+boot
diff --git a/defaultenv/common/bin/init b/defaultenv/common/bin/init
index b66f7d9..5c4ea00 100644
--- a/defaultenv/common/bin/init
+++ b/defaultenv/common/bin/init
@@ -24,11 +24,4 @@ if [ -f /env/bin/init_board ]; then
 	/env/bin/init_board
 fi
 
-echo
-echo -n "Hit any key to stop autoboot: "
-timeout -a $autoboot_timeout
-if [ $? != 0 ]; then
-	exit
-fi
-
-boot
+boot_timeout
diff --git a/defaultenv/login/bin/boot_timeout b/defaultenv/login/bin/boot_timeout
new file mode 100644
index 0000000..96a7690
--- /dev/null
+++ b/defaultenv/login/bin/boot_timeout
@@ -0,0 +1,15 @@
+. /env/config
+
+echo
+echo -n "Login in ${autoboot_timeout}s to stop autoboot: "
+echo
+login -t $autoboot_timeout
+
+echo
+echo -n "Hit any key to stop autoboot: "
+timeout -a $autoboot_timeout
+if [ $? != 0 ]; then
+	exit
+fi
+
+boot
-- 
1.7.5.4


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/3] defaultenv: add login autoboot support
  2011-08-10 10:47 ` [PATCH 3/3] defaultenv: add login autoboot support Jean-Christophe PLAGNIOL-VILLARD
@ 2011-08-11  7:31   ` Sascha Hauer
  2011-08-11 15:11     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2011-08-11  7:31 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Wed, Aug 10, 2011 at 12:47:10PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> if the login command is enable and a password set use login with timeout
> to stop the boot
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  common/Makefile                    |   10 ++++++----
>  defaultenv/common/bin/boot_timeout |   10 ++++++++++
>  defaultenv/common/bin/init         |    9 +--------
>  defaultenv/login/bin/boot_timeout  |   15 +++++++++++++++
>  4 files changed, 32 insertions(+), 12 deletions(-)
>  create mode 100644 defaultenv/common/bin/boot_timeout
>  create mode 100644 defaultenv/login/bin/boot_timeout
> 
> diff --git a/common/Makefile b/common/Makefile
> index 531000a..5eeb944 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -32,19 +32,21 @@ $(obj)/startup.o: include/generated/barebox_default_env.h
>  $(obj)/env.o: include/generated/barebox_default_env.h
>  
>  ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_GENERIC),y)
> -DEFAULT_ENVIRONMENT_PATH = "defaultenv/common"
> +DEFAULT_ENVIRONMENT_PATH-y = "defaultenv/common"
> +
> +DEFAULT_ENVIRONMENT_PATH-$(CONFIG_CMD_LOGIN) += "defaultenv/login"
>  endif
>  
>  ifneq ($(CONFIG_DEFAULT_ENVIRONMENT_PATH),"")
> -DEFAULT_ENVIRONMENT_PATH += $(CONFIG_DEFAULT_ENVIRONMENT_PATH)
> +DEFAULT_ENVIRONMENT_PATH-y += $(CONFIG_DEFAULT_ENVIRONMENT_PATH)
>  endif
>  
> -ENV_FILES := $(shell cd $(srctree); for i in $(DEFAULT_ENVIRONMENT_PATH); do find $${i} -type f -exec readlink -f '{}' \;; done)
> +ENV_FILES := $(shell cd $(srctree); for i in $(DEFAULT_ENVIRONMENT_PATH-y); do find $${i} -type f -exec readlink -f '{}' \;; done)
>  
>  endif # ifdef CONFIG_DEFAULT_ENVIRONMENT
>  
>  barebox_default_env: $(ENV_FILES)
> -	$(Q)$(srctree)/scripts/genenv $(srctree) $(objtree) $(DEFAULT_ENVIRONMENT_PATH)
> +	$(Q)$(srctree)/scripts/genenv $(srctree) $(objtree) $(DEFAULT_ENVIRONMENT_PATH-y)
>  
>  include/generated/barebox_default_env.h: barebox_default_env
>  	$(Q)cat $< | $(objtree)/scripts/bin2c default_environment > $@

I don't like this approach. It is quite intrusive and it handles only
one variable (CONFIG_CMD_LOGIN). If we by applying this patch tell
people that this is the way to customize the default env then this
is going to be a mess soon.

I think you have to live with overwriting /env/bin/init in your board
specific env or have to come up with a more general way to adjust
the default environment.


Sascha

> diff --git a/defaultenv/common/bin/boot_timeout b/defaultenv/common/bin/boot_timeout
> new file mode 100644
> index 0000000..a469ef3
> --- /dev/null
> +++ b/defaultenv/common/bin/boot_timeout
> @@ -0,0 +1,10 @@
> +. /env/config
> +
> +echo
> +echo -n "Hit any key to stop autoboot: "
> +timeout -a $autoboot_timeout
> +if [ $? != 0 ]; then
> +	exit
> +fi
> +
> +boot
> diff --git a/defaultenv/common/bin/init b/defaultenv/common/bin/init
> index b66f7d9..5c4ea00 100644
> --- a/defaultenv/common/bin/init
> +++ b/defaultenv/common/bin/init
> @@ -24,11 +24,4 @@ if [ -f /env/bin/init_board ]; then
>  	/env/bin/init_board
>  fi
>  
> -echo
> -echo -n "Hit any key to stop autoboot: "
> -timeout -a $autoboot_timeout
> -if [ $? != 0 ]; then
> -	exit
> -fi
> -
> -boot
> +boot_timeout
> diff --git a/defaultenv/login/bin/boot_timeout b/defaultenv/login/bin/boot_timeout
> new file mode 100644
> index 0000000..96a7690
> --- /dev/null
> +++ b/defaultenv/login/bin/boot_timeout
> @@ -0,0 +1,15 @@
> +. /env/config
> +
> +echo
> +echo -n "Login in ${autoboot_timeout}s to stop autoboot: "
> +echo
> +login -t $autoboot_timeout
> +
> +echo
> +echo -n "Hit any key to stop autoboot: "
> +timeout -a $autoboot_timeout
> +if [ $? != 0 ]; then
> +	exit
> +fi
> +
> +boot
> -- 
> 1.7.5.4
> 
> 
> _______________________________________________
> 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-5555 |

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/3] defaultenv: add login autoboot support
  2011-08-11  7:31   ` Sascha Hauer
@ 2011-08-11 15:11     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-08-11 15:11 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 09:31 Thu 11 Aug     , Sascha Hauer wrote:
> On Wed, Aug 10, 2011 at 12:47:10PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > if the login command is enable and a password set use login with timeout
> > to stop the boot
> > 
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  common/Makefile                    |   10 ++++++----
> >  defaultenv/common/bin/boot_timeout |   10 ++++++++++
> >  defaultenv/common/bin/init         |    9 +--------
> >  defaultenv/login/bin/boot_timeout  |   15 +++++++++++++++
> >  4 files changed, 32 insertions(+), 12 deletions(-)
> >  create mode 100644 defaultenv/common/bin/boot_timeout
> >  create mode 100644 defaultenv/login/bin/boot_timeout
> > 
> > diff --git a/common/Makefile b/common/Makefile
> > index 531000a..5eeb944 100644
> > --- a/common/Makefile
> > +++ b/common/Makefile
> > @@ -32,19 +32,21 @@ $(obj)/startup.o: include/generated/barebox_default_env.h
> >  $(obj)/env.o: include/generated/barebox_default_env.h
> >  
> >  ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_GENERIC),y)
> > -DEFAULT_ENVIRONMENT_PATH = "defaultenv/common"
> > +DEFAULT_ENVIRONMENT_PATH-y = "defaultenv/common"
> > +
> > +DEFAULT_ENVIRONMENT_PATH-$(CONFIG_CMD_LOGIN) += "defaultenv/login"
> >  endif
> >  
> >  ifneq ($(CONFIG_DEFAULT_ENVIRONMENT_PATH),"")
> > -DEFAULT_ENVIRONMENT_PATH += $(CONFIG_DEFAULT_ENVIRONMENT_PATH)
> > +DEFAULT_ENVIRONMENT_PATH-y += $(CONFIG_DEFAULT_ENVIRONMENT_PATH)
> >  endif
> >  
> > -ENV_FILES := $(shell cd $(srctree); for i in $(DEFAULT_ENVIRONMENT_PATH); do find $${i} -type f -exec readlink -f '{}' \;; done)
> > +ENV_FILES := $(shell cd $(srctree); for i in $(DEFAULT_ENVIRONMENT_PATH-y); do find $${i} -type f -exec readlink -f '{}' \;; done)
> >  
> >  endif # ifdef CONFIG_DEFAULT_ENVIRONMENT
> >  
> >  barebox_default_env: $(ENV_FILES)
> > -	$(Q)$(srctree)/scripts/genenv $(srctree) $(objtree) $(DEFAULT_ENVIRONMENT_PATH)
> > +	$(Q)$(srctree)/scripts/genenv $(srctree) $(objtree) $(DEFAULT_ENVIRONMENT_PATH-y)
> >  
> >  include/generated/barebox_default_env.h: barebox_default_env
> >  	$(Q)cat $< | $(objtree)/scripts/bin2c default_environment > $@
> 
> I don't like this approach. It is quite intrusive and it handles only
> one variable (CONFIG_CMD_LOGIN). If we by applying this patch tell
> people that this is the way to customize the default env then this
> is going to be a mess soon.
> 
> I think you have to live with overwriting /env/bin/init in your board
> specific env or have to come up with a more general way to adjust
> the default environment.
> 
here the idea is different it's default compporment for any board
if you enable login then a board is protected

the idea is make the default env configurable depending on the command enable

The idea is not obsolutly not to allow custom config in the default env just
to make it configurable

The login case is good proof of concept

Best Regards,
J.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-08-11 15:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-10 10:47 [PATCH 1/3] login: add timeout support Jean-Christophe PLAGNIOL-VILLARD
2011-08-10 10:47 ` [PATCH 2/3] defaultenv: move common env to defaultenv/common Jean-Christophe PLAGNIOL-VILLARD
2011-08-10 10:47 ` [PATCH 3/3] defaultenv: add login autoboot support Jean-Christophe PLAGNIOL-VILLARD
2011-08-11  7:31   ` Sascha Hauer
2011-08-11 15:11     ` Jean-Christophe PLAGNIOL-VILLARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox