Merge pull request #892 from jluebbe/bios

bios: support passing tftp filename to the 'netboot' command
This commit is contained in:
enjoy-digital 2021-04-26 10:59:53 +02:00 committed by GitHub
commit 65a4886b72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 9 deletions

View File

@ -487,9 +487,13 @@ static void netboot_from_bin(const char * filename, unsigned int ip, unsigned sh
boot(0, 0, 0, MAIN_RAM_BASE);
}
void netboot(void)
void netboot(int nb_params, char **params)
{
unsigned int ip;
char * filename = NULL;
if (nb_params > 0 )
filename = params[0];
printf("Booting from network...\n");
@ -499,13 +503,18 @@ void netboot(void)
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]));
/* Boot from boot.json */
printf("Booting from boot.json...\n");
netboot_from_json("boot.json", ip, TFTP_SERVER_PORT);
if (filename) {
printf("Booting from %s (JSON)...\n", filename);
netboot_from_json(filename, ip, TFTP_SERVER_PORT);
} else {
/* Boot from boot.json */
printf("Booting from boot.json...\n");
netboot_from_json("boot.json", ip, TFTP_SERVER_PORT);
/* Boot from boot.bin */
printf("Booting from boot.bin...\n");
netboot_from_bin("boot.bin", ip, TFTP_SERVER_PORT);
/* Boot from boot.bin */
printf("Booting from boot.bin...\n");
netboot_from_bin("boot.bin", ip, TFTP_SERVER_PORT);
}
/* Boot failed if we are here... */
printf("Network boot failed.\n");

View File

@ -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);
int serialboot(void);
void netboot(void);
void netboot(int nb_params, char **params);
void flashboot(void);
void romboot(void);
void sdcardboot(void);

View File

@ -69,7 +69,7 @@ static void boot_sequence(void)
#ifdef CSR_ETHPHY_MODE_DETECTION_MODE_ADDR
eth_mode();
#endif
netboot();
netboot(0, NULL);
#endif
printf("No boot medium found\n");
}