From: Andre Heider <a.heider@gmail.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] ARM: rpi: add SD card environment support
Date: Tue, 15 Oct 2013 13:54:50 +0200 [thread overview]
Message-ID: <20131015115448.GA41386@gmail.com> (raw)
In-Reply-To: <1381834214-12603-1-git-send-email-s.hauer@pengutronix.de>
Hi,
On Tue, Oct 15, 2013 at 12:50:14PM +0200, Sascha Hauer wrote:
> Similar to the OMAP boards mount the SD card to /boot and expect
> the environment as /boot/barebox.env
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> arch/arm/boards/raspberry-pi/rpi.c | 33 +++++++++++++++++++++++++++++++--
> 1 file changed, 31 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/boards/raspberry-pi/rpi.c b/arch/arm/boards/raspberry-pi/rpi.c
> index d4912cc..971a603 100644
> --- a/arch/arm/boards/raspberry-pi/rpi.c
> +++ b/arch/arm/boards/raspberry-pi/rpi.c
> @@ -15,6 +15,9 @@
>
> #include <common.h>
> #include <init.h>
> +#include <fs.h>
> +#include <linux/stat.h>
> +#include <envfs.h>
> #include <asm/armlinux.h>
> #include <generated/mach-types.h>
>
> @@ -37,11 +40,37 @@ static int rpi_console_init(void)
> }
> console_initcall(rpi_console_init);
>
> +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;
> +}
I was solving the same thing just yesterday ;)
What I did was to create a env/init/automount script, what's the advantage of this approach?
Regards,
Andre
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2013-10-15 11:55 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
2013-10-15 11:54 ` Andre Heider [this message]
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=20131015115448.GA41386@gmail.com \
--to=a.heider@gmail.com \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.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