Enviar pesquisa
Carregar
Primeiro módulo de kernel
•
Transferir como ODP, PDF
•
2 gostaram
•
492 visualizações
Diego Ruggeri
Seguir
Escrevendo seu primeiro módulo de kernel (Linux)
Leia menos
Leia mais
Tecnologia
Denunciar
Compartilhar
Denunciar
Compartilhar
1 de 16
Baixar agora
Recomendados
Docker-Vancouver Meetup - March 18, 2014 - An Introduction to Docker
Docker-Vancouver Meetup - March 18, 2014 - An Introduction to Docker
bacongobbler
Continuous Deployment of Front-end JavaScript with StriderCD, Github and Sauc...
Continuous Deployment of Front-end JavaScript with StriderCD, Github and Sauc...
niallo
PHP QA Tools
PHP QA Tools
rjsmelo
Corwin on containers
Corwin on containers
Corwin Brown
Libcontainer: joining forces under one roof
Libcontainer: joining forces under one roof
Andrey Vagin
How Docker didn't invent containers (Docker Meetup Brno #1)
How Docker didn't invent containers (Docker Meetup Brno #1)
Pavel Snajdr
Gcc
Gcc
Ricardo Liyushiro Chikasawa
Linux kernel modules
Linux kernel modules
Eddy Reyes
Recomendados
Docker-Vancouver Meetup - March 18, 2014 - An Introduction to Docker
Docker-Vancouver Meetup - March 18, 2014 - An Introduction to Docker
bacongobbler
Continuous Deployment of Front-end JavaScript with StriderCD, Github and Sauc...
Continuous Deployment of Front-end JavaScript with StriderCD, Github and Sauc...
niallo
PHP QA Tools
PHP QA Tools
rjsmelo
Corwin on containers
Corwin on containers
Corwin Brown
Libcontainer: joining forces under one roof
Libcontainer: joining forces under one roof
Andrey Vagin
How Docker didn't invent containers (Docker Meetup Brno #1)
How Docker didn't invent containers (Docker Meetup Brno #1)
Pavel Snajdr
Gcc
Gcc
Ricardo Liyushiro Chikasawa
Linux kernel modules
Linux kernel modules
Eddy Reyes
lesson03.ppt
lesson03.ppt
IraqReshi
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
Marco Cavallini
Es build presentation
Es build presentation
PT Citra Niaga Teknologi
Android Variants, Hacks, Tricks and Resources presented at AnDevConII
Android Variants, Hacks, Tricks and Resources presented at AnDevConII
Opersys inc.
Linux device driver
Linux device driver
chatsiri
Leveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VI
Opersys inc.
Practical SystemTAP basics: Perl memory profiling
Practical SystemTAP basics: Perl memory profiling
Lubomir Rintel
Android Hacks, Variants, Tricks and Resources ESC SV 2012
Android Hacks, Variants, Tricks and Resources ESC SV 2012
Opersys inc.
Leveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon V
Opersys inc.
Linux kernel code
Linux kernel code
Ganesh Naik
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
dotCloud
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Docker, Inc.
Linux kernel modules
Linux kernel modules
Dheryta Jaisinghani
Linux: the first second
Linux: the first second
Alison Chaiken
Nodejs
Nodejs
Mahmoud Atef Abdelsamie
Android for Embedded Linux Developers
Android for Embedded Linux Developers
Opersys inc.
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
Jérôme Petazzoni
Linux Device Driver’s
Linux Device Driver’s
Rashmi Warghade
Android on Intel Architecture: ROM Cooking Tutorial
Android on Intel Architecture: ROM Cooking Tutorial
Ron Munitz
Linux device driver for dummies
Linux device driver for dummies
Hirohito Kato
Energy profiler for android emulator
Energy profiler for android emulator
Diego Ruggeri
Exploiting process variability in voltage frequency control
Exploiting process variability in voltage frequency control
Diego Ruggeri
Mais conteúdo relacionado
Semelhante a Primeiro módulo de kernel
lesson03.ppt
lesson03.ppt
IraqReshi
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
Marco Cavallini
Es build presentation
Es build presentation
PT Citra Niaga Teknologi
Android Variants, Hacks, Tricks and Resources presented at AnDevConII
Android Variants, Hacks, Tricks and Resources presented at AnDevConII
Opersys inc.
Linux device driver
Linux device driver
chatsiri
Leveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VI
Opersys inc.
Practical SystemTAP basics: Perl memory profiling
Practical SystemTAP basics: Perl memory profiling
Lubomir Rintel
Android Hacks, Variants, Tricks and Resources ESC SV 2012
Android Hacks, Variants, Tricks and Resources ESC SV 2012
Opersys inc.
Leveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon V
Opersys inc.
Linux kernel code
Linux kernel code
Ganesh Naik
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
dotCloud
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Docker, Inc.
Linux kernel modules
Linux kernel modules
Dheryta Jaisinghani
Linux: the first second
Linux: the first second
Alison Chaiken
Nodejs
Nodejs
Mahmoud Atef Abdelsamie
Android for Embedded Linux Developers
Android for Embedded Linux Developers
Opersys inc.
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
Jérôme Petazzoni
Linux Device Driver’s
Linux Device Driver’s
Rashmi Warghade
Android on Intel Architecture: ROM Cooking Tutorial
Android on Intel Architecture: ROM Cooking Tutorial
Ron Munitz
Linux device driver for dummies
Linux device driver for dummies
Hirohito Kato
Semelhante a Primeiro módulo de kernel
(20)
lesson03.ppt
lesson03.ppt
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
Yocto Project Dev Day Prague 2017 - Advanced class - Kernel modules with eSDK
Es build presentation
Es build presentation
Android Variants, Hacks, Tricks and Resources presented at AnDevConII
Android Variants, Hacks, Tricks and Resources presented at AnDevConII
Linux device driver
Linux device driver
Leveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VI
Practical SystemTAP basics: Perl memory profiling
Practical SystemTAP basics: Perl memory profiling
Android Hacks, Variants, Tricks and Resources ESC SV 2012
Android Hacks, Variants, Tricks and Resources ESC SV 2012
Leveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon V
Linux kernel code
Linux kernel code
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Linux kernel modules
Linux kernel modules
Linux: the first second
Linux: the first second
Nodejs
Nodejs
Android for Embedded Linux Developers
Android for Embedded Linux Developers
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
Linux Device Driver’s
Linux Device Driver’s
Android on Intel Architecture: ROM Cooking Tutorial
Android on Intel Architecture: ROM Cooking Tutorial
Linux device driver for dummies
Linux device driver for dummies
Mais de Diego Ruggeri
Energy profiler for android emulator
Energy profiler for android emulator
Diego Ruggeri
Exploiting process variability in voltage frequency control
Exploiting process variability in voltage frequency control
Diego Ruggeri
Clamber network
Clamber network
Diego Ruggeri
Designers e Programadores em um projeto ágil
Designers e Programadores em um projeto ágil
Diego Ruggeri
Prime quest
Prime quest
Diego Ruggeri
Jogos Interativos como Ferramenta para Reconhecimento de Números Primos
Jogos Interativos como Ferramenta para Reconhecimento de Números Primos
Diego Ruggeri
Open VSwitch on Android
Open VSwitch on Android
Diego Ruggeri
Mais de Diego Ruggeri
(7)
Energy profiler for android emulator
Energy profiler for android emulator
Exploiting process variability in voltage frequency control
Exploiting process variability in voltage frequency control
Clamber network
Clamber network
Designers e Programadores em um projeto ágil
Designers e Programadores em um projeto ágil
Prime quest
Prime quest
Jogos Interativos como Ferramenta para Reconhecimento de Números Primos
Jogos Interativos como Ferramenta para Reconhecimento de Números Primos
Open VSwitch on Android
Open VSwitch on Android
Último
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
apidays
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
Rustici Software
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
apidays
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
rafiqahmad00786416
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
danishmna97
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
Khushali Kathiriya
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
Overkill Security
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
apidays
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
UiPathCommunity
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
Nanddeep Nachan
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
The Digital Insurer
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
DianaGray10
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
The Digital Insurer
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Angeliki Cooney
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
The Digital Insurer
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Edi Saputra
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Product Anonymous
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
Zilliz
Último
(20)
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
Primeiro módulo de kernel
1.
Escreva seu primeiro MÓDULO
DE KERNEL (LINUX)
2.
Em quatro atos ● Hello
World! ● Character driver ● Miscellaneous driver ● Ramdisk
3.
0 – Hello
World ● Olá mundo! ● Diego Ramos Ruggeri ● http://vai.la/62u3
4.
0 – Hello
World ● Linux é monolítico ● Módulos carregados em tempo de execução ● Ciclo de vida ● Básico: Inicializar e Limpar
5.
0 – Hello
World Porque? ● Hardware livre ● Entender o Linux ● OOP em C ● Projeto de software livre
6.
static int __init
hello_module(void) { printk(KERN_INFO "Hello World!n"); return 0; } static void __exit goodbye_module(void) { printk(KERN_INFO "Adiosn"); } module_init(hello_module); module_exit(goodbye_module); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Diego Ruggeri"); MODULE_DESCRIPTION("Hello World module");
7.
0 – Hello
World 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
8.
0 – Hello
World ● modinfo ● insmod ● lsmod ● rmmod ● dmesg
9.
1 – Char
Dev ● ioctls ● net ● /dev ● /sys ● /dev ● Block device ● Character device ● Major Minor
10.
static struct file_operations
fops = { .read = device_read, .write = device_write, .open = device_open, .release = device_release }; static int __init hello_module(void) { major = register_chrdev(0, DEVICE, &fops); /* … */ } static void __exit goodbye_module(void) { unregister_chrdev(major, DEVICE); }
11.
2 – Misc
Dev ● mknod /dev/fisl15 c $MAJOR $MINOR ● udev ● Miscellaneous API
12.
static struct file_operations
fops = { /*...*/ }; static struct miscdevice mdev = { .minor = MISC_DYNAMIC_MINOR, .name = DEVICE, .fops = &fops, }; static int __init hello_module(void) { misc_register(&mdev) /* … */ } static void __exit goodbye_module(void) { misc_deregister(&mdev); }
13.
3 - Ramdisk ● Char
device + ● Misc api + ● Aloca memória (slab) + ● open, close, read, write
14.
static int __init
hello_module(void) { disk = (char*) kzalloc(DISK_SIZE * sizeof(char), GFP_KERNEL); /*…*/ } static void __exit goodbye_module(void) { kfree(disk); /*...*/ }
15.
static ssize_t device_read(struct
file *filp, char *buffer, size_t length,loff_t * offset) { /*...*/ copy_to_user(buffer, message, len); /*...*/ } static ssize_t device_write(struct file *filp, const char *buff, size_t len, loff_t * off) { copy_from_user(disk, buff, len) }
16.
Obrigado diego@ruggeri.net.br http://github.com/diegor2
Baixar agora