logo资料库

hello world on uClinux&& skyeye.pdf

第1页 / 共4页
第2页 / 共4页
第3页 / 共4页
第4页 / 共4页
资料共4页,全文预览结束
uClinux的配置与编译
uClinux 的配置与编译 1、下载并解压缩: uClinux-dist-20080808.tar.bz2 arm-linux-tools-20061213.tar.gz 2、设置编译路径: 可以临时指定路径,如 进入/uClinux-dist 如;export PATH=/home/hdm/linux/soft/usr/local/bin:$PATH 然后:使用 echo $PATH 查看确认即可 文件后,使用命令: 3、make menuconfig (需要从新立得安装 libncurses5-dev 才能支持 menuconfig) 定制 Kernel,选择 Vendor/Product: GDB/ARMulator Kernel Version: linux-2.6.x 或者 linux-2.4.x Libc Version: uClibc 保存退出 内容如下: 配置文件 skyeye.conf, 在 uclinux-dist 目录下建立仿真 AT91 的 skyeye #//-----skyeye.conf----- cpu: arm7tdmi mach: at91 mem_bank: map=M, type=RW, addr=0x00000000, size=0x00004000 mem_bank: map=M, type=RW, addr=0x01000000, size=0x00400000 mem_bank: map=M, type=R, addr=0x01400000, size=0x00400000, file=images/boot.rom mem_bank: map=M, type=RW, addr=0x02000000, size=0x00400000 mem_bank: map=M, type=RW, addr=0x02400000, size=0x00008000 mem_bank: map=M, type=RW, addr=0x04000000, size=0x00400000 mem_bank: map=I, type=RW, addr=0xf0000000, size=0x10000000 lcd: state=on #//-----end of skyeye.conf----- 4、make dep(linux-2.6.x 不需要这一步) 5、make,如下图所示:
linux-2.4.x linux-2.6.x 6、在 skyeye 下运行 uClinux 这个时候就可以用 skyeye 来调试运行 kernel 了,在 uclinux-dist 执行如下命令: skyeye -e linux-2.6.x/linux 需要注意的是我已经在/usr/bin 目录中建立了一个 skyeye 的符号连接,所以上面 才不需要输入 skyeye 的完整路径。另外,由于 skyeye.conf 就在当前目录下,所以 也就不用在 skyeye 命令中使用-c 参数指定了,skyeye 启动顺序如下: 找到/linux-2.6.x 中的 linux 映像,通过 skyeye.conf 找到/images/boot.rom,读取配置信 息,启动 linux 映像。如果还要执行应用程序,则还要找到/romfs/bin 目录下。 下面是 uClinux 跑起来的界面显示:
7 、这里,我们再测试一下一个 hello world 。相应的代码和 Makefile 文件如下: uClinux-dist/user/hello/hello.c: #include int main(void) { printf("hello world!My name is hdm-linux\n"); return 0; } uClinux-dist/user/hello/Makefile: EXEC = hello OBJS = hello.o all: $(EXEC) $(EXEC): $(OBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS) romfs: $(ROMFSINST) /bin/$(EXEC) clean: -rm -f $(EXEC) *.elf *.gdb *.o
uClinux-dist/user/Makefile : Add a line to the file like dir_$(CONFIG_USER_HELLO_HELLO) += hello I added mine in alphabetical order. The order doesn't seem to matter. uClinux-dist/user/Kconfig: Add lines to the file like config USER_FOO_FOO bool "foo" help make menuconfig uClinux-dist to build "GDB/ARMulator" selecting to use a linux-2.6.x kernel, and selected the new "hello" program for inclusion as well make 之后,我们便可在 uClinux-dist/romfs/bin 中找到可执行文件 hello 8、from the command line I run "hello": /> hello hello world!My name is hdm-linux 因水平有限,如有不妥之处或者更好的方法,敬请指出。hdm125@126.com dianming_hu 2009-3-19
分享到:
收藏