上一章将uBuntu的基本服务建好了,此时就可以在WINDOWS环境中进行操作了,以下的操作均是在登录SSH客户端和ftp客户端的操作.
1.安装交叉编译环境:
1.下载:arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 下载地址:http://pan.baidu.com/s/1mgyYfos
sudo mkdir qemu_arm
sudo chmod 766 qemu_arm/
cd qemu_arm
tar xjf arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
2.设置路径:
export PATH="/qemu_arm/arm-2014.05/bin:$PATH"
echo $PATH
查看版本输出是否正确 arm-none-linux-gnueabi-gcc -v在最后一行显示:gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29) 说明路径设置正确
3.安装Qemu
sudo apt-get install qemu
若用下载方式安装此处为下载地址:http://wiki.qemu.org/Download
查看安装的版本:qemu-system-arm -version
显示:QEMU emulator version 2.6.1 (Debian 1:2.6.1+dfsg-0ubuntu5.2), Copyright (c) 2003-2008 Fabrice Bellard
4.编译u-boot
下载地址:ftp://ftp.denx.de/pub/u-boot/
下载最新的 u-boot:u-boot-2017.01.tar.bz2
将下载好的文件放在/qeum_arm目录中,解压 tar xjf u-boot-2017.01.tar.bz2
//从2014.10版的U-boot开始取消了boards.cfg换使用make menuconfig配置
(在/qemu_arm/u-boot-2017.01/configs查看哪些是支持的文件)
make vexpress_ca9x4_defconfig
make all arch=ARM CROSS_COMPILE=arm-none-linux-gnueabi-
//---------另一种编译方式-------------------
make vexpress_ca9x4_config
export ARCH=arm
export CROSS_COMPILE=arm-none-linux-gnueabi-
make vexpress_ca9x4_config
make all//-------------------------------------------------
编译后产生三个文件
- "u-boot.bin" is a raw binary image
- "u-boot" is an image in ELF binary format
- "u-boot.srec" is in Motorola S-Record format
5.用Qemu测试
qemu-system-arm -M vexpress-a9 -m 256M -nographic -kernel u-boot
显示 :
book@book-virtual-machine:/qemu_arm/u-boot-2017.01$ qemu-system-arm -M vexpress-a9 -m 256M -nographic -kernel u-boot
pulseaudio: set_sink_input_volume() failed
pulseaudio: Reason: Invalid argument
pulseaudio: set_sink_input_mute() failed
pulseaudio: Reason: Invalid argument
U-Boot 2017.01 (Jan 22 2017 - 21:02:27 +0800)
DRAM: 256 MiB
WARNING: Caches not enabled
Flash: 128 MiB
MMC: MMC: 0
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Net: smc911x-0
Hit any key to stop autoboot: 0
........中间省去一大堆
TFTP from server 10.0.2.2; our IP address is 10.0.2.15
Filename 'boot.scr.uimg'.
Load address: 0x80008000
Loading: *
TFTP error: 'Access violation' (2)
Not retrying...
smc911x: MAC 52:54:00:12:34:56
smc911x: MAC 52:54:00:12:34:56
Wrong Image Format for bootm command
ERROR: can't get kernel image!
=>
此时u-boot已运行起来,只是我们还没有内核文件可以运行
遇到的问题:
u-boot不能使用make menuconfig,此时需要安装libncurses5-dev,
解决: 1:安装 sudo apt-get install libncurses5-dev库
2:ssh客户端窗口不能太小,把terminal变大整个屏幕大小就可以显示。