Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Linux kernel source tree to establish load module hello     - Ceph single / multi-node installation summary Powered by CentOS 6.x (Server)

- JavaScript, some conclusions about the implicit conversion (Programming)

- KVM installation under CentOS 5.5 (Linux)

- [Android] Eclipse does not update the Android SDK Manager solution [using GoAgent] (Programming)

- How to use the ps command to monitor progress in the implementation of Linux commands (Linux)

- Oracle Migration partition table (Database)

- MySQL related statements (CRUD) (SQLyog software) (Database)

- Linux system security check notes on performance (Linux)

- MySQL 5.7.10 source code for the latest version of the installation process in detail (Database)

- Oracle 11g forget approach SYS and SYSTEM password (Database)

- The minimum initial use of the Linux operating system RancherOS feelings (Linux)

- tcpdump Linux system security tools (Linux)

- Bash difference in single quotes and double quotes (Programming)

- Zabbix monitoring platform to extract a single server graphical Python implementation of concurrent (Server)

- DRBD + Heartbeat solve NFS single point of failure (Server)

- Netfilter / Iptables Comments (Linux)

- Installation and use GAMIT / GLOBK Software (Linux)

- Linux Operating System Security Management Experience (Linux)

- Git common skills (Linux)

- What Java 8 fastest garbage collector (Programming)

 
         
  Linux kernel source tree to establish load module hello
     
  Add Date : 2018-11-21      
         
         
         
  Linux kernel source tree to establish load module hello

Before loading the module, the book said he needed to build the kernel source tree, then, how to build the kernel source tree yet?

First, we must first know the kernel version of your OS, you can get this with uname -r

In / url / src / directory you can see the corresponding release directory

If not you can get the kernel using apt-cache search linux-source

With sudo apt-get install linux-source-3.13.0 download the kernel

After the download is complete, generate a corresponding compressed file linux-source-3.13.0.tar.bz2 in that folder

Then extract the files from tar jxvf linux-source-3.13.0.tar.bz2

Enter the unpacked directory

Then enter root privileges su (where entry failures prompted Authentication failure), enter the following command in Terminal:
sudo passwd
Password: your current password
Enter new UNIX password: This is the root password
Retype new UNIX password: Repeat root password
You are then prompted successful.

Enter the command make oldconfig start configuring the kernel.

Before check the internet to see the kernel configuration spend an hour or so, but after I entered the command output

Information that will generate a new directory under / lib / modules After the configuration /lib/modules/3.16.0-30-generic/

Ls in the directory, I found that already exists in this directory = =! Is the original kernel source tree already exists.

Since the kernel source tree already exists, here we have to do is load the hello module into the kernel.

Here is the source code for hello

#include < linux / init.h>
#include < linux / module.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);

For coding the Makefile

obj-m: = hello.o
KERNELDIR: = /lib/modules/3.16.0-30/build
PWD: = $ (shell pwd)
modules:
    $ (MAKE) -C $ (KERNELDIR) M = $ (PWD) modules
modules_install:
    $ (MAKE) -C $ (KERNELDIR) M = $ (PWD) modules_install

Run make

Generate the corresponding file hello.ko

Then load hello.ko module, pay attention to in root mode to load and then loaded modules lsmod View (book that will output hello world in the console, but I did not console output)

Unloading module

Although there is no console output, but you can view the output hello module in the / var / log / syslog
     
         
         
         
  More:      
 
- Shuffle Process Arrangement in MapReduce (Server)
- ORA-14400: inserted partition key does not map to any partition (Database)
- Java class loading order (Programming)
- Ubuntu use three methods to install Ruby (Linux)
- Kitematic how seamless and DockerFILE (Server)
- Use matplotlib scientific drawing in Linux (Linux)
- Hadoop2.6.3 build clusters and the development of MapReduce WIN7 by Eclipse on Linux demo (Server)
- Use calcurse schedule appointments and to-do in the Linux terminal (Linux)
- How to upgrade Docker 1.6 on Fedora / CentOS (Server)
- SQLite (Database)
- Oracle metadata Reconstruction experiments (Database)
- C ++ why we chose to use the smart pointer (Programming)
- Debian users to install FFmpeg 2.2.2 (Linux)
- Ubuntu 14.10 Install Ubuntu Touch Music App 2.0 (Linux)
- ImageMagick Tutorial: How to cut images in Linux command line (Linux)
- Git common skills (Linux)
- To modify the existing user ID and comments GPG key (Linux)
- LVM basic concepts, management (Linux)
- Ubuntu U disk do not have write privileges can only read but not write (Linux)
- Linux firewall anti-hacker disguise malicious attacks (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.