[PATCH] ARM: rpi: add SD card environment support
Sascha Hauer
s.hauer at pengutronix.de
Wed Oct 16 03:44:42 EDT 2013
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 |
More information about the barebox
mailing list