mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] sandbox: add asm-generic/io.h
@ 2012-09-03  6:18 Alexander Aring
  2012-09-03  6:18 ` [PATCH 2/3] sandbox: fix whitespaces in board file Alexander Aring
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alexander Aring @ 2012-09-03  6:18 UTC (permalink / raw)
  To: barebox

Add in sandbox asm/io.h the asm-generic/io.h header file.
Needed by NAND support.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 arch/sandbox/include/asm/io.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h
index da84fa5..fbc23bf 100644
--- a/arch/sandbox/include/asm/io.h
+++ b/arch/sandbox/include/asm/io.h
@@ -1 +1,7 @@
-/* nothing */
+#ifndef __ASM_SANDBOX_IO_H
+#define __ASM_SANDBOX_IO_H
+
+#include <asm-generic/io.h>
+
+#endif /* __ASM_SANDBOX_IO_H */
+
-- 
1.7.12


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

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

* [PATCH 2/3] sandbox: fix whitespaces in board file
  2012-09-03  6:18 [PATCH 1/3] sandbox: add asm-generic/io.h Alexander Aring
@ 2012-09-03  6:18 ` Alexander Aring
  2012-09-03  6:18 ` [PATCH 3/3] sandbox: fix malloc argument Alexander Aring
  2012-09-03  9:09 ` [PATCH 1/3] sandbox: add asm-generic/io.h Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Alexander Aring @ 2012-09-03  6:18 UTC (permalink / raw)
  To: barebox

Fix whitespaces in board file.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 arch/sandbox/board/board.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sandbox/board/board.c b/arch/sandbox/board/board.c
index d2f0667..6bccd2c 100644
--- a/arch/sandbox/board/board.c
+++ b/arch/sandbox/board/board.c
@@ -29,7 +29,7 @@
 
 static struct device_d tap_device = {
 	.id	  = DEVICE_ID_DYNAMIC,
-        .name     = "tap",
+	.name     = "tap",
 };
 
 static int devices_init(void)
-- 
1.7.12


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

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

* [PATCH 3/3] sandbox: fix malloc argument
  2012-09-03  6:18 [PATCH 1/3] sandbox: add asm-generic/io.h Alexander Aring
  2012-09-03  6:18 ` [PATCH 2/3] sandbox: fix whitespaces in board file Alexander Aring
@ 2012-09-03  6:18 ` Alexander Aring
  2012-09-03  9:09 ` [PATCH 1/3] sandbox: add asm-generic/io.h Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Alexander Aring @ 2012-09-03  6:18 UTC (permalink / raw)
  To: barebox

Fix malloc argument for sandbox system.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 arch/sandbox/os/common.c | 87 +++++++++++++++++++++++++++++++-----------------
 1 file changed, 57 insertions(+), 30 deletions(-)

diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c
index 92b7dbb..e296574 100644
--- a/arch/sandbox/os/common.c
+++ b/arch/sandbox/os/common.c
@@ -271,33 +271,29 @@ err_out:
 
 static void print_usage(const char*);
 
+static struct option long_options[] = {
+	{"help",   0, 0, 'h'},
+	{"malloc", 1, 0, 'm'},
+	{"image",  1, 0, 'i'},
+	{"env",    1, 0, 'e'},
+	{"stdout", 1, 0, 'O'},
+	{"stdin",  1, 0, 'I'},
+	{0, 0, 0, 0},
+};
+
+static const char optstring[] = "hm:i:e:O:I:";
+
 int main(int argc, char *argv[])
 {
 	void *ram;
 	int opt, ret, fd;
 	int malloc_size = 8 * 1024 * 1024;
 	char str[6];
-	int fdno = 0, envno = 0;
-
-	ram = malloc(malloc_size);
-	if (!ram) {
-		printf("unable to get malloc space\n");
-		exit(1);
-	}
-	mem_malloc_init(ram, ram + malloc_size - 1);
+	int fdno = 0, envno = 0, option_index = 0;
 
 	while (1) {
-		int option_index = 0;
-		static struct option long_options[] = {
-			{"help",   0, 0, 'h'},
-			{"image",  1, 0, 'i'},
-			{"env",    1, 0, 'e'},
-			{"stdout", 1, 0, 'O'},
-			{"stdin",  1, 0, 'I'},
-			{0, 0, 0, 0},
-		};
-
-		opt = getopt_long(argc, argv, "hi:e:O:I:",
+		option_index = 0;
+		opt = getopt_long(argc, argv, optstring,
 			long_options, &option_index);
 
 		if (opt == -1)
@@ -307,18 +303,7 @@ int main(int argc, char *argv[])
 		case 'h':
 			print_usage(basename(argv[0]));
 			exit(0);
-		case 'i':
-			sprintf(str, "fd%d", fdno);
-			ret = add_image(optarg, str);
-			if (ret)
-				exit(1);
-			fdno++;
-			break;
 		case 'm':
-			/* This option is broken. add_image needs malloc, so
-			 * mem_alloc_init() has to be called before option
-			 * parsing
-			 */
 			malloc_size = strtoul(optarg, NULL, 0);
 			break;
 		case 'e':
@@ -351,6 +336,47 @@ int main(int argc, char *argv[])
 		}
 	}
 
+	ram = malloc(malloc_size);
+	if (!ram) {
+		printf("unable to get malloc space\n");
+		exit(1);
+	}
+	mem_malloc_init(ram, ram + malloc_size - 1);
+
+	/* reset getopt */
+	optind = 1;
+
+	while (1) {
+		option_index = 0;
+		opt = getopt_long(argc, argv, optstring,
+			long_options, &option_index);
+
+		if (opt == -1)
+			break;
+
+		switch (opt) {
+		case 'h':
+			break;
+		case 'm':
+			break;
+		case 'i':
+			sprintf(str, "fd%d", fdno);
+			ret = add_image(optarg, str);
+			if (ret)
+				exit(1);
+			fdno++;
+			break;
+		case 'e':
+			break;
+		case 'O':
+			break;
+		case 'I':
+			break;
+		default:
+			exit(1);
+		}
+	}
+
 	barebox_register_console("console", fileno(stdin), fileno(stdout));
 
 	rawmode();
@@ -371,6 +397,7 @@ static void print_usage(const char *prgname)
 "Usage: %s [OPTIONS]\n"
 "Start barebox.\n\n"
 "Options:\n\n"
+"  -m, "
 "  -i, --image=<file>   Map an image file to barebox. This option can be given\n"
 "                       multiple times. The files will show up as\n"
 "                       /dev/fd0 ... /dev/fdx under barebox.\n"
-- 
1.7.12


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

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

* Re: [PATCH 1/3] sandbox: add asm-generic/io.h
  2012-09-03  6:18 [PATCH 1/3] sandbox: add asm-generic/io.h Alexander Aring
  2012-09-03  6:18 ` [PATCH 2/3] sandbox: fix whitespaces in board file Alexander Aring
  2012-09-03  6:18 ` [PATCH 3/3] sandbox: fix malloc argument Alexander Aring
@ 2012-09-03  9:09 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2012-09-03  9:09 UTC (permalink / raw)
  To: Alexander Aring; +Cc: barebox

On Mon, Sep 03, 2012 at 08:18:06AM +0200, Alexander Aring wrote:
> Add in sandbox asm/io.h the asm-generic/io.h header file.
> Needed by NAND support.
> 
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>

Applied, thanks

Sascha

> ---
>  arch/sandbox/include/asm/io.h | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h
> index da84fa5..fbc23bf 100644
> --- a/arch/sandbox/include/asm/io.h
> +++ b/arch/sandbox/include/asm/io.h
> @@ -1 +1,7 @@
> -/* nothing */
> +#ifndef __ASM_SANDBOX_IO_H
> +#define __ASM_SANDBOX_IO_H
> +
> +#include <asm-generic/io.h>
> +
> +#endif /* __ASM_SANDBOX_IO_H */
> +
> -- 
> 1.7.12
> 
> 
> _______________________________________________
> 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] 4+ messages in thread

end of thread, other threads:[~2012-09-03  9:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-03  6:18 [PATCH 1/3] sandbox: add asm-generic/io.h Alexander Aring
2012-09-03  6:18 ` [PATCH 2/3] sandbox: fix whitespaces in board file Alexander Aring
2012-09-03  6:18 ` [PATCH 3/3] sandbox: fix malloc argument Alexander Aring
2012-09-03  9:09 ` [PATCH 1/3] sandbox: add asm-generic/io.h Sascha Hauer

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