Skip to contentSkip to conversation

arm: mach-omap: Change mountpoint of boot partitions

PATCH Superseded Daniel Schultz 2 participants 9 messages May 5, 2017 – May 12, 2017

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/5 arm: mach-omap: Change mountpoint of boot partitions

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/mmcN.0

---
 arch/arm/mach-omap/omap_generic.c | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)
arch/arm/mach-omap/omap_generic.c +20 -11
index 1d03eac..aa7424d 100644
@@ -113,12 +113,15 @@ const char *omap_get_bootmmc_devname(void)
 }
 
 #if defined(CONFIG_ENV_HANDLING)
-#define ENV_PATH "/boot/barebox.env"
+static char *envpath = "/mnt/mmc0.0/barebox.env";
+
 static int omap_env_init(void)
 {
-	char *partname;
-	const char *diskdev;
 	int ret;
+	const char *diskdev;
+	char *partname;
+	struct cdev *cdev;
+	const char *rootpath;
 
 	if (bootsource_get() != BOOTSOURCE_MMC)
 		return 0;
@@ -129,18 +132,24 @@ static int omap_env_init(void)
 		diskdev = "disk0";
 
 	device_detect_by_name(diskdev);
+	partname = basprintf("%s.0", diskdev);
+	cdev = cdev_by_name(partname);
+	if (cdev == NULL) {
+		pr_err("Failed to get device %s\n", partname);
+		goto out;
+	}
 
-	partname = basprintf("/dev/%s.0", diskdev);
-
-	mkdir("/boot", 0666);
-	ret = mount(partname, "fat", "/boot", NULL);
-	if (ret) {
-		pr_err("Failed to load environment: mount %s failed (%d)\n", partname, ret);
+	rootpath = cdev_mount_default(cdev, NULL);
+	if (IS_ERR(rootpath)) {
+		pr_err("Failed to load environment: mount %s failed (%d)\n",
+						cdev->name, IS_ERR(rootpath));
 		goto out;
 	}
+	envpath = basprintf("%s/barebox.env", rootpath);
 
-	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);
Signature · 7 lines
1.9.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH v2 2/5 arm: boards: phytec-som-am335x: Add automount script

Each MMC boot source is mounted to /mnt/mmcN.0. To make the not-mounted boot source available in Barebox, an automount script mounts this device also to /mnt/, if the directory will be accessed.

---
 .../defaultenv-physom-am335x/init/automount         | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/init/automount
arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/init/automount new file +21 -0
new file mode 100644
index 0000000..53ecbe3
@@ -0,0 +1,21 @@
+#!/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
+	mkdir -p /mnt/mmc0.0
+	automount /mnt/mmc0.0 '[ -e /dev/mmc0.0 ] && mount /dev/mmc0.0 /mnt/mmc0.0'
+else
+	mkdir -p /mnt/mmc1.0
+	automount /mnt/mmc1.0 '[ -e /dev/mmc1.0 ] && mount /dev/mmc1.0 /mnt/mmc1.0'
+fi
Signature · 7 lines
1.9.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH v2 3/5 arm: boards: phytec-som-am335x: Update boot scripts

In reply to Daniel Schultz

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.

---
 .../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
arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/emmc new file +7 -0
new file mode 100644
index 0000000..6ad5f87
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+[ -e /env/config-expansions ] && /env/config-expansions
+
+global.bootm.image=/mnt/mmc1.0/linuximage
+global.bootm.oftree=/mnt/mmc1.0/oftree
+global.linux.bootargs.dyn.root="root=/dev/mmcblk1p2 rootflags='data=journal'"
arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc +4 -3
index 834669d..0fefeb2 100644
@@ -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/mmc0.0/linuximage
+global.bootm.oftree=/mnt/mmc0.0/oftree
+global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootflags='data=journal'"
arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/nand +3 -1
index ece44b7..fa695bb 100644
@@ -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"
arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/net new file +17 -0
new file mode 100644
index 0000000..6dbd2aa
@@ -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"
arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/spi +3 -1
index 71c5834..2d88626 100644
@@ -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"
arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/init/bootsource +12 -4
index 3f2ff4b..61a0879 100644
@@ -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
Signature · 7 lines
1.9.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH v2 4/5 arm: boards: beaglebone: Delete default env

In reply to Daniel Schultz

The Beaglebone environment should be set from outside with an application specific environment.

---
 arch/arm/boards/beaglebone/Makefile                                 | 1 -
 arch/arm/boards/beaglebone/board.c                                  | 2 --
 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd            | 6 ------
 .../arm/boards/beaglebone/defaultenv-beaglebone/init/usb-limit-1300 | 5 -----
 4 files changed, 14 deletions(-)
 delete mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd
 delete mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/init/usb-limit-1300
arch/arm/boards/beaglebone/Makefile +0 -1
index 21a1a29..092c31d 100644
@@ -1,3 +1,2 @@
 lwl-y += lowlevel.o
 obj-y += board.o
-bbenv-y += defaultenv-beaglebone
arch/arm/boards/beaglebone/board.c +0 -2
index 5717c45..fc16aea 100644
@@ -85,8 +85,6 @@ static int beaglebone_devices_init(void)
 
 	black = is_beaglebone_black();
 
-	defaultenv_append_directory(defaultenv_beaglebone);
-
 	globalvar_add_simple("board.variant", black ? "boneblack" : "bone");
 
 	printf("detected 'BeagleBone %s'\n", black ? "Black" : "White");
arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd deleted +0 -6
deleted file mode 100644
index aa94b2f..0000000
@@ -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"
arch/arm/boards/beaglebone/defaultenv-beaglebone/init/usb-limit-1300 deleted +0 -5
deleted file mode 100644
index 56313bf..0000000
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-echo -n "changing USB current limit to 1300 mA... "
-i2c_write -b 0 -a 0x24 -r 0x01 0x3e
-echo "done"
Signature · 7 lines
1.9.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

Re: [PATCH v2 4/5] arm: boards: beaglebone: Delete default env

Hi Daniel,

Quoted 2 lines · Daniel Schultz

The Beaglebone environment should be set from outside with an application specific environment.

I don't understand this. What are you trying to archieve and why?

Sascha

Quoted 64 lines
---
 arch/arm/boards/beaglebone/Makefile                                 | 1 -
 arch/arm/boards/beaglebone/board.c                                  | 2 --
 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd            | 6 ------
 .../arm/boards/beaglebone/defaultenv-beaglebone/init/usb-limit-1300 | 5 -----
 4 files changed, 14 deletions(-)
 delete mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd
 delete mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/init/usb-limit-1300
arch/arm/boards/beaglebone/Makefile +0 -1
index 21a1a29..092c31d 100644
@@ -1,3 +1,2 @@
 lwl-y += lowlevel.o
 obj-y += board.o
-bbenv-y += defaultenv-beaglebone
arch/arm/boards/beaglebone/board.c +0 -2
index 5717c45..fc16aea 100644
@@ -85,8 +85,6 @@ static int beaglebone_devices_init(void)
 
 	black = is_beaglebone_black();
 
-	defaultenv_append_directory(defaultenv_beaglebone);
-
 	globalvar_add_simple("board.variant", black ? "boneblack" : "bone");
 
 	printf("detected 'BeagleBone %s'\n", black ? "Black" : "White");
arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd deleted +0 -6
deleted file mode 100644
index aa94b2f..0000000
@@ -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"
arch/arm/boards/beaglebone/defaultenv-beaglebone/init/usb-limit-1300 deleted +0 -5
deleted file mode 100644
index 56313bf..0000000
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-echo -n "changing USB current limit to 1300 mA... "
-i2c_write -b 0 -a 0x24 -r 0x01 0x3e
-echo "done"
Signature · 7 lines
1.9.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

Re: [PATCH v2 4/5] arm: boards: beaglebone: Delete default env

Hi Sascha,

Am 08.05.2017 um 14:57 schrieb Sascha Hauer:

Quoted 8 lines

Hi Daniel,

Quoted 2 lines · Daniel Schultz

The Beaglebone environment should be set from outside with an application specific environment.

I don't understand this. What are you trying to archieve and why?

I thought you prefer the bootloader spec way without a predefined environment, but maybe I just had misunderstood you. If so, I will only change the mount path of the boot partition.

Signature · 3 lines
Mit freundlichen Grüßen,
With best regards,
  Daniel Schultz
Quoted 61 lines

Sascha

Quoted 59 lines
---
 arch/arm/boards/beaglebone/Makefile                                 | 1 -
 arch/arm/boards/beaglebone/board.c                                  | 2 --
 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd            | 6 ------
 .../arm/boards/beaglebone/defaultenv-beaglebone/init/usb-limit-1300 | 5 -----
 4 files changed, 14 deletions(-)
 delete mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd
 delete mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/init/usb-limit-1300
arch/arm/boards/beaglebone/Makefile +0 -1
index 21a1a29..092c31d 100644
@@ -1,3 +1,2 @@
 lwl-y += lowlevel.o
 obj-y += board.o
-bbenv-y += defaultenv-beaglebone
arch/arm/boards/beaglebone/board.c +0 -2
index 5717c45..fc16aea 100644
@@ -85,8 +85,6 @@ static int beaglebone_devices_init(void)
 
 	black = is_beaglebone_black();
 
-	defaultenv_append_directory(defaultenv_beaglebone);
-
 	globalvar_add_simple("board.variant", black ? "boneblack" : "bone");
 
 	printf("detected 'BeagleBone %s'\n", black ? "Black" : "White");
arch/arm/boards/beaglebone/defaultenv-beaglebone/boot/sd deleted +0 -6
deleted file mode 100644
index aa94b2f..0000000
@@ -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"
arch/arm/boards/beaglebone/defaultenv-beaglebone/init/usb-limit-1300 deleted +0 -6
deleted file mode 100644
index 56313bf..0000000
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-echo -n "changing USB current limit to 1300 mA... "
-i2c_write -b 0 -a 0x24 -r 0x01 0x3e
-echo "done"
--

1.9.1

Quoted 6 lines
Quoted 5 lines

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#6 lore raw

PATCH v2 5/5 arm: boards: afi-gf: Update SD card boot script

In reply to Daniel Schultz

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

---
 arch/arm/boards/afi-gf/defaultenv-gf/boot/sd | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boards/afi-gf/defaultenv-gf/boot/sd +2 -2
index aa94b2f..1a6fab5 100644
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-global.bootm.image=/boot/uImage
-global.bootm.oftree=/boot/oftree
+global.bootm.image=/mnt/mmc0.0/uImage
+global.bootm.oftree=/mnt/mmc0.0/oftree
 #global.bootm.initrd=<path to initrd>
 global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rootfstype=ext4 rootwait"
Signature · 7 lines
1.9.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw
In reply to Daniel Schultz

Hi Daniel,

Your series wasn't forgotten. It's only that it took me some time to try and implement links to directories. With this series I just sent and "fs: Create automount entries for the default mount pathes" you should be able to make this series a bit nicer. What I think of is that /boot becomes a link to /mnt/mmcx.y or whatever provided /boot previously.

Could you give it a try?

Sascha

Quoted 77 lines

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/mmcN.0

---
 arch/arm/mach-omap/omap_generic.c | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)
arch/arm/mach-omap/omap_generic.c +20 -11
index 1d03eac..aa7424d 100644
@@ -113,12 +113,15 @@ const char *omap_get_bootmmc_devname(void)
 }
 
 #if defined(CONFIG_ENV_HANDLING)
-#define ENV_PATH "/boot/barebox.env"
+static char *envpath = "/mnt/mmc0.0/barebox.env";
+
 static int omap_env_init(void)
 {
-	char *partname;
-	const char *diskdev;
 	int ret;
+	const char *diskdev;
+	char *partname;
+	struct cdev *cdev;
+	const char *rootpath;
 
 	if (bootsource_get() != BOOTSOURCE_MMC)
 		return 0;
@@ -129,18 +132,24 @@ static int omap_env_init(void)
 		diskdev = "disk0";
 
 	device_detect_by_name(diskdev);
+	partname = basprintf("%s.0", diskdev);
+	cdev = cdev_by_name(partname);
+	if (cdev == NULL) {
+		pr_err("Failed to get device %s\n", partname);
+		goto out;
+	}
 
-	partname = basprintf("/dev/%s.0", diskdev);
-
-	mkdir("/boot", 0666);
-	ret = mount(partname, "fat", "/boot", NULL);
-	if (ret) {
-		pr_err("Failed to load environment: mount %s failed (%d)\n", partname, ret);
+	rootpath = cdev_mount_default(cdev, NULL);
+	if (IS_ERR(rootpath)) {
+		pr_err("Failed to load environment: mount %s failed (%d)\n",
+						cdev->name, IS_ERR(rootpath));
 		goto out;
 	}
+	envpath = basprintf("%s/barebox.env", rootpath);
 
-	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);
Signature · 7 lines
1.9.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#8 lore raw

Hi,

Am 11.05.2017 um 11:14 schrieb Sascha Hauer:

Quoted 9 lines

Hi Daniel,

Your series wasn't forgotten. It's only that it took me some time to try and implement links to directories. With this series I just sent and "fs: Create automount entries for the default mount pathes" you should be able to make this series a bit nicer. What I think of is that /boot becomes a link to /mnt/mmcx.y or whatever provided /boot previously.

Could you give it a try?

I added this to the newest patch series. Now, all AM335x boards can either boot from /boot or one of the /mnt/ boot partitions. Non Phytec Boards won't need an environment change. Thanks!

You can decide if you want the 4th path (delete BBB environment).

Daniel

Quoted 81 lines

Sascha

Quoted 77 lines

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/mmcN.0

---
 arch/arm/mach-omap/omap_generic.c | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)
arch/arm/mach-omap/omap_generic.c +20 -12
index 1d03eac..aa7424d 100644
@@ -113,12 +113,15 @@ const char *omap_get_bootmmc_devname(void)
 }
 
 #if defined(CONFIG_ENV_HANDLING)
-#define ENV_PATH "/boot/barebox.env"
+static char *envpath = "/mnt/mmc0.0/barebox.env";
+
 static int omap_env_init(void)
 {
-	char *partname;
-	const char *diskdev;
 	int ret;
+	const char *diskdev;
+	char *partname;
+	struct cdev *cdev;
+	const char *rootpath;
 
 	if (bootsource_get() != BOOTSOURCE_MMC)
 		return 0;
@@ -129,18 +132,24 @@ static int omap_env_init(void)
 		diskdev = "disk0";
 
 	device_detect_by_name(diskdev);
+	partname = basprintf("%s.0", diskdev);
+	cdev = cdev_by_name(partname);
+	if (cdev == NULL) {
+		pr_err("Failed to get device %s\n", partname);
+		goto out;
+	}
 
-	partname = basprintf("/dev/%s.0", diskdev);
-
-	mkdir("/boot", 0666);
-	ret = mount(partname, "fat", "/boot", NULL);
-	if (ret) {
-		pr_err("Failed to load environment: mount %s failed (%d)\n", partname, ret);
+	rootpath = cdev_mount_default(cdev, NULL);
+	if (IS_ERR(rootpath)) {
+		pr_err("Failed to load environment: mount %s failed (%d)\n",
+						cdev->name, IS_ERR(rootpath));
 		goto out;
 	}
+	envpath = basprintf("%s/barebox.env", rootpath);
 
-	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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Signature · 8 lines
Mit freundlichen Grüßen,
With best regards,
  Daniel Schultz

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox