標籤:

uClinux-dist-20040408 skyeye 模擬

一、環境信息

宿主機 :Ubuntu 16.04

源碼:uClinux-dist-20040408.tar.gz

交叉編譯工具:arm-elf-tools-20040427.sh

skyeye :skyeye-1.2.5

二、編譯配置 uClinux

解壓 uClinux-dist-20040408.tar.gz 並進入 uClinux-dist 目錄,命令行下輸入

make xconfig

vendor/product selection 選擇 GDB ARMulator

kernel/library/defaults delection 選擇 linux-2.4.x uClibc 其它默認

輸入

make depmake

彈出錯誤,錯誤信息如下

Makefile:251: *** mixed implicit and normal rules: deprecated syntaxmake ARCH=armnommu CROSS_COMPILE=arm-elf- -C linux-2.4.x || exit 1make[1]: Entering directory /home/song/workspace/uClinux-dist/linux-2.4.xmake[1]: arm-elf-gcc:命令未找到unset GCC_EXEC_PREFIX; gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -o scripts/split-include scripts/split-include.cscripts/split-include.c: In function 『main』:scripts/split-include.c:133:6: warning: ignoring return value of 『fgets』, declared with attribute warn_unused_result [-Wunused-result] fgets(old_line, buffer_size, fp_target); ^scripts/split-include include/linux/autoconf.h include/configarm-elf-gcc -D__KERNEL__ -I/home/song/workspace/uClinux-dist/linux-2.4.x/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fno-common -pipe -fno-builtin -D__linux__ -g -DNO_MM -mapcs-32 -march=armv4 -mtune=arm7tdmi -mshort-load-bytes -msoft-float -DKBUILD_BASENAME=main -c -o init/main.o init/main.cmake[1]: arm-elf-gcc:命令未找到Makefile:420: recipe for target init/main.o failedmake[1]: *** [init/main.o] Error 127make[1]: Leaving directory /home/song/workspace/uClinux-dist/linux-2.4.xMakefile:252: recipe for target linux failedmake: *** [linux] Error 1

打開 uClinux-dist 目錄 下的 makefile 找到 251 行,原來是舊版本的make 規則,新版本不支持,

這是原來的

linux linux%_only: @if [ $(LINUXDIR) != linux-2.5.x -a $(LINUXDIR) != linux-2.6.x -a ! -f $(LINUXDIR)/.depend ] ; then echo "ERROR: you need to do a make dep first" ; exit 1 ; fi $(MAKEARCH_KERNEL) -C $(LINUXDIR) $(LINUXTARGET) || exit 1 if [ -f $(LINUXDIR)/vmlinux ]; then ln -f $(LINUXDIR)/vmlinux $(LINUXDIR)/linux ; fi

這是更改之後的

linux: @if [ $(LINUXDIR) != linux-2.5.x -a $(LINUXDIR) != linux-2.6.x -a ! -f $(LINUXDIR)/.depend ] ; then echo "ERROR: you need to do a make dep first" ; exit 1 ; fi $(MAKEARCH_KERNEL) -C $(LINUXDIR) $(LINUXTARGET) || exit 1 if [ -f $(LINUXDIR)/vmlinux ]; then ln -f $(LINUXDIR)/vmlinux $(LINUXDIR)/linux ; fi%_only: @if [ $(LINUXDIR) != linux-2.5.x -a $(LINUXDIR) != linux-2.6.x -a ! -f $(LINUXDIR)/.depend ] ; then echo "ERROR: you need to do a make dep first" ; exit 1 ; fi $(MAKEARCH_KERNEL) -C $(LINUXDIR) $(LINUXTARGET) || exit 1 if [ -f $(LINUXDIR)/vmlinux ]; then ln -f $(LINUXDIR)/vmlinux $(LINUXDIR)/linux ; fi

再次輸入 make ,又出現錯誤

make ARCH=armnommu CROSS_COMPILE=arm-elf- -C linux-2.4.x || exit 1make[1]: Entering directory /home/song/workspace/uClinux-dist/linux-2.4.xmake[1]: arm-elf-gcc:命令未找到arm-elf-gcc -D__KERNEL__ -I/home/song/workspace/uClinux-dist/linux-2.4.x/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fno-common -pipe -fno-builtin -D__linux__ -g -DNO_MM -mapcs-32 -march=armv4 -mtune=arm7tdmi -mshort-load-bytes -msoft-float -DKBUILD_BASENAME=main -c -o init/main.o init/main.cmake[1]: arm-elf-gcc:命令未找到Makefile:420: recipe for target init/main.o failedmake[1]: *** [init/main.o] Error 127make[1]: Leaving directory /home/song/workspace/uClinux-dist/linux-2.4.xMakefile:253: recipe for target linux failedmake: *** [linux] Error 1

但是我們確實已經裝上 arm-elf- 交叉編譯工具了啊,為什麼提示找不到?

這次是一個八竿子打不著的原因,經常在ubuntu 64位下運行 ./xxx 會跳出來說沒有這個文件或者目錄,但是ls看又有這個文件,很是奇怪。

其實原因很簡單,是因為他沒有32位的運行庫

輸入 apt-get install lib32ncurses5 lib32z1 安裝上就好了

在輸入 arm-elf-gcc -v

song@song:~/workspace$ arm-elf-gcc -vReading specs from /usr/local/lib/gcc-lib/arm-elf/2.95.3/specsgcc 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/)

出現正確信息

再次,輸入 make,等待一會,又出現一個錯誤,唉問題就是這麼多,慢慢找,

In file included from dma.c:23:/home/song/workspace/uClinux-dist/linux-2.4.x/include/asm/mach/dma.h:53: warning: useless keyword or type name in empty declaration/home/song/workspace/uClinux-dist/linux-2.4.x/include/asm/mach/dma.h:53: warning: empty declarationarm-elf-gcc -D__ASSEMBLY__ -D__KERNEL__ -I/home/song/workspace/uClinux-dist/linux-2.4.x/include -DNO_MM -mapcs-32 -march=armv4 -msoft-float -mno-fpu -c -o entry-armv.o entry-armv.Sentry-armv.S: Assembler messages:entry-armv.S:1060: 警告: destination register same as write-back baseentry-armv.S:1283: 錯誤: internal_relocation (type: OFFSET_IMM) not fixed upentry-armv.S:1336: 錯誤: internal_relocation (type: OFFSET_IMM) not fixed upentry-armv.S:1337: 錯誤: internal_relocation (type: OFFSET_IMM) not fixed upentry-armv.S:1608: 錯誤: cannot represent SWI relocation in this object file format/home/song/workspace/uClinux-dist/linux-2.4.x/Rules.make:80: recipe for target entry-armv.o failedmake[2]: *** [entry-armv.o] Error 1make[2]: Leaving directory /home/song/workspace/uClinux-dist/linux-2.4.x/arch/armnommu/kernelMakefile:376: recipe for target _dir_arch/armnommu/kernel failedmake[1]: *** [_dir_arch/armnommu/kernel] Error 2make[1]: Leaving directory /home/song/workspace/uClinux-dist/linux-2.4.xMakefile:253: recipe for target linux failedmake: *** [linux] Error 1

原來是 沒有清理

試著輸入

make clean make distclean

就好了 成功信息是,

[ -d /home/song/workspace/uClinux-dist/images ] || mkdir /home/song/workspace/uClinux-dist/imagesmake ARCH=armnommu CROSS_COMPILE=arm-elf- -C /home/song/workspace/uClinux-dist/vendors/GDB/ARMulator/. imagemake[1]: Entering directory /home/song/workspace/uClinux-dist/vendors/GDB/ARMulator[ -d /home/song/workspace/uClinux-dist/images ] || mkdir -p /home/song/workspace/uClinux-dist/imagesgenromfs -v -V "ROMdisk" -f /home/song/workspace/uClinux-dist/images/romfs.img -d /home/song/workspace/uClinux-dist/romfs0 ROMdisk [0xffffffff, 0xffffffff] 37777777777, sz 0, at 0x0 1 . [0x808 , 0x221e70 ] 0040775, sz 0, at 0x20 1 .. [0x808 , 0x15f979 ] 0040755, sz 0, at 0x40 [link to 0x20 ]1 tmp [0x808 , 0x221eb7 ] 0120777, sz 8, at 0x60 1 lib [0x808 , 0x221e76 ] 0040775, sz 0, at 0x90 2 . [0x808 , 0x221e76 ] 0040775, sz 0, at 0xb0 [link to 0x90 ]2 .. [0x808 , 0x221e70 ] 0040775, sz 0, at 0xd0 [link to 0x20 ]1 mnt [0x808 , 0x221e77 ] 0040775, sz 0, at 0xf0 2 . [0x808 , 0x221e77 ] 0040775, sz 0, at 0x110 [link to 0xf0 ]2 .. [0x808 , 0x221e70 ] 0040775, sz 0, at 0x130 [link to 0x20 ]1 home [0x808 , 0x221e75 ] 0040775, sz 0, at 0x150 2 . [0x808 , 0x221e75 ] 0040775, sz 0, at 0x170 [link to 0x150 ]2 .. [0x808 , 0x221e70 ] 0040775, sz 0, at 0x190 [link to 0x20 ]1 bin [0x808 , 0x221e72 ] 0040775, sz 0, at 0x1b0 2 reboot [0x808 , 0x221ecb ] 0100744, sz 34280, at 0x1d0 2 inetd [0x808 , 0x221ec3 ] 0100744, sz 41144, at 0x87e0 2 init [0x808 , 0x221ec6 ] 0100744, sz 31320, at 0x128c0 2 dhcpcd [0x808 , 0x221ec1 ] 0100744, sz 91104, at 0x1a340 2 mount [0x808 , 0x221ec0 ] 0100744, sz 62868, at 0x30740 2 telnetd [0x808 , 0x221ecc ] 0100744, sz 51216, at 0x3fd00 2 ping [0x808 , 0x221ec8 ] 0100744, sz 64656, at 0x4c530 2 busybox [0x808 , 0x221ec0 ] 0100744, sz 0, at 0x5c1e0 [link to 0x30740 ]2 expand [0x808 , 0x221ec5 ] 0100744, sz 29624, at 0x5c200 2 . [0x808 , 0x221e72 ] 0040775, sz 0, at 0x635e0 [link to 0x1b0 ]2 sh [0x808 , 0x221eca ] 0100744, sz 79852, at 0x63600 2 boa [0x808 , 0x221ebf ] 0100744, sz 105980, at 0x76e10 2 umount [0x808 , 0x221ec0 ] 0100744, sz 0, at 0x90c30 [link to 0x30740 ]2 ifconfig [0x808 , 0x221ec0 ] 0100744, sz 0, at 0x90c50 [link to 0x30740 ]2 login [0x808 , 0x221ec7 ] 0100744, sz 56380, at 0x90c70 2 gdbserver [0x808 , 0x221ec2 ] 0100744, sz 40504, at 0x9e8d0 2 .. [0x808 , 0x221e70 ] 0040775, sz 0, at 0xa8730 [link to 0x20 ]2 route [0x808 , 0x221ec0 ] 0100744, sz 0, at 0xa8750 [link to 0x30740 ]1 proc [0x808 , 0x221e78 ] 0040775, sz 0, at 0xa8770 2 . [0x808 , 0x221e78 ] 0040775, sz 0, at 0xa8790 [link to 0xa8770 ]2 .. [0x808 , 0x221e70 ] 0040775, sz 0, at 0xa87b0 [link to 0x20 ]1 usr [0x808 , 0x221e79 ] 0040775, sz 0, at 0xa87d0 2 . [0x808 , 0x221e79 ] 0040775, sz 0, at 0xa87f0 [link to 0xa87d0 ]2 .. [0x808 , 0x221e70 ] 0040775, sz 0, at 0xa8810 [link to 0x20 ]1 dev [0x808 , 0x221e73 ] 0040775, sz 0, at 0xa8830 2 rom7 [0x808 , 0x221e9b ] 0060664, sz 0, at 0xa8850 2 ram0 [0x808 , 0x221e82 ] 0060664, sz 0, at 0xa8870 2 ptyp9 [0x808 , 0x221e8d ] 0020664, sz 0, at 0xa8890 2 null [0x808 , 0x221e81 ] 0020664, sz 0, at 0xa88b0 2 mem [0x808 , 0x221e7f ] 0020664, sz 0, at 0xa88d0 2 ttyp0 [0x808 , 0x221ea4 ] 0020664, sz 0, at 0xa88f0 2 ptyp2 [0x808 , 0x221e86 ] 0020664, sz 0, at 0xa8910 2 ptyp6 [0x808 , 0x221e8a ] 0020664, sz 0, at 0xa8930 2 ptypd [0x808 , 0x221e91 ] 0020664, sz 0, at 0xa8950 2 rom8 [0x808 , 0x221e9c ] 0060664, sz 0, at 0xa8970 2 ttyp9 [0x808 , 0x221ead ] 0020664, sz 0, at 0xa8990 2 ttyp7 [0x808 , 0x221eab ] 0020664, sz 0, at 0xa89b0 2 cua1 [0x808 , 0x221e7e ] 0020664, sz 0, at 0xa89d0 2 ttype [0x808 , 0x221eb2 ] 0020664, sz 0, at 0xa89f0 2 ttypa [0x808 , 0x221eae ] 0020664, sz 0, at 0xa8a10 2 tty [0x808 , 0x221e7b ] 0020664, sz 0, at 0xa8a30 2 ttyp8 [0x808 , 0x221eac ] 0020664, sz 0, at 0xa8a50 2 ptyp0 [0x808 , 0x221e84 ] 0020664, sz 0, at 0xa8a70 2 rom5 [0x808 , 0x221e99 ] 0060664, sz 0, at 0xa8a90 2 rom1 [0x808 , 0x221e95 ] 0060664, sz 0, at 0xa8ab0 2 ttyS0 [0x808 , 0x221ea2 ] 0020664, sz 0, at 0xa8ad0 2 tty0 [0x808 , 0x221e9e ] 0020664, sz 0, at 0xa8af0 2 ptypf [0x808 , 0x221e93 ] 0020664, sz 0, at 0xa8b10 2 ttyp6 [0x808 , 0x221eaa ] 0020664, sz 0, at 0xa8b30 2 ttyp1 [0x808 , 0x221ea5 ] 0020664, sz 0, at 0xa8b50 2 ttypd [0x808 , 0x221eb1 ] 0020664, sz 0, at 0xa8b70 2 ptyp3 [0x808 , 0x221e87 ] 0020664, sz 0, at 0xa8b90 2 ptypc [0x808 , 0x221e90 ] 0020664, sz 0, at 0xa8bb0 2 . [0x808 , 0x221e73 ] 0040775, sz 0, at 0xa8bd0 [link to 0xa8830 ]2 ptyp1 [0x808 , 0x221e85 ] 0020664, sz 0, at 0xa8bf0 2 tty3 [0x808 , 0x221ea1 ] 0020664, sz 0, at 0xa8c10 2 ptyp7 [0x808 , 0x221e8b ] 0020664, sz 0, at 0xa8c30 2 ttyp3 [0x808 , 0x221ea7 ] 0020664, sz 0, at 0xa8c50 2 ttyp4 [0x808 , 0x221ea8 ] 0020664, sz 0, at 0xa8c70 2 urandom [0x808 , 0x221eb6 ] 0020664, sz 0, at 0xa8c90 2 ttypf [0x808 , 0x221eb3 ] 0020664, sz 0, at 0xa8cb0 2 ttyp5 [0x808 , 0x221ea9 ] 0020664, sz 0, at 0xa8cd0 2 ptyp4 [0x808 , 0x221e88 ] 0020664, sz 0, at 0xa8cf0 2 rom4 [0x808 , 0x221e98 ] 0060664, sz 0, at 0xa8d10 2 ram1 [0x808 , 0x221e83 ] 0060664, sz 0, at 0xa8d30 2 random [0x808 , 0x221eb5 ] 0020664, sz 0, at 0xa8d50 2 rom2 [0x808 , 0x221e96 ] 0060664, sz 0, at 0xa8d70 2 rom0 [0x808 , 0x221e94 ] 0060664, sz 0, at 0xa8d90 2 rom6 [0x808 , 0x221e9a ] 0060664, sz 0, at 0xa8db0 2 rom3 [0x808 , 0x221e97 ] 0060664, sz 0, at 0xa8dd0 2 ptyp8 [0x808 , 0x221e8c ] 0020664, sz 0, at 0xa8df0 2 ptype [0x808 , 0x221e92 ] 0020664, sz 0, at 0xa8e10 2 ttypc [0x808 , 0x221eb0 ] 0020664, sz 0, at 0xa8e30 2 ttyp2 [0x808 , 0x221ea6 ] 0020664, sz 0, at 0xa8e50 2 ttypb [0x808 , 0x221eaf ] 0020664, sz 0, at 0xa8e70 2 ttyS1 [0x808 , 0x221ea3 ] 0020664, sz 0, at 0xa8e90 2 zero [0x808 , 0x221eb4 ] 0020664, sz 0, at 0xa8eb0 2 cua0 [0x808 , 0x221e7d ] 0020664, sz 0, at 0xa8ed0 2 tty1 [0x808 , 0x221e9f ] 0020664, sz 0, at 0xa8ef0 2 ptyp5 [0x808 , 0x221e89 ] 0020664, sz 0, at 0xa8f10 2 .. [0x808 , 0x221e70 ] 0040775, sz 0, at 0xa8f30 [link to 0x20 ]2 kmem [0x808 , 0x221e80 ] 0020664, sz 0, at 0xa8f50 2 ptypa [0x808 , 0x221e8e ] 0020664, sz 0, at 0xa8f70 2 rom9 [0x808 , 0x221e9d ] 0060664, sz 0, at 0xa8f90 2 tty2 [0x808 , 0x221ea0 ] 0020664, sz 0, at 0xa8fb0 2 ptypb [0x808 , 0x221e8f ] 0020664, sz 0, at 0xa8fd0 2 console [0x808 , 0x221e7c ] 0020664, sz 0, at 0xa8ff0 1 var [0x808 , 0x221e7a ] 0040775, sz 0, at 0xa9010 2 . [0x808 , 0x221e7a ] 0040775, sz 0, at 0xa9030 [link to 0xa9010 ]2 .. [0x808 , 0x221e70 ] 0040775, sz 0, at 0xa9050 [link to 0x20 ]1 etc [0x808 , 0x221e74 ] 0040775, sz 0, at 0xa9070 2 version [0x808 , 0x221ebe ] 0100664, sz 75, at 0xa9090 2 . [0x808 , 0x221e74 ] 0040775, sz 0, at 0xa9100 [link to 0xa9070 ]2 services [0x808 , 0x221ebb ] 0100644, sz 8205, at 0xa9120 2 inittab [0x808 , 0x221eba ] 0100644, sz 49, at 0xab150 2 passwd [0x808 , 0x221ebd ] 0100644, sz 21, at 0xab1b0 2 motd [0x808 , 0x221ebc ] 0100644, sz 343, at 0xab1f0 2 .. [0x808 , 0x221e70 ] 0040775, sz 0, at 0xab370 [link to 0x20 ]2 ramfs.img [0x808 , 0x221ec9 ] 0100644, sz 2874, at 0xab390 2 rc [0x808 , 0x221eb9 ] 0100644, sz 207, at 0xabef0 2 inetd.conf [0x808 , 0x221ec4 ] 0100664, sz 44, at 0xabfe0 1 sbin [0x808 , 0x221eb8 ] 0120777, sz 4, at 0xac030 arm-elf-objcopy -O binary --remove-section=.romvec --remove-section=.text --remove-section=.ramvec --remove-section=.init --remove-section=.bss --remove-section=.eram /home/song/workspace/uClinux-dist/linux-2.4.x/linux /home/song/workspace/uClinux-dist/images/linux.dataarm-elf-objcopy -O binary --remove-section=.ramvec --remove-section=.bss --remove-section=.data --remove-section=.eram --set-section-flags=.romvec=CONTENTS,ALLOC,LOAD,READONLY,CODE /home/song/workspace/uClinux-dist/linux-2.4.x/linux /home/song/workspace/uClinux-dist/images/linux.textcat /home/song/workspace/uClinux-dist/images/linux.text /home/song/workspace/uClinux-dist/images/linux.data /home/song/workspace/uClinux-dist/images/romfs.img > /home/song/workspace/uClinux-dist/images/image.binmake[1]: Leaving directory /home/song/workspace/uClinux-dist/vendors/GDB/ARMulator

uClinux-dist/images 目錄下是生成的文件.

三、skyeye模擬

下面開始安裝 skyeye 命令行下輸入,

sudo apt-get install skyeye

不用配置和編譯,一個完整的skyeye就能用了,在uClinux-dist目錄下新建一個skyeye的配置文件 skyeye.conf,輸入以下內容。

cpu:arm7tdmimach:at91mem_bank:map=M, type=RW, addr=0x00000000, size=0x00004000mem_bank:map=M, type=RW, addr=0x01000000, size=0x00400000mem_bank:map=M, type=R, addr=0x01400000 , size=0x00400000, file=images/romfs.imgmem_bank:map=M, type=RW, addr=0x02000000, size=0x00400000mem_bank:map=M, type=RW, addr=0x02400000, size=0x00008000mem_bank:map=M, type=RW, addr=0x04000000, size=0x00400000mem_bank:map=I, type=RW, addr=0xf0000000, size=0x10000000

保存後在命令行輸入

skyeye -e linux-2.4.x/linux

按下回車,uclinux就開始運行了。

Your elf file is little endian.arch: armcpu info: armv3, arm7tdmi, 41007700, fff8ff00, 0 mach info: name at91, mach_init addr 0x418790uart_mod:0, desc_in:, desc_out:, converter:SKYEYE: use arm7100 mmu opsLoaded ROM images/romfs.imgstart addr is set to 0x01000000 by exec file.Linux version 2.4.24-uc0 (song@song) (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 2017年 05月 23日 星期二 00:09:53 CSTProcessor: Atmel AT91M40xxx revision 0Architecture: EB01On node 0 totalpages: 1024zone(0): 0 pages.zone(1): 1024 pages.zone(2): 0 pages.Kernel command line: root=/dev/rom0Calibrating delay loop... 15.82 BogoMIPSMemory: 4MB = 4MB totalMemory: 2968KB available (851K code, 179K data, 40K init)Dentry cache hash table entries: 512 (order: 0, 4096 bytes)Inode cache hash table entries: 512 (order: 0, 4096 bytes)Mount cache hash table entries: 512 (order: 0, 4096 bytes)Buffer cache hash table entries: 1024 (order: 0, 4096 bytes)Page-cache hash table entries: 1024 (order: 0, 4096 bytes)POSIX conformance testing by UNIFIXLinux NET4.0 for Linux 2.4Based upon Swansea University Computer Society NET3.039Initializing RT netlink socketStarting kswapdAtmel USART driver version 0.99ttyS0 at 0xfffd0000 (irq = 2) is a builtin Atmel APB USARTttyS1 at 0xfffcc000 (irq = 3) is a builtin Atmel APB USARTBlkmem copyright 1998,1999 D. Jeff DionneBlkmem copyright 1998 Kenneth AlbanowskiBlkmem 1 disk images:0: 1400000-14B33FF [VIRTUAL 1400000-14B33FF] (RO)RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksizeNET4: Linux TCP/IP 1.0 for NET4.0IP Protocols: ICMP, UDP, TCPIP: routing cache hash table of 512 buckets, 4KbytesTCP: Hash tables configured (established 512 bind 512)NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.VFS: Mounted root (romfs filesystem) readonly.Shell invoked to run file: /etc/rcCommand: hostname GDB-ARMulatorCommand: /bin/expand /etc/ramfs.img /dev/ram0Command: mount -t proc proc /procCommand: mount -t ext2 /dev/ram0 /varCommand: mkdir /var/tmpCommand: mkdir /var/logCommand: mkdir /var/runCommand: mkdir /var/lockCommand: mkdir /var/emptyCommand: cat /etc/motdWelcome to ____ _ _ / __| ||_| _ _| | | | _ ____ _ _ _ _ | | | | | | || | _ | | | | / / | |_| | |__| || | | | | |_| |/ | ___\____|_||_|_| |_|\____|\_/\_/ | | |_|GDB/ARMulator support by <davidm@snapgear.com>For further information check:http://www.uclinux.org/Execution Finished, ExitingSash command shell (version 1.1.1)/>

看到下面的就成功了。

____ _ _ / __| ||_| _ _| | | | _ ____ _ _ _ _ | | | | | | || | _ | | | | / / | |_| | |__| || | | | | |_| |/ | ___\____|_||_|_| |_|\____|\_/\_/ | | |_|

四、添加屬於自己的程序

下面介紹如何添加自己的用戶程序。

新建一個 hello.c

輸入

#include <stdio.h> int main() { printf("songwenshuai uclinux!
"); return(0);}

命令行下輸入

arm-elf-gcc -Wall -elf2flt -o hello hello.c

此時會在目錄下生成名為 hello的二進位文件,把它複製到 romfs/bin 下

在命令行下輸入

genromfs -v -V "ROMdisk" -f ./images/romfs.img -d ./romfsmake imagemake

這樣我們的用戶程序就加進文件系統了,輸入

skyeye -e linux-2.4.x/linux

開機後輸入hello 就會列印自己程序的信息了。

Welcome to ____ _ _ / __| ||_| _ _| | | | _ ____ _ _ _ _ | | | | | | || | _ | | | | / / | |_| | |__| || | | | | |_| |/ | ___\____|_||_|_| |_|\____|\_/\_/ | | |_|GDB/ARMulator support by <davidm@snapgear.com>For further information check:http://www.uclinux.org/Execution Finished, ExitingSash command shell (version 1.1.1)/> hellosongwenshuai uclinux!/>

songwenshuai uclinux! 就是我們自己添加的程序。

推薦閱讀:

一步一步學ROP之linux_x86篇
Linux下有哪些遊戲值得推薦?
Shell判斷(test)命令的常用方法
微軟有沒有可能為Linux系統開發桌面環境?
想學習 Linux,裝個虛擬機,裝哪個發行版好?

TAG:Linux |