public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] Booting non devicetree enabled kernels using u-boot build with CONFIG_OF_LIBFDT ?
@ 2014-11-13 18:08 Hans de Goede
  2014-11-13 18:34 ` Tom Rini
  0 siblings, 1 reply; 7+ messages in thread
From: Hans de Goede @ 2014-11-13 18:08 UTC (permalink / raw)
  To: u-boot

Hi all,

So as you know I've been working on getting mainline u-boot to boot the
older android derived linux-sunxi kernels, as some people need features
not yet in mainline, and I would like there to be only one u-boot for both.

I had this working a while ago, but recently it broke, this is caused by
config_distro_defaults.h setting CONFIG_OF_LIBFDT, if I undef that
after including config_distro_defaults.h things work again.

I do not know if CONFIG_OF_LIBFDT is a recent addition to config_distro_defaults.h,
or if something else broke things. But if I do not undef it, boot fails with:

sun7i# bootm start 0x48000000
## Booting kernel from Legacy Image at 48000000 ...
   Image Name:   Linux-3.4.75.sun7i+
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3966672 Bytes = 3.8 MiB
   Load Address: 40008000
   Entry Point:  40008000
   Verifying Checksum ... OK
Could not find a valid device tree

Now this can be fixed by removing CONFIG_OF_LIBFDT when CONFIG_OLD_SUNXI_KERNEL_COMPAT
is set, but that is a somewhat big hammer, making it impossible to have one u-boot
build which can boot both old and new kernels with more or less optimal settings.

One theoretical work around is to just pass in a dummy fdt, but that seems silly.

Another option is to allow:

bootm start 0x48000000 - -

To continue with a devicetree, would a patch for that be acceptable ?

Regards,

Hams

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] Booting non devicetree enabled kernels using u-boot build with CONFIG_OF_LIBFDT ?
  2014-11-13 18:08 [U-Boot] Booting non devicetree enabled kernels using u-boot build with CONFIG_OF_LIBFDT ? Hans de Goede
@ 2014-11-13 18:34 ` Tom Rini
  2014-11-13 18:38   ` Hans de Goede
  0 siblings, 1 reply; 7+ messages in thread
From: Tom Rini @ 2014-11-13 18:34 UTC (permalink / raw)
  To: u-boot

On Thu, Nov 13, 2014 at 07:08:59PM +0100, Hans de Goede wrote:
> Hi all,
> 
> So as you know I've been working on getting mainline u-boot to boot the
> older android derived linux-sunxi kernels, as some people need features
> not yet in mainline, and I would like there to be only one u-boot for both.
> 
> I had this working a while ago, but recently it broke, this is caused by
> config_distro_defaults.h setting CONFIG_OF_LIBFDT, if I undef that
> after including config_distro_defaults.h things work again.
> 
> I do not know if CONFIG_OF_LIBFDT is a recent addition to config_distro_defaults.h,
> or if something else broke things. But if I do not undef it, boot fails with:
> 
> sun7i# bootm start 0x48000000
> ## Booting kernel from Legacy Image at 48000000 ...
>    Image Name:   Linux-3.4.75.sun7i+
>    Image Type:   ARM Linux Kernel Image (uncompressed)
>    Data Size:    3966672 Bytes = 3.8 MiB
>    Load Address: 40008000
>    Entry Point:  40008000
>    Verifying Checksum ... OK
> Could not find a valid device tree

My hunch is that we've got more fall-out from Simon's re-org of the
bootm code ages ago.  It should be valid to try and boot a kernel
without a device tree and other parts of the code base (for example
arch/arm/lib/bootm.c) still do a FDT-or-ATAGS dance for example.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141113/654af675/attachment.pgp>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] Booting non devicetree enabled kernels using u-boot build with CONFIG_OF_LIBFDT ?
  2014-11-13 18:34 ` Tom Rini
@ 2014-11-13 18:38   ` Hans de Goede
  2014-11-16 19:41     ` Hans de Goede
  2014-11-17 14:52     ` Tom Rini
  0 siblings, 2 replies; 7+ messages in thread
From: Hans de Goede @ 2014-11-13 18:38 UTC (permalink / raw)
  To: u-boot

Hi,

On 11/13/2014 07:34 PM, Tom Rini wrote:
> On Thu, Nov 13, 2014 at 07:08:59PM +0100, Hans de Goede wrote:
>> Hi all,
>>
>> So as you know I've been working on getting mainline u-boot to boot the
>> older android derived linux-sunxi kernels, as some people need features
>> not yet in mainline, and I would like there to be only one u-boot for both.
>>
>> I had this working a while ago, but recently it broke, this is caused by
>> config_distro_defaults.h setting CONFIG_OF_LIBFDT, if I undef that
>> after including config_distro_defaults.h things work again.
>>
>> I do not know if CONFIG_OF_LIBFDT is a recent addition to config_distro_defaults.h,
>> or if something else broke things. But if I do not undef it, boot fails with:
>>
>> sun7i# bootm start 0x48000000
>> ## Booting kernel from Legacy Image at 48000000 ...
>>    Image Name:   Linux-3.4.75.sun7i+
>>    Image Type:   ARM Linux Kernel Image (uncompressed)
>>    Data Size:    3966672 Bytes = 3.8 MiB
>>    Load Address: 40008000
>>    Entry Point:  40008000
>>    Verifying Checksum ... OK
>> Could not find a valid device tree
> 
> My hunch is that we've got more fall-out from Simon's re-org of the
> bootm code ages ago.  It should be valid to try and boot a kernel
> without a device tree and other parts of the code base (for example
> arch/arm/lib/bootm.c) still do a FDT-or-ATAGS dance for example.

That is good news, because ideally upstream u-boot build with
OLD_SUNXI_KERNEL_COMPAT should be able to boot old disk images without
needing them to modify their boot.scr, which requiring bootm 0xfoo - -
would do.

So maybe check if there is a third argument to bootm, and if there
is not still try the dance for finding one appended in various ways,
and if that fails continue normally (where as with the third
argument present this of course needs to stay an error) ?

Regards,

Hans

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] Booting non devicetree enabled kernels using u-boot build with CONFIG_OF_LIBFDT ?
  2014-11-13 18:38   ` Hans de Goede
@ 2014-11-16 19:41     ` Hans de Goede
  2014-11-17  7:24       ` Simon Glass
  2014-11-17 14:52     ` Tom Rini
  1 sibling, 1 reply; 7+ messages in thread
From: Hans de Goede @ 2014-11-16 19:41 UTC (permalink / raw)
  To: u-boot

Hi,

On 11/13/2014 07:38 PM, Hans de Goede wrote:
> Hi,
> 
> On 11/13/2014 07:34 PM, Tom Rini wrote:
>> On Thu, Nov 13, 2014 at 07:08:59PM +0100, Hans de Goede wrote:
>>> Hi all,
>>>
>>> So as you know I've been working on getting mainline u-boot to boot the
>>> older android derived linux-sunxi kernels, as some people need features
>>> not yet in mainline, and I would like there to be only one u-boot for both.
>>>
>>> I had this working a while ago, but recently it broke, this is caused by
>>> config_distro_defaults.h setting CONFIG_OF_LIBFDT, if I undef that
>>> after including config_distro_defaults.h things work again.
>>>
>>> I do not know if CONFIG_OF_LIBFDT is a recent addition to config_distro_defaults.h,
>>> or if something else broke things. But if I do not undef it, boot fails with:
>>>
>>> sun7i# bootm start 0x48000000
>>> ## Booting kernel from Legacy Image at 48000000 ...
>>>    Image Name:   Linux-3.4.75.sun7i+
>>>    Image Type:   ARM Linux Kernel Image (uncompressed)
>>>    Data Size:    3966672 Bytes = 3.8 MiB
>>>    Load Address: 40008000
>>>    Entry Point:  40008000
>>>    Verifying Checksum ... OK
>>> Could not find a valid device tree
>>
>> My hunch is that we've got more fall-out from Simon's re-org of the
>> bootm code ages ago.  It should be valid to try and boot a kernel
>> without a device tree and other parts of the code base (for example
>> arch/arm/lib/bootm.c) still do a FDT-or-ATAGS dance for example.
> 
> That is good news, because ideally upstream u-boot build with
> OLD_SUNXI_KERNEL_COMPAT should be able to boot old disk images without
> needing them to modify their boot.scr, which requiring bootm 0xfoo - -
> would do.
> 
> So maybe check if there is a third argument to bootm, and if there
> is not still try the dance for finding one appended in various ways,
> and if that fails continue normally (where as with the third
> argument present this of course needs to stay an error) ?

Ping ? The above was intended as a question, I'm willing to spend some
time on getting the behavior suggested above, but first I would like to
heat that such behavior is desirable (and thus my patch has a chance of
getting applied).

Regards,

Hans

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] Booting non devicetree enabled kernels using u-boot build with CONFIG_OF_LIBFDT ?
  2014-11-16 19:41     ` Hans de Goede
@ 2014-11-17  7:24       ` Simon Glass
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Glass @ 2014-11-17  7:24 UTC (permalink / raw)
  To: u-boot

Hi Hans,

On 16 November 2014 19:41, Hans de Goede <hdegoede@redhat.com> wrote:
> Hi,
>
> On 11/13/2014 07:38 PM, Hans de Goede wrote:
>> Hi,
>>
>> On 11/13/2014 07:34 PM, Tom Rini wrote:
>>> On Thu, Nov 13, 2014 at 07:08:59PM +0100, Hans de Goede wrote:
>>>> Hi all,
>>>>
>>>> So as you know I've been working on getting mainline u-boot to boot the
>>>> older android derived linux-sunxi kernels, as some people need features
>>>> not yet in mainline, and I would like there to be only one u-boot for both.
>>>>
>>>> I had this working a while ago, but recently it broke, this is caused by
>>>> config_distro_defaults.h setting CONFIG_OF_LIBFDT, if I undef that
>>>> after including config_distro_defaults.h things work again.
>>>>
>>>> I do not know if CONFIG_OF_LIBFDT is a recent addition to config_distro_defaults.h,
>>>> or if something else broke things. But if I do not undef it, boot fails with:
>>>>
>>>> sun7i# bootm start 0x48000000
>>>> ## Booting kernel from Legacy Image at 48000000 ...
>>>>    Image Name:   Linux-3.4.75.sun7i+
>>>>    Image Type:   ARM Linux Kernel Image (uncompressed)
>>>>    Data Size:    3966672 Bytes = 3.8 MiB
>>>>    Load Address: 40008000
>>>>    Entry Point:  40008000
>>>>    Verifying Checksum ... OK
>>>> Could not find a valid device tree
>>>
>>> My hunch is that we've got more fall-out from Simon's re-org of the
>>> bootm code ages ago.  It should be valid to try and boot a kernel
>>> without a device tree and other parts of the code base (for example
>>> arch/arm/lib/bootm.c) still do a FDT-or-ATAGS dance for example.

I'm not so sure. If I go back to v2011.03 I see that bootm_start()
calls boot_get_fdt() and prints that message if it fails. This call is
protected by CONFIG_OF_LIBFDT. So in this respect I don't see the new
code (bootm refactor of mid-2013) being different from the old.

It looks like this was created in this commit from 2008:

06a09918f bootm: refactor fdt locating and relocation code

It moved the PPC behaviour over to be common for all archs.

Of course I could be missing something, but I can't see it.

>>
>> That is good news, because ideally upstream u-boot build with
>> OLD_SUNXI_KERNEL_COMPAT should be able to boot old disk images without
>> needing them to modify their boot.scr, which requiring bootm 0xfoo - -
>> would do.
>>
>> So maybe check if there is a third argument to bootm, and if there
>> is not still try the dance for finding one appended in various ways,
>> and if that fails continue normally (where as with the third
>> argument present this of course needs to stay an error) ?
>
> Ping ? The above was intended as a question, I'm willing to spend some
> time on getting the behavior suggested above, but first I would like to
> heat that such behavior is desirable (and thus my patch has a chance of
> getting applied).

You can go through the steps using the bootm sub-commands, but it is a
bit painful. I'm not sure about the intended behaviour.

If you look at the README, it says:

> CONFIG_OF_LIBFDT
> New kernel versions are expecting firmware settings to be
> passed using flattened device trees (based on open firmware
> concepts).
> CONFIG_OF_LIBFDT
> * New libfdt-based support
> * Adds the "fdt" command
> * The bootm command automatically updates the fdt

My feeling is that CONFIG_OF_LIBFDT probably means that an FDT should
be provided to the kernel. If that is true then I don't like this
either - it should add the capability, not require it to be used. But
it appears to be long-standing behaviour going back 6 years.

What could we do? We presumably do want to report an error if there is
no FDT when the kernel needs it, but I'm not sure how we know. The
'dance' described above seems reasonable to me.

Regards,
Simon

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] Booting non devicetree enabled kernels using u-boot build with CONFIG_OF_LIBFDT ?
  2014-11-13 18:38   ` Hans de Goede
  2014-11-16 19:41     ` Hans de Goede
@ 2014-11-17 14:52     ` Tom Rini
  2014-11-17 15:00       ` Hans de Goede
  1 sibling, 1 reply; 7+ messages in thread
From: Tom Rini @ 2014-11-17 14:52 UTC (permalink / raw)
  To: u-boot

On Thu, Nov 13, 2014 at 07:38:50PM +0100, Hans de Goede wrote:
> Hi,
> 
> On 11/13/2014 07:34 PM, Tom Rini wrote:
> > On Thu, Nov 13, 2014 at 07:08:59PM +0100, Hans de Goede wrote:
> >> Hi all,
> >>
> >> So as you know I've been working on getting mainline u-boot to boot the
> >> older android derived linux-sunxi kernels, as some people need features
> >> not yet in mainline, and I would like there to be only one u-boot for both.
> >>
> >> I had this working a while ago, but recently it broke, this is caused by
> >> config_distro_defaults.h setting CONFIG_OF_LIBFDT, if I undef that
> >> after including config_distro_defaults.h things work again.
> >>
> >> I do not know if CONFIG_OF_LIBFDT is a recent addition to config_distro_defaults.h,
> >> or if something else broke things. But if I do not undef it, boot fails with:
> >>
> >> sun7i# bootm start 0x48000000
> >> ## Booting kernel from Legacy Image at 48000000 ...
> >>    Image Name:   Linux-3.4.75.sun7i+
> >>    Image Type:   ARM Linux Kernel Image (uncompressed)
> >>    Data Size:    3966672 Bytes = 3.8 MiB
> >>    Load Address: 40008000
> >>    Entry Point:  40008000
> >>    Verifying Checksum ... OK
> >> Could not find a valid device tree
> > 
> > My hunch is that we've got more fall-out from Simon's re-org of the
> > bootm code ages ago.  It should be valid to try and boot a kernel
> > without a device tree and other parts of the code base (for example
> > arch/arm/lib/bootm.c) still do a FDT-or-ATAGS dance for example.
> 
> That is good news, because ideally upstream u-boot build with
> OLD_SUNXI_KERNEL_COMPAT should be able to boot old disk images without
> needing them to modify their boot.scr, which requiring bootm 0xfoo - -
> would do.
> 
> So maybe check if there is a third argument to bootm, and if there
> is not still try the dance for finding one appended in various ways,
> and if that fails continue normally (where as with the third
> argument present this of course needs to stay an error) ?

So first, I have to take it back.  This isn't a behavior change
introduced by Simon's re-org (Sorry Simon!).  This is a real long
standing "feature".   I am agreeable to doing whatever the lowest impact
change would be to allow a non-DT tree to boot with CONFIG_OF_LIBFDT
set.   I'm thinking we turn the error into a warning (so that it's still
clear to the user that they booted without a DT, for when they didn't
mean to do that) and instead of a hang we just don't do the follow-up
steps.  That should let all the existing scripts work, yes?

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141117/7604650d/attachment.pgp>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] Booting non devicetree enabled kernels using u-boot build with CONFIG_OF_LIBFDT ?
  2014-11-17 14:52     ` Tom Rini
@ 2014-11-17 15:00       ` Hans de Goede
  0 siblings, 0 replies; 7+ messages in thread
From: Hans de Goede @ 2014-11-17 15:00 UTC (permalink / raw)
  To: u-boot

Hi,

On 11/17/2014 03:52 PM, Tom Rini wrote:
> On Thu, Nov 13, 2014 at 07:38:50PM +0100, Hans de Goede wrote:
>> Hi,
>>
>> On 11/13/2014 07:34 PM, Tom Rini wrote:
>>> On Thu, Nov 13, 2014 at 07:08:59PM +0100, Hans de Goede wrote:
>>>> Hi all,
>>>>
>>>> So as you know I've been working on getting mainline u-boot to boot the
>>>> older android derived linux-sunxi kernels, as some people need features
>>>> not yet in mainline, and I would like there to be only one u-boot for both.
>>>>
>>>> I had this working a while ago, but recently it broke, this is caused by
>>>> config_distro_defaults.h setting CONFIG_OF_LIBFDT, if I undef that
>>>> after including config_distro_defaults.h things work again.
>>>>
>>>> I do not know if CONFIG_OF_LIBFDT is a recent addition to config_distro_defaults.h,
>>>> or if something else broke things. But if I do not undef it, boot fails with:
>>>>
>>>> sun7i# bootm start 0x48000000
>>>> ## Booting kernel from Legacy Image at 48000000 ...
>>>>    Image Name:   Linux-3.4.75.sun7i+
>>>>    Image Type:   ARM Linux Kernel Image (uncompressed)
>>>>    Data Size:    3966672 Bytes = 3.8 MiB
>>>>    Load Address: 40008000
>>>>    Entry Point:  40008000
>>>>    Verifying Checksum ... OK
>>>> Could not find a valid device tree
>>>
>>> My hunch is that we've got more fall-out from Simon's re-org of the
>>> bootm code ages ago.  It should be valid to try and boot a kernel
>>> without a device tree and other parts of the code base (for example
>>> arch/arm/lib/bootm.c) still do a FDT-or-ATAGS dance for example.
>>
>> That is good news, because ideally upstream u-boot build with
>> OLD_SUNXI_KERNEL_COMPAT should be able to boot old disk images without
>> needing them to modify their boot.scr, which requiring bootm 0xfoo - -
>> would do.
>>
>> So maybe check if there is a third argument to bootm, and if there
>> is not still try the dance for finding one appended in various ways,
>> and if that fails continue normally (where as with the third
>> argument present this of course needs to stay an error) ?
> 
> So first, I have to take it back.  This isn't a behavior change
> introduced by Simon's re-org (Sorry Simon!).  This is a real long
> standing "feature".   I am agreeable to doing whatever the lowest impact
> change would be to allow a non-DT tree to boot with CONFIG_OF_LIBFDT
> set.   I'm thinking we turn the error into a warning (so that it's still
> clear to the user that they booted without a DT, for when they didn't
> mean to do that)

I was thinking along the same lines, except that when a third argument
is explicitly given to u-boot, and then we do not find a dt, that should
be treated as an error IMHO. I've put whipping up a patch for this on my
todo list.

> and instead of a hang we just don't do the follow-up
> steps. 

Actually not doing the follow-up steps (as in bootm execution steps) is what
we currently do. What we want to do is skip further dt processing / prepping,
but otherwise still continue with trying to boot the kernel.

> That should let all the existing scripts work, yes?

With the amendments done above, I think so, yes. But the proof is in the
pudding, iow I'll find out when I go work on that patch.

Regards,

Hans

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-11-17 15:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-13 18:08 [U-Boot] Booting non devicetree enabled kernels using u-boot build with CONFIG_OF_LIBFDT ? Hans de Goede
2014-11-13 18:34 ` Tom Rini
2014-11-13 18:38   ` Hans de Goede
2014-11-16 19:41     ` Hans de Goede
2014-11-17  7:24       ` Simon Glass
2014-11-17 14:52     ` Tom Rini
2014-11-17 15:00       ` Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox