diff mbox series

[1/9] include: env: phytec: Create env file for loading and applying overlays

Message ID 20240703054202.2812540-2-d.schultz@phytec.de
State Superseded
Delegated to: Tom Rini
Headers show
Series Generalize PHYTEC Overlay Handling | expand

Commit Message

Daniel Schultz July 3, 2024, 5:41 a.m. UTC
From: Benjamin Hahn <B.Hahn@phytec.de>

The env scripts for loading and applying overlays are identical for many
PHYTEC Boards. Create a common env that can be included.

The env variables bootenv_addr and fdto_addr are board specific and need
to be set in the board specific file. The env variable get_cmd also
needs to be set in board specific files and can be set to tftp or dhcp.

Signed-off-by: Benjamin Hahn <B.Hahn@phytec.de>
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
---
 include/env/phytec/overlays.env | 37 +++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 include/env/phytec/overlays.env

Comments

Teresa Remmet July 4, 2024, 6:40 a.m. UTC | #1
Am Dienstag, dem 02.07.2024 um 22:41 -0700 schrieb Daniel Schultz:
> From: Benjamin Hahn <B.Hahn@phytec.de>
> 
> The env scripts for loading and applying overlays are identical for
> many
> PHYTEC Boards. Create a common env that can be included.
> 
> The env variables bootenv_addr and fdto_addr are board specific and
> need
> to be set in the board specific file. The env variable get_cmd also
> needs to be set in board specific files and can be set to tftp or
> dhcp.
> 
> Signed-off-by: Benjamin Hahn <B.Hahn@phytec.de>
> Signed-off-by: Daniel Schultz <d.schultz@phytec.de>

Reviewed-by: Teresa Remmet <t.remmet@phytec.de>

> ---
>  include/env/phytec/overlays.env | 37
> +++++++++++++++++++++++++++++++++
>  1 file changed, 37 insertions(+)
>  create mode 100644 include/env/phytec/overlays.env
> 
> diff --git a/include/env/phytec/overlays.env
> b/include/env/phytec/overlays.env
> new file mode 100644
> index 00000000000..febb991f4f5
> --- /dev/null
> +++ b/include/env/phytec/overlays.env
> @@ -0,0 +1,37 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later  */
> +/*
> + * Copyright (C) 2024 PHYTEC Messtechnik GmbH
> + * Author: Benjamin Hahn <b.hahn@phytec.de>
> + */
> +
> +/* Logic to load and apply overlays. Load overlays from bootenv.txt
> into
> + * environment and apply those overlays.
> + * The variables bootenv_addr and fdto_addr are board specific. */
> +
> +bootenv=bootenv.txt
> +mmc_load_bootenv=load mmc ${mmcdev}:${mmcpart} ${bootenv_addr}
> ${bootenv}
> +mmc_load_overlay=load mmc ${mmcdev}:${mmcpart} ${fdto_addr}
> ${overlay}
> +mmc_apply_overlays=
> +       fdt address ${fdt_addr};
> +       if test ${no_overlays} = 0; then
> +               for overlay in ${overlays};
> +               do;
> +                       if run mmc_load_overlay; then
> +                               fdt resize ${filesize};
> +                               fdt apply ${fdto_addr};
> +                       fi;
> +               done;
> +       fi;
> +net_load_bootenv=${get_cmd} ${bootenv_addr} ${bootenv}
> +net_load_overlay=${get_cmd} ${fdto_addr} ${overlay}
> +net_apply_overlays=
> +       fdt address ${fdt_addr};
> +       if test ${no_overlays} = 0; then
> +               for overlay in ${overlays};
> +               do;
> +                       if run net_load_overlay; then
> +                               fdt resize ${filesize};
> +                               fdt apply ${fdto_addr};
> +                       fi;
> +               done;
> +       fi;
diff mbox series

Patch

diff --git a/include/env/phytec/overlays.env b/include/env/phytec/overlays.env
new file mode 100644
index 00000000000..febb991f4f5
--- /dev/null
+++ b/include/env/phytec/overlays.env
@@ -0,0 +1,37 @@ 
+/* SPDX-License-Identifier: GPL-2.0-or-later  */
+/*
+ * Copyright (C) 2024 PHYTEC Messtechnik GmbH
+ * Author: Benjamin Hahn <b.hahn@phytec.de>
+ */
+
+/* Logic to load and apply overlays. Load overlays from bootenv.txt into
+ * environment and apply those overlays.
+ * The variables bootenv_addr and fdto_addr are board specific. */
+
+bootenv=bootenv.txt
+mmc_load_bootenv=load mmc ${mmcdev}:${mmcpart} ${bootenv_addr} ${bootenv}
+mmc_load_overlay=load mmc ${mmcdev}:${mmcpart} ${fdto_addr} ${overlay}
+mmc_apply_overlays=
+	fdt address ${fdt_addr};
+	if test ${no_overlays} = 0; then
+		for overlay in ${overlays};
+		do;
+			if run mmc_load_overlay; then
+				fdt resize ${filesize};
+				fdt apply ${fdto_addr};
+			fi;
+		done;
+	fi;
+net_load_bootenv=${get_cmd} ${bootenv_addr} ${bootenv}
+net_load_overlay=${get_cmd} ${fdto_addr} ${overlay}
+net_apply_overlays=
+	fdt address ${fdt_addr};
+	if test ${no_overlays} = 0; then
+		for overlay in ${overlays};
+		do;
+			if run net_load_overlay; then
+				fdt resize ${filesize};
+				fdt apply ${fdto_addr};
+			fi;
+		done;
+	fi;