Pi4b/13.3 - Can I disable u-boot pxe attempts?

Greetings,

Pi4b w/ FreeBSD 13.3 (.img) downloaded a few days ago.

I intend to run this installation headless when configured. But for now while I am configuring, it has a tv monitor and keyboard. It is booting from a usb drive, and that works.

I have noticed that at the start of booting it says something like "press a key to skip auto-boot". I can skip that now when there is a keyboard, but when it is headless, no one will press any keys.

After that the boot process goes through many attempts at a pxe boot, all of which fail because the ethernet port's (genet0) phy can not auto-negotiate. Probably because the ethernet is not connected.

And because of all those pxe boot attempts, the time between power-on and fully booted is annoyingly long.

Is there any way to configure the boot loader to not make any pxe attempts?
 
I noticed the same behavior using 14.0 RELEASE.

If a console is attached these attempts can be interrupted with ctrl-c,
you need to press multiple times (one for each attempt).
I tried to replace the u-boot loader with the one of sysutils/u-boot-rpi4 but this one only starts one core (besides detecting all 4).
I also tried to use a u-boot.env or uboot.env to set boot_targets=mmc usb but it seems that these files are ignored.
I also tried with no success.

Beside that, 14.0-RELEASE-p6 works fine.

I'll keep digging on this, as it bugs me too.
 
Ok, I think i have a method which disables PXE boot attempts on the pi4.

This is what I did:

Because the sysutils/u-boot-rpi4 wants to install a whole lot of dependencies,
I compiled on a linux / Ubuntu 23.10 host.

Here are the steps (on linux)


git clone https://source.denx.de/u-boot/u-boot.git
cd u-boot
git checkout v2023.10
make rpi_4_defconfig


Then apply this diff (or edit .config manually):

Diff:
--- .config.rpi4    2024-04-01 19:37:24.921150786 +0000
+++ .config 2024-04-01 19:37:58.148956493 +0000
@@ -195,7 +195,7 @@
 # CONFIG_TARGET_RPI_4_32B is not set
 CONFIG_TARGET_RPI_4=y
 # CONFIG_TARGET_RPI_ARM64 is not set
-CONFIG_RPI_EFI_NR_SPIN_PAGES=1
+CONFIG_RPI_EFI_NR_SPIN_PAGES=2
 CONFIG_NR_DRAM_BANKS=4
 CONFIG_ENV_SOURCE_FILE=""
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
@@ -635,7 +635,7 @@
 # CONFIG_BOOTP_NISDOMAIN is not set
 # CONFIG_BOOTP_NTPSERVER is not set
 # CONFIG_CMD_PCAP is not set
-CONFIG_BOOTP_PXE=y
+# CONFIG_BOOTP_PXE is not set
 CONFIG_BOOTP_PXE_CLIENTARCH=0x16
 CONFIG_BOOTP_VCI_STRING="U-Boot.armv8"
 CONFIG_CMD_TFTPBOOT=y

The important part here is disabling the BOOTP_PXE option.
The CONFIG_RPI_EFI_NR_SPIN_PAGES comes from sysutils/u-boot-rpi4.

Typing make should produce a u-boot.bin.

On the freebsd host make a backup copy of the original u-boot.bin

Code:
cd /boot/efi
cp u-boot.bin u-boot.bak

As /boot/efi is a fat partition, in case of an error you should be able
to mount the device somewhere else and restore the backup.

Now copy the compilation result to the freebsd machine and replace the original u-boot.bin.

Reboot and good luck.

Report back if this worked for you.
 
When I get to
"Typing make should produce a u-boot.bin."
it stops with warnings and errors instead.

Code:
% make
scripts/kconfig/conf  --syncconfig Kconfig
  UPD     include/config.h
  CFG     u-boot.cfg
cc1: warning: unknown register name: x18
  GEN     include/autoconf.mk
  GEN     include/autoconf.mk.dep
cc1: warning: unknown register name: x18
  UPD     include/config/uboot.release
  UPD     include/generated/version_autogenerated.h
  UPD     include/generated/timestamp_autogenerated.h
  UPD     include/generated/dt.h
  ENVC    include/generated/env.txt
  ENVP    include/generated/env.in
  ENVT    include/generated/environment.h
  CC      lib/asm-offsets.s
cc1: warning: unknown register name: x18
cc1: error: bad value (‘armv8-a+crc’) for ‘-march=’ switch
cc1: note: valid arguments to ‘-march=’ switch are: 
{... list of cpu types ...}
make[1]: *** [scripts/Makefile.build:146: lib/asm-offsets.s] Error 1
make: *** [Makefile:1916: prepare0] Error 2
 
You need to compile on the same architecture, (aarch64).
If you don't have a second machine available: what could work is
to use the Raspberry Pi Imager app and create a sdcard with
Raspberry Pi Os (Lite) with the matching arch, boot on the pi and build there.
 
oh, when you said "I compiled on a linux / Ubuntu 23.10 host." I thought I would be able to compile on my Slackware64-15.0 laptop.
 
Sorry I forgot to mention that it must be the same architecture (aarch64) because the Pi4 is an arm machine.
Somehow I thought it would be obvious. Sorry about that.
I think any modern distribution would work as long as the architecture works.

Of course you could also directly compile it on the pi4 running freebsd, you just need to install a lot of
dependencies. Or use the sysutils/u-boot-rpi4 port but you need to patch the config to disable:

CONFIG_BOOTP_PXE=y

it must be changed to

# CONFIG_BOOTP_PXE is not set
 
Oh. I had thought that because it called itself a "cross-compiler" it could compile u-boot for other architectures.

During some spare time experimenting, I found that - If I press any key to skip auto-boot, u-boot's own cli will let me change the boot order and disable pxe and dhcp booting, using "env edit" and other "env" sub-commands. Which solves the pxe boot problem, but I need to do it every time.

There is a "env save" command. But I find that when I try to save my modified env settings, it keeps trying to save them to mmc0 - and then failing because I am booting my rpi4b from a usb drive, and there is no mmc0.

If anyone knows the right command syntax to "env save" to a usb drive instead, that would solve the rest of my stated problem.
 
Please post the commands / env vars you did use to accomplish this. Also please post all your env variables.

AFAIK the location of the env file is baked into the config, if you make rpi_4_defconfig this config entries are created:

Code:
CONFIG_CMD_EDITENV=y
CONFIG_CMD_ENV_EXISTS=y
CONFIG_CMD_EXPORTENV=y
CONFIG_CMD_IMPORTENV=y
CONFIG_CMD_SAVEENV=y
CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
CONFIG_ENV_FAT_FILE="uboot.env"
CONFIG_ENV_FAT_INTERFACE="mmc"
CONFIG_ENV_IS_IN_FAT=y
CONFIG_ENV_MAX_ENTRIES=512
CONFIG_ENV_MIN_ENTRIES=64
CONFIG_ENV_SIZE=0x4000
CONFIG_ENV_SOURCE_FILE=""
CONFIG_ENV_SUPPORT=y
CONFIG_ENV_VARS_UBOOT_CONFIG=y
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_SAVEENV=y
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
CONFIG_SYS_MMC_ENV_DEV=0
CONFIG_SYS_MMC_ENV_PART=0
CONFIG_SYS_RELOC_GD_ENV_ADDR=y

I also experimented with this and did not get it working yet.

You could try to insert some empty but msdos formatted mmc into the pi and check if saving works.

If the boot-order is set correctly in the eeprom it should still boot from usb.


 
There were many env variables, but only one I was interested in,

Code:
<pressed key to stop auto-boot>

U-Boot> help
U-Boot> help env

U-Boot> env print
U-Boot> env edit boot_targets

<removed pxe and dhcp from boot list>


U-Boot> env save
Saving Environment to FAT... * Bad device specification mmc 1 **
Failed (1)

I tried a lot monkey/typewriter combinations of parameters for "env save". No success so far.
 
Back
Top