From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 05/12] ARM: call start_linux directly with initrd start/size and oftree
Date: Thu, 15 Dec 2011 11:30:27 +0100 [thread overview]
Message-ID: <1323945034-19687-6-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1323945034-19687-1-git-send-email-s.hauer@pengutronix.de>
whoever calls this function is not necessarily aware of a struct
image_data, so remove the dependency from the function.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/include/asm/armlinux.h | 3 ++-
arch/arm/lib/armlinux.c | 20 ++++++++++----------
arch/arm/lib/bootm.c | 3 ++-
arch/arm/lib/bootu.c | 8 +++++++-
arch/arm/lib/bootz.c | 7 ++++++-
5 files changed, 27 insertions(+), 14 deletions(-)
diff --git a/arch/arm/include/asm/armlinux.h b/arch/arm/include/asm/armlinux.h
index ba3a424..9ca1e4b 100644
--- a/arch/arm/include/asm/armlinux.h
+++ b/arch/arm/include/asm/armlinux.h
@@ -29,6 +29,7 @@ static inline void armlinux_set_serial(u64 serial)
struct image_data;
-void start_linux(void *adr, int swap, struct image_data *data);
+void start_linux(void *adr, int swap, unsigned long initrd_address,
+ unsigned long initrd_size, void *oftree);
#endif /* __ARCH_ARMLINUX_H */
diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c
index bd9b72a..1d210d1 100644
--- a/arch/arm/lib/armlinux.c
+++ b/arch/arm/lib/armlinux.c
@@ -224,7 +224,8 @@ static void setup_end_tag (void)
params->hdr.size = 0;
}
-static void setup_tags(struct image_data *data, int swap)
+static void setup_tags(unsigned long initrd_address,
+ unsigned long initrd_size, int swap)
{
const char *commandline = getenv("bootargs");
@@ -232,8 +233,8 @@ static void setup_tags(struct image_data *data, int swap)
setup_memory_tags();
setup_commandline_tag(commandline, swap);
- if (data && (data->initrd_size > 0))
- setup_initrd_tag(data->initrd_address, data->initrd_size);
+ if (initrd_size)
+ setup_initrd_tag(initrd_address, initrd_size);
setup_revision_tag();
setup_serial_tag();
@@ -249,17 +250,16 @@ void armlinux_set_bootparams(void *params)
armlinux_bootparams = params;
}
-void start_linux(void *adr, int swap, struct image_data *data)
+void start_linux(void *adr, int swap, unsigned long initrd_address,
+ unsigned long initrd_size, void *oftree)
{
void (*kernel)(int zero, int arch, void *params) = adr;
void *params = NULL;
-#ifdef CONFIG_OFTREE
- params = of_get_fixed_tree();
- if (params)
+
+ if (oftree) {
printf("booting Linux kernel with devicetree\n");
-#endif
- if (!params) {
- setup_tags(data, swap);
+ } else {
+ setup_tags(initrd_address, initrd_size, swap);
params = armlinux_bootparams;
}
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 031a269..1de22bf 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -31,7 +31,8 @@ static int do_bootm_linux(struct image_data *data)
/* we assume that the kernel is in place */
printf("\nStarting kernel %s...\n\n", data->initrd ? "with initrd " : "");
- start_linux(theKernel, 0, data);
+ start_linux((void *)theKernel, 0, data->initrd_address, data->initrd_size,
+ data->oftree);
return -1;
}
diff --git a/arch/arm/lib/bootu.c b/arch/arm/lib/bootu.c
index e97ded0..89d793a 100644
--- a/arch/arm/lib/bootu.c
+++ b/arch/arm/lib/bootu.c
@@ -3,12 +3,14 @@
#include <fs.h>
#include <fcntl.h>
#include <errno.h>
+#include <of.h>
#include <asm/armlinux.h>
static int do_bootu(struct command *cmdtp, int argc, char *argv[])
{
int fd;
void *kernel = NULL;
+ void *oftree = NULL;
if (argc != 2) {
barebox_cmd_usage(cmdtp);
@@ -22,7 +24,11 @@ static int do_bootu(struct command *cmdtp, int argc, char *argv[])
if (!kernel)
kernel = (void *)simple_strtoul(argv[1], NULL, 0);
- start_linux(kernel, 0, NULL);
+#ifdef CONFIG_OFTREE
+ oftree = of_get_fixed_tree();
+#endif
+
+ start_linux(kernel, 0, 0, 0, oftree);
return 1;
}
diff --git a/arch/arm/lib/bootz.c b/arch/arm/lib/bootz.c
index 956ea82..40facf6 100644
--- a/arch/arm/lib/bootz.c
+++ b/arch/arm/lib/bootz.c
@@ -1,6 +1,7 @@
#include <common.h>
#include <command.h>
#include <fs.h>
+#include <of.h>
#include <fcntl.h>
#include <errno.h>
#include <malloc.h>
@@ -25,6 +26,7 @@ static int do_bootz(struct command *cmdtp, int argc, char *argv[])
int fd, ret, swap = 0;
struct zimage_header __header, *header;
void *zimage;
+ void *oftree = NULL;
u32 end;
int usemap = 0;
struct memory_bank *bank = list_first_entry(&memory_banks, struct memory_bank, list);
@@ -105,8 +107,11 @@ static int do_bootz(struct command *cmdtp, int argc, char *argv[])
}
printf("loaded zImage from %s with size %d\n", argv[1], end);
+#ifdef CONFIG_OFTREE
+ oftree = of_get_fixed_tree();
+#endif
- start_linux(zimage, swap, NULL);
+ start_linux(zimage, swap, 0, 0, oftree);
return 0;
--
1.7.7.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2011-12-15 10:31 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-15 10:30 reimplement bootm support Sascha Hauer
2011-12-15 10:30 ` [PATCH 01/12] oftree: add of_fix_tree() Sascha Hauer
2011-12-18 13:07 ` *** PROBABLY SPAM *** " Jean-Christophe PLAGNIOL-VILLARD
2011-12-19 10:31 ` Sascha Hauer
2011-12-20 14:03 ` Jean-Christophe PLAGNIOL-VILLARD
2011-12-23 17:14 ` Sascha Hauer
2011-12-25 6:09 ` Jean-Christophe PLAGNIOL-VILLARD
2012-01-02 11:49 ` Sascha Hauer
2011-12-15 10:30 ` [PATCH 02/12] filetype: Add oftree detection Sascha Hauer
2011-12-15 10:30 ` [PATCH 03/12] uncompress: implement uncompress_fd_to_buf Sascha Hauer
2011-12-15 10:30 ` [PATCH 04/12] libbb: add read_full/write_full functions Sascha Hauer
2011-12-15 10:30 ` Sascha Hauer [this message]
2011-12-15 10:30 ` [PATCH 06/12] reimplement uImage code Sascha Hauer
2011-12-15 13:33 ` *** PROBABLY SPAM *** " Jean-Christophe PLAGNIOL-VILLARD
2011-12-15 15:27 ` Sascha Hauer
2011-12-15 16:20 ` Jean-Christophe PLAGNIOL-VILLARD
2011-12-15 16:39 ` Sascha Hauer
2011-12-15 10:30 ` [PATCH 07/12] bootm: use new uimage code Sascha Hauer
2011-12-15 10:30 ` [PATCH 08/12] add uimage command Sascha Hauer
2011-12-15 10:30 ` [PATCH 09/12] remove now obsolete iminfo command Sascha Hauer
2011-12-15 10:30 ` [PATCH 10/12] remove now unused uImage code Sascha Hauer
2011-12-15 10:30 ` [PATCH 11/12] move code now only used in mkimage to mkimage Sascha Hauer
2011-12-15 10:30 ` [PATCH 12/12] defaultenv: simplify boot Sascha Hauer
2011-12-15 13:37 ` *** PROBABLY SPAM *** reimplement bootm support Jean-Christophe PLAGNIOL-VILLARD
2011-12-15 14:47 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1323945034-19687-6-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox