diff options
author | Daniel Schultz <d.schultz@phytec.de> | 2017-05-12 13:07:16 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-05-17 08:23:00 +0200 |
commit | 52daa4a94e7515aef7e29d92ebd483357129fbf2 (patch) | |
tree | 9b1cb4d24bcc3409c30b7781b68700d5cab23eef /arch/arm/mach-omap | |
parent | b9e0d4cf49706986544ea9fcacc5884377e70eed (diff) | |
download | barebox-52daa4a94e7515aef7e29d92ebd483357129fbf2.tar.gz barebox-52daa4a94e7515aef7e29d92ebd483357129fbf2.tar.xz |
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
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-omap')
-rw-r--r-- | arch/arm/mach-omap/omap_generic.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/arch/arm/mach-omap/omap_generic.c b/arch/arm/mach-omap/omap_generic.c index 1d03eac119..694c951037 100644 --- a/arch/arm/mach-omap/omap_generic.c +++ b/arch/arm/mach-omap/omap_generic.c @@ -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,29 @@ 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; } + ret = symlink(rootpath, "/boot"); + if (ret < 0) + pr_warn("Failed to create symlink from %s to %s\n", rootpath + , "/boot"); + + 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); |