So finally just a few hours before the closing date for the applications for GSoc , i have submitted my project Application for YUM Rollback Utility to The Fedora and Jboss project, truly speaking i am not actually very sure whether the applications are still accepted or if the time is already up. But people wish me all the best :-) !!
i recently was involved in the discussion , where we were talking about how Linux was going to be the next big thing, i didn't say that , someone else did , but i totally disagree, is Linux truly the next big thing ??
well , tell u what , i thing it has already begun , and other things are going down , and u know who i am talking about , BIG DADDY, ..... its time things changed for the good,....... but i think people don get along with Linux , because it is going to be the next big thing or it already is , ... but because, it is a passion , it is a culture, which many love and even I do !!!
this actually has been rolling in my mind for a long time now , how would it be to design an app, which would make it a click's work to plan for the design and coding of a project or a software application, which would produce text like what i have posted below for the 'diff'ing and'patch'ing application , and along with that also the deadlines, and sort of provide the functionality for adding new goals and decisions dynamically, ?
that would be great , i guess, a lot more thinking and discussion has to go in there, but it would be awesome and highly customizable !!!
i have decided to write a small GUI based app for taking out the diff of two files and applying patches to files, well i don have any idea how the actual programs work , but i have decided to write new algos for them , and a little innovation with the GUI , ... the plan goes as follows, :
------> creation of own diff and patch algorithms
|___--> better diff algo proposal
# char wise diff if line length > 256 (set arbitrarily)
------> designing the GUI through manual programming ( no GLADE )
|___--> components of the GUI
# textarea for displaying the diff output
# input and output file selector
# file selector for patch operations
# selector between methods patch/diff
------> writing the appropriate configure scripts for the gui code, as
the autoscan may not always generate the appropriate scripts
well actually , i was inspired by meld, but actually wanted to try my hand at making one, because it would help my endeavor for Gtk and also brush up my C , so as i always say , lets get coding !!!
some platform details first :
laptop : HP compaq nx 7400
Linux Distro : Ubuntu Gutsy Gibson (7.10)
Linux Kernel : 2.6.24
Wifi Card : Intel Pro wireless 3945 card
I compiled the kernel and created a kernel debian package using 'make-kpkg' , the list of commands i used are the following :
cd [kernel source directory]
make-kpkg --initrd binary
after the execution of the above commands is done , the debian packages for the kernel image, the headers, the documentation and the source are created in the parent directory of the linux kernel source directory . And after that it is simple installation to get the kernel working, ... but when i tried to compile and install the ipw3945 drivers from the source code, i had some really tough time, ......
later found out from a little googling that the wifi drivers to be used with the kernels version >=2.6.22 are the iwl3945 driver packages and not the ipw3945, ....... th iwl3945 drivers can be configured to be compiled into the kernel , check somewhere in the device drivers-->wireless-->iwlwifi section when you do a make gconfig, ......
but i had missed that out , now i had two options , recompile the kernel with the drivers supported or compile and install the drivers from the source code , well for the inherent lazyness i chose the second option , .... the set of wireless drivers included in the linux kernel are there for download at the following url , just download them and do a make and a make install, ....
now my wifi card works well, .... and to say the least ubuntu is awesome, i am gonna try out kernel version 126.96.36.199 today , quite excited i am as always !!!
it was a long time ago that i had tried a simple hello world program from 'Beggining' Linux programming and failed badly , going by the difficulty i had in figuring out the flags to be given to gcc and and the directories and libs i had to explicitly include, but i hvae atlast found some success, well it is not a achievement as all i did was follow the same book and do what it said , but i feel relieved , it has been my dream to develop a GUI based software for managing 'small business' . Which can be easily configured and used for any sort of 'small ' range business, as all of them have the same basic backdrop. So finally i have started working with GtkObjects and GtkWidgets, so it should not be long before i am grinding out some really good stuff !!!
Everytime we compile a program using the Gtk+ packages, we have to include some metadata about the include directories containing the headers, the directories to find the libraries in and all such stuff, it is quite difficult to figure these out individually, and that was the problem i faced initially. The book gives a solution , it uses the command 'pkg-config -cflags -libs gtk+-2.0' to give the details of the cflags and the libraries ! So for compiling a program named 'helloworld.c' i would give the following command according to the book, :
# gcc helloworld.c -o helloworld `pkg-config -cflags -libs gtk+-2.0`
note the reverse quotes they substitute the ouput of pkg-config command , but THAT DOES NOT WORK, the man page for pkg-config shows that the options to be given to it are ' --cflags --libs' , i am not sure whether this has changed since the time the book was written , but what is given in the book doesn't work with me , so the correct thing would now be :
# gcc helloworld.c -o helloworld `pkg-config --cflags --libs gtk+-2.0`
that compiles and gives the output !!
pkg-config is a utility for displaying the meta-data for packages which are installed on the system , check out the man pages for more detailed info !!
well i should say the past week has been tough , preparing for the exams and also working on this, . . and the good news is that i have almost achieved the initial goals for which this idea was proposed on the forums at www.vit.ac.in/lug/ , some of them are as simple as just uninstalling all the packages that were installed after a particular date using YUM . Well here goes a short summary of some of the work i have put in , the code consists of a set of perl scripts that parse the log file created by yum and then decide which are the packages that are to installed or uninstalled , all these perl scripts are managed by a single 'bash' shell script and this executes the rpm -e and the other commands used for manipulating the packages , and the main puprose for this idea was initially proposed was to undo the changes done through yum and i have achieved that , but at present the scirpts look kind of crude and lack a lot of valuable documentation i should be able to give a lot of modifications and may be implement t completely in C before i add any further functionalities, i need to take out some time for that though . And ya there is one more improvement , i have got the 'yumrollback' project approved on Sourceforge.net and one i am thorough with manipulating code using CVS, once i do this i willl putting up the present scripts up on the repository , so a lot of work ahead !!
well again back with the sick exams , and i am doing what i generally do the best during exams , ...... no guys its not preparing , it is sleeping , sleeping and sleeping all day , hey but i do give out time for filling up my stomach , ........
well the last useful thing i remember doing was writing a perl script to categorize the list of packages in /var/log/yum.log into installed and erased lists , and print them out to temporary files, well that was pretty cool stuff, but since then i have been sleeping !!!!
here are a few simple steps for compiling the linux kernel and installing it !!
first download the source code of the kernel version you want to install from http://kernel.org and extract the archive into the directory /usr/src/ , now after u have finished this run the following commands :
# cd /usr/src/[kernel source directory]
where kernel source directory is the one created on extracting the archive , ... now the next command is
# cp /boot/config-$(uname -r) ./config
this copies the configuration options for your current kernel to the one you are going to compile and install now , after this to make any further changes to the options execute the following command ,:
# make menuconfig
note : there are other options that can be used for configuring the kernel such as " make gconfig " which gives a GUI based configuration window, but they require extra library support , for example to use make gconfig u need to have installed the 'gnome software development ' libraries on your system , so it is better to use "make menuconfig " which almost always works !!!
after doing that u get a list of options , select or unselect the options which u want in your kernel or u don't want in your new kernel , after doing this save and exit , now u are done with configuring the kernel , next run the following command at the prompt :
this compiles the source code and creates a compressed kernel image , once this is finished and u get back to the prompt , run the following command ,
# make modules_install
this installs the kernel modules that were created in the earlier step ,and then
# make install
this will install the kernel and add appropriate options to the GRUB configuration file , all you need to do after this is to reboot and boot into the new kernel !!!!
just finished with installing the kernel 2.6.23 wifi drivers ( ipw3945) , well the actual kernel compilation took me some time , getting my wifi card working took me longer !! . The one reason i very musch wanted to install this kernel was the fact the native kernel provided with CenOS 5.1 does not have NTFS support and i was having a tough time installing the fuse kernel modules on that kernel , so decided to better shift to a kernel with native support , ..........
but then after doing that , i had to download the latest source for the ipw3945 driver and install it , now my wireless-tools package was a little old for the driver version , so had to upgrade that too from a Fedora 8 package , ....... now finally everything is going fine , tell u what , even the power manager which gave me a lot of problems in the 2.6.18 kernel is working great now !!!!
well actually this concept was first proposed to me by one of my seniors in the following post
in short yum is a software manager used in RPM based systems , if u are new to this world u can get more on yum at : http://fedoraproject.org/wiki/Tools/yum
what we propose to do here is provide a functionality which rollbacks all the software modifications done by yum to a particular date following are two basic ideas for doing exactly that the first one was what i thought of and the second one a little more innovative was the one suggested by my friend :
1 . parse the contents of the yum.log created by yum and issue a recursive command "rpm -e [package name] --nodeps " , where the user enters a date to rollback to and the [package name] stands for all packages that were installed after that date , this will recursively remove all the files after that date without checking for dependencies , and i planned to do this all in a C program .
2. this is as far as i know a far better method, my firend Kalyan , suggested that, we could run a cron job every day which would store the output of " yum list grep installed " in a file in a standard directory created by the utility , and when the user entered a date for rollback , we would take a ' diff ' of the present output of " yum list grep installed " and the contents stored in the file for the rollback date ,and thus would use the same rpm -e command for the differing files .
isn't that great stuff ??
lets get onto coding that !!!
now was wondering what was that supposed to mean , when i first saw the makefile for the sample driver module i had written , and now after having some personal time with the kernel documentation , i have found out that this stands for object module goals , i had suspected this already ..... so that gives me the reason why my module was compiled by make even though i didn't give the goal for the specific target object !!!
ever taken time to go through the kernel documentation , well i have not till now , ..... and there i found this file which read as 'Coding Style ' and believe it is nothing like what i have read before , .... if u have kernel source code go into the source directory and look for a file 'coding style' in the Documentation directory or else here goes the file or rather a part of it ......... _______________________________________________________________________________________
Linux kernel coding style
This is a short document describing the preferred coding style for the
linux kernel. Coding style is very personal, and I won't _force_ my
views on anybody, but this is what goes for anything that I have to be
able to maintain, and I'd prefer it for most other things too. Please
at least consider the points made here.
First off, I'd suggest printing out a copy of the GNU coding standards,
and NOT read it. Burn them, it's a great symbolic gesture.
Anyway, here goes:
Chapter 1: Indentation
Tabs are 8 characters, and thus indentations are also 8 characters.
There are heretic movements that try to make indentations 4 (or even 2!)
characters deep, and that is akin to trying to define the value of PI to
Rationale: The whole idea behind indentation is to clearly define where
a block of control starts and ends. Especially when you've been looking
at your screen for 20 straight hours, you'll find it a lot easier to see
how the indentation works if you have large indentations.
Now, some people will claim that having 8-character indentations makes
the code move too far to the right, and makes it hard to read on a
80-character terminal screen. The answer to that is that if you need
more than 3 levels of indentation, you're screwed anyway, and should fix
In short, 8-char indents make things easier to read, and have the added
benefit of warning you when you're nesting your functions too deep.
Heed that warning.
its too lengthy to be in full at this place , so get some time and read it from the kernel documentation !!!
hope u have a good time with that , ... more later.............
this seems to be getting more and more interesting , ... there is a hell lot of information on 'kbuild' and using the same for developing the modules form outside the kernel ,..... if u have kernel source code then the following is a good place to search ::
/[path to kernel source directory]/Documentation/kbuild/
check out all the text files in there !!
the content i posted just before , that is on compiling kernel modules , i have tried going through the contents of the makefile and found the following solution , the technique used was something called kbuild, it provides a standard method for building external modules from the kernel environment ,.................
for the sample.c driver i wrote the contents of the corresponding makefile were :
make -C /usr/src/kernels/$(shell uname -r)-i686/ SUBDIRS=$(PWD) modules
-rm *.o *.ko *.mod.c
according to the kernel module programming guide this is a method provided by the 2.6x versions called
kbuild a little more intorduction at the following link