ubuntu中建立交叉编译环境和skyey

如何构裸机hello world目标程序并在SkyEye全数字实时仿真平台上运行及调试? SkyEye全数字实时仿真平台,简称SkyEye,是一款支持 ARM、TI DSP、PowerPC、X86、SPARC、龙芯、飞腾等多种处理器体系架构的指令级仿真平台。 SkyEye可以部署在桌面计算机上,开发人员可以基于SkyEye提供的已有模型库的组件(如处理器、内存总线、存储器、片上外设、外围总线设备等),通过图形化搭环境拖拽需要的组件并定制与实际目标机相同的虚拟目标系统。 使运行在真实目标机上的二进制代码可以不加修改直接在虚拟系统中运行,并且可以得到与在真实目标机下相同的执行结果,支持的目标二进 阅读详情
一、搭建开发环境 ESaLinux联盟
在www.uclinux.org上下载以下两个包: ESaLinux联盟
交叉开发工具:arm-elf-tools-20040427.sh ESaLinux联盟
uClinux的源码包:uClinux-dist-20040408.tar.gz ESaLinux联盟
好像现在arm-elf-tools-20040427.sh不太好下,你也可以下载arm-elf-tools-20030314.sh ESaLinux联盟
安装交叉开发工具:进入arm-elf-tools-20040427.sh所在的目录,执行以下命令进行安装: ESaLinux联盟
代码:
$sudo chmod +x arm-elf-tools-20040427.sh ESaLinux联盟
$sudo ./arm-elf-tools-20040427.sh
ESaLinux联盟
这两条命令首先是加可执行权限,然后安装。 ESaLinux联盟
解压uClinux源码包: ESaLinux联盟
用以下命令: ESaLinux联盟
代码:
$tar zxvf uClinux-dist-20040408.tar.gz
ESaLinux联盟
ESaLinux联盟
二、下载Skyeye 以便进行仿真: ESaLinux联盟
ESaLinux联盟
SkyEye 是开源软件的一个项目,SkyEye的目标是在Linux和Windows操作系统里提供一个完全的仿真环境。SkyEye仿真环境相当于一个嵌入式计算 机系统,你可以在SkyEye里运行一些嵌入式Linux操作系统,如ARMLinux,uClinux,uc/OS-II(ucos- ii)等,并能分析和调试它们的源代码。 ESaLinux联盟
如果你想知道关于SkyEye和嵌入式系统更详细的信息,请访问下面的站点: ESaLinux联盟
www.SkyEye.org 
http://www.skyeye.org/index_cn.html ESaLinux联盟
ESaLinux联盟
安装SkyEye ESaLinux联盟
网上介绍了很多安装方法,其实在ubuntu里面安装最方便: ESaLinux联盟
代码:
wenwu@wenwu-desktop:~$ sudo apt-get install skyeye
ESaLinux联盟
这样,一个最新版的skyeye1.2.3就安装好了。 ESaLinux联盟
在shell 里面直接键入skyeye后看到如下说明: ESaLinux联盟
代码:
**************************** WARNING ********************************** ESaLinux联盟
If you want to run ELF image, you should use -e option to indicate ESaLinux联盟
your elf-format image filename. Or you only want to run binary image, ESaLinux联盟
you need to set the filename of the image and its entry in skyeye.conf. ESaLinux联盟
*********************************************************************** ESaLinux联盟
ESaLinux联盟
big_endian is false. ESaLinux联盟
Failed to open skyeye config file skyeye.conf in the same directory ESaLinux联盟
error: No such file or directory ESaLinux联盟
------------------------- SkyEye -V1.2 --------------------------- ESaLinux联盟
Usage: SkyEye [options] -e program [program args] ESaLinux联盟
Default mode is STANDALONE mode ESaLinux联盟
------------------------------------------------------------------ ESaLinux联盟
Options: ESaLinux联盟
-e exec-file        the (ELF executable format)kernel file name. ESaLinux联盟
-l load_address,load_address_mask ESaLinux联盟
                    Load ELF file to another address, not its entry. ESaLinux联盟
-b                  specify the data type is big endian when non "-e" option. ESaLinux联盟
-d                  in GDB Server mode (can be connected by GDB). ESaLinux联盟
-c config-file      the skyeye configure file name. ESaLinux联盟
-h                  The SkyEye command options, and ARCHs and CPUs simulated. ESaLinux联盟
------------------------------------------------------------------ ESaLinux联盟
----------- Architectures and CPUs simulated by SkyEye------------- ESaLinux联盟
-------- ARM architectures --------- ESaLinux联盟
at91 ESaLinux联盟
lpc ESaLinux联盟
s3c4510b ESaLinux联盟
s3c44b0x ESaLinux联盟
s3c44b0 ESaLinux联盟
s3c3410x ESaLinux联盟
ep7312 ESaLinux联盟
lh79520 ESaLinux联盟
ep9312 ESaLinux联盟
cs89712 ESaLinux联盟
sa1100 ESaLinux联盟
pxa_lubbock ESaLinux联盟
pxa_mainstone ESaLinux联盟
at91rm92 ESaLinux联盟
s3c2410x ESaLinux联盟
s3c2440 ESaLinux联盟
sharp_lh7a400 ESaLinux联盟
ns9750 ESaLinux联盟
lpc2210 ESaLinux联盟
ps7500 ESaLinux联盟
integrator ESaLinux联盟
-------- BlackFin architectures ---- ESaLinux联盟
bf533
ESaLinux联盟
ESaLinux联盟
表明你的skyeye 已经安装好了,可以随时使用了。 ESaLinux联盟
当然,如果你的源里面没有 skyeye,就尝试从下面的方法安装: ESaLinux联盟
首先下载skyeye: ESaLinux联盟
下载地址:http://gro.clinux.org/projects/skyeye/ ESaLinux联盟
在这个网址里面有如下两个版本,我建议用1.2.2版本的,1.2.3版本的在安装时往往存在一些问题 ESaLinux联盟
skyeye_1_2_2_Rel.tar.bz2 ESaLinux联盟
skyeye_1_2_3_Rel.tar.bz2
ESaLinux联盟
ESaLinux联盟
因为在安装skyeye 时会用到一些别的包,所以在新立得软件包管理器中找到下面的软件包:binutils-dev 标记并安装 ESaLinux联盟
下面是关于这个软件包的描述 ESaLinux联盟
The GNU binary utilities (BFD development files) ESaLinux联盟
This package includes header files and static libraries necessary to build ESaLinux联盟
programs which use the GNU BFD library, which is part of binutils. Note ESaLinux联盟
that building Debian packages which depend on the shared libbfd is Not ESaLinux联盟
Allowed. ESaLinux联盟
ESaLinux联盟
最后使用make命令进行软件的安装,编译完毕后会在binary生成一个skyeye可执行文件,该文件就是skyeye模拟器了。 ESaLinux联盟
使用make命令的时候可以加入一些选项参数,例如: ESaLinux联盟
不允许DBCT ESaLinux联盟
$make NO_DBCT=1 ESaLinux联盟
不支持LCD ESaLinux联盟
$make NO_LCD=1 ESaLinux联盟
不支持BFD库 ESaLinux联盟
$make NO_BFD=1 ESaLinux联盟
不支持网络设备 ESaLinux联盟
$make NO_NET=1 ESaLinux联盟
如果在binary目录下生成了skyeye文件,那么安装成功。 ESaLinux联盟
ESaLinux联盟
为了可以在shell 里面直接运用skyeye命令,将这个路径/source/skyeye_1_2_2_Rel/binary 加入到系统环境变量中 ESaLinux联盟
代码:
$gedit /etc/environment
ESaLinux联盟
找到有PATH那一行,加入skyeye 路径,比如下面所示 ESaLinux联盟
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:ESaLinux联盟
/opt/slickedit/bin:/source/skyeye_1_2_2_Rel/binary" ESaLinux联盟
重启系统后生效 ESaLinux联盟
ESaLinux联盟
三、测试arm-elf-tool 的工作情况 ESaLinux联盟
建立一个源文件键入以下代码: ESaLinux联盟
代码:
/*test.c*/ ESaLinux联盟
#include <stdio.h> ESaLinux联盟
ESaLinux联盟
int main() ESaLinux联盟
{ ESaLinux联盟
        int i; ESaLinux联盟
        for(i=0;i<6;i++) ESaLinux联盟
        { ESaLinux联盟
                printf("i=%d/n",i); ESaLinux联盟
                printf("Hello,embedded linux!/n"); ESaLinux联盟
        } ESaLinux联盟
        return 0; ESaLinux联盟
}
ESaLinux联盟
用以下命令进行编译: ESaLinux联盟
代码:
wenwu@wenwu-desktop:/source/work/test$ arm-elf-gcc -Wl,-elf2flt -o test test.c ESaLinux联盟
wenwu@wenwu-desktop:/source/work/test$ ls ESaLinux联盟
test  test.c  test.gdb
ESaLinux联盟
可以看到编译输出两个文件:test和test.gdb,表示编译成功 ESaLinux联盟
其中-elf2flt参数是将elf文件格式转为flat文件格式,这个工具是在你安装交叉编译器产生的. ESaLinux联盟
也可以写一个makefile测试,下面是我写的一个,仅供参考: ESaLinux联盟
ESaLinux联盟
代码:
#begin ESaLinux联盟
CC=arm-elf-gcc ESaLinux联盟
ESaLinux联盟
LDFLAGS=-Wl,-elf2flt ESaLinux联盟
ESaLinux联盟
LIBS= ESaLinux联盟
OBJS=test.o ESaLinux联盟
ESaLinux联盟
all:test ESaLinux联盟
ESaLinux联盟
hello:$(OBJS) ESaLinux联盟
   $(CC) $(CFLAGS) $(LDFLAGS) -o hello $(OBJS) ESaLinux联盟
    ESaLinux联盟
clean: ESaLinux联盟
   rm -rf *.o *.elf *.gdb test ESaLinux联盟
    ESaLinux联盟
#end
ESaLinux联盟
ESaLinux联盟
执行make 命令后编译成功,最后也生成了test文件,我们来看一下这个test文件 ESaLinux联盟
代码:
wenwu@wenwu-desktop:/source/work/test$ file test ESaLinux联盟
test: BFLT executable - version 4 ram
ESaLinux联盟
可以看到生成的文件格式为BFLT格式,这是目标平台所支持的格式,所以当你试图:./test时,系统会提示: ESaLinux联盟
代码:
wenwu@wenwu-desktop:/source/work/test$ ./test ESaLinux联盟
bash: ./test:无法执行二进制文件
ESaLinux联盟
我们也可以用下面的命令进行编译生成汇编代码 ESaLinux联盟
代码:
wenwu@wenwu-desktop:/source/work/test$ arm-elf-gcc -S -o test.S test.c ESaLinux联盟
wenwu@wenwu-desktop:/source/work/test$ file test.S ESaLinux联盟
test.S: ASCII assembler program text
ESaLinux联盟
用文本编辑器打开这个文件test.S,就可以看到熟悉的ARM 汇编代码了。 ESaLinux联盟

四、测试这个程序: ESaLinux联盟
ESaLinux联盟
测试这个程序需要用到一个工具skyeye-testsuits,可以在下面的网址下载: ESaLinux联盟
http://gro.clinux.org/projects/skyeye/ ESaLinux联盟
网址里面有testsuite2.1.tar.bz2 但是在这里我们直接下载1.2.0版的二进制的工具包,skyeye-binary-testutils-1.2.0.tar.bz2 ESaLinux联盟
下载后解压 ESaLinux联盟
代码:
wenwu@wenwu-desktop:/source$ tar jxvf skyeye-binary-testutils-1.2.0.tar.bz2
ESaLinux联盟
进入下面这个目录,这是我们主要用到的目录。 ESaLinux联盟
代码:
wenwu@wenwu-desktop:/source$ ls skyeye-binary-testutils-1.2.0/at91x40/uclinux2 ESaLinux联盟
boot.rom  linux  readme  skyeye.conf
ESaLinux联盟
这个目录里面有四个文件,其中linux就是内核映像,boot.rom是要写到Flash里面去的。里面包含文件系统。skyeye.conf是配置文件。 ESaLinux联盟
可以在命令行里键入以下代码, ESaLinux联盟
代码:
skyeye -e linux
ESaLinux联盟
你看到了什么?没错,我没有骗你 ESaLinux联盟
代码:
          ____ _  _ ESaLinux联盟
         /  __| ||_|                  ESaLinux联盟
    _   _| |  | | _ ____  _   _  _  _ ESaLinux联盟
   | | | | |  | || |  _ /| | | |/ // / ESaLinux联盟
   | |_| | |__| || | | | | |_| |/    / ESaLinux联盟
   |  ___/____|_||_|_| |_|/____|/_//_/ ESaLinux联盟
   | | ESaLinux联盟
   |_| ESaLinux联盟
ESaLinux联盟
当你看到这幅图片的时候,是不是感觉很爽?呵呵,我也是。 ESaLinux联盟
ESaLinux联盟
刚才我们不是写了一个代码吗?下面我们就看看怎么运行我们的程序: ESaLinux联盟
首先在skyeye-binary-testutils-1.2.0/at91x40/uclinux2这个目录里面建立一个文件夹:romfs ESaLinux联盟
这个目录主要用来存放用户程序,就是最后你写的程序也要拷到这个目录里面。 ESaLinux联盟
代码:
wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ mkdir romfs ESaLinux联盟
wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ ls ESaLinux联盟
boot.rom  linux  readme  romfs  skyeye.conf
ESaLinux联盟
但是我们必须把系统已有的文件系统里面的程序也拷出来,也就是把boot.rom本身所有的程序也要拷到romfs这个文件夹里面,所以首先要进行一次挂载,所以进入/mnt目录,建立一个临时文件夹tmp,如下所示 ESaLinux联盟
代码:
wenwu@wenwu-desktop:/mnt$ ls ESaLinux联盟
wenwu@wenwu-desktop:/mnt$ sudo mkdir tmp ESaLinux联盟
wenwu@wenwu-desktop:/mnt$ ls ESaLinux联盟
tmp
ESaLinux联盟
用 mount -o loop src dst命令进行挂载,如下所示: ESaLinux联盟
代码:
wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ sudo mount -o loop boot.rom /mnt/tmp/ ESaLinux联盟
wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ ls /mnt/tmp/ ESaLinux联盟
bin  dev  etc  home  lib  mnt  proc  sbin  tmp  usr  var
ESaLinux联盟
然后把这里面的所有文件拷贝到我们刚才所建的那个我们自己的文件夹romfs里面 ESaLinux联盟
代码:
wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ sudo cp -r /mnt/tmp/* ./romfs/
ESaLinux联盟
这时,我们自己的文件夹里面有以下内容: ESaLinux联盟
代码:
wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ ls romfs/ ESaLinux联盟
bin  dev  etc  home  lib  mnt  proc  sbin  tmp  usr  var
ESaLinux联盟
将我们刚才生成的一个测试程序test也拷贝过来到romfs/bin目录时面: ESaLinux联盟
代码:
wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ sudo cp /source/work/test/test romfs/bin/ ESaLinux联盟
wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ ls romfs/bin/ ESaLinux联盟
boa      dhcpcd  ftp   gdbserver  inetd  login  ping    route  telnet   test ESaLinux联盟
busybox  expand  ftpd  ifconfig   init   mount  reboot  sh     telnetd  umount
ESaLinux联盟
ESaLinux联盟
用genromfs这个工具重新制作文件系统 ESaLinux联盟
代码:
wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ sudo genromfs -f boot.rom -d ./romfs/ ESaLinux联盟
wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ ls -l boot.rom ESaLinux联盟
-rw-r--r-- 1 wenwu wenwu 1561600 2007-11-11 14:03 boot.rom
ESaLinux联盟
好了,下面我们再运行skyeye进行仿真,键入:skyeye -e linux ESaLinux联盟
代码:
wenwu@wenwu-desktop:/source/skyeye-binary-testutils-1.2.0/at91x40/uclinux2$ skyeye -e linux ESaLinux联盟
big_endian is false. ESaLinux联盟
arch: arm ESaLinux联盟
cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0 ESaLinux联盟
mach info: name at91, mach_init addr 0x8057550 ESaLinux联盟
ethmod num=1, mac addr=0:4:3:2:1:f, hostip=10.0.0.1 ESaLinux联盟
can't find device module: (name:net, type:(null)) ESaLinux联盟
log_info: log is off. ESaLinux联盟
log_info:log file is /tmp/test.log, fd is 0x80f9318 ESaLinux联盟
log_info: log start clock 3200000 ESaLinux联盟
log_info: log end clock 3330000 ESaLinux联盟
uart_mod:0, desc_in:, desc_out:, converter: ESaLinux联盟
SKYEYE: use arm7100 mmu ops ESaLinux联盟
Loaded ROM   ./boot.rom ESaLinux联盟
start addr is set to 0x01000000 by exec file. ESaLinux联盟
Linux version 2.4.20-uc0 (chy@localhost.localdomain) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(uClinux XIP and shared lib patches from http://www.snapgear.com/)) #7 ?? 8?? 1 19:43:07 CST 2003 ESaLinux联盟
Processor: Atmel AT91M40xxx revision 0 ESaLinux联盟
Architecture: EB01 ESaLinux联盟
On node 0 totalpages: 1024 ESaLinux联盟
zone(0): 0 pages. ESaLinux联盟
zone(1): 1024 pages. ESaLinux联盟
zone(2): 0 pages. ESaLinux联盟
Kernel command line: root=/dev/rom0 ESaLinux联盟
Calibrating delay loop... 12.97 BogoMIPS ESaLinux联盟
Memory: 4MB = 4MB total ESaLinux联盟
Memory: 2984KB available (833K code, 181K data, 40K init) ESaLinux联盟
Dentry cache hash table entries: 512 (order: 0, 4096 bytes) ESaLinux联盟
Inode cache hash table entries: 512 (order: 0, 4096 bytes) ESaLinux联盟
Mount-cache hash table entries: 512 (order: 0, 4096 bytes) ESaLinux联盟
Buffer-cache hash table entries: 1024 (order: 0, 4096 bytes) ESaLinux联盟
Page-cache hash table entries: 1024 (order: 0, 4096 bytes) ESaLinux联盟
POSIX conformance testing by UNIFIX ESaLinux联盟
Linux NET4.0 for Linux 2.4 ESaLinux联盟
Based upon Swansea University Computer Society NET3.039 ESaLinux联盟
Initializing RT netlink socket ESaLinux联盟
Starting kswapd ESaLinux联盟
Atmel USART driver version 0.99 ESaLinux联盟
ttyS0 at 0xfffd0000 (irq = 2) is a builtin Atmel APB USART ESaLinux联盟
ttyS1 at 0xfffcc000 (irq = 3) is a builtin Atmel APB USART ESaLinux联盟
Blkmem copyright 1998,1999 D. Jeff Dionne ESaLinux联盟
Blkmem copyright 1998 Kenneth Albanowski ESaLinux联盟
Blkmem 1 disk images: ESaLinux联盟
0: 1400000-157D3FF [VIRTUAL 1400000-157D3FF] (RO) ESaLinux联盟
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize ESaLinux联盟
SkyEye NE2k Ethernet driver version 0.2 (2003-04-27) ESaLinux联盟
sene2k dev name: eth0: <6>NET4: Linux TCP/IP 1.0 for NET4.0 ESaLinux联盟
IP Protocols: ICMP, UDP, TCP ESaLinux联盟
IP: routing cache hash table of 512 buckets, 4Kbytes ESaLinux联盟
TCP: Hash tables configured (established 512 bind 512) ESaLinux联盟
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0. ESaLinux联盟
sys_mount:dev_name /dev/root,dir_name /root, type ext2, flag 0x8001, data 0 ESaLinux联盟
 sys_mount:1 data_page 1122000, type_page 113bf74, dev_page 0, dir_page 8001 ESaLinux联盟
sys_mount:2 data_page 0, type_page 117f000, dev_page 117d000, dir_page 117e000 ESaLinux联盟
sys_mount:3 data_page 0, type_page 117f000, dev_page 117d000, dir_page 117e000 ESaLinux联盟
sys_mount:4 data_page 0, type_page 117f000, dev_page 117d000, dir_page 117e000 ESaLinux联盟
sys_mount:dev_name /dev/root,dir_name /root, type romfs, flag 0x8001, data 0 ESaLinux联盟
 sys_mount:1 data_page 0, type_page 117f000, dev_page 117d000, dir_page 8001 ESaLinux联盟
sys_mount:2 data_page 0, type_page 117f000, dev_page 117d000, dir_page 117e000 ESaLinux联盟
sys_mount:3 data_page 0, type_page 117f000, dev_page 117d000, dir_page 117e000 ESaLinux联盟
sys_mount:4 data_page 0, type_page 117f000, dev_page 117d000, dir_page 117e000 ESaLinux联盟
VFS: Mounted root (romfs filesystem) readonly. ESaLinux联盟
sys_mount:dev_name .,dir_name /, type <NULL>, flag 0x2000, data 0 ESaLinux联盟
 sys_mount:1 data_page 111c120, type_page 0, dev_page 10e5d00, dir_page 10e5174 ESaLinux联盟
sys_mount:2 data_page 0, type_page 0, dev_page 117f000, dir_page 1122000 ESaLinux联盟
sys_mount:3 data_page 0, type_page 0, dev_page 117f000, dir_page 1122000 ESaLinux联盟
sys_mount:4 data_page 0, type_page 0, dev_page 117f000, dir_page 1122000 ESaLinux联盟
Shell invoked to run file: /etc/rc ESaLinux联盟
Command: hostname GDB-ARMulator ESaLinux联盟
Command: /bin/expand /etc/ramfs.img /dev/ram0 ESaLinux联盟
Command: mount -t proc proc /proc ESaLinux联盟
sys_mount:dev_name /proc,dir_name /proc, type proc, flag 0xc0ed0000, data 11d0008 ESaLinux联盟
 sys_mount:1 data_page 1000, type_page 1002, dev_page 118a008, dir_page c0ed0000 ESaLinux联盟
sys_mount:2 data_page 1188000, type_page 11a0000, dev_page 1189000, dir_page 1122000 ESaLinux联盟
sys_mount:3 data_page 1188000, type_page 11a0000, dev_page 1189000, dir_page 1122000 ESaLinux联盟
sys_mount:4 data_page 1188000, type_page 11a0000, dev_page 1189000, dir_page 1122000 ESaLinux联盟
mount: /etc/mtab: Read-only file system ESaLinux联盟
Command: mount -t ext2 /dev/ram0 /var ESaLinux联盟
sys_mount:dev_name /dev/ram0,dir_name /var, type ext2, flag 0xc0ed0000, data 11d0008 ESaLinux联盟
 sys_mount:1 data_page 111c260, type_page 119fe40, dev_page 0, dir_page c0ed0000 ESaLinux联盟
sys_mount:2 data_page 1186000, type_page 1188000, dev_page 1187000, dir_page 1122000 ESaLinux联盟
sys_mount:3 data_page 1186000, type_page 1188000, dev_page 1187000, dir_page 1122000 ESaLinux联盟
sys_mount:4 data_page 1186000, type_page 1188000, dev_page 1187000, dir_page 1122000 ESaLinux联盟
mount: /etc/mtab: Read-only file system ESaLinux联盟
Command: mkdir /var/tmp ESaLinux联盟
Command: mkdir /var/log ESaLinux联盟
Command: mkdir /var/run ESaLinux联盟
Command: mkdir /var/lock ESaLinux联盟
Command: cat /etc/motd ESaLinux联盟
Welcome to ESaLinux联盟
          ____ _  _ ESaLinux联盟
         /  __| ||_|                  ESaLinux联盟
    _   _| |  | | _ ____  _   _  _  _ ESaLinux联盟
   | | | | |  | || |  _ /| | | |/ // / ESaLinux联盟
   | |_| | |__| || | | | | |_| |/    / ESaLinux联盟
   |  ___/____|_||_|_| |_|/____|/_//_/ ESaLinux联盟
   | | ESaLinux联盟
   |_| ESaLinux联盟
ESaLinux联盟
GDB/ARMulator support by <davidm@snapgear.com> ESaLinux联盟
For further information check: ESaLinux联盟
http://www.uclinux.org/ ESaLinux联盟
ESaLinux联盟
Command: /bin/ifconfig eth0 up 10.0.0.2 ESaLinux联盟
Execution Finished, Exiting ESaLinux联盟
ESaLinux联盟
Sash command shell (version 1.1.1) ESaLinux联盟
/> ESaLinux联盟
ESaLinux联盟
在这里面进行以下操作: ESaLinux联盟
代码:
/> cd bin ESaLinux联盟
/bin> ./test ESaLinux联盟
i=0 ESaLinux联盟
Hello,embedded linux! ESaLinux联盟
i=1 ESaLinux联盟
Hello,embedded linux! ESaLinux联盟
i=2 ESaLinux联盟
Hello,embedded linux! ESaLinux联盟
i=3 ESaLinux联盟
Hello,embedded linux! ESaLinux联盟
i=4 ESaLinux联盟
Hello,embedded linux! ESaLinux联盟
i=5 ESaLinux联盟
Hello,embedded linux! ESaLinux联盟
/bin>
ESaLinux联盟
ESaLinux联盟
看到程序在运行了吗? ESaLinux联盟
ESaLinux联盟
五、编译我们的uClinux内核 ESaLinux联盟
ESaLinux联盟
首先解压 ESaLinux联盟
代码:
tar zxvf uClinux-dist-20040408.tar.gz
ESaLinux联盟
这是在你解压的目录里面会生成一个 uClinux-dist目录 ESaLinux联盟
shell 中进 uClinux-dist目录,执行make menuconfig进行配置,我猜你遇到了和我一样的问题: ESaLinux联盟
ESaLinux联盟
代码:
wenwu@wenwu-desktop:/source/uClinux-dist$ make menuconfig ESaLinux联盟
config/mkconfig > config.in ESaLinux联盟
make -C /source/uClinux-dist/config/scripts/lxdialog all ESaLinux联盟
make[1]: Entering directory `/source/uClinux-dist/config/scripts/lxdialog' ESaLinux联盟
/usr/bin/ld: cannot find -lncurses ESaLinux联盟
collect2: ld 返回 1 ESaLinux联盟
-e ESaLinux联盟
>> Unable to find the Ncurses libraries. ESaLinux联盟
>> ESaLinux联盟
>> You must have Ncurses installed in order ESaLinux联盟
>> to use 'make menuconfig' ESaLinux联盟
ESaLinux联盟
make[1]: *** [ncurses] 错误 1 ESaLinux联盟
make[1]: Leaving directory `/source/uClinux-dist/config/scripts/lxdialog' ESaLinux联盟
make: *** [menuconfig] 错误 2 ESaLinux联盟
wenwu@wenwu-desktop:/source/uClinux-dist$
ESaLinux联盟
ESaLinux联盟
其实是没有安装ncurses开发包,安装就是了 ESaLinux联盟
在新立得软件管理器中找到libncurses5-dev,安装 ESaLinux联盟
用的朋友喜欢用make xconfig,直接运行会出现如下错误: ESaLinux联盟
代码:
wenwu@wenwu-desktop:/source/uClinux-dist$ sudo make xconfig ESaLinux联盟
config/mkconfig > config.in ESaLinux联盟
make -C /source/uClinux-dist/config/scripts tkparse ESaLinux联盟
make[1]: Entering directory `/source/uClinux-dist/config/scripts' ESaLinux联盟
make[1]: “tkparse”是最新的。 ESaLinux联盟
make[1]: Leaving directory `/source/uClinux-dist/config/scripts' ESaLinux联盟
ARCH=dummy /source/uClinux-dist/config/scripts/tkparse < config.in > config.tmp ESaLinux联盟
cat /source/uClinux-dist/config/scripts/header.tk >> ./config.tk ESaLinux联盟
cat config.tmp >> config.tk ESaLinux联盟
rm -f config.tmp ESaLinux联盟
echo "set defaults /"/dev/null/"" >> config.tk ESaLinux联盟
echo "set help_file /"config/Configure.help/"" >> config.tk ESaLinux联盟
cat /source/uClinux-dist/config/scripts/tail.tk >> config.tk ESaLinux联盟
chmod 755 config.tk ESaLinux联盟
make: wish:命令未找到 ESaLinux联盟
make: *** [xconfig] 错误 127
ESaLinux联盟
ESaLinux联盟
解决办法是在新立得软件包管理器中找到以下几项并安装,然后再运行make xconfig就可以看到图形界面了。 ESaLinux联盟
tcl8.4 ESaLinux联盟
tcl8.4-dev ESaLinux联盟
tk8.4 ESaLinux联盟
k8.4-dev ESaLinux联盟
ESaLinux联盟
然后再进行配置:在下面这个选项里面选择GDB ARMulator,怎么选择应该不用再说了吧? ESaLinux联盟
代码:
  --- Select the Vendor you wish to target  ESaLinux联盟
   (GDB) Vendor ESaLinux联盟
 --- Select the Product you wish to target ESaLinux联盟
     (ARMulator) GDB Products    ESaLinux联盟
ESaLinux联盟
ESaLinux联盟
Kernel选择2.4内核,Libc Version选择uC-libc ESaLinux联盟
代码:
(linux-2.4.x) Kernel Version  ESaLinux联盟
  (uC-libc) Libc Version          ESaLinux联盟
[ ] Default all settings (lose changes) ESaLinux联盟
[ ] Customize Kernel Settings          ESaLinux联盟
[ ] Customize Vendor/User Settings ESaLinux联盟
[ ] Update Default Vendor Settings   
ESaLinux联盟
退出它会提示: ESaLinux联盟
代码:
ESaLinux联盟
   Do you wish to save your new kernel configuration? ESaLinux联盟
                   < Yes >      <  No  >                            ESaLinux联盟
ESaLinux联盟
选择Yes ESaLinux联盟
这个时候就可以进行编译了,编译首先用make dep ESaLinux联盟
然后用make ESaLinux联盟
很不幸,我们的错误总是不断存在! ESaLinux联盟
ESaLinux联盟
代码:
arm/clone.S: Assembler messages: ESaLinux联盟
arm/clone.S:34: Error: undefined symbol `EINVAL' in operation ESaLinux联盟
make[3]: *** [arm/clone.o] 错误 1 ESaLinux联盟
make[3]: Leaving directory `/source/uClinux-dist/lib/libc/sysdeps' ESaLinux联盟
make[2]: *** [subdirs] 错误 1 ESaLinux联盟
make[2]: Leaving directory `/source/uClinux-dist/lib/libc' ESaLinux联盟
make[1]: *** [all] 错误 2 ESaLinux联盟
make[1]: Leaving directory `/source/uClinux-dist/lib' ESaLinux联盟
make: *** [subdirs] 错误 1
ESaLinux联盟
但有时候,就是因为这些错误使我们不断前行。 ESaLinux联盟
其实很多人都遇到了这个错误 ,是上面的库文件选择错了,什么?错了你还写在上面?我是想让你有更深的记忆! ESaLinux联盟
make clean把上次编译过程生成的中间文件删除 ESaLinux联盟
然后make menuconfig ESaLinux联盟
这次,我们把Libc Version换成uClibc ESaLinux联盟
代码:
(uClibc) Libc Version
ESaLinux联盟
再重复上面的步骤: ESaLinux联盟
代码:
make dep ESaLinux联盟
make
ESaLinux联盟
ESaLinux联盟
这个编译过程比较长,耐心等待。 ESaLinux联盟
编译成功后会在uClinux-dist目录里面生成一个images目录,这个目录里面有四个文件: ESaLinux联盟
image.bin:这是包含内核映像和 romfs文件系统映像,可以写到Flash中的文件, ESaLinux联盟
linux.data:包括内核所有的数据段 ESaLinux联盟
linux.text:包括内核所有的代码段 ESaLinux联盟
romfs.img:文件系统 ESaLinux联盟
另外在uClinux-dist/linux-2.4.x目录里面生成了两个文件:linux和system.map ESaLinux联盟
linux:linux内核文件 ESaLinux联盟
system.map:内核符号表 ESaLinux联盟
ESaLinux联盟
然后在uClinux-dist目录里面建一个skyeye.conf文件,并键入以下配置文件 ESaLinux联盟
代码:
#skyeye config file sample ESaLinux联盟
cpu: arm7tdmi ESaLinux联盟
ESaLinux联盟
mach: at91 ESaLinux联盟
ESaLinux联盟
mem_bank: map=M, type=RW, addr=0x00000000, size=0x00004000 ESaLinux联盟
mem_bank: map=M, type=RW, addr=0x01000000, size=0x00400000 ESaLinux联盟
mem_bank: map=M, type=R,  addr=0x01400000, size=0x00400000, file=./boot.rom ESaLinux联盟
mem_bank: map=M, type=RW, addr=0x02000000, size=0x00400000 ESaLinux联盟
mem_bank: map=M, type=RW, addr=0x02400000, size=0x00008000 ESaLinux联盟
mem_bank: map=M, type=RW, addr=0x04000000, size=0x00400000 ESaLinux联盟
mem_bank: map=I, type=RW, addr=0xf0000000, size=0x10000000
ESaLinux联盟
注意这个配置文件中需要boot.rom 文件系统,但是我们并没有生成boot.rom文件系统,怎么办? ESaLinux联盟
ln -s images/romfs.img boot.rom ESaLinux联盟
代码:
wenwu@wenwu-desktop:/source/uClinux-dist$ ln -s images/romfs.img boot.rom
ESaLinux联盟
这是就可以在uClinux-dist 目录里面看到boot.rom这个文件 ESaLinux联盟
下面就可以用skyeye运行我们自己编译出来的内核了。 ESaLinux联盟
代码:
wenwu@wenwu-desktop:/source/uClinux-dist$ skyeye -e linux-2.4.x/linux ESaLinux联盟
big_endian is false. ESaLinux联盟
arch: arm ESaLinux联盟
cpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0 ESaLinux联盟
mach info: name at91, mach_init addr 0x8057550 ESaLinux联盟
uart_mod:0, desc_in:, desc_out:, converter: ESaLinux联盟
SKYEYE: use arm7100 mmu ops ESaLinux联盟
Loaded ROM   ./boot.rom ESaLinux联盟
start addr is set to 0x01000000 by exec file. ESaLinux联盟
Linux version 2.4.24-uc0 (wenwu@wenwu-desktop) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(uClinux XIP and shared lib patches from http://www.snapgear.com/)) #2 2007年 11月 11日 星期日 16:21:16 CST ESaLinux联盟
Processor: Atmel AT91M40xxx revision 0 ESaLinux联盟
Architecture: EB01 ESaLinux联盟
On node 0 totalpages: 1024 ESaLinux联盟
zone(0): 0 pages. ESaLinux联盟
zone(1): 1024 pages. ESaLinux联盟
zone(2): 0 pages. ESaLinux联盟
Kernel command line: root=/dev/rom0 ESaLinux联盟
Calibrating delay loop... 15.82 BogoMIPS ESaLinux联盟
Memory: 4MB = 4MB total ESaLinux联盟
Memory: 2968KB available (850K code, 180K data, 40K init) ESaLinux联盟
Dentry cache hash table entries: 512 (order: 0, 4096 bytes) ESaLinux联盟
Inode cache hash table entries: 512 (order: 0, 4096 bytes) ESaLinux联盟
Mount cache hash table entries: 512 (order: 0, 4096 bytes) ESaLinux联盟
Buffer cache hash table entries: 1024 (order: 0, 4096 bytes) ESaLinux联盟
Page-cache hash table entries: 1024 (order: 0, 4096 bytes) ESaLinux联盟
POSIX conformance testing by UNIFIX ESaLinux联盟
Linux NET4.0 for Linux 2.4 ESaLinux联盟
Based upon Swansea University Computer Society NET3.039 ESaLinux联盟
Initializing RT netlink socket ESaLinux联盟
Starting kswapd ESaLinux联盟
Atmel USART driver version 0.99 ESaLinux联盟
ttyS0 at 0xfffd0000 (irq = 2) is a builtin Atmel APB USART ESaLinux联盟
ttyS1 at 0xfffcc000 (irq = 3) is a builtin Atmel APB USART ESaLinux联盟
Blkmem copyright 1998,1999 D. Jeff Dionne ESaLinux联盟
Blkmem copyright 1998 Kenneth Albanowski ESaLinux联盟
Blkmem 1 disk images: ESaLinux联盟
0: 1400000-14AC3FF [VIRTUAL 1400000-14AC3FF] (RO) ESaLinux联盟
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize ESaLinux联盟
NET4: Linux TCP/IP 1.0 for NET4.0 ESaLinux联盟
IP Protocols: ICMP, UDP, TCP ESaLinux联盟
IP: routing cache hash table of 512 buckets, 4Kbytes ESaLinux联盟
TCP: Hash tables configured (established 512 bind 512) ESaLinux联盟
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0. ESaLinux联盟
VFS: Mounted root (romfs filesystem) readonly. ESaLinux联盟
Shell invoked to run file: /etc/rc ESaLinux联盟
Command: hostname GDB-ARMulator ESaLinux联盟
Command: /bin/expand /etc/ramfs.img /dev/ram0 ESaLinux联盟
Command: mount -t proc proc /proc ESaLinux联盟
Command: mount -t ext2 /dev/ram0 /var ESaLinux联盟
Command: mkdir /var/tmp ESaLinux联盟
Command: mkdir /var/log ESaLinux联盟
Command: mkdir /var/run ESaLinux联盟
Command: mkdir /var/lock ESaLinux联盟
Command: mkdir /var/empty ESaLinux联盟
Command: cat /etc/motd ESaLinux联盟
Welcome to ESaLinux联盟
          ____ _  _ ESaLinux联盟
         /  __| ||_|                  ESaLinux联盟
    _   _| |  | | _ ____  _   _  _  _ ESaLinux联盟
   | | | | |  | || |  _ /| | | |/ // / ESaLinux联盟
   | |_| | |__| || | | | | |_| |/    / ESaLinux联盟
   |  ___/____|_||_|_| |_|/____|/_//_/ ESaLinux联盟
   | | ESaLinux联盟
   |_| ESaLinux联盟
ESaLinux联盟
GDB/ARMulator support by <davidm@snapgear.com> ESaLinux联盟
For further information check: ESaLinux联盟
http://www.uclinux.org/ ESaLinux联盟
ESaLinux联盟
Execution Finished, Exiting ESaLinux联盟
ESaLinux联盟
Sash command shell (version 1.1.1) ESaLinux联盟
/>
x86-64使用Ubuntu进行汇编语言编程x86-64 Assembly Language Programming with Ubuntu 本文为大学水平的汇编语言系统编程课程提供了参考。 具体来说,它使用Ubuntu 64位操作系统(OS)解决了流行的x86-64类处理器的x86-64指令集。 立即下载

相关推荐

ubuntu建立交叉编译环境skyeye

文章来源:http://blog.chinaunix.net/u1/56796/showart_441612.html 一、搭开发环境 在www.uclinux.org上下载以下两个包: 交叉开发工具:arm-elf-tools-20040427.sh uClinux的源码包:uClinux-dist-20040408.tar.gz 好像现在arm-elf-tools-20040427.

嵌入式开发小站 1291

VMware+Ubuntu8.10+Skyeye+gdb实现u-boot源码调试

VMware+Ubuntu8.10+Skyeye+gdb实现u-boot源码调试 系统平台WindowsXP 虚拟机VMware Workstation 6.5.0 Ubuntu8.10安装程序ubuntu-8.10-desktop-i386.iso 下载地址:http://mirror.ylmf.net/ubuntu/8.10/ubuntu-8.10-desktop-i386.iso

未来软件 1465

ubuntu7.10上搭uClinux编译开发环境并用Skyeye进行仿真(嵌入)

 转自  ubuntu 开源社区 ,作者 --by wenwu   。非常感谢。http://forum.ubuntu.org.cn/viewtopic.php?t=88369 唉,由于本人经费有限,实在拿不出钱去买块750的开发板子。没办法啊。一、搭开发环境 在www.uclinux.org上下载以下两个包: 交叉开发工具:arm-elf-tools-20040427.sh u

#include"stdio.h" 1170

以NFS启动方式构arm-linux仿真运行环境

一 其实在 skyeye 上移植 arm-linux 并非难事,网上也有不少资料, 只是大都遗漏细节, 以致细微之处卡壳,所以本文力求详实清析, 希望能对大家有点用处。本文旨在将 arm-linuxskyeye 上搭起来,并在 arm-linux 上能成功 mount NFS 为目标, 最终我们能在 arm-linux 里运行我们自己的应用程序. 二 安装 Sky...

weixin_33724659的博客 241

ubuntu 8.04中skyeye仿真项目的开发环境建立

网上流传很多文章,但大多数重复杂乱。致使我浪费了好多时时间。为此,记录我整个安装过程,一来方便自已,二来方便大家。好了,不罗嗦了,正文开始:1.在ubuntu中安装skyeye最简单不过,一个命令搞定:  sudo apt-get install skyey安装完成后运行skeye,显示如下:*********************

嵌入式Linux开发@Python学习 1190

手把手教你北邮操作系统小学期实验三——ARM/ucLinux-SkyEye的安装,配置与集成1

1.实验环境: 硬件:Intel i5 操作系统:Windows 8.1 虚拟机:VMware Workstation 12.5.0 软件:Ubuntu-14.0.5 (gcc 4.4) 2.实验目的: 安装SkyEye嵌入式硬件模拟器,配置嵌入式操作系统ucLinux,...

对方正在输入中... 1036

基于SkyEye的uCLinux交叉编译环境的搭

1.1简介SkyEye是一个开源软件,目标是在通用的LinuxWindows平台上实现一个纯软件集成开发环境,模拟常见的嵌入式计算机系统。可以在SkyEye上运行Linux/uClinux以及uC/OS-II等多种嵌入式操作系统各种系统软件(如TCP/IP协议栈,图形子系统,文件子系统),并课对他们进行源码级的分析测试。SkyEye可以模拟的主要是基于ARM内核的CPU,如ARM7,

w&health 的专栏 796

arm仿真器Skyeye的安装及使用

SkyEye是一个开源软件(OpenSource Software)项目,中文名字是"天目"。SkyEye的目标是在通用的LinuxWindows平台上实现一个纯软件集成开发环境,模拟常见的嵌入式系统,可在SkyEye上运行μCLinux以及μC/OS-II等,以及各种系统软件(如TCP/IP,图形子系统,文件子系统等),并可对它们进行源码级的分析测试。 目前SkyEye可以模拟...

系统运维 282

嵌入式调试环境建立Skyeye

        在嵌入式开发中少不了的就是交叉调试,以前自己在宿舍在ARM的开发板因此也没有想过用skyeye来模拟运行过程,无奈最过板子被拿走了,只好用一下这个模拟的东东来解一解瘾,下面是我的安装过程:       1.   首先到http://gro.clinux.org/frs/?group_id=327&release_id=1424中下载一个安装包,安装过程不是很麻烦,但是却也没有那么

林大虫子的专栏 1750

ARM仿真器SkyEye的安装及使用

SkyEye是一个开源软件(OpenSource Software)项目,中文名字是"天目"。SkyEye的目标是在通用的LinuxWindows平台上实现一个纯软件集成开发环境,模拟常见的嵌入式系统,可在SkyEye上运行μCLinux以及μC/OS-II等,以及各种系统软件(如TCP/IP,图形子系统,文件子系统等),并可对它们进行源码级的分析测试。 目前SkyEye可以模拟的CPU

autumn20080101的专栏 1071

Linux SkyEye安装交叉编译

<br />Linux SkyEye对于电脑使用的玩家的常用软件,然后我就学习及深入的研究Linux SkyEye,在这里大家一起探讨Linux SkyEye的使用方法,希望对大家有用。Linux SkyEye是一个可以运行嵌入式操作系统的硬件仿真工具,这样就可以在没有硬件条件下来进行嵌入式系统的开发。<br />以下操作均在Fedora Core 1.0里通过。Linux SkyEye项目资源列表http://gro.clinux.org/projects/Linux SkyEye/<br />

jianqi2010的专栏 795

【LTP-open_posix_testsuite用例分析】mmap/1-1

简介 mmap用于在文件内存间建立一种映射。 该用例主要用户检查映射的正确性 用例思路分析 创一个临时文件,向里面写入内容x 然后映射该文件到内存 检查内存里是否是刚才写入文件的内容 源码分析 * * Test Steps: * 1. Create a tmp file; * 2. mmap it to memory using mmap(); * */ 这里说明了测试步骤 1、创一个临时文件 2、调用mmap将它映射到内存 int main(void) { char tmpfname[

velscode 1260

开源代码交叉编译操作流程及遇到的问题解决(lightdm)

如何快速在X86本机上交叉编译 ARM、MIPS等目标架构的开源代码库,尤其是开源代码依赖众多底层库时。

跑不了的你的博客 1765

Ubuntu QT 交叉编译环境(超级详细)

完整编译Qt源码指的是在Qt源码路径下进行编译,使用configure对Qt进行编译配置时指定需要编译的模块

邮箱songtimi@foxmail.com 7457

测试交叉编译环境arm-elf-tools-20040427.sh安装是否成功

检验一下:          [root@localhost uclinux]# which arm-elf-gcc         /usr/local/bin/arm-elf-gcc   [root@localhost bluesea]# arm-elf-gcc   arm-elf-gcc: No input files   编写实验程序(国际惯例hell

fengpan2004的专栏 1840

linux skyeye,在Ubuntu 10.04上安装SkyEye及测试

说明一下,在Ubuntu 10.04上安装SkyEye方法不是原创,是来自互联网,仅供学习参考。1.检查支持软件包gcc,make,vim(optional),ssh,subversionbinutils-dev (bfd)atk-dev (libatk1.0-dev)gtk+-2.0-dev (libgtk2.0-dev)pkg-configpango-dev (libpango1.0-dev)...

weixin_35058762的博客 368

arm下uclinux程序编译(elf2flt)

arm-elf-gcc -o test_e test.c -elf2fltBFLT executable - version 4 ramelf[exective linked file]: 一种为Linux系统所采用的通用文件格式,支持动态链接重定位。  flat:扁平格式。elf文件有很大的头文件,flat格式对文件头一些段信息做了简化,可执行程序小,适于嵌入式系统。 elf2flt就是将e...

weixin_33816946的博客 234

ubuntu交叉编译环境

安装 g+±aarch64-linux-gnu 交叉编译器 $sudo apt install g++-aarch64-linux-gnu #安装 $aarch64-linux-gnu-g++ -v #查看默认安装的gcc版本 $sudo apt install cmake-gui #安装 cmake-gui 有些需要选择性编译的库使用较方便 编译如果不成功, 把源码删除,终端重新打开,重新编译。 如果源码不支持cmake, 则可以使用下面方式 在源码中打开终端输入一下命令行 $export CC=/

叶海 4448
上一篇: 手把手教你把Vim改装成一个IDE编程环境(图文)
下一篇: ubuntu 启动GNOME设置守护进程时出错 解决办法
Linux先生
博客等级 码龄20年 97粉丝 43原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值