Patchwork [U-Boot] bootm: Add support for Plan 9

login
register
mail settings
Submitter Steven Stallion
Date March 18, 2013, 6:12 a.m.
Message ID <CAGGHmKHs+j0rb8nazhTQsREcXWtNVrE32KCNRhy5ZC2dhsomCQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/228378/
State Changes Requested
Delegated to: Wolfgang Denk
Headers show

Comments

Steven Stallion - March 18, 2013, 6:12 a.m.
From 902b728b8bcacecf9e2ea7854cc1e3777c2fd4e3 Mon Sep 17 00:00:00 2001

Apologies for the second patch; I did not realize at the time that
modifications were needed for bootm to function correctly.

---
 common/cmd_bootm.c        | 39 +++++++++++++++++++++++++++++++++++++++
 include/config_defaults.h |  1 +
 2 files changed, 40 insertions(+)
Wolfgang Denk - March 18, 2013, 8:27 a.m.
Dear Steven,

In message <CAGGHmKHs+j0rb8nazhTQsREcXWtNVrE32KCNRhy5ZC2dhsomCQ@mail.gmail.com> you wrote:
>
> From 902b728b8bcacecf9e2ea7854cc1e3777c2fd4e3 Mon Sep 17 00:00:00 2001
> 
> Apologies for the second patch; I did not realize at the time that
> modifications were needed for bootm to function correctly.
> 
> ---

I guess the text above is not supposed to become part of the commit
message - as you posted it, it would.  Please move such comments below
the "---" separator line.

Also, your posting is missing the (mandatory) Signed-off-by: line.

And for repostings / updated versions of patches we expect a history
of changes.

I recommend you re-read the rules for patch submissions, especially
here [1] and here [2].


> +#endif
>  #if defined(CONFIG_CMD_ELF)
>   [IH_OS_VXWORKS] = do_bootm_vxworks,
>   [IH_OS_QNX] = do_bootm_qnxelf,

And finally, your patch is white-space corerupted.  Please fix your
mailer before resubmitting.  gmail is NOT a good client to use here.
Why don't you send your patch using "git send-email" as recommended?

[1] http://www.denx.de/wiki/view/U-Boot/Patches#General_Patch_Submission_Rules
[2] http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions

Best regards,

Wolfgang Denk

Patch

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 5d2ce00..7438469 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -128,6 +128,9 @@  static boot_os_fn do_bootm_rtems;
 #if defined(CONFIG_BOOTM_OSE)
 static boot_os_fn do_bootm_ose;
 #endif
+#if defined(CONFIG_BOOTM_PLAN9)
+static boot_os_fn do_bootm_plan9;
+#endif
 #if defined(CONFIG_CMD_ELF)
 static boot_os_fn do_bootm_vxworks;
 static boot_os_fn do_bootm_qnxelf;
@@ -154,6 +157,9 @@  static boot_os_fn *boot_os[] = {
 #if defined(CONFIG_BOOTM_OSE)
  [IH_OS_OSE] = do_bootm_ose,
 #endif
+#if defined(CONFIG_BOOTM_PLAN9)
+ [IH_OS_PLAN9] = do_bootm_plan9,
+#endif
 #if defined(CONFIG_CMD_ELF)
  [IH_OS_VXWORKS] = do_bootm_vxworks,
  [IH_OS_QNX] = do_bootm_qnxelf,
@@ -1628,6 +1634,39 @@  static int do_bootm_ose(int flag, int argc, char *
const argv[],
 }
 #endif /* CONFIG_BOOTM_OSE */

+#if defined(CONFIG_BOOTM_PLAN9)
+static int do_bootm_plan9(int flag, int argc, char * const argv[],
+   bootm_headers_t *images)
+{
+ void (*entry_point)(void);
+
+ if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
+ return 1;
+
+#if defined(CONFIG_FIT)
+ if (!images->legacy_hdr_valid) {
+ fit_unsupported_reset("Plan 9");
+ return 1;
+ }
+#endif
+
+ entry_point = (void (*)(void))images->ep;
+
+ printf("## Transferring control to Plan 9 (at address %08lx) ...\n",
+ (ulong)entry_point);
+
+ bootstage_mark(BOOTSTAGE_ID_RUN_OS);
+
+ /*
+ * Plan 9 Parameters:
+ *   None
+ */
+ (*entry_point)();
+
+ return 1;
+}
+#endif /* CONFIG_BOOTM_PLAN9 */
+
 #if defined(CONFIG_CMD_ELF)
 static int do_bootm_vxworks(int flag, int argc, char * const argv[],
      bootm_headers_t *images)
diff --git a/include/config_defaults.h b/include/config_defaults.h
index d023c63..567b46c 100644
--- a/include/config_defaults.h
+++ b/include/config_defaults.h
@@ -12,6 +12,7 @@ 
 /* Support bootm-ing different OSes */
 #define CONFIG_BOOTM_LINUX 1
 #define CONFIG_BOOTM_NETBSD 1
+#define CONFIG_BOOTM_PLAN9 1
 #define CONFIG_BOOTM_RTEMS 1

 #define CONFIG_GZIP 1