U-boot 运行在Linux主机

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/jnu_fangzebin/article/details/52971551

在没有开发板的时候,如果想要对u-boot进行编译,运行,执行相应的命令,那么就可以使用U-boot的沙箱功能,编译出来的U-boot能在Linux主机上运行。
使用U-boot的sandbox功能的具体步骤

1、make sandbox_defconfig all

可能出现问题

  1. ‘sdl-config: Command not found’ you may need to
    install libsdl1.2-dev or similar to get SDL support.
    解决方法:sudo apt-get install libsdl1.2-dev

  2. Fatal Error: openssl/evp.h No such file or directory
    解决方法:sudo apt-get install libssl-dev

  3. Your dtc is too old, please upgrade to dtc 1.4 or newer,
    解决方法:sudo apt-get install device- tree-compiler

另外要注意编译工具的配置
在最顶层makefile中,当我们编译arm开发板会写成下面这样,

ifeq ($(HOSTARCH),$(ARCH))
CROSS_COMPILE ?=
endif

CROSS_COMPILE ?= arm-linux-gnueabi-

上面的写法会导致编译出错,因为现在是在Linux主机上运行,不能使用arm-linux-gnueabi-gcc编译器,故要写成下面这样

ifeq ($(HOSTARCH),$(ARCH))
CROSS_COMPILE ?=
endif

否则出现:file not recognized: File format not recognized collect2: ld returned 1 exit status的错误

2、./u-boot 运行U-boot,出现下面的界面

U-Boot 2016.11-rc2 (Oct 30 2016 - 12:26:01 +0800)

DRAM:  128 MiB
MMC:   
Using default environment

In:    serial
Out:   serial
Err:   serial
SCSI:  Net:   No ethernet found.
IDE:   Bus 0: not available  
=> 

猜你喜欢

转载自blog.csdn.net/jnu_fangzebin/article/details/52971551