[PATCH 13/37] of: Add initrd helper
Alexander Aring
alex.aring at gmail.com
Mon Mar 4 07:01:56 EST 2013
Hi Sascha,
On Mon, Mar 04, 2013 at 10:53:16AM +0100, Sascha Hauer wrote:
> Add a helper to set the initrd properties in the unflattened tree.
>
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> ---
> drivers/of/base.c | 39 +++++++++++++++++++++++++++++++++++++++
> include/of.h | 3 +++
> 2 files changed, 42 insertions(+)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 721db29..4dbe11e 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1201,3 +1201,42 @@ int of_device_is_stdout_path(struct device_d *dev)
>
> return 0;
> }
> +
> +/**
> + * of_add_initrd - add initrd properties to the devicetree
> + * @root - the root node of the tree
> + * @start - physical start address of the initrd image
> + * @end - physical end address of the initrd image
> + *
> + * Add initrd properties to the devicetree, or, if end is 0,
> + * delete them.
> + */
> +int of_add_initrd(struct device_node *root, resource_size_t start,
> + resource_size_t end)
> +{
> + struct device_node *chosen;
> + __be32 buf[2];
> +
> + chosen = of_find_node_by_path(root, "/chosen");
> + if (!chosen)
> + return -EINVAL;
> +
> + if (end) {
Perhaps it's better here to check on (start && end) instead of end
address only.
Similar in "[PATCH 35/37] ARM bootm: Switch initrd support to unflattened
tree" at "of_add_reserve_entry(initrd_start, initrd_end);".
Regards
Alex
More information about the barebox
mailing list