diff --git a/litex/soc/software/bios/boot.c b/litex/soc/software/bios/boot.c index 8d511bca3..3760eaba5 100644 --- a/litex/soc/software/bios/boot.c +++ b/litex/soc/software/bios/boot.c @@ -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"); diff --git a/litex/soc/software/bios/boot.h b/litex/soc/software/bios/boot.h index 59234d7b2..338312d09 100644 --- a/litex/soc/software/bios/boot.h +++ b/litex/soc/software/bios/boot.h @@ -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); diff --git a/litex/soc/software/bios/main.c b/litex/soc/software/bios/main.c index a6f0375d5..5997118f9 100644 --- a/litex/soc/software/bios/main.c +++ b/litex/soc/software/bios/main.c @@ -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"); }