summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap/xload.c
diff options
context:
space:
mode:
authorJan Weitzel <j.weitzel@phytec.de>2014-11-13 13:31:46 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2014-11-19 07:45:37 +0100
commitb3f62a06ea42b36d48ac47fa9d8318622dc319ce (patch)
treec2ddc46f68e76d46d0121ca2c968f256c0f1f3a9 /arch/arm/mach-omap/xload.c
parent47a019a3d46652dab4715ba167881adfbea44d28 (diff)
downloadbarebox-b3f62a06ea42b36d48ac47fa9d8318622dc319ce.tar.gz
barebox-b3f62a06ea42b36d48ac47fa9d8318622dc319ce.tar.xz
ARM: omap: Add bootsource serial to xload
If booted from serial via xmodem, also get barebox.bin per xmodem For first stage you need the .pblx file instead of MLO. Add serial boot to am335x_mlo_defconfig introduce some cleanups by savedefconfig Signed-off-by: Jan Weitzel <j.weitzel@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-omap/xload.c')
-rw-r--r--arch/arm/mach-omap/xload.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/arch/arm/mach-omap/xload.c b/arch/arm/mach-omap/xload.c
index e9d7bbb2e9..8d9d84c85c 100644
--- a/arch/arm/mach-omap/xload.c
+++ b/arch/arm/mach-omap/xload.c
@@ -11,6 +11,7 @@
#include <sizes.h>
#include <malloc.h>
#include <filetype.h>
+#include <xymodem.h>
#include <mach/generic.h>
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,