Pattern Hatching by John Vlisside discusses
the Mememento pattern on pages 102 to about 106+
How to Design Programs
An introduction to Programming and Computing
Matthias Felleisen (scheme language)
Friday, December 08, 2006
Tuesday, December 05, 2006
matt buckland : ai book excerpts
Buckland, Mat.
Programming game AI by example / by Mat Buckland.
p. cm.
Includes index.
ISBN 1-55622-078-2 (pbk.)
1. Computer games — Design. 2. Computer games — Programming. 3.Computer
graphics. I. Title.
QA76.76.C672B85 2004
794.8'1526 — dc22
class State
{
public:
virtual void Execute (Troll* troll) = 0;
};
Now imagine a Troll class that has member variables for attributes such as health, anger, stamina, etc., and an interface allowing a client to query and adjust those values. A Troll can be given the functionality of a finite state machine by adding a pointer to an instance of a derived object of the State class, and a method permitting a client to change the instance the pointer is pointing to.
class Troll
{
/* ATTRIBUTES OMITTED */
State* m_pCurrentState;
public:
/* INTERFACE TO ATTRIBUTES OMITTED */
void Update()
{
m_pCurrentState->Execute(this);
}
void ChangeState(const State* pNewState)
{
delete m_pCurrentState;
m_pCurrentState = pNewState;
}
};
Programming game AI by example / by Mat Buckland.
p. cm.
Includes index.
ISBN 1-55622-078-2 (pbk.)
1. Computer games — Design. 2. Computer games — Programming. 3.Computer
graphics. I. Title.
QA76.76.C672B85 2004
794.8'1526 — dc22
class State
{
public:
virtual void Execute (Troll* troll) = 0;
};
Now imagine a Troll class that has member variables for attributes such as health, anger, stamina, etc., and an interface allowing a client to query and adjust those values. A Troll can be given the functionality of a finite state machine by adding a pointer to an instance of a derived object of the State class, and a method permitting a client to change the instance the pointer is pointing to.
class Troll
{
/* ATTRIBUTES OMITTED */
State* m_pCurrentState;
public:
/* INTERFACE TO ATTRIBUTES OMITTED */
void Update()
{
m_pCurrentState->Execute(this);
}
void ChangeState(const State* pNewState)
{
delete m_pCurrentState;
m_pCurrentState = pNewState;
}
};
Wednesday, November 22, 2006
how to build qt3 for win32
install the cvs client from http://www.wincvs.org/ its smaller than
the one from cygwin.
then do the following
http://qtwin.sourceforge.net/qt3-win32/compile-net.php
Requirements
* Windows 2000 or XP
* a cvs client (for example from http://www.cvsnt.org), when using the kde cvs server
* Visual Studio .NET or .NET 2003
Get the Q... sources
* by downloading a Q... source snapshot from the KDE-Cygwin snapshot area
* or from the cvs repository
first connect to the cvs server
c:\source> cvs -d :pserver:anonymous@qtwin.cvs.sourceforge.net:/cvsroot/qtwin login
enter empty password
then checkout the sources with
c:\source> cvs -z3 -d :pserver:anonymous@qtwin.cvs.sourceforge.net:/cvsroot/qtwin co -r QT_WIN32_3_3_BRANCH qt-3
Compiling Qt with command line tools
* Open a cmd shell
* Setup your compiler environment (please adjust the path to your needs)
c:\source> "c:\Programme\Microsoft Visual Studio .NET 2003\Vc7\bin\vcvars32.bat"
* Setup Q.. environment
c:\source> set QTDIR=< qt3 source root>
c:\source> set PATH=%QTDIR%\bin;%PATH%
c:\source> set QMAKESPEC=win32-msvc.net
* Configure and build the source
The script first creates link_includes.exe and configure.exe which are needed for bootstrap the build process. link_includes copies all relevant Qt-headers into the include-directory. configure.exe is the replacement for the ./configure-script unter Unix/Linux. After that, qmake.exe is build and the compilation gets started.
c:\source> cd < qt3 source root >
c:\source\qt-3> configure.bat [-fast] [-verbose]
configure knows some of the parameters of the x11 release configure script like -fast or -verbose.
For a full list see bin\configure.exe -help.
This should build the whole Qt release. If it breaks you can restart compiling with
c:\source\qt-3> nmake [< target >]
for a list of all available targets see the toplevel Makefile
* Start Q.. applications
c:\source\qt-3> designer
c:\source\qt-3> assistant
c:\source\qt-3> linguist
c:\source\qt-3> cd tutorial\t1
c:\source\qt-3\tutorial\t1> t1
the one from cygwin.
then do the following
http://qtwin.sourceforge.net/qt3-win32/compile-net.php
Requirements
* Windows 2000 or XP
* a cvs client (for example from http://www.cvsnt.org), when using the kde cvs server
* Visual Studio .NET or .NET 2003
Get the Q... sources
* by downloading a Q... source snapshot from the KDE-Cygwin snapshot area
* or from the cvs repository
first connect to the cvs server
c:\source> cvs -d :pserver:anonymous@qtwin.cvs.sourceforge.net:/cvsroot/qtwin login
enter empty password
then checkout the sources with
c:\source> cvs -z3 -d :pserver:anonymous@qtwin.cvs.sourceforge.net:/cvsroot/qtwin co -r QT_WIN32_3_3_BRANCH qt-3
Compiling Qt with command line tools
* Open a cmd shell
* Setup your compiler environment (please adjust the path to your needs)
c:\source> "c:\Programme\Microsoft Visual Studio .NET 2003\Vc7\bin\vcvars32.bat"
* Setup Q.. environment
c:\source> set QTDIR=< qt3 source root>
c:\source> set PATH=%QTDIR%\bin;%PATH%
c:\source> set QMAKESPEC=win32-msvc.net
* Configure and build the source
The script first creates link_includes.exe and configure.exe which are needed for bootstrap the build process. link_includes copies all relevant Qt-headers into the include-directory. configure.exe is the replacement for the ./configure-script unter Unix/Linux. After that, qmake.exe is build and the compilation gets started.
c:\source> cd < qt3 source root >
c:\source\qt-3> configure.bat [-fast] [-verbose]
configure knows some of the parameters of the x11 release configure script like -fast or -verbose.
For a full list see bin\configure.exe -help.
This should build the whole Qt release. If it breaks you can restart compiling with
c:\source\qt-3> nmake [< target >]
for a list of all available targets see the toplevel Makefile
* Start Q.. applications
c:\source\qt-3> designer
c:\source\qt-3> assistant
c:\source\qt-3> linguist
c:\source\qt-3> cd tutorial\t1
c:\source\qt-3\tutorial\t1> t1
Monday, November 20, 2006
timegettime and unix gettimeofday
here is what i used to replace windows timegettime
from advance progamming in the unix environment page 173
the gettimeofday function provides greater resolution (up to
a microsecond) than the time function.
#include
int gettimeofday(struct timevale *restrcited tp, void *restrict tzp);
here is my one off.
Uint32 ticks;
struct timeval now;
gettimeofday(&now, NULL);
ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_usec-start.tv_usec)/1000;
return(ticks);
i also found some helpfull information by looking at SDL library
look at the source file src/timer/unix/SDL_systimer.c
#ifdef HAVE_CLOCK_GETTIME
static struct timespec start;
#else
static struct timeval start;
#error "i do have it"
#endif /* HAVE_CLOCK_GETTIME */
void SDL_StartTicks(void)
{
/* Set first ticks value */
#if HAVE_CLOCK_GETTIME
clock_gettime(CLOCK_MONOTONIC,&start);
error "clock_gettime"
#else
gettimeofday(&start, NULL);
#error "gettimeofday"
#endif
}
Uint32 SDL_GetTicks (void)
{
#if HAVE_CLOCK_GETTIME
Uint32 ticks;
struct timespec now;
clock_gettime(CLOCK_MONOTONIC,&now);
ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_nsec-start.tv_nsec)/1000000;
return(ticks);
#else
Uint32 ticks;
struct timeval now;
gettimeofday(&now, NULL);
ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_usec-start.tv_usec)/1000;
return(ticks);
#endif
}
from advance progamming in the unix environment page 173
the gettimeofday function provides greater resolution (up to
a microsecond) than the time function.
#include
int gettimeofday(struct timevale *restrcited tp, void *restrict tzp);
here is my one off.
Uint32 ticks;
struct timeval now;
gettimeofday(&now, NULL);
ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_usec-start.tv_usec)/1000;
return(ticks);
i also found some helpfull information by looking at SDL library
look at the source file src/timer/unix/SDL_systimer.c
#ifdef HAVE_CLOCK_GETTIME
static struct timespec start;
#else
static struct timeval start;
#error "i do have it"
#endif /* HAVE_CLOCK_GETTIME */
void SDL_StartTicks(void)
{
/* Set first ticks value */
#if HAVE_CLOCK_GETTIME
clock_gettime(CLOCK_MONOTONIC,&start);
error "clock_gettime"
#else
gettimeofday(&start, NULL);
#error "gettimeofday"
#endif
}
Uint32 SDL_GetTicks (void)
{
#if HAVE_CLOCK_GETTIME
Uint32 ticks;
struct timespec now;
clock_gettime(CLOCK_MONOTONIC,&now);
ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_nsec-start.tv_nsec)/1000000;
return(ticks);
#else
Uint32 ticks;
struct timeval now;
gettimeofday(&now, NULL);
ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_usec-start.tv_usec)/1000;
return(ticks);
#endif
}
Sunday, November 19, 2006
interesting but not useful
the following came from http://home.earthlink.net/~huston2/dp/AdapterDemosCpp
but its limited can only work on a void function.
// Purpose. Adapter design pattern (External Polymorphism demo)
// 1. Specify the new desired interface
// 2. Design a "wrapper" class that can "impedance match" the old to the new
// 3. The client uses (is coupled to) the new interface
// 4. The adapter/wrapper "maps" to the legacy implementation
#include
class ExecuteInterface { public: // 1. Specify the new i/f
virtual ~ExecuteInterface() { }
virtual void execute() = 0;
};
template // 2. Design a "wrapper" or
class ExecuteAdapter : public ExecuteInterface { // "adapter" class
public:
ExecuteAdapter( TYPE* o, void (TYPE::*m)() ) { object = o; method =m; }
~ExecuteAdapter() { delete object; }
// 4. The adapter/wrapper "maps" the new to the legacy implementation
void execute() /* the new */ { (object->*method)(); }
private:
TYPE* object; // ptr-to-object attribute
void (TYPE::*method)(); /* the old */ // ptr-to-member-function
}; // attribute
// The old: three totally incompatible classes // no common base class,
class Fea { public: // no hope of polymorphism
~Fea() { cout << "Fea::dtor" << endl; }
void doThis() { cout << "Fea::doThis()" << endl; }
};
class Feye { public:
~Feye() { cout << "Feye::dtor" << endl; }
void doThat() { cout << "Feye::doThat()" << endl; }
};
class Pheau { public:
~Pheau() { cout << "Pheau::dtor" << endl; }
void doTheOther() { cout << "Pheau::doTheOther()" << endl; }
};
/* the new is returned */ ExecuteInterface** initialize() {
ExecuteInterface** array = new ExecuteInterface*[3]; /* the old is below */
array[0] = new ExecuteAdapter( new Fea(), &Fea::doThis );
array[1] = new ExecuteAdapter( new Feye(), &Feye::doThat );
array[2] = new ExecuteAdapter( new Pheau(), &Pheau::doTheOther );
return array;
}
void main( void ) {
ExecuteInterface** objects = initialize();
for (int i=0; i < 3; i++) objects[i]->execute(); // 3. Client uses the new
// (polymporphism)
for (i=0; i < 3; i++) delete objects[i];
delete objects;
}
// Fea::doThis()
// Feye::doThat()
// Pheau::doTheOther()
// Fea::dtor
// Feye::dtor
// Pheau::dtor
but its limited can only work on a void function.
// Purpose. Adapter design pattern (External Polymorphism demo)
// 1. Specify the new desired interface
// 2. Design a "wrapper" class that can "impedance match" the old to the new
// 3. The client uses (is coupled to) the new interface
// 4. The adapter/wrapper "maps" to the legacy implementation
#include
class ExecuteInterface { public: // 1. Specify the new i/f
virtual ~ExecuteInterface() { }
virtual void execute() = 0;
};
template
class ExecuteAdapter : public ExecuteInterface { // "adapter" class
public:
ExecuteAdapter( TYPE* o, void (TYPE::*m)() ) { object = o; method =m; }
~ExecuteAdapter() { delete object; }
// 4. The adapter/wrapper "maps" the new to the legacy implementation
void execute() /* the new */ { (object->*method)(); }
private:
TYPE* object; // ptr-to-object attribute
void (TYPE::*method)(); /* the old */ // ptr-to-member-function
}; // attribute
// The old: three totally incompatible classes // no common base class,
class Fea { public: // no hope of polymorphism
~Fea() { cout << "Fea::dtor" << endl; }
void doThis() { cout << "Fea::doThis()" << endl; }
};
class Feye { public:
~Feye() { cout << "Feye::dtor" << endl; }
void doThat() { cout << "Feye::doThat()" << endl; }
};
class Pheau { public:
~Pheau() { cout << "Pheau::dtor" << endl; }
void doTheOther() { cout << "Pheau::doTheOther()" << endl; }
};
/* the new is returned */ ExecuteInterface** initialize() {
ExecuteInterface** array = new ExecuteInterface*[3]; /* the old is below */
array[0] = new ExecuteAdapter
array[1] = new ExecuteAdapter
array[2] = new ExecuteAdapter
return array;
}
void main( void ) {
ExecuteInterface** objects = initialize();
for (int i=0; i < 3; i++) objects[i]->execute(); // 3. Client uses the new
// (polymporphism)
for (i=0; i < 3; i++) delete objects[i];
delete objects;
}
// Fea::doThis()
// Feye::doThat()
// Pheau::doTheOther()
// Fea::dtor
// Feye::dtor
// Pheau::dtor
Friday, November 17, 2006
java on debian
the following came from: http://www.crazysquirrel.com/computing/debian/java.jspx
Quick Guide
If you are fairly confident and don't want to read the whole document the following summary should probably be enought to get java working on your system. Lines 1 and 3 are preformed as root line 2 as a standard user.
apt-get install java-package
fakeroot make-jpkg.bin
dpkg -i.deb
Step 1 - Get the SunJVM
You could go with other JVM's like Blackdown or Kaffe if you want. I am not saying they aren't worth looking at but if you are serious about developing with Java you basically have no choice but to go with the Sun JVM. They provide it for free (as long as you sign you life away) so you might as well use the best.
You can get the latest Sun JVM from here http://java.sun.com/
Step 2 - Install the Required Builder Package
Installing Java on Debian is not the simplest thing in the world but fortunatly there is a package that will do most of the work for you (assuming it works). That heaven sent package is java-pacakge which can be installed with:
apt-get -u install java-package
Make sure that your repository is fully upto date before installing this package or you might run into problems installing the latest JVM. You also need fakeroot if you don't have it.
Step 3 - Create the .deb Package File
You have to perform this step as a non-root user so I suggest using your own account. Create a temporary directory and copy the java .bin installer file into it. then run the command:
fakeroot make-jpkg jdk-1_5_0-linux-i586.bin
changing the name of the java .bin package if you need to. You may see a few warnings while the package is being created (and it takes some time to actually create it - about 2 minutes). If you see a message at the end saying the package was created then the warnings are not a problem. The message will probably look something like this:
The Debian package has been created in the current
directory. You can install the package as root (e.g.
dpkg -i sun-j2sdk1.5_1.5.0+update00_i386.deb).
Step 4 - Install the Java .deb Package
You need to be root to perform this step so swtich now. Then execute the following command:
dpkg -i sun-j2sdk1.5_1.5.0+update00_i386.deb
Of course you need to specify the correct package name if yours doesn't match mine. You can find out what the package name is from looking at the success message.
Step 5 - Check it Works
This should be the simplest step. Just execute the command:
java -version
as both root and another user to make sure everything is installed correctly. You should see output not a million miles different to that shown below.
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
Quick Guide
If you are fairly confident and don't want to read the whole document the following summary should probably be enought to get java working on your system. Lines 1 and 3 are preformed as root line 2 as a standard user.
apt-get install java-package
fakeroot make-jpkg
dpkg -i
Step 1 - Get the SunJVM
You could go with other JVM's like Blackdown or Kaffe if you want. I am not saying they aren't worth looking at but if you are serious about developing with Java you basically have no choice but to go with the Sun JVM. They provide it for free (as long as you sign you life away) so you might as well use the best.
You can get the latest Sun JVM from here http://java.sun.com/
Step 2 - Install the Required Builder Package
Installing Java on Debian is not the simplest thing in the world but fortunatly there is a package that will do most of the work for you (assuming it works). That heaven sent package is java-pacakge which can be installed with:
apt-get -u install java-package
Make sure that your repository is fully upto date before installing this package or you might run into problems installing the latest JVM. You also need fakeroot if you don't have it.
Step 3 - Create the .deb Package File
You have to perform this step as a non-root user so I suggest using your own account. Create a temporary directory and copy the java .bin installer file into it. then run the command:
fakeroot make-jpkg jdk-1_5_0-linux-i586.bin
changing the name of the java .bin package if you need to. You may see a few warnings while the package is being created (and it takes some time to actually create it - about 2 minutes). If you see a message at the end saying the package was created then the warnings are not a problem. The message will probably look something like this:
The Debian package has been created in the current
directory. You can install the package as root (e.g.
dpkg -i sun-j2sdk1.5_1.5.0+update00_i386.deb).
Step 4 - Install the Java .deb Package
You need to be root to perform this step so swtich now. Then execute the following command:
dpkg -i sun-j2sdk1.5_1.5.0+update00_i386.deb
Of course you need to specify the correct package name if yours doesn't match mine. You can find out what the package name is from looking at the success message.
Step 5 - Check it Works
This should be the simplest step. Just execute the command:
java -version
as both root and another user to make sure everything is installed correctly. You should see output not a million miles different to that shown below.
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
Tuesday, November 14, 2006
subversion.
/etc/rcS.d
lrwxrwxrwx 1 root root 20 2006-11-14 12:58 S80svnserve -> /etc/init.d/svnserve
chown all files in the repos to svnserve user
then chmod-ed the db files read/write
configured the file
[general]
### These options control access to the repository for unauthenticated
### and authenticated users. Valid values are "write", "read",
### and "none". The sample settings below are the defaults.
anon-access = write
auth-access = write
lrwxrwxrwx 1 root root 20 2006-11-14 12:58 S80svnserve -> /etc/init.d/svnserve
chown all files in the repos to svnserve user
then chmod-ed the db files read/write
configured the file
[general]
### These options control access to the repository for unauthenticated
### and authenticated users. Valid values are "write", "read",
### and "none". The sample settings below are the defaults.
anon-access = write
auth-access = write
Monday, November 13, 2006
state machine fun!
BeginStateMachine
OnMsg(MSG_PrintError)
setState(STATE_Down);
State(STATE_Initialize)
OnEnter
if (paper_count <= 10)
setState(STATE_PaperLow);
else if (paper_count <= 0)
setState(STATE_PaperOut);
else
setState(STATE_Ready);
State(STATE_Ready)
OnEnter
// let device know
OnMsg(MSG_Print)
// print
setState(STATE_Print);
State(STATE_Print)
OnEnter
// let device know
// start printing
OnUpdate
// loop till printing is done
// maybe communicate with device to get progress
if (printing is done)
{
// decrement paper count
if (paper_count <= 10)
setState(STATE_PaperLow);
else if (paper_count <= 0)
setState(STATE_PaperOut);
}
OnExit
// do clean up for/with device
State(STATE_PaperLow)
OnEnter
// let device know
OnMsg(MSG_Print)
// print
setState(STATE_Print);
State(STATE_PaperOut)
OnEnter
// let device know
OnMsg(MSG_Print)
// return error message
setState(STATE_Down);
State(STATE_Down)
OnEnter
// let device know
OnMsg(MSG_Print)
// return error message
EndStateMachine
OnMsg(MSG_PrintError)
setState(STATE_Down);
State(STATE_Initialize)
OnEnter
if (paper_count <= 10)
setState(STATE_PaperLow);
else if (paper_count <= 0)
setState(STATE_PaperOut);
else
setState(STATE_Ready);
State(STATE_Ready)
OnEnter
// let device know
OnMsg(MSG_Print)
setState(STATE_Print);
State(STATE_Print)
OnEnter
// let device know
// start printing
OnUpdate
// loop till printing is done
// maybe communicate with device to get progress
if (printing is done)
{
// decrement paper count
if (paper_count <= 10)
setState(STATE_PaperLow);
else if (paper_count <= 0)
setState(STATE_PaperOut);
}
OnExit
// do clean up for/with device
State(STATE_PaperLow)
OnEnter
// let device know
OnMsg(MSG_Print)
setState(STATE_Print);
State(STATE_PaperOut)
OnEnter
// let device know
OnMsg(MSG_Print)
// return error message
setState(STATE_Down);
State(STATE_Down)
OnEnter
// let device know
OnMsg(MSG_Print)
// return error message
EndStateMachine
Thursday, November 09, 2006
ndiswrapper
ndiswrapper on Debian Sarge without having to compile anything
Written by MikeZila - 2005-06-13 20:40
Originally, I was trying to get the ndiswrapper source to compile with the stock Debian Sarge kernel. This didn't work because the kernel headers were absent. Even after installing them, compile failed with obscure errors. Getting the source didn't help either. Still no dice. I read around places and found that the kernel that comes with Debian Sarge has problems with ndiswrapper under certain situations. I made the safe assumption that I somehow had one of these "situations", and set out to get a new kernel.
You need a new kernel, but not to fear. The almighty apt-get has you covered from start to finish.
From this point on are instructions on how to get a new kernel and then get ndiswrapper playing ball with it. If you're unwilling to update your kernel, you can stop reading now. Please note that this kernel upgrade is very easy. There is no compile process and the whole deal takes about fifteen minutes; it isn't the usual kernel compile rigmarole. Also, it's totally safe to do the following. When the new kernel is installed, it makes an additional entry in your boot loader, it doesn't replace your current one. You're not stuck if it doesn't work.
Before we start, you should know that this guide assumes you're using a 686 CPU. Something like a P4, a P4 based Celeron, Pentium3, a PentiumPro, or similar. AMD Athlon people should be okay as well. Those with 64bit processors can try, but I have no idea if it will work. If your using a 586 or older, just replace every 686 in this guide with a 386. Everything will still work the same.
Ready? Let's do it.
First, you need to grab a new kernel. One is compiled and waiting for you in the apt repository. Do...
apt-get install kernel-image-2.6.8-2-686
It will download the deb containing the kernel and work it's magic. Before you know it a new kernel will be all setup and your boot loader will be configured with a new entry to boot it. Cool, huh? Your previous kernel and boot loader entry are preserved so you can boot it anytime you like.
Reboot and choose your new kernel at the bootmenu.
Now we'll grab the wireless-tools package. This will let us setup our card once it's working. You guessed it, apt-get has us covered.
apt-get install wireless-tools
The wireless tools will be downloaded and installed. You can check that they are by typing "iwconfig" and seeing if it gives you any output. It won't tell us anything good now, but it'll come in very handy later. Now we need to grab the ndiswrapper itself. Do...
apt-get install ndiswrapper-modules-2.6.8-2-686
If it suggests you install additional packages (it should suggest ndiswrapper-utils), type "Y" and hit enter to agree. It will download and install the packages. When it's done, try...
ndiswrapper -l
You should get a notice saying that no drivers are installed. This is normal, as we haven't yet given it the WindowsXP drivers to wrap. If you get a command not found error, then the ndiswrapper-utils package either wasn't suggested during the ndiswrapper-module install, or it failed for some reason. If it wasn't suggested (it was suggested to me), you can just get it yourself with...
apt-get install ndiswrapper-utils
Now try the "ndiswrapper -l" again. You should get the no drivers notice.
Now it's time to fix that no drivers notice. Get a hold of the WindowsXP drivers for your card. Don't use drivers included on the CD that came with your card, they won't work 99% of the time, and sometimes they cause kernel panics or other nasty things. Best to play it safe and grab the drivers known to work with your card. Go to the official ndiswrapper card list located here. Once you've got them, extract the driver files someplace (it doesn't matter where) and do the following in that directory. You'll need to run a...
ndiswrapper -i DRIVER.inf
..for a each .inf file required by your card. Usually you only need one. Your card's entry in the ndiswrapper card listing will tell you if you need more than one. I happen to need three. Once you have all the .inf files you need installed, you should do a...
ndiswrapper -l
...and check the output to make sure you see something like:
Installed ndis drivers:
lsbcmnds driver present
lsipnds driver present, hardware present
wmp11nds driver present
Your drivers will be have different names, and you may have more or less drivers installed. The important thing is that one of them says "hardware present". If you see a "hardware not present" you probably have bad drivers. If you see "cant see hardware", then you don't have wireless-tools. You should have downloaded them earlier in this guide, but if for some reason you didn't, just...
apt-get install wireless-tools
...and try "ndiswrapper -l" again. If all is well, move on.
It's time to load the module. Well, sorta. Remember installing the ndiswrapper-module package? It didn't actually install a module, but it did give us an ndiswrapper.ko, and that will work just as well.
You'll do this the old-school way...
insmod lib/modules/`uname -r`/misc/ndiswrapper.ko
The " ` " marks around "uname -r" aren't the " ' " next to your enter key, they're next to the " 1 " key, at the top left.
Doing this command probably won't give you any output, but it will give you the functionality of the ndiswrapper module. Now try...
iwconfig
You should now have an entry called "wlan0", and a bunch of information about it. If you see something like this...
wlan0 IEEE 802.11b ESSID:off/any
Mode:Managed Frequency:2.437 GHz Access Point: 00:40:05:C5:4E:03
Bit Rate:11 Mb/s Tx-Power:17 dBm
RTS thr:2347 B Fragment thr:2346 B
Encryption key:off
Power Management:off
Link Quality:100/100 Signal level:-69 dBm Noise level:-256 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:54 Invalid misc:512 Missed beacon:0
...then you're good to go. You may have additional entires without wireless extensions in the output, but this is normal.
Congratulations! Your card is up and running in Linux! Now to get it configured so you can be on your way. It's is simple enough.
At this point I recommend you turn off the ethernet connection. It can cause problems with the wlan0 interface if it's running when you try to configure the wireless card. Do...
ifdown eth0
If you've been using an ethernet connection to download the packages we've been installing, it will be lost. If for any reason you want it back, just...
ifup eth0
dhclient eth0
...and you'll be back to normal.
We'll get your new wireless running post haste. First we should make sure your AP (your wireless router or access point) is configured to have open access. Turn off WEP/WAP in your router or AP's configuration for the time being. Now let's set your SSID on the wireless card. It's simple. Do...
iwconfig wlan0 essid yourssidgoeshere
That will set the ssid. You won't get any feedback, but this is normal. Now run "iwconfig" again and check the ESSID in the top right of the block of information about your wireless card. It should no longer say "off/any", but the SSID you configured it to use. If it doesn't, try the command a few more times. Move your computer a little, do whatever you would normally do to get better signal. If "off/any" changed to your ssid, then you're good to go.
You don't have to bring up the wlan0 interface, but you do need to get an IP. Do...
dhclient wlan0
A bunch of stuff will go by, and at the end you'll either have errors, a long wait, or an IP on your network. If you get errors, then obviously something is wrong. Check the error and your system logs and hunt down the wrench in the works. If you get a long wait, your card is probably not talking to the router like it should, look in your logs and see if you can find out what's holding things up, it could just be that you aren't getting good signal. If you get no errors, and things finish in a reasonable time, you should be done. Open up a web browser and see if you can get to Google. If it works, then you're cooking with lasers, and everything is kosher. Congratulations!
If you want to make bringing up your wireless easy (this guide doesn't configure the ndiswrapper in a way that can be auto-loaded via normal means) dump the following in a text file and name it "loadwireless.sh". (really you can name it anything you want, just keep the .sh at the end) Make sure to put your ssid in place of "yourssidgoeshere"
#!/bin/sh
ifdown eth0
insmod /lib/modules/`uname -r`/misc/ndiswrapper.ko
sleep 2
iwconfig wlan0 essid yourssidgoeshere
sleep 2
iwconfig
chmod it executable and run it as root to bring your wireless up. If after several entries of "iwconfig" you still don't get your SSID set, try entering the config command again manually. Your card may not have started up in time to catch the command in the script. Just enter...
iwconfig wlan0 essid yourssidgoeshere
I'm sure there's a way to get this to be run automatically, but I'm done with my major accomplishments for the day. I'm cool just running this as root once the system is up and running. You don't have to be exclusively logged in as root for it to work, a root console in a normal user session will do fine.
That's all, folks. Post problems if you have them and I'll try to help you out. I'll do my very best, but keep in mind that I'm not a genius at this, I just happened to discover a correct way via experimentation and research. Like I said, ask and I'll try to help. I'm a nice guy, so don't be afraid to ask, no matter how small or large the question.
Thanks for reading my guide!
previous
up
Ndiswrapper in Fedora Core 5
Bookmark this post with:
delicious | digg | reddit | furl | google | yahoo
61 comments | Discuss Article | printer-friendly version
By martinj on Thu, 2005-06-16 11:58
This crashes my PC. I am running IPW2100
I do apt-get install ndiswrapper-modules-2.6.8-2-386
apt-get install ndiswrapper-utils
ndiswrapper -i w70n51.inf
ndiswrapper -l and it says the hardware is found
I do
apt-get install wireless-tools
ok
I do cd // and
insmod lib/modules/`uname -r`/misc/ndiswrapper.ko
and then it crashes
reply
Written by MikeZila - 2005-06-13 20:40
Originally, I was trying to get the ndiswrapper source to compile with the stock Debian Sarge kernel. This didn't work because the kernel headers were absent. Even after installing them, compile failed with obscure errors. Getting the source didn't help either. Still no dice. I read around places and found that the kernel that comes with Debian Sarge has problems with ndiswrapper under certain situations. I made the safe assumption that I somehow had one of these "situations", and set out to get a new kernel.
You need a new kernel, but not to fear. The almighty apt-get has you covered from start to finish.
From this point on are instructions on how to get a new kernel and then get ndiswrapper playing ball with it. If you're unwilling to update your kernel, you can stop reading now. Please note that this kernel upgrade is very easy. There is no compile process and the whole deal takes about fifteen minutes; it isn't the usual kernel compile rigmarole. Also, it's totally safe to do the following. When the new kernel is installed, it makes an additional entry in your boot loader, it doesn't replace your current one. You're not stuck if it doesn't work.
Before we start, you should know that this guide assumes you're using a 686 CPU. Something like a P4, a P4 based Celeron, Pentium3, a PentiumPro, or similar. AMD Athlon people should be okay as well. Those with 64bit processors can try, but I have no idea if it will work. If your using a 586 or older, just replace every 686 in this guide with a 386. Everything will still work the same.
Ready? Let's do it.
First, you need to grab a new kernel. One is compiled and waiting for you in the apt repository. Do...
apt-get install kernel-image-2.6.8-2-686
It will download the deb containing the kernel and work it's magic. Before you know it a new kernel will be all setup and your boot loader will be configured with a new entry to boot it. Cool, huh? Your previous kernel and boot loader entry are preserved so you can boot it anytime you like.
Reboot and choose your new kernel at the bootmenu.
Now we'll grab the wireless-tools package. This will let us setup our card once it's working. You guessed it, apt-get has us covered.
apt-get install wireless-tools
The wireless tools will be downloaded and installed. You can check that they are by typing "iwconfig" and seeing if it gives you any output. It won't tell us anything good now, but it'll come in very handy later. Now we need to grab the ndiswrapper itself. Do...
apt-get install ndiswrapper-modules-2.6.8-2-686
If it suggests you install additional packages (it should suggest ndiswrapper-utils), type "Y" and hit enter to agree. It will download and install the packages. When it's done, try...
ndiswrapper -l
You should get a notice saying that no drivers are installed. This is normal, as we haven't yet given it the WindowsXP drivers to wrap. If you get a command not found error, then the ndiswrapper-utils package either wasn't suggested during the ndiswrapper-module install, or it failed for some reason. If it wasn't suggested (it was suggested to me), you can just get it yourself with...
apt-get install ndiswrapper-utils
Now try the "ndiswrapper -l" again. You should get the no drivers notice.
Now it's time to fix that no drivers notice. Get a hold of the WindowsXP drivers for your card. Don't use drivers included on the CD that came with your card, they won't work 99% of the time, and sometimes they cause kernel panics or other nasty things. Best to play it safe and grab the drivers known to work with your card. Go to the official ndiswrapper card list located here. Once you've got them, extract the driver files someplace (it doesn't matter where) and do the following in that directory. You'll need to run a...
ndiswrapper -i DRIVER.inf
..for a each .inf file required by your card. Usually you only need one. Your card's entry in the ndiswrapper card listing will tell you if you need more than one. I happen to need three. Once you have all the .inf files you need installed, you should do a...
ndiswrapper -l
...and check the output to make sure you see something like:
Installed ndis drivers:
lsbcmnds driver present
lsipnds driver present, hardware present
wmp11nds driver present
Your drivers will be have different names, and you may have more or less drivers installed. The important thing is that one of them says "hardware present". If you see a "hardware not present" you probably have bad drivers. If you see "cant see hardware", then you don't have wireless-tools. You should have downloaded them earlier in this guide, but if for some reason you didn't, just...
apt-get install wireless-tools
...and try "ndiswrapper -l" again. If all is well, move on.
It's time to load the module. Well, sorta. Remember installing the ndiswrapper-module package? It didn't actually install a module, but it did give us an ndiswrapper.ko, and that will work just as well.
You'll do this the old-school way...
insmod lib/modules/`uname -r`/misc/ndiswrapper.ko
The " ` " marks around "uname -r" aren't the " ' " next to your enter key, they're next to the " 1 " key, at the top left.
Doing this command probably won't give you any output, but it will give you the functionality of the ndiswrapper module. Now try...
iwconfig
You should now have an entry called "wlan0", and a bunch of information about it. If you see something like this...
wlan0 IEEE 802.11b ESSID:off/any
Mode:Managed Frequency:2.437 GHz Access Point: 00:40:05:C5:4E:03
Bit Rate:11 Mb/s Tx-Power:17 dBm
RTS thr:2347 B Fragment thr:2346 B
Encryption key:off
Power Management:off
Link Quality:100/100 Signal level:-69 dBm Noise level:-256 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:54 Invalid misc:512 Missed beacon:0
...then you're good to go. You may have additional entires without wireless extensions in the output, but this is normal.
Congratulations! Your card is up and running in Linux! Now to get it configured so you can be on your way. It's is simple enough.
At this point I recommend you turn off the ethernet connection. It can cause problems with the wlan0 interface if it's running when you try to configure the wireless card. Do...
ifdown eth0
If you've been using an ethernet connection to download the packages we've been installing, it will be lost. If for any reason you want it back, just...
ifup eth0
dhclient eth0
...and you'll be back to normal.
We'll get your new wireless running post haste. First we should make sure your AP (your wireless router or access point) is configured to have open access. Turn off WEP/WAP in your router or AP's configuration for the time being. Now let's set your SSID on the wireless card. It's simple. Do...
iwconfig wlan0 essid yourssidgoeshere
That will set the ssid. You won't get any feedback, but this is normal. Now run "iwconfig" again and check the ESSID in the top right of the block of information about your wireless card. It should no longer say "off/any", but the SSID you configured it to use. If it doesn't, try the command a few more times. Move your computer a little, do whatever you would normally do to get better signal. If "off/any" changed to your ssid, then you're good to go.
You don't have to bring up the wlan0 interface, but you do need to get an IP. Do...
dhclient wlan0
A bunch of stuff will go by, and at the end you'll either have errors, a long wait, or an IP on your network. If you get errors, then obviously something is wrong. Check the error and your system logs and hunt down the wrench in the works. If you get a long wait, your card is probably not talking to the router like it should, look in your logs and see if you can find out what's holding things up, it could just be that you aren't getting good signal. If you get no errors, and things finish in a reasonable time, you should be done. Open up a web browser and see if you can get to Google. If it works, then you're cooking with lasers, and everything is kosher. Congratulations!
If you want to make bringing up your wireless easy (this guide doesn't configure the ndiswrapper in a way that can be auto-loaded via normal means) dump the following in a text file and name it "loadwireless.sh". (really you can name it anything you want, just keep the .sh at the end) Make sure to put your ssid in place of "yourssidgoeshere"
#!/bin/sh
ifdown eth0
insmod /lib/modules/`uname -r`/misc/ndiswrapper.ko
sleep 2
iwconfig wlan0 essid yourssidgoeshere
sleep 2
iwconfig
chmod it executable and run it as root to bring your wireless up. If after several entries of "iwconfig" you still don't get your SSID set, try entering the config command again manually. Your card may not have started up in time to catch the command in the script. Just enter...
iwconfig wlan0 essid yourssidgoeshere
I'm sure there's a way to get this to be run automatically, but I'm done with my major accomplishments for the day. I'm cool just running this as root once the system is up and running. You don't have to be exclusively logged in as root for it to work, a root console in a normal user session will do fine.
That's all, folks. Post problems if you have them and I'll try to help you out. I'll do my very best, but keep in mind that I'm not a genius at this, I just happened to discover a correct way via experimentation and research. Like I said, ask and I'll try to help. I'm a nice guy, so don't be afraid to ask, no matter how small or large the question.
Thanks for reading my guide!
previous
up
Ndiswrapper in Fedora Core 5
Bookmark this post with:
delicious | digg | reddit | furl | google | yahoo
61 comments | Discuss Article | printer-friendly version
By martinj on Thu, 2005-06-16 11:58
This crashes my PC. I am running IPW2100
I do apt-get install ndiswrapper-modules-2.6.8-2-386
apt-get install ndiswrapper-utils
ndiswrapper -i w70n51.inf
ndiswrapper -l and it says the hardware is found
I do
apt-get install wireless-tools
ok
I do cd // and
insmod lib/modules/`uname -r`/misc/ndiswrapper.ko
and then it crashes
reply
belkin card
Configuring Belkin F5D6020 (Version 3.0) 802.11b wireless PCMCIA card on MandrakeLinux 10.1
Submitted by akkumar on Thu, 12/16/2004 - 05:15. General Interest | How-to | Quick Tips & Newbies | Distributions
I had bought a Belkin Wireless PCMCIA Card – F5D6020 (Version 3.0) recently and wanted to configure the same in my favourite Linux distribution.
I downloaded and installed the MandrakeLinux 10.1 distribution released recently to the public (on December 6 2004 ). To get the latest version of MandrakeLinux visit the home page of MandrakeLinux, here. If you have a DVD writer, go for the DVD image. It would be much easier to maintain instead of playing around with the 3 CDs .
The installation was a breeze with MandrakeLinux 10.1 identifying my PCMCIA card attached to my laptop while installing the system. It did not load the right module corresponding to the PCMCIA card, though. So I had to find the right module to get that done. I did not get the Linux device driver from the manufacturer, but I did have the Windows driver.
Thanks to the ndiswrapper project at sourceforge, I was able to use the Windows device driver (already installed on my dual-boot system) for my Linux distribution too. I downloaded the latest source code of ndiswrapper from its sourceforge project page . The version that I had downloaded was 0.12 released on November 24 2004. The project documentation available at the site was pretty much clear to get things done.
1. Compiling ndiswrapper:
To compile ndiswrapper, you would need the source code of the kernel. By default, the kernel source was not installed. I installed the kernel source corresponding to the 2.6 tree (kernel-source-2.6.8.1-12mdk, to be exact) .
[akkumar@localhost tmp]$ pwd
/home/akkumar/tmp
[akkumar@localhost tmp]$ tar xzvf ndiswrapper-0.12.tar.gz
[akkumar@localhost tmp]$ cd ndiswrapper-0.12
[akkumar@localhost ndiswrapper-0.12]$ make install
This would compile the ndiswrapper utility and compile the module to be loaded later to identify the device.
2. Copying the Windows device drivers:
By default, MandrakeLinux identifies the NTFS parititions on your hard disk used by Windows. I am running Windows XP, and I had already configured my wireless card for the operating system. The windows device driver corresponds to two files, namely an INF file and a SYS file. Search for the following files in your Windows directory. ( C:\Windows\System ) .
* Bel6020.inf
* Bel6020.sys
Copy the two files to a directory of your choice in linux, say /home/akkumar/tmp .
Now go ahead to configure this Windows device driver using ndiswrapper as follows.
[akkumar@localhost tmp]$ ndiswrapper-0.12/utils/ndiswrapper -i Bel6020.inf
This would install the device drivers. To check the status of your device drivers, invoke the following command.
[akkumar@localhost tmp]$ ndiswrapper-0.12/utils/ndiswrapper -l
You should see something like this:
Installed ndis drivers
bel6020 hardware present
3. Load Modules:
To load the module, invoke the following command.
[akkumar@localhost tmp]$ modprobe ndiswrapper
Use the 'dmesg' command to view the kernel log to see if everything works fine till now. Refer to this documentation on the site to double-check the same.
Assuming everything goes fine, all that needs to be done is to specify a wireless SSID to connect to.
4. Configuring the wireless interface:
If you know your wireless SSID correctly, invoke the following command.
[akkumar@localhost tmp]$ iwconfig wlan0 essid MYESSID
At this point, the LED on your wireless card should start glowing, if everything works fine till now.
Once this happens the network interface ought to be brought up.
[akkumar@localhost tmp]$ ifup wlan0
Wait for a couple of seconds and then, you should be connected to the network right now. So yes, we had indeed succcessfully configured our wireless card to work with MandrakeLinux 10.1 , thanks to the ndiswrapper utility.
» login or register to post comments
Great tutorial ;-)
Submitted by k4m3leon on Sun, 06/19/2005 - 18:59.
Great tutorial ;-)
» login or register to post comments
Submitted by akkumar on Thu, 12/16/2004 - 05:15. General Interest | How-to | Quick Tips & Newbies | Distributions
I had bought a Belkin Wireless PCMCIA Card – F5D6020 (Version 3.0) recently and wanted to configure the same in my favourite Linux distribution.
I downloaded and installed the MandrakeLinux 10.1 distribution released recently to the public (on December 6 2004 ). To get the latest version of MandrakeLinux visit the home page of MandrakeLinux, here. If you have a DVD writer, go for the DVD image. It would be much easier to maintain instead of playing around with the 3 CDs .
The installation was a breeze with MandrakeLinux 10.1 identifying my PCMCIA card attached to my laptop while installing the system. It did not load the right module corresponding to the PCMCIA card, though. So I had to find the right module to get that done. I did not get the Linux device driver from the manufacturer, but I did have the Windows driver.
Thanks to the ndiswrapper project at sourceforge, I was able to use the Windows device driver (already installed on my dual-boot system) for my Linux distribution too. I downloaded the latest source code of ndiswrapper from its sourceforge project page . The version that I had downloaded was 0.12 released on November 24 2004. The project documentation available at the site was pretty much clear to get things done.
1. Compiling ndiswrapper:
To compile ndiswrapper, you would need the source code of the kernel. By default, the kernel source was not installed. I installed the kernel source corresponding to the 2.6 tree (kernel-source-2.6.8.1-12mdk, to be exact) .
[akkumar@localhost tmp]$ pwd
/home/akkumar/tmp
[akkumar@localhost tmp]$ tar xzvf ndiswrapper-0.12.tar.gz
[akkumar@localhost tmp]$ cd ndiswrapper-0.12
[akkumar@localhost ndiswrapper-0.12]$ make install
This would compile the ndiswrapper utility and compile the module to be loaded later to identify the device.
2. Copying the Windows device drivers:
By default, MandrakeLinux identifies the NTFS parititions on your hard disk used by Windows. I am running Windows XP, and I had already configured my wireless card for the operating system. The windows device driver corresponds to two files, namely an INF file and a SYS file. Search for the following files in your Windows directory. ( C:\Windows\System ) .
* Bel6020.inf
* Bel6020.sys
Copy the two files to a directory of your choice in linux, say /home/akkumar/tmp .
Now go ahead to configure this Windows device driver using ndiswrapper as follows.
[akkumar@localhost tmp]$ ndiswrapper-0.12/utils/ndiswrapper -i Bel6020.inf
This would install the device drivers. To check the status of your device drivers, invoke the following command.
[akkumar@localhost tmp]$ ndiswrapper-0.12/utils/ndiswrapper -l
You should see something like this:
Installed ndis drivers
bel6020 hardware present
3. Load Modules:
To load the module, invoke the following command.
[akkumar@localhost tmp]$ modprobe ndiswrapper
Use the 'dmesg' command to view the kernel log to see if everything works fine till now. Refer to this documentation on the site to double-check the same.
Assuming everything goes fine, all that needs to be done is to specify a wireless SSID to connect to.
4. Configuring the wireless interface:
If you know your wireless SSID correctly, invoke the following command.
[akkumar@localhost tmp]$ iwconfig wlan0 essid MYESSID
At this point, the LED on your wireless card should start glowing, if everything works fine till now.
Once this happens the network interface ought to be brought up.
[akkumar@localhost tmp]$ ifup wlan0
Wait for a couple of seconds and then, you should be connected to the network right now. So yes, we had indeed succcessfully configured our wireless card to work with MandrakeLinux 10.1 , thanks to the ndiswrapper utility.
» login or register to post comments
Great tutorial ;-)
Submitted by k4m3leon on Sun, 06/19/2005 - 18:59.
Great tutorial ;-)
» login or register to post comments
Wednesday, November 08, 2006
subversion inplace checkin
From the Subversion FAQ:
http://subversion.tigris.org/faq.html#in-place-import
Suppose, for example, that you wanted to put some of /etc under version control inside your repository:
# svn mkdir file:///root/svn-repository/etc -m "Make a directory in the repository to correspond to /etc"
# cd /etc
# svn checkout file:///root/svn-repository/etc .
# svn add apache samba alsa X11
# svn commit -m "Initial version of my config files"
This takes advantage of a not-immediately-obvious feature of svn checkout: you can check out a directory from the repository directly into an existing directory. Here, we first make a new empty directory in the repository, and then check it out into /etc, transforming /etc into a working copy. Once that is done, you can use normal svn add commands to select files and subtrees to add to the repository.
There is an issue filed for enhancing svn import to be able to convert the imported tree to a working copy automatically; see issue 1328.
note on using rapid svn i found that using file:/// is better than file:// !
http://subversion.tigris.org/faq.html#in-place-import
Suppose, for example, that you wanted to put some of /etc under version control inside your repository:
# svn mkdir file:///root/svn-repository/etc -m "Make a directory in the repository to correspond to /etc"
# cd /etc
# svn checkout file:///root/svn-repository/etc .
# svn add apache samba alsa X11
# svn commit -m "Initial version of my config files"
This takes advantage of a not-immediately-obvious feature of svn checkout: you can check out a directory from the repository directly into an existing directory. Here, we first make a new empty directory in the repository, and then check it out into /etc, transforming /etc into a working copy. Once that is done, you can use normal svn add commands to select files and subtrees to add to the repository.
There is an issue filed for enhancing svn import to be able to convert the imported tree to a working copy automatically; see issue 1328.
note on using rapid svn i found that using file:/// is better than file:// !
Thursday, November 02, 2006
uic trick
want to make the implementation and header files
make a pro file with:
FORMS += form1.ui
this will cause
/usr/share/qt3/bin/uic form1.ui -o form1.h
/usr/share/qt3/bin/uic form1.ui -i form1.h -o form1.cpp
make a pro file with:
FORMS += form1.ui
this will cause
/usr/share/qt3/bin/uic form1.ui -o form1.h
/usr/share/qt3/bin/uic form1.ui -i form1.h -o form1.cpp
Monday, October 30, 2006
autoconf fun and games
i need to turn of optimization
discusses the following
http://wiki.inkscape.org/wiki/index.php/CompilingInkscape
Plain vanilla compilation is done as documented in INSTALL; ./autogen.sh (optionally); ./configure; make; su && make test; make install (optional). See INSTALL for more on that.
But if you're going to be doing a lot of development, there's some tricks and techniques you should know, to get best results.
1. Turn off optimization
2. Use ccache for faster compilation
3. Set up a separate build directory (nice for testing both gcc and g++, or cross compiling)
4. Use the -j N flag to optimize for the number of processors in your machine, with N = 1 + no. proc's
Example: Setting up both gcc and g++ build environments (in separate tree), and using ccache for faster compilations on a dual-processor machine, with no optimization, assuming /bin/bash:
mkdir build-gcc build-g++
cvs checkout inkscape
cd inkscape
libtoolize --copy --force
./autogen.sh
cd ../build-gcc
CFLAGS='-g -O0 -Wall' CC='ccache gcc' ../inkscape/configure
cd ../build-g++
CXXFLAGS='-g -O0 -Wall' CXX='ccache g++' ../inkscape/configure
cd ../build-gcc && make -j 3
cd ../build-g++ && make -j 3
Turning off just optimization (which can produce strange results in debuggers):
export CXXFLAGS='-g -O0 -Wall'
export CFLAGS='-g -O0 -Wall'
./configure
Retrieved from "http://wiki.inkscape.org/wiki/index.php/CompilingInkscape"
This page has been accessed 7,113 times. This page was last modified 21:45, 20 June 2006.
add to the file Makefile.am
bin_PROGRAMS = testxml
testxml_SOURCES = main.cpp
AM_CXXFLAGS = -g -O0 -Wall
CXXFLAGS=
SUBDIRS = tinyxml
LDADD = tinyxml/libtinyxml.a
discusses the following
http://wiki.inkscape.org/wiki/index.php/CompilingInkscape
Plain vanilla compilation is done as documented in INSTALL; ./autogen.sh (optionally); ./configure; make; su && make test; make install (optional). See INSTALL for more on that.
But if you're going to be doing a lot of development, there's some tricks and techniques you should know, to get best results.
1. Turn off optimization
2. Use ccache for faster compilation
3. Set up a separate build directory (nice for testing both gcc and g++, or cross compiling)
4. Use the -j N flag to optimize for the number of processors in your machine, with N = 1 + no. proc's
Example: Setting up both gcc and g++ build environments (in separate tree), and using ccache for faster compilations on a dual-processor machine, with no optimization, assuming /bin/bash:
mkdir build-gcc build-g++
cvs checkout inkscape
cd inkscape
libtoolize --copy --force
./autogen.sh
cd ../build-gcc
CFLAGS='-g -O0 -Wall' CC='ccache gcc' ../inkscape/configure
cd ../build-g++
CXXFLAGS='-g -O0 -Wall' CXX='ccache g++' ../inkscape/configure
cd ../build-gcc && make -j 3
cd ../build-g++ && make -j 3
Turning off just optimization (which can produce strange results in debuggers):
export CXXFLAGS='-g -O0 -Wall'
export CFLAGS='-g -O0 -Wall'
./configure
Retrieved from "http://wiki.inkscape.org/wiki/index.php/CompilingInkscape"
This page has been accessed 7,113 times. This page was last modified 21:45, 20 June 2006.
add to the file Makefile.am
bin_PROGRAMS = testxml
testxml_SOURCES = main.cpp
AM_CXXFLAGS = -g -O0 -Wall
CXXFLAGS=
SUBDIRS = tinyxml
LDADD = tinyxml/libtinyxml.a
getopts example
http://www.siit.tu.ac.th/mdailey/class/2003_s2/its225/assignments/testopts.c:
/*
* testopts.c: example usage for getopt command line parsing
* library.
*
* Matt Dailey, Feb 2004
*
* Compile with "gcc testopt.c" to get executable a.out.
*
* This example program takes arguments of the following form:
*
* a.out [-ac] [-b] arg1 arg2 ...
*
* That is, a.out has three optional options -a, -b, and -c.
* -a and -c are standalone options, and -b is an option that
* takes a string argument.
*
* Valid invocations include:
*
* a.out
* a.out -a
* a.out -c
* a.out -b arg1
* a.out -ac
* a.out -b arg1 -ca
* a.out f1 f2 f3
* a.out -a f1 f2 f3
* a.out -ca f1 f2 f3
* a.out -ca f1 f2 -b arg1 f3
*
* and so on. What's nice is that the options and arguments
* can occur in any order.
*
* Also refer to "man 3 getopt"
*
*/
#include
#include
#include
#include
#define TRUE 1
#define FALSE 0
char *g_pCharProgramName = NULL;
int main( int argc, char *argv[] ) {
extern char *optarg;
extern int optind;
int this_opt;
int bOptA = FALSE;
int bOptB = FALSE;
int bOptC = FALSE;
char *pCharOptB = NULL;
g_pCharProgramName = argv[0];
/* Loop until all arguments are processed. On each pass, we
* call getopt() for the next option */
while ( 1 ) {
/* Get the next option. It is placed in this_opt. We pass
* the user-entered argc/argv and our option string. The
* option string "ab:c" says our program has options -a, -b,
* and -c. The -b option requires an argument (this is
* specified by the colon in 'b:'. */
this_opt = getopt( argc, argv, "ab:c" );
/* If there are no options left, getopt() returns -1. */
if ( this_opt == -1 ) break;
/* Now we have either a valid option or an invalid option.
* Check all possible cases. */
switch ( this_opt ) {
case 'a':
/* The user selected the -a option. Set a bool for later use. */
bOptA = TRUE;
break;
case 'b':
/* This is the -b option. Since we put b: in the getopt
* options string, option b has an argument. Let's save it */
bOptB = TRUE;
pCharOptB = strdup( optarg );
break;
case 'c':
/* -c is another simple option like -a. Just set a flag to
* not that the user selected it. */
bOptC = TRUE;
break;
default:
/* Error case.
*
* getopt() prints an invalid option message for you.
* Usually we now print a usage message. */
printf( "Usage: %s [-ac] [-b] [arg1] [arg2] ...\n",
g_pCharProgramName );
exit( -1 );
break;
}
}
/* Print out the options selected and not selected */
if ( bOptA ) {
printf( "Option A selected\n" );
} else {
printf( "Option A not selected\n" );
}
if ( bOptB ) {
printf( "Option B selected with argument %s\n", pCharOptB );
} else {
printf( "Option B not selected\n" );
}
if ( bOptC ) {
printf( "Option C selected\n" );
} else {
printf( "Option C not selected\n" );
}
/* Print out the non-option arguments. optind now indexes
* the first non-option argument in argv[]. */
while( optind < argc ) {
printf( "Got non-option argument %s\n", argv[optind] );
optind++;
}
/* Clean up */
if ( pCharOptB != NULL ) free( pCharOptB );
}
/*
* testopts.c: example usage for getopt command line parsing
* library.
*
* Matt Dailey, Feb 2004
*
* Compile with "gcc testopt.c" to get executable a.out.
*
* This example program takes arguments of the following form:
*
* a.out [-ac] [-b
*
* That is, a.out has three optional options -a, -b, and -c.
* -a and -c are standalone options, and -b is an option that
* takes a string argument.
*
* Valid invocations include:
*
* a.out
* a.out -a
* a.out -c
* a.out -b arg1
* a.out -ac
* a.out -b arg1 -ca
* a.out f1 f2 f3
* a.out -a f1 f2 f3
* a.out -ca f1 f2 f3
* a.out -ca f1 f2 -b arg1 f3
*
* and so on. What's nice is that the options and arguments
* can occur in any order.
*
* Also refer to "man 3 getopt"
*
*/
#include
#include
#include
#include
#define TRUE 1
#define FALSE 0
char *g_pCharProgramName = NULL;
int main( int argc, char *argv[] ) {
extern char *optarg;
extern int optind;
int this_opt;
int bOptA = FALSE;
int bOptB = FALSE;
int bOptC = FALSE;
char *pCharOptB = NULL;
g_pCharProgramName = argv[0];
/* Loop until all arguments are processed. On each pass, we
* call getopt() for the next option */
while ( 1 ) {
/* Get the next option. It is placed in this_opt. We pass
* the user-entered argc/argv and our option string. The
* option string "ab:c" says our program has options -a, -b,
* and -c. The -b option requires an argument (this is
* specified by the colon in 'b:'. */
this_opt = getopt( argc, argv, "ab:c" );
/* If there are no options left, getopt() returns -1. */
if ( this_opt == -1 ) break;
/* Now we have either a valid option or an invalid option.
* Check all possible cases. */
switch ( this_opt ) {
case 'a':
/* The user selected the -a option. Set a bool for later use. */
bOptA = TRUE;
break;
case 'b':
/* This is the -b option. Since we put b: in the getopt
* options string, option b has an argument. Let's save it */
bOptB = TRUE;
pCharOptB = strdup( optarg );
break;
case 'c':
/* -c is another simple option like -a. Just set a flag to
* not that the user selected it. */
bOptC = TRUE;
break;
default:
/* Error case.
*
* getopt() prints an invalid option message for you.
* Usually we now print a usage message. */
printf( "Usage: %s [-ac] [-b
g_pCharProgramName );
exit( -1 );
break;
}
}
/* Print out the options selected and not selected */
if ( bOptA ) {
printf( "Option A selected\n" );
} else {
printf( "Option A not selected\n" );
}
if ( bOptB ) {
printf( "Option B selected with argument %s\n", pCharOptB );
} else {
printf( "Option B not selected\n" );
}
if ( bOptC ) {
printf( "Option C selected\n" );
} else {
printf( "Option C not selected\n" );
}
/* Print out the non-option arguments. optind now indexes
* the first non-option argument in argv[]. */
while( optind < argc ) {
printf( "Got non-option argument %s\n", argv[optind] );
optind++;
}
/* Clean up */
if ( pCharOptB != NULL ) free( pCharOptB );
}
Friday, October 27, 2006
Better XConfiguration script that uses the ouput of xvidtune
Section "ServerLayout"
Identifier "XFree86 Configured"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "Files"
RgbPath "/usr/X11R6/lib/X11/rgb"
ModulePath "/usr/X11R6/lib/modules"
FontPath "/usr/X11R6/lib/X11/fonts/misc/"
FontPath "/usr/X11R6/lib/X11/fonts/Speedo/"
FontPath "/usr/X11R6/lib/X11/fonts/Type1/"
FontPath "/usr/X11R6/lib/X11/fonts/CID/"
FontPath "/usr/X11R6/lib/X11/fonts/75dpi/"
FontPath "/usr/X11R6/lib/X11/fonts/100dpi/"
EndSection
Section "Module"
Load "dbe"
Load "dri"
Load "extmod"
Load "glx"
Load "record"
Load "xtrap"
Load "speedo"
Load "type1"
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "keyboard"
EndSection
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
EndSection
Section "Monitor"
#DisplaySize 370 270 # mm
Identifier "Monitor0"
VendorName "VSC"
ModelName "A90-2"
Option "DPMS"
EndSection
#the following was derived from xvidtune
Section "Modes"
Identifier "Mode1"
Modeline "1280x1024" 157.50 1280 1344 1504 1728 1024 1025 1028 1072
Modeline "1280x960" 148.50 1280 1344 1504 1728 960 961 964 1011
Modeline "1024x768" 94.50 1024 1072 1168 1376 768 769 772 808
EndSection
Section "Device"
### Available Driver options are:-
### Values: : integer,: float, : "True"/"False",
###: "String", : " Hz/kHz/MHz"
### [arg]: arg optional
#Option "NoAccel" # []
#Option "SWcursor" # []
#Option "Dac6Bit" # []
#Option "Dac8Bit" # []
#Option "ForcePCIMode" # []
#Option "BusType" # []
#Option "CPPIOMode" # []
#Option "CPusecTimeout" #
#Option "AGPMode" #
#Option "AGPFastWrite" # []
#Option "AGPSize" #
#Option "GARTSize" #
#Option "RingSize" #
#Option "BufferSize" #
#Option "EnableDepthMoves" # []
#Option "EnablePageFlip" # []
#Option "NoBackBuffer" # []
#Option "PanelOff" # []
#Option "DDCMode" # []
#Option "MonitorLayout" # []
#Option "IgnoreEDID" # []
#Option "OverlayOnCRTC2" # []
#Option "CloneMode" # []
#Option "CloneHSync" # []
#Option "CloneVRefresh" # []
#Option "UseFBDev" # []
#Option "VideoKey" #
#Option "DisplayPriority" # []
#Option "PanelSize" # []
#Option "ForceMinDotClock" #
Identifier "Card0"
Driver "ati"
VendorName "ATI Technologies Inc"
BoardName "Radeon R250 Lf [Radeon Mobility 9000 M9]"
BusID "PCI:1:0:0"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
DefaultColorDepth 16
# i added this section
SubSection "Display"
Depth 8
Modes "1280x1024" "1024x768" "800x600" "640x480" "640x400"
EndSubSection
SubSection "Display"
Depth 15
Modes "1280x1024" "1152x864" "1024x768" "800x600" "640x480" "640x400" "512x384" "480x300" "400x300" "320x240" "320x200"
EndSubSection
SubSection "Display"
Depth 16
Modes "1280x1024" "1024x768" "800x600" "640x480" "640x400"
EndSubSection
SubSection "Display"
Depth 24
Modes "1280x1024" "1152x864" "1024x768" "800x600" "640x480" "640x400" "512x384" "480x300" "400x300" "320x240" "320x200"
EndSubSection
SubSection "Display"
Depth 32
Modes "1280x1024" "1152x864" "1024x768" "800x600" "640x480" "640x400" "512x384" "480x300" "400x300" "320x240" "320x200"
EndSubSection
EndSection
Identifier "XFree86 Configured"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "Files"
RgbPath "/usr/X11R6/lib/X11/rgb"
ModulePath "/usr/X11R6/lib/modules"
FontPath "/usr/X11R6/lib/X11/fonts/misc/"
FontPath "/usr/X11R6/lib/X11/fonts/Speedo/"
FontPath "/usr/X11R6/lib/X11/fonts/Type1/"
FontPath "/usr/X11R6/lib/X11/fonts/CID/"
FontPath "/usr/X11R6/lib/X11/fonts/75dpi/"
FontPath "/usr/X11R6/lib/X11/fonts/100dpi/"
EndSection
Section "Module"
Load "dbe"
Load "dri"
Load "extmod"
Load "glx"
Load "record"
Load "xtrap"
Load "speedo"
Load "type1"
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "keyboard"
EndSection
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
EndSection
Section "Monitor"
#DisplaySize 370 270 # mm
Identifier "Monitor0"
VendorName "VSC"
ModelName "A90-2"
Option "DPMS"
EndSection
#the following was derived from xvidtune
Section "Modes"
Identifier "Mode1"
Modeline "1280x1024" 157.50 1280 1344 1504 1728 1024 1025 1028 1072
Modeline "1280x960" 148.50 1280 1344 1504 1728 960 961 964 1011
Modeline "1024x768" 94.50 1024 1072 1168 1376 768 769 772 808
EndSection
Section "Device"
### Available Driver options are:-
### Values: : integer,
###
### [arg]: arg optional
#Option "NoAccel" # [
#Option "SWcursor" # [
#Option "Dac6Bit" # [
#Option "Dac8Bit" # [
#Option "ForcePCIMode" # [
#Option "BusType" # [
#Option "CPPIOMode" # [
#Option "CPusecTimeout" #
#Option "AGPMode" #
#Option "AGPFastWrite" # [
#Option "AGPSize" #
#Option "GARTSize" #
#Option "RingSize" #
#Option "BufferSize" #
#Option "EnableDepthMoves" # [
#Option "EnablePageFlip" # [
#Option "NoBackBuffer" # [
#Option "PanelOff" # [
#Option "DDCMode" # [
#Option "MonitorLayout" # [
#Option "IgnoreEDID" # [
#Option "OverlayOnCRTC2" # [
#Option "CloneMode" # [
#Option "CloneHSync" # [
#Option "CloneVRefresh" # [
#Option "UseFBDev" # [
#Option "VideoKey" #
#Option "DisplayPriority" # [
#Option "PanelSize" # [
#Option "ForceMinDotClock" #
Identifier "Card0"
Driver "ati"
VendorName "ATI Technologies Inc"
BoardName "Radeon R250 Lf [Radeon Mobility 9000 M9]"
BusID "PCI:1:0:0"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
DefaultColorDepth 16
# i added this section
SubSection "Display"
Depth 8
Modes "1280x1024" "1024x768" "800x600" "640x480" "640x400"
EndSubSection
SubSection "Display"
Depth 15
Modes "1280x1024" "1152x864" "1024x768" "800x600" "640x480" "640x400" "512x384" "480x300" "400x300" "320x240" "320x200"
EndSubSection
SubSection "Display"
Depth 16
Modes "1280x1024" "1024x768" "800x600" "640x480" "640x400"
EndSubSection
SubSection "Display"
Depth 24
Modes "1280x1024" "1152x864" "1024x768" "800x600" "640x480" "640x400" "512x384" "480x300" "400x300" "320x240" "320x200"
EndSubSection
SubSection "Display"
Depth 32
Modes "1280x1024" "1152x864" "1024x768" "800x600" "640x480" "640x400" "512x384" "480x300" "400x300" "320x240" "320x200"
EndSubSection
EndSection
Thursday, October 26, 2006
setting up the kernel and the modules.
the kernel goes here
/boot/xxxkernel
you need to modify the /boot/grub/menu.lst
to have the following entry.
i just place this at the top of the previous
entries.
title sasKernel from xxxx
root (hd0,0)
kernel /boot/xxxkernel root=/dev/hdc1 ro single
savedefault
boot
notice that this is a 2.6 kernel and has kernel modules
the modules start-up is dependent on the file
/etc/modules:
------------------------------------------------------------------
# /etc/modules: kernel modules to load at boot time.
#
# This file should contain the names of kernel modules that are
# to be loaded at boot time, one per line. Comments begin with
# a "#", and everything on the line after them are ignored.
ide-cd
ide-detect
ide-disk
psmouse
sd_mod
sr_mod
## i added these.
radeon
sis
8250
serial_core
-----------------------------------------------------------------
these files are in /lib/modules/2.6.10-xxx/kernel
./drivers
./drivers/char
./drivers/char/drm
./drivers/char/drm/radeon.ko
./drivers/char/drm/sis.ko
./drivers/serial
./drivers/serial/8250.ko
./drivers/serial/serial_core.ko
/boot/xxxkernel
you need to modify the /boot/grub/menu.lst
to have the following entry.
i just place this at the top of the previous
entries.
title sasKernel from xxxx
root (hd0,0)
kernel /boot/xxxkernel root=/dev/hdc1 ro single
savedefault
boot
notice that this is a 2.6 kernel and has kernel modules
the modules start-up is dependent on the file
/etc/modules:
------------------------------------------------------------------
# /etc/modules: kernel modules to load at boot time.
#
# This file should contain the names of kernel modules that are
# to be loaded at boot time, one per line. Comments begin with
# a "#", and everything on the line after them are ignored.
ide-cd
ide-detect
ide-disk
psmouse
sd_mod
sr_mod
## i added these.
radeon
sis
8250
serial_core
-----------------------------------------------------------------
these files are in /lib/modules/2.6.10-xxx/kernel
./drivers
./drivers/char
./drivers/char/drm
./drivers/char/drm/radeon.ko
./drivers/char/drm/sis.ko
./drivers/serial
./drivers/serial/8250.ko
./drivers/serial/serial_core.ko
bootlogd
i have added bootlogd start to my rc0 start up script
debian:/etc/rc0.d# ls -l S*boot*
lrwxr-xr-x 1 root root 18 2006-10-26 10:41 S00bootlogd -> ../init.d/bootlogd
lets see if this can log everything.
here is so more information i found out about bootlogd
the init script i set up in /etc/rcS.d no in the above /etc/rc0.d
and this guy at http://www.timhardy.net/wordpress/2005/12/11/enabling-bootlogd-on-debian-31/
had the following to say:
Enabling Bootlogd on Debian 3.1
Bootlogd does not work out of the box on Debian 3.1 with a 2.6.8 kernel. If you enable it by setting the option to yes in /etc/default/bootlogd you’ll see the error message bootlogd: ioctl (/dev/ttyzf, TIOCCONS): Bad file descriptor scroll by on boot and the log is not created.
The problem lies with the version of udev used in Debian stable.
One solution is to upgrade the udev package to one from testing or unstable but that is not acceptable to someone who wants a pure system.
The alternative is to move the order the scripts are executed in /etc/rcS.d/. Remember, execution order is determined by the number in the filename so by renaming the bootlogd launching script you can get it to run before the udev script S04udev
mv /etc/rcS.d/S05bootlogd /etc/rcS.d/S03bootlogd-was-S05
The next time you boot, the log will be enabled for reading in /var/log/boot.
(Solution by Frans Pop on the debian-laptop mailing list)
then you need to change the /etc/default/bootlogd file look like
-----------------------------------------------------------------
# Run bootlogd at startup ?
BOOTLOGD_ENABLE=YES
debian:/etc/rc0.d# ls -l S*boot*
lrwxr-xr-x 1 root root 18 2006-10-26 10:41 S00bootlogd -> ../init.d/bootlogd
lets see if this can log everything.
here is so more information i found out about bootlogd
the init script i set up in /etc/rcS.d no in the above /etc/rc0.d
and this guy at http://www.timhardy.net/wordpress/2005/12/11/enabling-bootlogd-on-debian-31/
had the following to say:
Enabling Bootlogd on Debian 3.1
Bootlogd does not work out of the box on Debian 3.1 with a 2.6.8 kernel. If you enable it by setting the option to yes in /etc/default/bootlogd you’ll see the error message bootlogd: ioctl (/dev/ttyzf, TIOCCONS): Bad file descriptor scroll by on boot and the log is not created.
The problem lies with the version of udev used in Debian stable.
One solution is to upgrade the udev package to one from testing or unstable but that is not acceptable to someone who wants a pure system.
The alternative is to move the order the scripts are executed in /etc/rcS.d/. Remember, execution order is determined by the number in the filename so by renaming the bootlogd launching script you can get it to run before the udev script S04udev
mv /etc/rcS.d/S05bootlogd /etc/rcS.d/S03bootlogd-was-S05
The next time you boot, the log will be enabled for reading in /var/log/boot.
(Solution by Frans Pop on the debian-laptop mailing list)
then you need to change the /etc/default/bootlogd file look like
-----------------------------------------------------------------
# Run bootlogd at startup ?
BOOTLOGD_ENABLE=YES
Friday, October 20, 2006
Tuesday, October 17, 2006
autoconf
http://www.openismus.com/documents/linux/automake/automake.shtml
great little tutorial.
here is what tools i needed to install.
ii autoconf 2.59a-3 automatic configure script builder
ii autogen 5.6.6-2 an automated text file generator
ii automake1.4 1.4-p6-9 A tool for generating GNU Standards-complian
ii autoproject 0.17-1 create a skeleton source package for a new p
ii autotools-dev 20050422.1 Update infrastructure for config.{guess,sub}
ii libtool 1.5.6-6 Generic library support script
great little tutorial.
here is what tools i needed to install.
ii autoconf 2.59a-3 automatic configure script builder
ii autogen 5.6.6-2 an automated text file generator
ii automake1.4 1.4-p6-9 A tool for generating GNU Standards-complian
ii autoproject 0.17-1 create a skeleton source package for a new p
ii autotools-dev 20050422.1 Update infrastructure for config.{guess,sub}
ii libtool 1.5.6-6 Generic library support script
Friday, October 13, 2006
yo dude im back!
working on a debian system whoopte fucking do!
here is a working XF86Config-4:
------------------------------------------------------------------------------
# XF86Config-4 (XFree86 X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the XF86Config-4 manual page.
# (Type "man XF86Config-4" at the shell prompt.)
#
# This file is automatically updated on xserver-xfree86 package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xfree86
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following commands as root:
#
# cp /etc/X11/XF86Config-4 /etc/X11/XF86Config-4.custom
# md5sum /etc/X11/XF86Config-4 >/var/lib/xfree86/XF86Config-4.md5sum
# dpkg-reconfigure xserver-xfree86
Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen" 0 0
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
EndSection
Section "Files"
# local font server
# if the local font server has problems, we can fall back on these
FontPath "unix/:7100"
FontPath "/usr/lib/X11/fonts/misc"
FontPath "/usr/lib/X11/fonts/cyrillic"
FontPath "/usr/lib/X11/fonts/100dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/75dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/Type1"
FontPath "/usr/lib/X11/fonts/CID"
FontPath "/usr/lib/X11/fonts/Speedo"
FontPath "/usr/lib/X11/fonts/100dpi"
FontPath "/usr/lib/X11/fonts/75dpi"
EndSection
Section "Module"
Load "GLcore"
Load "bitmap"
Load "dbe"
Load "ddc"
Load "dri"
Load "extmod"
Load "freetype"
Load "glx"
Load "int10"
Load "record"
Load "speedo"
Load "type1"
Load "vbe"
EndSection
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "keyboard"
Option "CoreKeyboard"
Option "XkbRules" "xfree86"
Option "XkbModel" "pc104"
Option "XkbLayout" "us"
EndSection
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ImPS/2"
Option "Emulate3Buttons" "true"
Option "ZAxisMapping" "4 5"
EndSection
Section "Monitor"
Identifier "Generic Monitor"
HorizSync 31.5 - 64.3
VertRefresh 50.0 - 70.0
Option "DPMS"
EndSection
Section "Device"
Identifier "Generic Video Card"
Driver "ati"
EndSection
Section "Screen"
Identifier "Default Screen"
Device "Generic Video Card"
Monitor "Generic Monitor"
DefaultDepth 15
SubSection "Display"
Depth 1
Modes "1280x960" "1152x864" "1024x768"
EndSubSection
SubSection "Display"
Depth 4
Modes "1280x960" "1152x864" "1024x768"
EndSubSection
SubSection "Display"
Depth 8
Modes "1280x960"
EndSubSection
SubSection "Display"
Depth 15
Modes "1280x960"
EndSubSection
SubSection "Display"
Depth 16
Modes "1280x960" "1152x864" "1024x768"
EndSubSection
SubSection "Display"
Depth 24
Modes "1280x960"
EndSubSection
EndSection
Section "Screen"
Identifier "Screen1"
Device "Generic Video Card"
Monitor "Generic Monitor"
DefaultDepth 8
SubSection "Display"
Depth 8
Modes "1280x1024"
EndSubSection
EndSection
Section "DRI"
Mode 0666
EndSection
-----------------------------------------------------------------------------
i am going to provide a list of the basic packages
emacs21_21.4a-1_i386.deb
kde_5%3a44_all.deb
less_382-1_i386.deb
links2_2.1pre16-1_i386.deb
mc_1%3a4.6.0-4.6.1-pre3-3sarge1_i386.deb
mozilla_2%3a1.7.8-1sarge7.1_i386.deb
resolvconf_1.28_all.deb
xbase-clients_4.3.0.dfsg.1-14sarge1_i386.deb
xchat_2.4.1-0.1_i386.deb
x-window-system_4.3.0.dfsg.1-14sarge1_all.deb
x-window-system-core_4.3.0.dfsg.1-14sarge1_i386.deb
----------------------------------------------------------------------------
i had to change some things to get nameserver in the conf file
/etc/resolv.conf to work correctly.
----------------------------------------------------------------------------
to install the kernel:
apt-get install kernel-package build-essential libncurses5-dev
and follow the instructions in /usr/share/doc/kernel-package/README.gz;
You should also ask me about 'make-kpkg' and 'kp mantra'
dpkg The kernel compilation mantra is make-kpkg clean && make-kpkg --revision=$(date +'%Y%m%d') --append-to-version=-$(hostname) --rootcmd fakeroot clean && make-kpkg --revision=$(date +'%Y%m%d') --append-to-version=-$(hostname) --rootcmd fakeroot kernel_image modules_image . Add --initrd before kernel_image if you need an initrd.
i took the quixant kernel sources and unpacked them in /usr/src/
the unpacke to the directory linux-2.6.10, i then mv-ed this to linux-2.6.10-qxt
and symbolicly linked this to /usr/src/linux
then i began the above process.
here is a working XF86Config-4:
------------------------------------------------------------------------------
# XF86Config-4 (XFree86 X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the XF86Config-4 manual page.
# (Type "man XF86Config-4" at the shell prompt.)
#
# This file is automatically updated on xserver-xfree86 package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xfree86
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following commands as root:
#
# cp /etc/X11/XF86Config-4 /etc/X11/XF86Config-4.custom
# md5sum /etc/X11/XF86Config-4 >/var/lib/xfree86/XF86Config-4.md5sum
# dpkg-reconfigure xserver-xfree86
Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen" 0 0
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
EndSection
Section "Files"
# local font server
# if the local font server has problems, we can fall back on these
FontPath "unix/:7100"
FontPath "/usr/lib/X11/fonts/misc"
FontPath "/usr/lib/X11/fonts/cyrillic"
FontPath "/usr/lib/X11/fonts/100dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/75dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/Type1"
FontPath "/usr/lib/X11/fonts/CID"
FontPath "/usr/lib/X11/fonts/Speedo"
FontPath "/usr/lib/X11/fonts/100dpi"
FontPath "/usr/lib/X11/fonts/75dpi"
EndSection
Section "Module"
Load "GLcore"
Load "bitmap"
Load "dbe"
Load "ddc"
Load "dri"
Load "extmod"
Load "freetype"
Load "glx"
Load "int10"
Load "record"
Load "speedo"
Load "type1"
Load "vbe"
EndSection
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "keyboard"
Option "CoreKeyboard"
Option "XkbRules" "xfree86"
Option "XkbModel" "pc104"
Option "XkbLayout" "us"
EndSection
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ImPS/2"
Option "Emulate3Buttons" "true"
Option "ZAxisMapping" "4 5"
EndSection
Section "Monitor"
Identifier "Generic Monitor"
HorizSync 31.5 - 64.3
VertRefresh 50.0 - 70.0
Option "DPMS"
EndSection
Section "Device"
Identifier "Generic Video Card"
Driver "ati"
EndSection
Section "Screen"
Identifier "Default Screen"
Device "Generic Video Card"
Monitor "Generic Monitor"
DefaultDepth 15
SubSection "Display"
Depth 1
Modes "1280x960" "1152x864" "1024x768"
EndSubSection
SubSection "Display"
Depth 4
Modes "1280x960" "1152x864" "1024x768"
EndSubSection
SubSection "Display"
Depth 8
Modes "1280x960"
EndSubSection
SubSection "Display"
Depth 15
Modes "1280x960"
EndSubSection
SubSection "Display"
Depth 16
Modes "1280x960" "1152x864" "1024x768"
EndSubSection
SubSection "Display"
Depth 24
Modes "1280x960"
EndSubSection
EndSection
Section "Screen"
Identifier "Screen1"
Device "Generic Video Card"
Monitor "Generic Monitor"
DefaultDepth 8
SubSection "Display"
Depth 8
Modes "1280x1024"
EndSubSection
EndSection
Section "DRI"
Mode 0666
EndSection
-----------------------------------------------------------------------------
i am going to provide a list of the basic packages
emacs21_21.4a-1_i386.deb
kde_5%3a44_all.deb
less_382-1_i386.deb
links2_2.1pre16-1_i386.deb
mc_1%3a4.6.0-4.6.1-pre3-3sarge1_i386.deb
mozilla_2%3a1.7.8-1sarge7.1_i386.deb
resolvconf_1.28_all.deb
xbase-clients_4.3.0.dfsg.1-14sarge1_i386.deb
xchat_2.4.1-0.1_i386.deb
x-window-system_4.3.0.dfsg.1-14sarge1_all.deb
x-window-system-core_4.3.0.dfsg.1-14sarge1_i386.deb
----------------------------------------------------------------------------
i had to change some things to get nameserver in the conf file
/etc/resolv.conf to work correctly.
----------------------------------------------------------------------------
to install the kernel:
apt-get install kernel-package build-essential libncurses5-dev
and follow the instructions in /usr/share/doc/kernel-package/README.gz;
You should also ask me about 'make-kpkg' and 'kp mantra'
dpkg The kernel compilation mantra is make-kpkg clean && make-kpkg --revision=$(date +'%Y%m%d') --append-to-version=-$(hostname) --rootcmd fakeroot clean && make-kpkg --revision=$(date +'%Y%m%d') --append-to-version=-$(hostname) --rootcmd fakeroot kernel_image modules_image . Add --initrd before kernel_image if you need an initrd.
i took the quixant kernel sources and unpacked them in /usr/src/
the unpacke to the directory linux-2.6.10, i then mv-ed this to linux-2.6.10-qxt
and symbolicly linked this to /usr/src/linux
then i began the above process.
Wednesday, May 10, 2006
cvs notes
Cvs notes:
Sandbox: A sandbox is a local copy of a project’s files.
Repository:
When you create a sandbox, you need to specify the repository to which to which it is connected. You do this by setting the repository path, either by putting it in the CVSROOT environment variable on you client computer, or by declaring it in the –d command option when you check out the sandbox. CVS stores the repository path in the sandbox.
The cvs checkout command is used to create a sandbox. Once the sandbox is created, checkout no longer needs to be used sandox; update is the preferred command from that point..
Files are edited in the sandbox, but changes to the sandbox have no effect on the repository until the are commited. The cvs commit uploads changes from the sandbox to the repository.
The cvs commit command uploads changes to from the sandbox to the repository, cvs update downloads changes from the repository to the sandbox.
Creating a repository:
To create a repository, create the repository root directory on the computer that will act as the CVS server and ensure that the root directory is owned by the user who will ultimately own the repository. Execute the command:
$> cvs –d repository_root_directory init
Where repository_root_directory is the name of your directory, to setup that directory as a CVS repository. The root must be given an absolute path, not a relative path.
Note: ensure there is enough room for three times the expected final size of the project
If you intend to store binary files then five times the size.
Securing the project.
Sandboxes are checked out of the repository with the username of the user who creates them or does the checking out.
Repository Root Directory:
Secure the repository root directory so that only users who are allowed to create new projects have write access. Users who will be using existing repository projects, even though they may creating and writng to projects files should only have read access to this directory.
Project Directories:
Group ownership of project files and directories controls project security. Ensure that each project is group-owned by a group with appropriate membership, and set the group permissions for the project files to the project’s group.
In UNIX or linux set each directory’s SGID bit to ensure that any new files or directories created in the directory are created with the same group ID as the directory the are created in. Use the command chmod g+s directory to set the SGID bit.
Repository Structure:
A CVS repository is composed of the special CVSROOT administrative directory and any project directories you create. All the CVS administrative files and configuration files are kept in CVSROOT.
CVS Subdirectory:
The only file stored in the CVS subdirectories in a repository is fileattr. Which lists the file attributes of the files in the parent directory.
Locks:
CVS uses read and write locks to prevent processes from simultaneously writing to or reading from the same repository files. These locks are signaled by the presence of a file or directory with a specific name patter in project directories.
CVSROOT Files:
The CVSROOT directory contains administrative files that contain information about the project stored in CVS.
It is good practice to have a specific username to own the CVSROOT directory and the repository root directory, and to be the initial owner of the CVSROOT files.
Create a group to have the group ownership of the CVSROOT directory and files, and include only trusted people in that group.
Configuration Files:
Config:
LockDir=directory
CVS puts lock files in the nominated directory rather than in the repository. This allows you to set the repository directories read-only for people who should not be commiting changes.
LogHistory=value
The text in value controls which actions are logged to the history file in the repository’s CVSROOT directory. The valid values are any combination of the following letters:
A Log when a file is added to the repository.
C Long when a file would have been updated in a sandbox, but needed to be merged and there where conflicts in the merge.
E Log when a file or files are exported.
F Log when a file or files are released.
G Log when a file is updated in a sandbox with a successful merge.
M Log when a file si modified (a sandbox revision is added to the repository).
O Log when a file or files are checked out.
R Log when a file is removed from the repository.
T Log when a file or files are tagged or rtagged.
U Log when a file is updated in a sandbox with no merge required
W Log when a file is deleted from a sandbox during an update because it is no longer active in the repository.
RCSBIN=directory
SystemAuth=value
This option is useful only if the client connects to CVS in pserver mode. It applies to CVS Versions 1.9.14 and later. If value is yes, the server authenticates the connecting user with the passwd file in the repository’s CVSROOT directory. If the user fails to authenticate there, the server authenticates the user against the main user database for the operating system.
If the value is no, the server authenticates the user only against the passwd file.
The default is yes.
Modules:
The modules file contains information about projects in the repository and can group arbitrary files or directories into a single module.Information in this file must be created by the repository or project administrator; CVS does not update this file when a new project is imported. Once a module is defined, the project and directories it defines can be checked out into a sandbox using either the module name or the name of the repository directory it represents.
Backing Up A Repository:
A CVS repository can be backed up using the same backup tools and schedule that you use for ordinary text and binary files.
Quick start guide I have used successfully:
1. Create a CVS user (for example 'cvsuser') using useradd. This will also create a group called 'cvsuser' which will be used to grant CVS access to other users.
For example:
[jdavis]$ su root
Password: {enter password}
[root]# /usr/sbin/useradd -c 'CVS root user' cvsuser
[root]# passwd cvsuser
New password: {enter password}
Retype new password: {enter password}
2. Create a folder for the initial repository using the 'cvsuser' account, or chown / chgrp it to 'cvsuser'.
[root]# mkdir /cvsrepo
[root]# chown cvsuser /cvsrepo
3. Set the 'group sticky bit' on all directories used by CVS (See "CVS File Permissions").
[root]# chmod g+s /cvsrepo
4. Initialize the repository using cvs init
[jdavis]$ su cvsuser
Password: {enter password}
[cvsuser]$ cvs -d :local:/cvsrepo init
5. Set up the lock directory
This is an important step. If lock directory is not set, the CVS daemon will try to create lock files in the repository directory, which will result in 'failed to create lock directory' error message when users perform any operations on the repository.
Create the lock directory first. For example:
[root]# mkdir /var/lock/cvs
[root]# chgrp -R cvsuser /var/lock/cvs
[root]# chmod -R g+w /var/lock/cvs
Then, configure CVS to use the lock directory. Change to a temporary directory, for example /home/cvsuser (which was created by the useradd command above), and check out the CVSROOT module from the repository using the local filesystem mode (not pserver mode). Edit the CVSROOT/config file and either uncomment or add a line 'LockDir=/var/lock/cvs'.
[root]# cd /home/cvsuser
[root]# cvs -d :local:/cvsrepo co CVSROOT
[root]# vi CVSROOT/config
... uncomment or change the line that defines LockDir...
for example: LockDir=/var/lock/cvs
[root]# cvs -d :local:/cvsrepo commit CVSROOT
6. Set up the cvs daemon:
for systems that use inetd - Add a line to the /etc/inetd.conf file
cvspserver stream tcp nowait root /usr/bin/cvs cvs --allow-root=/cvs pserver
Make sure /etc/services contains the line
cvspserver 2401/tcp
for systems that use xinetd - Create a 'cvspserver' file:
Sample /etc/xinet.d/cvspserver file
service cvspserver
{
socket_type = stream
wait = no
user = root
group = cvsgroup
env = HOME=/cvsrepo # Fixes RHL 7.0 problem!
server = /usr/bin/cvs
server_args = -f --allow-root=/cvsrepo pserver
disable = no
}
7. Restart inetd (or xinetd).
[root]# /etc/init.d/xinetd restart
Sandbox: A sandbox is a local copy of a project’s files.
Repository:
When you create a sandbox, you need to specify the repository to which to which it is connected. You do this by setting the repository path, either by putting it in the CVSROOT environment variable on you client computer, or by declaring it in the –d command option when you check out the sandbox. CVS stores the repository path in the sandbox.
The cvs checkout command is used to create a sandbox. Once the sandbox is created, checkout no longer needs to be used sandox; update is the preferred command from that point..
Files are edited in the sandbox, but changes to the sandbox have no effect on the repository until the are commited. The cvs commit uploads changes from the sandbox to the repository.
The cvs commit command uploads changes to from the sandbox to the repository, cvs update downloads changes from the repository to the sandbox.
Creating a repository:
To create a repository, create the repository root directory on the computer that will act as the CVS server and ensure that the root directory is owned by the user who will ultimately own the repository. Execute the command:
$> cvs –d repository_root_directory init
Where repository_root_directory is the name of your directory, to setup that directory as a CVS repository. The root must be given an absolute path, not a relative path.
Note: ensure there is enough room for three times the expected final size of the project
If you intend to store binary files then five times the size.
Securing the project.
Sandboxes are checked out of the repository with the username of the user who creates them or does the checking out.
Repository Root Directory:
Secure the repository root directory so that only users who are allowed to create new projects have write access. Users who will be using existing repository projects, even though they may creating and writng to projects files should only have read access to this directory.
Project Directories:
Group ownership of project files and directories controls project security. Ensure that each project is group-owned by a group with appropriate membership, and set the group permissions for the project files to the project’s group.
In UNIX or linux set each directory’s SGID bit to ensure that any new files or directories created in the directory are created with the same group ID as the directory the are created in. Use the command chmod g+s directory to set the SGID bit.
Repository Structure:
A CVS repository is composed of the special CVSROOT administrative directory and any project directories you create. All the CVS administrative files and configuration files are kept in CVSROOT.
CVS Subdirectory:
The only file stored in the CVS subdirectories in a repository is fileattr. Which lists the file attributes of the files in the parent directory.
Locks:
CVS uses read and write locks to prevent processes from simultaneously writing to or reading from the same repository files. These locks are signaled by the presence of a file or directory with a specific name patter in project directories.
CVSROOT Files:
The CVSROOT directory contains administrative files that contain information about the project stored in CVS.
It is good practice to have a specific username to own the CVSROOT directory and the repository root directory, and to be the initial owner of the CVSROOT files.
Create a group to have the group ownership of the CVSROOT directory and files, and include only trusted people in that group.
Configuration Files:
Config:
LockDir=directory
CVS puts lock files in the nominated directory rather than in the repository. This allows you to set the repository directories read-only for people who should not be commiting changes.
LogHistory=value
The text in value controls which actions are logged to the history file in the repository’s CVSROOT directory. The valid values are any combination of the following letters:
A Log when a file is added to the repository.
C Long when a file would have been updated in a sandbox, but needed to be merged and there where conflicts in the merge.
E Log when a file or files are exported.
F Log when a file or files are released.
G Log when a file is updated in a sandbox with a successful merge.
M Log when a file si modified (a sandbox revision is added to the repository).
O Log when a file or files are checked out.
R Log when a file is removed from the repository.
T Log when a file or files are tagged or rtagged.
U Log when a file is updated in a sandbox with no merge required
W Log when a file is deleted from a sandbox during an update because it is no longer active in the repository.
RCSBIN=directory
SystemAuth=value
This option is useful only if the client connects to CVS in pserver mode. It applies to CVS Versions 1.9.14 and later. If value is yes, the server authenticates the connecting user with the passwd file in the repository’s CVSROOT directory. If the user fails to authenticate there, the server authenticates the user against the main user database for the operating system.
If the value is no, the server authenticates the user only against the passwd file.
The default is yes.
Modules:
The modules file contains information about projects in the repository and can group arbitrary files or directories into a single module.Information in this file must be created by the repository or project administrator; CVS does not update this file when a new project is imported. Once a module is defined, the project and directories it defines can be checked out into a sandbox using either the module name or the name of the repository directory it represents.
Backing Up A Repository:
A CVS repository can be backed up using the same backup tools and schedule that you use for ordinary text and binary files.
Quick start guide I have used successfully:
1. Create a CVS user (for example 'cvsuser') using useradd. This will also create a group called 'cvsuser' which will be used to grant CVS access to other users.
For example:
[jdavis]$ su root
Password: {enter password}
[root]# /usr/sbin/useradd -c 'CVS root user' cvsuser
[root]# passwd cvsuser
New password: {enter password}
Retype new password: {enter password}
2. Create a folder for the initial repository using the 'cvsuser' account, or chown / chgrp it to 'cvsuser'.
[root]# mkdir /cvsrepo
[root]# chown cvsuser /cvsrepo
3. Set the 'group sticky bit' on all directories used by CVS (See "CVS File Permissions").
[root]# chmod g+s /cvsrepo
4. Initialize the repository using cvs init
[jdavis]$ su cvsuser
Password: {enter password}
[cvsuser]$ cvs -d :local:/cvsrepo init
5. Set up the lock directory
This is an important step. If lock directory is not set, the CVS daemon will try to create lock files in the repository directory, which will result in 'failed to create lock directory' error message when users perform any operations on the repository.
Create the lock directory first. For example:
[root]# mkdir /var/lock/cvs
[root]# chgrp -R cvsuser /var/lock/cvs
[root]# chmod -R g+w /var/lock/cvs
Then, configure CVS to use the lock directory. Change to a temporary directory, for example /home/cvsuser (which was created by the useradd command above), and check out the CVSROOT module from the repository using the local filesystem mode (not pserver mode). Edit the CVSROOT/config file and either uncomment or add a line 'LockDir=/var/lock/cvs'.
[root]# cd /home/cvsuser
[root]# cvs -d :local:/cvsrepo co CVSROOT
[root]# vi CVSROOT/config
... uncomment or change the line that defines LockDir...
for example: LockDir=/var/lock/cvs
[root]# cvs -d :local:/cvsrepo commit CVSROOT
6. Set up the cvs daemon:
for systems that use inetd - Add a line to the /etc/inetd.conf file
cvspserver stream tcp nowait root /usr/bin/cvs cvs --allow-root=/cvs pserver
Make sure /etc/services contains the line
cvspserver 2401/tcp
for systems that use xinetd - Create a 'cvspserver' file:
Sample /etc/xinet.d/cvspserver file
service cvspserver
{
socket_type = stream
wait = no
user = root
group = cvsgroup
env = HOME=/cvsrepo # Fixes RHL 7.0 problem!
server = /usr/bin/cvs
server_args = -f --allow-root=/cvsrepo pserver
disable = no
}
7. Restart inetd (or xinetd).
[root]# /etc/init.d/xinetd restart
Sunday, March 26, 2006
building qemu on fedora core 4(5)
the real pain the butt is getting the kernel sources
installed on the system and getting the
older version of gcc.
take a look at this link
http://www.brandonhutchinson.com/Installing_QEMU_with_Accelerator_Module_on_Fedora_Core.html
./configure --prefix=/usr/local/qemu --cc=gcc32
installed on the system and getting the
older version of gcc.
take a look at this link
http://www.brandonhutchinson.com/Installing_QEMU_with_Accelerator_Module_on_Fedora_Core.html
./configure --prefix=/usr/local/qemu --cc=gcc32
Subscribe to:
Posts (Atom)