FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    Linux kernel module introduction, the advantages of using Linux modules

     

    1.1Linux kernel module introduction 1.1.1Linux kernel module overview The driver is published in the form of a module in the embedded device driver development, which greatly improves the flexibility of the device - the user only needs to get the relevant driver module, and then inserted into the kernel of the user, you can use it flexibly. Your device. 1.1.2 Advantages of using Linux modules 1. Users can expand the functionality of the Linux system at any time. 2. When you want to modify the drive of the current Linux system, you only need to uninstall the old module, compile the target drive module, and reinstall the insert. 3. If you need to use a new module in your system, you don't have to recompile the kernel, just insert the corresponding module. 4. Reduce the volume of the Linux kernel, save Flash. 1.2linux module Getting started 1.2.1 Module Related Commands 1.2.1.1 Linux Module Command Details 1. Module installation command: Insmod Insmod xxxx.ko 2. View the current installation module: LSMOD LSMOD does not require parameters 3. Module Uninstall Command: RMMOD RMMOD XXXX.ko 4. View module information: MODInfo Operation on x86: [root @ zhifachen linux-3.5] # modinfo / root / work / rootfs / home / mod / tiny4412_hello_module.ko Filename: /Root/Work/rootfs/home/mod/tiny4412_hello_module.ko License: GPL Depends: INTREE: Y Vermagic: 3.5.0-Friendlyarm SMP preempt mod_unload ARMV7 P2V8 [root @ zhifachen linux-3.5] # 1.2.1.2 Linux Module Command Test Example Note: The compilation of the module relies on a specific source code, and this part is compiled and does not use the source project of MRPROPER, DISTCLEAN. 1.2.2 Compile the module in the kernel source tree using MakeModules 1. Add a kernel menu 2. make menuconfig configured to m 3. Enter Makemodules at the top of the directory terminal Direct Make can also generate a module file (.KO), generate zimage, when you just want to compile modules and do not want to compile zimage, using the make modules command faster. 1.2.3 Compile the module source file in the kernel source tree to the kernel image If you don't need to configure the menu, just want to compile the code to the kernel zimage, makefile can write OBJ-Y + = xxxx.o If you don't need to configure the menu, just want to compile the code as an external module, makefile can write OBJ-M + = xxxx.o 1.2.4 Adding a custom module in the kernel source and compile 1.2.5 External independent Makefile compilation module In the driving development phase, the new drive rate is very high. If you want to modify the kernel source Makefile, it is too complicated, it is not intended to port, and another method will be used to compile module files in actual development. 1.2.5.1 Linux kernel module code file template You can directly copy the sample template of the built in the kernel source code to test: drivers / char / tiny4412_hello_module.c 1.2.5.2 Linux kernel module Compile Makefile Template Compilation Module Makefile File: Obj-m + = XYD_HELLO_MODULE.O All: @Make -c /Root/Work/linux-3.5/ m = $ (PWD) Modules @rm -rf * .o * .mod.c modules.order module.symvers * ~ * .bak Clean: @rm -rf * .o * .mod.c modules.order module.symvers * .ko * ~ * .bak Make -C $ (KDIR) M = $ (PWD) MODULES M = Option Let the makefile return to the module source code before constructing the Modules target, then the modules target points to the module set in the OBJ-M variable; in the above example, we set this variable to module.o .o. The above clear rules are written by themselves, or the core Makefile clear rules can be used to clear the generation of the target file, improve the postcode: Obj-m + = XYD_HELLO_MODULE.O # x86 Time to use: uname -r Get the version number of the current kernel #Kdir: = / lib / modules / uname -r / build #Arm compile time Kdir: = / root / work / linux-3.5 All: @make -c $ (kdir) M = $ (PWD) Modules Clean: @make -c $ (kdir) M = $ (PWD) Modules Clean @rm -f * .ko.unsigned * ~ 1.1.1Linux kernel printk function The printf function output information cannot be used in the kernel. To use the Printk function, this function has output level control. The kernel has a log level via the Printk () output, and the log level is controlled by adding an integer with angle brackets before the string of Printk (), such as Printk (". 1881.6>hello, world! / n ") ;. Eight different log levels are provided in the core, there is a corresponding macro in Linux / kernel.h. #definekern_emerg "<0>" / * System Is UNUSABLE system is not available * / #definekern_lert "<1>" / * Action Must Be TakenimMediately Alert, must take immediate action * / #define kern_crit "<2>" / * critical conditions Critical status * / #definekern_err "<3>" / * Error Conditions error status * / #definekern_warning "<4>" / * WarningConditions Warning status * / #DEfinekern_notice "<5>" / * Normal But Significant is normal, but compelling * / #define kern_info "<6>" / * InformationAn information * / #definekern_debug "<7>" / * Debug-level Messages debug rating information * / You can know the setting information by viewing / proc / sys / kernel / printk file content. [root @ chenzhifa /] # cat / proc / sys / kernel / printk 7 4 1 7 You can modify the grade by echo command: [root @ chenzhifa /] # echo 4 4 1 7> / proc / sys / kernel / printk Description: Use Printk ("KKKK") directly; this is not specified, which is not specified. Only the level compares the current terminal level high will be displayed on the terminal. The following is performed on the X86 system (the test is valid under the pure character interface, which is invalid in the graphical interface) Press CTL + Alt + F2 in the graphical interface system (one of the F2 ~ F6 keys, the different computers may be different), you can go to the pure character interface, to return to CTL + Alt + F1 (different computers may be different) PRINTK --- does not support floating point numbers, actually drivers do not support floating point operations. All floating point calculations should be placed in user space. Read the full article, in the original title: 1.1 Linux kernel module introduction 1.1.1 Linux kernel module overview Article Source: [Micro Signal: Qrsworld, WeChat public number: Electronic design and microcontroller] Welcome to add attention! Please indicate the source of the article.

     

     

     

     

    List all Question

    Nickname

    Email

    Questions

    Our other product:

    Professional FM Radio Station Equipment Package

     



     

    Hotel IPTV Solution

     


      Enter email  to get a surprise

      fmuser.org

      es.fmuser.org
      it.fmuser.org
      fr.fmuser.org
      de.fmuser.org
      af.fmuser.org ->Afrikaans
      sq.fmuser.org ->Albanian
      ar.fmuser.org ->Arabic
      hy.fmuser.org ->Armenian
      az.fmuser.org ->Azerbaijani
      eu.fmuser.org ->Basque
      be.fmuser.org ->Belarusian
      bg.fmuser.org ->Bulgarian
      ca.fmuser.org ->Catalan
      zh-CN.fmuser.org ->Chinese (Simplified)
      zh-TW.fmuser.org ->Chinese (Traditional)
      hr.fmuser.org ->Croatian
      cs.fmuser.org ->Czech
      da.fmuser.org ->Danish
      nl.fmuser.org ->Dutch
      et.fmuser.org ->Estonian
      tl.fmuser.org ->Filipino
      fi.fmuser.org ->Finnish
      fr.fmuser.org ->French
      gl.fmuser.org ->Galician
      ka.fmuser.org ->Georgian
      de.fmuser.org ->German
      el.fmuser.org ->Greek
      ht.fmuser.org ->Haitian Creole
      iw.fmuser.org ->Hebrew
      hi.fmuser.org ->Hindi
      hu.fmuser.org ->Hungarian
      is.fmuser.org ->Icelandic
      id.fmuser.org ->Indonesian
      ga.fmuser.org ->Irish
      it.fmuser.org ->Italian
      ja.fmuser.org ->Japanese
      ko.fmuser.org ->Korean
      lv.fmuser.org ->Latvian
      lt.fmuser.org ->Lithuanian
      mk.fmuser.org ->Macedonian
      ms.fmuser.org ->Malay
      mt.fmuser.org ->Maltese
      no.fmuser.org ->Norwegian
      fa.fmuser.org ->Persian
      pl.fmuser.org ->Polish
      pt.fmuser.org ->Portuguese
      ro.fmuser.org ->Romanian
      ru.fmuser.org ->Russian
      sr.fmuser.org ->Serbian
      sk.fmuser.org ->Slovak
      sl.fmuser.org ->Slovenian
      es.fmuser.org ->Spanish
      sw.fmuser.org ->Swahili
      sv.fmuser.org ->Swedish
      th.fmuser.org ->Thai
      tr.fmuser.org ->Turkish
      uk.fmuser.org ->Ukrainian
      ur.fmuser.org ->Urdu
      vi.fmuser.org ->Vietnamese
      cy.fmuser.org ->Welsh
      yi.fmuser.org ->Yiddish

       
  •  

    FMUSER Wirless Transmit Video And Audio More Easier !

  • Contact

    Address:
    No.305 Room HuiLan Building No.273 Huanpu Road Guangzhou China 510620

    E-mail:
    [email protected]

    Tel / WhatApps:
    +8618078869184

  • Categories

  • Newsletter

    FIRST OR FULL NAME

    E-mail

  • paypal solution  Western UnionBank OF China
    E-mail:[email protected]   WhatsApp:+8618078869184   Skype:sky198710021 Chat with me
    Copyright 2006-2020 Powered By www.fmuser.org

    Contact Us