Skip to content

Merges interesting concepts regarding Linux and Android kernel development: concurrency, CPU-interruptions, workqueues, special linked lists...

License

Notifications You must be signed in to change notification settings

Zildj1an/Kernel-Numbers-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kernel-Module-Numbers-Generator GPL Licence

Language: Español | English

👨‍🔧 This kernel module merges many interesting concepts regarding Linux and Android kernel modules development in only two /proc entries.Needless to say, it does not include any standard C library.

It`s a SMP-Safe implementation of a Linux kernel module - random digits generator (even or odd).

Particularly interesting in terms of coding since:

  • It manages a kernel doubly-linked list with ghost node (read more about them at my repo)
  • It employs kernel interruptions to fill a kernel circular buffer (configurable intervals)
  • It uses semaphores and special kernel mutexes called spin-locks which are required for a code with CPU interruptions.
  • It uses private work-queues to schedule CPU work (in this case, empty the linked list)

You can also configure and check the module parameters with the auxiliar entry /proc/modconfig

Usage

Compile, load the module, access via cat and echo to /proc/modtimer2. The first process to open and write from the file will receive even numbers randomly generated, while the second one will be feed with odd digits.

    $ make # make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

    $ sudo insmod modtimer.ko

    $ echo max_random 4 > /proc/modconfig  or  $ cat modconfig

    ...

    $ cat /proc/modtimer
    
    ...

You can check it worked with $sudo lsmod | head and reading $sudo dmesg

Loading module into Android's Kernel

The module was developed for Debian, but the can be easily used in Android. You just need to use the Makefile for re-compiling. Please notice that the Makefile employs a compiled Android-x86 kernel oreo version

License

This project is licensed under the GNU-GPL License - see the LICENSE.md file for details

About

Merges interesting concepts regarding Linux and Android kernel development: concurrency, CPU-interruptions, workqueues, special linked lists...

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published