Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1577527

Re: [PATCH] MIPS: Allow compressed images to be loaded at the usual address

From Jonas Gorski <jonas.gorski@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] MIPS: Allow compressed images to be loaded at the usual address
Date 2017-02-09 13:30 +0100
Message-ID <t8W1k-66e-11@gated-at.bofh.it> (permalink)
References <t7BBG-3FO-81@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

On 5 February 2017 at 21:21, Alban <albeu@free.fr> wrote:
> From: Alban Bedel <albeu@free.fr>
>
> Normally compressed images have to be loaded at a different address to
> allow the decompressor to run. This add an option to let vmlinuz copy
> itself to the correct address from the normal vmlinux address.
>
> Signed-off-by: Alban Bedel <albeu@free.fr>
> ---
>  arch/mips/Kconfig                |  8 ++++++++
>  arch/mips/boot/compressed/head.S | 13 +++++++++++++
>  2 files changed, 21 insertions(+)
>
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index b3c5bde..8074fc5 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -2961,6 +2961,14 @@ choice
>                 bool "Extend builtin kernel arguments with bootloader arguments"
>  endchoice
>
> +config ZBOOT_VMLINUZ_AT_VMLINUX_LOAD_ADDRESS
> +       bool "Load compressed images at the same address as uncompressed"
> +       depends on SYS_SUPPORTS_ZBOOT
> +       help
> +         vmlinux and vmlinuz normally have different load addresses, with
> +         this option vmlinuz expect to be loaded at the same address as
> +         vmlinux.
> +
>  endmenu

Okay, it took me a while to understand the intention of this change. I
thought it was for supporting the case that VMLINUZ_LOAD_ADDRESS ==
VMLINUX_LOAD_ADDRESS, but it is indented for  VMLINUZ_LOAD_ADDRESS !=
VMLINUX_LOAD_ADDRESS, but still being loaded at VMLINUX_LOAD_ADDRESS.

So I guess that this can only happen with vmlinuz.bin, as vmlinux's
ELF header will cause it to be loaded at the expected address (for
sane bootloaders at least).

>  config LOCKDEP_SUPPORT
> diff --git a/arch/mips/boot/compressed/head.S b/arch/mips/boot/compressed/head.S
> index 409cb48..a215171 100644
> --- a/arch/mips/boot/compressed/head.S
> +++ b/arch/mips/boot/compressed/head.S
> @@ -25,6 +25,19 @@ start:
>         move    s2, a2
>         move    s3, a3
>
> +#ifdef CONFIG_ZBOOT_VMLINUZ_AT_VMLINUX_LOAD_ADDRESS

With a bit of BAL trickery you could easily detect this at runtime and
then conditionally copy without requiring any additional config
symbols. Then you aren't limited to being executed from
VMLINUX_LOAD_ADDRESS.

> +       /* Move the text, data section and DTB to the correct address */
> +       PTR_LA  a0, .text
> +       PTR_LI  a1, VMLINUX_LOAD_ADDRESS
> +       PTR_LA  a2, _edata
> +0:
> +       lw      a3, 0(a1)
> +       sw      a3, 0(a0)
> +       addiu   a1, a1, 4
> +       bne     a2, a0, 0b
> +        addiu  a0, a0, 4
> +#endif
> +
>         /* Clear BSS */
>         PTR_LA  a0, _edata
>         PTR_LA  a2, _end

Regards
Jonas

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] MIPS: Allow compressed images to be loaded at the usual address Alban <albeu@free.fr> - 2017-02-05 21:30 +0100
  Re: [PATCH] MIPS: Allow compressed images to be loaded at the usual  address Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2017-02-06 10:00 +0100
  Re: [PATCH] MIPS: Allow compressed images to be loaded at the usual address Jonas Gorski <jonas.gorski@gmail.com> - 2017-02-09 13:30 +0100
    Re: [PATCH] MIPS: Allow compressed images to be loaded at the usual  address Alban <albeu@free.fr> - 2017-02-13 09:40 +0100
      Re: [PATCH] MIPS: Allow compressed images to be loaded at the usual address Jonas Gorski <jonas.gorski@gmail.com> - 2017-02-13 12:00 +0100

csiph-web