Namdak Tonpa 9 years ago
parent
commit
af2e1e59bc
3 changed files with 89 additions and 26 deletions
  1. 88 25
      doc/bundles.tex
  2. 1 1
      doc/setup.tex
  3. BIN
      mad

+ 88 - 25
doc/bundles.tex

@@ -1,27 +1,11 @@
 \section{Bundles}
 
 
-
-\subsection{Apps Ordering}
-
-Before starting an application which could be
-packed within three forms: Single-File Bundle, Release or OTP.MK Folder.
-
-
-\vspace{1\baselineskip}
-\begin{lstlisting}
-    # mad plan
-    Ordered: [kernel,stdlib,mnesia,kvs,crypto,cowlib,ranch,
-              cowboy,compiler,syntax_tools,erlydtl,gproc,
-              xmerl,n2o,n2o_sample,fs,active,mad,rest,sh]
-\end{lstlisting}
-\vspace{1\baselineskip}
-
-\subsection{Single-File Bundles with MAD}
+\subsection{Single-file SCRIPT Bundles}
 
 The key feature of mad is ability to create single-file bundled web sites.
 Thus making dream to boot simpler than node.js come true.
-This target escript is ready to run on Windows, Linux and Mac.
+This bundle target is ready to run on Windows, Linux and Mac.
 
 To make this possible we implemented a zip filesytem inside escript.
 mad packages priv directories along with ebin and configs.
@@ -47,26 +31,105 @@ function defined, which will boot up the bundle. This function could be like tha
 \begin{lstlisting}
      -module(app_name).
 
-     main(Params) -> 
+     main(Params) ->
           RebarConfig = [],
           mad_repl:main(Params,RebarConfig).
 \end{lstlisting}
 \vspace{1\baselineskip}
 
-\subsection{Releases with RELX}
+\subsection{BEAM Releases}
 
 As you may know you can create OTP releases with
-reltool (rebar generate) or systools (relx). mad currently
-creates releases with relx but is going to do it independently soon.
-Now it can only order applications.
+reltool (rebar generate) or systools (relx). mad creates releases boot
+script with systools and pack tra by itself.
+
+\vspace{1\baselineskip}
+\begin{lstlisting}
+    # mad release beam sample
+\end{lstlisting}
+\vspace{1\baselineskip}
+
+\subsection{LING Unikernels}
+
+Sample rebar.config for your application you want to go unikernel:
+
+\vspace{1\baselineskip}
+\begin{lstlisting}
+    {deps_dir,"deps"}.
+    {deps, [{ling,"master"},{sh,"1.9"}]}.
+\end{lstlisting}
+\vspace{1\baselineskip}
+
+Now you should build LING/posix:
+
+\vspace{1\baselineskip}
+\begin{lstlisting}
+    $ mad dep
+    $ cd deps/ling
+    $ ARCH=posix make
+\end{lstlisting}
+\vspace{1\baselineskip}
+
+Now pack vmling.o, your OTP apps and rest static to single-file LING bundle with VM inside.
+
+\vspace{1\baselineskip}
+\begin{lstlisting}
+    $ mad release ling mad
+    Ling Params: []
+    ARCH: posix_x86
+    Bundle Name: mad
+    System: [compiler,syntax_tools,sasl,tools,mnesia,reltool,xmerl,crypto,kernel,
+             stdlib,wx,webtool,ssl,runtime_tools,public_key,observer,inets,asn1,
+             et,eunit,hipe,os_mon]
+    Apps: [kernel,stdlib,sh,mad]
+    Overlay: ["crypto.beam","9p.beam","9p_auth.beam","9p_info.beam",
+              "9p_mounter.beam","9p_server.beam","9p_tcp.beam","9p_zero.beam",
+              "disk.beam","disk_server.beam","embedded_export.beam",
+              "goo_export.beam","goofs.beam","hipe_unified_loader.beam",
+              "inet_config.beam","kernel.beam","ling_bifs.beam","ling_code.beam",
+              "ling_disasm.beam","ling_iops.beam","ling_iopvars.beam",
+              "ling_lib.beam","net_vif.beam","os.beam","prim_file.beam",
+              "user_drv.beam","os_mon.beam","dets.beam","filename.beam",
+              "maps.beam","unicode.beam","zlib.beam"]
+    Bucks: [{boot,"/boot",2},
+            {os_mon,"/erlang/lib/os_mon/ebin",1},
+            {crypto,"/erlang/lib/crypto/ebin",1},
+            {kernel,"/erlang/lib/kernel/ebin",90},
+            {stdlib,"/erlang/lib/stdlib/ebin",85},
+            {sh,"/erlang/lib/sh/ebin",6},
+            {mad,"/erlang/lib/mad/ebin",43}]
+    Initializing EMBED.FS:
+    Mount View:
+     /boot /boot
+    /erlang/lib/os_mon/ebin /os_mon
+    /erlang/lib/crypto/ebin /crypto
+    /erlang/lib/kernel/ebin /kernel
+    /erlang/lib/stdlib/ebin /stdlib
+    /erlang/lib/sh/ebin /sh
+    /erlang/lib/mad/ebin /mad
+    Creating EMBED.FS C file: ...ok
+    Compilation of Filesystem object: ...ok
+    Linking Image: ok
+\end{lstlisting}
+\vspace{1\baselineskip}
+
+Run it:
 
 \vspace{1\baselineskip}
 \begin{lstlisting}
-    # mad release
+    $ rlwrap ./image.img
+    Erlang [ling-0.5]
+
+    Eshell V6.3  (abort with ^G)
+    1> application:which_applications().
+    [{mad,"MAD VXZ Build Tool","2.2"},
+     {sh,"VXZ SH Executor","0.9"},
+     {stdlib,"ERTS  CXC 138 10","2.2"},
+     {kernel,"ERTS  CXC 138 10","3.0.3"}]
 \end{lstlisting}
 \vspace{1\baselineskip}
 
-\subsection{Folders with OTP.MK}
+\subsection{Makefiles with OTP.MK}
 
 OTP.MK is a tiny 50 lines Makefile that allows to start your set
 of application using run\_erl and to\_erl tools from OTP distribution.

+ 1 - 1
doc/setup.tex

@@ -37,7 +37,7 @@ just having a single copy of mad binary.
 \begin{lstlisting}
     # mad app sample
     # cd sample
-    # mad deps compile plan bundle sample
+    # mad deps compile release sample
 \end{lstlisting}
 \vspace{1\baselineskip}
 

BIN
mad