changing linux kernel code??

Posted on 2003-02-27
Medium Priority
Last Modified: 2010-04-21
I am trying to put some debug messages in linux host stack source files, but I am not able to see those changes after rebuilding kernel.

is there anyother way to get this done, how can i add my code??

Question by:leruj
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 8040785
Are you using printf() to print debug messages? If so, kernel can't use this function as it is part of libc. No library based function calls are possible from within the kernel.

Use printk() instead.


Expert Comment

ID: 8045467
I think we can assume he isn't using printf(), because the kernel would not have built if he did.

The usual cause of missing printk's is that you aren't looking in the right place for them.

So how about some details:  How are you attempting to issue debug messages, and how are you concluding that you aren't getting them?

I'm also wondering what "linux host stack" source files are.  I'm assuming they're Linux kernel source files.

Author Comment

ID: 8050739
I am using printk with KERN_DEBUG priority.
I have to make whole kernel again to see changes and restart with new kernel again, its not suiting me.

I am looking for something that i dont have to make the whole kernel but host sources(/usr/src/linux.../drivers/usb/host), also i dont have to restart my system with new kernel.


Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.


Expert Comment

ID: 8052677
So the problem has changed from you can't get messages after rebuilding the kernel to you want to get newly added messages without rebuilding the kernel?

I don't know what this USB host stuff is -- my kernel does not have a drivers/usb/host -- but is it a loadable kernel module?  If not, it should be.  If you build this module as an LKM, then you have only to rebuild and reload the LKM and you will see the results of any printk you added.  You don't have to rebuild or restart the rest of the kernel.

Author Comment

ID: 8054387
bryanh, can you please look at kernel version 2.5.60? yeah i have it as LKM, but I am not able to build my modules.

Also I need to know whether I have to write my own Rules.make and Makefile to build a seperate module,say ehci-hcd??


Accepted Solution

bryanh earned 400 total points
ID: 8062219
Sorry, I don't have convenient access to 2.5 source code.  I haven't worked with it, but I've read a lot.  Building an LKM is quite different from the past, and I've heard it is hard to build one without integrating it into the kernel build system.  (By contrast, in 2.4 it's easy to keep LKM sources in a whole different directory and write all your own make files).

And it seems the question has changed again such that it is now one of not being able to build modules.  But you don't provide any details one could use to answer that question.
LVL 20

Expert Comment

ID: 9983511
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: bryanh {http:#8062219}

Please leave any comments here within the next seven days.

EE Cleanup Volunteer

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month15 days, 8 hours left to enroll

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question