Skip to content

Commit 6a7b69c

Browse files
committed
updated to use latest IncludeOS version
1 parent f859b0b commit 6a7b69c

File tree

5 files changed

+23
-25
lines changed

5 files changed

+23
-25
lines changed

containers/compilers/includeos/cpp/Dockerfile.common

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ MAINTAINER includeos.org
33
RUN \
44
apt-get update && \
55
apt-get install -y bc git lsb-release sudo
6-
RUN useradd -m includeos && echo "includeos:includeos" | chpasswd && adduser includeos sudo
7-
RUN git clone https://github.com/hioa-cs/IncludeOS.git
8-
WORKDIR IncludeOS
9-
RUN /bin/bash install.sh
6+
RUN cd ~ && pwd && \
7+
git clone https://github.com/hioa-cs/IncludeOS.git && \
8+
cd IncludeOS && \
9+
git checkout 8dfa8b661355fd79b68ae2396d8df99c07f7c9e3 && \
10+
git fetch --tags && \
11+
/bin/bash ./install.sh

containers/compilers/includeos/cpp/Dockerfile.hw

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM projectunik/compilers-includeos-cpp-common:df9c830467f8b120
1+
FROM projectunik/compilers-includeos-cpp-common:25a238e8a72a6388
22
MAINTAINER includeos.org
33
VOLUME /opt/code
44
WORKDIR /opt/code

containers/versions.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"compilers-rump-python3-xen": "a1088c9cef821113",
1717
"compilers-rump-base-xen": "e8117ef5dddcdabe",
1818
"compilers-rump-base-hw": "d6f5c541f38f74bd",
19-
"compilers-includeos-cpp-common": "df9c830467f8b120",
20-
"compilers-includeos-cpp-hw": "7f19d78debeb0cc1",
19+
"compilers-includeos-cpp-common": "25a238e8a72a6388",
20+
"compilers-includeos-cpp-hw": "d42aa69e37ec6059",
2121
"rump-debugger-qemu": "49f1796b79f46203",
2222
"compilers-rump-base-common": "d16776a7c3dd168a",
2323
"image-creator": "fc2512fd8b56ad35",

docs/compilers/includeos.md

-2
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,3 @@ UniK uses [IncludeOS](http://www.includeos.org/) as a platform for compiling C++
55
You can also see an [example here](https://github.com/includeos/unik_test_service)
66

77
Your application code will be called from ```Service::start()``` in `service.cpp`
8-
9-
Note the line `unik::register_instance();` in [service.cpp#L41](https://github.com/includeos/unik_test_service/blob/master/service.cpp#L41): this line (and the imported file `#include <unik>`) are required for registering instances of your application to UniK. Without this, UniK will be unable to determine and display IPs of your instances (they will run otherwise normally).

docs/getting_started_cpp.md

+14-16
Original file line numberDiff line numberDiff line change
@@ -71,26 +71,21 @@ Ensure that each of the following are installed
7171

7272
```cpp
7373
#include <os>
74-
#include "unik_register_instance.hpp"
74+
#include <net/inet4>
7575
7676
constexpr int port {8080};
77-
std::unique_ptr<net::Inet4<VirtioNet>> inet;
7877
79-
void Service::start() {
78+
void Service::start(const std::string&) {
8079
using namespace std::string_literals;
81-
auto& eth0 = hw::Dev::eth<0, VirtioNet>();
82-
inet = std::make_unique<net::Inet4<VirtioNet>>(eth0);
83-
unik::register_instance();
84-
85-
auto& server = inet->tcp().bind(port);
86-
server.onAccept([] (auto conn) -> bool {
87-
return true; // allow all connections
88-
})
89-
.onConnect([] (auto conn) {
80+
81+
auto& server = net::Inet4::stack().tcp().bind(port);
82+
server.on_connect([] (auto conn) {
83+
conn->on_read(1024, [conn] (auto buf, size_t n) {
9084
auto response {"My first unikernel!\n"s};
91-
conn->write(response.data(), response.size());
85+
conn->write(response);
9286
conn->close();
9387
});
88+
});
9489
}
9590
```
9691

@@ -107,9 +102,14 @@ Ensure that each of the following are installed
107102
# Your disk image
108103
DISK=
109104
105+
# Add networking driver
106+
DRIVERS=virtionet
107+
110108
# Your own include-path
111109
LOCAL_INCLUDES=
112110
111+
PLATFORM=unik
112+
113113
# IncludeOS location
114114
ifndef INCLUDEOS_INSTALL
115115
INCLUDEOS_INSTALL=$(HOME)/IncludeOS_install
@@ -119,9 +119,7 @@ Ensure that each of the following are installed
119119
include $(INCLUDEOS_INSTALL)/Makeseed
120120
```
121121

122-
3. (In the very near future, this step will not be necessary, but since you are an early adopter, you will have to add an extra file. [Download the file from GitHub here](https://gist.githubusercontent.com/ingve/ae745418261c8871edf52e8dbdb29099/raw/86783f194f5b31556d242127d18f69b30b6c8c93/unik_register_instance.hpp) and add it to the same folder as `service.cpp`.)
123-
124-
4. Great! Now we're ready to compile this code to a unikernel.
122+
3. Great! Now we're ready to compile this code to a unikernel.
125123

126124
---
127125

0 commit comments

Comments
 (0)