Jump to content

How to enter to u-boot enviroment ?


Go to solution Solved by eselarm,

Recommended Posts

Posted (edited)

Hi all,
sorry for a kiddy queston but it the first time when I'm using Armbian.

I need to enter to u-boot menu/enviroment/shell and I can't 
I try to press any button when I'm rebooting but nothing happened and i've just have a booted system 


I have only UART to my system. 

 

In other devices I have some time to press any key to enter to u-boot shell but there I don't have time. 
U-boot exec bootcmd immediately


I need to enter to u-boot shell and reconfigure some env for my work.

 

I use Armbian 25.8.2 noble

 

Edited by BlackS
  • BlackS changed the title to How to enter to u-boot enviroment ?
Posted
4 hours ago, BlackS said:

first time when I'm using Armbian

If you have used RadxaOS before there might be an older U-Boot variant in SPI-flash and at least on ROCK3A SPI take preference over SD-cards, so the Armbian U-Boot from SD-card is not use. AFAIR Radxa OS ROCK5 U-Boot does not have the 1 sec autoboot timeout and also uses extlinux script and not bootcmd. But I might mix-up versions and platforms.

So rewrite SPI-flash from Armbian is option to fix it.

Posted (edited)

Thanks for answer 

I will try. Right now just waiting support from remote side.

 

And maybe it can be helpful. I can see on my UART console only this 
 

[58160.278303] reboot: Restarting system
]DDR 9fa84341ce typ 24/09/06-09:51:11,fwver: v1.18                                                                                            
ch0 ttot10
ch1 ttot10
ch2 ttot10
ch3 ttot10
ch0 ttot16
LPDDR4X, 2112MHz
channel[0] BW=16 Col=10 Bk=8 CS0 Row=17 CS1 Row=17 CS=2 Die BW=16 Size=4096MB
ch1 ttot16
channel[1] BW=16 Col=10 Bk=8 CS0 Row=17 CS1 Row=17 CS=2 Die BW=16 Size=4096MB
ch2 ttot16
channel[2] BW=16 Col=10 Bk=8 CS0 Row=17 CS1 Row=17 CS=2 Die BW=16 Size=4096MB
ch3 ttot16
channel[3] BW=16 Col=10 Bk=8 CS0 Row=17 CS1 Row=17 CS=2 Die BW=16 Size=4096MB
Manufacturer ID:0xff
DQS rds:l0,h1
CH0 RX Vref:28.5%, TX Vref:23.8%,22.8%
DQ rds:h4 h7 h1 h5 h5 l4 h6 h2, h6 h1 h6 h3 h3 h1 h2 h3

DQS rds:l0,l0
CH1 RX Vref:28.5%, TX Vref:23.8%,23.8%
DQ rds:h4 h2 l0 h1 h1 h3 h1 h1, h3 h1 h6 h1 h1 l0 l0 h2

DQS rds:l0,l0
CH2 RX Vref:29.3%, TX Vref:23.8%,21.8%
DQ rds:h2 h5 h7 h7 h6 l0 h3 h2, h1 h5 l0 h6 l0 h3 h7 h1

DQS rds:l1,h1
CH3 RX Vref:28.5%, TX Vref:24.8%,23.8%
DQ rds:l0 h3 h7 l0 h3 h1 h2 h4, h1 h7 h7 h7 h2 h6 l0 h1

stride=0x2, ddr_config=0x4
hash ch_mask0-1 0x20 0x40, bank_mask0-3 0xa00 0x1400 0x2800 0x0, rank_mask0 0x401000
change to F1: 528MHz
ch0 ttot10
ch1 ttot10
ch2 ttot10
ch3 ttot10
change to F2: 1068MHz
1;-1fdone.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... Scanning for Btrfs filesystems
done.
Begin: Will now check root file system ... fsck from util-linux 2.39.3
[/usr/sbin/fsck.ext4 (1) -- /dev/mmcblk1p1] fsck.ext4 -a -C0 /dev/mmcblk1p1
armbi_root: clean, 46692/7448320 files, 1142106/30126080 blocks
done.
done.
Begin: Running /scripts/local-bottom ... done.
Begin: Running /scripts/init-bottom ... done.

Welcome to Armbian 25.8.2 noble!
[  OK  ] Created slice system-modprobe.slice - Slice /system/modprobe.

# CTRL-A Z for help | 1500000 8N1 | NOR | Minicom 2.8


And in addition, I've tried to use fw_printenv -c /tmp/fw_env.config   from u-boot-tools package. Just to print current u-boot config but it doesn't work for rock5b. Maybe I've prepared a wrong config
 

$ cat /proc/partitions
major minor  #blocks  name
 179        0  121753600 mmcblk1
 179        1  120504320 mmcblk1p1
  31        0      16384 mtdblock0
 252        0    8174096 zram0
 252        1      51200 zram1

$ cat /tmp/fw_env.config
/dev/mmcblk1p1           0xE5D800000     0x4000

# Where E5D800000 i've get by such way for mmcblk1p1
# echo "obase=16; 120504320*512"| bc -l
# E5D800000

$ fw_printenv -c /tmp/fw_env.config
Cannot read environment, using default
Cannot read default environment from file

$ fw_printenv -V
0.3.5 773

 

Sorry for mixing all the stuff to one topic but it seems a bit relevant with this topic. 
 

Edited by BlackS
add additional info
Posted
53 minutes ago, BlackS said:

And maybe it can be helpful. I can see on my UART console only this 

And since it contains no firmware payload output, no one can tell what you are running.

Posted

I usually fight a bit the default 80x25 serial terminal sizing (KDE konsole) via 'screen /dev/ttyUSB0 1500000', but tools like MidnightCommander can be used. Certainly all standard CLI stuff and copy-paste. So just some commands:


apt list --installed linux-u-boot-rock-5b*
dpkg -L linux-u-boot-rock-5b-edge
cat /usr/lib/u-boot/platform_install.sh

cat /dev/mtdblock0 > /tmp/spidump
strings /tmp/spidump | grep -i U-Boot
 

Posted
$ apt list -a --installed linux-u-boot-rock-5b*
Listing... Done
linux-u-boot-rock-5b-current/now 25.8.2 arm64 [installed,local]
linux-u-boot-rock-5b-current/noble 25.8.1 arm64
linux-u-boot-rock-5b-current/noble 25.5.1 arm64
linux-u-boot-rock-5b-current/noble 25.2.3 arm64
linux-u-boot-rock-5b-current/noble 25.2.2 arm64
linux-u-boot-rock-5b-current/noble 24.11.3 arm64
linux-u-boot-rock-5b-current/noble 24.11.1 arm64
linux-u-boot-rock-5b-current/noble 24.8.2 arm64

$ dpkg -L linux-u-boot-rock-5b-current
/.
/usr
/usr/lib
/usr/lib/linux-u-boot-current-rock-5b
/usr/lib/linux-u-boot-current-rock-5b/idbloader.img
/usr/lib/linux-u-boot-current-rock-5b/rkspi_loader.img
/usr/lib/linux-u-boot-current-rock-5b/u-boot-config-target-1
/usr/lib/linux-u-boot-current-rock-5b/u-boot-defconfig-target-1
/usr/lib/linux-u-boot-current-rock-5b/u-boot-metadata-target-1.sh
/usr/lib/linux-u-boot-current-rock-5b/u-boot-metadata.sh
/usr/lib/linux-u-boot-current-rock-5b/u-boot.itb
/usr/lib/u-boot
/usr/lib/u-boot/LICENSE
/usr/lib/u-boot/platform_install.sh
/usr/lib/u-boot/rock-5b-rk3588_defconfig
/usr/share
/usr/share/doc
/usr/share/doc/linux-u-boot-rock-5b-current
/usr/share/doc/linux-u-boot-rock-5b-current/changelog.gz

$ cat /usr/lib/u-boot/platform_install.sh
# Armbian u-boot install script for linux-u-boot-rock-5b-current 2017.09-Sa317-Pedb0-H5208-Vc393-Bb703-R448a
# This file provides functions for deploying u-boot to a block device.
DIR=/usr/lib/linux-u-boot-current-rock-5b
write_uboot_platform ()
{
    local logging_prelude="";
    [[ $(type -t run_host_command_logged) == function ]] && logging_prelude="run_host_command_logged";
    if [ -f $1/u-boot-rockchip.bin ]; then
        ${logging_prelude} dd if=$1/u-boot-rockchip.bin of=$2 bs=32k seek=1 conv=notrunc status=none;
    else
        if [ -f $1/rksd_loader.img ]; then
            ${logging_prelude} dd if=$1/rksd_loader.img of=$2 seek=64 conv=notrunc status=none;
        else
            if [[ -f $1/u-boot.itb ]]; then
                ${logging_prelude} dd if=$1/idbloader.img of=$2 seek=64 conv=notrunc status=none;
                ${logging_prelude} dd if=$1/u-boot.itb of=$2 seek=16384 conv=notrunc status=none;
            else
                if [[ -f $1/uboot.img ]]; then
                    ${logging_prelude} dd if=$1/idbloader.bin of=$2 seek=64 conv=notrunc status=none;
                    ${logging_prelude} dd if=$1/uboot.img of=$2 seek=16384 conv=notrunc status=none;
                    ${logging_prelude} dd if=$1/trust.bin of=$2 seek=24576 conv=notrunc status=none;
                else
                    echo "Unsupported u-boot processing configuration!";
                    exit 1;
                fi;
            fi;
        fi;
    fi
}
write_uboot_platform_mtd ()
{
    FILES=$(find "$1" -maxdepth 1 -type f -name "rkspi_loader*.img");
    if [ -z "$FILES" ]; then
        echo "No SPI image found.";
        exit 1;
    fi;
    MENU_ITEMS=();
    i=1;
    while IFS= read -r file; do
        filename=$(basename "$file");
        MENU_ITEMS+=("$i" "$filename" "");
        ((i++));
    done <<< "$FILES";
    if [[ $i -eq 2 ]]; then
        dd if=$1/${MENU_ITEMS[1]} of=$2 conv=notrunc status=none > /dev/null 2>&1;
        return;
    fi;
    [[ -f /etc/armbian-release ]] && source /etc/armbian-release;
    backtitle="Armbian for $BOARD_NAME install script, https://www.armbian.com";
    CHOICE=$(dialog --no-collapse               --title "armbian-install"               --backtitle "$backtitle"                --radiolist "Choose SPI image:" 0 56 4     "${MENU_ITEMS[@]}"     3>&1 1
>&2 2>&3);
    if [ $? -eq 0 ]; then
        dd if=$1/${MENU_ITEMS[($CHOICE*3)-2]} of=$2 conv=notrunc status=none > /dev/null 2>&1;
    else
        echo "No SPI image chosen.";
        exit 1;
    fi
}
setup_write_uboot_platform ()
{
    if grep -q "ubootpart" /proc/cmdline; then
        local tmp part dev;
        tmp=$(cat /proc/cmdline);
        tmp="${tmp##*ubootpart=}";
        tmp="${tmp%% *}";
        [[ -n $tmp ]] && part=$(findfs PARTUUID=$tmp 2> /dev/null);
        [[ -n $part ]] && dev=$(lsblk -n -o PKNAME $part 2> /dev/null);
        [[ -n $dev ]] && DEVICE="/dev/$dev";
    fi
}

$ cat /dev/mtdblock0 > /tmp/spidump
$ strings /tmp/spidump | grep -i U.*Boot
nothing

$ du -h  /tmp/spidump
16M     /tmp/spidump


It seems something installed and configured but for -current   not for  -edge    
I thought that -current version more stable.
Am I wrong and I need to install -edge ?

 

Posted (edited)
31 minutes ago, BlackS said:

Am I wrong and I need to install -edge ?

OK, it seems your SPI-flash is empty, so not used and skipped. I start to remember I think; ROCK5B -current is quite old and not from denx.de (or 'mainline') so I picked -edge, but I think I never wrote it to SPI, instead I have this in SPI:

https://github.com/edk2-porting/edk2-rk3588?tab=readme-ov-file

You need grub-efi or other efi capable and configured bootloader (hide boot.scr, add ESP partition)

 

root@rock5b:~# strings /usr/lib/linux-u-boot-edge-rock-5b/u-boot-rockchip-spi.bin | grep "U-Boot SPL"
U-Boot SPL 2024.04-armbian-2024.04-S830c-P0000-H1056-Vdfa5-Bb703-R448a (Jun 08 2025 - 03:38:17 +0000)

My ROCK5B is 24/7 server, I won't reboot and do checks now, up to yourself to dig deeper and see how various versions are build. I remember there is a config option w.r.t. this 1 sec timeout, that I saw when building qemu arm64 u-boot a year ago.

 

I currently have blocked u-boot and armbian packages, but will maybe configure/build for ROCK3A 2025.10, but that is completely other topic/issue.

Edited by eselarm
  • Solution
Posted (edited)

What is easiest depends on the situation. If you feel comfortable enough to use dd to write bootloader, I just downloaded the -edge package from the beta apt package pool, extracted the .bin file and wrote it to correct location on SD-card, after saving the first 32k sectors also with dd to a backupfile. Then reboot and you know it. The qemu experiment was to boot directly from U-Boot to Btrfs raid1 filesystem, it took a lot of time browing through U-Boot config/compile options.

Better/formal method is to install -edge package, it will remove -current package, then use armbian-config to write the bootloader explicitly.

Edited by eselarm
Posted

Hip hip hooray !!!
Yep, this way worked. 

Will provide the all steps for people who have the same issue. 

$ apt install linux-u-boot-rock-5b-edge
$ armbian-install

# Just in case I've installed to the all partitions. I mean to 5th and 7th.
> 5  Install/Update the bootloader on SD card (/dev/mmcblk1)
> 7  Install/Update the bootloader on MTD Flash

$ reboot

       
And now I can enter to uboot shell 

change to F2: 1068MHz
ch0 ttot12
ch1 ttot12
ch2 ttot12
ch3 ttot12
change to F3: 1560MHz
ch0 ttot14
ch1 ttot14
ch2 ttot14
ch3 ttot14
change to F0: 2112MHz
ch0 ttot16
ch1 ttot16
ch2 ttot16
ch3 ttot16
out

U-Boot SPL 2024.04-armbian-2024.04-S830c-P0000-Hd72c-Vdfa5-Bb703-R448a (Oct 24 2025 - 02:33:30 +0000)
Trying to boot from SPI
## Checking hash(es) for config config-1 ... OK
## Checking hash(es) for Image atf-1 ... sha256+ OK
## Checking hash(es) for Image u-boot ... sha256+ OK
## Checking hash(es) for Image fdt-1 ... sha256+ OK
## Checking hash(es) for Image atf-2 ... sha256+ OK
## Checking hash(es) for Image atf-3 ... sha256+ OK
INFO:    Preloader serial: 2
NOTICE:  BL31: v2.3():v2.3-868-g040d2de11:derrick.huang, fwver: v1.48
NOTICE:  BL31: Built : 15:02:44, Dec 19 2024
INFO:    spec: 0x1
INFO:    code: 0x88
INFO:    ext 32k is not valid
INFO:    ddr: stride-en 4CH
INFO:    GICv3 without legacy support detected.
INFO:    ARM GICv3 driver initialized in EL3
INFO:    valid_cpu_msk=0xff bcore0_rst = 0x0, bcore1_rst = 0x0
INFO:    l3 cache partition cfg-0
INFO:    system boots from cpu-hwid-0
INFO:    disable memory repair
INFO:    idle_st=0x21fff, pd_st=0x11fff9, repair_st=0xfff70001
INFO:    dfs DDR fsp_params[0].freq_mhz= 2112MHz
INFO:    dfs DDR fsp_params[1].freq_mhz= 528MHz
INFO:    dfs DDR fsp_params[2].freq_mhz= 1068MHz
INFO:    dfs DDR fsp_params[3].freq_mhz= 1560MHz
INFO:    BL31: Initialising Exception Handling Framework
INFO:    BL31: Initializing runtime services
WARNING: No OPTEE provided by BL2 boot loader, Booting device without OPTEE initialization. SMC`s destined for OPTEE will return SMC_UNK
ERROR:   Error initializing runtime service opteed_fast
INFO:    BL31: Preparing for EL3 exit to normal world
INFO:    Entry point address = 0xa00000
INFO:    SPSR = 0x3c9
ns16550_serial serial@feb50000: pinctrl_select_state_full: uclass_get_device_by_phandle_id: err=-19


U-Boot 2024.04-armbian-2024.04-S830c-P0000-Hd72c-Vdfa5-Bb703-R448a (Oct 24 2025 - 02:33:30 +0000)

Model: Radxa ROCK 5 Model B
DRAM:  16 GiB
Core:  353 devices, 32 uclasses, devicetree: separate
MMC:   mmc@fe2c0000: 1, mmc@fe2d0000: 2, mmc@fe2e0000: 0
Loading Environment from SPIFlash... SF: Detected xt25f128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

In:    serial@feb50000
Out:   serial@feb50000
Err:   serial@feb50000
Model: Radxa ROCK 5 Model B
rockchip_dnl_key_pressed: no saradc device found
Net:   No ethernet found.
Hit any key to stop autoboot:  0
=>



Great
Thanks a lot

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines