mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Daniel Schultz <d.schultz@phytec.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 3/7] arm: mach-omap: Change mountpoint of boot partitions
Date: Tue, 2 May 2017 08:52:43 +0200	[thread overview]
Message-ID: <20170502065243.at6bsonkk3ya6odh@pengutronix.de> (raw)
In-Reply-To: <1493383568-27798-3-git-send-email-d.schultz@phytec.de>

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

  reply	other threads:[~2017-05-02  6:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170502065243.at6bsonkk3ya6odh@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=d.schultz@phytec.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox