Re: [DO NOT MERGE v5 06/37] sh: kernel/setup Update DT support.

From: Arnd Bergmann
Date: Tue Dec 05 2023 - 08:15:02 EST


On Tue, Dec 5, 2023, at 10:45, Yoshinori Sato wrote:
> Fix extrnal fdt initialize and bootargs.
>
> Signed-off-by: Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>
> ---
> arch/sh/kernel/setup.c | 51 ++++++++++++++++++++++++++++--------------
> 1 file changed, 34 insertions(+), 17 deletions(-)
>
> diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
> index 3d80515298d2..b299abff68e0 100644
> --- a/arch/sh/kernel/setup.c
> +++ b/arch/sh/kernel/setup.c
> @@ -30,6 +30,7 @@
> #include <linux/memblock.h>
> #include <linux/of.h>
> #include <linux/of_fdt.h>
> +#include <linux/libfdt.h>
> #include <linux/uaccess.h>
> #include <uapi/linux/mount.h>
> #include <asm/io.h>
> @@ -74,7 +75,13 @@ extern int root_mountflags;
> #define RAMDISK_PROMPT_FLAG 0x8000
> #define RAMDISK_LOAD_FLAG 0x4000
>
> +#if defined(CONFIG_OF) && !defined(CONFIG_USE_BUILTIN_DTB)
> +#define CHOSEN_BOOTARGS
> +#endif
> +
> +#ifndef CHOSEN_BOOTARGS
> static char __initdata command_line[COMMAND_LINE_SIZE] = { 0, };
> +#endif

I think an appended DTB is generally better than a built-in
one, as that allows you to still have a single kernel
image across machines and just pick the dtb when installing it.

With everything else being equal, I would suggest not
actually making this an option for new platforms.

Arnd