编译Ralink SDK

2052

过程在Ralink SDK User Manual中有,这里只记录我的研究过程。

Ralink SDK User Manual:   http://wenku.baidu.com/view/0c728d32ba1aa8114431d9e3.html

[vc_toggle title=”环境配置” open=”false”]首先要说的是ralink官方推荐的编译平台是Fedora 6(目前最新的是Fedora 20),而我用的ubuntu13.10,貌似因为这个原因,遇到不少问题:

dash和bash的问题

readelf版本问题   可用的readelf

交叉工具链(toolchain)解压到opt即可。

LZMA和mksquashfs,貌似可以不装。LZMA用作压缩kernel,mksquashfs-lzma用作压缩rootfs。没装时默认使用gzip压缩。可以在RT288x_SDK/source/vendors/Ralink/{Platform}/Makefile 中修改压缩方式[/vc_toggle][vc_toggle title=”添加一个新的库” open=”false”]1. #/ cp -r libtest to RT288x_SDK/source/lib

2. modify RT288x_SDK/source/lib/libtest/Makefile
[you can reference to libnvram/Makefile]

3. modify RT288x_SDK/source/lib/Makefile
ifeq ($(CONFIG_LIB_LIBTEST_FORCE),y)
DIRS += libtest
endif
ifeq ($(CONFIG_LIB_LIBTEST_FORCE),y)
@$(MAKE) -C libtest shared
endif

4. modify RT288x_SDK/source/config/config.in
bool ‘Build libtest’ CONFIG_LIB_LIBTEST_FORCE
#/ make menuconfig
You can see the “Build libtest” on the menu.

5.Compile your new library
#make dep
#make lib_only[/vc_toggle][vc_toggle title=”编译用户库” open=”false”]# cd RT288x_SDK/source

# make lib_only

# make romfs

………….

The shared libraries are shown in RT288x_SDK /source/romfs/lib[/vc_toggle][vc_toggle title=”接入新的内核模块” open=”false”]Example: Port the hello networking module to the RT2880 platform
1. Add the source code to the rt2880 directory
# mkdir RT288x_SDK/source/linux-2.4.x/drivers/net/hello
#vi RT288x_SDK/source/linux-2.4.x/drivers/net/hello/Makefile
O_TARGET := hello.o
obj-y := main.o
obj-m := $(O_TARGET)
include $(TOPDIR)/Rules.make
#vi RT288x_SDK/source/linux-2.4.x/drivers/net/hello/main.c
#include <linux/init.h>
#include <linux/module.h>
static int hello_init(void)
{
printk(“hello world\n”);
return 0;
}
static void hello_exit(void)
{
printk(“goodbye\n”);
}
module_init(hello_init);
module_exit(hello_exit);
MODULE_LICENSE(“GPL”);
~
2. Modify RT288x_SDK/source/linux-2.4.x/drivers/net/Makefile
subdir-$(CONFIG_RT2880_HELLO) += hello
3. Modify Config.in
tristate ‘ Ralink hello module’ CONFIG_RT2880_HELLO
4. Turn on the hello module
#make menuconfig
<M> Ralink hello module
5. Compile the source code
#make dep
#make
6. Test
/ # insmod hello
hello world
/ #[/vc_toggle][vc_toggle title=”添加启动运行命令” open=”false”]Edit RT288x_SDK/source/vendors/Ralink/RT2880/rcS
#!/bin/sh
mount –a
goahead& <– add new command here[/vc_toggle][vc_toggle title=”向Rootfs中添加文件” open=”false”]If you execute the “make clean” script, it will delete RT288x_SDK/source/romfs directory.
You cannot copy the file to RT288x_SDK/source/romfs manually because it will disappear after executing “make clean”.
Example: add xxx.bin to rootfs
a. copy xxx.bin to RT288x_SDK/source/vendors/Ralink/{RT2880/RT3052/RT3883/RT3352/RT5350}
b. edit RT288x_SDK/source/vendors/Ralink/{RT2880/RT3052/RT3883/RT3352/RT5350}/Makefile
romfs:
$(ROMFSINST) /etc_ro/xxx.bin
The script will copy xxx.bin to RT288x_SDK/source/romfs/etc_ro after executing “make romfs”[/vc_toggle]

1条评论

回复 Serval

Please enter your comment!
Please enter your name here