mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] ARM: rpi: add SD card environment support
Date: Wed, 16 Oct 2013 09:44:42 +0200	[thread overview]
Message-ID: <20131016074442.GO30088@pengutronix.de> (raw)
In-Reply-To: <20131015113630.GX32444@ns203013.ovh.net>

On Tue, Oct 15, 2013 at 01:36:30PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 12:50 Tue 15 Oct     , Sascha Hauer wrote:
> > +static int rpi_env_init(void)
> > +{
> > +	struct stat s;
> > +	const char *diskdev = "/dev/disk0.0";
> > +	int ret;
> > +
> > +	device_detect_by_name("mci0");
> > +
> > +	ret = stat(diskdev, &s);
> > +	if (ret) {
> > +		printf("no %s. using default env\n", diskdev);
> > +		return 0;
> > +	}
> > +
> > +	mkdir("/boot", 0666);
> > +	ret = mount(diskdev, "fat", "/boot");
> > +	if (ret) {
> > +		printf("failed to mount %s\n", diskdev);
> > +		return 0;
> > +	}
> > +
> > +	default_environment_path = "/boot/barebox.env";
> > +
> > +	return 0;
> > +}
> 
> can we drop all of this and do something like this
> 
> set_defaultenv and do not have custom code in the c duplicated everywhere?

That's probably a good idea. Right now it's just not clear to me how
such a code would look like. Omap does something similar to the above,
but additionally checks whether the device to mount is actually the
device the board started from.

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:[~2013-10-16  7:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-15 10:50 Sascha Hauer
2013-10-15 11:36 ` Jean-Christophe PLAGNIOL-VILLARD
2013-10-16  7:44   ` Sascha Hauer [this message]
2013-10-15 11:54 ` Andre Heider
2013-10-15 12:53   ` Sascha Hauer
2013-10-15 16:22     ` Andre Heider

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=20131016074442.GO30088@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    /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