mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/4] at91 boot menu support
@ 2012-04-07  3:12 Jean-Christophe PLAGNIOL-VILLARD
  2012-04-07  3:14 ` [PATCH 1/4] defaultenv: add support for custom board boot Jean-Christophe PLAGNIOL-VILLARD
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-04-07  3:12 UTC (permalink / raw)
  To: barebox

Hi,

	This patch series add the support on at91sam9m10g45ek of a boot menu.

	this pull include also at91-fixes, menu

please full
The following changes since commit 9c29dab5aab70d399c51d2cae73d9e40c5948707:

  net: env: getenv_ip use resolv (2012-04-03 11:39:29 +0800)

are available in the git repository at:

  git://git.jcrosoft.org/barebox.git at91

for you to fetch changes up to 6c0b0166b7b0ba9ec5733366b5edfc34e5eb165b:

  at91sam9m10g45ek: add boot menu support (2012-04-07 10:55:37 +0800)

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (8):
      at91rm9200ek: set maximum nor flash size
      at91sam9260ek/9g20ek: udpate defconfig
      menu: fix double action when "\n\r" or "\r\n" is received
      menu: add color fancy support
      defaultenv: add support for custom board boot
      at91sam9m10g45ek: add gpio keys support
      at91sam9m10g45ek: enable kernel console over framebuffer
      at91sam9m10g45ek: add boot menu support

 arch/arm/boards/at91rm9200ek/init.c                |    3 +-
 .../arm/boards/at91sam9m10g45ek/env/bin/boot_board |   51 +++++++++++++++++++
 arch/arm/boards/at91sam9m10g45ek/env/bin/menu_boot |   37 ++++++++++++++
 arch/arm/boards/at91sam9m10g45ek/env/config        |    2 +-
 arch/arm/boards/at91sam9m10g45ek/init.c            |   51 +++++++++++++++++++
 arch/arm/configs/at91sam9260ek_defconfig           |    5 ++-
 arch/arm/configs/at91sam9g20ek_defconfig           |    8 +++-
 common/menu.c                                      |   53 +++++++++++++++++---
 defaultenv/bin/init                                |   18 ++++---
 include/menu.h                                     |    3 +
 10 files changed, 213 insertions(+), 18 deletions(-)
 create mode 100644 arch/arm/boards/at91sam9m10g45ek/env/bin/boot_board
 create mode 100644 arch/arm/boards/at91sam9m10g45ek/env/bin/menu_boot

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

* [PATCH 1/4] defaultenv: add support for custom board boot
  2012-04-07  3:12 [PATCH 0/4] at91 boot menu support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-04-07  3:14 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-04-07  3:14 ` [PATCH 2/4] at91sam9m10g45ek: add gpio keys support Jean-Christophe PLAGNIOL-VILLARD
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-04-07  3:14 UTC (permalink / raw)
  To: barebox

This will allow a board to have a custom boot choice with a boot menu as
example.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 defaultenv/bin/init |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/defaultenv/bin/init b/defaultenv/bin/init
index b371c42..7452bb6 100644
--- a/defaultenv/bin/init
+++ b/defaultenv/bin/init
@@ -24,11 +24,15 @@ 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
+if [ -f /env/bin/boot_board ]; then
+	. /env/bin/boot_board
+else
+	echo
+	echo -n "Hit any key to stop autoboot: "
+	timeout -a $autoboot_timeout
+	if [ $? != 0 ]; then
+		exit
+	fi
+
+	boot
 fi
-
-boot
-- 
1.7.9.1


_______________________________________________
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/4] at91sam9m10g45ek: add gpio keys support
  2012-04-07  3:12 [PATCH 0/4] at91 boot menu support Jean-Christophe PLAGNIOL-VILLARD
  2012-04-07  3:14 ` [PATCH 1/4] defaultenv: add support for custom board boot Jean-Christophe PLAGNIOL-VILLARD
@ 2012-04-07  3:14 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-04-07  3:15 ` [PATCH 3/4] at91sam9m10g45ek: enable kernel console over framebuffer Jean-Christophe PLAGNIOL-VILLARD
  2012-04-07  3:15 ` [PATCH 4/4] at91sam9m10g45ek: add boot menu support Jean-Christophe PLAGNIOL-VILLARD
  3 siblings, 0 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-04-07  3:14 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/at91sam9m10g45ek/init.c |   51 +++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boards/at91sam9m10g45ek/init.c b/arch/arm/boards/at91sam9m10g45ek/init.c
index 6011bad..c4b1a97 100644
--- a/arch/arm/boards/at91sam9m10g45ek/init.c
+++ b/arch/arm/boards/at91sam9m10g45ek/init.c
@@ -41,6 +41,8 @@
 #include <mach/io.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/sam9_smc.h>
+#include <gpio_keys.h>
+#include <readkey.h>
 
 /*
  * board revision encoding
@@ -164,6 +166,54 @@ static void ek_device_add_leds(void)
 static void ek_device_add_leds(void) {}
 #endif
 
+#ifdef CONFIG_KEYBOARD_GPIO
+struct gpio_keys_button keys[] = {
+	{
+		.code = KEY_HOME,
+		.gpio = AT91_PIN_PB6,
+	}, {
+		.code = KEY_RETURN,
+		.gpio = AT91_PIN_PB7,
+	}, {
+		.code = KEY_LEFT,
+		.gpio = AT91_PIN_PB14,
+	}, {
+		.code = KEY_RIGHT,
+		.gpio = AT91_PIN_PB15,
+	}, {
+		.code = KEY_UP,
+		.gpio = AT91_PIN_PB16,
+	}, {
+		.code = KEY_DOWN,
+		.gpio = AT91_PIN_PB17,
+	}, {
+		.code = KEY_RETURN,
+		.gpio = AT91_PIN_PB18,
+	},
+};
+
+struct gpio_keys_platform_data gk_pdata = {
+	.buttons = keys,
+	.nbuttons = ARRAY_SIZE(keys),
+};
+
+static void ek_device_add_keyboard(void)
+{
+	int i;
+
+	for (i = 0; i < gk_pdata.nbuttons; i++) {
+		/* user push button, pull up enabled */
+		keys[i].active_low = 1;
+		at91_set_GPIO_periph(keys[i].gpio, keys[i].active_low);
+		at91_set_deglitch(keys[i].gpio, 1);
+	}
+
+	add_gpio_keys_device(-1, &gk_pdata);
+}
+#else
+static void ek_device_add_keyboard(void) {}
+#endif
+
 static int at91sam9m10g45ek_mem_init(void)
 {
 	at91_add_device_sdram(128 * 1024 * 1024);
@@ -178,6 +228,7 @@ static int at91sam9m10g45ek_devices_init(void)
 	at91_add_device_eth(0, &macb_pdata);
 	ek_add_device_mci();
 	ek_device_add_leds();
+	ek_device_add_keyboard();
 
 	devfs_add_partition("nand0", 0x00000, SZ_128K, PARTITION_FIXED, "at91bootstrap_raw");
 	dev_add_bb_dev("at91bootstrap_raw", "at91bootstrap");
-- 
1.7.9.1


_______________________________________________
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/4] at91sam9m10g45ek: enable kernel console over framebuffer
  2012-04-07  3:12 [PATCH 0/4] at91 boot menu support Jean-Christophe PLAGNIOL-VILLARD
  2012-04-07  3:14 ` [PATCH 1/4] defaultenv: add support for custom board boot Jean-Christophe PLAGNIOL-VILLARD
  2012-04-07  3:14 ` [PATCH 2/4] at91sam9m10g45ek: add gpio keys support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-04-07  3:15 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-04-07  3:15 ` [PATCH 4/4] at91sam9m10g45ek: add boot menu support Jean-Christophe PLAGNIOL-VILLARD
  3 siblings, 0 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-04-07  3:15 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/at91sam9m10g45ek/env/config |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/boards/at91sam9m10g45ek/env/config b/arch/arm/boards/at91sam9m10g45ek/env/config
index d115132..f31fdd5 100644
--- a/arch/arm/boards/at91sam9m10g45ek/env/config
+++ b/arch/arm/boards/at91sam9m10g45ek/env/config
@@ -31,7 +31,7 @@ rootfs_mtdblock_nand=5
 
 autoboot_timeout=3
 
-bootargs="console=ttyS0,115200"
+bootargs="console=ttyS0,115200 console=tty0"
 
 # set a fancy prompt (if support is compiled in)
 PS1="\e[1;32mbarebox@\e[1;31m\h:\w\e[0m "
-- 
1.7.9.1


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

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

* [PATCH 4/4] at91sam9m10g45ek: add boot menu support
  2012-04-07  3:12 [PATCH 0/4] at91 boot menu support Jean-Christophe PLAGNIOL-VILLARD
                   ` (2 preceding siblings ...)
  2012-04-07  3:15 ` [PATCH 3/4] at91sam9m10g45ek: enable kernel console over framebuffer Jean-Christophe PLAGNIOL-VILLARD
@ 2012-04-07  3:15 ` Jean-Christophe PLAGNIOL-VILLARD
  3 siblings, 0 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-04-07  3:15 UTC (permalink / raw)
  To: barebox

by default we boot the same way as before

The menu add interactive interface to choice boot, reset or update the system.
We still can access the shell.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 .../arm/boards/at91sam9m10g45ek/env/bin/boot_board |   51 ++++++++++++++++++++
 arch/arm/boards/at91sam9m10g45ek/env/bin/menu_boot |   37 ++++++++++++++
 2 files changed, 88 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boards/at91sam9m10g45ek/env/bin/boot_board
 create mode 100644 arch/arm/boards/at91sam9m10g45ek/env/bin/menu_boot

diff --git a/arch/arm/boards/at91sam9m10g45ek/env/bin/boot_board b/arch/arm/boards/at91sam9m10g45ek/env/bin/boot_board
new file mode 100644
index 0000000..3d7426f
--- /dev/null
+++ b/arch/arm/boards/at91sam9m10g45ek/env/bin/boot_board
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+PATH=/env/bin
+export PATH
+
+. /env/config
+
+menu -r -m boot
+menu -a -m boot -d "\e[1;36mWelcome on Barebox Boot Sequence\e[0m"
+menu -e -a -m boot -c 'menu_boot'			-d "boot (default)             "
+menu -e -a -m boot -c 'menu_boot -m nand'		-d "boot from nand             "
+menu -e -a -m boot -c 'menu_boot -k nfs -r net'		-d "boot from nfs (kernel nfs) "
+menu -e -a -m boot -c 'menu_boot -k tftp -r net'	-d "boot from nfs (kernel tftp)"
+menu -e -a -m boot -c 'clear'			-d "\e[2;33mshell                      \e[0m"
+menu -e -a -m boot -u update				-d "update                     "
+menu -e -a -m boot -c reset			-d "\e[1;31mreset                      \e[0m"
+
+# Submenu Update
+menu -r -m update
+menu -a -m update -d "\e[1;36mUpdate\e[0m"
+menu -e -a -m update -u update_barebox	-d "\e[2;33mbarebox\e[0m"
+menu -e -a -m update -u update_kernel		-d "kernel"
+menu -e -a -m update -u update_rootfs		-d "rootfs"
+menu -e -a -m update -c 'true'			-d "back  "
+
+# submenu update barebox
+menu -r -m update_barebox
+menu -a -m update_barebox -d "\e[2;33mBarebox Update Methode\e[0m"
+menu -e -a -m update_barebox -c 'update -t barebox -d nand -m tftp -c; echo ; timeout -a 3'	-d "tftp  "
+menu -e -a -m update_barebox -c 'update -t barebox -d nand -m xmodem -c; echo ; timeout -a 3'	-d "xmodem"
+menu -e -a -m update_barebox -c 'update -t barebox -d nand -m nfs -c; echo ; timeout -a 3'	-d "nfs   "
+menu -e -a -m update_barebox -c 'true'								-d "back  "
+
+# submenu update kernel
+menu -r -m update_kernel
+menu -a -m update_kernel -d "\e[1;36mKernel Update Methode\e[0m"
+menu -e -a -m update_kernel -c 'update -t kernel -d nand -m tftp -c; echo ; timeout -a 3'	-d "tftp  "
+menu -e -a -m update_kernel -c 'update -t kernel -d nand -m xmodem -c; echo ; timeout -a 3'	-d "xmodem"
+menu -e -a -m update_kernel -c 'update -t kernel -d nand -m nfs -c; echo ; timeout -a 3'	-d "nfs   "
+menu -e -a -m update_kernel -c 'true'								-d "back  "
+
+# submenu update barebox
+menu -r -m update_rootfs
+menu -a -m update_rootfs -d "\e[1;36mRootfs Update Methode\e[0m"
+menu -e -a -m update_rootfs -c 'update -t rootfs -d nand -m tftp -c; echo ; timeout -a 3'	-d "tftp  "
+menu -e -a -m update_rootfs -c 'update -t rootfs -d nand -m xmodem -c; echo ; timeout -a 3'	-d "xmodem"
+menu -e -a -m update_rootfs -c 'update -t rootfs -d nand -m nfs -c; echo ; timeout -a 3'	-d "nfs   "
+menu -e -a -m update_rootfs -c 'true'								-d "back  "
+
+menu -s -m boot -A $autoboot_timeout
+exit 1
diff --git a/arch/arm/boards/at91sam9m10g45ek/env/bin/menu_boot b/arch/arm/boards/at91sam9m10g45ek/env/bin/menu_boot
new file mode 100644
index 0000000..d0b1396
--- /dev/null
+++ b/arch/arm/boards/at91sam9m10g45ek/env/bin/menu_boot
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+. /env/config
+
+while getopt "k:r:i:m:" Option
+do
+if [ ${Option} = k ]; then
+	kernel_loc=${OPTARG}
+elif [ ${Option} = r ]; then
+	rootfs_loc=${OPTARG}
+elif [ ${Option} = i ]; then
+	ip=${OPTARG}
+elif [ ${Option} = m ]; then
+	mode=${OPTARG}
+else
+fi
+done
+
+boot_opt=
+
+if [ x$mode != x ]; then
+	boot_opt="-m ${mode}"
+else
+	if [ x$kernel_loc != x ]; then
+		boot_opt="-k ${kernel_loc}"
+	fi
+	if [ x$kernel_loc != x ]; then
+		boot_opt="-r ${rootfs_loc}"
+	fi
+fi
+
+boot ${boot_opt} -i ${ip}
+
+echo -n "boot error: Hit any key to return to the menu: "
+timeout -a 3
+menu -s -m boot
+exit 1
-- 
1.7.9.1


_______________________________________________
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:[~2012-04-07  3:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-07  3:12 [PATCH 0/4] at91 boot menu support Jean-Christophe PLAGNIOL-VILLARD
2012-04-07  3:14 ` [PATCH 1/4] defaultenv: add support for custom board boot Jean-Christophe PLAGNIOL-VILLARD
2012-04-07  3:14 ` [PATCH 2/4] at91sam9m10g45ek: add gpio keys support Jean-Christophe PLAGNIOL-VILLARD
2012-04-07  3:15 ` [PATCH 3/4] at91sam9m10g45ek: enable kernel console over framebuffer Jean-Christophe PLAGNIOL-VILLARD
2012-04-07  3:15 ` [PATCH 4/4] at91sam9m10g45ek: add boot menu support 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