On Fri, 29 Jun 2018 09:29:08 +0200
Sascha Hauer <s.ha...@pengutronix.de> wrote:

> On Thu, Jun 28, 2018 at 10:39:44AM +0300, Antony Pavlov wrote:
> > Signed-off-by: Antony Pavlov <antonynpav...@gmail.com>
> > ---
> > +++ b/arch/riscv/lib/barebox.lds.S
> > @@ -0,0 +1,89 @@
> > +/*
> > + * Copyright (C) 2016 Antony Pavlov <antonynpav...@gmail.com>
> > + *
> > + * This file is part of barebox.
> > + * See file CREDITS for list of people who contributed to this project.
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2
> > + * as published by the Free Software Foundation.
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > + * GNU General Public License for more details.
> > + *
> > + */
> > +
> > +#include <asm-generic/barebox.lds.h>
> > +
> > +OUTPUT_ARCH(riscv)
> > +ENTRY(_start)
> > +SECTIONS
> > +{
> > +   . = TEXT_BASE;
> > +
> > +   . = ALIGN(8);
> > +   .text      :
> > +   {
> > +           _stext = .;
> > +           _start = .;
> > +           KEEP(*(.text_entry*))
> > +           _text = .;
> > +           __bare_init_start = .;
> > +           *(.text_bare_init*)
> > +           __bare_init_end = .;
> > +           *(.text*)
> > +   }
> > +   BAREBOX_BARE_INIT_SIZE
> 
> Do you need these __bare_init* stuff? If not I would prefer to remove
> it.


Hmmm. You are right! I have not realized PBL for RISC-V yet so it's better
to drop all these bare_inits.


> > +
> > +   PRE_IMAGE
> 
> Same here.
> 
> > +static int of_riscv_init(void)
> > +{
> > +   struct device_node *root;
> > +
> > +   root = of_get_root_node();
> > +   if (root)
> > +           return 0;
> > +
> > +   root = of_unflatten_dtb(__dtb_start);
> > +   if (!IS_ERR(root)) {
> > +           pr_debug("using internal DTB\n");
> > +           of_set_root_node(root);
> > +           if (IS_ENABLED(CONFIG_OFDEVICE))
> > +                   of_probe();
> > +   }
> 
> Can we just call of_unflatten_dtb()/of_set_root_node() from the board
> code and use obj-dtb-y to include the dtb?
> 
> That way a board can specify the dtb and not the config.

Good idea! MIPS code lacks this feature at the moment.

Can I use of_arm_init() as a reference?

-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to