Skip to contentSkip to conversation

Omap xloader boot menu support and beagle env

PATCH In review Jean-Christophe PLAGNIOL-VILLARD 3 participants 9 messages Apr 14, 2012 – Apr 18, 2012

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

cover Omap xloader boot menu support and beagle env

Hi,

The following patch seri add the support of a boot menu in the xloader

This will allow to choice where we boot from.
As example if the nand boot is broken we can choose to boot from mmc. The autoboot is set to 1s as most of the time you expect to boot from the default boot.

As the xloader need to be really small to fit in the sram the boot menu allow to add user interaction.

This pull request also include
menu: enable the fancy color support only if HUSH is enabled

send previously

The following changes since commit c406f591292ccc2af583445c0a8b5f9ade0310e2:

at91sam9260ek/9g20ek: udpate defconfig (2012-04-13 15:55:28 +0200)

are available in the git repository at:

git://git.jcrosoft.org/barebox.git omap

for you to fetch changes up to 3687e2b6dbc2e7319c6abf8023f122f7e9ec8403:

beagle/xload: update defconfig (2012-04-15 00:25:26 +0800)

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (4):
menu: enable the fancy color support only if HUSH is enabled
beagle: add default env support
beagle: add xloader boot menu support beagle/xload: update defconfig

 arch/arm/boards/beagle/env/config                |   39 ++++++++
 arch/arm/configs/omap3530_beagle_defconfig       |   16 +++-
 arch/arm/configs/omap3530_beagle_xload_defconfig |    2 +
 arch/arm/mach-omap/xload.c                       |  115 ++++++++++++++++++++-
 common/menu.c                                    |   21 +++-
 5 files changed, 177 insertions(+), 16 deletions(-)
 create mode 100644 arch/arm/boards/beagle/env/config

Best Regards,
J.

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

#1 lore raw

PATCH 1/3 beagle: add default env support

update defconfig too to support oftree

---
 arch/arm/boards/beagle/env/config          |   39 ++++++++++++++++++++++++++++
 arch/arm/configs/omap3530_beagle_defconfig |   16 ++++++++---
 2 files changed, 51 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/boards/beagle/env/config
arch/arm/boards/beagle/env/config new file +39 -0
new file mode 100644
index 0000000..927e96b
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# use 'dhcp' to do dhcp in barebox and in kernel
+# use 'none' if you want to skip kernel ip autoconfiguration
+ip=dhcp-barebox
+dhcp_vendor_id=barebox-beagle
+
+# or set your networking parameters here
+#eth0.ipaddr=a.b.c.d
+#eth0.netmask=a.b.c.d
+#eth0.gateway=a.b.c.d
+#eth0.serverip=a.b.c.d
+
+# can be either 'nfs', 'tftp' or 'nand'
+kernel_loc=nfs
+# can be either 'net', 'nand' or 'initrd'
+rootfs_loc=net
+# can be either 'nfs', 'tftp', 'nand' or empty
+oftree_loc=nfs
+
+# can be either 'jffs2' or 'ubifs'
+rootfs_type=ubifs
+rootfsimage=root.$rootfs_type
+
+kernelimage=zImage
+#kernelimage=uImage
+#kernelimage=Image
+#kernelimage=Image.lzo
+
+nand_device=omap2-nand
+nand_parts="128k(xload),256k(barebox)ro,128k(bareboxenv),128k(oftree),4M(kernel),120M(rootfs),-(data)"
+rootfs_mtdblock_nand=5
+
+autoboot_timeout=3
+
+bootargs="console=ttyO2,115200"
+
+# set a fancy prompt (if support is compiled in)
+PS1="\e[1;32mbarebox@\e[1;31m\h:\w\e[0m\n# "
arch/arm/configs/omap3530_beagle_defconfig +12 -4
index 621bd49..1b0a163 100644
@@ -2,32 +2,40 @@ CONFIG_ARCH_OMAP=y
 # CONFIG_OMAP3_COPY_CLOCK_SRAM is not set
 CONFIG_MACH_BEAGLE=y
 CONFIG_AEABI=y
+CONFIG_THUMB2_BAREBOX=y
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 CONFIG_ARM_UNWIND=y
+CONFIG_MMU=y
 CONFIG_TEXT_BASE=0x81000000
+CONFIG_MALLOC_SIZE=0xa00000
 CONFIG_PROMPT="barebox> "
 CONFIG_LONGHELP=y
 CONFIG_GLOB=y
 CONFIG_HUSH_FANCY_PROMPT=y
-CONFIG_HUSH_GETOPT=y
 CONFIG_CMDLINE_EDITING=y
 CONFIG_AUTO_COMPLETE=y
 # CONFIG_TIMESTAMP is not set
-CONFIG_PARTITION=y
 CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/beagle/env/"
 CONFIG_CMD_EDIT=y
 CONFIG_CMD_SLEEP=y
 CONFIG_CMD_SAVEENV=y
-CONFIG_CMD_LOADENV=y
 CONFIG_CMD_EXPORT=y
 CONFIG_CMD_PRINTENV=y
 CONFIG_CMD_READLINE=y
 CONFIG_CMD_ECHO_E=y
 CONFIG_CMD_LOADB=y
 CONFIG_CMD_FLASH=y
-# CONFIG_CMD_BOOTM is not set
+CONFIG_CMD_BOOTM_SHOW_TYPE=y
+CONFIG_CMD_BOOTM_VERBOSE=y
+CONFIG_CMD_BOOTM_INITRD=y
+CONFIG_CMD_BOOTM_OFTREE=y
+CONFIG_CMD_BOOTM_OFTREE_UIMAGE=y
+CONFIG_CMD_UIMAGE=y
+# CONFIG_CMD_BOOTU is not set
 CONFIG_CMD_RESET=y
 CONFIG_CMD_GO=y
+CONFIG_CMD_OFTREE=y
 CONFIG_CMD_TIMEOUT=y
 CONFIG_CMD_PARTITION=y
 CONFIG_CMD_GPIO=y
Signature · 7 lines
1.7.9.1


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

Re: [PATCH 1/3] beagle: add default env support

Quoted 2 lines · Jean-Christophe PLAGNIOL-VILLARD

update defconfig too to support oftree

.../...

arch/arm/boards/beagle/env/config line 20

Quoted 7 lines
arch/arm/boards/beagle/env/config new file +7 -0
+# can be either 'nfs', 'tftp' or 'nand'
+kernel_loc=nfs
+# can be either 'net', 'nand' or 'initrd'
+rootfs_loc=net
+# can be either 'nfs', 'tftp', 'nand' or empty
+oftree_loc=nfs
+

I understand that NFS can be useful for development, but I think we should have a default configuration for the "standard" way to use the board. In the present case, this is booting from a SDCard and not from NFS.

Eric

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

#3 lore raw

Re: [PATCH 1/3] beagle: add default env support

Quoted 6 lines · Eric Bénard
Quoted 2 lines · Jean-Christophe PLAGNIOL-VILLARD

update defconfig too to support oftree

.../...

Quoted 11 lines

arch/arm/boards/beagle/env/config line 20

Quoted 7 lines
arch/arm/boards/beagle/env/config new file +7 -0
+# can be either 'nfs', 'tftp' or 'nand'
+kernel_loc=nfs
+# can be either 'net', 'nand' or 'initrd'
+rootfs_loc=net
+# can be either 'nfs', 'tftp', 'nand' or empty
+oftree_loc=nfs
+

I understand that NFS can be useful for development, but I think we should have a default configuration for the "standard" way to use the board. In the present case, this is booting from a SDCard and not from NFS.

boot from SD card does not work barebox does not detect the SDCard on any version

I try on via beagle c3
with 2GB and 8GB

where my loco deteect it both

Best Regards,
J.

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

#4 lore raw

PATCH 2/3 beagle: add xloader boot menu support

In reply to Jean-Christophe PLAGNIOL-VILLARD

This will allow to choice where we boot from.
As example if the nand boot is broken we can choose to boot from mmc. The autoboot is set to 1s as most of the time you expect to boot from the default boot.

As the xloader need to be really small to fit in the sram the boot menu allow to add user interaction.

---
 arch/arm/mach-omap/xload.c |  115 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 109 insertions(+), 6 deletions(-)
arch/arm/mach-omap/xload.c +109 -6
index 59f75e2..90bf05f 100644
@@ -3,10 +3,12 @@
 #include <nand.h>
 #include <driver.h>
 #include <linux/mtd/mtd.h>
+#include <linux/err.h>
 #include <fs.h>
 #include <fcntl.h>
 #include <mach/xload.h>
 #include <sizes.h>
+#include <menu.h>
 
 void *omap_xload_boot_nand(int offset, int size)
 {
@@ -63,15 +65,11 @@ enum omap_boot_src omap_bootsrc(void)
 #endif
 }
 
-/*
- * Replaces the default shell in xload configuration
- */
-int run_shell(void)
+static void xload_boot(enum omap_boot_src mode)
 {
 	int (*func)(void) = NULL;
 
-	switch (omap_bootsrc())
-	{
+	switch (mode) {
 	case OMAP_BOOTSRC_MMC1:
 		printf("booting from MMC1\n");
 		func = omap_xload_boot_mmc();
@@ -94,3 +92,108 @@ int run_shell(void)
 
 	while (1);
 }
+
+#ifdef CONFIG_MENU
+struct action_entry {
+	enum omap_boot_src mode;
+	struct menu_entry entry;
+};
+
+static void menu_action_command(struct menu *m, struct menu_entry *me)
+{
+	struct action_entry *e = container_of(me, struct action_entry, entry);
+
+	xload_boot(e->mode);
+}
+
+static void menu_action_free(struct menu_entry *me)
+{
+	struct action_entry *e = container_of(me, struct action_entry, entry);
+
+	free(e->entry.display);
+
+	free(e);
+}
+
+static struct menu_entry *menu_add_boot_entry(struct menu *m, const char *display,
+					      enum omap_boot_src mode)
+{
+	struct action_entry *e = calloc(1, sizeof(*e));
+	int ret;
+
+	if (!e)
+		return NULL;
+
+	e->mode = mode;
+	e->entry.action = menu_action_command;
+	e->entry.free = menu_action_free;
+	e->entry.type = 0;
+	e->entry.display = strdup(display);
+
+	ret = menu_add_entry(m, &e->entry);
+	if (ret)
+		goto err_free;
+
+	return &e->entry;
+err_free:
+	menu_action_free(&e->entry);
+	return NULL;
+}
+
+int run_shell(void)
+{
+	struct menu *m;
+	struct menu_entry *mmc1, *nand;
+	int ret = -ENOMEM;
+	enum omap_boot_src mode = omap3_bootsrc();
+
+	m = menu_alloc();
+
+	if (!m)
+		goto boot;
+
+	m->name = strdup("boot");
+
+	if (!m->name)
+		goto boot;
+
+	ret = menu_add(m);
+	if (ret)
+		goto boot;
+
+	mmc1 = menu_add_boot_entry(m, "Boot from mmc1", OMAP_BOOTSRC_MMC1);
+	if (!mmc1)
+		goto boot;
+
+	nand = menu_add_boot_entry(m, "Boot from nand", OMAP_BOOTSRC_NAND);
+	if (!nand)
+		goto boot;
+
+	switch (mode)
+	{
+	case OMAP_BOOTSRC_MMC1:
+		menu_set_selected_entry(m, mmc1);
+		break;
+	case OMAP_BOOTSRC_UNKNOWN:
+	case OMAP_BOOTSRC_NAND:
+		menu_set_selected_entry(m, nand);
+		break;
+	}
+
+	menu_set_auto_select(m, 1);
+
+	menu_show(m);
+
+boot:
+	xload_boot(mode);
+
+	return 0;
+}
+#else
+int run_shell(void)
+{
+	xload_boot(omap_bootsrc());
+
+	return 0;
+}
+#endif
Signature · 7 lines
1.7.9.1


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

PATCH 3/3 beagle/xload: update defconfig

In reply to Jean-Christophe PLAGNIOL-VILLARD

enable Thumb2 and menu support

---
 arch/arm/configs/omap3530_beagle_xload_defconfig |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/configs/omap3530_beagle_xload_defconfig +2 -0
index d951b1c..8a1fe84 100644
@@ -2,6 +2,7 @@ CONFIG_ARCH_OMAP=y
 CONFIG_OMAP_BUILD_IFT=y
 CONFIG_MACH_BEAGLE=y
 CONFIG_AEABI=y
+CONFIG_THUMB2_BAREBOX=y
 # CONFIG_CMD_ARM_CPUINFO is not set
 # CONFIG_ARM_EXCEPTIONS is not set
 CONFIG_TEXT_BASE=0x40200000
@@ -12,6 +13,7 @@ CONFIG_MALLOC_BASE=0x87BFFF10
 CONFIG_MALLOC_DUMMY=y
 CONFIG_PROMPT="X-load Beagle>"
 CONFIG_SHELL_NONE=y
+CONFIG_MENU=y
 # CONFIG_ERRNO_MESSAGES is not set
 # CONFIG_TIMESTAMP is not set
 # CONFIG_CONSOLE_FULL is not set
Signature · 7 lines
1.7.9.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw
In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD

Hi,

The following patch seri add the support of a boot menu in the xloader

This will allow to choice where we boot from.
As example if the nand boot is broken we can choose to boot from mmc. The autoboot is set to 1s as most of the time you expect to boot from the default boot.

No, please no delays which can't be configured away.

Sascha

Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw
Quoted 11 lines · Sascha Hauer
Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD

Hi,

The following patch seri add the support of a boot menu in the xloader

This will allow to choice where we boot from.
As example if the nand boot is broken we can choose to boot from mmc. The autoboot is set to 1s as most of the time you expect to boot from the default boot.

No, please no delays which can't be configured away.

with no delay the first entry is selected so minimal delay is 1s

The idea is that even you boot from nand you can load the code from MMC for barebox

Best Rebards,
J.

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

#8 lore raw
In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 9 lines · Jean-Christophe PLAGNIOL-VILLARD

Hi,

The following patch seri add the support of a boot menu in the xloader

This will allow to choice where we boot from.
As example if the nand boot is broken we can choose to boot from mmc. The autoboot is set to 1s as most of the time you expect to boot from the default boot.

Quoted 5 lines

As the xloader need to be really small to fit in the sram the boot menu allow to add user interaction.

This pull request also include
menu: enable the fancy color support only if HUSH is enabled

Doesn't the Beagle board have a button which lets you decide whether you want to boot from NAND or SD card? Then I don't see a reason to make the first stage loader interactive. Adding a delay in the first stage is not acceptable aswell, at least not without letting us the choice whether we want to have it or not.

Sascha

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