BPI-R4 Reboot issues when using U-Boot EFI and GRUB EFI

Hi all,

I’m playing around with U-Boot EFI and GRUB EFI. If I’m starting Kernel 6.11 booted from U-Boot using:

#### Kernel 6.11
setenv kaddr 0x48000000
setenv dtaddr 0x50000000
setenv consoleargs "earlycon=uart8250,mmio32,0x11000000 console=ttyS0,115200n1 debug=7 loglevel=8 pci=pcie_bus_perf consoleblank=0"
setenv rootfs "root=/dev/nvme0n1p2 rootfstype=ext4 rootwait"
setenv bootargs ${consoleargs} ${rootfs} mtdparts=${mtdparts}
load nvme 0:2 ${kaddr} /boot/vmlinux-6.11.0-EasyOS-arm64
load nvme 0:2 ${dtaddr} /boot/dtb/mediatek/mt7988a-bananapi-bpi-r4-EasyOS.dtb
booti ${kaddr} - ${dtaddr}

The system is booting fine and using sudo reboot the system is rebooting without issues:

[  OK  ] Stopped systemd-timesyncd.service - Network Time Synchronization.
[  OK  ] Unmounted boot-efi.mount - /boot/efi.
[  OK  ] Unmounted run-lock.mount - Legacy Locks Directory /run/lock.
[  OK  ] Unmounted tmp.mount - Temporary Directory /tmp.
[  OK  ] Stopped target swap.target - Swaps.
[  OK  ] Reached target umount.target - Unmount All Filesystems.
[  OK  ] Stopped systemd-fsck@dev-disk-by\x…eck on /dev/disk/by-uuid/6388-320E.
[  OK  ] Removed slice system-systemd\x2dfs…slice - Slice /system/systemd-fsck.
[  OK  ] Stopped target local-fs-pre.target…Preparation for Local File Systems.
[  OK  ] Stopped systemd-remount-fs.service…mount Root and Kernel File Systems.
[  OK  ] Stopped systemd-fsck-root.service - File System Check on Root Device.
[  OK  ] Stopped systemd-tmpfiles-setup-dev…Create Static Device Nodes in /dev.
[  OK  ] Stopped systemd-tmpfiles-setup-dev…ic Device Nodes in /dev gracefully.
[  OK  ] Reached target shutdown.target - System Shutdown.
[  OK  ] Reached target final.target - Late Shutdown Services.
[  OK  ] Finished systemd-reboot.service - System Reboot.
[  OK  ] Reached target reboot.target - System Reboot.
[  624.105083] watchdog: watchdog0: watchdog did not stop!
[  624.125856] systemd-shutdown[1]: Using hardware watchdog 'mtk-wdt', version 0, device /dev/watchdog0
[  624.135067] systemd-shutdown[1]: Watchdog running with a hardware timeout of 10min.
[  624.153771] systemd-shutdown[1]: Syncing filesystems and block devices.
[  624.162383] systemd-shutdown[1]: Sending SIGTERM to remaining processes...
[  624.178306] systemd-journald[1678]: Received SIGTERM from PID 1 (systemd-shutdow).
[  624.199143] systemd-shutdown[1]: Sending SIGKILL to remaining processes...
[  624.213929] systemd-shutdown[1]: Unmounting file systems.
[  624.220824] (sd-umount)[3787]: Unmounting '/run/credentials/systemd-journald.service'.
[  624.230085] (sd-remount)[3788]: Remounting '/' read-only with options 'errors=remount-ro'.
[  624.294344] EXT4-fs (nvme0n1p2): re-mounted 05329a7f-410a-419b-840b-2fde100897cc ro. Quota mode: none.
[  624.311973] systemd-shutdown[1]: All filesystems unmounted.
[  624.317581] systemd-shutdown[1]: Deactivating swaps.
[  624.322578] systemd-shutdown[1]: All swaps deactivated.
[  624.327852] systemd-shutdown[1]: Detaching loop devices.
[  624.337334] systemd-shutdown[1]: All loop devices detached.
[  624.342904] systemd-shutdown[1]: Stopping MD devices.
[  624.348215] systemd-shutdown[1]: All MD devices stopped.
[  624.353527] systemd-shutdown[1]: Detaching DM devices.
[  624.358805] systemd-shutdown[1]: All DM devices detached.
[  624.364202] systemd-shutdown[1]: All filesystems, swaps, loop devices, MD devices and DM devices detached.
[  624.373863] watchdog: watchdog0: watchdog did not stop!
[  624.443853] systemd-shutdown[1]: Syncing filesystems and block devices.
[  624.450587] systemd-shutdown[1]: Rebooting.
[  624.645343] reboot: Restarting system
F0: 102B 0000
FA: 1042 0000
FA: 1042 0000 [0200]
F9: 0000 0000
V0: 0000 0000 [0001]
00: 0000 0000
BP: 0600 0041 [0000]
G0: 1190 0000
EC: 0000 0000 [1000]
MK: 0000 0000 [0000]
T0: 0000 01A0 [0101]
Jump to BL

NOTICE:  BL2: v2.12.0(release):v2.4-rc0-8168-ge09077068
NOTICE:  BL2: Built : 13:45:15, Jun 25 2025
NOTICE:  WDT: [40000000] Software reset (reboot)
NOTICE:  CPU: MT7988
NOTICE:  EMI: Using DDR unknown settings
NOTICE:  EMI: Detected DRAM size: 4096 MB
NOTICE:  EMI: complex R/W mem test passed
NOTICE:  LVTS: Enable thermal HW reset
NOTICE:  SPI_NAND parses attributes from parameter page.
NOTICE:  SPI_NAND Detected ID 0xef
NOTICE:  Page size 2048, Block size 131072, size 134217728
NOTICE:  BL2: Booting BL31
NOTICE:  BL31: v2.12.0(release):v2.4-rc0-8168-ge09077068
NOTICE:  BL31: Built : 13:45:15, Jun 25 2025


U-Boot 2025.07-rc5-EasyOS-00012-g7027b445cc0b-dirty (Jul 03 2025 - 14:09:09 +0200)

CPU:   MediaTek MT7988
Model: mt7988-rfb
DRAM:  4 GiB
Core:  72 devices, 25 uclasses, devicetree: separate
Flash: spi-nand: spi_nand spi_nand@0: Winbond SPI NAND was found.
spi-nand: spi_nand spi_nand@0: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 64
0 Bytes
MMC:   mmc@11230000: 0
Loading Environment from UBI... jedec_spi_nor spi_nor@0: unrecognized JEDEC id bytes: ff, ff, ff
ubi0: attaching mtd3
ubi0: scanning is finished
ubi0: attached mtd3 (name "ubi", size 114 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
ubi0: good PEBs: 916, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 4, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 0
ubi0: available PEBs: 822, total reserved PEBs: 94, PEBs reserved for bad PEB handling: 20
Read 65536 bytes from volume ubootenv to 00000000ff7db640
Read 65536 bytes from volume ubootenvbkp to 00000000ff7eb680

Then if I’m trying to boot via U-Boot EFI → GRUB EFI → Linux Kernel 6.11:

load nvme 0:2 ${dtaddr} /boot/dtb/mediatek/mt7988a-bananapi-bpi-r4-EasyOS.dtb
fdt addr ${dtaddr}
bootefi bootmgr ${dtaddr}

Is loading GRUB EFI then I’m booting Linux 6.11 Kernel.

Then if I’m trying to reboot the system using sudo reboot the system is reaching systemd-shutdown but the device doesn’t reboot:

[  OK  ] Stopped systemd-timesyncd.service - Network Time Synchronization.
[  OK  ] Unmounted boot-efi.mount - /boot/efi.
[  OK  ] Unmounted run-lock.mount - Legacy Locks Directory /run/lock.
[  OK  ] Unmounted tmp.mount - Temporary Directory /tmp.
[  OK  ] Stopped target swap.target - Swaps.
[  OK  ] Reached target umount.target - Unmount All Filesystems.
[  OK  ] Stopped systemd-fsck@dev-disk-by\x…eck on /dev/disk/by-uuid/6388-320E.
[  OK  ] Removed slice system-systemd\x2dfs…slice - Slice /system/systemd-fsck.
[  OK  ] Stopped target local-fs-pre.target…Preparation for Local File Systems.
[  OK  ] Stopped systemd-remount-fs.service…mount Root and Kernel File Systems.
[  OK  ] Stopped systemd-fsck-root.service - File System Check on Root Device.
[  OK  ] Stopped systemd-tmpfiles-setup-dev…Create Static Device Nodes in /dev.
[  OK  ] Stopped systemd-tmpfiles-setup-dev…ic Device Nodes in /dev gracefully.
[  OK  ] Reached target shutdown.target - System Shutdown.
[  OK  ] Reached target final.target - Late Shutdown Services.
[  OK  ] Finished systemd-reboot.service - System Reboot.
[  OK  ] Reached target reboot.target - System Reboot.
[   33.867088] watchdog: watchdog0: watchdog did not stop!
[   33.887520] systemd-shutdown[1]: Using hardware watchdog 'mtk-wdt', version 0, device /dev/watchdog0
[   33.896722] systemd-shutdown[1]: Watchdog running with a hardware timeout of 10min.
[   33.916072] systemd-shutdown[1]: Syncing filesystems and block devices.
[   33.924643] systemd-shutdown[1]: Sending SIGTERM to remaining processes...
[   33.940922] systemd-journald[1739]: Received SIGTERM from PID 1 (systemd-shutdow).
[   33.956174] systemd-shutdown[1]: Sending SIGKILL to remaining processes...
[   33.971273] systemd-shutdown[1]: Unmounting file systems.
[   33.978099] (sd-umount)[2122]: Unmounting '/run/credentials/systemd-journald.service'.
[   33.987323] (sd-remount)[2123]: Remounting '/' read-only with options 'errors=remount-ro'.
[   34.104453] EXT4-fs (nvme0n1p2): re-mounted 05329a7f-410a-419b-840b-2fde100897cc ro. Quota mode: none.
[   34.120888] systemd-shutdown[1]: All filesystems unmounted.
[   34.126497] systemd-shutdown[1]: Deactivating swaps.
[   34.131503] systemd-shutdown[1]: All swaps deactivated.
[   34.136748] systemd-shutdown[1]: Detaching loop devices.
[   34.146157] systemd-shutdown[1]: All loop devices detached.
[   34.151768] systemd-shutdown[1]: Stopping MD devices.
[   34.157004] systemd-shutdown[1]: All MD devices stopped.
[   34.162313] systemd-shutdown[1]: Detaching DM devices.
[   34.167648] systemd-shutdown[1]: All DM devices detached.
[   34.173047] systemd-shutdown[1]: All filesystems, swaps, loop devices, MD devices and DM devices detached.
[   34.182772] watchdog: watchdog0: watchdog did not stop!
[   34.307202] systemd-shutdown[1]: Syncing filesystems and block devices.
[   34.313933] systemd-shutdown[1]: Rebooting.
[   34.487267] reboot: Restarting system

Am I missing something or U-Boot EFI / GRUB EFI is missing something and doesn’t trigger the board reboot?

//LE: I’ve recompiled U-Boot with EFI selftest and after running bootefi selftest the last line is:

Executing 'watchdog timer'
Executing 'watchdog timer' succeeded

Tearing down 'watchdog timer'
Tearing down 'watchdog timer' succeeded

Setting up 'crc32'
Setting up 'crc32' succeeded

Setting up 'ExitBootServices'
Setting up 'ExitBootServices' succeeded

Setting up 'variables at runtime'
Setting up 'variables at runtime' succeeded

Setting up 'virtual address map'
Setting up 'virtual address map' succeeded

Boot services terminated

Executing 'crc32'
Executing 'crc32' succeeded

Executing 'ExitBootServices'

Boot services terminated
Executing 'ExitBootServices' succeeded

Executing 'variables at runtime'
Executing 'variables at runtime' succeeded

Executing 'virtual address map'
Executing 'virtual address map' succeeded

Summary: 0 failures

Preparing for reset. Press any key...

And nothing happens.

I guess uefi and psci do not get along very well.

Normally it is psci that finally resets the board. It is part of BL31 of arm trusted firmware.

However, I also do not see any notification of BL31 also when you do the normal reset.

Hi @ericwoud ,

I was suspecting a problem from PSCI or something similar. My U-Boot config has this configuration:

CONFIG_PSCI_RESET=y
# CONFIG_ARMV8_PSCI is not set
CONFIG_ARM_PSCI_FW=y

Why I don’t have any notification of BL31, I have no clue, because FIP should contain also BL31. From AT-F build:

Building mt7988
true
make[1]: Nothing to be done for 'all'.
EL3 Runtime Firmware BL31: offset=0x88, size=0xB299, cmdline="--soc-fw"
Non-Trusted Firmware BL33: offset=0xB321, size=0x18D3A8, cmdline="--nt-fw"

But for EFI should I disable PSCI?

//LE: Adding these configs to U-Boot:

CONFIG_PSCI_RESET=y
CONFIG_ARMV8_PSCI=y
CONFIG_ARMV8_PSCI_NR_CPUS=4
CONFIG_ARMV8_PSCI_CPUS_PER_CLUSTER=0
CONFIG_ARM_PSCI_FW=y

Well, it doesn’t reboot from U-Boot anymore :joy: :

NOTICE:  BL2: v2.12.0(release):v2.4-rc0-8168-ge09077068
NOTICE:  BL2: Built : 13:45:15, Jun 25 2025
NOTICE:  WDT: [40000000] Software reset (reboot)
NOTICE:  CPU: MT7988
NOTICE:  EMI: Using DDR unknown settings
NOTICE:  EMI: Detected DRAM size: 4096 MB
NOTICE:  EMI: complex R/W mem test passed
NOTICE:  LVTS: Enable thermal HW reset
NOTICE:  SPI_NAND parses attributes from parameter page.
NOTICE:  SPI_NAND Detected ID 0xef
NOTICE:  Page size 2048, Block size 131072, size 134217728
NOTICE:  BL2: Booting BL31
NOTICE:  BL31: v2.12.0(release):v2.4-rc0-8168-ge09077068
NOTICE:  BL31: Built : 13:45:15, Jun 25 2025


U-Boot 2025.07-rc5-EasyOS-00012-g7027b445cc0b-dirty (Jul 04 2025 - 16:56:53 +0200)

CPU:   MediaTek MT7988
Model: mt7988-rfb
DRAM:  4 GiB
Core:  72 devices, 25 uclasses, devicetree: separate
Flash: spi-nand: spi_nand spi_nand@0: Winbond SPI NAND was found.
spi-nand: spi_nand spi_nand@0: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 64
0 Bytes
MMC:   mmc@11230000: 0
Loading Environment from UBI... jedec_spi_nor spi_nor@0: unrecognized JEDEC id bytes: ff, ff, ff
ubi0: attaching mtd3
ubi0: scanning is finished
ubi0: attached mtd3 (name "ubi", size 114 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
ubi0: good PEBs: 916, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 4, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 0
ubi0: available PEBs: 822, total reserved PEBs: 94, PEBs reserved for bad PEB handling: 20
Read 65536 bytes from volume ubootenv to 00000000ff7db640
Read 65536 bytes from volume ubootenvbkp to 00000000ff7eb680
*** Warning - bad CRC, using default environment

In:    serial@11000000
Out:   serial@11000000
Err:   serial@11000000
Net:   MediaTek MT7988 built-in switch

Warning: ethernet@15110100 (eth0) using random MAC address - 2a:61:57:20:7f:f2
eth0: ethernet@15110100
starting USB...
xhci-mtk xhci@11200000: hcd: 0x0000000011200000, ippc: 0x0000000011203e00
xhci-mtk xhci@11200000: ports disabled mask: u3p-0x0, u2p-0x0
xhci-mtk xhci@11200000: u2p:1, u3p:1
Register 200010f NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus xhci@11200000: 4 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0
## Error: "set_main_menu" not defined
EasyOS(MT7988)> reset
resetting ...

Well, removing completely PSCI from U-Boot, now I can reboot the board from U-Boot, U-Boot → direct Linux booting and U-Boot EFI → GRUB EFI → Linux Booting.

Here is my U-Boot config for PSCI:

# CONFIG_PSCI_RESET is not set
# CONFIG_ARMV8_PSCI is not set
CONFIG_ARM_PSCI_FW=y

For me is a strange issue.