mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: rdu1: add default environment
@ 2019-12-17 11:40 Lucas Stach
  2019-12-18  7:32 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Lucas Stach @ 2019-12-17 11:40 UTC (permalink / raw)
  To: barebox

Adds scripts for network detection in development case and
autoboot from the SD card.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 arch/arm/boards/zii-imx51-rdu1/Makefile       |  1 +
 arch/arm/boards/zii-imx51-rdu1/board.c        |  3 +++
 .../zii-imx51-rdu1/defaultenv-rdu1/boot/net   | 24 +++++++++++++++++++
 .../zii-imx51-rdu1/defaultenv-rdu1/boot/nfs   |  6 +++++
 .../defaultenv-rdu1/boot/rdu-default          | 14 +++++++++++
 .../defaultenv-rdu1/network/eth0-discover     |  4 ++++
 .../defaultenv-rdu1/nv/autoboot_abort_key     |  1 +
 .../defaultenv-rdu1/nv/boot.default           |  1 +
 8 files changed, 54 insertions(+)
 create mode 100644 arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/boot/net
 create mode 100644 arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/boot/nfs
 create mode 100644 arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/boot/rdu-default
 create mode 100644 arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/network/eth0-discover
 create mode 100644 arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/nv/autoboot_abort_key
 create mode 100644 arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/nv/boot.default

diff --git a/arch/arm/boards/zii-imx51-rdu1/Makefile b/arch/arm/boards/zii-imx51-rdu1/Makefile
index 604b3621be59..a17cf5684adb 100644
--- a/arch/arm/boards/zii-imx51-rdu1/Makefile
+++ b/arch/arm/boards/zii-imx51-rdu1/Makefile
@@ -1,3 +1,4 @@
 obj-y += board.o
 CFLAGS_pbl-lowlevel.o := -fno-tree-switch-conversion -fno-jump-tables
 lwl-y += lowlevel.o
+bbenv-y += defaultenv-rdu1
diff --git a/arch/arm/boards/zii-imx51-rdu1/board.c b/arch/arm/boards/zii-imx51-rdu1/board.c
index f739f3b7b445..640bb0d1b70c 100644
--- a/arch/arm/boards/zii-imx51-rdu1/board.c
+++ b/arch/arm/boards/zii-imx51-rdu1/board.c
@@ -16,6 +16,7 @@
  */
 
 #include <common.h>
+#include <envfs.h>
 #include <init.h>
 #include <environment.h>
 #include <mach/bbu.h>
@@ -49,6 +50,8 @@ static int zii_rdu1_init(void)
 		BBU_HANDLER_FLAG_DEFAULT |
 		IMX_BBU_FLAG_PARTITION_STARTS_AT_HEADER);
 
+	defaultenv_append_directory(defaultenv_rdu1);
+
 	return 0;
 }
 coredevice_initcall(zii_rdu1_init);
diff --git a/arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/boot/net b/arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/boot/net
new file mode 100644
index 000000000000..4be8e1e2d79b
--- /dev/null
+++ b/arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/boot/net
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+path="/mnt/tftp"
+
+# clear seat network config
+global.linux.bootargs.rdu_network=
+
+global.bootm.image="${path}/${global.user}-linux-${global.hostname}"
+
+oftree="${path}/${global.user}-oftree-${global.hostname}"
+if [ -f "${oftree}" ]; then
+	global.bootm.oftree="$oftree"
+fi
+
+nfsroot="/home/${global.user}/nfsroot/${global.hostname}"
+
+ip_route_get -b ${global.net.server} global.linux.bootargs.dyn.ip
+
+initramfs="${path}/${global.user}-initramfs-${global.hostname}"
+if [ -f "${initramfs}" ]; then
+	global.bootm.initrd="$initramfs"
+else
+	global.linux.bootargs.dyn.root="root=/dev/nfs nfsroot=$nfsroot,v3,tcp"
+fi
diff --git a/arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/boot/nfs b/arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/boot/nfs
new file mode 100644
index 000000000000..0a2fa07b16e9
--- /dev/null
+++ b/arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/boot/nfs
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# clear seat network config (not implemented on RDU1 yet)
+#global.linux.bootargs.rdu_network=
+
+boot /mnt/nfs
diff --git a/arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/boot/rdu-default b/arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/boot/rdu-default
new file mode 100644
index 000000000000..97cc1dcdeab9
--- /dev/null
+++ b/arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/boot/rdu-default
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+sp.usb_power=1
+usb
+if [ "$bootsource" = "spi" ]; then
+	boot disk1.0 || boot disk2.0
+else
+	detect mmc0
+	if [ "$mmc0.boot" = "boot0" ]; then
+		boot mmc0.0
+	else
+		boot mmc0.1
+	fi
+fi
diff --git a/arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/network/eth0-discover b/arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/network/eth0-discover
new file mode 100644
index 000000000000..ce35613ef1b0
--- /dev/null
+++ b/arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/network/eth0-discover
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+sp.usb_power=1
+usb
diff --git a/arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/nv/autoboot_abort_key b/arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/nv/autoboot_abort_key
new file mode 100644
index 000000000000..55920c9a58ca
--- /dev/null
+++ b/arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/nv/autoboot_abort_key
@@ -0,0 +1 @@
+ctrl-c
\ No newline at end of file
diff --git a/arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/nv/boot.default b/arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/nv/boot.default
new file mode 100644
index 000000000000..9076a1e64eb5
--- /dev/null
+++ b/arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/nv/boot.default
@@ -0,0 +1 @@
+rdu-default
\ No newline at end of file
-- 
2.20.1


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM: rdu1: add default environment
  2019-12-17 11:40 [PATCH] ARM: rdu1: add default environment Lucas Stach
@ 2019-12-18  7:32 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2019-12-18  7:32 UTC (permalink / raw)
  To: Lucas Stach; +Cc: barebox

On Tue, Dec 17, 2019 at 12:40:42PM +0100, Lucas Stach wrote:
> Adds scripts for network detection in development case and
> autoboot from the SD card.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  arch/arm/boards/zii-imx51-rdu1/Makefile       |  1 +
>  arch/arm/boards/zii-imx51-rdu1/board.c        |  3 +++
>  .../zii-imx51-rdu1/defaultenv-rdu1/boot/net   | 24 +++++++++++++++++++
>  .../zii-imx51-rdu1/defaultenv-rdu1/boot/nfs   |  6 +++++
>  .../defaultenv-rdu1/boot/rdu-default          | 14 +++++++++++
>  .../defaultenv-rdu1/network/eth0-discover     |  4 ++++
>  .../defaultenv-rdu1/nv/autoboot_abort_key     |  1 +
>  .../defaultenv-rdu1/nv/boot.default           |  1 +
>  8 files changed, 54 insertions(+)
>  create mode 100644 arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/boot/net
>  create mode 100644 arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/boot/nfs
>  create mode 100644 arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/boot/rdu-default
>  create mode 100644 arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/network/eth0-discover
>  create mode 100644 arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/nv/autoboot_abort_key
>  create mode 100644 arch/arm/boards/zii-imx51-rdu1/defaultenv-rdu1/nv/boot.default

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-18  7:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-17 11:40 [PATCH] ARM: rdu1: add default environment Lucas Stach
2019-12-18  7:32 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox