Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7989431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:45:02+00:00 2026-06-04T12:45:02+00:00

I am following the following tutorial , trying to learn how to develop device

  • 0

I am following the following tutorial, trying to learn how to develop device drivers, and in Chapter 2, the focus is to develop a working module and insert it into the kernel. I used the following code (hello.c):

#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>

MODULE_LICENSE("Dual BSD/GPL");

static int hello_init(void)
{
    printk(KERN_ALERT "Hello World!\n");
    return 0;
}

static void hello_exit(void)
{
    printk(KERN_ALERT "Goodbye, cruel world!\n");
}

module_init(hello_init);
module_exit(hello_exit);

And my this is the Makefile:

obj-m += hello.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

I then run the following in LXTerminal:

brian@brian-desktop:~/driver_stuff/hello$ su
root@brian-desktop:/home/brian/driver_stuff/hello# make
make -C /lib/modules/2.6.32-21-generic/build M=/home/brian/driver_stuff/hello modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-21-generic'
Building modules, stage 2.
MODPOST 1 modules
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-21-generic'
root@brian-desktop:/home/brian/driver_stuff/hello# insmod ./hello.ko
root@brian-desktop:/home/brian/driver_stuff/hello# rmmod hello
root@brian-desktop:/home/brian/driver_stuff/hello# exit

However, after the insmod ./hello.ko command, one should expect that the terminal would print “Hello world!” and then “Goodbye, cruel world!” after the rmmod hello command. The book mentioned that this happens when you run the commands in the console, but not in an emulated terminal, could this be the problem?

I also checked under /var/log/messages and /var/log/messages.1 which had no record of either “Hello World!” nor “Good bye, cruel world!”. Is it possible that these messages are in a different file, or is the issue that the messages aren’t being pushed to the kernel in the first place?

If you need an info about the kernel I am running (Lubuntu 10.04, inside a VM):

brian@brian-desktop:~/driver_stuff/hello$ uname -r
2.6.32-21-generic

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:45:04+00:00Added an answer on June 4, 2026 at 12:45 pm

    The output from kprintf is always to the kernel log. This may happen to also go to the system console (and, therefore, to the terminal you’re using if you’re on the console), but there’s nothing to link it back to the specific terminal that you loaded the module in.

    To read the kernel log, run dmesg.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am newbie trying to learn some code. I am following the tutorial on
i am trying to learn Java, Hibernate and the MVC pattern. Following various tutorial
I'm trying to learn Assembler and following a tutorial, and the first examples worked
I am trying to learn Spring Roo following the tutorial Getting Started with Spring
I am trying to create my own module, i followed the following tutorial: LINK
I am following this tutorial, trying to learn to make Magento extensions, however, in
I'm trying to learn some basic java programming for games. I'm following this tutorial
I am trying to learn GNU autotools, and I am following some tutorials, I
I was following Azure Tutorial and found error while trying to run the Azure
I'm trying to reproduce the heatmap presented on this blog by following their tutorial,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.