Re: [PATCH 2/2] ARM: omap: Add bootsource serial to xload

2014-11-13 Thread Jan Weitzel


Am 13.11.2014 um 08:37 schrieb Sascha Hauer:

On Wed, Nov 12, 2014 at 10:24:48AM +0100, Jan Weitzel wrote:

Am 12.11.2014 um 09:22 schrieb Sascha Hauer:

Hi Jan,

On Wed, Nov 12, 2014 at 08:41:54AM +0100, Jan Weitzel wrote:

If booted from serial via xmodem, also get barebox.bin per xmodem
For first stage you need the .pblx file instead of MLO.

Signed-off-by: Jan Weitzel 
---
  arch/arm/mach-omap/Kconfig |  7 +++
  arch/arm/mach-omap/xload.c | 46 ++
  2 files changed, 53 insertions(+)

diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
index f9b5ec3..953dd8f 100644
--- a/arch/arm/mach-omap/Kconfig
+++ b/arch/arm/mach-omap/Kconfig
@@ -118,6 +118,13 @@ config OMAP4_USBBOOT
  You need the utility program omap4_usbboot to boot from USB.
  Please read omap4_usb_booting.txt for more information.
+config OMAP_SERIALBOOT
+   bool
+   default y

No default y please. Better keep it disabled by default because the
OMAP4 xload configs are quiet tight I think.

Is adding it to am335x_mlo_defconfig ok? Because of the size I added the
ARCH_AM33XX dependency.

I overlooked this dependency. So the dependency is only because of the
binary size and it's otherwise usable on Omap aswell? In this case I
suggest to drop the dependency. And yes, ok to add it to the
am335x_mlo_defconfig.


Only AM335x set BOOTSOURCE_SERIAL by now
Jan



Sascha




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


Re: [PATCH 2/2] ARM: omap: Add bootsource serial to xload

2014-11-12 Thread Sascha Hauer
On Wed, Nov 12, 2014 at 10:24:48AM +0100, Jan Weitzel wrote:
> Am 12.11.2014 um 09:22 schrieb Sascha Hauer:
> >Hi Jan,
> >
> >On Wed, Nov 12, 2014 at 08:41:54AM +0100, Jan Weitzel wrote:
> >>If booted from serial via xmodem, also get barebox.bin per xmodem
> >>For first stage you need the .pblx file instead of MLO.
> >>
> >>Signed-off-by: Jan Weitzel 
> >>---
> >>  arch/arm/mach-omap/Kconfig |  7 +++
> >>  arch/arm/mach-omap/xload.c | 46 
> >> ++
> >>  2 files changed, 53 insertions(+)
> >>
> >>diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
> >>index f9b5ec3..953dd8f 100644
> >>--- a/arch/arm/mach-omap/Kconfig
> >>+++ b/arch/arm/mach-omap/Kconfig
> >>@@ -118,6 +118,13 @@ config OMAP4_USBBOOT
> >>  You need the utility program omap4_usbboot to boot from USB.
> >>  Please read omap4_usb_booting.txt for more information.
> >>+config OMAP_SERIALBOOT
> >>+   bool
> >>+   default y
> >No default y please. Better keep it disabled by default because the
> >OMAP4 xload configs are quiet tight I think.
> 
> Is adding it to am335x_mlo_defconfig ok? Because of the size I added the
> ARCH_AM33XX dependency.

I overlooked this dependency. So the dependency is only because of the
binary size and it's otherwise usable on Omap aswell? In this case I
suggest to drop the dependency. And yes, ok to add it to the
am335x_mlo_defconfig.

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- |

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


Re: [PATCH 2/2] ARM: omap: Add bootsource serial to xload

2014-11-12 Thread Jan Weitzel

Am 12.11.2014 um 09:22 schrieb Sascha Hauer:

Hi Jan,

On Wed, Nov 12, 2014 at 08:41:54AM +0100, Jan Weitzel wrote:

If booted from serial via xmodem, also get barebox.bin per xmodem
For first stage you need the .pblx file instead of MLO.

Signed-off-by: Jan Weitzel 
---
  arch/arm/mach-omap/Kconfig |  7 +++
  arch/arm/mach-omap/xload.c | 46 ++
  2 files changed, 53 insertions(+)

diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
index f9b5ec3..953dd8f 100644
--- a/arch/arm/mach-omap/Kconfig
+++ b/arch/arm/mach-omap/Kconfig
@@ -118,6 +118,13 @@ config OMAP4_USBBOOT
  You need the utility program omap4_usbboot to boot from USB.
  Please read omap4_usb_booting.txt for more information.
  
+config OMAP_SERIALBOOT

+   bool
+   default y

No default y please. Better keep it disabled by default because the
OMAP4 xload configs are quiet tight I think.


Is adding it to am335x_mlo_defconfig ok? Because of the size I added the
ARCH_AM33XX dependency.

Jan



Sascha



+   select XYMODEM
+   select FS_RAMFS
+   depends on ARCH_AM33XX && SHELL_NONE
+
  config OMAP_MULTI_BOARDS
bool "Allow multiple boards to be selected"
select HAVE_DEFAULT_ENVIRONMENT_NEW
diff --git a/arch/arm/mach-omap/xload.c b/arch/arm/mach-omap/xload.c
index e9d7bbb..8d9d84c 100644
--- a/arch/arm/mach-omap/xload.c
+++ b/arch/arm/mach-omap/xload.c
@@ -11,6 +11,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  
  struct omap_barebox_part *barebox_part;

@@ -184,6 +185,45 @@ static void *omap4_xload_boot_usb(void){
return buf;
  }
  
+static void *omap_serial_boot(void){

+   struct console_device *cdev;
+   int ret;
+   void *buf;
+   int len;
+   int fd;
+
+   /* need temporary place to store file */
+   ret = mount("none", "ramfs", "/", NULL);
+   if (ret < 0) {
+   printf("failed to mount ramfs\n");
+   return NULL;
+   }
+
+   cdev = console_get_first_active();
+   if (!cdev) {
+   printf("failed to get console\n");
+   return NULL;
+   }
+
+   fd = open("/barebox.bin", O_WRONLY | O_CREAT);
+   if (fd < 0) {
+   printf("could not create barebox.bin\n");
+   return NULL;
+   }
+
+   ret = do_load_serial_xmodem(cdev, fd);
+   if (ret < 0) {
+   printf("loadx failed\n");
+   return NULL;
+   }
+
+   buf = read_file("/barebox.bin", &len);
+   if (!buf)
+   printf("could not read barebox.bin from serial\n");
+
+   return buf;
+}
+
  /*
   * Replaces the default shell in xload configuration
   */
@@ -218,6 +258,12 @@ static __noreturn int omap_xload(void)
func = omap_xload_boot_spi(barebox_part->nor_offset,
barebox_part->nor_size);
break;
+   case BOOTSOURCE_SERIAL:
+   if (IS_ENABLED(CONFIG_OMAP_SERIALBOOT)) {
+   printf("booting from serial\n");
+   func = omap_serial_boot();
+   break;
+   }
default:
printf("unknown boot source. Fall back to nand\n");
func = omap_xload_boot_nand(barebox_part->nand_offset,
--
1.9.1


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




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


Re: [PATCH 2/2] ARM: omap: Add bootsource serial to xload

2014-11-12 Thread Sascha Hauer
Hi Jan,

On Wed, Nov 12, 2014 at 08:41:54AM +0100, Jan Weitzel wrote:
> If booted from serial via xmodem, also get barebox.bin per xmodem
> For first stage you need the .pblx file instead of MLO.
> 
> Signed-off-by: Jan Weitzel 
> ---
>  arch/arm/mach-omap/Kconfig |  7 +++
>  arch/arm/mach-omap/xload.c | 46 
> ++
>  2 files changed, 53 insertions(+)
> 
> diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
> index f9b5ec3..953dd8f 100644
> --- a/arch/arm/mach-omap/Kconfig
> +++ b/arch/arm/mach-omap/Kconfig
> @@ -118,6 +118,13 @@ config OMAP4_USBBOOT
> You need the utility program omap4_usbboot to boot from USB.
> Please read omap4_usb_booting.txt for more information.
>  
> +config OMAP_SERIALBOOT
> + bool
> + default y

No default y please. Better keep it disabled by default because the
OMAP4 xload configs are quiet tight I think.

Sascha


> + select XYMODEM
> + select FS_RAMFS
> + depends on ARCH_AM33XX && SHELL_NONE
> +
>  config OMAP_MULTI_BOARDS
>   bool "Allow multiple boards to be selected"
>   select HAVE_DEFAULT_ENVIRONMENT_NEW
> diff --git a/arch/arm/mach-omap/xload.c b/arch/arm/mach-omap/xload.c
> index e9d7bbb..8d9d84c 100644
> --- a/arch/arm/mach-omap/xload.c
> +++ b/arch/arm/mach-omap/xload.c
> @@ -11,6 +11,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  
>  struct omap_barebox_part *barebox_part;
> @@ -184,6 +185,45 @@ static void *omap4_xload_boot_usb(void){
>   return buf;
>  }
>  
> +static void *omap_serial_boot(void){
> + struct console_device *cdev;
> + int ret;
> + void *buf;
> + int len;
> + int fd;
> +
> + /* need temporary place to store file */
> + ret = mount("none", "ramfs", "/", NULL);
> + if (ret < 0) {
> + printf("failed to mount ramfs\n");
> + return NULL;
> + }
> +
> + cdev = console_get_first_active();
> + if (!cdev) {
> + printf("failed to get console\n");
> + return NULL;
> + }
> +
> + fd = open("/barebox.bin", O_WRONLY | O_CREAT);
> + if (fd < 0) {
> + printf("could not create barebox.bin\n");
> + return NULL;
> + }
> +
> + ret = do_load_serial_xmodem(cdev, fd);
> + if (ret < 0) {
> + printf("loadx failed\n");
> + return NULL;
> + }
> +
> + buf = read_file("/barebox.bin", &len);
> + if (!buf)
> + printf("could not read barebox.bin from serial\n");
> +
> + return buf;
> +}
> +
>  /*
>   * Replaces the default shell in xload configuration
>   */
> @@ -218,6 +258,12 @@ static __noreturn int omap_xload(void)
>   func = omap_xload_boot_spi(barebox_part->nor_offset,
>   barebox_part->nor_size);
>   break;
> + case BOOTSOURCE_SERIAL:
> + if (IS_ENABLED(CONFIG_OMAP_SERIALBOOT)) {
> + printf("booting from serial\n");
> + func = omap_serial_boot();
> + break;
> + }
>   default:
>   printf("unknown boot source. Fall back to nand\n");
>   func = omap_xload_boot_nand(barebox_part->nand_offset,
> -- 
> 1.9.1
> 
> 
> ___
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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- |

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


[PATCH 2/2] ARM: omap: Add bootsource serial to xload

2014-11-11 Thread Jan Weitzel
If booted from serial via xmodem, also get barebox.bin per xmodem
For first stage you need the .pblx file instead of MLO.

Signed-off-by: Jan Weitzel 
---
 arch/arm/mach-omap/Kconfig |  7 +++
 arch/arm/mach-omap/xload.c | 46 ++
 2 files changed, 53 insertions(+)

diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
index f9b5ec3..953dd8f 100644
--- a/arch/arm/mach-omap/Kconfig
+++ b/arch/arm/mach-omap/Kconfig
@@ -118,6 +118,13 @@ config OMAP4_USBBOOT
  You need the utility program omap4_usbboot to boot from USB.
  Please read omap4_usb_booting.txt for more information.
 
+config OMAP_SERIALBOOT
+   bool
+   default y
+   select XYMODEM
+   select FS_RAMFS
+   depends on ARCH_AM33XX && SHELL_NONE
+
 config OMAP_MULTI_BOARDS
bool "Allow multiple boards to be selected"
select HAVE_DEFAULT_ENVIRONMENT_NEW
diff --git a/arch/arm/mach-omap/xload.c b/arch/arm/mach-omap/xload.c
index e9d7bbb..8d9d84c 100644
--- a/arch/arm/mach-omap/xload.c
+++ b/arch/arm/mach-omap/xload.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 struct omap_barebox_part *barebox_part;
@@ -184,6 +185,45 @@ static void *omap4_xload_boot_usb(void){
return buf;
 }
 
+static void *omap_serial_boot(void){
+   struct console_device *cdev;
+   int ret;
+   void *buf;
+   int len;
+   int fd;
+
+   /* need temporary place to store file */
+   ret = mount("none", "ramfs", "/", NULL);
+   if (ret < 0) {
+   printf("failed to mount ramfs\n");
+   return NULL;
+   }
+
+   cdev = console_get_first_active();
+   if (!cdev) {
+   printf("failed to get console\n");
+   return NULL;
+   }
+
+   fd = open("/barebox.bin", O_WRONLY | O_CREAT);
+   if (fd < 0) {
+   printf("could not create barebox.bin\n");
+   return NULL;
+   }
+
+   ret = do_load_serial_xmodem(cdev, fd);
+   if (ret < 0) {
+   printf("loadx failed\n");
+   return NULL;
+   }
+
+   buf = read_file("/barebox.bin", &len);
+   if (!buf)
+   printf("could not read barebox.bin from serial\n");
+
+   return buf;
+}
+
 /*
  * Replaces the default shell in xload configuration
  */
@@ -218,6 +258,12 @@ static __noreturn int omap_xload(void)
func = omap_xload_boot_spi(barebox_part->nor_offset,
barebox_part->nor_size);
break;
+   case BOOTSOURCE_SERIAL:
+   if (IS_ENABLED(CONFIG_OMAP_SERIALBOOT)) {
+   printf("booting from serial\n");
+   func = omap_serial_boot();
+   break;
+   }
default:
printf("unknown boot source. Fall back to nand\n");
func = omap_xload_boot_nand(barebox_part->nand_offset,
-- 
1.9.1


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