歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux服務器

uClinux中添加用戶應用程序的詳細方法

1. uClinux-dist/user/Makefile

dir_$(CONFIG_USER_HELLO_WORLD)

+= hello


2. uClinux-dist/config/Configure.help

CONFIG_USER_HELLO_WORLD

A simple hello world program


3. uClinux-dist/config/config.in

找到下面兩行

mainmenu_option next_comment

comment 'Miscellaneous Applications'

添加如下一行

bool 'hello'

CONFIG_USER_HELLO_WORLD


4.1.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

4.2.uClinux-dist/user/hello/hello.c

 

#include <stdio.h>

int main()
{
printf("Hello, World\n");
return 0;
}

5. 將用戶程序編譯進romfs


# cd ~/uClinux-dist
# make menuconfig
# make dep
# make romfs

Copyright © Linux教程網 All Rights Reserved