Next Previous Contents

5. Pros8eto dwraki : Ekkinwntas apo cd-rom

Polla apo ta parapanw efarmozontai epishs se ekkinhsh apo cd-rom. Mia pou - etsi ki alliws - h8ela na gracw kai gia ekkinhsh apo cd-rom, pros8etw edw tis katallhles plhrofories, wste na mhn janagracw dyo fores ta idia pragmata.

Giati na 8eloyme na bootaroyme enan H/Y apo cd-rom; H ekkinhsh apo cd-rom mas endiaferei se periptwseis, opoy 8eloyme na trejoyme mia polu eidikh efarmogh, px ena kiosk (s.t.m. : Des to Kiosk HowTo), ena programma bashs dedomenwn biblio8hkhs, h ena intenet cafe, kai den exoyme diktyo h server, gia na kanoyme sthsimo root over nfs.

5.1 Basikh arxh

H basikh arxh pali einai aplh : na ekkinhsoyme ws root m' ena cd-rom. Gia na mporesoyme : 8a xrhsimopoihsoyme thn epektash rockridge, gia na topo8ethsoyme ena unix-like filesystem epanw sto cd, kai thn epektash Eltorito, gia na kanoyme to cd ekkinhsimo.

Ta pragmata den mporei na einai toso apla

Fysika, ayto to sthsimo paroysiazei merika problhmata. Ta perissotera einai ta idia me ta parapanw :

  1. 8a xreiastoume prosbash eggrafhs sta : /dev, /var & /tmp.
  2. Merikes efarmoges xreiazontai prosbash eggrafhs sto /home.
  3. To /etc/mtab prepei na mporei na grafetai :

5.2 Ftiaxnontas ena dokimastiko sthsimo.

Twra, poy gnwrizoyme ti na kanoyme kai pws, hr8e h stigmh na ftiajoyme ena dokimastiko sthsimo :

  1. Kat' arxhn, parte enan H/Y ap' aytous poy 8elete na xrhsimopoihsete, kai balte mesa enan megalo sklhro disko ki ena cd recorder.
  2. Balte to Linux poy sas aresei epanw s' ayto to mhxanhma, ki afhste eleu8erh mia partition twn 650 MB gia to dokimastiko sthsimo. Ayth h egkatastash 8a fanei xrhsimh sto na ftiajoyme to iso-image toy cd kai na to rijoyme sta cd's ekkinhshs, ara egkatasthste ta aparaithta ergaleia. Epishs, 8a mas xreiastei sto na dior8wsoyme ola ta bugs, poy den mas epitrepoyn na bootaroyme to mhxanhma ths dokimhs.
  3. Egkatasthste to Linux ths epiloghs sas epanw sthn partition twn 650 MB, me to sthsimo poy 8elete na perasei kai sto cd. Ayto 8a einai kai to sthsimo poy 8a xrhsimopoihsoyme stis dokimes.
  4. 3ekinhste apo th dokimastikh partition.
  5. Kante compile enan pyrhna, opws perigracame sto tmhma 3.1 . Akoloy8hste ola ta bhmata, dioti oi aparaithtes allages gia to devfs ejakoloy8oun na xreiazontai! Sto bhma 3 toy tmhmatos 3.1, pros8este ta ejhs :
  6. Ry8miste to dokimastiko sthsimo :
  7. Dokimaste to oti ola doyleuoyn swsta.
  8. Ekkinhste thn kyriws egkatastash kai kante mount thn partition twn 650 MB sto directory /test ths kyriws egkatastashs.
  9. Balte ta parakatw s' ena arxeio, me to onoma /test/etc/rc.d/rc.iso . To source aytou toy arxeioy mpainei sthn arxh toy rc.sysinit, gia na ftiajei to /var .
    #/var
    echo Ftiaxnoume to /var ...
    mke2fs -q -i 1024 /dev/ram1 1024
    mount /dev/ram1 /var -o defaults,rw
    cp -a /lib/var /
    
    #Epanaferoume tis ry8miseis tou devfs, xreiazomaste to proc
    mount -t proc /proc /proc
    /etc/rc.d/rc.devfs restore /etc/sysconfig
    umount /proc
      
    

  10. Dior8wnoyme to /test/etc/rc.sysinit , bazontas sxolio stis grammes opoy o root fortwnetai rw, kai pros8etoyme tis akoloy8es 2 grammes amesws meta ton orismo toy PATH :
    #gia na bootaroume apo cdrom
    . /etc/rc.d/rc.iso
      
    

  11. Antigrafoyme ta parakatw s' ena script kai to ekteloume. Ayto 8a ftiajei ena protypo gia to /var kai 8a dhmioyrghsei ta links twn /tmp kai /etc/mtab.
    #!/bin/sh
    echo tmp
    rm -fR /test/tmp
    ln -s var/tmp /test/tmp
    
    ###
    echo mtab
    touch /test/proc/mounts
    rm /test/etc/mtab
    ln -s /proc/mounts /test/etc/mtab
    
    ###
    echo var
    mv /test/var/lib /test/lib/var-lib
    mv /test/var /test/lib
    mkdir /test/var
    ln -s /lib/var-lib /test/lib/var/lib
    rm -fR /test/lib/var/catman
    rm -fR /test/lib/var/log/httpd
    rm -f /test/lib/var/log/samba/*
    for i in `find /test/lib/var/log -type f`; do cat /dev/null > $i; done
    rm `find /test/lib/var/lock -type f`
    rm `find /test/lib/var/run -type f`
    
      
    

  12. Afairwntas th dhmioyrgia toy /etc/issue* apo to /test/etc/rc.local, apla 8a to anagkasoyme na apotuxei.
  13. Twra epanekkinoume th dokimastikh partition, h opoia 8a diabastei apla san ena cd-rom. An kati den doylecei, epanekkinhste me thn kyriws partition, dior8wste to, janadokimaste to, k.o.k. . H, mporeite na kanete remount / rw th dokimastikh partition, na to dior8wsete, kai na epanekkinhsete katey8eian me th dokimastikh partition jana. Gia na kanete remount / rw , dwste :
    mount -o remount,rw /

5.3 Ftiaxnontas to cd

Ftiaxnontas ena boot image

Prwta-prwta, ekkinhste me thn kyriws partition. Gia na ftiajete ena ekkinhsimo cd, 8a xreiasteite ena image mias bootable disketas. Den 8a doylecei to aplo dd s' ena zimage, epeidh o loader sthn arxh toy zimage den fainetai n' agapaei thn ceutikh disketa, poy dhmioyrgei to ekkinhsimo cd. Etsi, 8a xrhsimopoihsoyme to syslinux :

  1. Pairnoyme to boot.img apo ena cd toy RedHat
  2. Kanoyme mount to boot.img kapoy anamesa sto loopback, dinontas :
    mount boot.img kapou -o loop -t vfat
  3. Afairoume o,tidhpote apo to boot.img , ektos apo ta :
  4. Antigrafoyme to kernel image ths dokimastikhs partition sto boot.img .
  5. Dior8wnoyme to syslinux.cfg , wste na periexei ta ejhs (antika8istwntas, fysika, to zImage me to katallhlo onoma image) :
    default linux 
    
    label linux
    kernel zImage
    append root=/dev/<balte edw to onoma tou cdrom sas>
      
    

  6. Umount boot.img:
    umount kapou
  7. An to /etc/mtab sas einai link gia to /proc/mounts , to umount den 8' afhsei aytomata eleu8ero to /dev/loop0 , synepws eley8erwste to dinontas :
    losetup -d /dev/loop0

Dhmioyrgwntas to iso image

Afou exoyme to boot image kai mia egkatastash poy mporei na jekinhsei apo ena readonly mount, eftase h stigmh na ftiajoyme ena iso image toy cd :

  1. Antigracte to boot.img sto /test
  2. Kante cd sto directory, opoy 8elete n' apo8hkeusete to image. Bebaiw8eite oti brisketai epanw se mia partition me arketo eleu8ero xwro.
  3. Twra, ftiajte to image, plhktrologwntas :
    mkisofs -R -b boot.img -c boot.catalog -o boot.iso /test

Epalh8euontas to iso image

  1. Kante mount to image anamesa sto loopback device, dinontas :
    mount boot.iso kapou -o loop -t iso9660
  2. Twra epibebaiwste oti ta periexomena einai entajei.
  3. Kante umount to boot.iso :
    umount kapou
  4. An to /etc/mtab sas einai link pros to /proc/mounts , to umount den 8' apeley8erwsei aytomata to /dev/loop0 . Ayto eley8erwste to, plhktrologwntas :
    losetup -d /dev/loop0

Grafontas to CD

Ypo8etontas oti exete egkatasthsei kai ry8misei to cdrecord gia ton eggrafea sas, dwste :

cdrecord -v speed=<epi8umhth taxuthta eggrafhs> dev=<path pros to generic scsi device tou eggrafea sas> boot.iso

5.4 Bootarete to CD kai dokimaste to

E, o titlos ayths ths paragrafoy ta leei ola! ;)


Next Previous Contents