--- created_at: '2016-11-02T13:17:42.000Z' title: Emacs standing alone on a Linux Kernel (2004) url: http://www.informatimago.com/linux/emacs-on-user-mode-linux.html author: Ivoah points: 178 story_text: comment_text: num_comments: 62 story_id: story_title: story_url: parent_id: created_at_i: 1478092662 _tags: - story - author_Ivoah - story_12854336 objectID: '12854336' year: 2004 --- [Source](http://www.informatimago.com/linux/emacs-on-user-mode-linux.html "Permalink to Emacs standing alone on a Linux Kernel") # Emacs standing alone on a Linux Kernel * * * | [Contents][1] | [Home][2] | [Previous][3] | [Up][4] | [Next][5] | * * * [Jump to Emacs as shell][6] # Emacs standing alone on a Linux Kernel The purpose of this experiment is to see how emacs can work alone over a linux kernel. The only external tool needed is `mount`. This "root_fs_emacs" could be used as a normal partition or on live CD, but for this experiment, we'll run it with [User Mode Linux][7]. ## 1- Initialize a root_fs with at least 150 MB 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 # we create this link to simplify config --prefix of emacs cp -a /dev dev # we boldly copy the whole /dev mkdir etc sbin tmp # some other directories not installed by emacs cat >etc/fstab <.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--------------------- Of course, quite a number of syscalls are missing from emacs (not available as elisp primitives), so as it is, it would be hard enough to do EVERYTHING with emacs, but this is a starting point. Another, more realistic, alternative would be to use a Common-Lisp implementation with a FFI and portable Hemlock. # Emacs as shell Emacs can easily be used as shell: echo /usr/bin/emacs >> /etc/shells chsh -s /usr/bin/emacs GOODUSER echo '(setenv "SHELL" "/bin/bash")' >> ~GOODUSER/.emacs # in case the user wants to use M-x shell # [ I use rather: (setenv "SHELL" "/usr/bin/clisp") ] echo '(eshell)' >> ~GOODUSER/.emacs # to launch eshell automatically. # One could use: (dired default-directory) instead... su - GOODUSER # Hosanna! * * * | [Contents][1] | [Home][2] | [Previous][3] | [Up][4] | [Next][5] | * * * * * * ` | [Mirror on informatimago.com][8] | [Mirror on free.fr][9] | ` ![Valid HTML 4.01!][10] [1]: http://www.informatimago.com/toc.html [2]: http://www.informatimago.com/index.html [3]: http://www.informatimago.com/chrooted-ssh-cvs.html [4]: http://www.informatimago.com/develop/sms/index.html [5]: http://www.informatimago.com/develop/abalone/index.html [6]: http://www.informatimago.com#shell [7]: http://user-mode-linux.sourceforge.net [8]: http://www.informatimago.com//linux/emacs-on-user-mode-linux.html [9]: http://informatimago.free.fr/i//linux/emacs-on-user-mode-linux.html [10]: http://www.w3.org/Icons/valid-html401