diff options
author | Jan Remmet <j.remmet@phytec.de> | 2015-07-06 08:55:26 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-07-08 08:21:05 +0200 |
commit | c3d162e3e3c5549dc15d6c913abf0898f0c34407 (patch) | |
tree | fc44425b9fe724dc432d190097b859e6eedfc7f4 /arch/arm/mach-omap/xload.c | |
parent | 2afe71f5674a64707893a956156b12e7b7dc43c9 (diff) | |
download | barebox-c3d162e3e3c5549dc15d6c913abf0898f0c34407.tar.gz barebox-c3d162e3e3c5549dc15d6c913abf0898f0c34407.tar.xz |
ARM: am33xx: netboot use ramfs
Older tftp server don't send the file size.
Then tftpfs needs temporary place to store the file.
mount ramfs and then tftpfs in a own mount point
Signed-off-by: Jan Remmet <j.remmet@phytec.de>
Tested-by: Wadim Egorov <w.egorov@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.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/arch/arm/mach-omap/xload.c b/arch/arm/mach-omap/xload.c index 4a0714ed93..b0ce1d68c8 100644 --- a/arch/arm/mach-omap/xload.c +++ b/arch/arm/mach-omap/xload.c @@ -229,13 +229,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); @@ -247,7 +250,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; @@ -259,11 +277,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; } |