Está en la página 1de 47

1

DESIGN AND DEVELOPMENT OF DEVICE DRIVER AND ITS IMPLIMENTATION


ON BEAGLE BOARD-XM(ARM BOARD) USING I2C..
A PROJECT REPORT
Submitted by
DANI KINJAL
PATEL DEVAL
In fulfillment for the award of the degree
Of
BACHELOR OF ENGINEERING
IN
ELECTRONICS CO!!"NICATION
SA#AR INSTIT"TE O$ TEC%NOLO&' $OR &IRLS( TAJP"R
&u)arat Te*hnologi*al "ni+er,it-( Ahmeda.ad
!a-( /012
2
SABAR INSTITUTE OF TECHNOLOGY FOR GIRLS
ELECTRONICS & COMMUNICATION
201-1!
CERTIFICATE
Date 3
Thi, i, to *ertif- that the di,,ertation entitled 4DESIGN AND DEVELOPMENT OF
DEVICE DRIVER AND ITS IMPLIMENTATION ON BEAGLE BOARD-XM(ARM
BOARD) USING I2C5" ha, .een *arried out .- DANI #INJAL and DEVAL
PATEL under m- guidan*e in fulfillment of the degree of #a*helor of Engineering in
ELECTRONICS CO!!"NICATION 67
T%
SE!ESTER8 of &u)arat Te*hnologi*al
"ni+er,it-( Ahmeda.ad during the a*ademi* -ear /019:125
&uide3
!r5 RAJES% PATEL

%ead of the De;artment
!r5 Ra)e,h Patel
3
AC#NO$LEDGMENT
It i, our great ;lea,ure to a*<nowledge the *ontri.ution and a,,i,tan*e of a few indi+idual, to
thi, effort5 I a*<nowledge here to our de.t to tho,e who ha+e *ontri.uted ,ignifi*antl- thi,
;ro)e*t5 I would li<e to e=;re,, m- ,in*ere regard, to P%&'())&% R*+(), P*-(. m- ;ro)e*t
guide( Ele*troni*, and Communi*ation, De;artment( SIT&( for hi, *on,tant moti+ation and
,u;;ort for the entire duration of thi, ;ro)e*t5 It i, m- ;ri+ilege and honor to ha+e wor<ed
under her ,u;er+i,ion5 I am o.liged to P%&'. R*+(), P*-(. %ead of De;artment( Ele*troni*,
Communi*ation, Engineering De;artment( SIT&( for allowing me di,,ertation in Com;an-
Premi,e,5 I al,o than<ful to m- *om;an->, ;ro)e*t &uide M%. ADARSH PARI#H who
ha, hel;ed me in all the wa-, the- *an and I ,in*erel- a*<nowledge that without their ,u;;ort
thi, ;ro)e*t would not ha+e .een fea,i.le5 !- than<, go to all the ,taff mem.er, of
D(/*%-0(1- &' E.(2-%&132) A14 C&005132*-3&1. $inall- I would li<e to than< e+er-one for
their ,u;;ort and to all m- friend, who en*ouraged and hel;ed me in +ariou, wa-, during m-
di,,ertation5
?ith than<, to all@
Dani Kin)al 6100AA011100B8
Patel De+al6100AA01110228
4
ABSTRACT
A, ;er our ;ro)e*t definition we are u,ing i/* .u, whi*h hel;, to redu*e the wire al,o we are
ma<ing dri+er for *ommuni*ation u,ing I/C on arm .oard,5 I/* i, inter integrated *ir*uit
whi*h i, a two wire *ommuni*ation ;roto*ol u,e, ma,ter and ,la+e de+i*e5 I/C i, a
,-n*hronou, ;roto*ol that allow, a ma,ter de+i*e to initiate *ommuni*ation with a ,la+e
de+i*e5 Data i, e=*hanged .etween the,e de+i*e,5 %ere we are u,ing * li.rar-( Linu= and
Linu= <ernel a, module ;rogram to de+elo; de+i*e dri+er u,ing I/C6inter integrated *ir*uit8
and thi, dri+er i, im;lemented on .eagle .oard:C! through ,d:*ard5 After *onne*ting
hardware to .oard it will .ring u; a**ording to module ;rogram5 $rom #eagle #oard:C!
data will flow to the Linu= <ernel then it will flow to the li.rar- and to the a;;li*ation 6li<e
e=*el( word85Al,o we are u,ing arm .oard, a, #eagle #oard:C! to im;lement thi, dri+er5
#eagle #oard:C! i, the newe,t +er,ion of .eagle .oard whi*h in *or;orate la;to; li<e
;erforman*e without the in*on+enien*e of large de,<to; ma*hine,5
5
INDEX
CONTENT PAGE NO
Certifi*ate
A*<nowledgement
A.,tra*t
Cha;ter 1 : Introdu*tionDDDDDDDDDDDDD
151 Pro.lem Definition DDDDDDDDDD5
15/ Need of ;ro)e*tDDDDDDDDDDDD
159 #lo*< DiagramDDDDDDDDDDDD
Cha;ter /: LITERAT"RE S"RVE'DDDDDDDDDD
Cha;ter 9 E Introdu*tion to Linu=DDDDDDDDD
951 %i,tor-DDDDDDDDDDDDDDDD
95/ ?hat i, linu= F555555555555555555555555555555555555555555555555555
959 Linu= ar*hite*tureDDDDDDDDDDD5
952 Linu= Command,DDDDDDDDDDD55
95B Linu= #ooting Pro*e,,DDDDDDDDD55
Cha;ter 2 E Linu= <ernelDDDDDDDDDDDD
251 New Kernel Com;ilation and
in,tallation ;ro*e,,DDDDDDDDDD5555
25/ ?hat i, <ernelF 5555555555555555555555555555555555555555555555555
6
259 !a<e$ile *on*e;tDDDDDDDDDDD55
25951 Introdu*tionDDDDDDDDDDD55
2595/ E=am;le of !a<e$ileDDDDDDD555
Cha;ter BE Kernel moduleDDDDDDDDDDDD
B51 Kernel module ;rogrammingDDDDDDD5
B5151 %ello module ;rogrammingDDDDD5
B515/ !odule Programming with ;arameter,D5
Cha;ter A : Linu= De+i*e Dri+erDDDDDDD55555555555
A 51 %i,tor- of De+i*e Dri+erDDDDDDD5
Cha;ter 7: Ad+antage,DDDDDDDDDDD55555555555
7
LIST OF FIGRURES
F36.1(*8 #LOCK DIA&RA! O$ PROJECT
F36.(*)7 !ICROSO$T DOS
F36. (8)7 S'!#OL O$ LIN"C
F36.(2)7 ARCITECT"RE O$ LIN"C KERNEL
F36. (4)7LIN"C #OOTIN& PROCESS
F36.!(*)7 KERNEL
F36.!(8)7 !AKE $ILE
F36.!(2)7 !AKE $ILE
F36.9(*) 7%ELLO !OD"LE PRO&RA!!IN&
F36(8) (%ELLO !OD"LE PRO&RA!!IN&
F36.9(2) (%ELLO !OD"LE PRO&RA!!IN&
F36.9(4) 7%ELLO !OD"LE PRO&RA!!IN&
F36.9(() 7%ELLO !OD"LE PRO&RA!!IN&
F36.9(') 7KERNEL !OD"LE PRO&RA!!IN& ?IT% PARA!ETERS
F36.9(6) 7KERNEL !OD"LE PRO&RA!!IN& ?IT% PARA!ETERS
F36.9(,) 7KERNEL !OD"LE PRO&RA!!IN& ?IT% PARA!ETERS
F36.9(3) 7KERNEL !OD"LE PRO&RA!!IN& ?IT% PARA!ETERS
F36.9(+) 7KERNEL !OD"LE PRO&RA!!IN& ?IT% PARA!ETERS
F36.9(:) 7KERNEL !OD"LE PRO&RA!!IN& ?IT% PARA!ETERS
F36.9(.) 7KERNEL !OD"LE PRO&RA!!IN& ?IT% PARA!ETERS
8
INTRODUCTION CHAPTER-1
Toda- a, life had .e*ame fa,ter than earlier ,o all thing, ,hould al,o .e fa,ter and ea,-( ,o we
are going to ma<e a de+i*e whi*h will ,ol+e all more time *on,uming ;ro.lem, whi*h are
di,tur.ing in toda->, life5 The i/* *ommuni*ation ;roto*ol will hel; to ma<e all the
*ommuni*ation a, earl- a, ;o,,i.le al,o the .igge,t ;ro.lem of the world that i, wiring(to
*onne*t an- de+i*e with other(it need lot, of wiring and it .e*ome more *om;li*ated #ut .-
u,ing i/* we *an ,ol+e the ;ro.lem of *om;li*ation( .e*au,e it )u,t need onl- two wire, for
*ommuni*ation5 Thu, we are going to de+elo; the de+i*e dri+er whi*h i, mounted on
.eagle.oard:C!6Arm #oard8 +ia ,d *ard and *ommuni*ation .etween thi, i, done .- i/*
*ommuni*ation ;roto*ol5 Al,o we are u,ing Linu= for ;rogramming .e*au,e it ;ro+ide,
;rote*tion then window,5
1.1 PROBLEM DEFINATION;
In thi, ;ro)e*t we are u,ing * li.rar-( Linu= and Linu= <ernel a, module ;rogram to de+elo;
de+i*e dri+er u,ing I/C6inter integrated *ir*uit8 and thi, dri+er i, im;lemented on .eagle
.oard:=m through SD:*ard 5After *onne*ting hardware to .oard it will .ring u; a**ording to
module ;rogram5 $rom #eagle#oard:=m data will flow to the Linu= <ernel( from it will flow
to the li.rar- and to the a;;li*ation 6li<e e=*el( word85
1.2 NEED OF PROJECT
Re*ent te*hnolog- i, SPI:,erial ;eri;heral interfa*e5 SPI i, al,o <nown a, ,-n*hronou, ,erial
interfa*e6SSI85 SPI i, the e=ternal mi*ro*ontroller .u, u,ed to *onne*t mi*ro*ontroller
;eri;heral with four wire,5 SPI i, a ;roto*ol of four ,ignal line,5 S;i u,e, four wire, and it
doe, not gi+e a*<nowledgment thu, it doe, not ;ro+ide ,e*urit- al,o it ha, four ,ignal line, it
.e*ome, *om;le= when more num.er, of ma,ter and ,la+e, are u,ed5
?hile i/* u,e, onl- two wire, and it gi+e, a*<nowledgment ,o it i, ,e*ure than ,;i5 It *an
,u;;ort more num.er of ma,ter and ,la+e al,o it i, not *om;le= li<e ,;i5 It i, .idire*tional
;roto*ol5 %ere we are u,ing Linu= and Linu= <ernel to de+elo; de+i*e dri+er and thi, dri+er i,
im;lemented on .eagle .oard C! ( Linu= i, u,ed in ;la*e of window, .e*au,e it i, ,e*ure5
9
1. BLOC# DIAGRAM OF PROJECT
fig16a8
A, ;er the .lo*< diagram a;;li*ation i, *onne*ted to the li.rar- and thi, li.rar- will *all to
,er+i*e, the Linu= <ernel5 Linu= and it, <ernel a**ording to the module ;rogram manage the
hardware5
Thi, hardware i, *onne*ted to the #eagle#oard:=m +ia ,d *ard5 #eagle#oard:=m will a*t a,
intermediate .etween hardware and Linu= <ernel5
After *onne*ting hardware to .oard it will .ring u; a**ording to module ;rogram5
$rom #eagle#oard:=m data will flow to the Linu= <ernel( from it will flow to the the li.rar-
and to the a;;li*ation5
I2C COMMUNICATION PROTOCOL
I/C ,tand, for INTER INTE&RATED CIRC"IT CO!!"NICATION5
I/C:.u, de+elo;ed in the late 1G70>, for Phili;, *on,umer ;rodu*t, 6e5g5 TV,8
I/C i, a ,-n*hronou, ;roto*ol that allow, a ma,ter de+i*e to initiate *ommuni*ation with a
,la+e de+i*e5 Data i, e=*hanged .etween the,e de+i*e,5
10
ARCHITECTURE;
The Inter:Integrated Cir*uitH 6I/CH8 module i, a ,erial interfa*e u,eful for *ommuni*ating
with other ;eri;heral or mi*ro*ontroller de+i*e,5 The,e ;eri;heral de+i*e, ma- .e ,erial
EEPRO!,( di,;la- dri+er,( analog:to:digital *on+erter,( et*5
The I/C module *an o;erate in an- of the following I/C ,-,tem,3
I A, a ,la+e de+i*e
I A, a ma,ter de+i*e in a ,ingle ma,ter ,-,tem 6,la+e ma- al,o .e a*ti+e8
I A, a ma,terJ,la+e de+i*e in a multi:ma,ter ,-,tem 6.u, *olli,ion dete*tion and
ar.itration a+aila.le8
fig16.8
11
The Inter:Integrated Cir*uitH 6I/CH8 module i, a ,erial interfa*e u,eful for *ommuni*ating
with other ;eri;heral or mi*ro*ontroller de+i*e,5 The,e ;eri;heral de+i*e, ma- .e ,erial
EEPRO!,( di,;la- dri+er,( analog:to:digital *on+erter,( et*
The I/C module *an o;erate in an- of the following I/C ,-,tem,3
IA, a ,la+e de+i*e
IA, a ma,ter de+i*e in a ,ingle ma,ter ,-,tem 6,la+e ma- al,o .e a*ti+e8
IA, a ma,terJ,la+e de+i*e in a multi:ma,ter ,-,tem 6.u, *olli,ion dete*tion and
ar.itration a+aila.le8
BULDING BLOC# OF I2C;
The I/C .u, ha, a num.er of 4*ondition,K5 The,e *ondition, indi*ate when a tran,fer i,
,tarting( ,to;;ing( .eing a*<nowledged( and other e+ent,5
fig16*8
S ,tate ,tarting5
P ,tate ,to;5

fig16d8
R ,tate re,tart5
D ,tate data tran,fer
12
fig16e8
A ,tate ACK *ondition5
N ,tate NACK *ondition5
LITERETURE REVIE$ CHAPTER -2
P%3123/.( &' I2C 85) *14 3-) *//.32*-3&1 31 IC 4()361
15 Li 'ifan(!o$ei !ultimedia *ommuni*ation la. (#ei)ing "ni+er,it- of ;o,t and
tele*ommuni*ation,( #ei)ing61000L985
In thi, ;a;er( the ;rin*i;le of I/C .u, i, introdu*ed detailed i5e it i, +er- ,im;le
*ommuni*ation that u,e onl- two wire, for *ommuni*ation5 Al,o the de,ign of .oth I/C ,la+e
and ma,ter are ;re,ented5 I/C u,e, multi;le ma,ter and multi;le ,la+e for *ommuni*ation5
The whole *ommuni*ation through I/C .u, i, +er- hel;ful to an-one want to u,e thi, ,im;le
/:wire .u, and u,eful in IC de,ign 5
/5 O>reill- E.oo< 9
rd
edition
The .oo< introdu*e, it, to;i*, in a,*ending order of *om;le=it- and i, di+ided into two ;art,5
The fir,t ;art .egin, with the ;ro;er ,etu; of <ernel module, and goe, on to de,*ri.e the
+ariou, a,;e*t, of ;rogramming that -ou>ll need in order to write a full:featured dri+er for a
*har:oriented de+i*e5 E+er- *ha;ter *o+er, a di,tin*t ;ro.lem and in*lude, a Mui*< ,ummar-
13
at the end( whi*h *an .e u,ed a, a referen*e during a*tual de+elo;ment5 Throughout the fir,t
;art of the .oo<( the organiNation of the material mo+e, roughl- from the ,oftware:oriented
*on*e;t, to the hardware:related one,5 Thi, organiNation i, meant to allow -ou to te,t the
,oftware on -our own *om;uter a, far a, ;o,,i.le without the need to ;lug e=ternal hardware
into the ma*hine5 E+er- *ha;ter in*lude, ,our*e *ode and ;oint, to ,am;le dri+er, that -ou
*an run on an- Linu= *om;uter5 The ,e*ond half of the .oo< de,*ri.e, .lo*< dri+er, and
networ< interfa*e, and goe, dee;er into more ad+an*ed to;i*,( ,u*h a, wor<ing with the
+irtual memor- ,u.,-,tem and with the PCI and "S# .u,e,5 !an- dri+er author, do not need
all of thi, material( .ut we en*ourage -ou to go on reading an-wa-5 !u*hof the material
found there i, intere,ting a, a +iew into how the Linu= <ernel wor<,( e+en if -ou do not need
it for a ,;e*ifi* ;ro)e*t( .e*au,e of ;e*uliarit- of ,*ull( we u,e the word de+i*e
inter*hangea.l- with 4the memor- area u,ed .- ,*ull5K The ad+antage of ,*ull i, that it i,n>t
hardware de;endent5 ,*ull )u,t a*t, on ,ome memor-( allo*ated from the <ernel5 An-one *an
*om;ile and run ,*ull( and ,*ull i, ;orta.le a*ro,, the *om;uter ar*hite*ture, on whi*h Linu=
run,5 On the other hand( the de+i*e doe,n>t do an-thing 4u,efulK other than demon,trate the
interfa*e .etween the <ernel and *har dri+er, and allow the u,er to run ,ome te,t,5
Thi, ,e*tion de,*ri.e, the de,ign of the dri+er for the LIS9LV0/DL inertial ,en,or whi*h
eMui;, the N%KLL1B e+aluation .oard5 The LIS9LV0/DL i, a three a=e, linear a**elerometer
that ;ro+ide, the mea,urement a**eleration ,ignal, to the e=ternal world throughan I/C
interfa*e5 The LIS9LV0/DL dri+er wa, written .efore the .u, dri+er5 It, de.ug wa, ;o,,i.le
.- u,ing the g;io:.a,ed I/C .u, dri+er a+aila.le in the original <ernel5 On*e *om;leted and
te,ted( the LIS9LV0/DL dri+er wa, then u,ed for de.ugging the STNLL1B I/C .u, dri+er5
Thi, ;a;er ha, dealt with the I/C de+i*e dri+er de,ign in a Linu= em.edded ,-,tem
en+ironment5 Due to the tight *ou;ling .etween the,e t-;e, of dri+er, and the underl-ing
hardware( u,uall- their de+elo;ment i, underta<en .- the manufa*turer of the em.edded
,-,tem5 Therefore mo,t of the *ommer*ial .oard, ,hi; with a tailored Linu= di,tri.ution
whi*h ha, all the dri+er, ne*e,,ar- for the de+i*e, on the .oard5 Thi, wa- the engineer, *an
fo*u, on de+elo;ing the a;;li*ation ,;e*ifi* ,oftware rather than .uilding <ernel *om;onent,5
Ne+erthele,,( thi, ;a;er gi+e, an in,ight into how the Linu= <ernel ,u;;ort, I/C ( ma<ing it
hel;ful for tho,e who need to modif- an e=i,ting im;lementation to fit their own need,5
14
95 Co;-right /00A Oero;lu, te*hnolog- CO5( LTD5 All right, re,er+ed5 Pu.li*ation relea,e
www5Nero;lu,5*om5tw
IPC .u,e, are widel- im;lemented in em.edded ,-,tem, de,ign( .ut the engineer, are fa*ing
to ta<e e=tremel- time *on,uming and error ;rone ;ro*e,, to ha+e to manuall- de*oded a
long ;eriod of .u, a*ti+it- to diagno,e ;ro.lem,5 Oero;lu, PC #a,ed Logi* Anal-Ner, ;ro+ide
;owerful trigger( de*ode( and ,ear*h *a;a.ilitie, for the engineer, to ,ol+e em.edded ,-,tem
de,ign i,,ue, with e=*e;tional eff*ien*-5



LINUX CHAPTER-
15
.1 HISTORY
B('&%( L315<
In L0>,( !i*ro,oft>, DOS wa, the dominated OS for PC
fig96a8
A;;le !AC wa, .etter( .ut e=;en,i+e5 "NIC wa, mu*h .etter( .ut mu*h( mu*h more
e=;en,i+e5 Onl- for mini*om;uter for *ommer*ial a;;li*ation,5 Peo;le wa, loo<ing for a
"NIC .a,ed ,-,tem( whi*h i, *hea;er and *an run on PC5 #oth DOS( !AC and "NIC were
;ro;rietar-( i5e5( the ,our*e *ode of their <ernel i, ;rote*ted 5No modifi*ation i, ;o,,i.le
without ;a-ing high li*en,e fee,
GNU /%&+(2-
E,ta.li,hed in 1GL2 .- Ri*hard Stallman( who .elie+e, that ,oftware ,hould .e free from
re,tri*tion, again,t *o;-ing or modifi*ation in order to ma<e .etter and effi*ient *om;uter
;rogram,5&N" i, a re*ur,i+e a*ron-m for 4&N"Q, Not "ni=K 5 Aim at de+elo;ing a *om;lete
"ni=:li<e o;erating ,-,tem whi*h i, free for *o;-ing and modifi*ation5 Com;anie, ma<e
their mone- .- maintaining and di,tri.uting the ,oftware( e5g5 o;timall- ;a*<aging the
,oftware with different tool, 6Redhat( Sla*<ware( !andra<e( SuSE( et*85Stallman .uilt the
16
fir,t free &N" C Com;iler in 1GG15 #ut ,till( an OS wa, -et to .e de+elo;ed5
B(6311316 &' L315<
A famou, ;rofe,,or Andrew Tanen.aum de+elo;ed !ini=( a ,im;lified +er,ion of "NIC that
run, on PC5!ini= i, for *la,, tea*hing onl-5 No intention for *ommer*ial u,e5In Se;t 1GG1(
Linu, Tor+ald,( a ,e*ond -ear ,tudent of Com;uter S*ien*e at the "ni+er,it- of %el,in<i(
de+elo;ed the ;reliminar- <ernel of Linu=( <nown a, Linu= +er,ion 05051
L315< T&4*=
Linu= ha, .een u,ed for man- *om;uting ;latform, PC( PDA( Su;er*om;uter(D
Not onl- *hara*ter u,er interfa*e .ut gra;hi*al u,er interfa*e i, a+aila.le
Commer*ial +endor, mo+ed in Linu= it,elf to ;ro+ide freel- di,tri.uted *ode5 The- ma<e
their
mone- .- *om;iling u; +ariou, ,oftware and gathering them in a di,tri.uta.le forma
Red %at( Sla*<ware( et*5
G%&>316 *14 6%&>316?
In order to en*ourage wide di,,emination of hi, OS( Linu, made the ,our*e *ode o;en to
;u.li* 5 At the end of 1GG/ there were a.out a hundred Linu= de+elo;er,5 Ne=t -ear there
were 10005 And the num.er, multi;lied e+er- -ear5Re*ent e,timate, ,a- a.out /G million
;eo;le u,e Linu= worldwide5 The effe*t, of the dot:*om .u,t( IT ,lowdown and glo.al
e*onomi* re*e,,ion *an .e *learl- ,een5
19L71/u,er, regi,tered 1BBA7Gma*hine, regi,tered
$ig96.8
17
fig96.8
.2 $HAT IS LINUX @
A multita,<ing( multi:u,er o;erating ,-,tem informall- refer, to the o;erating ,-,tem a, well
a, the ,tandard tool, and a;;li*ation, di,tri.uted with it ,;e*ifi*all-( Linu= refer, to the
<ernel whi*h form, the *ore of the o;erating ,-,tem5
: The <ernel i, di,tri.uted with indi,;en,a.le utilitie, and a;;li*ation,( ,u*h a, *om;iler,(
editor,( *ommand inter;reter,( et*5
: !o,t Linu= ,oftware di,tri.uted under the &N" general ;u.li* li*en,e 6&PL8
Linu= i, .a,ed on "ni= o;erating ,-,tem,( traditionall- a,,o*iated with hea+- *om;uting(
,ta.ilit- and .a*<end ,er+i*e, *om;utationall- inten,i+e ta,<, ,u*h a, +i,ualiNation and
gra;hi*, rendering ,*ientifi* *om;utation and ,imulation,
a*ademi* la.oratorie,
: Large ;ortion of the Internet i, "ni=:.a,ed
: Linu= i, re+olutioniNing the old lega*- of "ni= .- .ringing the o;erating ,-,tem to de,<to;,
and e+er-da- u,er,5
.2.1 LINUX DISTRIBUTION
Redhat
$edora
De.ian
No+ell>, S"SE Linu=
".untu
!andra<e
Li+e CD, E Kno;;i= and more
18
A0&16 -,3) L315< 43)-%385-3&1 >( *%( 5)316 U851-5 *) L315< &/(%*-316 )=)-(0 .
.2.2 F%(( S&'->*%( F&514*-3&1
$ounded .- Ri*hard Stallman in 1GL9
OrganiNation that ,tarted de+elo;ing *o;- lifted ;rogram,
Pro)e*t E &N" Pro)e*t
&N" Not "ni= Re*ur,i+e e=;an,ion
.2. GNUAL315<
:Linu= li<ed the endea+or, of the $ree Software $oundation and relea,ed hi, <ernel under the
&N" &PL
: The Linu= <ernel and &N" tool, made a *om;lete( free o;erating ,-,tem3 the &N"JLinu=
o;erating ,-,tem5
. LINUX #ERNEL ARCHITECHTURE
19
'36(2)
In thi, ar*hite*ture when an- a;;li*ation li<e hardware are *onne*ted to Linu= o;erating
,-,tem then linu= <ernel will ;erform the ta,< of o;eration a**ording to u,er ;rogramming5
Dri+er are *onne*ted with <ernel mode to fulfill the a;;li*ation of hardware a**ording to
;rogramming5 Dri+er ;ro+ide the ,u;;ort to the hardware to wor< with the o;erating ,-,tem,(
without dri+er the *onne*ted hardware *annot wor<5
.! LINUX COMMANDS3
R3 E+er-thing on a Linu= ,-,tem *an .e done .- t-;ing *ommand,
the &"I 6C:?indow8 i, not needed for running a Linu= S-,tem In order
to t-;e *ommand, in C:?indow -ou need to ,tart a terminal emulator 5
C&00*14 P%&0/-
Can .e *onfigured -our,elf
S : 4logged in a, a regular u,erK(
T : 4logged in a, rootK
F3.( M*1*6(0(1- C&00*14)3
R3 m<dir: *reating dire*tor-
!<dir dirname
R3 rmdirE remo+ing dire*tor- and it, *ontent,
Rmdir dirname
R3 *d E Change dire*tor-
Cd dir;ath
R3*;E Co;-ing file,
*; file1 file/
R3 m+ E !o+ing or renaming file,
!+ oldfile newfile
20
S&0( B*)32 L315< C&00*14);
R3 ;a,,wd3 Change -our ;a,,word
R3 m<;a,,wd3 &enerate a random ;a,,word
R3 date( *al3 $ind out toda->, date and di,;la- a *alendar
R3 who( finger3 $ind out whom el,e i, a*ti+e on the ,-,tem
R3 *lear3 Clear the ,*reen
R3 e*ho3 ?rite a me,,age to -our ,*reen
L3)-316 '3.() 2&00*14)3
Command3 l,Uo;tion,V Ufile,V
Common o;tion,3
:a3 ,how, all file,( in*luding hidden file,
:l3 u,e, long li,ting format
:r3 ;rodu*e, out;ut in re+er,e order
:t3 ,ort, out;ut .- modifi*ation time,
:13 li,t, one file ;er line
E=am;le,3
l,6,hort file li,ting8
l,:al6long li,ting( in*luding hidden file,8
l,:1 6,hort li,ting@ one file ;er line8
l,:lrt6long li,ting@ mo,t re*entl- a**e,,ed file, la,t8
V3(>316 F3.( C&1-(1-) 2&00*14) 3
R3 *at utilit-3 out;ut, the *ontent, of a file to the
terminal
R3 le,, utilit-3 ,imilar to *at( .ut di,;la-, one ;age
of out;ut at a time 6im;ro+ement of
more8
R3 ",e ,;a*e.ar to ad+an*e to the ne=t ;age
R3 ",e # to )um; .a*< to the ;re+iou, ;age
21
R3 ",e Enter <e- to ad+an*e line at a time
R3 ",e u; and down arrow <e-, to mo+e a line at a time ,ear*h .- ;re,,ing QJQ(
t-;e the ,tring and ;re,, the enter5
H(./ *8&5- 2&00*14)
man( ;info( info 6man WW*md nameRR8
V3(>316 '3.(B) 2&1-(1-
*at WWfilenameRR
V3(>316 5)(%)7 /%&2())()
who E Li,t all ",er,
who am I E Li,t the *urrent u,er
;,tree E di,;la-, all ;ro*e,,e, running in the ,-,tem in tree format
;, E di,;la-, ;ro*e,,e, owned .- the *urrent u,er
C,*16316 '3.( /(%03))3&1A&>1(%
*hmod E *hange, file ;ermi,,ion
*hown E *hange, file owner
22
.9 LINUX BOOTING PROCESS
The following are the A high le+el ,tage, of a t-;i*al Linu= .oot ;ro*e,,5
'36(4)
15 #IOS
#IOS ,tand, for #a,i* In;utJout;ut S-,tem
Perform, ,ome ,-,tem integrit- *he*<,
Sear*he,( load,( and e=e*ute, the .oot loader ;rogram5
It loo<, for .oot loader in flo;;-( *d:rom( or hard dri+e5 'ou *an ;re,, a <e- 6t-;i*all-
$1/ of $/( .ut it de;end, on -our ,-,tem8 during the #IOS ,tartu; to *hange the .oot
,eMuen*e5
On*e the .oot loader ;rogram i, dete*ted and loaded into the memor-( #IOS gi+e, the
*ontrol to it5
So( in ,im;le term, #IOS load, and e=e*ute, the !#R .oot loader5
/5!#R
!#R ,tand, for !a,ter #oot Re*ord5
It i, lo*ated in the 1,t ,e*tor of the .oota.le di,<5 T-;i*all- Jde+Jhda( or Jde+J,da
23
!#R i, le,, than B1/ .-te, in ,iNe5 Thi, ha, three *om;onent, 18 ;rimar- .oot loader
info in 1,t 22A .-te, /8 ;artition ta.le info in ne=t A2 .-te, 98 m.r +alidation *he*< in
la,t / .-te,5
It *ontain, information a.out &R"# 6or LILO in old ,-,tem,85
So( in ,im;le term, !#R load, and e=e*ute, the &R"# .oot loader5
95 &R"#
&R"# ,tand, for &rand "nified #oot loader5
If -ou ha+e multi;le <ernel image, in,talled on -our ,-,tem( -ou *an *hoo,e whi*h
one to .e e=e*uted5
&R"# di,;la-, a ,;la,h ,*reen( wait, for few ,e*ond,( if -ou don>t enter an-thing( it
load, the default <ernel image a, ,;e*ified in the gru. *onfiguration file5
&R"# ha, the <nowledge of the file ,-,tem 6the older Linu= loader LILO didn>t
under,tand file ,-,tem85
&ru. *onfiguration file i, J.ootJgru.Jgru.5*onf 6Jet*Jgru.5*onf i, a lin< to thi,85 The
following i, ,am;le gru.5*onf of CentOS5
T.ootXJde+J,da
defaultX0
timeoutXB
,;la,himageX6hd0(08J.ootJgru.J,;la,h5=;m5gN
24
hiddenmenu
titleCentOS 6/5A51L:1G25elBPAE8
root 6hd0(08
<ernel J.ootJ+mlinuN:/5A51L:1G25elBPAE ro rootXLA#ELXJ
initrd J.ootJinitrd:/5A51L:1G25elBPAE5img
A, -ou noti*e from the a.o+e info( it *ontain, <ernel and initrd image5
So( in ,im;le term, &R"# )u,t load, and e=e*ute, Kernel and initrd image,5
25 Kernel
!ount, the root file ,-,tem a, ,;e*ified in the 4rootXK in gru.5*onf
Kernel e=e*ute, the J,.inJinit ;rogram
Sin*e init wa, the 1,t ;rogram to .e e=e*uted .- Linu= Kernel( it ha, the ;ro*e,, id
6PID8 of 15 Do a Y;, :ef Z gre;init> and *he*< the ;id5
Initrd ,tand, for Initial RA! Di,<5
Initrd i, u,ed .- <ernel a, tem;orar- root file ,-,tem until <ernel i, .ooted and the real
root file ,-,tem i, mounted5 It al,o *ontain, ne*e,,ar- dri+er, *om;iled in,ide( whi*h
hel;, it to a**e,, the hard dri+e ;artition,( and other hardware5
B5 Init
Loo<, at the Jet*Jinitta. file to de*ide the Linu= run le+el5
$ollowing are the a+aila.le run le+el,
0 : halt
1 : Single u,er mode
/:!ultiu,er( without N$S
25
9: $ull multiu,er mode
2 :unu,ed
B : C11
A : re.oot
Init identifie, the default initle+el from Jet*Jinitta. and u,e, that to load all a;;ro;riate
;rogram5
E=e*ute Ygre;initdefault Jet*Jinitta.> on -our ,-,tem to identif- the default run le+el
If -ou want to get into trou.le( -ou *an ,et the default run le+el to 0 or A5 Sin*e -ou
<now what 0 and A mean,( ;ro.a.l- -ou might not do that5
T-;i*all- -ou would ,et the default run le+el to either 9 or B5

A5 Run le+el ;rogram,


?hen the Linu= ,-,tem i, .ooting u;( -ou might ,ee +ariou, ,er+i*e, getting ,tarted5
$or e=am;le( it might ,a- 4,tarting ,endmail D5 OKK5 Tho,e are the runle+el
;rogram,( e=e*uted from the run le+el dire*tor- a, defined .- -our run le+el5
De;ending on -our default init le+el ,etting( the ,-,tem will e=e*ute the ;rogram,
from one of the following dire*torie,5
Run le+el 0 E Jet*Jr*5dJr*05dJ
Run le+el 1 E Jet*Jr*5dJr*15dJ
Run le+el / E Jet*Jr*5dJr*/5dJ
Run le+el 9 E Jet*Jr*5dJr*95dJ
Run le+el 2 E Jet*Jr*5dJr*25dJ
Run le+el B E Jet*Jr*5dJr*B5dJ
Run le+el A E Jet*Jr*5dJr*A5dJ
Plea,e note that there are al,o ,-m.oli* lin<, a+aila.le for the,e dire*tor- under Jet*
dire*tl-5 So( Jet*Jr*05d i, lin<ed to Jet*Jr*5dJr*05d5
"nder the Jet*Jr*5dJr*[5dJ dire*torie,( -ou would ,ee ;rogram, that ,tart with S and K5
Program, ,tart, with S are u,ed during ,tartu;5 S for ,tartu;5
26
Program, ,tart, with K are u,ed during ,hutdown5 K for <ill5
There are num.er, right ne=t to S and K in the ;rogram name,5 Tho,e are the
,eMuen*e num.er in whi*h the ;rogram, ,hould .e ,tarted or <illed5





!.1 NE$ #ERNEL COMPLIATION AND INSTALLATION PROCESS
S-(/ C 1 G(- L*-()- L315< :(%1(. 2&4(
Vi,it htt;3JJ<ernel5orgJ and download the late,t ,our*e *ode5
S-(/ C 2 E<-%*2- -*% (.-*%.8D2) '3.(
LINUX #ERNEL CHAPTER-!
27
T-;e the following *ommand3
S tar =)+f linu=/5A5/B5tar5.N/
S-(/ C C&1'365%( :(%1(.
#efore -ou *onfigure <ernel ma<e ,ure -ou ha+e de+elo;ment tool, 6g** *om;iler, and
related tool,8 are in,talled on -our ,-,tem5 If g** *om;iler and tool, are not in,talled then u,e
a;tget *ommand under De.ian Linu= to in,tall de+elo;ment tool,5
S ,udo a;tget in,tall g**
Now -ou *an ,tart <ernel *onfiguration .- t-;ing an- one of the *ommand3
S ma<e menu*onfig Te=t .a,ed *olor menu,( radioli,t, dialog,5 Thi, o;tion al,o
u,eful on remote ,er+er if -ou wanna *om;ile <ernel remotel-5
S-(/ C ! C&0/3.( :(%1(.
Start *om;iling to *reate a *om;re,,ed <ernel image( enter3
S ma<e
Start *om;iling to <ernel module,3
S ma<e module,
In,tall <ernel module, 6.e*ome a root u,er( u,e ,u *ommand8
S ,u
T ma<e module,\in,tall
S-(/ C 9 I1)-*.. :(%1(.
So far we ha+e *om;iled <ernel and in,talled <ernel module,5 It i, time to in,tall <ernel
it,elf5
T ma<e in,tall
28
It will in,tall three file, into J.oot dire*tor- a, well a, modifi*ation to -our <ernel gru.
*onfiguration file3
I S-,tem5ma;/5A5/B
I *onfig/5A5/B
I +mlinuN/5A5/B
S-(/ C E; C%(*-( *1 313-%4 30*6(
T-;e the following *ommand at a ,hell ;rom;t3
T *d J.oot
T m<initrd o initrd5img/5A5/B /5A5/B
Initrd image, *ontain, de+i*e dri+er whi*h needed to load re,t of the o;erating ,-,tem later
on5 Not all *om;uter reMuire, initrd( .ut it i, ,afe to *reate one5
S-(/ C F M&43'= G%58 2&1'365%*-3&1 '3.( A8&&-A6%58A0(15..)-
O;en file u,ing +i3
T +i J.ootJgru.Jmenu5l,t
title De.ian &N"JLinu=( <ernel /5A5/B Default
root 6hd0(08
<ernel J.ootJ+mlinuN rootXJde+Jhd.1 ro
initrd J.ootJinitrd5img/5A5/B
,a+e default
.oot
T u;dategru.
29
S-(/ C G ; R(8&&- 2&0/5-(% *14 8&&- 31-& =&5% 1(> :(%1(.
Ju,t i,,ue re.oot *ommand3
T re.oot
!.2 $HAT IS #ERNEL @
The Linu= <ernel i, one *om;onent of a ,-,tem( whi*h al,o reMuire, li.rarie, and
a;;li*ation, to ;ro+ide feature, to end u,er,5
The Linu= <ernel wa, *reated a, a ho..- in 1GG1 .- a $inni,h ,tudent( Linu, Tor+ald,5
Linu= Mui*<l- ,tarted to .e u,ed a, the <ernel for free ,oftware o;erating ,-,tem,5
'36!(*)
!. MA#E FILE CONCEPT ;
P%&8.(0);
Long file, are harder to manage 6for .oth ;rogrammer, and ma*hine,8
E+er- *hange reMuire, long *om;ilation
!an- ;rogrammer, *an not modif- the ,ame file ,imultaneou,l-
Di+i,ion to *om;onent, i, de,ired
Long file, are harder to manage 6for .oth ;rogrammer, and ma*hine,8
E+er- *hange reMuire, long *om;ilation
30
!an- ;rogrammer, *an not modif- the ,ame file ,imultaneou,l-
Di+i,ion to *om;onent, i, de,ired
Solution 3 di+ide ;ro)e*t to multi;le file,
Target,3
&ood di+i,ion to *om;onent,
!inimum *om;ilation when ,omething i, *hanged
Ea,- maintenan*e of ;ro)e*t ,tru*ture( de;enden*ie, and *reation
P%&+(2- 0*31-(1*12(
Done in "ni= .- the !a<efile me*hani,m
A ma<efile i, a file 6,*ri;t8 *ontaining 3
Pro)e*t ,tru*ture 6file,( de;enden*ie,8
In,tru*tion, for file, *reation
The ma<e *ommand read, a ma<efile( under,tand, the ;ro)e*t ,tru*ture and ma<e, u;
the e=e*uta.le
Note that the !a<efile me*hani,m i, not limited to C ;rogram,
P%&+(2- )-%52-5%(
Pro)e*t ,tru*ture and de;enden*ie, *an .e re;re,ented a, a DA& 6X Dire*ted A*-*li*
&ra;h8
E=am;le 3
Program *ontain, 9 file,
main5*5( ,um5*( ,um5h
,um5h in*luded in .oth 5* file,
E=e*uta.le ,hould .e the file ,um
31
fig26.8
M*:('3.(
)50; 0*31.& )50.&
o 622 H& )50 0*31.& )50.&
0*31.&; 0*31.2 )50.,
o 622 H2 0*31.2
)50.&; )50.2 )50.,
o 622 H2 )50.2
MA#E OPERATION
Pro)e*t de;enden*ie, tree i, *on,tru*ted
Target of fir,t rule ,hould .e *reated
?e go down the tree to ,ee if there i, a target that ,hould .e re*reated5 Thi, i, the *a,e
when the target file i, older than one of it, de;enden*ie,
In thi, *a,e we re*reate the target file a**ording to the a*tion ,;e*ified( on our wa- u; the
tree5 Con,eMuentl-( more file, ma- need to .e re*reated
If ,omething i, *hanged( lin<ing i, u,uall- ne*e,,ar-
ma<e o;eration en,ure, minimum *om;ilation( when the ;ro)e*t ,tru*ture i, written
;ro;erl-5
32
'36!I
'36!(4)
33
'36!(()
34
Linu= <ernel ha, the a.ilit- to e=tend at runtime the ,et of feature, offered
Linu= <ernel ha, the a.ilit- to e=tend at runtime the ,et of feature, offered .- the <ernel5 Thi,
mean, that -ou *an add fun*tionalit- to the <ernel while the ,-,tem i, u; and running5
Ea*h ;ie*e of *ode that *an .e loaded and unloaded into the <ernel at runtime i, *alled a
module5
!odule e=tend, the fun*tionalit- of the <ernel without the need to re.oot the ,-,tem5
The Linu= <ernel offer, ,u;;ort for Muite a few different t-;e, 6or *la,,e,8 of module,(
in*luding( .ut not limited to( de+i*e dri+er,5
Ea*h module i, made u; of o.)e*t *ode 6not lin<ed into a *om;lete e=e*uta.le8 that *an .e
d-nami*all- lin<ed to the running <ernel5
A4J*1-*6() &' 0&45.();
!odule, ma<e it ea,- to de+elo; dri+er, without re.ooting3 load( te,t( unload( re.uild
again load and ,o on5
",eful to <ee; the <ernel ,iNe to the minimum 6e,,ential in em.edded ,-,tem,85
?ithout module, ( would need to .uild monolithi* <ernel and add new fun*tionalit-
dire*tl- into the <ernel image5
Al,o u,eful to redu*e .oot time( -ou don>t need to ,;end time initialiNing de+i*e that
ma- not .e needed at .oot time5
On*e loaded( module, ha+e full *ontrol and ;ri+ilege, in the ,-,tem5 That>, wh- onl-
the root u,er *an load and unload the module,5
#ERNEL MODULE PROGRAMMING CHAPTER-9
35
There are ->& t-;e, of <ernel module ;rogramming
i5 %ELLO !OD"LE PRO&RA!!IN&
Thi, module ;rogramming ha, to write in u.untu ,o we ha+e fir,t ,tart the
terminal in,ide the u.untu( then in thi, 4(J*.K5851-5;-L will .e ,een5
A**ording to hello module ;rogramming we ha+e to go in the de,<to; thi, i,
done a, ,hown in ,*reen ,hot5
'369(*)
Then we ha+e to enter in to the :(%1M0&45.( .e*au,e we ha+e two file in it
one of them i, 5* file and another i, ma<efile( thi, file, are ne*e,,ar- to di,;la-
;rogram in u.untu of hello module5
36
'369(8)
Now we will write .) *ommand to ,ee all the file ( after thi, we do ma<e to u,e
ma<efile *on*e;t i5e .- doing ma<e we *an lin< more no of file, and we *an
*hange ,imultaneou,l- in the,e file,5
'369I
37
After ma<e we will load the module .- N )54& 31)0&4 ,3.:& N a, ,hown in
,*reen ,hot5 After thi, the- will a,< -our /*))>&%4 and then .- u,ing .)0&4
we *an ,ee the module ha, .een loaded5
'369(4)
Then .- u,ing 40()6 *ommand we *an ,ee the me,age whi*h we had written
;rogram5
38
'369(()
At the end we will remo+e the loaded module .- writing 4 )54& %00&4 ,3 N.
And .- u,ing 40()6 again we *an ,ee the me,,age we want after the module
ha+e .een remo+ed5
#ERNEL MODULE PROGRAMMG $ITH PARAMETERS 3
Thi, module ;rogramming ha, to write in u.untu ,o we ha+e fir,t ,tart the
terminal in,ide the u.untu( then in thi, 4(J*.K5851-5;-L will .e ,een5
A**ording to ;arameter, module ;rogramming we ha+e to go in the
de,<to; thi, i, done a, ,hown in ,*reen ,hot5
39
'369(')
40
Then we ha+e to enter in to the :(%1M/*%* .e*au,e we ha+e two file, in it one
of them i, 5* file and another i, ma<efile( thi, file, are ne*e,,ar- to di,;la-
;rogram in u.untu of ;arameter, module
Now we will write .) *ommand to ,ee all the file ( after thi, we do ma<e to u,e
ma<efile *on*e;t i5e .- doing ma<e we *an lin< more no of file, and we *an
*hange ,imultaneou,l- in the,e file,5
'369(6)
figB6h8
After ma<e we will load the module .- N )54& 31)0&4 ,(..&M9.:& N a, ,hown in
,*reen ,hot5 After thi, the- will a,< -our /*))>&%4 and then .- u,ing .)0&4 we *an
,ee the module ha, .een loaded 5
41
F369(3)
Then .- u,ing 40()6 *ommand we *an ,ee the me,age whi*h we had written
;rogram5
'369(+)
At the end we will remo+e the loaded module .- writing 4 )54& %00&4 ,(..&M9 N
and we *an ,ee that loaded file had .een remo+ed .- writing .)0&4.
42
'369(:)
And .- u,ing 40()6 again we *an ,ee the me,,age we want after the module ha+e
.een remo+ed5
'369(.)
43
LINUX DEVICE DRIVER CHAPTER E

9.1 HISTORY OF DEVICE DRIVER
De+i*e dri+er, ta<e on a ,;e*ial role in the Linu= <ernel5 The- are di,tin*t 4.la*< .o=e,K that
ma<e a ;arti*ular ;ie*e of hardware re,;ond to a well:defined internal ;rogramming
interfa*e@ the- hide *om;letel- the detail, of how the de+i*e wor<,5 ",er a*ti+itie, are
;erformed .- mean, of a ,et of ,tandardiNed *all, that are inde;en: dent of the ,;e*ifi* dri+er@
ma;;ing tho,e *all, to de+i*e:,;e*ifi* o;eration, that a*t on real hardware i, then the role of
the de+i*e dri+er5 Thi, ;rogramming interfa*e i,
,u*h that dri+er, *an .e .uilt ,e;aratel- from the re,t of the <ernel and 4;lugged inK at
runtime when needed5 Thi, modularit- ma<e, Linu= dri+er, ea,- to write( to the
;oint that there are now hundred, of them a+aila.le5There are a num.er of rea,on, to .e
intere,ted in the writing of Linu= de+i*e dri+er,5 The rate at whi*h new hardware .e*ome,
a+aila.le 6and o.,olete]8 alone guarantee, that dri+er writer, will .e .u,- for the fore,eea.le
future5 Indi+idual, ma- need to <now a.out dri+er, in order to gain a**e,, to a ;arti*ular
de+i*e that i, of intere,t to them5 %ardware +endor,( .- ma<ing a Linu= dri+er a+aila.le for
their ;rodu*t,( *an add the large and growing Linu= u,er .a,e to their ;otential mar<et,5 And
the o;en ,our*e nature of the Linu= ,-,tem mean, that if the dri+er writer wi,he,( the ,our*e
to a dri+er *an .e Mui*<l- di,,eminated to million, of u,er,5
There are -,%(( t-;e, of de+i*e dri+er, are a, follow,3
D(J32( T=/()3
#lo*< de+i*e,
Random a**e,, de+i*e, 6.uffering8 $or e=am;le a file ,-,tem *an onl- .e
mounted on a .lo*< de+i*e( .e*au,e it reMuire, random a**e,,5
$or e=am;le( di,<, are *ommonl- im;lemented a, .lo*< de+i*e,5
44
Chara*ter de+i*e,
SeMuential a**e,, 6no .uffering85 E=am;le, might in*lude ;rinter,(
,*anner,( ,ound .oard,( *5 The ,ame de+i*e ma- ha+e .oth .lo*< and
*hara*ter oriented interfa*e, 6In other "NIC thi, would a*tuall- reMuire
,e;arate dri+er,5 A .lo*< de+i*e dri+er and a raw de+i*e dri+er85
Networ< de+i*e,
An- networ< tran,a*tion i, made through an interfa*e( that i,( a de+i*e
that i, a.le to e=*hange data with other ho,t,5 ",uall-( an interfa*e i, a
hardware de+i*e( .ut it might al,o .e a ;ure ,oftware de+i*e( li<e the
loo;.a*< interfa*e5 A networ< interfa*e i, in *harge of ,ending and
re*ei+ing data ;a*<et,( dri+en .- the networ< ,u.,-,tem of the <ernel(
without <nowing how indi+idual tran,a*tion, ma; to the a*tual ;a*<et,
.eing tran,mitted5 !an- networ< *onne*tion, 6e,;e*iall- tho,e u,ing
TCP8 are ,tream:oriented( .ut networ< de+i*e, are( u,uall-( de,igned
around the tran,mi,,ion and re*ei;t of ;a*<et,5 A networ< dri+er <now,
nothing a.out indi+idual *onne*tion,@ it onl- handle, ;a*<et,5Not .eing a
,tream:oriented de+i*e( a networ< interfa*e i,n>t ea,il- ma;;ed to a node
in the file,-,tem( a, Jde+Jtt-1 i,5 The "ni= wa- to ;ro+ide a**e,, to
interfa*e, i, ,till .- a,,igning a uniMue name to them 6,u*h a, eth08( .ut
that name doe,n>t ha+e a *orre,;onding entr- in the file,-,tem5
Communi*ation .etween the <ernel and a networ< de+i*e dri+er i,
*om;letel- different from that u,ed with *har and .lo*< dri+er,5 In,tead
of read and write( the <ernel *all, fun*tion, related to ;a*<et
tran,mi,,ion5
45
M*+&% *14 M31&% N508(%)

I M*+&% 1508(%
Ea*h de+i*e dri+er i, identified .- a uniMue ma)or num.er5 Thi, num.er i,
a,,igned .- the Linu= De+i*e Regi,trar 6A human E *urrentl-
Peter5An+in^linu=5org85 Thi, num.er i, the inde= into an arra- that
*ontain, the information a.out the dri+er 6the de+i*e\,tru*t8
I M31&% 1508(%
Thi, uniMuel- identifie, a ;arti*ular in,tan*e of a de+i*e5 $or e=am;le( a
,-,tem ma- ha+e multi;le IDE hard di,<, ea*h would ha+e a ma)or
num.er of 9( .ut a different 031&% 1508(%5
If -ou i,,ue the l,El *ommand(-ou>ll ,ee two num.er,6,e;arated .- a
*omma8 in the de+i*e file entrie, .efore the date of the la,t modifi*ation(
where the file length normall- a;;ear,5 The,e num.er, are the ma)or and
minor de+i*e num.er for the ;arti*ular de+i*e5 The following li,ting
,how, a few de+i*e, a, the- a;;ear on a t-;i*al ,-,tem5The ir ma)or
num.er, are1( 2( 7(and 10(while the minor, are 1( 9( B( A2( AB( and 1/G5
*rw:rw:rw: 1 root root 1( 9 A;r 11 /00/ null
*rw::::::: 1 root root 10( 1 A;r 11 /00/ ;,au=
*rw::::::: 1 root root 2( 1 O*t /L 09302 tt-1
*rw:rw:rw: 1 root tt- 2( A2 A;r 11 /00/ tt-,0
*rw:rw:::: 1 root uu*; 2( AB A;r 11 /00/ tt-S1
*rw::w:::: 1 +*,a tt- 7( 1 A;r 11 /00/ +*,1
*rw::w:::: 1 +*,a tt- 7( 1/G A;r 11 /00/ +*,a1
*rw:rw:rw: 1 root root 1( B A;r 11 /00/ Nero
46
ADVANTAGES CHAPTER F

Linu= de+i*e dri+er ha, the rate at whi*h new hardware .e*ome,
a+aila.le along grantie, that dri+er write, will .e .u,- for the fore,eea.le5
Linu= ,-,tem i, the o;en ,our*e nature mean, that if the dri+er writer
wi,he, the ,our*e to a dri+er, *an .e Mui*<l- di,,eminated to millon, of
u,er,5
In linu= dri+er ;rogramming interfa*e i, ,u*h that dri+er, *an .e .uilt
,e;aratel- from the re,t of the <ernel and 4;lugged inK at run time when
needed5 Thi, modularit- ma<e, Linu= dri+er ea,- to write( to the ;oint
that there are now hundred, of them a+aila.le5

47

También podría gustarte