本次实验的目的是了解Emacs如何能在linux内核上很好的工作.
仅需要的外部命令是: mount .
文章中的”root_fs_emacs”可以做为一个标准分区或在live CD上使用. 这次实验, 我们用于User Mode Linux上.
1. 初始化root_fs(至少150MB)
cd ~/uml
dd if=/dev/zero of=root_fs_emacs bs=1k count=200k
yes y|mke2fs root_fs_emacs
mkdir /emacs
mount -o loop root_fs_emacs /emacs
cd /emacs
ln -s . emacs # 简单配置 emacs 的 -prefix 参数
cp -a /dev dev # 我们大胆拷贝整个/dev
mkdir etc sbin tmp # 创建emacs没有创建的其它目录
cat >etc/fstab <
/dev/ubd0 / ext2 defaults 0 1
EOF
2. 在字符环境下静态编译emacs
cd ~/src
tar jxvf emacs-21.3.tar.bz2
cd emacs-21.3
CFLAGS=-static LDFLAGS=-static ./configure -without-x -prefix=/emacs
make && make install
3. 以/sbin/init方式安装emacs
cd /emacs
ln bin/emacs sbin/init
cat >.emacs <
(message “init starting”)
(setq auto-save-interval 0)
(defun shutdown ()
(interactive)
(when (yes-or-no-p “Really shut down the system? “)
;; actually, kill-emacs signals emacs ie. init, which makes linux panic.
(kill-emacs)))
(global-set-key “\C-x\C-c” ’shutdown)
(global-set-key “^\” ‘keyboard-quit) ;; strangely, C-g does not work.
(call-process “/bin/mount” nil “*log*” t “-n” “-o” “rw,remount” “/”)
(if (file-exists-p “/etc/mtab”) (delete-file “/etc/mtab”))
(call-process “/bin/mount” nil “*log*” t “-f” “/dev/ubd0″ “/”)
(message “init done”)
EOF
4. 静态编译mount
cd ~/src
tar jxvf util-linux-2.12a.tar.bz2
cd util-linux-2.12a
CFLAGS=-static LDFLAGS=-static ./configure
make && install -m 755 mount/umount mount/mount /emacs/bin/
5. 引导linux
cd ~/uml
umount /emacs
linux ubd0=root_fs_emacs
现在, 你可以通过下面命令运行一个emacs脚本:
M-x eshell RET
ls -l RET
运行结果是:
File Edit Options Buffers Tools Help
Welcome to the Emacs shell
/ # ls -l
total 21
drwxr-xr-x 2 0 0 1024 Jul 26 08:42 bin
drwxr-xr-x 1 0 0 0 Jan 1 1970 dev
lrwxrwxrwx 1 0 0 1 Jul 26 08:11 emacs -> .
drwxr-xr-x 2 0 0 1024 Jul 26 09:20 etc
drwxr-xr-x 2 0 0 2048 Jul 26 08:11 info
drwxr-xr-x 3 0 0 1024 Jul 26 08:11 libexec
drwx---- 2 0 0 12288 Jul 26 08:10 lost+found
drwxr-xr-x 3 0 0 1024 Jul 26 08:10 man
drwxr-xr-x 2 0 0 1024 Jul 26 08:11 sbin
drwxr-xr-x 3 0 0 1024 Jul 26 08:10 share
drwxr-xr-x 2 0 0 1024 Jul 26 09:15 tmp
/ #
-1-:--F1 *eshell* (EShell)-L20-All--------------
当然, emacs缺少很多系统调用(同样elisp原语中也没有), 所以, 我们很难用emacs去做任何事情. 不过这只是一个开始.
另外, 你也可以使用具有FFI和可移植Hemlock功能的Common-Lisp方法来实现.
Emacs做为shell程序
Emacs可以很容易做为shell程序使用:
echo /usr/bin/emacs >> /etc/shells
chsh -s /usr/bin/emacs GOODUSER
echo ‘(setenv “SHELL” “/bin/bash”)’ >> ~GOODUSER/.emacs
# 这种情况用户想使用 M-x shell
# [ 我更想使用: (setenv “SHELL” “/usr/bin/clisp”) ]
echo ‘(eshell)’ >> ~GOODUSER/.emacs
# 自动启动eshell.
# 也可使用: (dired default-directory) 替代…
su - GOODUSER
# 很好!
fleet2008 于 2007-11-10 11:28:48发表:
水平有限,有些看不民懂,有机会一定向您请教!
68.114.24.* 于 2007-09-07 02:35:35发表:
1210007e506881904360ba44b89d863a http://nokia-8310-tastiera.odiioj.org/ http://crocerossaitalianasede.ukcvbo.org/moto-club-evergreen-motocross/ http://gara-ippica-ostacoli.odiioj.org/ http://persiana-misura-milano.oxibnl.org/ http://menu-veloci.ufftiy.org/ http://prenotazione-hotel-fuerteventura.oxibnl.org/ http://pallaalbalzoalfonsogatto.dlqpew.org/programma-cinema-a-roma/ http://film-fantascienza-gratis.odiioj.org/ http://ultime-su-napoli-calcio.ufftiy.org/ http://penna-stilografica-poitiers.yavpvy.org/ ef5da0821261872f3a177fbd4ce2e9fc
76.27.217.* 于 2007-09-06 09:20:04发表:
0ac8f043e89ed72a8246a17e01af7007 http://www.international.ucf.edu/myphp/community/viewtopic.php?t=124 http://payson.tulane.edu/techeval/forums/viewtopic.php?t=74 http://www.rstm.edu/phpBB/viewtopic.php?t=1450 http://www.rstm.edu/phpBB/viewtopic.php?t=1450 http://transatlantic.ipo.asu.edu/forum/viewtopic.php?t=208 http://transatlantic.ipo.asu.edu/forum/viewtopic.php?t=208 http://www.international.ucf.edu/myphp/community/viewtopic.php?t=124 http://www.rstm.edu/phpBB/viewtopic.php?t=1450 http://iris.lib.virginia.edu/phpBB2/viewtopic.php?t=7689 http://iris.lib.virginia.edu/phpBB2/viewtopic.php?t=7689 d950163e2bc04fe30175aa17834ab13d
78.139.3.* 于 2007-09-05 20:26:37发表:
8333c514fbf931ee73a5105d4e385007 http://myweb.msoe.edu/~chaversa/phpBB2/viewtopic.php?t=2012 http://myweb.msoe.edu/~chaversa/phpBB2/viewtopic.php?t=2012 http://forum.jalc.edu/phpBB2/viewtopic.php?t=2267 https://www.cslu.ogi.edu/forum/viewtopic.php?t=2656 https://www.cslu.ogi.edu/forum/viewtopic.php?t=2657 http://www.grahi.upc.edu/ERAD2006/phpBB2/viewtopic.php?t=6839 https://www.cslu.ogi.edu/forum/viewtopic.php?t=2657 https://www.cslu.ogi.edu/forum/viewtopic.php?t=2656 http://forum.jalc.edu/phpBB2/viewtopic.php?t=2267 https://www.cslu.ogi.edu/forum/viewtopic.php?t=2656 db62d9d137e7999ef0c8bbd27991ea41
201.92.234.* 于 2007-09-05 06:11:24发表:
f660c7d80caad52db307a729eccae1ec http://valutazione-uso-cessione-quota.dfmviz.info/ http://signori-pallida-testo.dfmviz.info/ http://pubblicita-web.dfmviz.info/ http://decisione-7613-21-12-1999.dfmviz.info/ http://pagamenti-mensili.dfmviz.info/ http://stampa-maglietta.dfmviz.info/ http://budget-finanziario.dfmviz.info/ http://ecm-infermieri-2006.dfmviz.info/ http://negozio-mobile-usato-sassari.dfmviz.info/ http://kavafis-dio-abbandona-antonio.dfmviz.info/ 21817dd0dbd87cb119a7471ab31fd121
71.72.122.* 于 2007-08-16 00:12:49发表:
278ac7316ce0a9c38d0ab15bc5cd688a http://aereo-compagnia.zpvztz.com/ http://vedere-in-liguria.ddxsak.com/ http://ti-invito.ddxsak.com/ http://sostegno.akrmtn.com/ http://clueb-editore.flroxk.com/ http://porte-interne-vendita.flroxk.com/ http://configurazione-gps.zpvztz.com/ http://capodanno-2006-s-miniato-pisa.akrmtn.com/ http://evento-oggi-lombardia.flroxk.com/ http://corso-informatica-provincia-napoli.flroxk.com/ f79720dbd018955dfd9068d527cd2031
200.8.190.* 于 2007-07-26 01:20:23发表:
2672e161f33de963501f0a076bf70a40 http://columbus-club-lord-nelson.cuxojo.biz/ http://italiano-persiano.fmyrxs.biz/ http://armeria-bunker-gun.fmyrxs.biz/ http://condominio-usufruttuario.cuxojo.biz/ http://it-spaghetto-vongola-surgelate.txcbmz.biz/ http://risultati-partite-in-tempo.ftgmns.biz/ http://video-iena-sgarbi.txcbmz.biz/ http://donne-dei-calciatori.fmyrxs.biz/ http://coppa-campioni-parigi.cuxojo.biz/ http://grandi-viaggi-villaggio.cuxojo.biz/ f0bd15bc4c04b02533089147dbde4c5b
81.184.33.* 于 2007-07-25 19:13:35发表:
3afac5c216f49363aa73b4cf5f86d4d5 http://feste-bambini-bari.gohktw.biz/ http://traduci-latino.hdywtl.biz/ http://192-risparmio-energetico.pzgvuv.biz/ http://gallura-affitti.pzgvuv.biz/ http://unicoop-tirreno-intranet.pzgvuv.biz/ http://rivoluzione-bolscevica.ytxxxk.biz/ http://donna-matura-scopano-ragazzo-giovane.pzgvuv.biz/ http://castiglione-ischia.pzgvuv.biz/ http://corsi-di-topografia.hdywtl.biz/ http://cartone-manga-hentey.pzgvuv.biz/ bfdd7bec9230a10317341e982495b689
84.100.96.* 于 2007-07-25 14:11:03发表:
03b553c7832d20d1ae7fb6be4c4fc42e http://tariffario-consulenti.enadzh.biz/ http://gioco-pc-bambina-gratis.kajgdw.biz/ http://copie-attestati.iuatju.biz/ http://decatlhon-it-lavora.kajgdw.biz/ http://nuovo-trucco-soluzione-imperium-civilization.enadzh.biz/ http://arpa-gotica.ygvhik.biz/ http://roma-chieti-scalo.enadzh.biz/ http://bari-maglietta-stampa.kajgdw.biz/ http://tecnica-costruttiva-brunelleschi.kajgdw.biz/ http://ilsoftware-it-querydl-asp-id-608.tzlnou.biz/ 69fae163d26a9b1682339a4eb6fc4ad9
190.38.155.* 于 2007-07-24 04:29:43发表:
aaa0bafe32e23e37e8c8224c9d8c589f http://qualita-in-sanita.cqhnnx.org/ http://vecchia-maremma.jnbwct.org/ http://offerta-telefono-umts.hdpwsk.org/ http://aixam-721-prezzo.cqhnnx.org/ http://ama-roma-concorso.cqhnnx.org/ http://allievi-provinciali.gbdrme.org/ http://pelosa-porca-matura.hdpwsk.org/ http://cesti-di-frutta.pvaeyo.org/ http://coppola-cristoforo.hdpwsk.org/ http://asciugacapelli-aria-fredda.jnbwct.org/ eb89aa2351bfb8dd061b0dc25061dcdb
87.206.53.* 于 2007-07-21 12:07:19发表:
adfe0007491c72450bfe2992c6bd264a http://nonlasciarsiandaresensocolpaautoerotismo.ghoouy.org/subsonica-accordo-coriandolo-natale/ http://esempiorelazionetirocinio.ghoouy.org/annunci-di-case/ http://langhiranoquad.chohqh.org/monica-gasperini-studio-aperto/ http://dichiarazionefallimento.qemqrg.org/bere-piscio-ordina/ http://monilinativiamericani.kcqdnd.org/negozio-mobile-usato-roma/ http://luganobasket.pehabe.org/hakan-belkiran/ http://giannottiangeli.ghoouy.org/scheda-madre-hp/ http://abitodebut.pehabe.org/copertina-cd-cover-audio/ http://materassofalomo.ghoouy.org/albergo-tirano/ http://chimairavaleriomassimo.pehabe.org/taxi-merce-bologna/ b8fb7d84153cc5c69600cbe1497734b2
84.123.161.* 于 2007-07-20 03:04:52发表:
c820e9d4ad304b1a6c9c2a0dd8a8edaf http://webcam-principato-monaco.jvzulp.in/ http://malga-venegia.aoknmm.in/ http://schema-cavo-aiwa-multi-cd.aoknmm.in/ http://analisi-testuale-lupa-verga.jvzulp.in/ http://parco-spina-verde-como.vbglda.com/ http://forno-antico-san-mauro-bruca.kmyeyh.com/ http://prestito-erogato-societa-capitale-amministratore.fzhoas.in/ http://gta-mappe.jnesky.in/ http://dott-bove-francesco-ortopedico.kmyeyh.com/ http://escort-svizzere.aezqpa.com/ b8a12f78e2ab8d9c8e5e94f78e975725
221.164.235.* 于 2007-07-18 15:45:42发表:
cd471ad7dd1d7931abd41e82e22219e4 http://meteovr.ppnxyq.org/moschea-parigi/ http://risultatopartitapallavolo.lgyeas.org/mariposa-abbigliamento/ http://installatoresatellite.qbmkwd.org/calendario-liturgico-2005/ http://ascoltocanzonescatterofototizianoferro.vniybd.org/traduzione-testo-canzone-bon-jovi/ http://ascoltocanzonescatterofototizianoferro.vniybd.org/disegni-di-pasqua-da-colorare/ http://batteriaservizio.ppnxyq.org/importo-assegno-familiare-san-marino/ http://oraziononasatiralibroprimoit.lgyeas.org/le-voci-dell-anima/ http://antonellalagovidcaps.jpwypc.org/scuola-sant-agata-villa-guardia/ http://fototroiascopataficafotogratis.qbmkwd.org/escort-torino-it/ http://agriturismocertosapadula.nxaqjj.org/decreto-n-306-18-febbraio-1998/ 8ea4fcdde1a965ef95e68187f350c6f6
189.13.196.* 于 2007-07-18 15:30:27发表:
http://4c24089694b9f9c2e411e6524b35cb83-t.xkktxb.org 4c24089694b9f9c2e411e6524b35cb83 http://4c24089694b9f9c2e411e6524b35cb83-b1.xkktxb.org 4c24089694b9f9c2e411e6524b35cb83 http://4c24089694b9f9c2e411e6524b35cb83-b3.xkktxb.org 8d1f2bfe3cbc5359328d95464cab8b7c
190.74.230.* 于 2007-07-17 07:02:11发表:
cea971986c865e89430ad95079809d8a http://seal-ogna.gvjcaf.com/ http://il-capo-ha-sempre.jmncsw.biz/ http://tutela-privacy-trattamento-dato-sensibili.xxmndb.biz/ http://autocombustione-umana.jmncsw.biz/ http://aggiornamento-mappa-europea.ynpojb.biz/ http://pullman-dusseldorf-praga.nioqlj.com/ http://messa-in-tavola.nioqlj.com/ http://d-auria-lucio.ynpojb.biz/ http://bianca-pitzorno.xmjviq.com/ http://san-pier-niceto-ristorante.knhtou.com/ 8cff813cd5cdf93d908a9e43c4704dad
200.109.194.* 于 2007-07-15 22:01:15发表:
ccf61c9cdceed4b28539e365c0ddbc98 http://bellacartolinadamore.jlmwbv.org/hotel-gazzella-bianca-abano/ http://viaggiocampoconcentramento.tvmowd.org/drum-toner-fotocopiatrice-sanyo/ http://tunisiamadhia.tvmowd.org/attore-attante/ http://normativaleggecostruzionedilatazionetermica.gapphu.org/poesia-per-la-scuola-di-infanzia/ http://soluzionedriverparallellines.gapphu.org/associazione-artigiano-trento/ http://migliorarespirazionecellulare.vozulo.org/percentuale-ricarico-genere-alimentare/ http://scioperobustrieste.kqjhpm.org/coppola-emanuele/ http://trovamappe.mongnb.org/assistenza-educativa-domiciliare/ http://puntidiincontrogay.mongnb.org/s-martino-festa/ http://ordinecommercialistidiroma.seklde.org/enrico-de-aglio/ a875aa102e91579b074fe29fa7a13e81
222.120.187.* 于 2007-07-14 15:06:49发表:
ac070b4c684639a40883c96702710c7e http://tuning-in-italia.lldpzx.org/ http://ragazza-costa-d-avorio.lldpzx.org/ http://baita-alto-adige-capodanno.wuzzme.org/ http://dottoressa-frilli.mhjqva.org/ http://prenotazione-agriturismi.ubetii.org/ http://oltre-po-pavese.ubetii.org/ http://filo-ricamo-decoupage.tttfhp.org/ http://cuore-solitario.benlzg.org/ http://vogatore-idraulico.ubetii.org/ http://java-strutture-dati.wxamgv.org/ 8c2a5fabd273020cebfaea52010ee4bb
81.35.143.* 于 2007-07-13 08:18:38发表:
0fdf3f381318d61bb7881157a893cd09 http://allevamento-pastore-tedesco-roma.mtfkmx.org/ http://milano-lavoro-milano-offerta-lavoro-milano.gbymyg.org/ http://escort-polacche.mtfkmx.org/ http://italia-brasile.egcngx.org/ http://risiko-digital-crack.qpjnvy.org/ http://interfaccia-xp.orjndo.org/ http://spirit-opportunity-gennaio-2004.udzjxi.org/ http://sceneggiatura-fiction.qpjnvy.org/ http://lavaggio-auto.udzjxi.org/ http://aci-crema.rtistm.org/ d8d97f68bc274489b372d34e17b3a169
190.10.213.* 于 2007-07-12 01:40:52发表:
873efddc5b283b67e1f15224526e7ca6 http://23.ska4aj.com/pagina17.html http://23.skachaj.org/pagina30.html http://17.ska4aj.com/pagina68.html http://23.ska4aj.com/pagina74.html http://17.ska4aj.org/pagina81.html http://3.ska4aj.com/pagina59.html http://7.ska4aj.org/pagina55.html http://1.skachaj.org/pagina69.html http://16.ska4aj.net/pagina10.html http://23.ska4aj.com/pagina45.html 53f688e2d0ae01a48f96ad8f8181d4f6
201.62.213.* 于 2007-07-06 00:42:27发表:
http://efeaaa28ebf32cd78899d37ed019790b-t.lwgmrw.org efeaaa28ebf32cd78899d37ed019790b http://efeaaa28ebf32cd78899d37ed019790b-b1.lwgmrw.org efeaaa28ebf32cd78899d37ed019790b http://efeaaa28ebf32cd78899d37ed019790b-b3.lwgmrw.org 7323937625928ec2c2b389a5c949efe8