Skip to contentSkip to conversation

at91 boot menu support

PATCH New Jean-Christophe PLAGNIOL-VILLARD 1 participant 5 messages Apr 7, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover at91 boot menu support

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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#1 lore raw

PATCH 1/4 defaultenv: add support for custom board boot

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

---
 defaultenv/bin/init |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)
defaultenv/bin/init +11 -7
index b371c42..7452bb6 100644
@@ -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
Signature · 7 lines
1.7.9.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 2/4 at91sam9m10g45ek: add gpio keys support

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 arch/arm/boards/at91sam9m10g45ek/init.c |   51 +++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)
arch/arm/boards/at91sam9m10g45ek/init.c +51 -0
index 6011bad..c4b1a97 100644
@@ -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");
Signature · 7 lines
1.7.9.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH 3/4 at91sam9m10g45ek: enable kernel console over framebuffer

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 arch/arm/boards/at91sam9m10g45ek/env/config |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/boards/at91sam9m10g45ek/env/config +1 -1
index d115132..f31fdd5 100644
@@ -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 "
Signature · 7 lines
1.7.9.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH 4/4 at91sam9m10g45ek: add boot menu support

In reply to Jean-Christophe PLAGNIOL-VILLARD

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.

---
 .../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
arch/arm/boards/at91sam9m10g45ek/env/bin/boot_board new file +51 -0
new file mode 100644
index 0000000..3d7426f
@@ -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
arch/arm/boards/at91sam9m10g45ek/env/bin/menu_boot new file +37 -0
new file mode 100644
index 0000000..d0b1396
@@ -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
Signature · 7 lines
1.7.9.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox