aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Herring <rob.herring@calxeda.com>2012-09-12 16:35:23 -0500
committerJohn Rigby <john.rigby@linaro.org>2012-12-06 13:51:52 -0700
commitc34a942ae367bde9506aa28278906f09f28823fb (patch)
treebca82a79436d7ce97b3d71ebd1a8ea5e4588c036
parent31770a3437e5cc10200754ae9f7c96fb20a86626 (diff)
downloadu-boot-linaro-next-c34a942ae367bde9506aa28278906f09f28823fb.tar.gz
cmd_pxe: add support for per arch and SoC default paths
A pxelinux server setup for "default" menu is typically an x86 binary. This does not work well with a mixed architecture setup. Extend the default search to look for default-<arch>-<soc> and then default-<arch> before falling back to just "default". Signed-off-by: Rob Herring <rob.herring@calxeda.com>
-rw-r--r--common/cmd_pxe.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index a89466d63..a314275b1 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -26,6 +26,13 @@
#define MAX_TFTP_PATH_LEN 127
+const char *pxe_default_paths[] = {
+ "default-" CONFIG_SYS_ARCH "-" CONFIG_SYS_SOC,
+ "default-" CONFIG_SYS_ARCH,
+ "default",
+ NULL
+};
+
/*
* Like getenv, but prints an error if envvar isn't defined in the
* environment. It always returns what getenv does, so it can be used in
@@ -358,7 +365,7 @@ do_pxe_get(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
char *pxefile_addr_str;
unsigned long pxefile_addr_r;
- int err;
+ int err, i = 0;
do_getfile = do_get_tftp;
@@ -381,14 +388,21 @@ do_pxe_get(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
*/
if (pxe_uuid_path((void *)pxefile_addr_r) > 0
|| pxe_mac_path((void *)pxefile_addr_r) > 0
- || pxe_ipaddr_paths((void *)pxefile_addr_r) > 0
- || get_pxelinux_path("default", (void *)pxefile_addr_r) > 0) {
+ || pxe_ipaddr_paths((void *)pxefile_addr_r) > 0) {
printf("Config file found\n");
return 0;
}
+ while (pxe_default_paths[i]) {
+ if (get_pxelinux_path(pxe_default_paths[i], (void *)pxefile_addr_r) > 0) {
+ printf("Config file found\n");
+ return 0;
+ }
+ i++;
+ }
+
printf("Config file not found\n");
return 1;