Change boot option from OS

Is it possible to change next boot to other OS?
I have OpenWRT on NAND and UBUNTU on NVM.
I don’t have serial connection to the unit. I want booot next time to different OS, that first in u-boot variables. From OpenWRT i can reach u-boot environment (fw_printenv/fw_setenv) and change it. From ubuntu i cannot do it. Is any way to reach u-boot variables from linux? Is other way to change boot option from remote?


This is now possible on the new firmware versions (v0.9.x and later).

Access to the flash (NOR and NAND) from NVMe/USB/sdcard was disabled in the previous versions for multiple reasons:

  • Older versions of some distributions contained a flash driver which was not able to access the NAND chip, and could corrupt it if used incorrectly

  • At the time, it was anticipated that a solution for EFI variables via U-Boot would come out. The community has since decided on another method which does not touch the flash from the OS.

If you want, you can re-enable this in the earlier U-Boot by deleting the following portion of the setup_distroboot_efi variable:

fdt set "/soc/spi@20c0000" "status" "disabled"

(be careful attempting this remotely, the boot process will get stuck if not edited correctly)

I’m not aware of any method to re-enable it from a running operating system.

Thanks, @mcbridematt !
After update to 0.9.1 and configure /etc/fw_env.config i can reach u-boot env partition.
Could you point me what variable used to boot without menu entering?
It changes from 0.8 firmware.


Do you mean, which commands you should set to boot each source (disk vs NAND) directly?

Adjusting the bootcmd variable should work now:

# For OpenWrt
fw_setenv bootcmd 'run bootcmd_openwrt_nand'

# For bootflow boot (NVMe/SD/USB)
fw_setenv bootcmd 'bootflow scan -lb'

If you need to boot from a drive that is not the first detected, you will need to use some combination of bootflow scan -l and bootflow select .

The bootflow documentation shows what options you can use: bootflow command — Das U-Boot unknown version documentation