Sponsored Content
Top Forums UNIX for Advanced & Expert Users program that boots at OS startup Post 28391 by preetham on Tuesday 17th of September 2002 10:36:29 PM
Old 09-17-2002
Re: Re: Re: Your file locations may vary but should be similar

thank you Optimus,
First, let me assure you that i have no intention of hacking, im not a hacker, can't afford to be one...i just code for food man Smilie

I have this hello world kernal module code:
Code:
/* Declare what kind of code we want from the header files */
#define __KERNEL__         /* We're part of the kernel */
#define MODULE             /* Not a permanent part, though. */

/* Standard headers for LKMs */
#include <linux/modversions.h> 
#include <linux/module.h>  

#define _LOOSE_KERNEL_NAMES
    /* With some combinations of Linux and gcc, tty.h will not compile if
       you don't define _LOOSE_KERNEL_NAMES.  It's a bug somewhere.
    */
#include <linux/tty.h>      /* console_print() interface */

/* Initialize the LKM */
int init_module()
{
  console_print("Hello, world - this is the kernel speaking\n");
  /* More normal is printk(), but there's less that can go wrong with 
     console_print(), so let's start simple.
  */

  /* If we return a non zero value, it means that 
   * init_module failed and the LKM can't be loaded 
   */
  return 0;
}


/* Cleanup - undo whatever init_module did */
void cleanup_module()
{
  console_print("Short is the life of an LKM\n");
}

i compile the program using the command:
gcc -c hello.c -Wall

When i compile the program i get the following errors:
/usr/include/linux/modversions.h:1:2: #error Modules should never use kernel-headers system headers,
/usr/include/linux/modversions.h:2:2: #error but rather headers from an appropriate kernel-source package.
/usr/include/linux/modversions.h:3:2: #error Change -I/usr/src/linux/include (or similar) to
/usr/include/linux/modversions.h:4:2: #error -I/lib/modules/$(uname -r)/build/include
/usr/include/linux/modversions.h:5:2: #error to build against the currently-running kernel.

Appreciate the help.
thanks,
Preetham.

added code tags for readability --oombera

Last edited by oombera; 02-20-2004 at 03:43 PM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

auto startup of a program

how do i make a program run at system startup? is there a hirarchy i have to consider? is there any equivalent to an NT "Service" in unix? how do you set it up? thanx Ron (2 Replies)
Discussion started by: exoron
2 Replies

2. Solaris

NIS Boots Me Out

I have a NIS environment using all Solaris 9 systems. After all kinds of trobleshooting i am to the point where I can login to a NIS account from a client system. However, the logon process starts and the splash screen is displayed and then the desk top is displayed but then it flashes and kicks... (1 Reply)
Discussion started by: meyersp
1 Replies

3. Shell Programming and Scripting

How can I make a program start up automatically after the computer restart/startup?

hi all How can I make a program start up automatically after the computer restart/startup in fedora? something like: ... Establish a shell then run some of command code. Thanks for Help!! (1 Reply)
Discussion started by: munna_dude
1 Replies

4. Red Hat

Fedora on Laptop No Longer Boots

Hi, I'm a bit of a newbie, so please bare with me. I installed Fedora 10 on a Dell Latitude D610 a few weeks ago. The computer previously had Windows on it, but I wiped it clean. I've been trying out Fedora successfully for the past couple of weeks and I was able to use the computer as recently... (1 Reply)
Discussion started by: iansocool
1 Replies

5. OS X (Apple)

How to execute a command when system boots?

Hi all, I want to execute a command when system boots. I tried to edit /etc/rc.common and add my command at the end of rc.common, but it does not work! Anyone knows how to do it? Thanks :) (6 Replies)
Discussion started by: andrewust
6 Replies

6. Ubuntu

execute command when Ubuntu boots up ?

hey all,, I want to add comments when Ubuntu starts up.. now I know that there is a directory called /etc/init.d which I can place my scripts there to run them at Ubuntu's startup.. but I prefer if there would be a file which runs when Ubuntu starts!! because it is only one command. not... (2 Replies)
Discussion started by: eawedat
2 Replies

7. Shell Programming and Scripting

Launch a text program inside a konsole at startup

Hi ULFers, I am trying to setup a (very) simple startup script on a centos 6.4 computer and it kind of failed.... Here are the details : As said just above the computer setup is running a CentOS 6.4 x64, on this computer a vncserver is automatically started (by a chkconfig vncserver on), i... (1 Reply)
Discussion started by: pierpier
1 Replies

8. Shell Programming and Scripting

Apache tomcat startup script not booting at startup.

I copied the script from an AskUbuntu post - #!/bin/bash ### BEGIN INIT INFO # Provides: tomcat7 # Required-Start: $network # Required-Stop: $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/Stop Tomcat server ### END INIT INFO ... (14 Replies)
Discussion started by: Hijanoqu
14 Replies

9. HP-UX

HP-UX server boots to black graphical screen

hello all, please can you help me crack this.... i have an hp-ux server which when after booting it does not completely boot to graphical. it stops aa black screen with only an hour glass showing. at this stage only the mouse responds but the keyboard does not respond. any idea to find... (5 Replies)
Discussion started by: steveGH
5 Replies
iscsi_discovery(8)					      System Manager's Manual						iscsi_discovery(8)

NAME
iscsi_discovery - discover iSCSI targets SYNOPSIS
iscsi_discovery <IP> [-p <port>] [-d] [-t <tcp|iser> [-f]] [-m] [-l] DESCRIPTION
Perform send-targets discovery to the specified IP. If a discovery record is generated, try to login to the portal using the preferred transport (-t flag specifies the requested transport type, TCP is the default). If login using a certain transport succeeds, mark the por- tal for automatic login (unless -m flag is used), and disconnect (unless -l flag is used). For iSCSI discovery to work, open-iscsi services must be running. i.e. iscsid should be up, and the iSCSI modules loaded. This is best accomplished by the init.d startup script. [-p=]port-number set the port number (defualt is 3260). [-d] print debugging information. [-t=]transport-type set transport (default is tcp). [-f] force specific transport - disable the fallback to tcp (default is fallback enabled). force the transport specified by the argument of the -t flag. [-m] manual startup - will set manual startup (default is automatic startup). [-l] login - login to the new discovered nodes (defualt is false). AUTHOR
Written by Dan Bar Dov REPORTING BUGS
Report bugs to <erezzi.list@gmail.com>. COPYRIGHT
Copyright (C) Voltaire Ltd. 2006. iscsi_discovery(8)
All times are GMT -4. The time now is 08:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy