Ralink Linux Makefile and Installation Notes

1. Readme
¡@ 1.1 README ¡@
* README
*
* Ralink Tech Inc.
*
* http://www.ralinktech.com
*


=======================================================================
Description:
The is a linux device driver for Ralink RT2460.


=======================================================================
Build Instructions:

NOTE: At the time of this writing the following targets were supported:
RedHat 7.1
RedHat 7.2
RedHat 7.3 
RedHat 8.0
RedHat 9.0


Building:

1) run 'tar xvzf rt2460_rh**.tar.gz'
go to ~/rt2460_rh** directory.

2) run 'make config'
The default answer is correct for most users. Just press 'Enter' to use the default answer.
if the kernel has a different
version string, this allows you to change the module install directory.

3) run 'make install' (as root).

4) run '/sbin/insmod rt2460.o' (as root)
'/sbin/ifconfig ra0 inet YOUR_IP up'
'/sbin/route add default gw YOUR_DEFAULT_GW dev ra0'

5) run 'RaConfig' to start the Configuring Utility.


=======================================================================
Configuring:
A) choose ra0 for first RT2460 WLAN card, ra1 for second RT2460 WLAN card, etc.

B) create(edit) 'ifcfg-ra0' file in /etc/sysconfig/network-scripts/,
edit( or add the line) in /etc/modules.conf:
alias ra0 rt2460

C) edit(create) the file /etc/sysconfig/network-scripts/ifcfg-ra0
DEVICE='ra0'
ONBOOT='yes'


NOTE:
if you use dhcp, add this line too .
BOOTPROTO='dhcp'

*D) To ease the Default Gateway setting,
add the line
GATEWAY=x.x.x.x
in /etc/sysconfig/network

*E) RedHat provides wireless tool('iwconfig' command) in wireless-tools-**.i386.rpm.
2. How to make and install Module
¡@ 2.1 config.mak ¡@
LINUX_SRC=/usr/src/linux-2.4.18-3
TARGET_MODDIR=/lib/modules/linux-2.4.18-3/kernel/drivers/net
¡@ 2.2 Makefile ¡@
¡@ ¡@ # Comment/uncomment the following line to enable/disable debugging

CC := cc

include ./config.mk

WFLAGS := -Wall -Wstrict-prototypes -Wno-trigraphs -Wno-unused
CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=i686 -DMODULE -DMODVERSIONS -include $(LINUX_SRC)/include/linux/modversions.h $(WFLAGS)

OBJ = rt2400.o

all: $(OBJ)
@touch config.mk

rt2400.o: rtmp_main.o mlme.o connect.o sync.o assoc.o auth.o auth_rsp.o rtmp_data.o rtmp_init.o sanity.o rtmp_wep.o rtmp_info.o eeprom.o
$(LD) -r $^ -o $@

clean:
rm -f *.o *~ core

install:
@touch config.mk
@echo "install '$(OBJ)' to $(TARGET_MODDIR)"
install -m 644 -o 0 -g 0 $(OBJ) $(TARGET_MODDIR)
/sbin/depmod -a

@if [ ! -f /etc/sysconfig/network-scripts/ifcfg-ra0 ]; then \
echo "Create 'ifcfg-ra0' in /etc/sysconfig/network-scripts/"; \
cp ifcfg-ra0 /etc/sysconfig/network-scripts/ ; \
fi
@if ! grep 'ra0' /etc/modules.conf ; then \
echo "append 'alias ra0 rt2400' to /etc/modules.conf"; \
echo "alias ra0 rt2400" >> /etc/modules.conf ; \
fi

config:
@touch config.mk
@./Configure
¡@ 2.3 ifcfg-ra0 ¡@
¡@ ¡@ DEVICE=ra0
BOOTPROTO=dhcp
ONBOOT=yes
3. How to make and install Utility
¡@ 3.1 config.mak ¡@
QTDIR=/home/qt-x11-free-static-3.1.1
CFLAGS_CFG=
LIBS_CFG=-lqt -lXrender -lXinerama -lXft -lfreetype -lXext -lX11 -lm -lSM -lICE -ldl
¡@ 3.2 Makefile ¡@
#############################################################################
# Makefile for building: RaConfig
# Project: RT2400 Linux Device Configuration Utility
# Template: application
# Command: Make config
# Make
#############################################################################

####### Compiler, tools and options

include ./config.mk

KDEDIR = /usr
CC = gcc
CXX = g++
LEX = flex
YACC = yacc
#CFLAGS = -pipe -Wall -W -O2 -DQT_NO_DEBUG -DQT_SHARED
#CXXFLAGS = -pipe -Wall -W -O2 -DQT_NO_DEBUG -DQT_SHARED
CFLAGS = -pipe -Wall -W -O2 $(CFLAGS_CFG)
CXXFLAGS = -pipe -Wall -W -O2 $(CFLAGS_CFG)
LEXFLAGS =
YACCFLAGS= -d

INCPATH = -I$(QTDIR)/mkspecs/linux-g++ -I. -I/usr/include/freetype2 -I$(QTDIR)/include
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS) -Wl,-rpath,$(QTDIR)/lib -L$(QTDIR)/lib -L/usr/X11R6/lib $(LIBS_CFG)

AR = ar cqs
RANLIB =
MOC = $(QTDIR)/bin/moc
UIC = $(QTDIR)/bin/uic -L $(QTDIR)/plugins
QMAKE = qmake
TAR = tar -cf
GZIP = gzip -9f
COPY = cp -f
COPY_FILE= $(COPY) -p
COPY_DIR = $(COPY) -pR
DEL_FILE = rm -f
DEL_DIR = rmdir
MOVE = mv

####### Output directory

OBJECTS_DIR =

####### Files

HEADERS =
SOURCES = raconfig.cpp
OBJECTS = raconfig.o \
configapi.o \
rt_tool.o \
raconfigform.o \
addform.o \
qhexvalidator.o \
sitewepdlg.o\
cardselect.o\
countryform.o \
qmake_image_collection.o

#FORMS = raconfigform.ui \
# addform.ui
UICDECLS = raconfigform.h \
addform.h \
sitewepdlg.h \
countryform.h \
cardselect.h

UICIMPLS = raconfigform.cpp \
addform.cpp \
qhexvalidator.cpp \
sitewepdlg.cpp \
countryform.cpp \
cardselect.cpp

SRCMOC = moc_raconfigform.cpp \
moc_addform.cpp \
moc_sitewepdlg.cpp \
moc_countryform.cpp \
moc_cardselect.cpp
OBJMOC = moc_raconfigform.o \
moc_addform.o \
moc_sitewepdlg.o \
moc_countryform.o \
moc_cardselect.o
DIST =
QMAKE_TARGET = RaConfig
DESTDIR =
TARGET = RaConfig

first: all
####### Implicit rules

.SUFFIXES: .c .cpp .cc .cxx .C

.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<

####### Build rules

all: Makefile $(TARGET)
chmod a+x $(TARGET)

$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)

mocables: $(SRCMOC)

$(MOC):
( cd $(QTDIR)/src/moc ; $(MAKE) )

dist:
@mkdir -p RaConfig && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) ssurvey/ && ( cd `dirname ssurvey` && $(TAR) ssurvey.tar ssurvey && $(GZIP) ssurvey.tar ) && mv `dirname ssurvey`/ssurvey.tar.gz . && rm -rf ssurvey

mocclean:
-rm -f $(OBJMOC)
-rm -f $(SRCMOC)

uiclean:
-rm -f $(UICIMPLS) $(UICDECLS)

clear: mocclean
-rm -f $(OBJECTS)
-rm -f qmake_image_collection.cpp
-rm -f *~ core *.core

clean:
-rm $(TARGET)
-rm *.o
-rm moc_*.*


FORCE:

####### Compile

raconfig.o: raconfig.cpp raconfigform.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o raconfig.o raconfig.cpp

raconfigform.o: raconfigform.cpp raconfigform.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o raconfigform.o raconfigform.cpp

addform.o: addform.cpp addform.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o addform.o addform.cpp

sitewepdlg.o: sitewepdlg.cpp sitewepdlg.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o sitewepdlg.o sitewepdlg.cpp

countryform.o: countryform.cpp countryform.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o countryform.o countryform.cpp

cardselect.o: cardselect.cpp cardselect.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o cardselect.o cardselect.cpp

qhexvalidator.o: qhexvalidator.cpp qhexvalidator.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o qhexvalidator.o qhexvalidator.cpp

moc_raconfigform.o: moc_raconfigform.cpp raconfigform.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_raconfigform.o moc_raconfigform.cpp

moc_addform.o: moc_addform.cpp addform.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_addform.o moc_addform.cpp

moc_sitewepdlg.o: moc_sitewepdlg.cpp sitewepdlg.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_sitewepdlg.o moc_sitewepdlg.cpp

moc_countryform.o: moc_countryform.cpp countryform.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_countryform.o moc_countryform.cpp

moc_cardselect.o: moc_cardselect.cpp cardselect.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_cardselect.o moc_cardselect.cpp

moc_raconfigform.cpp: $(MOC) raconfigform.h
$(MOC) raconfigform.h -o moc_raconfigform.cpp

moc_addform.cpp: $(MOC) addform.h
$(MOC) addform.h -o moc_addform.cpp

moc_sitewepdlg.cpp: $(MOC) sitewepdlg.h
$(MOC) sitewepdlg.h -o moc_sitewepdlg.cpp

moc_cardselect.cpp: $(MOC) cardselect.h
$(MOC) cardselect.h -o moc_cardselect.cpp

moc_countryform.cpp: $(MOC) countryform.h
$(MOC) countryform.h -o moc_countryform.cpp

qmake_image_collection.o: qmake_image_collection.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o qmake_image_collection.o qmake_image_collection.cpp

qmake_image_collection.cpp: ./ico/check16.xpm \
./ico/uncheck16.xpm \
./ico/handshak16.xpm \
./ico/lost32.xpm \
./ico/normal32.xpm \
./ico/raconfig.xpm \
./ico/week32.xpm \
./ico/adapter.xpm \
./ico/noactive16.xpm \
./ico/radiooff.png \
./ico/radioon.png \
./ico/rtlogo.png
$(UIC) -embed RaConfig ./ico/check16.xpm ./ico/radioon.png ./ico/radiooff.png ./ico/noactive16.xpm ./ico/uncheck16.xpm ./ico/handshak16.xpm ./ico/lost32.xpm ./ico/normal32.xpm ./ico/raconfig.xpm ./ico/week32.xpm ./ico/adapter.xpm ./ico/rtlogo.png -o qmake_image_collection.cpp

config_api.o: configapi.cpp configapi.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o configapi.o configapi.cpp

rt_tool.o: rt_tool.cpp rt_tool.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o rt_tool.o rt_tool.cpp

config:
@touch config.mk
@./configure