efi loader does not work with static network parameters. It always uses BOOTP/DHCP and also uses RARP as a fallback. The reason for this is most likely that FreeBSD has always used NFS for netbooting and doesn't use TFTP at all. Problems with DHCP servers can cause the loader to fail to populate network parameters.
Details
- Reviewers
imp - Commits
- rS349928: Allow efi loader to get network params from uboot
Test case 1: Pass ipaddr, netmask, serverip, gatewayip as part of bootargs. See that loader uses the passed args
> Set bootargs
uboot# setenv bootargs "ipaddr=10.216.67.194 netmask=255.255.240.0 serverip=10.216.67.213 gatewayip=10.216.79.254 rootpath=tftp://10.216.67.213/"
> load FDT
uboot# tftpboot 0x88000000 tsiddharth/loader/JNPR-ERICSSON-6675.dtb; fdt addr 0x88000000;
> execute efi loader,
tftpboot 0x90000000 tsiddharth/loader_simp.efi;bootefi 0x90000000 0x88000000
Starting EFI application at 90000000 ...
do_bootefi_exec:306 Jumping to 0xfda43bb8
Consoles: EFI console
Reading loader env vars from /efi/freebsd/loader.env
FreeBSD/arm64 EFI loader, Revision 1.1
Command line arguments: loader.efi ipaddr=10.216.67.194 netmask=255.255.240.0 serverip=10.216.67.213 gatewayip=10.216.79.254 rootdev=part1: rootpath=tftp://10.216.67.213/ EFI version: 2.70 EFI Firmware: Das U-Boot (rev 0.00) Console: efi (0) Load Path: /tsiddharth\loader_simp.efi Load Device: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/MAC(021013d0b2a2,0x1) Setting currdev to configured rootdev part1:
can't load 'kernel'
Type '?' for a list of commands, 'help' for more detailed help.
> Sucessful load file from tftp
OK set currev part0:
OK load tsiddharth/kernel
tsiddharth/kernel text=0x92cc78 data=0x1913c8+0x84ab1c syms=[0x8+0x1372b0+0x8+0x1235c9]
OK show
boot.netif.gateway=10.216.79.254
boot.netif.hwaddr=02:10:13:d0:b2:a2
boot.netif.ip=10.216.67.194
boot.netif.netmask=255.255.240.0
boot.netif.server=10.216.67.213
boot.tftproot.path=/
boot.tftproot.server=10.216.67.213
console=efi
currdev=net0:
efi-version=2.70
gatewayip=10.216.79.254
interpret=OK
ipaddr=10.216.67.194
loaddev=part1:
netmask=255.255.240.0
prompt=${interpret}
rootdev=part1:
rootpath=tftp://10.216.67.213/
script.lang=simple
serverip=10.216.67.213
Test case 2: Pass incomplete bootargs. See that loader displays a warning and resorts to bootp.
uboot# setenv bootargs "ipaddr=10.216.67.194 netmask=255.255.240.0 serverip=10.216.67.213"
Starting EFI application at 90000000 ...
do_bootefi_exec:306 Jumping to 0xfda43bb8
Consoles: EFI console
Reading loader env vars from /efi/freebsd/loader.env
FreeBSD/arm64 EFI loader, Revision 1.1
Command line arguments: loader.efi ipaddr=10.216.67.194 netmask=255.255.240.0 serverip=10.216.67.213 rootpath=tftp://10.216.67.213/ EFI version: 2.70 EFI Firmware: Das U-Boot (rev 0.00) Console: efi (0) Load Path: /tsiddharth\loader_simp.efi Load Device: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/MAC(021013d0b2a2,0x1)
Setting currdev to net0:
Incomplete network settings from U-Boot <=========
*ethHw_checkPortSpeed setting speed: 5
net0: cannot set rx. filters (status=3)
/
can't load 'kernel'
Type '?' for a list of commands, 'help' for more detailed help.
OK show
boot.netif.gateway=10.216.79.254
boot.netif.hwaddr=02:10:13:d0:b2:a2
boot.netif.ip=10.216.67.0
boot.netif.netmask=255.255.240.0
boot.netif.server=10.216.47.47
boot.nfsroot.path=/
boot.nfsroot.server=10.216.47.47
console=efi
currdev=net0:
dhcp.dhcp-lease-time=6000
dhcp.dhcp-message-type=2
dhcp.dhcp-server-identifier=10.216.67.155
dhcp.routers=10.216.79.254
dhcp.subnet-mask=255.255.240.0
dhcp.tags=53,54,51,1,3
efi-version=2.70
interpret=OK
ipaddr=10.216.67.194
loaddev=net0:
netmask=255.255.240.0
prompt=${interpret}
script.lang=simple
serverip=10.216.67.213
twiddle_divisor=1
OK
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
can you re-upload the diff -U9999 please? It will make it easier to review.
I like the general direction, but want to look at it more closely.
stand/efi/libefi/efinet.c | ||
---|---|---|
232 ↗ | (On Diff #59238) | why set this? We don't seem to use it... |
stand/efi/libefi/efinet.c | ||
---|---|---|
232 ↗ | (On Diff #59238) | servip is still used in libsa/tftp.c to make tftp transfer. It is set in common/install.c as well to be used fot tftp purpose. Probably all the occurrences of servip would need to be cleaned up to use rootip instead. |
stand/efi/libefi/efinet.c | ||
---|---|---|
198 ↗ | (On Diff #59238) | This should be an explicit comparison against NULL; a la (envstr = getenv("rootpath")) != NULL |
217 ↗ | (On Diff #59238) | This and the subsequent if should probably be written as a series of comparisons against 0 |
252 ↗ | (On Diff #59238) | This explicit return should go away |
I agree with kevans' style nits, but this is looking a lot better. I'd see where servip is used better now.