mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-16 14:08:45 +00:00
pxe: add ipappend support
Add ipappend support to pass network device information to the kernel. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
This commit is contained in:
parent
58d9ff936f
commit
98f646764d
1 changed files with 44 additions and 3 deletions
|
@ -452,6 +452,7 @@ struct pxe_label {
|
||||||
char *append;
|
char *append;
|
||||||
char *initrd;
|
char *initrd;
|
||||||
char *fdt;
|
char *fdt;
|
||||||
|
int ipappend;
|
||||||
int attempted;
|
int attempted;
|
||||||
int localboot;
|
int localboot;
|
||||||
int localboot_val;
|
int localboot_val;
|
||||||
|
@ -585,7 +586,11 @@ static int label_boot(struct pxe_label *label)
|
||||||
{
|
{
|
||||||
char *bootm_argv[] = { "bootm", NULL, NULL, NULL, NULL };
|
char *bootm_argv[] = { "bootm", NULL, NULL, NULL, NULL };
|
||||||
char initrd_str[22];
|
char initrd_str[22];
|
||||||
|
char mac_str[29] = "";
|
||||||
|
char ip_str[68] = "";
|
||||||
|
char *bootargs;
|
||||||
int bootm_argc = 3;
|
int bootm_argc = 3;
|
||||||
|
int len = 0;
|
||||||
|
|
||||||
label_print(label);
|
label_print(label);
|
||||||
|
|
||||||
|
@ -624,9 +629,39 @@ static int label_boot(struct pxe_label *label)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (label->append) {
|
if (label->ipappend & 0x1) {
|
||||||
setenv("bootargs", label->append);
|
sprintf(ip_str, " ip=%s:%s:%s:%s",
|
||||||
printf("append: %s\n", label->append);
|
getenv("ipaddr"), getenv("serverip"),
|
||||||
|
getenv("gatewayip"), getenv("netmask"));
|
||||||
|
len += strlen(ip_str);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (label->ipappend & 0x2) {
|
||||||
|
int err;
|
||||||
|
strcpy(mac_str, " BOOTIF=");
|
||||||
|
err = format_mac_pxe(mac_str + 8, sizeof(mac_str) - 8);
|
||||||
|
if (err < 0)
|
||||||
|
mac_str[0] = '\0';
|
||||||
|
len += strlen(mac_str);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (label->append)
|
||||||
|
len += strlen(label->append);
|
||||||
|
|
||||||
|
if (len) {
|
||||||
|
bootargs = malloc(len + 1);
|
||||||
|
if (!bootargs)
|
||||||
|
return 1;
|
||||||
|
bootargs[0] = '\0';
|
||||||
|
if (label->append)
|
||||||
|
strcpy(bootargs, label->append);
|
||||||
|
strcat(bootargs, ip_str);
|
||||||
|
strcat(bootargs, mac_str);
|
||||||
|
|
||||||
|
setenv("bootargs", bootargs);
|
||||||
|
printf("append: %s\n", bootargs);
|
||||||
|
|
||||||
|
free(bootargs);
|
||||||
}
|
}
|
||||||
|
|
||||||
bootm_argv[1] = getenv("kernel_addr_r");
|
bootm_argv[1] = getenv("kernel_addr_r");
|
||||||
|
@ -689,6 +724,7 @@ enum token_type {
|
||||||
T_INCLUDE,
|
T_INCLUDE,
|
||||||
T_FDT,
|
T_FDT,
|
||||||
T_ONTIMEOUT,
|
T_ONTIMEOUT,
|
||||||
|
T_IPAPPEND,
|
||||||
T_INVALID
|
T_INVALID
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -718,6 +754,7 @@ static const struct token keywords[] = {
|
||||||
{"include", T_INCLUDE},
|
{"include", T_INCLUDE},
|
||||||
{"fdt", T_FDT},
|
{"fdt", T_FDT},
|
||||||
{"ontimeout", T_ONTIMEOUT,},
|
{"ontimeout", T_ONTIMEOUT,},
|
||||||
|
{"ipappend", T_IPAPPEND,},
|
||||||
{NULL, T_INVALID}
|
{NULL, T_INVALID}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1109,6 +1146,10 @@ static int parse_label(char **c, struct pxe_menu *cfg)
|
||||||
err = parse_integer(c, &label->localboot_val);
|
err = parse_integer(c, &label->localboot_val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case T_IPAPPEND:
|
||||||
|
err = parse_integer(c, &label->ipappend);
|
||||||
|
break;
|
||||||
|
|
||||||
case T_EOL:
|
case T_EOL:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue