From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752299AbdBMIhz (ORCPT ); Mon, 13 Feb 2017 03:37:55 -0500 Received: from smtp5-g21.free.fr ([212.27.42.5]:49007 "EHLO smtp5-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751955AbdBMIhy (ORCPT ); Mon, 13 Feb 2017 03:37:54 -0500 Date: Mon, 13 Feb 2017 09:37:36 +0100 From: Alban To: Jonas Gorski Cc: Aban Bedel , MIPS Mailing List , Ralf Baechle , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] MIPS: Allow compressed images to be loaded at the usual address Message-ID: <20170213093736.1ee183f3@tock> In-Reply-To: References: <1486326077-17091-1-git-send-email-albeu@free.fr> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/4ILNor26cixMDxa7eSjnB/t"; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Sig_/4ILNor26cixMDxa7eSjnB/t Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Thu, 9 Feb 2017 13:22:37 +0100 Jonas Gorski wrote: > Hi, >=20 > On 5 February 2017 at 21:21, Alban wrote: > > From: Alban Bedel > > > > 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 > > --- > > 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 a= rguments" > > endchoice > > > > +config ZBOOT_VMLINUZ_AT_VMLINUX_LOAD_ADDRESS > > + bool "Load compressed images at the same address as uncompresse= d" > > + depends on SYS_SUPPORTS_ZBOOT > > + help > > + vmlinux and vmlinuz normally have different load addresses, w= ith > > + this option vmlinuz expect to be loaded at the same address as > > + vmlinux. > > + > > endmenu =20 >=20 > 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 =3D=3D > VMLINUX_LOAD_ADDRESS, but it is indented for VMLINUZ_LOAD_ADDRESS !=3D > VMLINUX_LOAD_ADDRESS, but still being loaded at VMLINUX_LOAD_ADDRESS. >=20 > 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). Yes, this is for bootloaders that use raw images. Having to configure different load addresses for compressed and uncompressed images was just too annoying. > > config LOCKDEP_SUPPORT > > diff --git a/arch/mips/boot/compressed/head.S b/arch/mips/boot/compress= ed/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 =20 >=20 > 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. Could you expand a bit on what you mean with "BAL trickery"? I hoped that it would be possible to auto detect the current running address, but as I know very little about MIPS assembly I didn't found how that could be done. Alban --Sig_/4ILNor26cixMDxa7eSjnB/t Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYoXBQAAoJEHSUmkuduC28KSYP/RdK2Rg5l+PjzXo5AOU7969+ wfQzFZEcK+i4134/SBFPHEvSEeE/nU+bq5zXm/rpT9LYj/PE2BVwRlQ7LG/RlUS0 eNJKEfM8KGHY7VlndH502xnAHvhuaEOu7Ipbjchoop7ElBdjgFmYdinrZeRaWMJO fQs3PucHfDG+5hU+Cjz+URx6P2P31K3b2domW4Cza2TqD+lZfVWaOM+wXyu3RLsW mQ0y56CuFnza7rZU12C2PzvD4+lmE21E+/guIBV+6ocDlLw62tma3y0bQTgaSsmR XV3FzmbVEHQAUZNawenX80IIjfP8noXQmLX42f1EA3QSaTwwSmgucUYG1XrqxDI/ rFOQYIFGGKEilYeUjWSoatv8b5BXjDJ02mxmQDWdT1whYmcL+ZwtZ4CjC49W3exA 0NCXvY6QUPi6JZJtlDDaOevZZkJgFDY8An7wXN1dhFbDTuQcWk/d+e39gx2F4PCo IWQVKu+gj3j+8zA2C13VDANHewnwH2eXYHo1fHtNMoArhQcGrKqkb65S9znNrpTD n4beG8YJIAzpIioL7BeJTPzW7FyfwjstQYs/1JzrJER0OstEAvIyPYRjPXoNcs/M pQl9ahhPiERUf1GSRIeY0r5R9yulnifMnknMfGoPr50FKKpJvq4yTlbbeGbAis/o 9EBMtdAXGkDc/sMfIiL4 =SAkT -----END PGP SIGNATURE----- --Sig_/4ILNor26cixMDxa7eSjnB/t--