[erlang-questions] Reltool anyone?

Michael Truog mjtruog@REDACTED
Sun Aug 24 04:08:37 CEST 2014


On 08/23/2014 11:51 AM, Joe Armstrong wrote:
> I think it might be a better idea if you explained how booting erlang works
>
> *exactly* what happens when you do "erl -boot XYZ.boot"
>
> examining a boot file is fun - for example, we can take a look at start.boot
Thank you for mentioning the format of the boot file.  For some reason I didn't see that previously though I did create functions for starting and stopping applications within a release outside of the normal Erlang startup at https://github.com/okeuday/reltool_util (I was using the .script file but I added functions for the .boot file).  The reltool_util source code is used within CloudI to start internal (Erlang) services, including services that are in a release (as shown here https://github.com/CloudI/CloudI/tree/develop/examples/hello_world1#usage-different-ways-of-adding-the-same-internal-service). So, the reltool_util source code might help others experiment with Erlang releases.


> (the default boot file) - to see what it does we do the following:
>
> $ cd /usr/local/lib/erlang/bin
> $ erl
>
> 1 > {ok, B} = file:read_file("start.boot").
>
> {ok,<<131,104,3,100,0,6,115,99,114,105,112,116,104,2,107,
>
>        0,10,69,114,108,97,110,103,47,79,84,80,...>>}
>
> 2 > binary_to_term(B).
>
> {script,
>
>      {"Erlang/OTP","17"},
>
>      [{preLoaded,
>
>           [erl_prim_loader,erlang,erts_internal,init,otp_ring0,
>
>            prim_eval,prim_file,prim_inet,prim_zip,zlib]},
>
>       {progress,preloaded},
>
>       {path,
>
>           ["$ROOT/lib/kernel-3.0/ebin","$ROOT/lib/stdlib-2.0/ebin"]},
>
>       {primLoad,[error_handler]},
>
>       {kernel_load_completed},
>
>       {progress,kernel_load_completed},
>
>       {path,["$ROOT/lib/kernel-3.0/ebin"]},
>
>       {primLoad,
>
>           [application,application_controller,application_master,
>
>            application_starter,auth,code,code_server,disk_log,
>
>            disk_log_1,disk_log_server,disk_log_sup,dist_ac,dist_util,
>
>            erl_boot_server,erl_ddll,erl_distribution|...]},
> ...etc
>
> Boot files are just tuples which are interpreted by the function eval_script -
> (Which on my system starts in line 812 of
> /usr/local/lib/erlang/lib/erts-6.0/src/init.erl)
>
> The *reason* they
> are written as binaries and use binary_to_term to "see" them is
> because when the system
> is loaded the code to parse erlang terms has not yet been loaded -
> this code gets loaded
> by the boot loader a little bit later.
>
> The stuff in systools and reltool basically takes the pain out of
> manipulating the boot files.
> Once you've understood the bootfile structure the rest is easy.
>
> This is actually described in
>
> http://www.erlang.org/documentation/doc-4.9.1/doc/system_principles/system_principles.html
>
> But very few people seem to notice this - it might be an idea to
> emphasis how easy the
> start phases are. Once you hide what's really going on with tools you
> can get into deep
> waters if the tools stop working and you don't really understand whats
> happening under the
> covers ...
>
> Anybody who really wants to understand how the system starts should
> write some simple
> bootscripts by-hand and see what happens when they are run :-)
>
> Cheers
>
> /Joe
>
>
> On Sun, Aug 17, 2014 at 6:07 PM, Francesco Cesarini
> <francesco@REDACTED> wrote:
>> Hi,
>>
>> I was wrapping up the chapter on release handling for the OTP book and never
>> having used it before, decided to take a look at reltool. Is anyone using
>> it? I am finding it counter intuitive and struggling to see how it
>> simplifies the task of creating releases.
>>
>> Feel free to reply to the list or ping me privately.
>>
>> Thanks,
>> F
>>
>> --
>> Founder & Technical Director
>> Erlang Solutions Ltd.
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>




More information about the erlang-questions mailing list