Merge pull request #892 from jluebbe/bios
bios: support passing tftp filename to the 'netboot' command
This commit is contained in:
commit
65a4886b72
|
@ -487,9 +487,13 @@ static void netboot_from_bin(const char * filename, unsigned int ip, unsigned sh
|
||||||
boot(0, 0, 0, MAIN_RAM_BASE);
|
boot(0, 0, 0, MAIN_RAM_BASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void netboot(void)
|
void netboot(int nb_params, char **params)
|
||||||
{
|
{
|
||||||
unsigned int ip;
|
unsigned int ip;
|
||||||
|
char * filename = NULL;
|
||||||
|
|
||||||
|
if (nb_params > 0 )
|
||||||
|
filename = params[0];
|
||||||
|
|
||||||
printf("Booting from network...\n");
|
printf("Booting from network...\n");
|
||||||
|
|
||||||
|
@ -499,6 +503,10 @@ void netboot(void)
|
||||||
ip = IPTOINT(remote_ip[0], remote_ip[1], remote_ip[2], remote_ip[3]);
|
ip = IPTOINT(remote_ip[0], remote_ip[1], remote_ip[2], remote_ip[3]);
|
||||||
udp_start(macadr, IPTOINT(local_ip[0], local_ip[1], local_ip[2], local_ip[3]));
|
udp_start(macadr, IPTOINT(local_ip[0], local_ip[1], local_ip[2], local_ip[3]));
|
||||||
|
|
||||||
|
if (filename) {
|
||||||
|
printf("Booting from %s (JSON)...\n", filename);
|
||||||
|
netboot_from_json(filename, ip, TFTP_SERVER_PORT);
|
||||||
|
} else {
|
||||||
/* Boot from boot.json */
|
/* Boot from boot.json */
|
||||||
printf("Booting from boot.json...\n");
|
printf("Booting from boot.json...\n");
|
||||||
netboot_from_json("boot.json", ip, TFTP_SERVER_PORT);
|
netboot_from_json("boot.json", ip, TFTP_SERVER_PORT);
|
||||||
|
@ -506,6 +514,7 @@ void netboot(void)
|
||||||
/* Boot from boot.bin */
|
/* Boot from boot.bin */
|
||||||
printf("Booting from boot.bin...\n");
|
printf("Booting from boot.bin...\n");
|
||||||
netboot_from_bin("boot.bin", ip, TFTP_SERVER_PORT);
|
netboot_from_bin("boot.bin", ip, TFTP_SERVER_PORT);
|
||||||
|
}
|
||||||
|
|
||||||
/* Boot failed if we are here... */
|
/* Boot failed if we are here... */
|
||||||
printf("Network boot failed.\n");
|
printf("Network boot failed.\n");
|
||||||
|
|
|
@ -7,7 +7,7 @@ void set_mac_addr(const char * mac_address);
|
||||||
|
|
||||||
void __attribute__((noreturn)) boot(unsigned long r1, unsigned long r2, unsigned long r3, unsigned long addr);
|
void __attribute__((noreturn)) boot(unsigned long r1, unsigned long r2, unsigned long r3, unsigned long addr);
|
||||||
int serialboot(void);
|
int serialboot(void);
|
||||||
void netboot(void);
|
void netboot(int nb_params, char **params);
|
||||||
void flashboot(void);
|
void flashboot(void);
|
||||||
void romboot(void);
|
void romboot(void);
|
||||||
void sdcardboot(void);
|
void sdcardboot(void);
|
||||||
|
|
|
@ -69,7 +69,7 @@ static void boot_sequence(void)
|
||||||
#ifdef CSR_ETHPHY_MODE_DETECTION_MODE_ADDR
|
#ifdef CSR_ETHPHY_MODE_DETECTION_MODE_ADDR
|
||||||
eth_mode();
|
eth_mode();
|
||||||
#endif
|
#endif
|
||||||
netboot();
|
netboot(0, NULL);
|
||||||
#endif
|
#endif
|
||||||
printf("No boot medium found\n");
|
printf("No boot medium found\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue