Next Previous Contents

9. Modules

Ta modules toy pyrhna poy fortwnontai (loadable), synh8ws kanoyn oikonomia sth mnhmh kai dieykolunoyn tis ry8miseis. To pedio twn modules exei megalwsei, wste shmera perilambanei filesystems, drivers kartwn diktuoy, drivers monadwn magnhtikhs tainias, drivers ektypwtwn, kai alla.

9.1 Egka8istwntas tis utilities gia ta modules

Oi utilities gia ta modules einai dia8esimes (ws arxeio modutils-x.y.z.tar.gz) apo ekei, opoy phrate ton source kwdika toy pyrhna. Dialejte thn pleon prosfath ekdosh x.y.z toy sxetikou patch, h opoia einai ish me (h amesws parakatw apo) thn ekdosh toy pyrhna sas. Anoijte to me tar zxvf modutils-x.y.z.tar.gz, pate me cd sto directory poy dhmioyrgh8hke (modutils-x.y.z), diabaste to README, kai akoloy8hste tis odhgies egkatastashs (poy synh8ws einai aples, px kati san make install). Twra, kanonika prepei na exete ta programmata insmod, rmmod, ksyms, lsmod, genksyms, modprobe, kai depmod sto dir /sbin. An 8elete, kante mia dokimh stis utilities aytes me ton driver "hw", poy perilambanetai sthn insmod ws paradeigma. Gia leptomereies, cajte to arxeio INSTALL sto sxetiko subdir.

H insmod bazei ena module ston energo pyrhna. Ta modules synh8ws exoyne epektash .o . O driver dokimwn poy proanaferame, onomazetai drv_hello.o. Epomenws, gia na ton baloyme ston pyrhna, 8a dwsoyme insmod drv_hello.o. Gia na doume poia modules xrhsimopoiei ayth th stigmh o pyrhnas mas, dinoyme lsmod. H ejodos einai kapws etsi :

    blah# lsmod
    Module:        #pages:  Used by:
    drv_hello          1

To drv_hello einai to onoma toy module, katalambanei mia selida twn 4k mnhmhs, kai pros to paron den yparxoyn alla modules poy ejartwntai ap' ayto. Gia na to afairesoyme, dinoyme rmmod drv_hello. Shmeiwste oti h rmmod xreiazetai onoma module ws orisma, oxi onoma arxeioy. To onoma toy module to pairnete apo th lista toy lsmod. O skopos twn ypoloipwn utilities gia ta modules anaferetai stis antistoixes selides man.

9.2 Modules poy dianemontai mazi me ton pyrhna

Apo thn ekdosh 2.0.30, ta perissotera paketa einai dia8esima ws loadable modules. Gia na ta xrhsimopoihsete, prwta bebaiw8eite oti den ta exete sthsei mazi me ton pyrhna. Dhladh, mhn apantate y gi' ayta, kata th diarkeia ths make config. Kante compile enan neo pyrhna, kai epanekkinhste m' ayton. Meta, janapate me cd sto /usr/src/linux, kai dwste make modules. Ayto kanei compile ola ta modules poy den balate sto sthsimo toy pyrhna, kai topo8etei links pros ayta sto /usr/src/linux/modules. Mporeite na ta xrhsimopoihsete katey8eian apo to dir ayto, h na dwsete make modules_install, poy 8a ta egkatasthsei sto dir /lib/modules/x.y.z (opoy x.y.z einai h ekdosh toy pyrhna).

Ayto einai polu eukolo eidika me ta filesystems. Px, pi8anotata den 8a xrhsimopoihsete syxna ta filesystems minix kai msdos, kai, an proswpika euriska mia disketa msdos (mprrrr!!!), 8a edina insmod /usr/src/linux/modules/msdos.o, kai meta rmmod msdos. Ayth h diadikasia ejoikonomei peripoy 50k RAM ston pyrhna kata thn ypoloiph leitoyrgia toy. Edw epiballetai mia mikrh shmeiwsh gia to filesystem minix : Panta na to sthnete katey8eian mesa ston pyrhna, otan prokeitai gia xrhsh se disketes "diaswshs".


Next Previous Contents