mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] Add support for default env and mounting /boot to BeagleBoard
@ 2012-02-09 13:39 Robert P. J. Day
  2012-02-09 14:54 ` Premi, Sanjeev
  0 siblings, 1 reply; 3+ messages in thread
From: Robert P. J. Day @ 2012-02-09 13:39 UTC (permalink / raw)
  To: U-Boot Version 2 (barebox)


Stealing shamelessly from the panda/board.c file, add equivalent
support for checking for the default environment and automounting the
/boot partition on the SD card.

Also, include the necessary header files for this, and fix the
filename reference at the top of the file.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

---

  a quick and dirty theft of code from panda/board.c, it builds and
boots and appears to work.  thoughts?

diff --git a/arch/arm/boards/beagle/board.c b/arch/arm/boards/beagle/board.c
index faeaf8e..6825ef2 100644
--- a/arch/arm/boards/beagle/board.c
+++ b/arch/arm/boards/beagle/board.c
@@ -27,7 +27,7 @@
 /**
  * @page ti_beagle Texas Instruments Beagle Board
  *
- * FileName: arch/arm/boards/omap/board-beagle.c
+ * FileName: arch/arm/boards/beagle/board.c
  *
  * Beagle Board from Texas Instruments as described here:
  * http://www.beagleboard.org
@@ -55,6 +55,7 @@
 #include <common.h>
 #include <console.h>
 #include <init.h>
+#include <fs.h>
 #include <driver.h>
 #include <sizes.h>
 #include <io.h>
@@ -72,8 +73,10 @@
 #include <mach/ehci.h>
 #include <i2c/i2c.h>
 #include <linux/err.h>
+#include <linux/stat.h>
 #include <usb/ehci.h>
 #include <mach/xload.h>
+#include <environment.h>

 /******************** Board Boot Time *******************/

@@ -317,3 +320,30 @@ static int beagle_devices_init(void)
 	return 0;
 }
 device_initcall(beagle_devices_init);
+
+#ifdef CONFIG_DEFAULT_ENVIRONMENT
+static int beagle_env_init(void)
+{
+	struct stat s;
+	char *diskdev = "/dev/disk0.0";
+	int ret;
+
+	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/bareboxenv";
+
+	return 0;
+}
+late_initcall(beagle_env_init);
+#endif

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] Add support for default env and mounting /boot to BeagleBoard
  2012-02-09 13:39 [PATCH] Add support for default env and mounting /boot to BeagleBoard Robert P. J. Day
@ 2012-02-09 14:54 ` Premi, Sanjeev
  2012-02-09 16:35   ` Robert P. J. Day
  0 siblings, 1 reply; 3+ messages in thread
From: Premi, Sanjeev @ 2012-02-09 14:54 UTC (permalink / raw)
  To: Robert P. J. Day, U-Boot Version 2 (barebox)

> -----Original Message-----
> From: barebox-bounces@lists.infradead.org 
> [mailto:barebox-bounces@lists.infradead.org] On Behalf Of 
> Robert P. J. Day
> Sent: Thursday, February 09, 2012 7:10 PM
> To: U-Boot Version 2 (barebox)
> Subject: [PATCH] Add support for default env and mounting 
> /boot to BeagleBoard
> 
> 
> Stealing shamelessly from the panda/board.c file, add equivalent
> support for checking for the default environment and automounting the
> /boot partition on the SD card.
> 
> Also, include the necessary header files for this, and fix the
> filename reference at the top of the file.
> 
> Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
> 
> ---
> 
>   a quick and dirty theft of code from panda/board.c, it builds and
> boots and appears to work.  thoughts?
> 
> diff --git a/arch/arm/boards/beagle/board.c 
> b/arch/arm/boards/beagle/board.c
> index faeaf8e..6825ef2 100644
> --- a/arch/arm/boards/beagle/board.c
> +++ b/arch/arm/boards/beagle/board.c
> @@ -27,7 +27,7 @@
>  /**
>   * @page ti_beagle Texas Instruments Beagle Board
>   *
> - * FileName: arch/arm/boards/omap/board-beagle.c
> + * FileName: arch/arm/boards/beagle/board.c
>   *
>   * Beagle Board from Texas Instruments as described here:
>   * http://www.beagleboard.org
> @@ -55,6 +55,7 @@
>  #include <common.h>
>  #include <console.h>
>  #include <init.h>
> +#include <fs.h>
>  #include <driver.h>
>  #include <sizes.h>
>  #include <io.h>
> @@ -72,8 +73,10 @@
>  #include <mach/ehci.h>
>  #include <i2c/i2c.h>
>  #include <linux/err.h>
> +#include <linux/stat.h>
>  #include <usb/ehci.h>
>  #include <mach/xload.h>
> +#include <environment.h>
> 
>  /******************** Board Boot Time *******************/
> 
> @@ -317,3 +320,30 @@ static int beagle_devices_init(void)
>  	return 0;
>  }
>  device_initcall(beagle_devices_init);
> +
> +#ifdef CONFIG_DEFAULT_ENVIRONMENT
> +static int beagle_env_init(void)
> +{
> +	struct stat s;
> +	char *diskdev = "/dev/disk0.0";
> +	int ret;
> +
> +	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/bareboxenv";
> +
> +	return 0;
> +}
> +late_initcall(beagle_env_init);
> +#endif

Keeping this sequence, in init scripts makes things more & easily configurable.

~sanjeev
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] Add support for default env and mounting /boot to BeagleBoard
  2012-02-09 14:54 ` Premi, Sanjeev
@ 2012-02-09 16:35   ` Robert P. J. Day
  0 siblings, 0 replies; 3+ messages in thread
From: Robert P. J. Day @ 2012-02-09 16:35 UTC (permalink / raw)
  To: Premi, Sanjeev; +Cc: U-Boot Version 2 (barebox)

On Thu, 9 Feb 2012, Premi, Sanjeev wrote:

> >  /******************** Board Boot Time *******************/
> >
> > @@ -317,3 +320,30 @@ static int beagle_devices_init(void)
> >  	return 0;
> >  }
> >  device_initcall(beagle_devices_init);
> > +
> > +#ifdef CONFIG_DEFAULT_ENVIRONMENT
> > +static int beagle_env_init(void)
> > +{
> > +	struct stat s;
> > +	char *diskdev = "/dev/disk0.0";
> > +	int ret;
> > +
> > +	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/bareboxenv";
> > +
> > +	return 0;
> > +}
> > +late_initcall(beagle_env_init);
> > +#endif
>
> Keeping this sequence, in init scripts makes things more & easily configurable.

  i agree, it was a bad idea of mine.  so moving it *out* of the panda
code would make sense as well, yes?

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-02-09 16:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-09 13:39 [PATCH] Add support for default env and mounting /boot to BeagleBoard Robert P. J. Day
2012-02-09 14:54 ` Premi, Sanjeev
2012-02-09 16:35   ` Robert P. J. Day

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox