* [U-Boot] [PATCH v2] bootm: Move to using a function pointer table for the boot os function
@ 2008-10-19 18:07 Kumar Gala
2008-10-19 18:44 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 6+ messages in thread
From: Kumar Gala @ 2008-10-19 18:07 UTC (permalink / raw)
To: u-boot
This removes a bit of code and makes it easier for the upcoming sub bootm
command support to call into the proper OS specific handler.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
Fix a bug that showed up in sub command testing in that we didn't sent the relocated
flag.
common/cmd_bootm.c | 68 +++++++++++++++++++++++----------------------------
1 files changed, 31 insertions(+), 37 deletions(-)
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index b02da3e..956e1a0 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -119,6 +119,22 @@ int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
static boot_os_fn do_bootm_integrity;
#endif
+boot_os_fn * boot_os[] = {
+ [IH_OS_LINUX] = do_bootm_linux,
+ [IH_OS_NETBSD] = do_bootm_netbsd,
+#ifdef CONFIG_LYNXKDI
+ [IH_OS_LYNXOS] = do_bootm_lynxkdi,
+#endif
+ [IH_OS_RTEMS] = do_bootm_rtems,
+#if defined(CONFIG_CMD_ELF)
+ [IH_OS_VXWORKS] = do_bootm_vxworks,
+ [IH_OS_QNX] = do_bootm_qnxelf,
+#endif
+#ifdef CONFIG_INTEGRITY
+ [IH_OS_INTEGRITY] = do_bootm_integrity,
+#endif
+};
+
ulong load_addr = CONFIG_SYS_LOAD_ADDR; /* Default Load Address */
static bootm_headers_t images; /* pointers to os/initrd/fdt images */
@@ -386,12 +402,22 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
/*******************************************************************/
/* bootm - boot application image from image in memory */
/*******************************************************************/
+static int relocated = 0;
+
int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
-
ulong iflag;
ulong load_end = 0;
int ret;
+ boot_os_fn *boot_fn;
+
+ /* relocate boot function table */
+ if (0 == relocated) {
+ int i;
+ for (i = 0; i < ARRAY_SIZE(boot_os); i++)
+ boot_os[i] += gd->reloc_off;
+ relocated = 1;
+ }
if (bootm_start(cmdtp, flag, argc, argv))
return 1;
@@ -454,45 +480,13 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
show_boot_progress (8);
- switch (images.os.os) {
- default: /* handled by (original) Linux case */
- case IH_OS_LINUX:
#ifdef CONFIG_SILENT_CONSOLE
- fixup_silent_linux();
-#endif
- do_bootm_linux (0, argc, argv, &images);
- break;
-
- case IH_OS_NETBSD:
- do_bootm_netbsd (0, argc, argv, &images);
- break;
-
-#ifdef CONFIG_LYNXKDI
- case IH_OS_LYNXOS:
- do_bootm_lynxkdi (0, argc, argv, &images);
- break;
+ if (images.os.os == IH_OS_LINUX)
+ fixup_silent_linux();
#endif
- case IH_OS_RTEMS:
- do_bootm_rtems (0, argc, argv, &images);
- break;
-
-#if defined(CONFIG_CMD_ELF)
- case IH_OS_VXWORKS:
- do_bootm_vxworks (0, argc, argv, &images);
- break;
-
- case IH_OS_QNX:
- do_bootm_qnxelf (0, argc, argv, &images);
- break;
-#endif
-
-#ifdef CONFIG_INTEGRITY
- case IH_OS_INTEGRITY:
- do_bootm_integrity (0, argc, argv, &images);
- break;
-#endif
- }
+ boot_fn = boot_os[images.os.os];
+ boot_fn(0, argc, argv, &images);
show_boot_progress (-9);
#ifdef DEBUG
--
1.5.5.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH v2] bootm: Move to using a function pointer table for the boot os function
2008-10-19 18:07 [U-Boot] [PATCH v2] bootm: Move to using a function pointer table for the boot os function Kumar Gala
@ 2008-10-19 18:44 ` Jean-Christophe PLAGNIOL-VILLARD
2008-10-19 22:46 ` Kumar Gala
0 siblings, 1 reply; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-10-19 18:44 UTC (permalink / raw)
To: u-boot
On 13:07 Sun 19 Oct , Kumar Gala wrote:
> This removes a bit of code and makes it easier for the upcoming sub bootm
> command support to call into the proper OS specific handler.
>
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> ---
>
> Fix a bug that showed up in sub command testing in that we didn't sent the relocated
> flag.
>
> common/cmd_bootm.c | 68 +++++++++++++++++++++++----------------------------
> 1 files changed, 31 insertions(+), 37 deletions(-)
>
> diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
> index b02da3e..956e1a0 100644
> --- a/common/cmd_bootm.c
> +++ b/common/cmd_bootm.c
> @@ -119,6 +119,22 @@ int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
> static boot_os_fn do_bootm_integrity;
> #endif
>
> +boot_os_fn * boot_os[] = {
> + [IH_OS_LINUX] = do_bootm_linux,
> + [IH_OS_NETBSD] = do_bootm_netbsd,
why not add config to ative or not netbsd, linux and rterms to reduce U-Boot
size?
Best Regards,
J.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH v2] bootm: Move to using a function pointer table for the boot os function
2008-10-19 18:44 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2008-10-19 22:46 ` Kumar Gala
2008-10-20 7:28 ` Wolfgang Denk
0 siblings, 1 reply; 6+ messages in thread
From: Kumar Gala @ 2008-10-19 22:46 UTC (permalink / raw)
To: u-boot
On Oct 19, 2008, at 1:44 PM, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 13:07 Sun 19 Oct , Kumar Gala wrote:
>> This removes a bit of code and makes it easier for the upcoming sub
>> bootm
>> command support to call into the proper OS specific handler.
>>
>> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
>> ---
>>
>> Fix a bug that showed up in sub command testing in that we didn't
>> sent the relocated
>> flag.
>>
>> common/cmd_bootm.c | 68 ++++++++++++++++++++++
>> +----------------------------
>> 1 files changed, 31 insertions(+), 37 deletions(-)
>>
>> diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
>> index b02da3e..956e1a0 100644
>> --- a/common/cmd_bootm.c
>> +++ b/common/cmd_bootm.c
>> @@ -119,6 +119,22 @@ int do_bootelf (cmd_tbl_t *cmdtp, int flag,
>> int argc, char *argv[]);
>> static boot_os_fn do_bootm_integrity;
>> #endif
>>
>> +boot_os_fn * boot_os[] = {
>> + [IH_OS_LINUX] = do_bootm_linux,
>> + [IH_OS_NETBSD] = do_bootm_netbsd,
> why not add config to ative or not netbsd, linux and rterms to
> reduce U-Boot
> size?
ative?
that would be an orthogonal change.
- k
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH v2] bootm: Move to using a function pointer table for the boot os function
2008-10-19 22:46 ` Kumar Gala
@ 2008-10-20 7:28 ` Wolfgang Denk
2008-10-20 13:14 ` Kumar Gala
0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Denk @ 2008-10-20 7:28 UTC (permalink / raw)
To: u-boot
Dear Kumar Gala,
In message <6FA5D356-5762-4185-BD0C-1CE3BDEDE2D9@kernel.crashing.org> you wrote:
>
> >> This removes a bit of code and makes it easier for the upcoming sub
> >> bootm
> >> command support to call into the proper OS specific handler.
> >>
> >> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> >> ---
...
> >> @@ -119,6 +119,22 @@ int do_bootelf (cmd_tbl_t *cmdtp, int flag,
> >> int argc, char *argv[]);
> >> static boot_os_fn do_bootm_integrity;
> >> #endif
> >>
> >> +boot_os_fn * boot_os[] = {
> >> + [IH_OS_LINUX] = do_bootm_linux,
> >> + [IH_OS_NETBSD] = do_bootm_netbsd,
> > why not add config to ative or not netbsd, linux and rterms to
> > reduce U-Boot
> > size?
>
> ative?
>
> that would be an orthogonal change.
One that we should implement, I think.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Drawing on my fine command of language, I said nothing.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH v2] bootm: Move to using a function pointer table for the boot os function
2008-10-20 7:28 ` Wolfgang Denk
@ 2008-10-20 13:14 ` Kumar Gala
2008-10-21 19:22 ` Wolfgang Denk
0 siblings, 1 reply; 6+ messages in thread
From: Kumar Gala @ 2008-10-20 13:14 UTC (permalink / raw)
To: u-boot
On Oct 20, 2008, at 2:28 AM, Wolfgang Denk wrote:
> Dear Kumar Gala,
>
> In message <6FA5D356-5762-4185-
> BD0C-1CE3BDEDE2D9 at kernel.crashing.org> you wrote:
>>
>>>> This removes a bit of code and makes it easier for the upcoming sub
>>>> bootm
>>>> command support to call into the proper OS specific handler.
>>>>
>>>> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
>>>> ---
> ...
>>>> @@ -119,6 +119,22 @@ int do_bootelf (cmd_tbl_t *cmdtp, int flag,
>>>> int argc, char *argv[]);
>>>> static boot_os_fn do_bootm_integrity;
>>>> #endif
>>>>
>>>> +boot_os_fn * boot_os[] = {
>>>> + [IH_OS_LINUX] = do_bootm_linux,
>>>> + [IH_OS_NETBSD] = do_bootm_netbsd,
>>> why not add config to ative or not netbsd, linux and rterms to
>>> reduce U-Boot
>>> size?
>>
>> ative?
>>
>> that would be an orthogonal change.
>
> One that we should implement, I think.
So this means introducing CONFIG_BOOT_RTEMS, CONFIG_BOOT_NETBSD, and
CONFIG_BOOT_LINUX.
Should these be enabled in all board configs by default?
- k
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH v2] bootm: Move to using a function pointer table for the boot os function
2008-10-20 13:14 ` Kumar Gala
@ 2008-10-21 19:22 ` Wolfgang Denk
0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Denk @ 2008-10-21 19:22 UTC (permalink / raw)
To: u-boot
Dear Kumar Gala,
In message <80445EB2-8BF8-4DE2-859E-D9505B4AF75C@kernel.crashing.org> you wrote:
>
> > One that we should implement, I think.
>
> So this means introducing CONFIG_BOOT_RTEMS, CONFIG_BOOT_NETBSD, and
> CONFIG_BOOT_LINUX.
ACK.
> Should these be enabled in all board configs by default?
I recommend to enable only CONFIG_BOOT_LINUX by default.
Board maintainers, please register now if you have different needs :-)
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If a man had a child who'd gone anti-social, killed perhaps, he'd
still tend to protect that child.
-- McCoy, "The Ultimate Computer", stardate 4731.3
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-10-21 19:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-19 18:07 [U-Boot] [PATCH v2] bootm: Move to using a function pointer table for the boot os function Kumar Gala
2008-10-19 18:44 ` Jean-Christophe PLAGNIOL-VILLARD
2008-10-19 22:46 ` Kumar Gala
2008-10-20 7:28 ` Wolfgang Denk
2008-10-20 13:14 ` Kumar Gala
2008-10-21 19:22 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox