Re: [PATCH RFC] MIPS: add support for vmlinux appended DTB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 8, 2014 at 6:01 PM, James Hogan <james.hogan@xxxxxxxxxx> wrote:
> Hi Jonas,
>
> On 08/07/14 16:14, Jonas Gorski wrote:
>> Add support for populating initial_device_params through a dtb
>
> initial_boot_params here and above?

Yes, that's what I meant. I must have been distracted by the
thunderstorm outside.

>
>> blob appended to vmlinux.
>
> should that be vmlinux.bin? Presumably it isn't appended to the ELF file?

Hmmm, you are right, indeed it should. I was always taking the OpenWrt
names for granted, so I never looked at how the kernel itself named
them. OpenWrt uses "vmlinux" for binary only, and "vmlinux.elf" for
the unstripped elf one.

As far as I can tell, there is no simple vmlinux.bin target without
the decompressor wrapper included, but for the description I will
change the name and clarify that I am talking about a binary kernel
without the decompressing wrapper.

>
>>
>> Signed-off-by: Jonas Gorski <jogo@xxxxxxxxxxx>
>> ---
>> Mostly adapted from how ARM is doing it.
>>
>> Sent as an RFC PATCH because I am not sure if this is the right way to
>> it, and whether storing the pointer in initial_device_params is a good
>> idea, or a new variable should be introduced.
>>
>> The reasoning for initial_device_params is that there is no common
>> MIPS interface yet, so the next best thing was using that. This also
>> has the advantage of keeping the original fw_args intact.
>
> Does it matter that this will be ignored if the bootloader does provide
> a DT (initial_boot_params overwritten by early_init_dt_scan() call), and
> that if no DT is provided by the bootloader the of_scan_flat_dt() calls
> at the bottom of early_init_dt_scan will never happen?

Since (AFAIK) there is no common interface on mips for a bootloader to
pass a dtb to the kernel, it is currently up to the individual targets
to do something with an appended dtb, and decide which one has a
higher priority. They already need to manually "extract" the passed
dtb from the bootloader and pass it to the kernel, so all this patch
does is provide another source for one.


>>
>> This patch works for me on bcm63xx, where the bootloade expects
>
> s/bootloade/bootloader/
>
>> an lzma compressed kernel, so I wanted to not double compress using
>> the in-kernel compressed kernel support.
>>
>> Completely untested on anything except MIPS32 / big endian.
>>
>>  arch/mips/Kconfig              | 18 ++++++++++++++++++
>>  arch/mips/kernel/head.S        | 19 +++++++++++++++++++
>>  arch/mips/kernel/vmlinux.lds.S |  6 ++++++
>>  3 files changed, 43 insertions(+)
>>
>> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
>> index 3f05b56..58527cd 100644
>> --- a/arch/mips/Kconfig
>> +++ b/arch/mips/Kconfig
>> @@ -2476,6 +2476,24 @@ config USE_OF
>>       select OF_EARLY_FLATTREE
>>       select IRQ_DOMAIN
>>
>> +config MIPS_APPENDED_DTB
>> +     bool "Use appended device tree blob to vmlinux (EXPERIMENTAL)"
>> +     depends on OF
>> +     help
>> +       With this option, the boot code will look for a device tree binary
>> +       DTB) appended to vmlinux
>
> s/DTB)/(DTB)/
>
> vmlinux.bin again?

Right.

>> +       (e.g. cat vmlinux <filename>.dtb > vmlinux_w_dtb).
>
> here too I think.

Right again.

>> +
>> +       This is meant as a backward compatibility convenience for those
>> +       systems with a bootloader that can't be upgraded to accommodate
>> +       the documented boot protocol using a device tree.
>> +
>> +       Beware that there is very little in terms of protection against
>> +       this option being confused by leftover garbage in memory that might
>> +       look like a DTB header after a reboot if no actual DTB is appended
>> +       to vmlinux.  Do not leave this option active in a production kernel
>
> maybe same here too.

Will fix that, too.

>
> Can't fault the rest though.
>
> Cheers
> James

Thanks for the review!


Jonas


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux