我的目标设置:
SOC: STM32H743 (Cortex m7 single core)
Internal Flash: 2MB
Board: Waveshare CoreH7XXI
On-board DRAM: 8MB, Start_Address: 0xd0000000, Size_in_bytes: 0x7A1200
SDCARD: 1GB
Bootloader: mainline u-boot (only I've modified the device tree and added my board files, almost everything is default)
kernel: mainline linux (compiled with stm32_defconfig configuration + some tweaks in menuconfig)
我的主机(PC)设置:
OS: Ubuntu 20 LTS on windows10 WSL2
Text Editor: VSCode (Visual Studio Code)
Debug Probe: STLink V2
Debug Software: Openocd + gdb-multiarch integrated in VSCode
原始 U-boot 串行控制台:
U-Boot 2020.07-00610-g610e1487c8-dirty (Sep 07 2020 - 22:06:45 +0430)
Model: Waveshare STM32H743i-Coreh7 board
DRAM: 7.6 MiB
MMC: STM32 SD/MMC: 0
In: serial@40004400
Out: serial@40004400
Err: serial@40004400
Hit SPACE in 3 seconds to stop autoboot.
stm32_sdmmc2_send_cmd: cmd 6 failed, retrying ...
stm32_sdmmc2_send_cmd: cmd 6 failed, retrying ...
stm32_sdmmc2_send_cmd: cmd 6 failed, retrying ...
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
U-Boot > fatload mmc 0:1 ${kernel_addr_r} zImage
1403424 bytes read in 326 ms (4.1 MiB/s)
U-Boot > fatload mmc 0:1 ${fdt_addr_r} stm32h743i-coreh7.dtb
15116 bytes read in 14 ms (1 MiB/s)
U-Boot > setenv bootargs console=ttySTM1,115200n8
U-Boot > bootz ${kernel_addr_r} - ${fdt_addr_r}
Kernel image @ 0xd0008000 [ 0x000000 - 0x156a20 ]
## Flattened Device Tree blob at d0408000
Booting using the fdt blob at 0xd0408000
Loading Device Tree to d064f000, end d0655b0b ... OK
Starting kernel ...
即使我使用以下命令制作了 uImage,但它仍然无法启动。
mkimage -A arm -O linux -T kernel -C none -a 0xd0008000 -e 0xd0008000 -n "Linux kernel" -d arch/arm/boot/zImage uImage
u 启动日志:
U-Boot > bootm ${kernel_addr_r} - ${fdt_addr_r}
## Booting kernel from Legacy Image at d0008000 ...
Image Name: Linux kernel
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1403424 Bytes = 1.3 MiB
Load Address: d0008000
Entry Point: d0008000
Verifying Checksum ... OK
## Flattened Device Tree blob at d0408000
Booting using the fdt blob at 0xd0408000
Loading Kernel Image
U-boot 环境:
U-Boot > printenv
arch=arm
baudrate=115200
board=coreh7
board_name=coreh7
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_syslinux_conf=extlinux/extlinux.conf
boot_targets=mmc0
bootcmd=run distro_bootcmd
bootcmd_mmc0=devnum=0; run mmc_boot
bootdelay=3
bootfstype=fat
cpu=armv7m
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
fdt_addr_r=0xD0408000
fdtcontroladdr=d06572a0
fdtfile=stm32h743i-coreh7.dtb
kernel_addr_r=0xD0008000
loadaddr=0xD0400000
mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi
pxefile_addr_r=0xD0428000
ramdisk_addr_r=0xD0438000
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done; setenv devplist
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf}; then echo Found ${prefix}${boot_syslinux_conf}; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
scriptaddr=0xD0418000
soc=stm32h7
stderr=serial@40004400
stdin=serial@40004400
stdout=serial@40004400
vendor=waveshare
Environment size: 1873/8188 bytes
你可以从下载我的内核 .config 文件这里(默认配置:stm32_defconfig)。
你可以从下载我的 u-boot .config 文件这里。
你可以从下载我修改过的设备树这里。
你可以从下载我的u-boot特定修改后的设备树这里。
答案1
您没有将任何内容传递bootargs
给内核,并且由于您绕过了让常规 Linux 发行版为您提供该服务的逻辑,因此您需要将控制台所在位置的内容传递给 Linux,因此它将打印出来消息以及您的根设备。