* [PATCH 01/15] Make bootm optionally use pre-existing atags for Linux kernel boot.
@ 2010-09-01 22:07 Alistair Buxton
0 siblings, 0 replies; only message in thread
From: Alistair Buxton @ 2010-09-01 22:07 UTC (permalink / raw)
To: u-boot
This patch adapts the bootm command so that it can use an existing atags command
set up by a previous bootloader. If the environment variable "atags" is unset,
bootm behaves as normal. If "atags" is set, bootm will skip all boot args setup
entirely, and pass the address found in "atags". For example, if a previous boot
loader already set up the atags struct at 0x80000100:
setenv atags 0x80000100; bootm 0x80008000
Signed-off-by: Alistair Buxton <a.j.buxton@gmail.com>
---
arch/arm/lib/bootm.c | 37 ++++++++++++++++++++++++++++---------
1 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 802e833..262efda 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -100,6 +100,13 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
int machid = bd->bi_arch_number;
void (*kernel_entry)(int zero, int arch, uint params);
+#ifdef CONFIG_CHAINLOADER
+ uint params;
+ #define PARAMS params
+#else
+ #define PARAMS (bd->bi_boot_params)
+#endif
+
#ifdef CONFIG_CMDLINE_TAG
char *commandline = getenv ("bootargs");
#endif
@@ -125,34 +132,46 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
debug ("## Transferring control to Linux (at address %08lx) ...\n",
(ulong) kernel_entry);
+#ifdef CONFIG_CHAINLOADER
+ s = getenv ("atags");
+ if (s) {
+ params = simple_strtoul (s, NULL, 16);
+ printf ("Using existing atags at 0x%x\n", params);
+ } else {
+#endif
+
#if defined (CONFIG_SETUP_MEMORY_TAGS) || \
defined (CONFIG_CMDLINE_TAG) || \
defined (CONFIG_INITRD_TAG) || \
defined (CONFIG_SERIAL_TAG) || \
defined (CONFIG_REVISION_TAG)
- setup_start_tag (bd);
+ setup_start_tag (bd);
#ifdef CONFIG_SERIAL_TAG
- setup_serial_tag (¶ms);
+ setup_serial_tag (¶ms);
#endif
#ifdef CONFIG_REVISION_TAG
- setup_revision_tag (¶ms);
+ setup_revision_tag (¶ms);
#endif
#ifdef CONFIG_SETUP_MEMORY_TAGS
- setup_memory_tags (bd);
+ setup_memory_tags (bd);
#endif
#ifdef CONFIG_CMDLINE_TAG
- setup_commandline_tag (bd, commandline);
+ setup_commandline_tag (bd, commandline);
#endif
#ifdef CONFIG_INITRD_TAG
- if (images->rd_start && images->rd_end)
- setup_initrd_tag (bd, images->rd_start, images->rd_end);
+ if (images->rd_start && images->rd_end)
+ setup_initrd_tag (bd, images->rd_start, images->rd_end);
+#endif
+ setup_end_tag(bd);
#endif
- setup_end_tag(bd);
+
+#ifdef CONFIG_CHAINLOADER
+ }
#endif
announce_and_cleanup();
- kernel_entry(0, machid, bd->bi_boot_params);
+ kernel_entry(0, machid, PARAMS);
/* does not return */
return 1;
--
1.7.4.1
--nextPart1511561.nRVgJThL9n
Content-Disposition: attachment; filename="0002-Store-existing-atags-at-startup-if-chainloading.patch"
Content-Transfer-Encoding: 7Bit
Content-Type: text/x-patch; charset="UTF-8"; name="0002-Store-existing-atags-at-startup-if-chainloading.patch"
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-09-01 22:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-01 22:07 [PATCH 01/15] Make bootm optionally use pre-existing atags for Linux kernel boot Alistair Buxton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.