summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap/xload.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-08-06 12:33:15 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-08-06 12:33:15 +0200
commit4ee01d2b469f65d92c6e7759152cd31fbfbb1414 (patch)
tree1d9f9af4fa6d169dfbe916811d6a2df3b2e9cdcd /arch/arm/mach-omap/xload.c
parentb32e327d3e8be662c8d69db8c64e750a9118345a (diff)
parent4f37af47a8bd14078b6a11485d38bef6ac6bdc86 (diff)
downloadbarebox-4ee01d2b469f65d92c6e7759152cd31fbfbb1414.tar.gz
barebox-4ee01d2b469f65d92c6e7759152cd31fbfbb1414.tar.xz
Merge branch 'for-next/misc'
Diffstat (limited to 'arch/arm/mach-omap/xload.c')
-rw-r--r--arch/arm/mach-omap/xload.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/arch/arm/mach-omap/xload.c b/arch/arm/mach-omap/xload.c
index 3cf7ff4f68..ebcbcbcde1 100644
--- a/arch/arm/mach-omap/xload.c
+++ b/arch/arm/mach-omap/xload.c
@@ -230,13 +230,16 @@ static void *omap_serial_boot(void){
return buf;
}
+#define TFTP_MOUNT "/.tftp"
+
static void *am33xx_net_boot(void)
{
void *buf = NULL;
int err;
int len;
struct dhcp_req_param dhcp_param;
- const char *bootfile;
+ const char *bootfile, *ip;
+ char *file;
am33xx_register_ethaddr(0, 0);
@@ -248,7 +251,22 @@ static void *am33xx_net_boot(void)
return NULL;
}
- err = mount(ip_to_string(net_get_serverip()), "tftp", "/", NULL);
+ /*
+ * Older tftp server don't send the file size.
+ * Then tftpfs needs temporary place to store the file.
+ */
+ err = mount("none", "ramfs", "/", NULL);
+ if (err < 0) {
+ printf("failed to mount ramfs\n");
+ return NULL;
+ }
+
+ err = make_directory(TFTP_MOUNT);
+ if (err)
+ return NULL;
+
+ ip = ip_to_string(net_get_serverip());
+ err = mount(ip, "tftp", TFTP_MOUNT, NULL);
if (err < 0) {
printf("Unable to mount.\n");
return NULL;
@@ -260,11 +278,15 @@ static void *am33xx_net_boot(void)
return NULL;
}
- buf = read_file(bootfile, &len);
+ file = asprintf("%s/%s", TFTP_MOUNT, bootfile);
+
+ buf = read_file(file, &len);
if (!buf)
printf("could not read %s.\n", bootfile);
- umount("/");
+ free(file);
+
+ umount(TFTP_MOUNT);
return buf;
}