Skip to content

Commit 1850d74

Browse files
authored
Merge pull request #1970 from alfred-bratterud/0.13-release
0.13 release
2 parents 367a1dc + e34facc commit 1850d74

File tree

801 files changed

+24179
-14329
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

801 files changed

+24179
-14329
lines changed

.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build_*
2+
IncludeOS_install/
3+
**/build

.gitignore

+16
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@
1717
*.img
1818
*.img.*
1919
*.gz
20+
*.tar
21+
*nacl.txt
2022
.DS_Store
2123
nbproject
2224
dummy.disk
25+
callgraph.svg
26+
massif.out.*
2327

2428
!Dockerfile
2529

@@ -35,3 +39,15 @@ test/**/*.log
3539
CMakeFiles*
3640
CMakeCache*
3741
cmake_install.cmake
42+
43+
# Name of installation folder
44+
IncludeOS_install
45+
46+
# Vim
47+
*.swp
48+
49+
#CLion
50+
.idea/
51+
52+
# Starbase disk file
53+
lib/uplink/starbase/disk

CMakeLists.txt

+33-31
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ set(SCRIPTS ${CMAKE_INSTALL_PREFIX}/includeos/scripts)
3232
set(CPP_VERSION c++17)
3333

3434
# create OS version string from git describe (used in CXX flags)
35-
execute_process(COMMAND git describe --dirty
35+
execute_process(COMMAND git describe --tags --dirty
3636
WORKING_DIRECTORY ${INCLUDEOS_ROOT}
3737
OUTPUT_VARIABLE OS_VERSION)
3838
string(STRIP ${OS_VERSION} OS_VERSION)
@@ -48,28 +48,27 @@ else()
4848
set(DEFAULT_VM "vm.cpu_feat.json") # vmrunner
4949
endif(cpu_feat_vanilla)
5050

51-
option(threading "Compile with SMP/threading support" OFF)
51+
option(smp "Compile with SMP (multiprocessing)" OFF)
5252

5353
option(silent "Disable most output during OS boot" OFF)
5454

5555
option (undefined_san "Enable undefined-behavior sanitizer" OFF)
56+
option (thin_lto "Enable the Thin LTO plugin" OFF)
57+
option (full_lto "Enable full LTO (compatibility)" OFF)
5658

5759
# create random hex string as stack protector canary
5860
string(RANDOM LENGTH 16 ALPHABET 0123456789ABCDEF STACK_PROTECTOR_VALUE)
5961

60-
set(CAPABS "${CAPABS} -fstack-protector-strong -D_STACK_GUARD_VALUE_=0x${STACK_PROTECTOR_VALUE}")
62+
set(CAPABS "${CAPABS} -g -fstack-protector-strong -D_STACK_GUARD_VALUE_=0x${STACK_PROTECTOR_VALUE}")
6163

6264
# Various global defines
6365
# * NO_DEBUG disables output from the debug macro
6466
# * OS_TERMINATE_ON_CONTRACT_VIOLATION provides classic assert-like output from Expects / Ensures
65-
set(CAPABS "${CAPABS} -DNO_DEBUG=1 -DOS_TERMINATE_ON_CONTRACT_VIOLATION ")
66-
67-
set(WARNS "-Wall -Wextra")
67+
set(CAPABS "${CAPABS} -DNO_DEBUG=1 -DOS_TERMINATE_ON_CONTRACT_VIOLATION -D_LIBCPP_HAS_MUSL_LIBC -D_GNU_SOURCE -D__includeos__")
68+
set(WARNS "-Wall -Wextra") # -Werror
6869

6970
# configure options
70-
option(debug "Build with debugging symbols (OBS: Dramatically increases binary size)" OFF)
71-
option(debug-info "Build like \"all\" but with debugging output (i.e. the 'debug'-macro) enabled" OFF)
72-
option(debug-all "Build with debugging symbols + debugging output, i.e. \"debug\" + \"debug-info\"" OFF)
71+
option(debug "Build with no optimizations" OFF)
7372
option(minimal "Build for minimal size" OFF)
7473
option(stripped "reduce size" OFF)
7574

@@ -96,15 +95,6 @@ if(minimal)
9695
set(OPTIMIZE "-Os")
9796
endif(minimal)
9897

99-
# Set debug options
100-
if(debug OR debug-all)
101-
set(CAPABS "${CAPABS} -ggdb3 -DGSL_THROW_ON_CONTRACT_VIOLATION")
102-
endif(debug OR debug-all)
103-
104-
if(debug-info OR debug-all)
105-
set(CAPABS "${CAPABS} -UNO_DEBUG")
106-
endif(debug-info OR debug-all)
107-
10898
if(silent)
10999
set(CAPABS "${CAPABS} -DNO-INFO=1")
110100
endif(silent)
@@ -116,6 +106,11 @@ set(CAPABS "${CAPABS} ${OPTIMIZE}")
116106
if (undefined_san)
117107
set(CAPABS "${CAPABS} -fsanitize=undefined -fno-sanitize=vptr")
118108
endif()
109+
if (thin_lto)
110+
set(CAPABS "${CAPABS} -flto=thin")
111+
elseif(full_lto)
112+
set(CAPABS "${CAPABS} -flto=full")
113+
endif()
119114

120115
# object format needs to be set BEFORE enabling ASM
121116
# see: https://cmake.org/Bug/bug_relationship_graph.php?bug_id=13166
@@ -131,21 +126,15 @@ endif()
131126

132127
enable_language(ASM_NASM)
133128

134-
135-
if (NOT threading)
136-
add_definitions(-D_LIBCPP_HAS_NO_THREADS)
137-
endif()
138-
139-
140129
# initialize C and C++ compiler flags
141130
if (CMAKE_COMPILER_IS_GNUCC)
142131
# gcc/g++ settings
143-
set(CMAKE_CXX_FLAGS "-std=${CPP_VERSION} -MMD ${CAPABS} ${WARNS} -Wno-frame-address -nostdlib -fno-omit-frame-pointer -c ${LIBCPP_THREADING} -DOS_VERSION=\\\"${OS_VERSION}\\\"")
144-
set(CMAKE_C_FLAGS " -MMD ${CAPABS} ${WARNS} -nostdlib -fno-omit-frame-pointer -c -DOS_VERSION=\"\"${OS_VERSION}\"\"")
132+
set(CMAKE_CXX_FLAGS "${CAPABS} -std=${CPP_VERSION} ${WARNS} -Wno-frame-address -nostdlib -fno-omit-frame-pointer -c")
133+
set(CMAKE_C_FLAGS " ${CAPABS} ${WARNS} -nostdlib -fno-omit-frame-pointer -c")
145134
else()
146135
# these kinda work with llvm
147-
set(CMAKE_CXX_FLAGS "-std=${CPP_VERSION} -MMD ${CAPABS} ${WARNS} -nostdlib -nostdlibinc -fno-omit-frame-pointer -c ${LIBCPP_THREADING} -DOS_VERSION=\\\"${OS_VERSION}\\\"")
148-
set(CMAKE_C_FLAGS "-MMD ${CAPABS} ${WARNS} -nostdlib -nostdlibinc -fno-omit-frame-pointer -c -DOS_VERSION=\"\"${OS_VERSION}\"\"")
136+
set(CMAKE_CXX_FLAGS "${CAPABS} -std=${CPP_VERSION} ${WARNS} -nostdlib -nostdlibinc -fno-omit-frame-pointer -c")
137+
set(CMAKE_C_FLAGS "${CAPABS} ${WARNS} -nostdlib -nostdlibinc -fno-omit-frame-pointer -c")
149138
endif()
150139

151140
# either download or cross-compile needed libraries
@@ -179,7 +168,9 @@ if(vmbuild)
179168
SOURCE_DIR ${INCLUDEOS_ROOT}/vmbuild # Where is project located
180169
BINARY_DIR ${INCLUDEOS_ROOT}/vmbuild/build
181170
INSTALL_DIR ${BIN} # Where to install
182-
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> # Pass installation folder
171+
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
172+
-DINCLUDE_PATH=${CMAKE_INSTALL_PREFIX} # Pass installation folder
173+
DEPENDS PrecompiledLibraries
183174
)
184175
endif(vmbuild)
185176

@@ -201,8 +192,14 @@ if(examples)
201192
endif(examples)
202193

203194
option(tests "Build unit tests in /test and install lest test framework" OFF)
204-
if(tests)
195+
option(lest "Install lest unittest headers" OFF)
196+
197+
if (lest OR tests)
205198
init_submodule(test/lest)
199+
install(DIRECTORY test/lest/include/lest DESTINATION ${CMAKE_INSTALL_PREFIX}/includeos/include)
200+
endif()
201+
202+
if(tests)
206203
enable_testing()
207204
ExternalProject_Add(unittests
208205
PREFIX unittests
@@ -272,8 +269,13 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/elf-toolchain.cmake DESTINATION
272269
# Install seed
273270
install(DIRECTORY seed/ DESTINATION includeos/seed)
274271

275-
# Install boot util
272+
# Install executable scripts
276273
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/etc/boot DESTINATION bin)
274+
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/etc/linux/lxp-run DESTINATION bin)
275+
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/etc/linux/lxp-callgraph DESTINATION bin)
276+
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/etc/linux/lxp-debug DESTINATION bin)
277+
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/etc/linux/lxp-gprof DESTINATION bin)
278+
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/etc/linux/lxp-pgo DESTINATION bin)
277279

278280
# Install scripts
279281
install(PROGRAMS

CONTRIBUTE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
You're very welcome to [clone, edit and send pull-request](https://help.github.com/articles/using-pull-requests).
44

5-
**Please read the contribution gudelines on the wiki: [Conributing to IncludeOS](https://github.com/hioa-cs/IncludeOS/wiki/Contributing-to-IncludeOS)**
5+
**Please read the contribution guidelines: [Contributing to IncludeOS](http://includeos.readthedocs.io/en/latest/Contributing-to-IncludeOS.html)**
66

77
## Thank you!

Dockerfile

+93-18
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,106 @@
1-
FROM ubuntu:xenial
1+
FROM ubuntu:xenial as base
2+
3+
RUN apt-get update && apt-get -y install \
4+
sudo \
5+
curl \
6+
locales \
7+
&& rm -rf /var/lib/apt/lists/*
8+
RUN locale-gen en_US.UTF-8
9+
ENV LANG=en_US.UTF-8 \
10+
LANGUAGE=en_US:en \
11+
LC_ALL=en_US.UTF-8
12+
13+
# Add fixuid to change permissions for bind-mounts. Set uid to same as host with -u <uid>:<guid>
14+
RUN addgroup --gid 1000 docker && \
15+
adduser --uid 1000 --ingroup docker --home /home/docker --shell /bin/sh --disabled-password --gecos "" docker && \
16+
usermod -aG sudo docker && \
17+
sed -i.bkp -e \
18+
's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL/g' \
19+
/etc/sudoers
20+
RUN USER=docker && \
21+
GROUP=docker && \
22+
curl -SsL https://github.com/boxboat/fixuid/releases/download/v0.3/fixuid-0.3-linux-amd64.tar.gz | tar -C /usr/local/bin -xzf - && \
23+
chown root:root /usr/local/bin/fixuid && \
24+
chmod 4755 /usr/local/bin/fixuid && \
25+
mkdir -p /etc/fixuid && \
26+
printf "user: $USER\ngroup: $GROUP\npaths:\n - /service\n" > /etc/fixuid/config.yml
27+
28+
ARG CUSTOM_TAG
29+
LABEL org.label-schema.schema-version="1.0" \
30+
org.label-schema.name="IncludeOS builder" \
31+
org.label-schema.vendor="IncludeOS" \
32+
org.label-schema.version=$CUSTOM_TAG \
33+
org.label-schema.vcs-url="https://github.com/hioa-cs/includeos"
34+
35+
RUN echo "LANG=C.UTF-8" > /etc/default/locale
36+
37+
#########################
38+
FROM base as source-build
239

340
RUN apt-get update && apt-get -y install \
441
git \
42+
lsb-release \
543
net-tools \
6-
sudo \
744
wget \
8-
&& rm -rf /var/lib/apt/lists/*
45+
&& rm -rf /var/lib/apt/lists/*
946

10-
RUN useradd --create-home -s /bin/bash ubuntu
11-
RUN adduser ubuntu sudo
12-
RUN echo -n 'ubuntu:ubuntu' | chpasswd
47+
RUN mkdir -p /root/IncludeOS
48+
WORKDIR /root/IncludeOS
49+
COPY . .
1350

14-
# Enable passwordless sudo for users under the "sudo" group
15-
RUN sed -i.bkp -e \
16-
's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL/g' \
17-
/etc/sudoers
51+
# Ability to specify custom tag that overwrites any existing tag. This will then match what IncludeOS reports itself.
52+
ARG CUSTOM_TAG
53+
RUN git describe --tags --dirty > /ios_version.txt
54+
RUN : ${CUSTOM_TAG:=$(git describe --tags)} && git tag -d $(git describe --tags); git tag $CUSTOM_TAG && git describe --tags --dirty > /custom_tag.txt
55+
56+
# Installation
57+
RUN ./install.sh -n
58+
59+
#############################
60+
FROM base as grubify
61+
62+
RUN apt-get update && apt-get -y install \
63+
dosfstools \
64+
grub-pc
1865

19-
USER ubuntu
66+
COPY --from=source-build /usr/local/includeos/scripts/grubify.sh /home/ubuntu/IncludeOS_install/includeos/scripts/grubify.sh
2067

21-
ADD . /home/ubuntu/IncludeOS
22-
WORKDIR /home/ubuntu/IncludeOS
68+
ENTRYPOINT ["fixuid", "/home/ubuntu/IncludeOS_install/includeos/scripts/grubify.sh"]
2369

24-
RUN sudo apt-get update && \
25-
sudo do_bridge="" ./etc/install_all_source.sh \
26-
&& sudo rm -rf /var/lib/apt/lists/*
70+
###########################
71+
FROM base as build
72+
73+
RUN apt-get update && apt-get -y install \
74+
git \
75+
clang-5.0 \
76+
cmake \
77+
nasm \
78+
python-pip \
79+
&& rm -rf /var/lib/apt/lists/* \
80+
&& pip install pystache antlr4-python2-runtime && \
81+
apt-get remove -y python-pip && \
82+
apt autoremove -y
83+
84+
ARG VCS_REF="Check file /ios_version.txt inside container"
85+
LABEL org.label-schema.description="Build a service using IncludeOS" \
86+
org.label-schema.vcs-ref=$VCS_REF \
87+
org.label-schema.docker.cmd="docker run -v $PWD:/service <container>"
2788

28-
VOLUME /service
2989
WORKDIR /service
3090

31-
CMD ./run.sh
91+
COPY --from=source-build /usr/local/includeos /usr/local/includeos/
92+
COPY --from=source-build /usr/local/bin/boot /usr/local/bin/boot
93+
COPY --from=source-build /root/IncludeOS/etc/install_dependencies_linux.sh /
94+
COPY --from=source-build /root/IncludeOS/etc/use_clang_version.sh /
95+
COPY --from=source-build /root/IncludeOS/lib/uplink/starbase /root/IncludeOS/lib/uplink/starbase/
96+
COPY --from=source-build /ios_version.txt /
97+
COPY --from=source-build /custom_tag.txt /
98+
COPY --from=source-build /root/IncludeOS/etc/docker_entrypoint.sh /entrypoint.sh
99+
ENTRYPOINT ["/entrypoint.sh"]
100+
101+
CMD mkdir -p build && \
102+
cd build && \
103+
cp $(find /usr/local/includeos -name chainloader) /service/build/chainloader && \
104+
echo "IncludeOS version:" $(cat /ios_version.txt) "tag:" $(cat /custom_tag.txt) && \
105+
cmake .. && \
106+
make

NaCl

Submodule NaCl updated 50 files

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ IncludeOS is free software, with "no warranties or restrictions of any kind".
2727
* **Extreme memory footprint**: A minimal bootable 64-bit web server, including operating system components and a anything needed from the C/C++ standard libraries is currently 2.5 MB.
2828
* **KVM, VirtualBox and VMWare support** with full virtualization, using [x86 hardware virtualization](https://en.wikipedia.org/wiki/X86_virtualization), available on most modern x86 CPUs. IncludeOS will run on any x86 hardware platform, even on a physical x86 computer, given appropriate drivers. Officially, we develop for- and test on [Linux KVM](http://www.linux-kvm.org/page/Main_Page), and VMWare [ESXi](https://www.vmware.com/products/esxi-and-esx.html)/[Fusion](https://www.vmware.com/products/fusion.html) which means that you can run your IncludeOS service on Linux, Microsoft Windows and macOS, as well as on cloud providers such as [Google Compute Engine](http://www.includeos.org/blog/2017/includeos-on-google-compute-engine.html), [OpenStack](https://www.openstack.org/) and VMWare [vcloud](https://www.vmware.com/products/vcloud-suite.html).
2929
* **Instant boot:** IncludeOS on Qemu/kvm boots in about 300ms but IBM Research has also integrated IncludeOS with [Solo5/uKVM](https://github.com/Solo5/solo5), providing boot times as low as 10 milliseconds.
30-
* **C++11/14 support**
31-
* Full C++11/14 language support with [clang](http://clang.llvm.org) v3.8 and later.
30+
* **Modern C++ support**
31+
* Full C++11/14/17 language support with [clang](http://clang.llvm.org) 5 and later.
3232
* Standard C++ library (STL) [libc++](http://libcxx.llvm.org) from [LLVM](http://llvm.org/).
3333
* Exceptions and stack unwinding (currently using [libgcc](https://gcc.gnu.org/onlinedocs/gccint/Libgcc.html)).
3434
* *Note:* Certain language features, such as threads and filestreams are currently missing backend support.
35-
* **Standard C library** using [newlib](https://sourceware.org/newlib/) from [Red Hat](http://www.redhat.com/).
35+
* **Standard C library** using [musl libc](http://www.musl-libc.org/).
3636
* **Virtio and vmxnet3 Network drivers** with DMA. [Virtio](https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=virtio) provides a highly efficient and widely supported I/O virtualization. vmxnet3 is the VMWare equivalent.
3737
* **A highly modular TCP/IP-stack**.
3838

@@ -42,11 +42,11 @@ A longer list of features and limitations can be found on our [documentation sit
4242

4343
### Set custom location and compiler
4444

45-
By default the project is installed to /usr/local/includeos.
45+
By default the project is installed to `/usr/local/includeos`.
4646

47-
However, it is recommended to choose a custom location as well as select the compiler we want clang to find. In this document we assume you install IncludeOS in your home directory, in the folder ~/includeos.
47+
However, it is recommended to choose a custom location as well as select the compiler we want clang to find. In this document we assume you install IncludeOS in your home directory, in the folder `~/includeos`.
4848

49-
To do this we can edit ~/.bash_profile (mac os) or ~/.bashrc (linux), adding these lines at the end of the file:
49+
To do this we can edit `~/.bash_profile` (mac os) or `~/.bashrc` (linux), adding these lines at the end of the file:
5050

5151
```
5252
export INCLUDEOS_PREFIX=~/includeos/

api/arch.hpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// -*-C++-*-
1+
// -*-C++-*-
22
// This file is a part of the IncludeOS unikernel - www.includeos.org
33
//
44
// Copyright 2017 Oslo and Akershus University College of Applied Sciences
@@ -31,19 +31,24 @@ extern void __arch_poweroff();
3131
extern void __arch_reboot();
3232
extern void __arch_enable_legacy_irq(uint8_t);
3333
extern void __arch_disable_legacy_irq(uint8_t);
34+
extern void __arch_system_deactivate();
3435

3536
extern void __arch_install_irq(uint8_t, void(*)());
3637
extern void __arch_subscribe_irq(uint8_t);
3738
extern void __arch_unsubscribe_irq(uint8_t);
3839
extern void __arch_preempt_forever(void(*)());
39-
40+
extern inline void __arch_read_memory_barrier() noexcept;
41+
extern inline void __arch_write_memory_barrier() noexcept;
4042
inline void __arch_hw_barrier() noexcept;
4143
inline void __sw_barrier() noexcept;
4244

4345
extern uint64_t __arch_system_time() noexcept;
4446
extern timespec __arch_wall_clock() noexcept;
4547
inline uint64_t __arch_cpu_cycles() noexcept;
4648

49+
inline void __arch_hw_barrier() noexcept {
50+
__sync_synchronize();
51+
}
4752

4853
inline void __sw_barrier() noexcept
4954
{

api/arch/i686.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#ifndef i686_ARCH_HPP
2020
#define i686_ARCH_HPP
2121

22-
#include <arch/x86.hpp>
22+
#define ARCH_x86
2323

2424
inline uint64_t __arch_cpu_cycles() noexcept {
2525
uint64_t ret;
@@ -28,4 +28,6 @@ inline uint64_t __arch_cpu_cycles() noexcept {
2828
}
2929

3030

31+
constexpr uintptr_t __arch_max_canonical_addr = 0xffffffff;
32+
3133
#endif

0 commit comments

Comments
 (0)