From: Sascha Hauer <s.hauer@pengutronix.de>
To: "Панов Андрей" <rockford@yandex.ru>
Cc: "barebox@lists.infradead.org" <barebox@lists.infradead.org>,
"perachet7@gmail.com" <perachet7@gmail.com>,
Sam Ravnborg <sam@ravnborg.org>
Subject: Re: rk3188 (radxa rock pro) boot failure w/ barebox 2018-04 and later
Date: Mon, 17 Sep 2018 08:37:41 +0200 [thread overview]
Message-ID: <20180917063741.GG7949@pengutronix.de> (raw)
In-Reply-To: <8463281536949204@iva4-f774db2b5297.qloud-c.yandex.net>
Hi,
On Fri, Sep 14, 2018 at 09:20:04PM +0300, Панов Андрей wrote:
> Hi!
>
> Attached patch fixed the problem.
>
> in arch/arm/cpu/uncompress.c global_variable_offset() was called before relocation.
>
> And we have TEXT_BASE = 0 (since CONFIG_*_RELOCATABLE is set and it is not configurable)
>
> Arch memory starts at 0x60000000 and image linked at 0x0, so global_variable_offset() returns 0x60000000
>
> We're running around 0x60000000 and at
> image_end = (void *)&image_end_marker + global_variable_offset();
> &image_end_marker is 0x6000XXXXX
> image_end goes at 0x60000000 more than it is actually
>
> After relocation global_variable_offset() becomes zero.
>
> So if we move
> image_end = (void *)&image_end_marker + global_variable_offset();
> after relocation it will point to right location.
This patch only works for CONFIG_PBL_RELOCATABLE enabled. If it's not
enabled, then we will move the binary to its link address, but not the
compressed image behind the binary. After that image_end is correctly
calculated to the address behind the new image, but there's only
garbage.
I have a patch in preparation I'll post shortly.
Sascha
> diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c
> index b07087e4c..708c04c1f 100644
> --- a/arch/arm/cpu/uncompress.c
> +++ b/arch/arm/cpu/uncompress.c
> @@ -50,8 +50,6 @@ void __noreturn barebox_multi_pbl_start(unsigned long membase,
> void *pg_start;
> unsigned long pc = get_pc();
>
> - image_end = (void *)&image_end_marker + global_variable_offset();
> -
> if (IS_ENABLED(CONFIG_PBL_RELOCATABLE)) {
> /*
> * If we run from inside the memory just relocate the binary
> @@ -64,6 +62,8 @@ void __noreturn barebox_multi_pbl_start(unsigned long membase,
> relocate_to_adr(membase);
> }
>
> + image_end = (void *)&image_end_marker + global_variable_offset();
> +
> /*
> * image_end is the image_end_marker defined above. It is the last location
> * in the executable. Right after the executable the build process adds
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2018-09-17 6:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-13 11:18 rk3188 (radxa rock pro) boot failure w/ barebox 2018-04 and later perachet7
2018-09-13 12:37 ` Sam Ravnborg
2018-09-14 18:20 ` Панов Андрей
2018-09-17 6:37 ` Sascha Hauer [this message]
[not found] ` <8463281536949204@think-future.de>
2018-09-14 21:41 ` perachet7
[not found] ` <20180913123746.GA18653@think-future.de>
2018-09-14 21:33 ` perachet7
2018-09-17 7:30 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180917063741.GG7949@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=perachet7@gmail.com \
--cc=rockford@yandex.ru \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.