Boot
u-boot 卡在啟動核心
我的目標設置:
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-boot 日誌:
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 特定修改設備樹。
您沒有將任何內容傳遞
bootargs
給核心,並且由於您繞過了讓正常 Linux 發行版為您提供的邏輯,因此您需要將一些說明控制台在哪裡的內容傳遞給 Linux,因此它會列印出來消息,以及您的根設備。