diff mbox

[u-boot,v2,2/3] bootm: relocate ramdisk if CONFIG_SYS_BOOT_RAMDISK_HIGH set

Message ID 1480717624-24994-3-git-send-email-raltherr@google.com
State Superseded, archived
Headers show

Commit Message

Rick Altherr Dec. 2, 2016, 10:27 p.m. UTC
In 35fc84f, bootm was refactored so plain 'bootm' and
'bootm <subcommand>' shared a common implementation.
The 'bootm ramdisk' command implementation is now part of the common
implementation but not invoke by plain 'bootm' since the original
implementation never did ramdisk relocation.  Instead, ramdisk
relocation happened in image_setup_linux() which is typically called
during the OS portion of 'bootm'.

On ARM, parameters to the Linux kernel can either be passed by FDT or
ATAGS. When using FDT, image_setup_linux() is called which also triggers
ramdisk relocation.  When using ATAGS, image_setup_linux() is _not_
called because it mostly does FDT setup.

Instead of calling image_setup_linux() in both FDT and ATAGS cases,
include BOOTM_STATE_RAMDISK in the requested states during a plain
'bootm' if CONFIG_SYS_BOOT_RAMDISK_HIGH is set and remove the ramdisk
relocation from image_setup_linux().  This causes ramdisk relocation to
happen on any system where CONFIG_SYS_BOOT_RAMDISK_HIGH regardless of
the OS being booted.

Signed-off-by: Rick Altherr <raltherr@google.com>
---
 cmd/bootm.c    | 3 +++
 common/image.c | 7 -------
 2 files changed, 3 insertions(+), 7 deletions(-)

Comments

Simon Glass Dec. 5, 2016, 6:24 a.m. UTC | #1
Hi Rick,

On 2 December 2016 at 15:27, Rick Altherr <raltherr@google.com> wrote:
> In 35fc84f, bootm was refactored so plain 'bootm' and
> 'bootm <subcommand>' shared a common implementation.
> The 'bootm ramdisk' command implementation is now part of the common
> implementation but not invoke by plain 'bootm' since the original
> implementation never did ramdisk relocation.  Instead, ramdisk
> relocation happened in image_setup_linux() which is typically called
> during the OS portion of 'bootm'.
>
> On ARM, parameters to the Linux kernel can either be passed by FDT or
> ATAGS. When using FDT, image_setup_linux() is called which also triggers
> ramdisk relocation.  When using ATAGS, image_setup_linux() is _not_
> called because it mostly does FDT setup.
>
> Instead of calling image_setup_linux() in both FDT and ATAGS cases,
> include BOOTM_STATE_RAMDISK in the requested states during a plain
> 'bootm' if CONFIG_SYS_BOOT_RAMDISK_HIGH is set and remove the ramdisk
> relocation from image_setup_linux().  This causes ramdisk relocation to
> happen on any system where CONFIG_SYS_BOOT_RAMDISK_HIGH regardless of
> the OS being booted.
>
> Signed-off-by: Rick Altherr <raltherr@google.com>
> ---
>  cmd/bootm.c    | 3 +++
>  common/image.c | 7 -------
>  2 files changed, 3 insertions(+), 7 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

But why would you still be using ATAGS?

Regards,
Simon
Rick Altherr Dec. 5, 2016, 6:01 p.m. UTC | #2
I think that is an artifact of starting from the Aspeed SDK.  Once these
changes are in, I plan to propose changing to FIT+FDT.

On Sun, Dec 4, 2016 at 10:24 PM, Simon Glass <sjg@chromium.org> wrote:

> Hi Rick,
>
> On 2 December 2016 at 15:27, Rick Altherr <raltherr@google.com> wrote:
> > In 35fc84f, bootm was refactored so plain 'bootm' and
> > 'bootm <subcommand>' shared a common implementation.
> > The 'bootm ramdisk' command implementation is now part of the common
> > implementation but not invoke by plain 'bootm' since the original
> > implementation never did ramdisk relocation.  Instead, ramdisk
> > relocation happened in image_setup_linux() which is typically called
> > during the OS portion of 'bootm'.
> >
> > On ARM, parameters to the Linux kernel can either be passed by FDT or
> > ATAGS. When using FDT, image_setup_linux() is called which also triggers
> > ramdisk relocation.  When using ATAGS, image_setup_linux() is _not_
> > called because it mostly does FDT setup.
> >
> > Instead of calling image_setup_linux() in both FDT and ATAGS cases,
> > include BOOTM_STATE_RAMDISK in the requested states during a plain
> > 'bootm' if CONFIG_SYS_BOOT_RAMDISK_HIGH is set and remove the ramdisk
> > relocation from image_setup_linux().  This causes ramdisk relocation to
> > happen on any system where CONFIG_SYS_BOOT_RAMDISK_HIGH regardless of
> > the OS being booted.
> >
> > Signed-off-by: Rick Altherr <raltherr@google.com>
> > ---
> >  cmd/bootm.c    | 3 +++
> >  common/image.c | 7 -------
> >  2 files changed, 3 insertions(+), 7 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> But why would you still be using ATAGS?
>
> Regards,
> Simon
>
diff mbox

Patch

diff --git a/cmd/bootm.c b/cmd/bootm.c
index 16fdea5..8da750e 100644
--- a/cmd/bootm.c
+++ b/cmd/bootm.c
@@ -131,6 +131,9 @@  int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	return do_bootm_states(cmdtp, flag, argc, argv, BOOTM_STATE_START |
 		BOOTM_STATE_FINDOS | BOOTM_STATE_FINDOTHER |
 		BOOTM_STATE_LOADOS |
+#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
+		BOOTM_STATE_RAMDISK |
+#endif
 #if defined(CONFIG_PPC) || defined(CONFIG_MIPS)
 		BOOTM_STATE_OS_CMDLINE |
 #endif
diff --git a/common/image.c b/common/image.c
index 0be09e5..6584f7f 100644
--- a/common/image.c
+++ b/common/image.c
@@ -1470,13 +1470,6 @@  int image_setup_linux(bootm_headers_t *images)
 			return ret;
 		}
 	}
-	if (IMAGE_ENABLE_RAMDISK_HIGH) {
-		rd_len = images->rd_end - images->rd_start;
-		ret = boot_ramdisk_high(lmb, images->rd_start, rd_len,
-				initrd_start, initrd_end);
-		if (ret)
-			return ret;
-	}
 
 	if (IMAGE_ENABLE_OF_LIBFDT) {
 		ret = boot_relocate_fdt(lmb, of_flat_tree, &of_size);