Re: Handy References for Linux Device Drivers Developer
On Thu, Dec 16, 2010 at 1:57 PM, Pradeep Kumar pradeep4uii...@gmail.comwrote: hi all, I am new to kernel device drivers field. Any suggestions about the references to follow for quick overview and detailed flow of code in Linux Kernel. thanks, Goudagunta Pradeep Kumar, http://crashcouse.ca is a good place to start. Read at least free lessons. Then you try to write a device driver of your own. Its easy. freesoftwaremagazine has a good article on it. http://www.freesoftwaremagazine.com/articles/drivers_linux Once you understand the above try to read (or write if you can) a network driver. It might take you 2-3 months to understand or even more but it is worth the effort. There is a book Essential Linux Device Drivers http://www.amazon.com/Essential-Device-Drivers-Sreekrishnan-Venkateswaran/dp/0132396556 read the above book this will surely develop a lot of understanding. Then if you still want to read buy a hardware such as Beagleboard and work upon it. Nerdkit is another I have heard.
Re: Handy References for Linux Device Drivers Developer
I forgot to mention the best way to learn these type of things is to start playing with it.(Start working rather than reading books) I do not know if you experienced this in past but this is a good way. Pick up a project and start working on it. (For example you can start with file system development such as ext4 that would be easiest ) or try to make your own filesystem.It is easy. In such projects when you will start doing you will be able to see a distance of 5 meters only but when you cover these 5 meters then another 5 meters you will see like this if you keep on progressing you will reach your goal. On Thu, Dec 16, 2010 at 3:14 PM, Tapas Mishra mightydre...@gmail.comwrote: On Thu, Dec 16, 2010 at 1:57 PM, Pradeep Kumar pradeep4uii...@gmail.comwrote: hi all, I am new to kernel device drivers field. Any suggestions about the references to follow for quick overview and detailed flow of code in Linux Kernel. thanks, Goudagunta Pradeep Kumar, http://crashcouse.ca is a good place to start. Read at least free lessons. Then you try to write a device driver of your own. Its easy. freesoftwaremagazine has a good article on it. http://www.freesoftwaremagazine.com/articles/drivers_linux Once you understand the above try to read (or write if you can) a network driver. It might take you 2-3 months to understand or even more but it is worth the effort. There is a book Essential Linux Device Drivers http://www.amazon.com/Essential-Device-Drivers-Sreekrishnan-Venkateswaran/dp/0132396556 read the above book this will surely develop a lot of understanding. Then if you still want to read buy a hardware such as Beagleboard and work upon it. Nerdkit is another I have heard. -- http://mightydreams.blogspot.com
Re: Building the linux kernel
On Tue, Nov 23, 2010 at 9:25 AM, sugnan prabhu sugnan.pra...@gmail.com wrote: Hello, I am a newbie and am trying to build the kernel, the kernel version am trying to build in 2.6.36, i have added few header files and kernel module Check this page http://crashcourse.ca/introduction-linux-kernel-programming/lesson-1-building-and-running-new-linux-kernel it is a free lesson and this should answer most of your queries. -- http://mightydreams.blogspot.com -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
2 links good for newbies
Hi, list I was searching for some information and came across 2 links which would be relevant to us. http://www.novell.com/coolsolutions/feature/14910.html http://www.novell.com/coolsolutions/feature/11254.html I have not checked the kernelnewbies wiki but any one who maintains that can include these both. -- http://mightydreams.blogspot.com -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: structure for Super IO chip detection
On Fri, Nov 19, 2010 at 12:27 PM, hiren panchasara hiren.panchas...@gmail.com wrote: You should be able to find how structures are declared/defined/used in any good C programming book. I doubt if such a thing is mentioned on any good C book. Coming to OP's question.You need to know to understand this is that, in C/C++, if you initialise part of an array or struct, i.e. supply fewer initialisation values than there are elements, then the remainder of the elements in the array/struct are initialised to 0. So, in this case, if you just initialise the first element to 0, then you are effectively initialising all elements to 0. This is what's happening in the example above, except that it's an array of structs, hence the double { } superios[NR_SUPERIOS] = { { 0 } }; The code should not have been done superios[NR_SUPERIOS] = { { 0 ,}, }; These commas are redundant and all compilers will not support it. -- http://mightydreams.blogspot.com -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: how does ifconfig communicates with network device driver strace output given
On Sat, Nov 13, 2010 at 12:12 AM, Greg Freemyer greg.freem...@gmail.com wrote: When you see /dev/... opened, then a connection to the kernel is opened. Read / write / ioctl etc. all directly send data to the kernel. You do know the standard file descriptors: stdin, stdout, stderr right? You see stdout (1) being sent the ifconfig output in the code, so just look immediately before that to try and see what ifconfig did to figure what it did to allow it to generate the output. Are you referring to file descriptors? -- http://mightydreams.blogspot.com -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: what is equivalent to ether_setup in 8139too.c as given in LDD page 504
Ok thanks for your responses. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
what does wrap_copy do in 8139too.c
I was trying to understand how 8139too.c is developed, I came across a function wrap_copy in it. Can some one help to understand what it is doing. What I interpret it is that some how the person is tying to copy payload from DMA to sk buffer. But still what exactly are we trying to achieve via wrap_copy function call? -- http://mightydreams.blogspot.com -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
how does ifconfig communicates with network device driver strace output given
Hi, I read the 17th Chapter of LDD3 and explored what is a network device driver. I wanted to understand in real context the working of network device driver on my laptop. The book described about snull (dummy ) device. So here is the problem when I do an ifconfig the open,close, and other methods which the driver has defined come into action. I did strace ifconfig to understand what system calls were issued when I do an ifconfig from userspace here is the output of strace http://pastebin.com/FMggtA9s what I see is most of the calls are open,access,fstat,mmap,mprotect,close,ioctl,write, what I am not clear is what mechanism is existing which says that when ifconfig is issued then the response will come from a particular set of driver (I understand that we register the driver by register_netdev but how does the system calls or requests from ifconfig transferred to the particular device or how does ifconfig communicates with kernel and I see the resultant commands issued via strace as you see in above pastebin output. -- http://mightydreams.blogspot.com -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: is this link valid
On Wed, Nov 3, 2010 at 10:09 PM, Denis Kirjanov kirja...@gmail.com wrote: There are many good examples in drivers/net. drivers/net/pci-skeleton.c for example. I think that it is a not big problem to compare the text from the link with the current state of the device drivers. How will a newbie come to know what is the example file one needs to see and what to validate. Also looking at the exact code would not take me any where. Any how I understood your point. On Wed, Nov 3, 2010 at 11:31 PM, Rajat Sharma fs.ra...@gmail.com wrote: Tapas, Please look into the Linux kernel source, it also has Realtech driver in kernel but perhaps supporting newer chips from realtech. http://lxr.linux.no/linux+v2.6.36/drivers/net/r8169.c I think you can go through the link you are trying to validate, being a careful reader, and keep referring to above file for any corresponding changes in API described on that link. Rajat That link I mention has given things in a simple way so once I understand basic skeleton I would be able to understand.Having said that I will also say that I had looked at drivers/net/8139too.c also.Since I am new I asked.( I am also reading 17th chapter of LDD3 but it is difficult to understand) -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
what is equivalent to ether_setup in 8139too.c as given in LDD page 504
I am trying to understand how network drivers can be written. In LDD page 504 Chapter 17, what is equivalent to ether_setup in 8139too.c as given in LDD page 504 a function ether_setup has been explained what is equivalent to that function in the driver 8139too.c -- http://mightydreams.blogspot.com -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: BIOS Vs. Linux
2010/11/4 अनुज anu...@gmail.com: Hi list, I am just exploring how much the linux is dependent on BIOS. I wanted to know : 1. Which information linux uses from BIOS ( some sort of tables like MP tables, ACPI tables) and for what purpose? 2. Whether linux uses BIOS routines to program and initialize the different chips (e.g. IOAPIC, PIR, PCI devices etc.) or not? Please provide if there is any document or link which explains the clear interface between BIOS and linux? What you are searching as is known as bootstrapping. This link http://www.ibm.com/developerworks/linux/library/l-linuxboot/ should give a good start. Then you can go on with your research. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: how does kernel detects presence of a particular device
On Wed, Nov 3, 2010 at 10:28 AM, Mulyadi Santosa mulyadi.sant...@gmail.com wrote: IIRC, it is the bus (or should we say, the motherboard...or chipset) that send somekind of signal (of announcement). Ok this is what I am looking for. What signal is send by whom and where Driver picks it up How? since the probe function had been registered before in that bus line (or irq line). Can you elaborate this a bit more? -- http://mightydreams.blogspot.com -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: is this link valid
On Wed, Nov 3, 2010 at 8:19 AM, Mulyadi Santosa mulyadi.sant...@gmail.com wrote: On Tue, Nov 2, 2010 at 18:09, Tapas Mishra mightydre...@gmail.com wrote: Hi, wanted to know if the information given on this link is still valid. http://linuxgazette.net/93/bhaskaran.html Have you give it try first and see how it comes up? How can I give it a try I am new to programming network devices I am reading what ever resources I have. (I know about LDD Chapter 17) no where on that link date is mentioned so some one who is in practice can tell me if these functions are still valid. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: how does kernel detects presence of a particular device
2010/11/3 अनुज anu...@gmail.com: Simply, whenever either a device or driver is registered with the bus, then probe function of matching driver is called by the bus subsystem. Refer : http://lxr.linux.no/#linux+v2.6.36/Documentation/PCI/pci.txt probe This probing function gets called (during execution 88 of pci_register_driver() for already existing 89 devices or later if a new device gets inserted) for 90 all PCI devices which match the ID table and are not 91 owned by the other drivers yet. This function gets 92 passed a struct pci_dev * for each device whose 93 entry in the ID table matches the device. The probe 94 function returns zero when the driver chooses to 95 take ownership of the device or an error code 96 (negative number) otherwise. 97 The probe function always gets called from process 98 context, so it can sleep. That links talks about WHAT is done. As pci_register_driver() looks for existing devices or which match the ID table and not owned by id table. I am looking for HOW it is done. I am not in a position to understand the source code right now.So I asked list. I had read that doc before posting here.
Re: how does kernel detects presence of a particular device
On Wed, Nov 3, 2010 at 11:22 AM, Gavin Guo tuffki...@gmail.com wrote: That How does probe work depends on particular driver. To be brief, driver will does some initial work for devices, like setting up register or registering device node on file system. For instance, touch panel driver need to register an event node under /dev/input. You can read the driver code for specific implementation of probe. Ok I think these are the two places where I should be looking http://lxr.linux.no/#linux+v2.6.36/drivers/pci/probe.c http://lxr.linux.no/#linux+v2.6.36/drivers/pci/search.c The code in probe.c will detect the device. This is matched up with the driver (assuming it was registered) in search.c. Inspite of the comments on the above two links I am not able to understand it as how it is happening. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: how does kernel detects presence of a particular device
On Wed, Nov 3, 2010 at 3:24 PM, Wouter Simons l...@woutersimons.org wrote: On 11/03/2010 03:46 AM, Tapas Mishra wrote: As far as I understand once the probe function(Not too sure) detects or kernel detects then the driver would be looked up and control would be handed over to driver. If this is correct then how does probe works? Or how a particular device's presence on PCI bus is detected. The PCI system is a special hardware system that replaced ISA. The interesting thing in a PCI system is that hardware registers itself in the PCI configuration register. You only need to read that to know what harware is connected. Perhaps that is the how part you are looking for? Exactly you are THE man :) Here is the info on the PCI config register: http://en.wikipedia.org/wiki/PCI_configuration_space Wouter Thanks this makes it clear. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
ethernet registers
http://lxr.free-electrons.com/source/drivers/net/8139too.c#L289 I want to know what should I search to be able to understand the value of the registers given on above link. -- -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: ethernet registers
On Wed, Nov 3, 2010 at 6:43 PM, Wouter Simons l...@woutersimons.org wrote: On 11/03/2010 12:58 PM, Tapas Mishra wrote: http://lxr.free-electrons.com/source/drivers/net/8139too.c#L289 I want to know what should I search to be able to understand the value of the registers given on above link. That sort of stuff is defined in datasheets, try here: http://www.datasheetsite.com/datasheet/RTL8139D(L) Ok Thanks a lot. -- -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
how does kernel detects presence of a particular device
As far as I understand once the probe function(Not too sure) detects or kernel detects then the driver would be looked up and control would be handed over to driver. If this is correct then how does probe works? Or how a particular device's presence on PCI bus is detected. -- -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: typdef in iw_handler.h
On Mon, Nov 1, 2010 at 2:49 PM, Darshan Ghumare darshan.ghum...@gmail.com wrote: http://publications.gbdirect.co.uk/c_book/chapter8/typedef.html iw_handler is the type. For example: int do_something(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { /* do stuff */ } int do_something_else( same thing here ) { /* more stuff */ } iw_handler handlers[10]; handlers[0] = do_something; handlers[1] = do_something_else; ... etc. ... int choice = 4; handlers[choice](dev, blah1, info_arg, iwreq_blah_arg, NULL); This allows you to set up an array of functions that all take the same arguments but do different things. You can then use a variable to choose the function without caring what it does, and pass the same arguments regardless of which function is being called. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
where is usb driver file system
I checked this link http://www.linux-usb.org/USB-guide/x173.html excerpts from above page The USB device filesystem is a dynamically generated filesystem, similar to the /proc filesystem. This filesystem can be mounted just about anywhere, however it is customarily mounted on /proc/bus/usb, whi and went to see /proc/bus but the directories were not there as they have mentioned. Can some one point me to right direction. -- http://www.howtoforge.com/install-linux-without-burning-an-iso-to-cd-dvd-use-the-iso-downloaded-to-your-hard-drive -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
struct in_device set to 1 for ipforwarding what does that mean
In the file include/linux/inetdevice.h struct in_device has a member cnf which is set to 1 when IP Forwarding is enabled in Linux Kernel cnf is a struct of type ipv4_devconf so what does this mean that the member cnf is set to 1. I am not able to understand how can a structure be set to 1? -- http://mightydreams.blogspot.com -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: where is usb driver file system
On Mon, Nov 1, 2010 at 7:26 PM, Greg KH g...@kroah.com wrote: It's no longer mounted at /proc/bus/usb as it's not needed there anymore. But if you want to, you can mount it anywhere you want: mount -t usbfs none /home/foo/usbfs What do you want to do with it? Nothing just learning to write drivers for USB and Network Drivers. -- http://www.howtoforge.com/install-linux-without-burning-an-iso-to-cd-dvd-use-the-iso-downloaded-to-your-hard-drive http://wiki.linuxquestions.org/wiki/User:Tapas.mishra http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers http://wiki.xensource.com/xenwiki/EditorsGroup http://www.linuxforums.org/articles/authors/tapas-mishra_95.html -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
does get_user_byte and put_user_byte exist
I was reading an article http://www.linuxjournal.com/article/1221 They have used get_user_byte and put_user_byte functions do they exist? I tried to man them but there were no entry. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: multiboot compliancy of vmlinuz-2.6.34
On Mon, Oct 11, 2010 at 9:43 AM, Prabhu nath gprabhun...@gmail.com wrote: Then, what is the interface specification to which both Linux and Grub comply to. How does Grub load the linux kernel to the memory and initiate execution of the Kernel code. Thanks, Prabhu On Wed, Oct 6, 2010 at 9:08 PM, Philip Downer p...@pjd.me.uk wrote: Prabhu nath wrote: I have built a kernel version 2.6.34 and have a file *vmlinuz-2.6.34* in /boot folder. Is this file multiboot comliant ?. If yes, then as per multiboot specification, first byte should be magic number 0x1BADB002. But when I read the first byte, it is 0xC5EA. unless a patch has been applied recently (within the last year as thats when I last looked) to make it so, Linux isn't multiboot compliant. If you search the lkml you'll find a few mails about it, I just don't think anyone was interested in making it compliant as they didn't see any benefit. Philip Downer Prabhu... you need to understand bootstrapping of Linux Kernel. I will give you one good link http://www.ibm.com/developerworks/linux/library/l-linuxboot/ rest you search on your own. I once modified the boot sequence that time I had done such stuff. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: make with argument 0 is failing some where
On Sun, Sep 12, 2010 at 10:56 AM, Tapas Mishra mightydre...@gmail.com wrote: For the sake of simplicity I am rewriting all the steps that I did Step 1) copied the config from /boot to $HOME/linux-2.6 Step 2) yes ' ' | make O=$HOME/btc oldconfig Step 3) make O=$HOME/btc got errors make O=$HOME/btc Ok finally I have been able to fix this. To do so what I was trying I executed make mrproper at two places one is $HOME/linux-2.6 and another was $HOME/btc now I was in Step 1) cd $HOME/linux-2.6 Step 2) make mrproper Step 3) cd $HOME/btc Step 4) make $O=$HOME/btc mrproper Step 5) cd $HOME/linux-2.6 Step 6) copied the config from /boot to $HOME/linux-2.6 Step 7) yes ' ' | make O=$HOME/btc oldconfig upto here is all Ok. Next step is Step 8) make mrproper Step 9) cd $HOME/btc Step 10) make O=$HOME/btc and then make with all modules install and rest of the stuff had worked. -- Tapas -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Regarding installing Linux kernel for first time
On Thu, Sep 16, 2010 at 4:20 PM, Rags Linux linux.r...@gmail.com wrote: * Is it possible to install linux on my PC without having Linux? (I have only windows) If you have one of those laptops where the manufacturer has given only one driver and are afraid of partitioning it and you do not wish to install Linux on your machine you can Vmware http://downloads.vmware.com/d/info/desktop_downloads/vmware_workstation/7_0 demo version and then install Linux inside what ever stuff you are interested to do you can do. You can use Vmware Player also which will serve your purpose. Or you can also try cygwin. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: make with argument 0 is failing some where
On Sat, Sep 11, 2010 at 4:21 PM, Edward Allcutt edw...@allcutt.me.uk wrote: sudo make 0=$HOME/btc modules_install ln: target `kernel+/source' is not a directory make: *** [_modinst_] Error 1 Did I do some thing wrong? I think what you wanted was an O (capital o) not a 0 (zero). -- Yes even I also did the same. -- Tapas -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: make with argument 0 is failing some where
On Sat, Sep 11, 2010 at 10:57 PM, Mulyadi Santosa mulyadi.sant...@gmail.com wrote: maybe you miss something..ok, please try sudo sh -c make your options here I did what you suggested I am getting an error to always run make mrproper where as I have executed make mrproper in two ways 1) make mrproper 2) make O=$HOME/btc mrproper any of the above methods has had not effect. For the sake of simplicity I am rewriting all the steps that I did Step 1) copied the config from /boot to $HOME/linux-2.6 Step 2) yes ' ' | make O=$HOME/btc oldconfig Step 3) make O=$HOME/btc got errors make O=$HOME/btc GEN /home/tapas/btc/Makefile scripts/kconfig/conf --silentoldconfig arch/x86/Kconfig Using /home/tapas/linux-2.6 as source for kernel /home/tapas/linux-2.6 is not clean, please run 'make mrproper' in the '/home/tapas/linux-2.6' directory. make[1]: *** [prepare3] Error 1 make: *** [sub-make] Error 2 I had then executed make distclean also and when it did not worked then gave it argument with make O=$HOME/btc distclean still got the same error. This is the link from where I am trying it http://www.crashcourse.ca/introduction-linux-kernel-programming/lesson-2-further-issues-kernel-configuration The original author has used 64 bit. but I am using 32 bit system (Ubuntu 10.04) though this should have no difference on any of these things. Tapas -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
the first kernel code written by torvalds
Hi, just Googled http://www.google.com/search?client=ubuntuchannel=fsq=Linuses+kernels+first+codeie=utf-8oe=utf-8 want to know if some one can point out the first version of kernel code which Torvalds wrote. -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: the first kernel code written by torvalds
On Fri, Sep 10, 2010 at 2:57 PM, Manohar Vanga manohar.va...@gmail.com wrote: This is probably what you're looking for: http://www.kernel.org/pub/linux/kernel/Historic/ Yeah right.But some other people have also given some links which are useful. -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: the first kernel code written by torvalds
On Fri, Sep 10, 2010 at 3:33 PM, Mulyadi Santosa mulyadi.sant...@gmail.com wrote: If that's really what you need, try to head on to: http://www.ibiblio.org/pub/historic-linux/distributions/yggdrasil/ That was great. -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: debugging a process
On Fri, Sep 10, 2010 at 12:46 PM, John Mahoney jmaho...@waav.com wrote: Actually, it is an executable, but not the actual firefox binary one would expect. Instead it is a symbolic link to a wrapper script which executes the first line of the file /bin/sh(a link to dash in Ubuntu) which later calls the firefox binary executable. Yeah talk about bad luck in picking a program to mess with. Yeah correct. -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
make with argument 0 is failing some where
I cloned the 2.6 latest kernel tree on my system and in my home directory made a folder named btc git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git linux-2.6 then compiled as yes ' ' | make 0=$HOME/btc/ oldconfig worked well. Then make 0=$HOME/btc this also worked but when I did sudo make 0=$HOME/btc modules_install ln: target `kernel+/source' is not a directory make: *** [_modinst_] Error 1 Did I do some thing wrong? -- Tapas -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
debugging a process
I tried to debug a running process. I am taking firefox as an example. So I wanted to see it in detail as how is Linux kernel communicating with it. Here is my output such as which kernel symbol is used in this process what other macros it is using any thing from kernel that is affecting it like that things that I can look in it using gdb. I am doing it for learning purpose. Can any one suggest some thing meaningful? GNU gdb (GDB) 7.1-ubuntu Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type show copying and show warranty for details. This GDB was configured as x86_64-linux-gnu. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/... /usr/bin/firefox: not in executable format: File format not recognized Attaching to process 2266 Reading symbols from /bin/dash...(no debugging symbols found)...done. Reading symbols from /lib/libc.so.6...(no debugging symbols found)...done. Loaded symbols for /lib/libc.so.6 Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done. Loaded symbols for /lib64/ld-linux-x86-64.so.2 0x7fab77f8401a in wait4 () from /lib/libc.so.6 -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: debugging a process
On Thu, Sep 9, 2010 at 6:06 PM, Daniel Baluta daniel.bal...@gmail.com wrote: Hi Daniel For debugging purposes you can start with a `lighter' program. can you suggest some thing.Which you can consider as lighter program. In order for gdb to dump meaningful results the program must be compiled with debugging symbols enabled (-g flag should be present in compilation line). Ok. Useful information about a processes can be found with: * pmap, reports memory map of a process. * lsof, lists opened files for a process. * strace/ltrace, allows you to analyse system/function calls. * cat /proc/PID, various info about a process. Ok. -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: debugging a process
On Thu, Sep 9, 2010 at 6:28 PM, Paul-Ovidiu Dascalu paul.dasc...@gmail.com wrote: Hi Paul /usr/bin/firefox is not an executable file to begin with. Yes this thing I got in my search also it is not an executable. Also you can you 'strace' on a program to see the the system calls and signal a process uses. Yes I have tried this.I mean I have seen its output. I want to understand related things. As what more things are there in it to understand. -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
changing kernel variables at run time
How can one change the value of Kernel Variables at run time. -- Tapas -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: changing kernel variables at run time
On Wed, Sep 8, 2010 at 5:50 AM, Neependra Khare neependra.kh...@gmail.com wrote: On Tue, Sep 7, 2010 at 10:59 PM, Tapas Mishra mightydre...@gmail.com wrote: How can one change the value of Kernel Variables at run time. You can definitely use SystemTap's Guru mode for that. An specific example is given at:- http://www.redbooks.ibm.com/redpapers/pdfs/redp4469.pdf Thanks for the link. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: fine tuning the precision in calibrate.c
On Sun, Sep 5, 2010 at 9:25 AM, Tapas Mishra mightydre...@gmail.com wrote: loopbit = loops_per_jiffy; /* Gradually work on the lower-order bits */ while (lps_precision-- (loopbit = 1)) { loops_per_jiffy |= loopbit; How is loops_per_jiffy |= loopbit; OR operation above and ticks = jiffies; while (ticks == jiffies); /* Wait until the start of the next jiffy */ ticks = jiffies; /* Delay */ __delay(loops_per_jiffy); if (jiffies != ticks) /* longer than 1 tick */ loops_per_jiffy = ~loopbit; AND with Inverse loops_per_jiffy = ~loopbit; help to achieve the desired result. } -- Tapas -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: fine tuning the precision in calibrate.c
On Sun, Sep 5, 2010 at 9:25 AM, Tapas Mishra mightydre...@gmail.com wrote: Ok I have done some calculation using a pen and paper here is what are my results lets assume loops_per_jiffy = 1011 0010 loopbit = loops_per_jiffy; So loopbit = 1011 0010 /* Gradually work on the lower-order bits */ while (lps_precision-- (loopbit = 1)) { no idea of what lps_precision is may be some sort of check. loopbit = loopbit/2 by above operation so new value of loopbit is loopbit = 0101 1001 loops_per_jiffy |= loopbit; Now due to above loops_per_jiffy = loops_per_jiffy | loopbit so the result of an OR operation loops_per_jiffy = 1011 0010 OR 0101 1001 = 1011 which is higher than the initial value of loops_per_jiffy ticks = jiffies; simple while (ticks == jiffies); /* Wait until the start is also simple if due to some calculation you are in mid of jiffy interval then it will make sure that as tick==jiffies will come out of loop only at the start of jiffy of the next jiffy */ ticks = jiffies; simple /* Delay */ __delay(loops_per_jiffy); Will delay for the value loops_per_jiffy if (jiffies != ticks) /* longer than 1 tick */ loops_per_jiffy = ~loopbit; here comes the magic if it is not satisfying the if condition then will go back divide the loopbits by 2 as a result of (right shift) and the OR operation will make sure that the value which is divided by 2 of loopbits gets added to loops_per_jiffy will enter the delay loop and in this case if this time the if condition is true then the result of loops_per_jiffy = ~loopbit is loops_per_jiffy = loops_per_jiffy AND (~loopbit) where taking complement of loopbit as above makes it negative (not sure on this part) and the result is the value is subtracted (as it was more than required value) and then loopbit is again divided so added and this cycle will continue until exact value of loops_per_jiffy is calculated. } but such a logic which is used above is there any more example some where? -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
fine tuning the precision in calibrate.c
Hi, on the following link http://books.google.com/books?id=Boo57V0IOq0Cpg=PA24lpg=PA24dq=loopbit+%3D+loops_per_jiffysource=blots=pwHxgTVaX9sig=mmFc_E2o9-xS7Xy-kzYXxTu1-a8hl=enei=_RODTLP9H8bJcdPHpNALsa=Xoi=book_resultct=resultresnum=5ved=0CCQQ6AEwBA#v=onepageq=loopbit%20%3D%20loops_per_jiffyf=false Following code is given loopbit = loops_per_jiffy; /* Gradually work on the lower-order bits */ while (lps_precision-- (loopbit = 1)) { loops_per_jiffy |= loopbit; ticks = jiffies; while (ticks == jiffies); /* Wait until the start of the next jiffy */ ticks = jiffies; /* Delay */ __delay(loops_per_jiffy); if (jiffies != ticks) /* longer than 1 tick */ loops_per_jiffy = ~loopbit; } Can any one help to understand this section? -- Tapas -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
gdb error for 32 bit Ubuntu No symbol table is loaded. Use the file command.
I tried to run gdb on a 32 bit kernel image. gdb /boot/vmlinuz-2.6.28-11-generic /proc/kcore and tried to check loops_per_jiffy via gdb gdb vmlinuz-2.6.28-11-generic /proc/kcore GNU gdb 6.8-debian Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type show copying and show warranty for details. This GDB was configured as i486-linux-gnu... /tmp/vmlinuz-2.6.28-11-generic: not in executable format: File format not recognized Core was generated by `root=UUID=1c1bc84c-9ef5-4daa-a630-8fe29b5d12d1 ro quiet splash'. [New process 0] #0 0x in ?? () (gdb) whatis loops_per_jiffy No symbol table is loaded. Use the file command. (gdb) The last line of above message says no symbol table is loaded Use the file command. where as while invoking gdb I had used it. -- Tapas -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: gdb error for 32 bit Ubuntu No symbol table is loaded. Use the file command.
On Tue, Aug 31, 2010 at 4:56 PM, mayur nande mayur@gmail.com wrote: Hello, I guess you need to load the uncompressed kernel image (vmlinux) instead of the compressed one (vmlinuz). Ok so for that what do I need to do? Do you mean to say I need to compile a new kernel and then use that? -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: what is static inline void tvec_base
On Sat, Aug 28, 2010 at 12:06 PM, James Bond jamesbond.2...@gmail.com wrote: No not yet clear. To make a function call CPU has to save registers and pass on ret instructions when ever the function call ends if we have a small fucntion which is used in a file and a function call via CPU then over head of saving flag registers ,saving stack and making the called function return to the location where the call was made is so much that it is preferred to replace that call via the actual function itself hence if some one has such a function which has is of very less number of lines and has been called once or twice then it is good to declare it inline. The overhead that CPU has to undergo if the function is not inline is saving the current context ,flag,stack,heap ,(what ever is)the state of code in execution and then load the called function from a specific memory location. Doing this for small subroutines is resource consuming.So it is a good practise among kernel developers do declare functions inline when it is used once or twice and saves the CPU the over head involved in saving the stack,program counter flag registers and other registers which are being related to the program in execution. By using the word in laymans language I will say that part of code (function ) is actually written where ever the function call is made. For example following program example1.c #includestdio.h inline function ingen (X1,X2) { does some thing some thing return c; } function b( ) { step = function ingen (); } main() { b (); } If you were to execute above code call to function ingen () via function b() would replace the function ingen() by the code inside function ingen(). If you would not have declared function ingen as inline function then the CPU would jumped to some memory location where function ingen() is actually residing and then executed. In this case CPU just have to insert that code what ever function ingen() does when ever a call to function ingen() is made via function b(). Or which ever function in the code calls function ingen(). If the keyword static is added so that if the same function has been used at any other place then it should not affect the other files.Meaning the word static before a function makes its scope limited to that file only. If you have another program example2.c and compile cc example1.c example2.c then functions in exampl1.c would be available to example2.c and vice versa but use of word static restricts the function in their respective files. i.e. if example1.c has a static function then it will not be available to example2.c Since Linux kernel is made up of C and to make sure functions with similar names(if any) exist then they are not conflicting it is a good practice to declare a function as static. Declaring it inline reduces the overhead that CPU would have to do in actually calling a function. To have more digging about this you need to understand mechanism of function call as what does processor do when a function call is made. Clearly if you have a large code to execute the instruction is in memory and it has to come to cache so if you have large code and you declare that as inline it has disadvantage that cache miss will more. What I wanted to say is if you have a function is used at 10 places and you declare it inline 10 times then there would be cache miss more (because that inline part of code would not be in cache) and this will have disadvantage. static and inline functions is To make a function call CPU has to save registers and pass on ret instructions when ever the function call ends if we have a small fucntion which is used in a file and a function call via CPU then over head of saving flag registers ,saving stack and making the called function return to the location where the call was made is so much that it is preferred to replace that call via the actual function itself hence if some one has such a function which has is of very less number of lines and has been called once or twice then it is good to declare it inline. The overhead that CPU has to undergo if the function is not inline is saving the current context ,flag,stack,heap ,(what ever is)the state of code in execution and then load the called function from a specific memory location. Doing this for small subroutines is resource consuming.So it is a good practise among kernel developers do declare functions inline when it is used once or twice and saves the CPU the over head involved in saving the stack,program counter flag registers and other registers which are being related to the program in execution. By using the word in laymans language I will say that part of code (function ) is actually written where ever the function call is made. For example following program example1.c #includestdio.h inline function ingen (X1,X2) { does some thing some thing return c; } function b( ) { step = function ingen (); } main() { b (); } If you were to execute above code
Re: what is static inline void tvec_base
On Fri, Aug 27, 2010 at 10:53 PM, James Bond jamesbond.2...@gmail.com wrote: Hi, I am new to kernel development. So after being able to have some basic understand of some things I just went through source code. I was going through a file known as linux-2.6.34/kernel/timer.c and found following code. I want to understand what is it doing. What should I be reading to be able to understand it? static inline void timer_set_base(struct timer_list *timer, struct tvec_base *new_base) { timer-base = (struct tvec_base *)((unsigned long)(new_base) | tbase_get_deferrable(timer-base)); } What static does is to create a label for a certain global memory chunk and give that a value at compile time, plus not making it available to the linker. Look at these examples static int mystatic = 6; int main(void) { return 0; } Generated ASM is as follows: Code: .file static2.c .data .align 4 .type mystatic, @object .size mystatic, 4 mystatic: .long 6 .text .globl main .type main, @function main: pushl %ebp movl%esp, %ebp movl$0, %eax popl%ebp ret .size main, .-main .ident GCC: (Debian 4.4.4-8) 4.4.5 20100728 (prerelease) .section.note.GNU-stack,,@progbits Compare that with declaring the global variable as non-static: Code: int mynonstatic = 6; int main(void) { return 0; } Code: .file nonstatic2.c .globl mynonstatic .data .align 4 .type mynonstatic, @object .size mynonstatic, 4 mynonstatic: .long 6 .text .globl main .type main, @function main: pushl %ebp movl%esp, %ebp movl$0, %eax popl%ebp ret .size main, .-main .ident GCC: (Debian 4.4.4-8) 4.4.5 20100728 (prerelease) .section.note.GNU-stack,,@progbits The only difference is that in the non-static case, there's the .globl mynonstatic that makes that symbol available to the linker. Now, careful observation will make you notice that both global variables are declared as labels, exactly the same way as main is. ASM doesn't really distinguish between functions and variables (the @function and @object thing is just an optimization gcc does): all there is memory addresses that you conveniently can refer to with a label. So, when you declare a function static, what will happen is exactly the same: the function is given a value (its code) and make it unavailable to the linker... exactly what was done to the variable. Here you have the C and ASM for a static function: Code: .file stat_func.c .text .type something, @function something: pushl %ebp movl%esp, %ebp movl$0, %eax popl%ebp ret .size something, .-something .ident GCC: (Debian 4.4.4-8) 4.4.5 20100728 (prerelease) .section.note.GNU-stack,,@progbits Again, the value for something is its code, it's a global value but not available to the linker because there's no .globl something. What about local static variables? Actually, the idea of local variables is lost when compiling C to ASM. What you have is a global stack that each function is in charge to clean up when returning... therefore making its local values no longer available outside the function... but place a jmp and the value will be available. What happens with static variables is that the static again sets up a value at compile time and makes the symbol unavailable for the linker... as you'll see here: Code: int main(void) { static int mystatic = 6; return 0; } Code: .file static.c .text .globl main .type main, @function main: pushl %ebp movl%esp, %ebp movl$0, %eax popl%ebp ret .size main, .-main .data .align 4 .type mystatic.1248, @object .size mystatic.1248, 4 mystatic.1248: .long 6 .ident GCC: (Debian 4.4.4-8) 4.4.5 20100728 (prerelease) .section.note.GNU-stack,,@progbits The only difference here is that the .data section has been placed *after* the main rets (a kind of return you have in ASM...)... ASM indentation is awful here, but actually main ends at the ret, not at the mystatic.1248 label. Ok, I'm not sure why the name is mangled but it's clear that the variable is declared as global even when we declared it as local in C. What will happen is that the C compiler will restrict the usage of that symbol to the main function, but you clearly see that it's just a way to create the illusion of locality... It's actually a global and that's why its value is persistent across the program's execution. So, in summary, it seems that the real effective meaning (I don't care what
Re: branch annotation
On Sat, Aug 28, 2010 at 10:21 PM, James Bond jamesbond.2...@gmail.com wrote: I want to know the concept of Branch Annotation with respect to Linux Kernel use of likely() and unlikely() Please give some links if you have any to share. http://kerneltrap.org/node/4705 http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Other-Builtins.html -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: branch annotation
On Sat, Aug 28, 2010 at 10:21 PM, James Bond jamesbond.2...@gmail.com wrote: Please give some links if you have any to share. You also need to search pipelined instructions branch prediction 5 stage pipeline speculative instruction execution (considers it wont write any thing in memory) pipeline flush (if prediction is wrong) -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: what is static inline void tvec_base
What I understand with respect to static and inline functions is To make a function call CPU has to save registers and pass on ret instructions when ever the function call ends if we have a small fucntion which is used in a file and a function call via CPU then over head of saving flag registers ,saving stack and making the called function return to the location where the call was made is so much that it is preferred to replace that call via the actual function itself hence if some one has such a function which has is of very less number of lines and has been called once or twice then it is good to declare it inline. You need to understand mechanism of function call as what does processor do when a function call is made. -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: what is static inline void tvec_base
Sorry in previous post I did not made clear actually what I wanted to say is if you have a function is used at 10 places and you declare it inline 10 times then there would be cache miss more and then it will have disadvantage. On Sat, Aug 28, 2010 at 10:37 AM, Tapas Mishra mightydre...@gmail.com wrote: I forgot to mention If you have a large code to execute the instruction is in memory and it has to come to cache so if you have large code and you declare that as inline it has disadvantage that cache miss will more. -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: linux/module.h does not exist
No It did not worked I tried what you said. Here is the new program. If possible just copy paste the program and try to run. #include linux/kernel.h #include asm/syscalls.h #include linux/module.h #include linux/unistd.h extern void *sys_table[]; asmlinkage int(*main_sys_exit)(int); asmlinkage int alt_exit_function(int err_code) { printk(Sys_exit called with err_code=%d\n,err_code); return main_sys_exit(err_code); } int init_module() { main_sys_exit=sys_table[__NR_exit]; sys_table[__NR_exit]=alt_exit_function; } void cleanup_module() { sys_table[__NR_exit]=main_sys_exit; } Following way I tried to do it. gcc -I /usr/src/linux-headers-`uname -r`/include -I /usr/src/linux-headers-`uname -r`/linux -Wall -DMODULE -D__KERNEL__ -DLINUX -c sample2.c and following errors I got http://pastebin.com/ZGRD8cC3 any more guess? -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: linux/module.h does not exist
Sharad you are right. It did worked I got a warning in it. make -C /lib/modules/2.6.28-11-generic/build M=/home/tapas/LKP/pandora/temp/sample2 modules make[1]: Entering directory `/usr/src/linux-headers-2.6.28-11-generic' CC [M] /home/tapas/LKP/pandora/temp/sample2/sample21.o /home/tapas/LKP/pandora/temp/sample2/sample21.c: In function ‘init_module’: /home/tapas/LKP/pandora/temp/sample2/sample21.c:17: warning: control reaches end of non-void function Building modules, stage 2. MODPOST 1 modules WARNING: sys_table [/home/tapas/LKP/pandora/temp/sample2/sample21.ko] undefined! CC /home/tapas/LKP/pandora/temp/sample2/sample21.mod.o LD [M] /home/tapas/LKP/pandora/temp/sample2/sample21.ko make[1]: Leaving directory `/usr/src/linux-headers-2.6.28-11-generic' but the program in book which is used is #include linux/kernel.h #include linux/module.h #include sys/syscall.h extern void *sys_table[]; asmlinkage int(*main_sys_exit)(int); asmlinkage int alt_exit_function(int err_code) { printk(Sys_exit called with err_code=%d\n,err_code); return main_sys_exit(err_code); } int init_module() { main_sys_exit=sys_table[__NR_exit]; sys_table[__NR_exit]=alt_exit_function; } void cleanup_module() { sys_table[__NR_exit]=main_sys_exit; } and I made a Makefile for the same as (My program name is sample2.c) obj-m += sample2.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean and got following error with the Makefile approach for the program given in book. ta...@tapas-laptop:~/LKP/pandora/temp/sample2$ make make -C /lib/modules/2.6.28-11-generic/build M=/home/tapas/LKP/pandora/temp/sample2 modules make[1]: Entering directory `/usr/src/linux-headers-2.6.28-11-generic' CC [M] /home/tapas/LKP/pandora/temp/sample2/sample2.o /home/tapas/LKP/pandora/temp/sample2/sample2.c:3:25: error: sys/syscall.h: No such file or directory /home/tapas/LKP/pandora/temp/sample2/sample2.c: In function ‘init_module’: /home/tapas/LKP/pandora/temp/sample2/sample2.c:14: error: ‘__NR_exit’ undeclared (first use in this function) /home/tapas/LKP/pandora/temp/sample2/sample2.c:14: error: (Each undeclared identifier is reported only once /home/tapas/LKP/pandora/temp/sample2/sample2.c:14: error: for each function it appears in.) /home/tapas/LKP/pandora/temp/sample2/sample2.c: In function ‘cleanup_module’: /home/tapas/LKP/pandora/temp/sample2/sample2.c:19: error: ‘__NR_exit’ undeclared (first use in this function) make[2]: *** [/home/tapas/LKP/pandora/temp/sample2/sample2.o] Error 1 make[1]: *** [_module_/home/tapas/LKP/pandora/temp/sample2] Error 2 make[1]: Leaving directory `/usr/src/linux-headers-2.6.28-11-generic' make: *** [all] Error 2 Any idea of what is it complaining about? -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: linux/module.h does not exist
He he tried what you said. I wont 2 cents :) It did not worked Following is new program #include linux/kernel.h #include sys/syscalls.h #include linux/module.h extern void *sys_table[]; asmlinkage int(*main_sys_exit)(int); asmlinkage int alt_exit_function(int err_code) { printk(Sys_exit called with err_code=%d\n,err_code); return main_sys_exit(err_code); } int init_module() { main_sys_exit=sys_table[__NR_exit]; sys_table[__NR_exit]=alt_exit_function; } void cleanup_module() { sys_table[__NR_exit]=main_sys_exit; } Following is way I compiled gcc -I /usr/include/ -Wall -DMODULE -D__KERNEL__ -DLINUX -c sample2.c and following are the errors http://pastebin.com/u3mPhfUf Then I compiled it also in following way gcc -I /usr/src/linux-headers-2.6.28-11-generic/include/linux/ -Wall -DMODULE -D__KERNEL__ -DLINUX -c sample2.c and got following errors http://pastebin.com/HzX0DBz1 . So 2 cents :) any how this is the original link where I was trying the code page 48 left hand column https://docs.google.com/fileview?id=0B2A4urYOAf6POTI1OGE1MjctM2UyMC00OGUzLThlNDUtZDBhOWFjY2Y1MDUzhl=en Any more suggestions. -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: linux/module.h does not exist
On Sun, Aug 22, 2010 at 1:48 PM, Mulyadi Santosa mulyadi.sant...@gmail.com wrote: uhum? AFAIK sys call table is not exported in 2.6.x so even if your code is perfectly compiled and produced valid .ko kernel module, I doubt it will work. Unless I missed something in recent development Regarding the missing __NR_exit, I think you forgot to include asm/unistd.h. find /usr -name unistd.h http://pastebin.com/NRib2tB6 which one? And try to include asm/syscalls find /usr/ -name syscalls* /usr/src/alsa/alsa-driver-1.0.21/include/syscalls_26.h /usr/src/linux-headers-2.6.28-11/arch/x86/include/asm/syscalls.h /usr/src/linux-headers-2.6.28-11/arch/sh/include/asm/syscalls_32.h /usr/src/linux-headers-2.6.28-11/arch/sh/include/asm/syscalls.h /usr/src/linux-headers-2.6.28-11/arch/sh/include/asm/syscalls_64.h /usr/src/linux-headers-2.6.28-11/arch/sparc/include/asm/syscalls.h /usr/src/linux-headers-2.6.28-11/arch/powerpc/include/asm/syscalls.h /usr/src/linux-headers-2.6.28-11/include/linux/syscalls.h which one? Once again original link from where I got the above program http://techblog.aasisvinayak.com/a-voyage-to-kernel-first-24-parts/ https://docs.google.com/fileview?id=0B2A4urYOAf6POTI1OGE1MjctM2UyMC00OGUzLThlNDUtZDBhOWFjY2Y1MDUzhl=en page 48 of pdf. Left hand side I believe the author did not miss any thing? -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: address space of kernel thread
http://ldn.linuxfoundation.org/article/kernel-symbols-whats-available-your-module-what-isnt On Sun, Aug 22, 2010 at 3:58 PM, Parmenides mobile.parmeni...@gmail.com wrote: Hi, It's said that kernel thread is running in kernel address space only. I wonder what's the meaning of running in kernel address space only. When kernel thread running, which page table is used? Is there any special characteristics of this page table? -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: linux/module.h does not exist
On Sun, Aug 22, 2010 at 6:11 PM, Robert P. J. Day rpj...@crashcourse.ca wrote: i'm just catching up with this thread and, if i read it correctly, the goal is to build a loadable kernel module using the proper incantation and options on the gcc command line, is that correct? Yes yes right but i'm not sure i see the value in tha I was reading and trying to understand the programs given in the Linux Magazine to which I have posted the links. t -- why not just build the module using all of the compilation infrastructure built into the kernel source Makefile and accompanying build structure? Sure here is my Makefile ifeq($(KERNELRELEASE),) KERNELDIR ?= /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) .PHONY: build clean build: $(MAKE) -C $(KERNELDIR) M=$(PWD) modules clean: rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c rm -rf modules.order Module.symvers else $(info Building with KERNELRELEASE =${KERNELRELEASE}) obj-m := sample2.o endif I did make but I got following error Makefile:1: *** missing separator. Stop. I will try the Makefile approach also. Since till now I just was trying an approach the author had described so had not tried Makefile. not trying to market, but i explain how to do that here: http://crashcourse.ca/introduction-linux-kernel-programming/introduction-linux-kernel-programming :) in the first few lessons, which are publicly available to everyone. granted, you *can* reproduce all of that manually if you want, but i don't see the point in making this any more difficult than it has to be. of course, if i've misunderstood what this thread is about, you can ignore all this. :-) No if interested do stay in this thread. I am not sure if the program in magazine is wrong or correct or what did the author tried to convey? Specially the asm_linkage part what is the author trying to explain the readers. p.s. specifically, i demonstrate how to build your first kernel module here: http://crashcourse.ca/introduction-linux-kernel-programming/lesson-4-writing-and-running-your-first-kernel-module again, that lesson is publicly available to everyone. Ya I found it quite useful. -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: linux/module.h does not exist
Ok I corrected the make file there should have been a blank space here is the new make file for the program ifeq ($(KERNELRELEASE),) KERNELDIR ?= /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) .PHONY: build clean build: $(MAKE) -C $(KERNELDIR) M=$(PWD) modules clean: rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c rm -rf modules.order Module.symvers else $(info Building with KERNELRELEASE =${KERNELRELEASE}) obj-m := sample2.o endif and following were the errors when I tried to execute it make ta...@tapas-laptop:~/LKP/pandora/temp/sample2$ make make -C /lib/modules/2.6.28-11-generic/build M=/home/tapas/LKP/pandora/temp/sample2 modules make[1]: Entering directory `/usr/src/linux-headers-2.6.28-11-generic' Building with KERNELRELEASE =2.6.28-11-generic CC [M] /home/tapas/LKP/pandora/temp/sample2/sample2.o /home/tapas/LKP/pandora/temp/sample2/sample2.c:2:26: error: sys/syscalls.h: No such file or directory /home/tapas/LKP/pandora/temp/sample2/sample2.c: In function ‘init_module’: /home/tapas/LKP/pandora/temp/sample2/sample2.c:14: error: ‘__NR_exit’ undeclared (first use in this function) /home/tapas/LKP/pandora/temp/sample2/sample2.c:14: error: (Each undeclared identifier is reported only once /home/tapas/LKP/pandora/temp/sample2/sample2.c:14: error: for each function it appears in.) /home/tapas/LKP/pandora/temp/sample2/sample2.c: In function ‘cleanup_module’: /home/tapas/LKP/pandora/temp/sample2/sample2.c:19: error: ‘__NR_exit’ undeclared (first use in this function) make[2]: *** [/home/tapas/LKP/pandora/temp/sample2/sample2.o] Error 1 make[1]: *** [_module_/home/tapas/LKP/pandora/temp/sample2] Error 2 make[1]: Leaving directory `/usr/src/linux-headers-2.6.28-11-generic' make: *** [build] Error 2 the program for which I made above Makefile is #include linux/kernel.h #include sys/syscalls.h #include linux/module.h extern void *sys_table[]; asmlinkage int(*main_sys_exit)(int); asmlinkage int alt_exit_function(int err_code) { printk(Sys_exit called with err_code=%d\n,err_code); return main_sys_exit(err_code); } int init_module() { main_sys_exit=sys_table[__NR_exit]; sys_table[__NR_exit]=alt_exit_function; } void cleanup_module() { sys_table[__NR_exit]=main_sys_exit; } -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: linux/module.h does not exist
On Sun, Aug 22, 2010 at 8:49 PM, arshad hussain arshad.su...@gmail.com wrote: Ok. So you included linux/syscalls.h instead of sys/syscalls.h and still it cannot find Yes this is what happened __NR_exit symbol. Right? Or it compiled successfully but did not load. Not reached here. -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: linux/module.h does not exist
Upto this point I have tried Step1) gcc -Wall -DMODULE -D__KERNEL__ -DLINUX -c sample2.c Step2) added -I to gcc flag gcc -Wall -DMODULE -D__KERNEL -DLINUX -I /usr/src/linux-headers-2.6.28- 11/include/ -c sample2.c Step3) added one more -I with asm in path gcc -I /usr/src/linux-headers-2.6.28-11/arch/x86/include/asm/ -I /usr/src/linux-headers-2.6.28-11/include/ -c sample2.c Step4) added asm/x86/include in path gcc -I /usr/src/linux-headers-2.6.28-11/arch/x86/include/ -I /usr/src/linux-headers-2.6.28-11/include/ -c sample2.c Step5) added linux in -I of second argument gcc -I /usr/src/linux-headers-2.6.28-11/arch/x86/include/asm/ -I /usr/src/linux-headers-2.6.28-11/include/linux/ -c sample2.c Step6) removed asm from first argument and linux from second gcc -I /usr/src/linux-headers-2.6.28-11/arch/x86/include/ -I /usr/src/linux-headers-2.6.28-11/include/ -c sample2.c Any more guesses as what is it failing? This is the link http://techblog.aasisvinayak.com/a-voyage-to-kernel-first-24-parts/ where author has shared his programs. These are working programs which have failed on my hardware. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: linux/module.h does not exist
Ok I did try what you suggested. From http://tldp.org/LDP/lkmpg/2.6/html/x181.html#AEN189 here is my Makefile obj-m += sample2.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean but I got same errors ta...@tapas-laptop:~/LKP/pandora/temp/sample2$ make make -C /lib/modules/2.6.28-11-generic/build M=/home/tapas/LKP/pandora/temp/sample2 modules make[1]: Entering directory `/usr/src/linux-headers-2.6.28-11-generic' CC [M] /home/tapas/LKP/pandora/temp/sample2/sample2.o /home/tapas/LKP/pandora/temp/sample2/sample2.c:2:25: error: sys/syscall.h: No such file or directory /home/tapas/LKP/pandora/temp/sample2/sample2.c: In function ‘init_module’: /home/tapas/LKP/pandora/temp/sample2/sample2.c:14: error: ‘__NR_exit’ undeclared (first use in this function) /home/tapas/LKP/pandora/temp/sample2/sample2.c:14: error: (Each undeclared identifier is reported only once /home/tapas/LKP/pandora/temp/sample2/sample2.c:14: error: for each function it appears in.) /home/tapas/LKP/pandora/temp/sample2/sample2.c: In function ‘cleanup_module’: /home/tapas/LKP/pandora/temp/sample2/sample2.c:19: error: ‘__NR_exit’ undeclared (first use in this function) make[2]: *** [/home/tapas/LKP/pandora/temp/sample2/sample2.o] Error 1 make[1]: *** [_module_/home/tapas/LKP/pandora/temp/sample2] Error 2 make[1]: Leaving directory `/usr/src/linux-headers-2.6.28-11-generic' make: *** [all] Error 2 Following is the program for which it was Makefile I am mentioning it here for the sake of clarity so that you dont have to read first post #include linux/kernel.h #include sys/syscall.h #include linux/module.h extern void *sys_table[]; asmlinkage int(*main_sys_exit)(int); asmlinkage int alt_exit_function(int err_code) { printk(Sys_exit called with err_code=%d\n,err_code); return main_sys_exit(err_code); } int init_module() { main_sys_exit=sys_table[__NR_exit]; sys_table[__NR_exit]=alt_exit_function; } void cleanup_module() { sys_table[__NR_exit]=main_sys_exit; } ~ -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: linux/module.h does not exist
Hi Dave I could not understand your reply. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: linux/module.h does not exist
GCC does not have information about compiling the kernel. The information that you were suggested to read it how to configure GCC so it can find the kernel headers. I checked these 2 documents http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1124.pdf http://gcc.gnu.org/onlinedocs/gcc-4.4.4/gcc.pdf but could not understand as what you wanted me to understand. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: linux/module.h does not exist
Yes you were right I had missed one line following. asmlinkage int alt_exit_function(int err_code) I have added this line so the program becomes now #include linux/kernel.h #include sys/syscall.h #include linux/module.h extern void *sys_table[]; asmlinkage int(*main_sys_exit)(int); asmlinkage int alt_exit_function(int err_code) { printk(Sys_exit called with err_code=%d\n,err_code); return main_sys_exit(err_code); } int init_module() { main_sys_exit=sys_table[__NR_exit]; sys_table[__NR_exit]=alt_exit_function; } void cleanup_module() { sys_table[__NR_exit]=main_sys_exit; } I compiled it got new errors gcc -Wall -DMODULE -D__KERNEL -DLINUX -c sample2.c sample2.c:3:26: error: linux/module.h: No such file or directory sample2.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’ sample2.c:6: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’ sample2.c: In function ‘init_module’: sample2.c:14: error: ‘main_sys_exit’ undeclared (first use in this function) sample2.c:14: error: (Each undeclared identifier is reported only once sample2.c:14: error: for each function it appears in.) sample2.c:15: error: ‘alt_exit_function’ undeclared (first use in this function) sample2.c:16: warning: control reaches end of non-void function sample2.c: In function ‘cleanup_module’: sample2.c:19: error: ‘main_sys_exit’ undeclared (first use in this function) On Fri, Aug 20, 2010 at 9:37 PM, Dave Hylands dhyla...@gmail.com wrote: Hi Tapas, Replying to all this time... On Fri, Aug 20, 2010 at 12:52 AM, Tapas Mishra wrote: Hi Dave I could not understand your reply. Go back to page 48 of the PDF, and look at the example. And then look at the code you posted. It's missing a line in the spot I indicated. -- Dave Hylands Shuswap, BC, Canada http://www.DaveHylands.com/ -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: linux/module.h does not exist
Also I did a find on module.h which of them among here should I include? As some one pointed out to use -I flag /usr/src/linux-headers-2.6.28-11-generic/include/linux/module.h /usr/src/linux-headers-2.6.28-11/arch/alpha/include/asm/module.h /usr/src/linux-headers-2.6.28-11/arch/x86/include/asm/module.h /usr/src/linux-headers-2.6.28-11/arch/sh/include/asm/module.h /usr/src/linux-headers-2.6.28-11/arch/ia64/include/asm/module.h /usr/src/linux-headers-2.6.28-11/arch/ia64/include/asm/sn/module.h /usr/src/linux-headers-2.6.28-11/arch/arm/mach-ns9xxx/include/mach/module.h /usr/src/linux-headers-2.6.28-11/arch/arm/include/asm/module.h /usr/src/linux-headers-2.6.28-11/arch/mips/include/asm/module.h /usr/src/linux-headers-2.6.28-11/arch/avr32/include/asm/module.h /usr/src/linux-headers-2.6.28-11/arch/sparc/include/asm/module.h /usr/src/linux-headers-2.6.28-11/arch/s390/include/asm/module.h /usr/src/linux-headers-2.6.28-11/arch/cris/include/asm/module.h /usr/src/linux-headers-2.6.28-11/arch/h8300/include/asm/module.h /usr/src/linux-headers-2.6.28-11/arch/m68knommu/include/asm/module.h /usr/src/linux-headers-2.6.28-11/arch/blackfin/include/asm/module.h /usr/src/linux-headers-2.6.28-11/arch/powerpc/include/asm/module.h /usr/src/linux-headers-2.6.28-11/arch/parisc/include/asm/module.h /usr/src/linux-headers-2.6.28-11/include/asm-m68k/module.h /usr/src/linux-headers-2.6.28-11/include/asm-m32r/module.h /usr/src/linux-headers-2.6.28-11/include/asm-mn10300/module.h /usr/src/linux-headers-2.6.28-11/include/linux/module.h /usr/src/linux-headers-2.6.28-11/include/asm-frv/module.h /usr/src/linux-headers-2.6.28-11/include/asm-xtensa/module.h /usr/include/sepol/policydb/module.h /usr/include/sepol/module.h -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: linux/module.h does not exist
Ohh Ok now it becomes a bit clear, On Sat, Aug 21, 2010 at 8:51 AM, Dave Hylands dhyla...@gmail.com wrote: This one: /usr/src/linux-headers-2.6.28-11/include/linux/module.h I suspect that you'll also need to add /usr/src//usr/src/linux-headers-2.6.28-11/arch/x86/include/asm to your search path. Ok is this the one you said to include in gcc search path? With -I option? -- Tapas http://mightydreams.blogspot.com http://wiki.xensource.com/xenwiki/Xen_on_4_app_servers -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: linux/module.h does not exist
Apart from what you said I notice adding /linux to reduces the errors. So when I tried gcc -I /usr/src/linux-headers-2.6.28-11/arch/x86/include/asm/ -I /usr/src/linux-headers-2.6.28-11/include/linux/ -c sample2.c got less errors sample2.c:3:26: error: linux/module.h: No such file or directory sample2.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’ sample2.c:6: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’ sample2.c: In function ‘init_module’: sample2.c:14: error: ‘main_sys_exit’ undeclared (first use in this function) sample2.c:14: error: (Each undeclared identifier is reported only once sample2.c:14: error: for each function it appears in.) sample2.c:15: error: ‘alt_exit_function’ undeclared (first use in this function) sample2.c: In function ‘cleanup_module’: sample2.c:19: error: ‘main_sys_exit’ undeclared (first use in this function) -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: linux/module.h does not exist
I was able to write my first module and saw that in syslog. I am trying this code from here https://docs.google.com/fileview?id=0B2A4urYOAf6POTI1OGE1MjctM2UyMC00OGUzLThlNDUtZDBhOWFjY2Y1MDUzhl=en page 48 left hand section. Headers are installed. sudo apt-get install linux-headers-generic [sudo] password for tapas: Reading package lists... Done Building dependency tree Reading state information... Done linux-headers-generic is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 115 not upgraded. Any more suggestions? -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: linux/module.h does not exist
Ok I looked at man page of gcc and searched for DMODULE D__KERNEL and DLINUX got following Pattern not found (press RETURN) -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
linux/module.h does not exist
I wrote following program in my home directory. #include linux/kernel.h #include sys/syscall.h #include linux/module.h extern void *sys_table[]; asmlinkage int(*main_sys_exit)(int); { printk(Sys_exit called with err_code=%d\n,err_code); return main_sys_exit(err_code); } int init_module() { main_sys_exit=sys_table[__NR_exit]; sys_table[__NR_exit]=alt_exit_function; } void cleanup_module() { sys_table[__NR_exit]=main_sys_exit; } ~ [/code] When I compiled it as gcc -Wall -DMODULE -D__KERNEL__ -DLINUX -c sample2.c[/code] I got following error sample2.c:3:26: error: linux/module.h: No such file or directory sample2.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’ sample2.c:6: error: expected identifier or ‘(’ before ‘{’ token sample2.c: In function ‘init_module’: sample2.c:13: error: ‘main_sys_exit’ undeclared (first use in this function) sample2.c:13: error: (Each undeclared identifier is reported only once sample2.c:13: error: for each function it appears in.) sample2.c:14: error: ‘alt_exit_function’ undeclared (first use in this function) sample2.c:15: warning: control reaches end of non-void function sample2.c: In function ‘cleanup_module’: sample2.c:18: error: ‘main_sys_exit’ undeclared (first use in this function) What is the above error and why is it coming? I did all this in my home directory. -- Tapas -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: How to Begin
Victor thanks for the link. I really found it helpful. On Wed, Aug 11, 2010 at 7:35 PM, Victor Rodriguez vm.ro...@gmail.com wrote: On Wed, Aug 11, 2010 at 8:56 AM, jerome zh jerome...@gmail.com wrote: 2010/8/11 Fazal Azim azimfa...@gmail.com: How to Begin undersatnding Linux kernal source code. Thanks Fazal Azim The drivers IMHO may be a good place for you to start with -- Regards, Jerome -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ Yes is a really good option star to create your own LDD, check this web page and try to make a driver for the parallel port of your computer or a hello Word http://www.freesoftwaremagazine.com/articles/drivers_linux?page=0%2C0 Hope it helps Victor Rodriguez -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ -- Tapas -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
multiple streaming servers in a cloud
Probably some one on this list may give me some idea to which direction I should look or think. This question is not for kernel development but it is a problem I am facing. I have multiple video streaming servers running on my LAN. For different subdomains. i.e. site1.mydomain.com site2.mydomain.com site3.mydomain.com site4.mydomain.com All the above websites have different content and are different websites. The front end to the world is apache2 on a server which has public IP. To be able to reach the streaming server I embed a javascript in HTML pages as follows Code: embed . var=rtmp://site1.my_domain.com the problem is the website are many site1.mydomain.com site2.mydomain.com site3.mydomain.com site4.mydomain.com each on a separate server. Each of these four have their own streaming servers the front end to each of these four is apache running on gateway If I run rtmp on each of the subdomains at a different port how will I make sure a request such as rtmp://site1.mydomain.com rtmp://site2.mydomain.com goes to their respective servers. from the front end server from gateway. What do I need to handle in this case ? For handling HTTP requests in this case I use Apache Reverse Proxy but for rtmp requests I am not clear as which direction to proceed. What I want is if I embed a code in javascript as rtmp://site1.mydomain.com then request for rtmp://site1.mydomain.com rtmp://site2.mydomain.com goes to the server on LAN which has site1.mydomain.com site2.mydomain.com respectively. The gateway is Linux Server. Which redirects to these websites via Reverse Proxy at apache what more I need to put in my vhosts at gateway. If some one has any suggestions let me know. -- Tapas -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
what port does git uses
I am running following command which is giving error git clone git://git.kernel.org/pub/scm/linux/kernel/git/trovalds/linux-2.6.git linux-2.6 Initialized empty Git repository in /home/tapas/LKP/pandora/linux-2.6/.git/ fatal: The remote end hung up unexpectedly Some one suggested me to check my firewall I am not clear as which port does git uses. Can some one tell what is wrong in above command. Ubuntu 9.04 -- Tapas -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: How can I search this discussion list?
I use http://www.google.com and keyword insite:www.kernelnewbies.org On Fri, Jun 4, 2010 at 4:14 AM, Srdjan Todorovic todorovi...@googlemail.com wrote: Hi, On 3 June 2010 21:48, StephanT stman937-linew...@yahoo.com wrote: I need to find topics discussed here some time ago. I don't remember exactly the date of the discussion - so I'd like to do a search on the whole archive. Is this possible and how? http://kernelnewbies.org/ML That page says: Most of these lists can be searched via the http://marc.theaimsgroup.com/ archive. http://marc.info/?l=kernelnewbiesr=1w=2 That would be a good starting point to see if the discussion is in the archives. Regards, Srdjan -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ -- Tapas -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Getting driver module name from device node?
Mayank any question is not dumb.Had it been so many of us would not have been subscribed to this list. On Thu, Jun 3, 2010 at 12:34 AM, Mayank Kaushik mayank.ute...@gmail.com wrote: I found this for network devices: ls -l /sys/class/net/eth0/device/driver lrwxrwxrwx 1 root root 0 2006-02-09 14:16 /sys/class/net/eth0/device/driver - ../../../../bus/pci/drivers/e1000 which is what I had been looking for. On Tue, May 18, 2010 at 5:14 PM, Mayank Kaushik mayank.ute...@gmail.com wrote: Hi everyone, Sorry if this is a dumb question. For a device node in the /dev directory, how do i figure out which driver is handling that node? I'm looking for a way to do this from the shell prompt. Thanks, -Mayank -- Regards, Mayank -- Tapas -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: hi -- i was also a newbie once--thanks list.
1)Bach 2)ALP 3)UTLK Is for Understanding The Linux Kernel 4)LDD Linux Device Drivers I could not get what is ALP and Bach ? Do you have any bookmarks pass them on here. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
delay calibration init/calibrate.c
I am not clear with delay loop.May be some of you can help here. http://lxr.linux.no/#linux+v2.6.33/init/calibrate.c#L54 In comments it is mentioning So, we do * 1. pre_start - When we are sure that jiffy switch hasn't happened * 2. check jiffy switch * 3. start - timer value before or after jiffy switch * 4. post_start - When we are sure that jiffy switch has happened What is all that pre_start and why is it needed to be used over here? Here is some thing which I am wondering not because of logic in same program What is the CPU busy with between timer ticks I guess it is the calculation of delay as mentioned here in this code and what exactly is meant by timer tick? If you can see the following comment on the above mentioned link it says A simple loop like .wont do I am not clear why they mentioned a simple loop wont do ? /* 045 * A simple loop like 046 * while ( jiffies start_jiffies+1) 047 * start = read_current_timer(); 048 * will not do. As we don't really know whether jiffy switch 049 * happened first or timer_value was read first. And some asynchronous 050 * event can happen between these two events introducing errors in lpj. 051 * 052 * So, we do -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
question about init/calibrate.c
I am not clear with the logic of init/calibrate.c http://lxr.ncu.cc/source/init/calibrate.c from line 45 it mentions the following comment. /* 045 * A simple loop like 046 * while ( jiffies start_jiffies+1) 047 * start = read_current_timer(); 048 * will not do. As we don't really know whether jiffy switch 049 * happened first or timer_value was read first. And some asynchronous 050 * event can happen between these two events introducing errors in lpj. 051 * 052 * So, we do 053 * 1. pre_start - When we are sure that jiffy switch hasn't happened 054 * 2. check jiffy switch 055 * 3. start - timer value before or after jiffy switch 056 * 4. post_start - When we are sure that jiffy switch has happened 057 * 058 * Note, we don't know anything about order of 2 and 3. 059 * Now, by looking at post_start and pre_start difference, we can 060 * check whether any asynchronous event happened or not 061 */ I am not clear with why is that pre_start condition being checked.How is happening of jiffy switch here affecting the logic of the calibrate.c and why is it important? -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: suggestion on writing driver
I also had this problem and was suggested to real O Reilly Book . I have found one more interesting book see if it suits you http://www.amazon.com/Essential-Device-Drivers-Sreekrishnan-Venkateswaran/dp/0132396556 then you may have a copy of it. I am currently stuck up with init/calibrate.c that is where kernel creates delay in processes. On Tue, Apr 20, 2010 at 1:34 AM, Greg Freemyer greg.freem...@gmail.com wrote: On Mon, Apr 19, 2010 at 10:29 AM, Niamathullah sharief newbie...@gmail.com wrote: Hello, I am newbie to programming. I want to write some USB driver for any USB device. Can anyone suggest me what will be better one to start programming drivers. I know only c programming. The vast majority of the kernel is c code. So c programming is all you need unless you want to drill into assembly which you should be able to avoid in almost all cases. But the kernel code is very complex, so I would not pick it as a programming learning experience. Greg -- Greg Freemyer Head of EDD Tape Extraction and Processing team Litigation Triage Solutions Specialist http://www.linkedin.com/in/gregfreemyer CNN/TruTV Aired Forensic Imaging Demo - http://insession.blogs.cnn.com/2010/03/23/how-computer-evidence-gets-retrieved/ The Norcross Group The Intersection of Evidence Technology http://www.norcrossgroup.com -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ -- Tapas http://wiki.xensource.com/xenwiki/How_to_run_4_Application_servers_on_same_piece_of_hardware_with_a_separate_OS_for_each_of_them. +91 8971248477 -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ