* [PATCH] ARM: boards: Fix beaglebone enviroment
@ 2015-09-03 7:17 Daniel Schultz
2015-09-04 6:00 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Schultz @ 2015-09-03 7:17 UTC (permalink / raw)
To: barebox
This patch adds missing enviroment files to boot from different sources.
Also adds the handling of default bootsources.
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
---
.../arm/boards/beaglebone/defaultenv-beaglebone/boot/emmc | 6 ++++++
arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/mmc | 6 ++++++
arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/net | 15 +++++++++++++++
.../beaglebone/defaultenv-beaglebone/init/bootsource | 13 +++++++++++++
4 files changed, 40 insertions(+)
create mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/emmc
create mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/mmc
create mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/net
create mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/init/bootsource
diff --git a/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/emmc b/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/emmc
new file mode 100644
index 0000000..cc2bea2
--- /dev/null
+++ b/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/emmc
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+mount /dev/mmc1.0 /mnt/
+global.bootm.image=/mnt/linuximage
+global.bootm.oftree=/mnt/oftree
+global.linux.bootargs.dyn.root="root=/dev/mmcblk1p2 rootwait rw"
diff --git a/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/mmc b/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/mmc
new file mode 100644
index 0000000..96255d5
--- /dev/null
+++ b/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/mmc
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+mount /dev/mmc0.0 /mnt/
+global.bootm.image=/mnt/linuximage
+global.bootm.oftree=/mnt/oftree
+global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootwait rw"
diff --git a/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/net b/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/net
new file mode 100644
index 0000000..5ca4bad
--- /dev/null
+++ b/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/net
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+path="/mnt/tftp"
+
+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="/nfsroot/${global.hostname}"
+bootargs-ip
+/env/config-expansions
+global.linux.bootargs.dyn.root="root=/dev/nfs nfsroot=$nfsroot,vers=3,udp rw"
diff --git a/arch/arm/boards/beaglebone/defaultenv-beaglebone/init/bootsource b/arch/arm/boards/beaglebone/defaultenv-beaglebone/init/bootsource
new file mode 100644
index 0000000..c36d723
--- /dev/null
+++ b/arch/arm/boards/beaglebone/defaultenv-beaglebone/init/bootsource
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+if [ -n "$nv.boot.default" ]; then
+ exit
+fi
+
+if [ $bootsource = mmc -a $bootsource_instance = 1 ]; then
+ global.boot.default="emmc mmc net"
+elif [ $bootsource = mmc -a $bootsource_instance = 0 ]; then
+ global.boot.default="mmc emmc net"
+elif [ $bootsource = net ]; then
+ global.boot.default="net emmc mmc"
+fi
--
1.9.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: boards: Fix beaglebone enviroment
2015-09-03 7:17 [PATCH] ARM: boards: Fix beaglebone enviroment Daniel Schultz
@ 2015-09-04 6:00 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2015-09-04 6:00 UTC (permalink / raw)
To: Daniel Schultz; +Cc: barebox
On Thu, Sep 03, 2015 at 09:17:29AM +0200, Daniel Schultz wrote:
> This patch adds missing enviroment files to boot from different sources.
> Also adds the handling of default bootsources.
>
> Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
> ---
> .../arm/boards/beaglebone/defaultenv-beaglebone/boot/emmc | 6 ++++++
> arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/mmc | 6 ++++++
> arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/net | 15 +++++++++++++++
> .../beaglebone/defaultenv-beaglebone/init/bootsource | 13 +++++++++++++
> 4 files changed, 40 insertions(+)
> create mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/emmc
> create mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/mmc
> create mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/net
> create mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/init/bootsource
>
> diff --git a/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/emmc b/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/emmc
> new file mode 100644
> index 0000000..cc2bea2
> --- /dev/null
> +++ b/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/emmc
> @@ -0,0 +1,6 @@
> +#!/bin/sh
> +
> +mount /dev/mmc1.0 /mnt/
> +global.bootm.image=/mnt/linuximage
> +global.bootm.oftree=/mnt/oftree
> +global.linux.bootargs.dyn.root="root=/dev/mmcblk1p2 rootwait rw"
> diff --git a/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/mmc b/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/mmc
> new file mode 100644
> index 0000000..96255d5
> --- /dev/null
> +++ b/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/mmc
> @@ -0,0 +1,6 @@
> +#!/bin/sh
> +
> +mount /dev/mmc0.0 /mnt/
> +global.bootm.image=/mnt/linuximage
> +global.bootm.oftree=/mnt/oftree
> +global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootwait rw"
This assumes a specific probe order of devices in Linux. What for
example when the external SD card is not plugged in? The eMMC will
become mmcblk0p2 then. Also we assume a very specific layout of the SD
card which is not documented (separate boot partition, root partition
right after that). Could you have a look at bootloader spec which solves
all these problems?
The short version is: Put your rootfs into a partition on the SD card.
In the same filesystem put a file /loader/entries/jessie.conf:
title Debian Jessy
version 4.2
options rootwait
linux-appendroot true
linux /boot/zImage
devicetree /boot/am335x-boneblack.dtb
Put the kernel/devicetree to the specified paths in the same filesystem.
In barebox you only have to type 'boot mmc0' or 'boot mmc1' depending
where your rootfs is, or create a nv.boot.default variable containing
the mmc0/1 device.
The appropriate root= option for the kernel will be appended
automatically by barebox when the 'linux-appendroot' option is set to
true in the bootloader spec entry.
> diff --git a/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/net b/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/net
> new file mode 100644
> index 0000000..5ca4bad
> --- /dev/null
> +++ b/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/net
> @@ -0,0 +1,15 @@
> +#!/bin/sh
> +
> +path="/mnt/tftp"
> +
> +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="/nfsroot/${global.hostname}"
> +bootargs-ip
> +/env/config-expansions
> +global.linux.bootargs.dyn.root="root=/dev/nfs nfsroot=$nfsroot,vers=3,udp rw"
except for the /env/config-expansions which does not exist in mainline
this should be the same as in mainline, right?
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 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:[~2015-09-04 6:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-03 7:17 [PATCH] ARM: boards: Fix beaglebone enviroment Daniel Schultz
2015-09-04 6:00 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox