U-BOOT具有强大的命令行功能,在幽兰上,可以通过如下步骤进入U-BOOT命令行:

  1. 连接好SD串口
  2. 重启Linux
  3. 按住1
    比如:
    No misc partition
    Net: No ethernet found.
    Autoboot in 2 seconds
    ulan# 11

命令行提示符ulan是代表幽兰(u-兰)。

version

进入u-boot命令行,可以执行version命令获取版本信息:
ulan# version
U-Boot 2017.09-YourLand (Apr 12 2024 - 18:39:00 +0800)

aarch64-none-linux-gnu-gcc (GNU Toolchain for the A-profile Architecture 10.3-2021.07 (arm-10.29)) 10.3.1 20210621
GNU ld (GNU Toolchain for the A-profile Architecture 10.3-2021.07 (arm-10.29)) 2.36.1.20210621

控制台信息

ulan# coninfo
List of available devices:
serial 00000003 IO stdin
nulldev 00000003 IO
vidconsole 00000002 .O stdout stderr

观察内存


ulan# md 200000
00200000: 1400000a d503201f 00200000 00000000    ..... .... .....
00200010: 0014a8a0 00000000 0014a8a0 00000000    ................
00200020: 001d3888 00000000 1400003c 10003ea0    .8......<....>..
00200030: d5384241 f100303f 540000a0 f100203f    AB8.?0.....T? ..
00200040: 54000160 f100103f 540001a0 d51ec000    `..T?......T....
00200050: d53e1100 b2400c00 d51e1100 d51e115f    ..>...@....._...
00200060: 58000600 d51be000 14000008 d51cc000    ...X............
00200070: d2867fe0 d51c1140 14000004 d518c000    ....@...........
00200080: d2a00600 d5181040 94000003 9400000b    ....@...........
00200090: 94000732 aa1e03fd d5380000 d344fc00    2.........8...D.
002000a0: 92402c00 f1341c1f 54000060 aa1d03fe    .,@...4.`..T....
002000b0: d65f03c0 17fffffe aa1e03fd 58000360    .._.........`..X
002000c0: 94000797 58000360 940007a2 aa1d03fe    ....`..X........
002000d0: d65f03c0 580002a0 140007d6 d65f03c0    .._....X......_.
002000e0: 10003900 d5384241 f100303f 540000a0    .9..AB8.?0.....T
002000f0: f100203f 540000a0 f100103f 540000a0    ? .....T?......T

枚举PCI总线

ulan# pci enum
gpio: pin 115 (gpio 115) value is 1
gpio: pin 42 (gpio 42) value is 1
pcie@fe150000: PCIe Linking… LTSSM is 0x0
pcie@fe150000: PCIe Linking… LTSSM is 0x210022
pcie@fe150000: PCIe Linking… LTSSM is 0x210022
pcie@fe150000: PCIe Linking… LTSSM is 0x210023
pcie@fe150000: PCIe Link up, LTSSM is 0x230011
pcie@fe150000: PCIE-0: Link up (Gen3-x4, Bus0)
pcie@fe150000: invalid flags type!

NVMe硬盘的基本信息

NVMe硬盘的详细信息

ulan# nvme detail
Blk device 0: Optional Admin Command Support:
Namespace Management/Attachment: no
Firmware Commit/Image download: yes
Format NVM: yes
Security Send/Receive: yes
Blk device 0: Optional NVM Command Support:
Reservation: yes
Save/Select field in the Set/Get features: yes
Write Zeroes: yes
Dataset Management: yes
Write Uncorrectable: yes
Blk device 0: Format NVM Attributes:
Support Cryptographic Erase: No
Support erase a particular namespace: Yes
Support format a particular namespace: Yes
Blk device 0: LBA Format Support:
Blk device 0: End-to-End DataProtect Capabilities:
As last eight bytes: No
As first eight bytes: No
Support Type3: No
Support Type2: No
Support Type1: No
Blk device 0: Metadata capabilities:
As part of a separate buffer: No
As part of an extended data LBA: No
ulan# nvme info
Device 0: Vendor: 0x1f03 Rev: H220901a Prod: 230304170000000063
Type: Hard Disk
Capacity: 488386.3 MB = 476.9 GB (1000215216 x 512)

打印环境变量

执行printenv打印环境变量
ulan# printenv
arch=arm
autoload=no
baudrate=1500000
board=evb_rk3588
board_name=evb_rk3588
bootargs=storagemedia=mtd androidboot.storagemedia=mtd androidboot.mode=normal
bootcmd=check_ver;reset;
bootdelay=2
bootdir=/boot/
bootos=nvme
cnsoargs=setenv bootargs root=${nvmeroot} console=${console},${baudrate} splash verbose nokaslr
console=ttyFIQ0
cpu=armv8
devnum=2
devtype=mtd
fdt_addr_r=0x0a100000
fdt_file=x5.dtb
fdt_high=0xffffffff
image=Image.gz
initrd_addr=0x18000000
initrd_high=0xffffffff
ip_dyn=yes
kernel_addr_c=0x05480000
kernel_addr_r=0x00400000
loadaddr=0x14000000
loadaddr_=0x12000000
loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${bootdir}${fdt_file};fdt addr ${fdt_addr_r}
loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr_} ${bootdir}${image};unzip ${loadaddr_} ${loadaddr}
loadrd=load mmc ${mmcdev}:${mmcpart} ${initrd_addr} ${bootdir}${rd_file}
mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot}
mmcautodetect=yes
mmcboot=echo Booting from mmc …; run mmcargs; if run loadfdt; then booti ${loadaddr} - ${fdt_addr_r}; else echo WARN: Cannot load the DT; echo; fi;
mmcdev=0
mmcpart=2
mmcroot=/dev/mmcblk0p3 rootfstype=ext4 rootwait rw
nvmeargs=setenv bootargs root=${nvmeroot} ${quiet} plymouth.ignore-serial-consoles splash verbose nokaslr
nvmeroot=/dev/nvme0n1p2 rootfstype=ext4 rw
pxefile_addr_r=0x00600000
quiet=quiet
ramargs=setenv bootargs ${smp} root=${ramroot} rootfstype=${ramrootfstype} net.ifnames=0 biosdevname=0 splash ${quiet} plymouth.ignore-serial-consoles
ramboot=run ramargs; mmc dev ${mmcdev}; if run loadimage; then if run loadfdt; then if run loadrd; then booti ${loadaddr} ${initrd_addr} ${fdt_addr_r}; else echo; fi; else echo; fi; else echo; fi;
ramdisk_addr_r=0x0a200000
ramroot=/dev/ram0 rw
ramrootfstype=ext4
rd_file=ramdisk.img
scriptaddr=0x00500000
sdcargs=setenv bootargs root=${sdcroot} console=${console},${baudrate} splash verbose nokaslr
sdcroot=/dev/mmcblk1p2 rootfstype=ext4 rw
soc=rockchip
stderr=serial,vidconsole
stdin=serial
stdout=serial,vidconsole
usbargs=setenv bootargs ${smp} root=${ramroot} rootfstype=${ramrootfstype} net.ifnames=0 biosdevname=0 label=install
vendor=rockchip

Environment size: 2269/32764 bytes

可以执行help命令获取所有命令的列表:
ulan# help
? - alias for ‘help’
aes - AES 128 CBC encryption
android_print_hdr- print android image header
atags - Dump all atags
base - print or set address offset
bdinfo - print Board Info structure
bidram_dump- Dump bidram layout
blk - Block device sub-system
boot - boot default, i.e., run ‘bootcmd’
boot_android- Execute the Android Bootloader flow.
boot_fit- Boot FIT Image from memory or boot/recovery partition
bootavb - Execute the Android avb a/b boot flow.
bootd - boot default, i.e., run ‘bootcmd’
bootefi - Boots an EFI payload from memory
booti - boot arm64 Linux Image image from memory
bootm - boot application image from memory
bootp - boot image via network using BOOTP/TFTP protocol
bootz - boot Linux zImage image from memory
charge - Charge display
check_ver- Loading
cmp - memory compare
coninfo - print console devices and information
cp - memory copy
crc32 - checksum calculation
crypto_sum- crypto checksum engine
dhcp - boot image via network using DHCP/TFTP protocol
dm - Driver model low level access
download- enter rockusb/bootrom download mode
dtimg - manipulate dtb/dtbo Android image
dump_irqs- Dump IRQs
dump_resource- dump resource list
echo - echo args to console
editenv - edit environment variable
env - environment handling commands
exit - exit script
ext2load- load binary file from a Ext2 filesystem
ext2ls - list files in a directory (default /)
ext4load- load binary file from a Ext4 filesystem
ext4ls - list files in a directory (default /)
ext4size- determine a file’s size
false - do nothing, unsuccessfully
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatls - list files in a directory (default /)
fatsize - determine a file’s size
fatwrite- write file into a dos filesystem
fstype - Look up a filesystem type
go - start application at address ‘addr’
gpio - query and control gpio pins
gpt - GUID Partition Table
gzwrite - unzip and write memory to block device
help - print command description/usage
i2c - I2C sub-system
iomem - Show iomem data by device compatible(high priority) or node name
lcdputs - print string on video framebuffer
led - manage LEDs
load - load binary file from a filesystem
loop - infinite loop on address range
ls - list files in a directory (default /)
md - memory display
mdio - MDIO utility commands
mii - MII utility commands
mm - memory modify (auto-incrementing address)
mmc - MMC sub system
mmcinfo - display MMC info
mtd - MTD utils
mtd_blk - MTD Block device sub-system
mw - memory write (fill)
nfs - boot image via network using NFS protocol
nm - memory modify (constant address)
nvme - NVM Express sub-system
part - disk partition related commands
pci - list and access PCI Configuration Space
ping - send ICMP ECHO_REQUEST to network host
printenv- print environment variables
pxe - commands to get and boot from pxe files
rbrom - Perform RESET of the CPU
reboot - Perform RESET of the CPU, alias of ‘reset’
repart - update mmc partitons
reset - Perform RESET of the CPU
rkimgtest- Test if storage media have rockchip image
rockchip_show_bmp- load and display bmp from resource partition
rockchip_show_logo- load and display log from resource partition
rockusb - Use the rockusb Protocol
run - run commands in an environment variable
save - save file to a filesystem
saveenv - save environment variables to persistent storage
setcurs - set cursor position within screen
setenv - set environment variables
sf - SPI flash sub-system
showvar - print local hushshell variables
size - determine a file’s size
source - run script from memory
sspi - SPI utility command
sysboot - command to get and boot from syslinux files
sysmem_dump- Dump sysmem layout
sysmem_search- Search a available sysmem region
test - minimal test like /bin/sh
tftp - download image via network using TFTP protocol
tftpbootm- tftpbootm aosp/uImage/FIT image via network using TFTP protocol
tftpflash- flash image via network using TFTP protocol
tftpput - TFTP put command, for uploading files to a server
true - do nothing, successfully
ums - Use the UMS [USB Mass Storage]
unzip - unzip a memory region
usb - USB sub-system
usbboot - boot from USB device
version - print monitor, compiler and linker version

继续启动

ulan# boot
ulan’s current boot device nvme
prepare boot from nvme
will run command [pci enum]
gpio: pin 115 (gpio 115) value is 1
gpio: pin 42 (gpio 42) value is 1
pcie@fe150000: PCIe Linking… LTSSM is 0x0
pcie@fe150000: PCIe Linking… LTSSM is 0x210022
pcie@fe150000: PCIe Linking… LTSSM is 0x210022
pcie@fe150000: PCIe Linking… LTSSM is 0x210023
pcie@fe150000: PCIe Link up, LTSSM is 0x230011
pcie@fe150000: PCIE-0: Link up (Gen3-x4, Bus0)
pcie@fe150000: invalid flags type!
will run command [nvme scan]
will run command [load nvme 0 ${loadaddr} /Image]
reading /Image
56908288 bytes read in 47 ms (1.1 GiB/s)
will run command [run nvmeargs]
will run command [load nvme 0 ${initrd_addr} /initrd.img-5.10.110-rockchip-rk3588]
reading /initrd.img-5.10.110-rockchip-rk3588
9157085 bytes read in 9 ms (970.3 MiB/s)
will run command [load nvme 0 ${fdt_addr_r} /dtb/rockchip/yourland.dtb]
reading /dtb/rockchip/yourland.dtb
165739 bytes read in 1 ms (158.1 MiB/s)
will run boot command

作者:Zhang Yinkui  创建时间:2024-04-14 07:55
最后编辑:Zhang Yinkui  更新时间:2024-05-07 11:11