[U-Boot] RFC unified boot environment

Dennis Gilmore
2014-02-18T16:09:10Z

On Tue, 18 Feb 2014 11:18:22 +0100
Stefano Babic <sbabic@denx.de> wrote:

> Hi Dennis,
>
> On 17/02/2014 18:56, Dennis Gilmore wrote:
> > Hi All,
> >
> > The attached patches build on the work for generic distro config,
> > as well as Stephen Warrens implementation for tegra.
> >
>
> First, thanks to make order on this issue.
>
> > I have added a header to be included that will allow all boards to
> > boot in the same way and I have ported over two boards to use it.
> > One thought I have had is to move the environment into the same
> > header as the generic config.
>
> I think this is currently the best solution.
>
> >
> > I am also working on writing a README.distro file to document
> > everything that needs to be set for everything to just work. Along
> > with information on how to best choose memory locations.
>
>
> Ok, let's see. This seems quite board-depending, I do not know if we
> find a common solution. But we can find an agreement about a generic
> set of variables/scripts, that all boards can reuse.

There will always be some board specific things like memory locations
etc. None of the boot logic is board specific. Some features are
hardware specific, i.e. PXE boot support is only configured if the
hardware supports it same for SATA.

I'm putting what I have for the documentation so far at the end of this
email. I think that soc families should have a common settings file,
each board should have its on file and then we have a common set of
configurations on how to boot.

Dennis

/*
* (C) Copyright 2014 Red Hat Inc.
*
* SPDX-License-Identifier: GPL-2.0+
*/

Generic distro configuration

configuring
-----------
To configure a board to run the generic distro setup and enable generic distros
to easily support your board.

you will need to include a pair of headers to enable the boot environment and
configuration options needed. It is best to only include when not doing an
SPL build.

#ifndef CONFIG_SPL_BUILD
#include <config_distro_defaults.h>
#include <config_distro_bootcmd.h>
#endif

There is some memory addresses you will need to define in
CONFIG_EXTRA_ENV_SETTINGS
fdt_addr:
Optional, if specified a dtb to boot the system needs to be available at the
address.

fdt_addr_r:
Mandatory, This is the location where the sysboot/pxeboot with load the dtb to,
using the fdtdir/devicetreedir or fdt/devicetree options in the pxe/extlinux
config file. The location can be anywhere in ram it just needs to not overlap
with anything, allowing 1 megabyte seems to be a safe option.

ramdisk_addr_r:
Mandatory, This is the location where the sysboot/pxeboot with load the
initramfs to, using the initrd option in the pxe/extlinux config file, the
location of the initramfs does not matter, there needs to be enough room to be
able to store any image. Making the image the last item stored should allow for
any initramfs to fit and not overwrite anything else.

kernel_addr_r:
Mandatory,

pxe_addr_r:
Mandatory, used by the PXE code to hold the pxelinux config file. The location
can be anywhere in ram it just needs to not overlap with anything, allowing 1
megabyte seems to be a safe option.

scriptaddr:
Mandatory,

suggested mapping:
16M

make sure you also include BOOTCMDS_COMMON in CONFIG_EXTRA_ENV_SETTINGS

booting your system
-------------------
in the most simplest form CONFIG_BOOTCOMMAND just needs one line

"for target in ${boot_targets}; do run bootcmd_${target}; done"

you can run any setup before going through the targets for example run a
command to set "fdtfile" variable for the dtb for your board.

Dennis