新手求问,平台已建好,运行正常,但如何加入自己的应用程序啊
自己编写的应用程序应该如何编译并加入内核啊 应该是用mount -o loop 加挂img文件,然后把应用程序复制进去,然后umount uClinux AddApp User Guide for lumit4510 :说明: 如何给 uClinux 添加自己的应用程序
-------------------------------------------------------------------------
Step 1 :
1. cd uClinux-dist
2. cd user
3. mkdir myapp
4. cd myapp
5. vi demo.c
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
printf("Hello world! \n");
printf(" - let us make it together \n");
printf("--------------------\n");
printf("http://www.lumit.org\n");
return 0;
}
6. vi Makefile
EXEC = demo
OBJS = demo.o
all: $(EXEC)
$(EXEC): $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
romfs:
$(ROMFSINST) /bin/$(EXEC)
clean:
rm -f$(EXEC) *.elf *.gdb *.o
7. vi uClinux-dist/user/Makefile
添加一行dir_$(CONFIG_USER_MYAPP_DEMO) += myapp
309 # add by liming
310 dir_$(CONFIG_USER_MYAPP_DEMO) += myapp
311
8. vi uClinux-dist/Config/config.in
增添以下内容到文件最后
#############################################################################
mainmenu_option next_comment
comment 'My New Application'
bool 'demo' CONFIG_USER_MYAPP_DEMO
bool 'app1' CONFIG_USER_MYAPP_APP1
bool 'app2' CONFIG_USER_MYAPP_APP2
bool 'app3' CONFIG_USER_MYAPP_APP3
comment "My New Application"
endmenu
#############################################################################
9. 进行重新编译内核和文件系统的步骤
make dep
make clean
make lib_only (可以仅1次,不必要每次都来)
make user_only (每次修改过您的应用程序之后,这一步后面的都必须重来)
make romfs
make image
make
注意,如果前面已经编译成功过一次,那么后面只需进行 make user_only; make romfs; make
10. 下载内核,运行看看:
\>load
No begin address for download, use default address 0x8000
Mini TFTP Server 1.0 (IP : 192.168.168.101 PORT: 69)
Load image file from host
Type tftp -i 192.168.168.101 put filename at the host PC
Press ESC key to exit
Starting the TFTP download...
................................................
Received 18baec Bytes, END...
Boot Image? (y/n) yLinux version 2.4.20-uc0 ([email protected]) (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 Wed Aug 25 22:07:14 HKT 2004
Processor: Samsung S3C4510B revision 6
Architecture: SNDS100
On node 0 totalpages: 4096
zone(0): 0 pages.
zone(1): 4096 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/rom0
Calibrating delay loop... 49.86 BogoMIPS
Memory: 16MB = 16MB total
Memory: 14452KB available (1510K code, 157K data, 40K init)
Dentry cache hash table entries: 2048 (order: 2, 16384 bytes)
Inode cache hash table entries: 1024 (order: 1, 8192 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: 4096 (order: 2, 16384 bytes)
POSIX conformance testing by UNIFIX
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Starting kswapd
Samsung S3C4510 Serial driver version 0.9 (2001-12-27) with no serial options enabled
ttyS00 at 0x3ffd000 (irq = 5) is a S3C4510B
ttyS01 at 0x3ffe000 (irq = 7) is a S3C4510B
Blkmem copyright 1998,1999 D. Jeff Dionne
Blkmem copyright 1998 Kenneth Albanowski
Blkmem 1 disk images:
0: BE7E8-18BBE7 (RO)
RAMDISK driver initialized: 16 RAM disks of 1024K size 1024 blocksize
Samsung S3C4510 Ethernet driver version 0.1 (2002-02-20) <[email protected]>
eth0: 00:40:95:36:35:34
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 1024 bind 1024)
VFS: Mounted root (romfs filesystem) readonly.
Freeing init memory: 40K
Shell invoked to run file: /etc/rc
Command: hostname Samsung
Command: /bin/expand /etc/ramfs.img /dev/ram0
Command: /bin/expand /etc/ramfs2048.img /dev/ram1
Command: mount -t proc proc /proc
Command: mount -t ext2 /dev/ram0 /var
Command: mount -t ext2 /dev/ram1 /ramdisk
Command: chmod 777 /ramdisk
Command: mkdir /var/config
Command: mkdir /var/tmp
Command: mkdir /var/log
Command: mkdir /var/run
Command: mkdir /var/lock
Command: ifconfig lo 127.0.0.1
Command: route add -net 127.0.0.0 netmask 255.255.255.0 lo
Command: ifconfig eth0 192.168.168.101 netmask 255.255.255.0 up
Command: cat /etc/motd
Welcome to
____ __
/__| ||_|
_ _| || | _ _____ ___
| | | | || || |_ \| | | |\ \/ /
| |_| | |__| || | | | | |_| |/ \
|___\____|_||_|_| |_|\____|\_/\_/
| |
|_|
For further information check:
http://www.uclinux.org/
Execution Finished, Exiting
Sash command shell (version 1.1.1)
/> ls
bin
dev
etc
home
lib
mnt
proc
ramdisk
sbin
tmp
usr
var
/>
/> cd bin
/bin> ./demo
Hello world!
- let us make it together
--------------------
http://www.lumit.org
/bin>
参考链接:
http://www.lumit.org/dn_document.htm
http://www.ucdragon.com/bbs/printpage.asp?BoardID=1&id=106
页:
[1]