aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Carlsson <[email protected]>2018-05-23 11:35:31 +0200
committerRichard Carlsson <[email protected]>2018-05-23 13:31:18 +0200
commit6ee6d1903c4255cbea809129c8262d5863a94093 (patch)
tree253e38d96db5de4fabadb335044c9e07b84b5a0f
parent4534387fd15937fd3a7d646e9fa56ba2b62390da (diff)
downloadotp-6ee6d1903c4255cbea809129c8262d5863a94093.tar.gz
otp-6ee6d1903c4255cbea809129c8262d5863a94093.tar.bz2
otp-6ee6d1903c4255cbea809129c8262d5863a94093.zip
Add erl_init module
-rw-r--r--Makefile.in2
-rw-r--r--erts/emulator/Makefile.in1
-rw-r--r--erts/preloaded/src/Makefile1
-rw-r--r--erts/preloaded/src/erl_init.erl39
4 files changed, 42 insertions, 1 deletions
diff --git a/Makefile.in b/Makefile.in
index e75bcf7f10..bce26cc8b2 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -939,7 +939,7 @@ primary_bootstrap_copy:
# To remove modules left by the bootstrap building, but leave (restore)
# the modules in kernel which are needed for an emulator build
-KERNEL_PRELOAD = otp_ring0 init erl_prim_loader prim_inet prim_file zlib prim_zip erlang erts_code_purger
+KERNEL_PRELOAD = erl_init otp_ring0 init erl_prim_loader prim_inet prim_file zlib prim_zip erlang erts_code_purger
KERNEL_PRELOAD_BEAMS=$(KERNEL_PRELOAD:%=$(BOOTSTRAP_TOP)/lib/kernel/ebin/%.beam)
start_scripts:
diff --git a/erts/emulator/Makefile.in b/erts/emulator/Makefile.in
index 221cf84622..2101e4ffdd 100644
--- a/erts/emulator/Makefile.in
+++ b/erts/emulator/Makefile.in
@@ -633,6 +633,7 @@ GENERATE += $(TTF_DIR)/driver_tab.c
PRELOAD_BEAM = $(ERL_TOP)/erts/preloaded/ebin/otp_ring0.beam \
$(ERL_TOP)/erts/preloaded/ebin/erts_code_purger.beam \
+ $(ERL_TOP)/erts/preloaded/ebin/erl_init.beam \
$(ERL_TOP)/erts/preloaded/ebin/init.beam \
$(ERL_TOP)/erts/preloaded/ebin/prim_buffer.beam \
$(ERL_TOP)/erts/preloaded/ebin/prim_eval.beam \
diff --git a/erts/preloaded/src/Makefile b/erts/preloaded/src/Makefile
index 4333f6643a..17b9fa796b 100644
--- a/erts/preloaded/src/Makefile
+++ b/erts/preloaded/src/Makefile
@@ -42,6 +42,7 @@ PRE_LOADED_ERL_MODULES = \
zlib \
prim_zip \
otp_ring0 \
+ erl_init \
erts_code_purger \
erlang \
erts_internal \
diff --git a/erts/preloaded/src/erl_init.erl b/erts/preloaded/src/erl_init.erl
new file mode 100644
index 0000000000..186a04a8e8
--- /dev/null
+++ b/erts/preloaded/src/erl_init.erl
@@ -0,0 +1,39 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2000-2016. All Rights Reserved.
+%%
+%% Licensed under the Apache License, Version 2.0 (the "License");
+%% you may not use this file except in compliance with the License.
+%% You may obtain a copy of the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing, software
+%% distributed under the License is distributed on an "AS IS" BASIS,
+%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%% See the License for the specific language governing permissions and
+%% limitations under the License.
+%%
+%% %CopyrightEnd%
+%%
+-module(erl_init).
+
+%% Initial process of an Erlang system.
+
+-export([start/2]).
+
+%% This gets the boot arguments as expected by init:boot/1
+
+-spec start(_, term()) -> term().
+start(_Env, Argv) ->
+ run(init, boot, Argv).
+
+run(M, F, A) ->
+ case erlang:function_exported(M, F, 1) of
+ false ->
+ erlang:display({fatal,error,module,M,"does not export",F,"/1"}),
+ halt(1);
+ true ->
+ M:F(A)
+ end.