Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mk authored and proger committed May 2, 2014
0 parents commit e2084f8
Show file tree
Hide file tree
Showing 701 changed files with 338,360 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.o
*.beam
/Makefile
/Config.mk
*.la
*.lo
/core/include/xen
/dist
ling-*.tag.gz
21 changes: 21 additions & 0 deletions DOCKER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

# Building with Docker

To start building your own images that contain your code, you
need to build `railing` -- a builder for openling images.

Prerequisites: [docker](http://www.docker.io)

* build the image that contains all build dependencies for openling:

```sh
% cd deps && docker build -t openling-env .
```

* build the image that contains the openling binary and railing
(this also builds an empty image in `/tmp`):

```sh
% docker build -t openling .
```

5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM openling-env
RUN mkdir -p /usr/src/openling
ADD . /usr/src/openling
RUN (cd /usr/src/openling && ./configure --with-xen=/usr/src/xen-4.4.0 --with-nettle=/usr/local/lib && make install)
RUN (cd /tmp; touch railing.config; railing image)
33 changes: 33 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

Prerequisites
-------------

To build LING from sources, the following prerequisites must be met:

1. Erlang/OTP

The installed version of Erlang/OTP must be R16B01. It means that it must be
build from sources available at http://erlang.org.

2. uClibc

The version known to work is 0.9.33.2. Other versions must work too. LING
requires a static version of the library. Ubuntu and, possibly, other
distributions do not include the static version.

When building uClibc from source, you can use lib/uClibc_config as the
configuration file.

3. Nettle

LING uses the Nettle library for cryptographic primitives. The version known to
work is 4.7.1. The static version of the library is required. It may or may not
be available as a binary package. To build from sources is always an option.

Build
-----

./configure
make
make install

49 changes: 49 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

.PHONY: default install dist bc core apps railing

include Config.mk

HEADERS := embed.h heap.h term.h nalloc.h

default: bc core apps railing

bc:
make -C bc

core:
make -C core

apps:
make -C apps

railing:
make -C railing

install: default
install -d $(LING_ROOT)/core/include $(LING_ROOT)/bc
install -d $(BIN_DIR)
install core/vmling.o $(LING_ROOT)/core
install core/ling.lds $(LING_ROOT)/core
install $(addprefix core/include/,$(HEADERS)) $(LING_ROOT)/core/include
install bc/*.beam $(LING_ROOT)/bc
install railing/railing $(BIN_DIR)
cp -R apps $(LING_ROOT)

DIST_LING_ROOT := dist
DIST_BING_DIR := $(DIST_LING_ROOT)/bin
DIST_TAR_BALL := ling-$(LING_VER).tar.gz

dist: bc core apps railing-dist $(DIST_TAR_BALL)
install -d $(DIST_LING_ROOT)/core/include $(DIST_LING_ROOT)/bc
install -d $(DIST_BIN_DIR)
install core/vmling.o $(DIST_LING_ROOT)/core
install core/ling.lds $(DIST_LING_ROOT)/core
install $(addprefix core/include/,$(HEADERS)) $(DIST_LING_ROOT)/core/include
install bc/*.beam $(DIST_LING_ROOT)/bc
install railing/railing $(DIST_BIN_DIR)
cp -R apps $(DIST_LING_ROOT)
tar czf $(DIST_TAR_BALL) dist

railing-dist:
make -C railing dist

73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
## LING: Erlang on Xen

Wikipedia: -ling, an English diminutive suffix

### How to get started?

The easy way is to use pre-built binaries:

1. Grab the archive named ling-[version].tar.gz.

1. Extract it locally. This creates directory <path>/ling.

1. Go to your Erlang project directory and run:

```
<path>/ling/bin/railing image dconf
```

1. This creates vmling, the Xen image file and domain\_config, the Xen domain
configuration file.

1. Launch the Xen domain and get the familiar Erlang shell:

```
xl create -c domain_config
```

### Building from sources

The recommended way to build LING from sources is to use a Docker container with
the right environment already set up for you. See DOCKER.md for details.

If you are not easily daunted, then you may try to build everything yourself.
See INSTALL for instructions.

### Creating LING images

To create LING-based images for your Erlang projects you need a utility called
_railing_. Railing is in a way similar to reltool. The typical invocation of
railing is:

railing image

This instructs railing to read railing.config and perform all steps necessary to
build an image named vmling.

To launch a Xen image you also need a domain configuration file. You may start
with a skeleton domain\_config file created as follows:

railing dconf

### railing.config

The railing.config contains a series of options represented as Erlang terms. The
following options are recongized:

{import,<path>}.

The option imports files referred to by &lt;path&gt; to the image. They become
accessible inside the VM. The option can be repeated multiple times. Example:
`{import,"priv/*/*"}`.

{import_lib,<std_app>}.

The option imports a standard library from the installed Erlang/OTP. Example:
`{import_lib,crypto}`. stdlib and kernel applications are imported
automatically. The option can also contain a list of libraries to import.

{build_config,<config>}}.

The option sets the build configuration for the image. Currently, the only
recognized configuration is 'fastest'.

27 changes: 27 additions & 0 deletions apps/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

.PHONY: default

include ../Config.mk

STDLIB_BEAMS := $(patsubst stdlib/src/%.erl,stdlib/ebin/%.beam,$(wildcard stdlib/src/*.erl))
KERNEL_BEAMS := $(patsubst kernel/src/%.erl,kernel/ebin/%.beam,$(wildcard kernel/src/*.erl))
CRYPTO_BEAMS := $(patsubst crypto/src/%.erl,crypto/ebin/%.beam,$(wildcard crypto/src/*.erl))
OS_MON_BEAMS := $(patsubst os_mon/src/%.erl,os_mon/ebin/%.beam,$(wildcard os_mon/src/*.erl))

default: $(STDLIB_BEAMS) $(KERNEL_BEAMS) $(CRYPTO_BEAMS) $(OS_MON_BEAMS)

$(STDLIB_BEAMS): stdlib/ebin/%.beam: stdlib/src/%.erl
erlc -o stdlib/ebin $<

kernel/src/ling_%.erl: ../code/ling_%.erl
cp $< $@

$(KERNEL_BEAMS): kernel/ebin/%.beam: kernel/src/%.erl
erlc -o kernel/ebin $<

$(CRYPTO_BEAMS): crypto/ebin/%.beam: crypto/src/%.erl
erlc -o crypto/ebin $<

$(OS_MON_BEAMS): os_mon/ebin/%.beam: os_mon/src/%.erl
erlc -o os_mon/ebin $<

6 changes: 6 additions & 0 deletions apps/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

Modified of rewritten portions of Erlang/OTP.

These directories are embedded into the image and mounted on top of standard
directories to replace implementations of same-name moduels.

Binary file added apps/crypto/ebin/crypto.ling
Binary file not shown.
Loading

0 comments on commit e2084f8

Please sign in to comment.