BeagleBone Black和U-Boot 2020.07:fit_find_config_node:DTB中缺少FDT描述

问题描述

我的环境如下:

  1. beaglebone black rev C
  2. 使用defconfig(am335x_evm_defconfig)构建的u-boot 2020.07
  3. 内核通过TFTP加载
  4. RFS是通过NFS(buildroot)安装的

当我从uSD卡启动时,我的beaglebone Black给我这个错误

U-Boot SPL 2020.07 (Sep 22 2020 - 16:58:58 -0700)                                                                                                    
Trying to boot from MMC1                                                                                                                             
fit_find_config_node: Missing FDT description in DTB                                                                                                 
No matching DT out of these options:

BBB MLO Boot error

当我不按S2按钮启动时,似乎使用了emmC中的MLO,它将uEnv.txt加载到SD卡上。

我创建了一个bash脚本,用于自动格式化SD卡(即使用sfdisk和mkfs.vfat创建FAT16分区):

#! /bin/sh
#    
#
#Before running,first give 755 permissions:
# chmod 755 mk2partSDcard.sh

#To run script,provide the device (/dev/sdb,/dev/mmcblk) the SD card is 
#attached to using the following:
# 1. lsblk -l 
# 2. df -hT
#and pass the device to the script as root:
#sudo mk2partSDcard.sh /dev/sdb
     
#DRIVE=$1

#if [ ! -e $DRIVE ]
#then
#   echo "\"$DRIVE\" doesn't exist... closing"
#   exit -1
#fi 

#should only perform the following when re-using an already formatted sd 
#card. No need to do this on a brand new card.
#Erase partition table/labels on uSD card:
dd if=/dev/zero of=$DRIVE bs=1M count=10

#clear additional locations of prevIoUs MLOs
#dd if=/dev/zero of=$DRIVE bs=512 count=1 seek=512 
#dd if=/dev/zero of=$DRIVE bs=512 count=1 seek=768 

#type - 0x01=FAT12; 0x04=FAT16; 0x0b=W95 fat32; 0x0c=W95 fat32 (LBA); 
#0x0e=W95 FAT16 (LBA); 0x0f=W95 Ext'd (LBA)

#bootable - [ * | - ]

#echo "Starting sfdisk"
#sfdisk $DRIVE <<-__EOF__
#,4096,0x0e,*
#To add additional partition,uncomment the following:
#,+,83
#__EOF__

#echo "Starting mkfs"
#mkfs.vfat -c -F 16 -n "BOOT" -v ${DRIVE}1
#umount ${DRIVE}1
#mkfs.ext4 -L "\ROOTFS\" -O ^Metadata_csum,^64bit -v ${DRIVE}2
#umount ${DRIVE}2
#echo "Done script"

我设法将fit_find_config_node追踪到common_fit.c,并在u-boot readme (line # 52)中注意到了这一点:

 #include <common.h>
#include <errno.h>
#include <image.h>
#include <log.h>
#include <linux/libfdt.h>

ulong fdt_getprop_u32(const void *fdt,int node,const char *prop)
{
    const u32 *cell;
    int len;

    cell = fdt_getprop(fdt,node,prop,&len);
    if (!cell || len != sizeof(*cell))
        return FDT_ERROR;

    return fdt32_to_cpu(*cell);
}

/*
 * Iterate over all /configurations subnodes and call a platform specific
 * function to find the matching configuration.
 * Returns the node offset or a negative error number.
 */
int fit_find_config_node(const void *fdt)
{
    const char *name;
    int conf,len;
    const char *dflt_conf_name;
    const char *dflt_conf_desc = NULL;
    int dflt_conf_node = -ENOENT;

    conf = fdt_path_offset(fdt,FIT_CONFS_PATH);
    if (conf < 0) {
        debug("%s: Cannot find /configurations node: %d\n",__func__,conf);
        return -EINVAL;
    }

    dflt_conf_name = fdt_getprop(fdt,conf,"default",&len);

    for (node = fdt_first_subnode(fdt,conf);
         node >= 0;
         node = fdt_next_subnode(fdt,node)) {
        name = fdt_getprop(fdt,"description",&len);
        if (!name) {
#ifdef CONfig_SPL_LIBCOMMON_SUPPORT
            printf("%s: Missing FDT description in DTB\n",__func__);
#endif
            

    return -EINVAL;
            }
    
            if (dflt_conf_name) {
                const char *node_name = fdt_get_name(fdt,NULL);
                if (strcmp(dflt_conf_name,node_name) == 0) {
                    dflt_conf_node = node;
                    dflt_conf_desc = name;
                }
            }
    
            if (board_fit_config_name_match(name))
                continue;
    
            debug("Selecting config '%s'",name);
    
            return node;
        }
    
        if (dflt_conf_node != -ENOENT) {
            debug("Selecting default config '%s'\n",dflt_conf_desc);
            return dflt_conf_node;
        }
    
        return -ENOENT;
    }

common_fit.c行的第52行:

IFDEF_SPL_LIBCOMMON

由于取消配置已启用,因此我不想更改它。

我的目标是使用MLO,u-boot.img和uEnV.txt从SD启动(就像我过去一样)。我不确定以前有什么变化。我也可以根据要求提供SD卡的十六进制转储。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)