CFE引导加载程序中的ELF文件错误无效

时间:2017-01-27 22:35:47

标签: cross-platform elf bootloader powerpc broadcom

我有一个Broadcom开关板,上面有MPC8548E PowerPC CPU。我使用crosstool-ng为这个CPU创建了一个工具链。当我尝试使用命令CFE>在此板上使用load -elf 10.13.51.131:main引导加载程序加载已编译的二进制文件时,我得到以下输出:

CFE> load -elf 10.13.51.131:main
Loader:elf Filesys:tftp Dev:eth0 File:10.13.51.131:main Options:(null)
Loading: Warning: negative seek on tftp file attempted
Failed.
Could not load 10.13.51.131:main: Invalid ELF file
*** command status = -16

为什么会说Invalid ELF filereadelf -h向我显示以下信息:

$ readelf -h main
ELF Header:
  Magic:   7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, big endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           PowerPC
  Version:                           0x1
  Entry point address:               0x100002c8
  Start of program headers:          52 (bytes into file)
  Start of section headers:          3972 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         7
  Size of section headers:           40 (bytes)
  Number of section headers:         28
  Section header string table index: 25

如何加载ELF文件,我甚至不想运行任何东西,它首先需要接受ELF。我有另一个ELF(据说)已经准备好用VxWorks编译了,但我也得到了同样的错误。

这适用于切换Broadcom的{​​{1}}参考板。

1 个答案:

答案 0 :(得分:1)

看起来您的文件没有正确传输(通过tftp),导致文件被解析为ELF时出错。

也许尝试在tftp服务器上运行数据包捕获,以检查booloader和服务器之间的流量。在tftp服务器上尝试这样的事情:

tcpdump -s 2048 -w tftp.pcap -i <interface> udp port tftp

- 然后使用wireshark打开生成的tftp.pcap文件。