bootm: use initrd_address and initrd_size
Make these fields in struct image_data the reference for image handlers Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
351058fa51
commit
d4950552f5
|
@ -200,7 +200,7 @@ static void setup_serial_tag(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setup_initrd_tag(image_header_t *header)
|
static void setup_initrd_tag(unsigned long start, unsigned long size)
|
||||||
{
|
{
|
||||||
/* an ATAG_INITRD node tells the kernel where the compressed
|
/* an ATAG_INITRD node tells the kernel where the compressed
|
||||||
* ramdisk can be found. ATAG_RDIMG is a better name, actually.
|
* ramdisk can be found. ATAG_RDIMG is a better name, actually.
|
||||||
|
@ -208,8 +208,8 @@ static void setup_initrd_tag(image_header_t *header)
|
||||||
params->hdr.tag = ATAG_INITRD2;
|
params->hdr.tag = ATAG_INITRD2;
|
||||||
params->hdr.size = tag_size(tag_initrd);
|
params->hdr.size = tag_size(tag_initrd);
|
||||||
|
|
||||||
params->u.initrd.start = image_get_load(header);
|
params->u.initrd.start = start;
|
||||||
params->u.initrd.size = image_get_data_size(header);
|
params->u.initrd.size = size;
|
||||||
|
|
||||||
params = tag_next(params);
|
params = tag_next(params);
|
||||||
}
|
}
|
||||||
|
@ -228,8 +228,8 @@ static void setup_tags(struct image_data *data, int swap)
|
||||||
setup_memory_tags();
|
setup_memory_tags();
|
||||||
setup_commandline_tag(commandline, swap);
|
setup_commandline_tag(commandline, swap);
|
||||||
|
|
||||||
if (data && data->initrd)
|
if (data && (data->initrd_size > 0))
|
||||||
setup_initrd_tag (&data->initrd->header);
|
setup_initrd_tag(data->initrd_address, data->initrd_size);
|
||||||
|
|
||||||
setup_revision_tag();
|
setup_revision_tag();
|
||||||
setup_serial_tag();
|
setup_serial_tag();
|
||||||
|
|
|
@ -181,9 +181,6 @@ static int do_bootm(struct command *cmdtp, int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.initrd && data.initrd_address != ~0)
|
|
||||||
data.initrd->header.ih_load = cpu_to_uimage(data.initrd_address);
|
|
||||||
|
|
||||||
if (optind == argc) {
|
if (optind == argc) {
|
||||||
ret = COMMAND_ERROR_USAGE;
|
ret = COMMAND_ERROR_USAGE;
|
||||||
goto err_out;
|
goto err_out;
|
||||||
|
@ -221,8 +218,12 @@ static int do_bootm(struct command *cmdtp, int argc, char *argv[])
|
||||||
goto err_out;
|
goto err_out;
|
||||||
|
|
||||||
if (data.initrd) {
|
if (data.initrd) {
|
||||||
ret = relocate_image(data.initrd,
|
if (data.initrd && data.initrd_address == ~0)
|
||||||
(void *)image_get_load(&data.initrd->header));
|
data.initrd_address = uimage_to_cpu(data.initrd->header.ih_load);
|
||||||
|
|
||||||
|
data.initrd_size = image_get_data_size(&data.initrd->header);
|
||||||
|
|
||||||
|
ret = relocate_image(data.initrd, (void *)data.initrd_address);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ struct image_data {
|
||||||
const char *oftree;
|
const char *oftree;
|
||||||
int verify;
|
int verify;
|
||||||
unsigned long initrd_address;
|
unsigned long initrd_address;
|
||||||
|
unsigned long initrd_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct image_handler {
|
struct image_handler {
|
||||||
|
|
Loading…
Reference in New Issue