SlideShare ist ein Scribd-Unternehmen logo
1 von 47
Kernel




Monolothic   Microkernel   Exokernel




  Hybrid
   When a computer is powered on, there is
    nothing running on the CPU. For a program to
    be set running, the binary image of the
    program must first be loaded into memory
    from a storage device.
   Bootstrapping: cold start to the point at
    which user-mode programs can be run.
   In FreeBSD, the binary image is in /vmunix or
    /boot/kernel/kernel
Kernel

Static Modules                 KLDs


Compiled in the kernel   Loaded during run time
   Some modules should be compiled in the
    kernel and can’t be loaded during run time.
     Those modules are ones that used before control
     turned to the user.
   Kernel Location
      /usr/src/sys/machine_type
   Kernel Configuration File
     /usr/src/sys/machine_type/conf
   By default, Kernel Configuration file is called
    GENERIC.
   Kernel Configuration file consists of set of
    modules.
   These modules consists of machine
    architecture, devices and set of options.
   Options are modes of compilation,
    communication restrictions, ports
    infrastructure, debugging options, .. etc
   It’s very important to compile the kernel with
    the modules which are needed at boot time
    since there is no control to the user to load
    them manually.
   Default Options are stored in DEFAULTS file.
   All the available options are located in the
    NOTES file in the same directory.
1.   One method is using the dmesg(8) utility
     and the man(1) commands. Most device
     drivers on FreeBSD have a manual page,
     listing supported hardware, and during the
     boot probe, found hardware will be listed.
2. Another method of finding hardware is by
   using the pciconf(8) utility which provides
   more verbose output.




   Using man ath will return the ath(4) manual
    page
   An include directive is available for use in
    configuration files. This allows another
    configuration file to be logically included in
    the current one, making it easy to maintain
    small changes relative to an existing file.
   Note: To build a file which contains all
    available options, as normally done for
    testing purposes, run the following command
    as root:

# cd /usr/src/sys/i386/conf && make LINT
   Compile Kernel
   Install Kernel
   New kernel will be installed in /boot/kernel
   For backup issues, old kernel stored in
    /boot/kernel.old
   You can load the old kernel by using single
    user mode at the FreeBSD booting page.
Unlike the older approach, this
make buildkernel      uses the new compiler residing
                                in /usr/obj.
                         This first compiles the new
                      compiler and a few related tools,
make buildworld        then uses the new compiler to
                     compile the rest of the new world.
                       The result ends up in /usr/obj.
                     Place the new kernel and kernel
                     modules onto the disk, making it
make installkernel
                     possible to boot with the newly
                             updated kernel.
                      Copies the world from /usr/obj.
make installworld     You now have a new kernel and
                            new world on disk.
1. Move to the directory of i386 kernel config files
   # cd /usr/src/sys/i386/conf
2. Create a copy of your kernel config file.
   # cp GENERIC MYKERNEL
3. Modify MYKERNEL configuration file.
   # ee MYKERNEL
4. Change to the /usr/src directory:
   # cd /usr/src
5. Compile the kernel:
   # make buildkernel KERNCONF=MYKERNEL
6. Install the new kernel:
   # make installkernel KERNCONF=MYKERNEL
   Kernel Loadable Modules result large
    flexibility in the kernel size since only needed
    KLD’s are loaded.
     We can use Binary file for total KLD’s indexing and
     make it easier for the user to determine what KLD’s
     can be loaded at boot time without the need for
     loading each one separately.
   Use kldstat to view them.
   All the kld’s are found in /boot/kernel
    directory.
   Use kldload to load kld’s.




   After loading
   Use kldunload to unload kld.
1. The bsd.kmod.mk makefile resides
 in /usr/src/share/mk/bsd.kmod.mk and
 takes all of the pain out of building and
 linking kernel modules properly.
2. you simply have to set two variables: the
 name of the kernel module itself via the
 “KMOD” variable; the source files configured
 via the intuitive “SRCS” variable.
3. Then, all you have to do is include
 <bsd.kmod.mk> to build the module.
 The Makefile for our introductory kernel
  module looks like this:
# Declare Name of kernel module
KMOD = hello_fsm
# Enumerate Source files for kernel module
SRCS = hello_fsm.c
# Include kernel module makefile
.include <bsd.kmod.mk>
   Create a new directory called kernel, under
    your home directory. Copy and paste the text
    in the last presentation into a file
    called Makefile. This will be your working
    base going forward.
   A kernel module allows dynamic functionality
    to be added to a running kernel. When a
    kernel module is inserted, the “load” event is
    fired. When a kernel module is removed, the
    “unload” event is fired. The kernel module is
    responsible for implementing an event
    handler that handles these cases.
The running kernel will pass in the event in
 the form of a symbolic constant defined in
 the/usr/include/sys/module.h
   (<sys/module.h>) header file.
The two main events you are concerned with
 are MOD_LOAD and MOD_UNLOAD.
   The module is responsible for configuring
    that call-back as well by using the
    DECLARE_MODULE macro.
   The DECLARE_MODULE macro is defined in
    the <sys/module.h> header
  DECLARE_MODULE takes four parameters in the
  following order:
1. name: Defines the name.
2. data: Specifies the name of
  the moduledata_t structure, which I’ve
  named hello_conf in my implementation.
  The moduledata_t type is defined at
  <sys/module.h>
3. sub: Sets the subsystem interface, which defines
  the module type.
4. order: Defines the modules initialization order
  within the defined subsystem
   The moduledata structure contains the name
    defined as a char variable and the event
    handler routine defined as
    a modeventhand_t structure which is defined
    at line 50 of <sys/module.h>. Finally,
    themoduledata structure has void pointer for
    any extra data, which you won’t be using.
   #include <sys/param.h>
   #include <sys/module.h>
   #include <sys/kernel.h>
   #include <sys/systm.h>
   /* The function called at load/unload. */
    static int event_handler(struct module *module, int event, void *arg)
{
 int e = 0;    /* Error, 0 for normal return status */
switch (event) {
case MOD_LOAD:
uprintf("Hello Free Software Magazine Readers! n");
break;
case MOD_UNLOAD:
uprintf("Bye Bye FSM reader, be sure to check http://www.google.com !n");
break;
default:
e = EOPNOTSUPP; /* Error, Operation Not Supported */
break;
}
return(e);
}
  This is where you set the name of the module
   and expose the event_handler routine to be
   called when loaded and unloaded from the
   kernel.
 /* The second argument of
   DECLARE_MODULE. */
  static moduledata_t hello_conf = {
    "hello_fsm", /* module name */
     event_handler, /* event handler */
     NULL /* extra data */
};
   DECLARE_MODULE(hello_fsm, hello_conf,
    SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
   make
Thank you

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Ch1 linux basics
Ch1 linux basicsCh1 linux basics
Ch1 linux basics
 
Introduction To Linux Kernel Modules
Introduction To Linux Kernel ModulesIntroduction To Linux Kernel Modules
Introduction To Linux Kernel Modules
 
Linux IO
Linux IOLinux IO
Linux IO
 
Linux basics
Linux basics Linux basics
Linux basics
 
11 linux filesystem copy
11 linux filesystem copy11 linux filesystem copy
11 linux filesystem copy
 
Linux filesystemhierarchy
Linux filesystemhierarchyLinux filesystemhierarchy
Linux filesystemhierarchy
 
Kernel init
Kernel initKernel init
Kernel init
 
Linux basics
Linux basics Linux basics
Linux basics
 
OMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with VolatlityOMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
 
Linuxppt
LinuxpptLinuxppt
Linuxppt
 
Lecture 3 Perl & FreeBSD administration
Lecture 3 Perl & FreeBSD administrationLecture 3 Perl & FreeBSD administration
Lecture 3 Perl & FreeBSD administration
 
LINUX Admin Quick Reference
LINUX Admin Quick ReferenceLINUX Admin Quick Reference
LINUX Admin Quick Reference
 
De-Anonymizing Live CDs through Physical Memory Analysis
De-Anonymizing Live CDs through Physical Memory AnalysisDe-Anonymizing Live CDs through Physical Memory Analysis
De-Anonymizing Live CDs through Physical Memory Analysis
 
Linux
LinuxLinux
Linux
 
unixtoolbox
unixtoolboxunixtoolbox
unixtoolbox
 
Introduction to UNIX
Introduction to UNIXIntroduction to UNIX
Introduction to UNIX
 
Linux kernel architecture
Linux kernel architectureLinux kernel architecture
Linux kernel architecture
 
Linux scheduler
Linux schedulerLinux scheduler
Linux scheduler
 
Linux kernel architecture
Linux kernel architectureLinux kernel architecture
Linux kernel architecture
 

Andere mochten auch

Innova day motorsporttech_eng_b
Innova day motorsporttech_eng_bInnova day motorsporttech_eng_b
Innova day motorsporttech_eng_bFrancesco Baruffi
 
Rapid Control Prototyping
Rapid Control PrototypingRapid Control Prototyping
Rapid Control Prototypingguest0eeac7
 
you know databases, how hard can MySQL be?
you know databases, how hard can MySQL be?you know databases, how hard can MySQL be?
you know databases, how hard can MySQL be?sarahnovotny
 
Co jsme se naučili od spuštění Fakturoidu
Co jsme se naučili od spuštění FakturoiduCo jsme se naučili od spuštění Fakturoidu
Co jsme se naučili od spuštění Fakturoidujan korbel
 
Collaborative Assessment: Working Together Toward Institutional Change
Collaborative Assessment: Working Together Toward Institutional ChangeCollaborative Assessment: Working Together Toward Institutional Change
Collaborative Assessment: Working Together Toward Institutional ChangeElizabeth Nesius
 
Answergen bi ppt-apr 09 2015
Answergen bi   ppt-apr 09 2015Answergen bi   ppt-apr 09 2015
Answergen bi ppt-apr 09 2015TS Kumaresh
 
IGNITE MySQL - Backups Don't Make Me Money
IGNITE MySQL - Backups Don't Make Me MoneyIGNITE MySQL - Backups Don't Make Me Money
IGNITE MySQL - Backups Don't Make Me Moneysarahnovotny
 
Soc. Unit I, Packet 2
Soc. Unit I, Packet 2Soc. Unit I, Packet 2
Soc. Unit I, Packet 2NHSDAnderson
 
Dissertation on MF
Dissertation on MFDissertation on MF
Dissertation on MFPIYUSH JAIN
 
NGINX 101 - now with more Docker
NGINX 101 - now with more DockerNGINX 101 - now with more Docker
NGINX 101 - now with more Dockersarahnovotny
 
Oracle Exec Summary 7000 Unified Storage
Oracle Exec Summary 7000 Unified StorageOracle Exec Summary 7000 Unified Storage
Oracle Exec Summary 7000 Unified StorageDavid R. Klauser
 
Responding to student writing
Responding to student writingResponding to student writing
Responding to student writingElizabeth Nesius
 
all data everywhere
all data everywhereall data everywhere
all data everywheresarahnovotny
 
Tally Sheet Results - Technology Habits
Tally Sheet Results - Technology HabitsTally Sheet Results - Technology Habits
Tally Sheet Results - Technology Habitsleouy
 
Google Platform Overview (April 2014)
Google Platform Overview (April 2014)Google Platform Overview (April 2014)
Google Platform Overview (April 2014)Ido Green
 

Andere mochten auch (20)

Innova day motorsporttech_eng_b
Innova day motorsporttech_eng_bInnova day motorsporttech_eng_b
Innova day motorsporttech_eng_b
 
Rapid Control Prototyping
Rapid Control PrototypingRapid Control Prototyping
Rapid Control Prototyping
 
Plc day ppt
Plc day pptPlc day ppt
Plc day ppt
 
you know databases, how hard can MySQL be?
you know databases, how hard can MySQL be?you know databases, how hard can MySQL be?
you know databases, how hard can MySQL be?
 
Co jsme se naučili od spuštění Fakturoidu
Co jsme se naučili od spuštění FakturoiduCo jsme se naučili od spuštění Fakturoidu
Co jsme se naučili od spuštění Fakturoidu
 
Collaborative Assessment: Working Together Toward Institutional Change
Collaborative Assessment: Working Together Toward Institutional ChangeCollaborative Assessment: Working Together Toward Institutional Change
Collaborative Assessment: Working Together Toward Institutional Change
 
Answergen bi ppt-apr 09 2015
Answergen bi   ppt-apr 09 2015Answergen bi   ppt-apr 09 2015
Answergen bi ppt-apr 09 2015
 
Mohammed Farrag Resume
Mohammed Farrag ResumeMohammed Farrag Resume
Mohammed Farrag Resume
 
Aptso cosechas 2010
Aptso cosechas 2010Aptso cosechas 2010
Aptso cosechas 2010
 
IGNITE MySQL - Backups Don't Make Me Money
IGNITE MySQL - Backups Don't Make Me MoneyIGNITE MySQL - Backups Don't Make Me Money
IGNITE MySQL - Backups Don't Make Me Money
 
5th Grade
5th Grade5th Grade
5th Grade
 
Marathon
MarathonMarathon
Marathon
 
Soc. Unit I, Packet 2
Soc. Unit I, Packet 2Soc. Unit I, Packet 2
Soc. Unit I, Packet 2
 
Dissertation on MF
Dissertation on MFDissertation on MF
Dissertation on MF
 
NGINX 101 - now with more Docker
NGINX 101 - now with more DockerNGINX 101 - now with more Docker
NGINX 101 - now with more Docker
 
Oracle Exec Summary 7000 Unified Storage
Oracle Exec Summary 7000 Unified StorageOracle Exec Summary 7000 Unified Storage
Oracle Exec Summary 7000 Unified Storage
 
Responding to student writing
Responding to student writingResponding to student writing
Responding to student writing
 
all data everywhere
all data everywhereall data everywhere
all data everywhere
 
Tally Sheet Results - Technology Habits
Tally Sheet Results - Technology HabitsTally Sheet Results - Technology Habits
Tally Sheet Results - Technology Habits
 
Google Platform Overview (April 2014)
Google Platform Overview (April 2014)Google Platform Overview (April 2014)
Google Platform Overview (April 2014)
 

Ähnlich wie Lecture 5 Kernel Development

Linux Kernel Programming
Linux Kernel ProgrammingLinux Kernel Programming
Linux Kernel ProgrammingNalin Sharma
 
Building a linux kernel
Building a linux kernelBuilding a linux kernel
Building a linux kernelRaghu nath
 
Linux kernel driver tutorial vorlesung
Linux kernel driver tutorial vorlesungLinux kernel driver tutorial vorlesung
Linux kernel driver tutorial vorlesungdns -
 
Linux Kernel Development
Linux Kernel DevelopmentLinux Kernel Development
Linux Kernel DevelopmentPriyank Kapadia
 
Linux kernel modules
Linux kernel modulesLinux kernel modules
Linux kernel modulesHao-Ran Liu
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingTushar B Kute
 
Linuxdd[1]
Linuxdd[1]Linuxdd[1]
Linuxdd[1]mcganesh
 
Oracle11g On Fedora14
Oracle11g On Fedora14Oracle11g On Fedora14
Oracle11g On Fedora14kmsa
 
brief intro to Linux device drivers
brief intro to Linux device driversbrief intro to Linux device drivers
brief intro to Linux device driversAlexandre Moreno
 
Load module kernel
Load module kernelLoad module kernel
Load module kernelAbu Azzam
 
Linux Module Programming
Linux Module ProgrammingLinux Module Programming
Linux Module ProgrammingAmir Payberah
 
Managing Perl Installations: A SysAdmin's View
Managing Perl Installations: A SysAdmin's ViewManaging Perl Installations: A SysAdmin's View
Managing Perl Installations: A SysAdmin's ViewBaden Hughes
 
Fedora Atomic Workshop handout for Fudcon Pune 2015
Fedora Atomic Workshop handout for Fudcon Pune  2015Fedora Atomic Workshop handout for Fudcon Pune  2015
Fedora Atomic Workshop handout for Fudcon Pune 2015rranjithrajaram
 
Linux device driver
Linux device driverLinux device driver
Linux device driverchatsiri
 

Ähnlich wie Lecture 5 Kernel Development (20)

Linux Kernel Programming
Linux Kernel ProgrammingLinux Kernel Programming
Linux Kernel Programming
 
Building a linux kernel
Building a linux kernelBuilding a linux kernel
Building a linux kernel
 
Linux kernel driver tutorial vorlesung
Linux kernel driver tutorial vorlesungLinux kernel driver tutorial vorlesung
Linux kernel driver tutorial vorlesung
 
Linux Kernel Development
Linux Kernel DevelopmentLinux Kernel Development
Linux Kernel Development
 
Linux kernel modules
Linux kernel modulesLinux kernel modules
Linux kernel modules
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
 
Linuxdd[1]
Linuxdd[1]Linuxdd[1]
Linuxdd[1]
 
Oracle11g On Fedora14
Oracle11g On Fedora14Oracle11g On Fedora14
Oracle11g On Fedora14
 
Oracle11g on fedora14
Oracle11g on fedora14Oracle11g on fedora14
Oracle11g on fedora14
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
brief intro to Linux device drivers
brief intro to Linux device driversbrief intro to Linux device drivers
brief intro to Linux device drivers
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
Load module kernel
Load module kernelLoad module kernel
Load module kernel
 
Linux Module Programming
Linux Module ProgrammingLinux Module Programming
Linux Module Programming
 
Linux Device Driver’s
Linux Device Driver’sLinux Device Driver’s
Linux Device Driver’s
 
Managing Perl Installations: A SysAdmin's View
Managing Perl Installations: A SysAdmin's ViewManaging Perl Installations: A SysAdmin's View
Managing Perl Installations: A SysAdmin's View
 
Fedora Atomic Workshop handout for Fudcon Pune 2015
Fedora Atomic Workshop handout for Fudcon Pune  2015Fedora Atomic Workshop handout for Fudcon Pune  2015
Fedora Atomic Workshop handout for Fudcon Pune 2015
 
Studienarb linux kernel-dev
Studienarb linux kernel-devStudienarb linux kernel-dev
Studienarb linux kernel-dev
 
Linux device driver
Linux device driverLinux device driver
Linux device driver
 
Linux kernel modules
Linux kernel modulesLinux kernel modules
Linux kernel modules
 

Mehr von Mohammed Farrag

Resume for Mohamed Farag
Resume for Mohamed FaragResume for Mohamed Farag
Resume for Mohamed FaragMohammed Farrag
 
Mum Article Recognition for Mohamed Farag
Mum Article Recognition for Mohamed FaragMum Article Recognition for Mohamed Farag
Mum Article Recognition for Mohamed FaragMohammed Farrag
 
Artificial Intelligence Programming in Art by Mohamed Farag
Artificial Intelligence Programming in Art by Mohamed FaragArtificial Intelligence Programming in Art by Mohamed Farag
Artificial Intelligence Programming in Art by Mohamed FaragMohammed Farrag
 
The practices, challenges and opportunities of board composition and leadersh...
The practices, challenges and opportunities of board composition and leadersh...The practices, challenges and opportunities of board composition and leadersh...
The practices, challenges and opportunities of board composition and leadersh...Mohammed Farrag
 
Confirmation letter info tech 2013(1)
Confirmation letter info tech 2013(1)Confirmation letter info tech 2013(1)
Confirmation letter info tech 2013(1)Mohammed Farrag
 

Mehr von Mohammed Farrag (9)

Resume for Mohamed Farag
Resume for Mohamed FaragResume for Mohamed Farag
Resume for Mohamed Farag
 
Mum Article Recognition for Mohamed Farag
Mum Article Recognition for Mohamed FaragMum Article Recognition for Mohamed Farag
Mum Article Recognition for Mohamed Farag
 
Create 2015 Event
Create 2015 EventCreate 2015 Event
Create 2015 Event
 
Artificial Intelligence Programming in Art by Mohamed Farag
Artificial Intelligence Programming in Art by Mohamed FaragArtificial Intelligence Programming in Art by Mohamed Farag
Artificial Intelligence Programming in Art by Mohamed Farag
 
The practices, challenges and opportunities of board composition and leadersh...
The practices, challenges and opportunities of board composition and leadersh...The practices, challenges and opportunities of board composition and leadersh...
The practices, challenges and opportunities of board composition and leadersh...
 
Confirmation letter info tech 2013(1)
Confirmation letter info tech 2013(1)Confirmation letter info tech 2013(1)
Confirmation letter info tech 2013(1)
 
Google APPs and APIs
Google APPs and APIsGoogle APPs and APIs
Google APPs and APIs
 
FreeBSD Handbook
FreeBSD HandbookFreeBSD Handbook
FreeBSD Handbook
 
Master resume
Master resumeMaster resume
Master resume
 

Kürzlich hochgeladen

Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxRosabel UA
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 

Kürzlich hochgeladen (20)

Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 

Lecture 5 Kernel Development

  • 1.
  • 2. Kernel Monolothic Microkernel Exokernel Hybrid
  • 3. When a computer is powered on, there is nothing running on the CPU. For a program to be set running, the binary image of the program must first be loaded into memory from a storage device.  Bootstrapping: cold start to the point at which user-mode programs can be run.  In FreeBSD, the binary image is in /vmunix or /boot/kernel/kernel
  • 4. Kernel Static Modules KLDs Compiled in the kernel Loaded during run time
  • 5. Some modules should be compiled in the kernel and can’t be loaded during run time.  Those modules are ones that used before control turned to the user.
  • 6. Kernel Location /usr/src/sys/machine_type  Kernel Configuration File /usr/src/sys/machine_type/conf  By default, Kernel Configuration file is called GENERIC.
  • 7. Kernel Configuration file consists of set of modules.  These modules consists of machine architecture, devices and set of options.  Options are modes of compilation, communication restrictions, ports infrastructure, debugging options, .. etc
  • 8. It’s very important to compile the kernel with the modules which are needed at boot time since there is no control to the user to load them manually.  Default Options are stored in DEFAULTS file.  All the available options are located in the NOTES file in the same directory.
  • 9. 1. One method is using the dmesg(8) utility and the man(1) commands. Most device drivers on FreeBSD have a manual page, listing supported hardware, and during the boot probe, found hardware will be listed.
  • 10. 2. Another method of finding hardware is by using the pciconf(8) utility which provides more verbose output.  Using man ath will return the ath(4) manual page
  • 11. An include directive is available for use in configuration files. This allows another configuration file to be logically included in the current one, making it easy to maintain small changes relative to an existing file.
  • 12.
  • 13. Note: To build a file which contains all available options, as normally done for testing purposes, run the following command as root: # cd /usr/src/sys/i386/conf && make LINT
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22. Compile Kernel  Install Kernel
  • 23. New kernel will be installed in /boot/kernel  For backup issues, old kernel stored in /boot/kernel.old  You can load the old kernel by using single user mode at the FreeBSD booting page.
  • 24. Unlike the older approach, this make buildkernel uses the new compiler residing in /usr/obj. This first compiles the new compiler and a few related tools, make buildworld then uses the new compiler to compile the rest of the new world. The result ends up in /usr/obj. Place the new kernel and kernel modules onto the disk, making it make installkernel possible to boot with the newly updated kernel. Copies the world from /usr/obj. make installworld You now have a new kernel and new world on disk.
  • 25. 1. Move to the directory of i386 kernel config files # cd /usr/src/sys/i386/conf 2. Create a copy of your kernel config file. # cp GENERIC MYKERNEL 3. Modify MYKERNEL configuration file. # ee MYKERNEL
  • 26. 4. Change to the /usr/src directory: # cd /usr/src 5. Compile the kernel: # make buildkernel KERNCONF=MYKERNEL 6. Install the new kernel: # make installkernel KERNCONF=MYKERNEL
  • 27. Kernel Loadable Modules result large flexibility in the kernel size since only needed KLD’s are loaded.  We can use Binary file for total KLD’s indexing and make it easier for the user to determine what KLD’s can be loaded at boot time without the need for loading each one separately.
  • 28. Use kldstat to view them.
  • 29. All the kld’s are found in /boot/kernel directory.
  • 30. Use kldload to load kld’s.  After loading
  • 31. Use kldunload to unload kld.
  • 32. 1. The bsd.kmod.mk makefile resides in /usr/src/share/mk/bsd.kmod.mk and takes all of the pain out of building and linking kernel modules properly.
  • 33. 2. you simply have to set two variables: the name of the kernel module itself via the “KMOD” variable; the source files configured via the intuitive “SRCS” variable. 3. Then, all you have to do is include <bsd.kmod.mk> to build the module.
  • 34.  The Makefile for our introductory kernel module looks like this: # Declare Name of kernel module KMOD = hello_fsm # Enumerate Source files for kernel module SRCS = hello_fsm.c # Include kernel module makefile .include <bsd.kmod.mk>
  • 35. Create a new directory called kernel, under your home directory. Copy and paste the text in the last presentation into a file called Makefile. This will be your working base going forward.
  • 36. A kernel module allows dynamic functionality to be added to a running kernel. When a kernel module is inserted, the “load” event is fired. When a kernel module is removed, the “unload” event is fired. The kernel module is responsible for implementing an event handler that handles these cases.
  • 37. The running kernel will pass in the event in the form of a symbolic constant defined in the/usr/include/sys/module.h (<sys/module.h>) header file. The two main events you are concerned with are MOD_LOAD and MOD_UNLOAD.
  • 38. The module is responsible for configuring that call-back as well by using the DECLARE_MODULE macro.  The DECLARE_MODULE macro is defined in the <sys/module.h> header
  • 39.  DECLARE_MODULE takes four parameters in the following order: 1. name: Defines the name. 2. data: Specifies the name of the moduledata_t structure, which I’ve named hello_conf in my implementation. The moduledata_t type is defined at <sys/module.h> 3. sub: Sets the subsystem interface, which defines the module type. 4. order: Defines the modules initialization order within the defined subsystem
  • 40. The moduledata structure contains the name defined as a char variable and the event handler routine defined as a modeventhand_t structure which is defined at line 50 of <sys/module.h>. Finally, themoduledata structure has void pointer for any extra data, which you won’t be using.
  • 41. #include <sys/param.h>  #include <sys/module.h>  #include <sys/kernel.h>  #include <sys/systm.h>
  • 42. /* The function called at load/unload. */ static int event_handler(struct module *module, int event, void *arg) { int e = 0; /* Error, 0 for normal return status */ switch (event) { case MOD_LOAD: uprintf("Hello Free Software Magazine Readers! n"); break; case MOD_UNLOAD: uprintf("Bye Bye FSM reader, be sure to check http://www.google.com !n"); break; default: e = EOPNOTSUPP; /* Error, Operation Not Supported */ break; } return(e); }
  • 43.  This is where you set the name of the module and expose the event_handler routine to be called when loaded and unloaded from the kernel.  /* The second argument of DECLARE_MODULE. */ static moduledata_t hello_conf = { "hello_fsm", /* module name */ event_handler, /* event handler */ NULL /* extra data */ };
  • 44. DECLARE_MODULE(hello_fsm, hello_conf, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
  • 45. make
  • 46.