Geek magazine hacker daily blog

4 years, 11 months ago
FAQ: What is OS Inferno and why it is necessary?

Information in the previous post became outdated almost for 4 years, and I was asked it to update. Also asked not to mix in one post installation with setup therefore there will be only an installation, and setup is inferno described in a separate post. Update: The description of installation for Windows is updated in June, 2014.

So, we will set the distributed Inferno OS. On the official site there are installation instructions, but they are not absolutely correct and too became outdated a little. Inferno can work in two modes — native (on naked iron or in qemu/etc. as all normal OS) and hosted (as the normal application under * NIX/Win). Installation instructions of native Inferno can be found in the Russian Vicki. In addition there are also other options — for example, the Inferno installation on Android (English). Personally I do not see sense in use of native Inferno on normal computers therefore I will describe the hosted Inferno installation under Gentoo, Ubuntu, FreeBSD, MacOSX and Windows.

Contents



Features of installation


OS Inferno versions

Theoretically, the last official version "Fourth Edition" appeared approximately in 2004. The current version is in Mercurial repositories on Google Code, and calls itself by "New Edition". Practically, to use something except the current version from a repository there is no sense — it is absolutely stable, and was always stable. We will also put it.

One - or many user style of installation

Inferno can be set obshchesistemno (e.g. in /usr/inferno/), that all users could use it. Inferno supports everything that for this purpose is required — work with the rights of users, separate house directories, etc. On the other hand, it is inferno possible to put just in the house directory (e.g. in ~/inferno/), that it is even more convenient. I pereuslozhnit last article describing at the same time both methods a little, but now decided that it will be simpler to describe only single-user option of installation. If someone from readers of this article has a server on which it is more than one user inferno — it hardly needs my installation instructions inferno. ;-) So we will put in ~/inferno/ on * NIX systems, and in C:\inferno\ on Windows.

32/64 bits

OS Inferno is 32-bit. Therefore support of 32-bit applications in these OS is necessary for installation and start in 64-bit OS. Unfortunately, under 64-bit FreeBSD-9.0 I did not manage to start inferno.

Hardened/PaX/SeLinux/etc.

Inferno executes a code in the virtual computer, plus supports JIT therefore it has same problems with various protection as at Java, etc. In the previous article I paid to this subject more attention if there are questions — look there.

Time and place

Set inferno borrows about 200MB. And here on installation of compilers about more than 3 gigabytes can be required (for example on Xcode or the Visual Studio). It is compiled inferno literally in a couple of minutes on average system.

Arrangement

At installation inferno in the house directory it must be kept in mind what does not love special characters inferno in names of files/directories so if the way to the house directory contains, for example, a space — there can be difficulties which are not considered by me.

Installation


In (Hardened) of Gentoo Linux 32/64-bit everything is trivial — there is a packet which puts inferno obshchesistemno in /usr/inferno/:
layman -a powerman
emerge inferno

And we will deal with other OSes now.

Mercurial, compilers and all everything everything

… Ubuntu 12.04 32-bit

sudo apt-get install -y mercurial
sudo apt-get install -y libxext-dev

… Ubuntu 12.04 64-bit

sudo apt-get install -y mercurial
sudo apt-get install -y libc6-dev-i386
sudo apt-get install -y libxext-dev:i386

… FreeBSD 8.0 32-bit

pkg_add -r mercurial

… Mac OS X 10.6.8 Snow Leopard 32-bit

I already set Xcode (3.2.2) and Mercurial (1.7.1).

… Mac OS X 10.7.4 Lion 64-bit

We set Xcode (4.3.2) through App Store.
We start Xcode, we go to the Xcode — Preferences — Downloads menu and we click Install for Command Line Tools.
We go on mercurial.berkwood.com and we swing/put the current version (Mercurial 2.2.2 for OS X 10.7).

… Windows (XP 32-bit, Seven 32-bit, Seven 64-bit)

We go on mercurial.selenic.com/downloads and we swing/put the current version (3.0.1).

And here with the compiler there are options. The arising option with the Visual Studio Express installation will manage in more than 3 gigabytes on the screw. Alternative option — to deliver to WinSDK — will cost approximately 800 megabytes. I will describe both options, select.

First option. We go on www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express and we swing/put/update (on the Russian custom — three times :) differently not all updates will be established) "the Visual C ++ 2010 Express".

Second option. At first we go on go.microsoft.com/fwlink/?LinkId=187668 and we swing/put complete "a. net Framework 4". Then we go on www.microsoft.com/en-us/download/details.aspx?id=8279 and we swing/put "Windows SDK 7.1". At installation it is enough to be limited to these points:
#    Windows Native Code Development:
#          Windows Headers and Libraries:
#            [X] Windows Headers
#            [X] x86 Libraries
#      [X] Visual C++ Compilers
#    Redistributable Packages:
#      [X] Microsoft Visual C++ 2010
(In 2014 SDK at me I refused to be established so far did not bear all the Visual C ++ 2010 Redistributable — they appeared for it too new version.) Then we update too. Actually it is not obligatory to update, probably, just already became a habit.

We download and update source codes inferno

In spite of the fact that on the official site for Windows the separate archive, and for poppy separate binarnik is offered, we do not need all this, and is even harmful (the archive for Windows is not updated normally from a repository — there are conflicts). So under all OS we will be established from inferno-20100120.tgz. Sense to use this archive instead of simple cloning of a repository that the archive included some files (generally fonts) which the license prohibits to spread on Google Code therefore they are not in a repository.

… * NIX

wget http://www.vitanuova.com/dist/4e/inferno-20100120.tgz
tar xzf inferno-20100120.tgz
cd inferno/
hg pull -uv

… Win

We download www.vitanuova.com/dist/4e/inferno.zip (it is recommended on the website, but it is possible to take and .tgz — at me without problems gather both that and another).
We unpack in C:\inferno\. I do not know that it is necessary for unpacking of .tgz under Windows — I had Far and 7Zip, unpacked Far-ohm.
We start cmd.
cd \inferno
hg pull -uv

# если получаем конфликт вроде:
merging libinterp/keyring.h
warning: conflicts during merge.
merging libinterp/keyring.h incomplete! (edit conflicts, then use 'hg resolve --mark')
merging libinterp/runt.h
warning: conflicts during merge.
merging libinterp/runt.h incomplete! (edit conflicts, then use 'hg resolve --mark')
3038 files updated, 0 files merged, 106 files removed, 2 files unresolved
use 'hg resolve' to retry unresolved file merges
# то просто восстанавливаем последнюю версию:
hg revert -r tip libinterp\keyring.h
hg revert -r tip libinterp\runt.h
We leave from cmd.

We configure variable environments

The only really necessary variable is PATH. In EMU default arguments for start inferno are set, it is necessary just for convenience. As for INFERNO_ROOT that inferno about it does not know at all, this variable is necessary to us just for convenience. In addition to installation of variables in the current session, we will register them in starting scripts.

… Ubuntu

export INFERNO_ROOT=$(pwd)
export PATH=$INFERNO_ROOT/Linux/386/bin:$PATH
export EMU=-r$INFERNO_ROOT
echo "export INFERNO_ROOT=$INFERNO_ROOT"                   >> ~/.bashrc
echo "export PATH=\$INFERNO_ROOT/Linux/386/bin:\$PATH"    >> ~/.bashrc
echo "export EMU=-r\$INFERNO_ROOT"                         >> ~/.bashrc

… FreeBSD

export INFERNO_ROOT=$(pwd)
export PATH=$INFERNO_ROOT/FreeBSD/386/bin:$PATH
export EMU=-r$INFERNO_ROOT
echo "export INFERNO_ROOT=$INFERNO_ROOT"                   >> ~/.bash_profile
echo "export PATH=\$INFERNO_ROOT/FreeBSD/386/bin:\$PATH"  >> ~/.bash_profile
echo "export EMU=-r\$INFERNO_ROOT"                         >> ~/.bash_profile

… Mac OS X

export INFERNO_ROOT=$(pwd)
export PATH=$INFERNO_ROOT/MacOSX/386/bin:$PATH
export EMU=-r$INFERNO_ROOT
echo "export INFERNO_ROOT=$INFERNO_ROOT"                   >> ~/.bash_profile
echo "export PATH=\$INFERNO_ROOT/MacOSX/386/bin:\$PATH"   >> ~/.bash_profile
echo "export EMU=-r\$INFERNO_ROOT"                         >> ~/.bash_profile

… Win

We go in: A control bar-> System-> Additional parameters of system (in XP just "In addition")-> Variable environments.
We add to the end of Path: ;C:\inferno\Nt\386\bin
We create a new variable: INFERNO_ROOT: C:\inferno
We create a new variable: EMU: -rC:\inferno

We configure assembly settings

It is possible to edit the file mkconfig manually in all OS, but for simplicity I where it is possible, will give the commands which are automatically changing a config.

… Ubuntu

perl -i -pe 's/^ROOT=.*/ROOT=$ENV{INFERNO_ROOT}/m'  mkconfig
perl -i -pe 's/^SYSHOST=.*/SYSHOST=Linux/m'         mkconfig
perl -i -pe 's/^OBJTYPE=.*/OBJTYPE=386/m'           mkconfig

In a linukha inferno supports IPv6. Moreover, this IPv6 is used by default. You suit it or not — solve. I personally switch off it:
perl -i -pe 's/ipif6/ipif/g' emu/Linux/emu emu/Linux/emu-g

… FreeBSD

perl -i -pe 's/^ROOT=.*/ROOT=$ENV{INFERNO_ROOT}/m'  mkconfig
perl -i -pe 's/^SYSHOST=.*/SYSHOST=FreeBSD/m'       mkconfig
perl -i -pe 's/^OBJTYPE=.*/OBJTYPE=386/m'           mkconfig

… Mac OS X

perl -i -pe 's/^ROOT=.*/ROOT=$ENV{INFERNO_ROOT}/m'  mkconfig
perl -i -pe 's/^SYSHOST=.*/SYSHOST=MacOSX/m'        mkconfig
perl -i -pe 's/^OBJTYPE=.*/OBJTYPE=386/m'           mkconfig

… Win

We edit mkconfig:
ROOT=c:/inferno
SYSHOST=Nt
OBJTYPE=386

Assembly

… * NIX

sh makemk.sh
mk nuke
mk install          # пропустите эту команду на серверах без X-ов и GUI
mk CONF=emu-g install

… Win Seven 64-bit

If you put WinSDK, then it is necessary to make a new label on "Windows SDK 7.1 Command Prompt", to come into its properties and to add parameter /x86 — that it turned out here so:
C:\Windows\System32\cmd.exe /E:ON /V:ON /T:0E /K "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86
If you put the Visual C ++ 2010, then I do not know how to start the 32-bit compiler (but perhaps it is done the same approximately).
What to do is farther — it is described in the following item for all versions of Windows.

… Win

We start "Windows SDK 7.1 Command Prompt" (well or "Visual Studio Command Prompt (2010)" — depending on what you set).
cd \inferno
mk nuke
mk install

Start


Actually, all this. Now you can start inferno command emu or emu-g (the second differs in what does not support a graphics mode, but will work at servers without X-ov and it is very convenient for start of different network services). The graphical environment can be seen having started command in emu wm/wm:
$ emu
; wm/wm

OS Inferno New Edition installation (update)

Useful links


My description can be interesting to read those who will not stop on installation of system Limbo in Russian, the current version of man-documentation in html, to look on mine inferno at modules and applications and big archive of applications under inferno from mjl. English-speaking community lives in a maillist-a and on IRC #inferno in the freenode network.

P.S.


In advance I answer a traditional question "to whom and why all this is necessary". In hosted the mode it is inferno used approximately the same as Erlang, Java or Go — for applications programming in a cool programming language which are executed in very pleasant environment which simply and comfortably to write and which work at least not worse, than similar applications at other languages. Unlike Erlang in Inferno there are no many things "from a box" (but they without problems are implemented by handles if necessary) but it is the system of general purpose suitable for a solution of any tasks (well, except low-level drivers, etc., as usual). Unlike Java we have full-fledged easy threads and an opportunity to write simple multithreaded applications in CSP style. Unlike Go we have the virtualized and simplified environment identical under any OS. Generally, inferno really excellent system ready to use in the prodakena on commercial projects (we exactly there also use it) and deserves long ago much bigger popularity, than has.

This article is a translation of the original post at geektimes.ru/post/145922/
If you have any questions regarding the material covered in the article above, please, contact the original author of the post.
If you have any complaints about this article or you want this article to be deleted, please, drop an email here: sysmagazine.com@gmail.com.

We believe that the knowledge, which is available at the most popular Russian IT blog geektimes.ru, should be accessed by everyone, even though it is poorly translated.
Shared knowledge makes the world better.
Best wishes.