diff mbox

[U-Boot] bootm: relocate names of sub-command table for archs with CONFIG_NEEDS_MANUAL_RELOC

Message ID 1357577692-29227-1-git-send-email-daniel.schwierzeck@gmail.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Daniel Schwierzeck Jan. 7, 2013, 4:54 p.m. UTC
From: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

To make bootm sub-command feature working on archs with CONFIG_NEEDS_MANUAL_RELOC,
the name pointers in the sub-command table need to be relocated.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
---
 common/cmd_bootm.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Tom Rini Jan. 10, 2013, 9:43 p.m. UTC | #1
On Mon, Jan 07, 2013 at 06:54:52AM -0000, Daniel Schwierzeck wrote:

> From: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> 
> To make bootm sub-command feature working on archs with CONFIG_NEEDS_MANUAL_RELOC,
> the name pointers in the sub-command table need to be relocated.
> 
> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index f7595c0..1b8a8c1 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -592,12 +592,18 @@  int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
 	static int relocated = 0;
 
-	/* relocate boot function table */
 	if (!relocated) {
 		int i;
+
+		/* relocate boot function table */
 		for (i = 0; i < ARRAY_SIZE(boot_os); i++)
 			if (boot_os[i] != NULL)
 				boot_os[i] += gd->reloc_off;
+
+		/* relocate names of sub-command table */
+		for (i = 0; i < ARRAY_SIZE(cmd_bootm_sub); i++)
+			cmd_bootm_sub[i].name += gd->reloc_off;
+
 		relocated = 1;
 	}
 #endif