mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/7] arm: mach-omap: Change file flags in emmc handler
@ 2017-04-28 12:46 Daniel Schultz
  2017-04-28 12:46 ` [PATCH 2/7] arm: boards: Add MLO handler for EMMC devices Daniel Schultz
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Daniel Schultz @ 2017-04-28 12:46 UTC (permalink / raw)
  To: barebox

This handler tries to read from a file descriptor with 'write only'
flags and fails. Add read permissions for the file, so the handler can
read the partition layout.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
---
 arch/arm/mach-omap/am33xx_bbu_emmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap/am33xx_bbu_emmc.c b/arch/arm/mach-omap/am33xx_bbu_emmc.c
index 3220575..d3adb37 100644
--- a/arch/arm/mach-omap/am33xx_bbu_emmc.c
+++ b/arch/arm/mach-omap/am33xx_bbu_emmc.c
@@ -39,7 +39,7 @@ static int emmc_mlo_handler(struct bbu_handler *handler, struct bbu_data *data)
 	if (ret != 0)
 		return ret;
 
-	fd = open(handler->devicefile, O_WRONLY);
+	fd = open(handler->devicefile, O_RDWR);
 	if (fd < 0) {
 		pr_err("could not open %s: %s\n", handler->devicefile,
 			errno_str());
-- 
1.9.1


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

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

* [PATCH 2/7] arm: boards: Add MLO handler for EMMC devices
  2017-04-28 12:46 [PATCH 1/7] arm: mach-omap: Change file flags in emmc handler Daniel Schultz
@ 2017-04-28 12:46 ` Daniel Schultz
  2017-04-28 12:46 ` [PATCH 3/7] arm: mach-omap: Change mountpoint of boot partitions Daniel Schultz
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Daniel Schultz @ 2017-04-28 12:46 UTC (permalink / raw)
  To: barebox

This patch enables the barebox handler to flash MLOs on EMMC devices
with 'barebox_update'.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
---
 arch/arm/boards/phytec-som-am335x/board.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boards/phytec-som-am335x/board.c b/arch/arm/boards/phytec-som-am335x/board.c
index 7f62453..dc3b84a 100644
--- a/arch/arm/boards/phytec-som-am335x/board.c
+++ b/arch/arm/boards/phytec-som-am335x/board.c
@@ -112,6 +112,7 @@ static int physom_devices_init(void)
 		xloadslots, ARRAY_SIZE(xloadslots));
 	am33xx_bbu_nand_slots_register_handler("nand", nandslots,
 				ARRAY_SIZE(nandslots));
+	am33xx_bbu_emmc_mlo_register_handler("MLO.emmc", "/dev/mmc1");
 
 	if (IS_ENABLED(CONFIG_SHELL_NONE))
 		return am33xx_of_register_bootdevice();
-- 
1.9.1


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

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

* [PATCH 3/7] arm: mach-omap: Change mountpoint of boot partitions
  2017-04-28 12:46 [PATCH 1/7] arm: mach-omap: Change file flags in emmc handler Daniel Schultz
  2017-04-28 12:46 ` [PATCH 2/7] arm: boards: Add MLO handler for EMMC devices Daniel Schultz
@ 2017-04-28 12:46 ` Daniel Schultz
  2017-05-02  6:52   ` Sascha Hauer
  2017-04-28 12:46 ` [PATCH 4/7] arm: boards: phytec-som-am335x: Add automount script Daniel Schultz
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: Daniel Schultz @ 2017-04-28 12:46 UTC (permalink / raw)
  To: barebox

If using EMMC and SD as bootsources, mounting the boot partition of both
devices to /boot makes trouble. Either the correct device is mounted to
/boot or a remount of /boot has to be performed.

To ensure this problem each MMCn bootsource will be mounted to his own
path in /mnt/{mmc,emmc}.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
---
 arch/arm/mach-omap/omap_generic.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-omap/omap_generic.c b/arch/arm/mach-omap/omap_generic.c
index 1d03eac..7c50806 100644
--- a/arch/arm/mach-omap/omap_generic.c
+++ b/arch/arm/mach-omap/omap_generic.c
@@ -113,10 +113,15 @@ const char *omap_get_bootmmc_devname(void)
 }
 
 #if defined(CONFIG_ENV_HANDLING)
-#define ENV_PATH "/boot/barebox.env"
+#define MMC_PATH "/mnt/mmc/"
+#define MMC_ENV_PATH MMC_PATH "barebox.env"
+#define EMMC_PATH "/mnt/emmc/"
+#define EMMC_ENV_PATH EMMC_PATH "barebox.env"
 static int omap_env_init(void)
 {
 	char *partname;
+	char *mntpath;
+	char *envpath;
 	const char *diskdev;
 	int ret;
 
@@ -132,15 +137,24 @@ static int omap_env_init(void)
 
 	partname = basprintf("/dev/%s.0", diskdev);
 
-	mkdir("/boot", 0666);
-	ret = mount(partname, "fat", "/boot", NULL);
+	if (bootsource_get_instance() == 1) {
+		mntpath = EMMC_PATH;
+		envpath = EMMC_ENV_PATH;
+	} else {
+		mntpath = MMC_PATH;
+		envpath = MMC_ENV_PATH;
+	}
+	mkdir("/mnt", 0666);
+	mkdir(MMC_PATH, 0666);
+	mkdir(EMMC_PATH, 0666);
+	ret = mount(partname, "fat", mntpath, NULL);
 	if (ret) {
 		pr_err("Failed to load environment: mount %s failed (%d)\n", partname, ret);
 		goto out;
 	}
 
-	pr_debug("Loading default env from %s on device %s\n", ENV_PATH, partname);
-	default_environment_path_set(ENV_PATH);
+	pr_debug("Loading default env from %s on device %s\n", envpath, partname);
+	default_environment_path_set(envpath);
 
 out:
 	free(partname);
-- 
1.9.1


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

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

* [PATCH 4/7] arm: boards: phytec-som-am335x: Add automount script
  2017-04-28 12:46 [PATCH 1/7] arm: mach-omap: Change file flags in emmc handler Daniel Schultz
  2017-04-28 12:46 ` [PATCH 2/7] arm: boards: Add MLO handler for EMMC devices Daniel Schultz
  2017-04-28 12:46 ` [PATCH 3/7] arm: mach-omap: Change mountpoint of boot partitions Daniel Schultz
@ 2017-04-28 12:46 ` Daniel Schultz
  2017-04-28 12:46 ` [PATCH 5/7] arm: boards: phytec-som-am335x: Update boot scripts Daniel Schultz
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Daniel Schultz @ 2017-04-28 12:46 UTC (permalink / raw)
  To: barebox

Each boot source is mounted to either /mnt/mmc or /mnt/emmc. To make the
not-mounted boot source available in Barebox, an automount script mounts
this device to /mnt/{mmc, emmc}, if the directory will be accessed.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
---
 .../defaultenv-physom-am335x/init/automount           | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/init/automount

diff --git a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/init/automount b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/init/automount
new file mode 100644
index 0000000..3d109ec
--- /dev/null
+++ b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/init/automount
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# automount tftp server based on $eth0.serverip
+
+mkdir -p /mnt/tftp
+automount /mnt/tftp 'ifup eth0 && mount -t tftp $eth0.serverip /mnt/tftp'
+
+# automount nfs server's nfsroot
+
+mkdir -p /mnt/nfs
+automount /mnt/nfs 'ifup eth0 && mount -t nfs ${eth0.serverip}:/home/${global.user}/nfsroot/${global.hostname} /mnt/nfs'
+
+#automount SD card and EMMC boot partitions
+
+if [ $bootsource = mmc -a $bootsource_instance = 1 ]; then
+	automount /mnt/mmc '[ -e /dev/mmc0.0 ] && mount /dev/mmc0.0 /mnt/mmc'
+else
+	automount /mnt/emmc '[ -e /dev/mmc1.0 ] && mount /dev/mmc1.0 /mnt/emmc'
+fi
-- 
1.9.1


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

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

* [PATCH 5/7] arm: boards: phytec-som-am335x: Update boot scripts
  2017-04-28 12:46 [PATCH 1/7] arm: mach-omap: Change file flags in emmc handler Daniel Schultz
                   ` (2 preceding siblings ...)
  2017-04-28 12:46 ` [PATCH 4/7] arm: boards: phytec-som-am335x: Add automount script Daniel Schultz
@ 2017-04-28 12:46 ` Daniel Schultz
  2017-04-28 12:46 ` [PATCH 6/7] arm: boards: beaglebone: " Daniel Schultz
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Daniel Schultz @ 2017-04-28 12:46 UTC (permalink / raw)
  To: barebox

Expand the boot scripts with EMMC and add a default file source for
expansions.

Removed "rw" and "rootwait" bootargs from existing boot scripts.
Added "rootflags='data=journal'" bootarg to SD card boot script.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
---
 .../defaultenv-physom-am335x/boot/emmc                  |  7 +++++++
 .../phytec-som-am335x/defaultenv-physom-am335x/boot/mmc |  7 ++++---
 .../defaultenv-physom-am335x/boot/nand                  |  4 +++-
 .../phytec-som-am335x/defaultenv-physom-am335x/boot/net | 17 +++++++++++++++++
 .../phytec-som-am335x/defaultenv-physom-am335x/boot/spi |  4 +++-
 .../defaultenv-physom-am335x/init/bootsource            | 16 ++++++++++++----
 6 files changed, 46 insertions(+), 9 deletions(-)
 create mode 100644 arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/emmc
 create mode 100644 arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/net

diff --git a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/emmc b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/emmc
new file mode 100644
index 0000000..ed0f240
--- /dev/null
+++ b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/emmc
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+[ -e /env/config-expansions ] && /env/config-expansions
+
+global.bootm.image=/mnt/emmc/linuximage
+global.bootm.oftree=/mnt/emmc/oftree
+global.linux.bootargs.dyn.root="root=/dev/mmcblk1p2 rootflags='data=journal'"
diff --git a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc
index 834669d..21b16f4 100644
--- a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc
+++ b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc
@@ -1,6 +1,7 @@
 #!/bin/sh
 
-global.bootm.image=/boot/linuximage
-global.bootm.oftree=/boot/oftree
+[ -e /env/config-expansions ] && /env/config-expansions
 
-global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rw rootwait"
+global.bootm.image=/mnt/mmc/linuximage
+global.bootm.oftree=/mnt/mmc/oftree
+global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootflags='data=journal'"
diff --git a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/nand b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/nand
index ece44b7..fa695bb 100644
--- a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/nand
+++ b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/nand
@@ -1,8 +1,10 @@
 #!/bin/sh
 
+[ -e /env/config-expansions ] && /env/config-expansions
+
 [ ! -e /dev/nand0.root.ubi ] && ubiattach /dev/nand0.root
 
 global.bootm.image="/dev/nand0.root.ubi.kernel"
 global.bootm.oftree="/dev/nand0.root.ubi.oftree"
 
-global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=root rw rootfstype=ubifs"
+global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=root rootfstype=ubifs"
diff --git a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/net b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/net
new file mode 100644
index 0000000..6dbd2aa
--- /dev/null
+++ b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/net
@@ -0,0 +1,17 @@
+#!/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
+
+[ -e /env/config-expansions ] && /env/config-expansions
+
+global.linux.bootargs.dyn.root="root=/dev/nfs nfsroot=$nfsroot,vers=3,udp"
diff --git a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/spi b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/spi
index 71c5834..2d88626 100644
--- a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/spi
+++ b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/spi
@@ -1,7 +1,9 @@
 #!/bin/sh
 
+[ -e /env/config-expansions ] && /env/config-expansions
+
 global.bootm.image="/dev/m25p0.kernel"
 global.bootm.oftree="/dev/m25p0.oftree"
 
 # Use rootfs from NAND
-global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root rw rootfstype=ubifs"
+global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=nand0.root rootfstype=ubifs"
diff --git a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/init/bootsource b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/init/bootsource
index 3f2ff4b..61a0879 100644
--- a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/init/bootsource
+++ b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/init/bootsource
@@ -4,12 +4,20 @@ if [ -n "$nv.boot.default" ]; then
 	exit
 fi
 
-if [ $bootsource = mmc ]; then
-	global.boot.default="mmc nand spi net"
+if [ -e /dev/mmc1.0 ]; then
+	nvmem="emmc"
+else
+	nvmem="nand"
+fi
+
+if [ $bootsource = mmc -a $bootsource_instance = 1 ]; then
+	global.boot.default="emmc mmc spi net"
+elif [ $bootsource = mmc -a $bootsource_instance = 0 ]; then
+	global.boot.default="mmc $nvmem spi net"
 elif [ $bootsource = nand ]; then
 	global.boot.default="nand spi mmc net"
 elif [ $bootsource = spi ]; then
-	global.boot.default="spi nand mmc net"
+	global.boot.default="spi $nvmem mmc net"
 elif [ $bootsource = net ]; then
-	global.boot.default="net nand spi mmc"
+	global.boot.default="net $nvmem spi mmc"
 fi
-- 
1.9.1


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

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

* [PATCH 6/7] arm: boards: beaglebone: Update boot scripts
  2017-04-28 12:46 [PATCH 1/7] arm: mach-omap: Change file flags in emmc handler Daniel Schultz
                   ` (3 preceding siblings ...)
  2017-04-28 12:46 ` [PATCH 5/7] arm: boards: phytec-som-am335x: Update boot scripts Daniel Schultz
@ 2017-04-28 12:46 ` Daniel Schultz
  2017-05-02  7:11   ` Sascha Hauer
  2017-04-28 12:46 ` [PATCH 7/7] arm: boards: afi-gf: Update SD card boot script Daniel Schultz
  2017-05-05  7:03 ` [PATCH 1/7] arm: mach-omap: Change file flags in emmc handler Sascha Hauer
  6 siblings, 1 reply; 10+ messages in thread
From: Daniel Schultz @ 2017-04-28 12:46 UTC (permalink / raw)
  To: barebox

Remove the current SD boot script and add support for MMC, EMMC and
network bootsources.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
---
 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/emmc  |  9 +++++++++
 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/mmc   |  9 +++++++++
 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd    |  6 ------
 .../boards/beaglebone/defaultenv-beaglebone/init/bootsource | 13 +++++++++++++
 4 files changed, 31 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/emmc
 create mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/mmc
 delete mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd
 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..5734e3b
--- /dev/null
+++ b/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/emmc
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if [ -e /mnt/emmc/linuximage ]
+	global.bootm.image=/mnt/emmc/linuximage
+else
+	global.bootm.image=/mnt/emmc/uImage
+fi
+global.bootm.oftree=/mnt/emmc/oftree
+global.linux.bootargs.dyn.root="root=/dev/mmcblk1p2 rootflags='data=journal'"
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..e8bd769
--- /dev/null
+++ b/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/mmc
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if [ -e /mnt/mmc/linuximage ]
+	global.bootm.image=/mnt/mmc/linuximage
+else
+	global.bootm.image=/mnt/mmc/uImage
+fi
+global.bootm.oftree=/mnt/mmc/oftree
+global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootflags='data=journal'"
diff --git a/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd b/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd
deleted file mode 100644
index aa94b2f..0000000
--- a/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-global.bootm.image=/boot/uImage
-global.bootm.oftree=/boot/oftree
-#global.bootm.initrd=<path to initrd>
-global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootfstype=ext4 rootwait"
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..6301d1d
--- /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] 10+ messages in thread

* [PATCH 7/7] arm: boards: afi-gf: Update SD card boot script
  2017-04-28 12:46 [PATCH 1/7] arm: mach-omap: Change file flags in emmc handler Daniel Schultz
                   ` (4 preceding siblings ...)
  2017-04-28 12:46 ` [PATCH 6/7] arm: boards: beaglebone: " Daniel Schultz
@ 2017-04-28 12:46 ` Daniel Schultz
  2017-05-05  7:03 ` [PATCH 1/7] arm: mach-omap: Change file flags in emmc handler Sascha Hauer
  6 siblings, 0 replies; 10+ messages in thread
From: Daniel Schultz @ 2017-04-28 12:46 UTC (permalink / raw)
  To: barebox

The default mount path for SD cards changed from /boot to /mnt/mmc.
Updated paths in SD card boot script.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
---
 arch/arm/boards/afi-gf/defaultenv-gf/boot/sd | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boards/afi-gf/defaultenv-gf/boot/sd b/arch/arm/boards/afi-gf/defaultenv-gf/boot/sd
index aa94b2f..30f373e 100644
--- a/arch/arm/boards/afi-gf/defaultenv-gf/boot/sd
+++ b/arch/arm/boards/afi-gf/defaultenv-gf/boot/sd
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-global.bootm.image=/boot/uImage
-global.bootm.oftree=/boot/oftree
+global.bootm.image=/mnt/mmc/uImage
+global.bootm.oftree=/mnt/mmc/oftree
 #global.bootm.initrd=<path to initrd>
 global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootfstype=ext4 rootwait"
-- 
1.9.1


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

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

* Re: [PATCH 3/7] arm: mach-omap: Change mountpoint of boot partitions
  2017-04-28 12:46 ` [PATCH 3/7] arm: mach-omap: Change mountpoint of boot partitions Daniel Schultz
@ 2017-05-02  6:52   ` Sascha Hauer
  0 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2017-05-02  6:52 UTC (permalink / raw)
  To: Daniel Schultz; +Cc: barebox

Hi Daniel,

On Fri, Apr 28, 2017 at 02:46:04PM +0200, Daniel Schultz wrote:
> If using EMMC and SD as bootsources, mounting the boot partition of both
> devices to /boot makes trouble. Either the correct device is mounted to
> /boot or a remount of /boot has to be performed.
> 
> To ensure this problem each MMCn bootsource will be mounted to his own
> path in /mnt/{mmc,emmc}.
> 
> Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
> ---
>  arch/arm/mach-omap/omap_generic.c | 24 +++++++++++++++++++-----
>  1 file changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/mach-omap/omap_generic.c b/arch/arm/mach-omap/omap_generic.c
> index 1d03eac..7c50806 100644
> --- a/arch/arm/mach-omap/omap_generic.c
> +++ b/arch/arm/mach-omap/omap_generic.c
> @@ -113,10 +113,15 @@ const char *omap_get_bootmmc_devname(void)
>  }
>  
>  #if defined(CONFIG_ENV_HANDLING)
> -#define ENV_PATH "/boot/barebox.env"
> +#define MMC_PATH "/mnt/mmc/"
> +#define MMC_ENV_PATH MMC_PATH "barebox.env"
> +#define EMMC_PATH "/mnt/emmc/"
> +#define EMMC_ENV_PATH EMMC_PATH "barebox.env"
>  static int omap_env_init(void)
>  {
>  	char *partname;
> +	char *mntpath;
> +	char *envpath;
>  	const char *diskdev;
>  	int ret;
>  
> @@ -132,15 +137,24 @@ static int omap_env_init(void)
>  
>  	partname = basprintf("/dev/%s.0", diskdev);
>  
> -	mkdir("/boot", 0666);
> -	ret = mount(partname, "fat", "/boot", NULL);
> +	if (bootsource_get_instance() == 1) {
> +		mntpath = EMMC_PATH;
> +		envpath = EMMC_ENV_PATH;
> +	} else {
> +		mntpath = MMC_PATH;
> +		envpath = MMC_ENV_PATH;
> +	}

Hardcoding that one instance is eMMC while the other is a SD card slot
is not so nice.

> +	mkdir("/mnt", 0666);
> +	mkdir(MMC_PATH, 0666);
> +	mkdir(EMMC_PATH, 0666);
> +	ret = mount(partname, "fat", mntpath, NULL);

You could use cdev_mount_default() instead of mount directly. This
function only mounts when it's not mounted already and returns the
path the device is mounted to.

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] 10+ messages in thread

* Re: [PATCH 6/7] arm: boards: beaglebone: Update boot scripts
  2017-04-28 12:46 ` [PATCH 6/7] arm: boards: beaglebone: " Daniel Schultz
@ 2017-05-02  7:11   ` Sascha Hauer
  0 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2017-05-02  7:11 UTC (permalink / raw)
  To: Daniel Schultz; +Cc: barebox

On Fri, Apr 28, 2017 at 02:46:07PM +0200, Daniel Schultz wrote:
> Remove the current SD boot script and add support for MMC, EMMC and
> network bootsources.
> 
> Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
> ---
>  arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/emmc  |  9 +++++++++
>  arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/mmc   |  9 +++++++++
>  arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd    |  6 ------
>  .../boards/beaglebone/defaultenv-beaglebone/init/bootsource | 13 +++++++++++++
>  4 files changed, 31 insertions(+), 6 deletions(-)
>  create mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/emmc
>  create mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/mmc
>  delete mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd
>  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..5734e3b
> --- /dev/null
> +++ b/arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/emmc
> @@ -0,0 +1,9 @@
> +#!/bin/sh
> +
> +if [ -e /mnt/emmc/linuximage ]
> +	global.bootm.image=/mnt/emmc/linuximage
> +else
> +	global.bootm.image=/mnt/emmc/uImage
> +fi
> +global.bootm.oftree=/mnt/emmc/oftree
> +global.linux.bootargs.dyn.root="root=/dev/mmcblk1p2 rootflags='data=journal'"

I know I asked this quite some times already, but: Why not bootloader
spec? grepping for "global.bootm.image=" shows that we expect the kernel
at "/linuximage", "/zImage" or "/uImage", depending on the board.
"data=journal" is only valid for ext4 and even there is not an option
everybody wants to have.
With bootloader spec the rootfs can describe itself which kernel(s)
shall be started with which devicetrees. From barebox it's easy aswell,
only type "boot mmcx" and you're done.

With these bootscripts the first one who comes decides how the board is
intended to be used. I really don't want to have this in generic boards.

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] 10+ messages in thread

* Re: [PATCH 1/7] arm: mach-omap: Change file flags in emmc handler
  2017-04-28 12:46 [PATCH 1/7] arm: mach-omap: Change file flags in emmc handler Daniel Schultz
                   ` (5 preceding siblings ...)
  2017-04-28 12:46 ` [PATCH 7/7] arm: boards: afi-gf: Update SD card boot script Daniel Schultz
@ 2017-05-05  7:03 ` Sascha Hauer
  6 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2017-05-05  7:03 UTC (permalink / raw)
  To: Daniel Schultz; +Cc: barebox

On Fri, Apr 28, 2017 at 02:46:02PM +0200, Daniel Schultz wrote:
> This handler tries to read from a file descriptor with 'write only'
> flags and fails. Add read permissions for the file, so the handler can
> read the partition layout.
> 
> Signed-off-by: Daniel Schultz <d.schultz@phytec.de>

Applied this one and 2/7 for now.

Sascha

> ---
>  arch/arm/mach-omap/am33xx_bbu_emmc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-omap/am33xx_bbu_emmc.c b/arch/arm/mach-omap/am33xx_bbu_emmc.c
> index 3220575..d3adb37 100644
> --- a/arch/arm/mach-omap/am33xx_bbu_emmc.c
> +++ b/arch/arm/mach-omap/am33xx_bbu_emmc.c
> @@ -39,7 +39,7 @@ static int emmc_mlo_handler(struct bbu_handler *handler, struct bbu_data *data)
>  	if (ret != 0)
>  		return ret;
>  
> -	fd = open(handler->devicefile, O_WRONLY);
> +	fd = open(handler->devicefile, O_RDWR);
>  	if (fd < 0) {
>  		pr_err("could not open %s: %s\n", handler->devicefile,
>  			errno_str());
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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] 10+ messages in thread

end of thread, other threads:[~2017-05-05  7:04 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-28 12:46 [PATCH 1/7] arm: mach-omap: Change file flags in emmc handler Daniel Schultz
2017-04-28 12:46 ` [PATCH 2/7] arm: boards: Add MLO handler for EMMC devices Daniel Schultz
2017-04-28 12:46 ` [PATCH 3/7] arm: mach-omap: Change mountpoint of boot partitions Daniel Schultz
2017-05-02  6:52   ` Sascha Hauer
2017-04-28 12:46 ` [PATCH 4/7] arm: boards: phytec-som-am335x: Add automount script Daniel Schultz
2017-04-28 12:46 ` [PATCH 5/7] arm: boards: phytec-som-am335x: Update boot scripts Daniel Schultz
2017-04-28 12:46 ` [PATCH 6/7] arm: boards: beaglebone: " Daniel Schultz
2017-05-02  7:11   ` Sascha Hauer
2017-04-28 12:46 ` [PATCH 7/7] arm: boards: afi-gf: Update SD card boot script Daniel Schultz
2017-05-05  7:03 ` [PATCH 1/7] arm: mach-omap: Change file flags in emmc handler Sascha Hauer

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