9
0
Fork 0

ARM: call start_linux directly with initrd start/size and oftree

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>
This commit is contained in:
Sascha Hauer 2011-12-12 10:43:33 +01:00
parent 4c41e245cf
commit 296cd8d638
5 changed files with 27 additions and 14 deletions

View File

@ -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 */

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;