From 44c657a8a8d320963890f48e3bc09675313b8d12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Henrique=20Ferreira=20de=20Freitas?= Date: Sun, 27 Jul 2025 19:36:35 -0300 Subject: [PATCH 1/5] Add instructions for debugging Erlang VM --- docs/guides/guides-erlang-debugging.md | 54 ++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 docs/guides/guides-erlang-debugging.md diff --git a/docs/guides/guides-erlang-debugging.md b/docs/guides/guides-erlang-debugging.md new file mode 100644 index 00000000..09996360 --- /dev/null +++ b/docs/guides/guides-erlang-debugging.md @@ -0,0 +1,54 @@ +--- +sidebar_position: 7 +description: Building Erlang/OTP for debugging +--- + +# Building SDKs + + +[Debug emulator](https://www.erlang.org/doc/system/debugging.html) + +[How to Build a Debug Enabled Erlang RunTime System](https://www.erlang.org/doc/system/install#advanced-configuration-and-build-of-erlang-otp_building_how-to-build-a-debug-enabled-erlang-runtime-system) + +The erlang recipe from meta-erlang layer provides, via PACKAGECONFIG, a special way in order to build Erlang emulator for debugging purposes. The official Erlang/OTP has all the details about why a special build is necessary, [Debug emulator](https://www.erlang.org/doc/system/debugging.html). + +Enable with: + +``` +PACKAGECONFIG:append:pn-erlang = " emu-type-debug" +``` + +Add the feature `dbg-pkgs` and `tools-debug` to EXTRA_IMAGE_FEATURES: + +``` +EXTRA_IMAGE_FEATURES:append = " dbg-pkgs tools-debug" +``` + +Build an image like core-image-minimal: + +``` +bitbake core-image-minimal +``` + +Run it using qemu: + +``` +runqemu core-image-minimal +``` + +Two shells: + +One for running `erl`: + +``` +erl --emu-type debug +``` + +A second one for attaching gdb: + +``` +gdb --pid=19 +``` + +According to Erlang/OTP documentation, the emu-type debug is a special emulator tailored for +debugging purposes. \ No newline at end of file From dd976611b2521e9a046ebecfa10dcd3c92f38752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Henrique=20Ferreira=20de=20Freitas?= Date: Fri, 1 Aug 2025 15:06:06 -0300 Subject: [PATCH 2/5] Remove google tracker --- docusaurus.config.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index cdb695fe..16b2206f 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -66,9 +66,6 @@ const config = { 'classic', /** @type {import('@docusaurus/preset-classic').Options} */ ({ - gtag: { - trackingID: 'G-2N5Z9W349S', - }, docs: { sidebarPath: require.resolve('./sidebars.js'), // Please change this to your repo. From c6e7bfee1e983927d58cd0c63578565e07fd6601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Henrique=20Ferreira=20de=20Freitas?= Date: Fri, 1 Aug 2025 15:07:04 -0300 Subject: [PATCH 3/5] Add blog post about erlang-red --- blog/2025-07-27/index.md | 242 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 242 insertions(+) create mode 100644 blog/2025-07-27/index.md diff --git a/blog/2025-07-27/index.md b/blog/2025-07-27/index.md new file mode 100644 index 00000000..591d68f9 --- /dev/null +++ b/blog/2025-07-27/index.md @@ -0,0 +1,242 @@ +--- +title: Erlang-Red, recipe introduction +authors: [joaohf] +tags: [meta-erlang, erlang-red] +--- + +[Erlang-Red](https://github.com/gorenje/erlang-red) is an experimental Erlang +backend to replace [Node-RED](https://nodered.org/). This blog post introduces +the erlang-red recipe available in meta-erlang layer. + + + +The purpose here is to get a virtual environment with Erlang-Red installed where +it is possible to start creating basic flow and explore possibilities using +Yocto and Erlang-Red. + +## Erlang-Red + +According to [Erlang-Red](https://github.com/gorenje/erlang-red), it is: + +> Experimental Erlang backend to replace Node-REDs existing NodeJS backend, +> aiming for 100% compatible with existing flow code. +> +> The goal is bring the advantages of low-code visual flow-based programming to +> a programming language that is designed for message passing and concurrency +> from the ground up, hence Erlang. More details described in the corresponding +> blog post. + +A few months ago I was reading [Erlang Forums](https://erlangforums.com) when I +saw a thread about +[Erlang-RED - Erlang interpreter for Node-RED flow code (visual flow based programming)](https://erlangforums.com/t/erlang-red-erlang-interpreter-for-node-red-flow-code-visual-flow-based-programming/4678). +It looked so fantastic that someone was trying to implement a new backend for +Node-RED, moreover it is written in Erlang/OTP. + +In order to get a better view of Erlang-Red philosophy and internals I recommend +reading this blog post: +[The Erlang-Red Project](https://blog.openmindmap.org/erlang-red). + +I thought that writing an +[Erlang-Red Yocto recipe](https://layers.openembedded.org/layerindex/recipe/464852/) +could be useful for anyone interested in applying flow based programming in the +context of linux embedded projects. + +## The Erlang-Red recipe + +As everything else in OpenEmbedded / Yocto land, it is necessary a recipe in +order to get any software installed in the final image built with Yocto. Some +recipes are easy, while others are more complicated. As Erlang-Red uses rebar3 +as build tool, it was easy to build, release and package it using +[rebar3.bbclass](https://github.com/meta-erlang/meta-erlang/blob/master/classes/rebar3.bbclass). + +A full working +[erlang-red bitbake recipe](https://github.com/meta-erlang/meta-erlang/blob/master/recipes-extended/erlang-red/erlang-red_git.bb) +is now available on meta-erlang layer. And in the rest of this blog post I will +guide you to get a basic image working. + +I have added erlang-red recipe to meta-erlang master branch. I did not test it +using others Yocto branches. But the recipe will work in other branches with +small fixes. + +## Setup bitbake and Yocto + +:::note + +This is the point where reading the +[Yocto Project Quick Build](https://docs.yoctoproject.org/brief-yoctoprojectqs/index.html) +documentation can help to understand basic principles. In this section I +extracted the commands that I used to run this use case. + +::: + +### Fetching source code + +Cloning all repositories for master branch: + +```bash +git clone --branch master git://git.yoctoproject.org/poky +git clone --branch master https://github.com/meta-erlang/meta-erlang +``` + +### Sourcing build environment + +Source the init build environment script: + +```bash +cd poky +source oe-init-build-env ../build +``` + +### Adding meta-erlang layer + +Add the needed layers: + +```bash +bitbake-layers add-layer ../meta-erlang +``` + +### Configuring the build environment + +For this use case, the quickest way is to edit and add some snippets in the +configuration file: _conf/local.conf_: + +```bash +# select which machine we want to build +MACHINE = "qemuriscv32" + +# systemd only +INIT_MANAGER = "systemd" + +# install erlang-red when creating an image +IMAGE_INSTALL:append = " erlang-red" + +# additional QEMU configuration for slirp mode, export 8080 tcp port +QB_SLIRP_OPT = "-netdev user,id=net0,hostfwd=tcp::8080-:8080,hostfwd=tcp::2222-:22" +``` + +### Build erlang-red recipe + +Right, the environment is configured. Have sourced the `oe-init-build-env`, we +can build erlang-red recipe: + +```bash +bitbake erlang-red +``` + +This bitbake command will build erlang-red and all its building dependencies. + +But to get something useful, we need to also build an image. + +## A basic image with erlang-red enabled + +Next, we need to build the final image: + +```bash +bitbake core-image-full-cmdline +``` + +Because we have added erlang-red to `IMAGE_INSTALL`, the build image process +will install erlang-red. + +With image ready, it is time to run it. + +## Running erlang-red with QEMU emulator + +```bash +runqemu core-image-full-cmdline serialstdio nographic + +.... + +Poky (Yocto Project Reference Distro) 5.2.99+snapshot-bd4625cd4db0f02162092d85aeab3023914f768a qemuriscv32 ttyS0 + +qemuriscv32 login: root + +WARNING: Poky is a reference Yocto Project distribution that should be used for +testing and development purposes only. It is recommended that you create your +own distribution for production use. + +root@qemuriscv32:~# +``` + +I used the arguments `serialstdio`, to enable a serial console input attached to +stdio; and `nographic` to avoid starting QEMU GUI frontend. + +In a new terminal, let's open a ssh session and start erlang-red using systemctl +command: + +```bash +ssh root@192.168.7.2 + +Last login: Fri Aug 1 18:50:29 2025 from 172.17.0.1 + +WARNING: Poky is a reference Yocto Project distribution that should be used for +testing and development purposes only. It is recommended that you create your +own distribution for production use. + +root@qemuriscv32:~# systemctl status erlang-red +● erlang-red.service - Breadboard Programming for Erlang inspired by Node-RED + Loaded: loaded (/usr/lib/systemd/system/erlang-red.service; enabled; preset: enabled) + Active: active (running) since Fri 2025-08-01 18:49:45 UTC; 55s ago +``` + +Great, erlang-red is up and running. + +In the host, open a browser at http://192.168.7.2:8080/erlang-red to see the +erlang-red web interface. + +Well, now it is the right time to learn about flow based programming and start +playing with erlang-red. + +## Erlang-Red runtime analysis + +The Erlang-Red performance is relative as there is no much to say when emulating +using QEMU without KVM to improve performance. Some rough analises below: + +### What about the disk footprint ? + +The total erlang-red footprint is about 35Mb of disk space. It includes the ERTS +(Erlang Runtime System) and all Erlang/Elixir dependencies. All files installed +on `/usr/lib/erlang-red` folder. The erlang-red package also provides systemV +and systemd start/stop scripts. + +### And about memory footprint ? + +In this use case I used systemd because I want to get the memory footprint that +systemd was reporting: + +```bash +root@qemuriscv32:~# systemctl status erlang-red +● erlang-red.service - Breadboard Programming for Erlang inspired by Node-RED + Loaded: loaded (/usr/lib/systemd/system/erlang-red.service; enabled; preset: enabled) + Active: active (running) since Fri 2025-08-01 18:49:45 UTC; 55s ago + Invocation: 704b9bef5b384451932e15cadb7291fa + Main PID: 322 (beam.smp) + Tasks: 27 (limit: 4915) + Memory: 69.7M (peak: 75.4M) + CPU: 9.751s + CGroup: /system.slice/erlang-red.service + ├─322 /usr/lib/erlang-red/bin/erlang_red -Bd -C multi_time_warp -- -root /usr/lib/erlang-red -bindir /usr/lib/erlang-red/erts-16.0.1/bin -progname usr/lib/erlang-red/bin/erlang_red -- -home /var/lib/erlang> + ├─380 /usr/lib/erlang-red/erts-16.0.1/bin/epmd -daemon + ├─435 erl_child_setup 1024 + └─458 /usr/lib/erlang-red/lib/erlexec-2.2.0/priv/x86_64-pc-linux-gnu/exec-port + +Aug 01 18:49:45 qemuriscv32 systemd[1]: Started Breadboard Programming for Erlang inspired by Node-RED. +Aug 01 18:49:47 qemuriscv32 erlang_red[322]: Exec: /usr/lib/erlang-red/erts-16.0.1/bin/erlexec -noinput +Bd -boot /usr/lib/erlang-red/releases/0.2.2/start -mode embedded -boot_var SYSTEM_LIB_DIR /usr/lib/erlang-red/lib> +Aug 01 18:49:47 qemuriscv32 erlang_red[322]: Root: /usr/lib/erlang-red +Aug 01 18:49:47 qemuriscv32 erlang_red[322]: /usr/lib/erlang-red +Aug 01 18:49:50 qemuriscv32 erlang_red[322]: warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can> +lines 1-19/19 (END) + +``` + +So, 69.7M is the memory consumption. + +As Erlang-Red is in it's early development stages, I believe that are open space +for code optimization for reducing memory usage and also for tuning ERTS for the +Erlang-Red use case. + +## What has next ? + +As a next project, I wish to install erlang-red into a Raspberry Pi platform and +control some external hardware. This is a pretty common scenario and let's see +how feasible it is with Erlang-Red. From 04e9ed2b43e4b6dd34a6bd11574aa6ca045d9fc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Henrique=20Ferreira=20de=20Freitas?= Date: Fri, 1 Aug 2025 16:52:35 -0300 Subject: [PATCH 4/5] Apply format --- blog/2025-04-19/index.md | 3 ++- docs/guides/guides-beamtools.md | 5 +++-- docs/guides/guides-erlang-debugging.md | 10 ++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/blog/2025-04-19/index.md b/blog/2025-04-19/index.md index 832b14f8..dbf5a347 100644 --- a/blog/2025-04-19/index.md +++ b/blog/2025-04-19/index.md @@ -4,7 +4,8 @@ authors: [joaohf] tags: [meta-erlang, news] --- -Due [CVE-2025-32433](https://nvd.nist.gov/vuln/detail/CVE-2025-32433), more details at +Due [CVE-2025-32433](https://nvd.nist.gov/vuln/detail/CVE-2025-32433), more +details at [Unauthenticated Remote Code Execution in Erlang/OTP SSH](https://github.com/erlang/otp/security/advisories/GHSA-37cp-fgq5-7wc2), we have updated the following new Erlang/OTP releases: diff --git a/docs/guides/guides-beamtools.md b/docs/guides/guides-beamtools.md index 35e20175..1bb2788b 100644 --- a/docs/guides/guides-beamtools.md +++ b/docs/guides/guides-beamtools.md @@ -5,7 +5,8 @@ description: Building BEAM Tools. # Building BEAM Tools -The [beamtools user guide](/beamtools/intro) has more details about how to setup and usage modes. +The [beamtools user guide](/beamtools/intro) has more details about how to setup +and usage modes. This section is focused on how to build beamtools using meta-erlang. @@ -37,4 +38,4 @@ script, like that: ```bash sh x86_64-beamtools-nativesdk-standalone-3.4.1-erlang-24.1.7-elixir-1.12.3.sh -``` \ No newline at end of file +``` diff --git a/docs/guides/guides-erlang-debugging.md b/docs/guides/guides-erlang-debugging.md index 09996360..1a2a772d 100644 --- a/docs/guides/guides-erlang-debugging.md +++ b/docs/guides/guides-erlang-debugging.md @@ -5,12 +5,14 @@ description: Building Erlang/OTP for debugging # Building SDKs - [Debug emulator](https://www.erlang.org/doc/system/debugging.html) [How to Build a Debug Enabled Erlang RunTime System](https://www.erlang.org/doc/system/install#advanced-configuration-and-build-of-erlang-otp_building_how-to-build-a-debug-enabled-erlang-runtime-system) -The erlang recipe from meta-erlang layer provides, via PACKAGECONFIG, a special way in order to build Erlang emulator for debugging purposes. The official Erlang/OTP has all the details about why a special build is necessary, [Debug emulator](https://www.erlang.org/doc/system/debugging.html). +The erlang recipe from meta-erlang layer provides, via PACKAGECONFIG, a special +way in order to build Erlang emulator for debugging purposes. The official +Erlang/OTP has all the details about why a special build is necessary, +[Debug emulator](https://www.erlang.org/doc/system/debugging.html). Enable with: @@ -50,5 +52,5 @@ A second one for attaching gdb: gdb --pid=19 ``` -According to Erlang/OTP documentation, the emu-type debug is a special emulator tailored for -debugging purposes. \ No newline at end of file +According to Erlang/OTP documentation, the emu-type debug is a special emulator +tailored for debugging purposes. From bd7e188eacc5d45ffc661f2de4d754deb9b39f6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Henrique=20Ferreira=20de=20Freitas?= Date: Sun, 11 May 2025 21:28:36 -0300 Subject: [PATCH 5/5] Add blog about autotools --- blog/2025-05-11/index.md | 174 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 blog/2025-05-11/index.md diff --git a/blog/2025-05-11/index.md b/blog/2025-05-11/index.md new file mode 100644 index 00000000..e2445041 --- /dev/null +++ b/blog/2025-05-11/index.md @@ -0,0 +1,174 @@ +--- +title: autotools as build tool for Erlang/OTP projects +authors: [joaohf] +tags: [meta-erlang, autotools] +--- + +The [hello-erlang-autoconf](https://github.com/meta-erlang/hello-world/tree/master/hello-erlang-autoconf) repository is an example about how to use autotools as build tool for Erlang/OTP projects. The original code came from https://github.com/sirbeancounter/hello. I just adapted it and fixed small issues for Yocto integration. + + + +The result was the creating of a recipe called [hello-erlang-autoconf](https://github.com/meta-erlang/meta-erlang/blob/master/recipes-examples/hello-erlang-autoconf/hello-erlang-autoconf_0.1.0.bb) as an example about how to integrate autotools with erlang build. This recipe is very interesting because it inherit the class `autotools` which is a standard class from openembedded-core. + +autotools provides support for building Erlang projects: [Erlang-Libraries](https://www.gnu.org/software/autoconf/manual/autoconf-2.72/html_node/Erlang-Libraries.html) and I've found a talk +about: [Using GNU Autoconf to Configure Erlang Programs](https://erlang.org/euc/06/proceedings/1430Lenglet.ppt). It looks like using autotools is something that could save time as build tool. + +I think the final result for the recipe [hello-erlang-autoconf](https://github.com/meta-erlang/meta-erlang/blob/master/recipes-examples/hello-erlang-autoconf/hello-erlang-autoconf_0.1.0.bb) was very short and easy to customize. Moreover, as autotools is pretty standard for configuring and building software package it brings solid foundations too. + +I'm not saying that autotools is easy to learn or it is the best tool. But something to consider. + +After building the recipe `bitbake hello-erlang-autoconf` and with buildhistory enabled it is possible to inspect the size of each dependency. + +:::note + +Enabled in `local.conf`: + +``` +USER_CLASSES ?= "buildhistory buildstats" +BUILDHISTORY_COMMIT = "1" +``` + +::: + +Starting with _hello-erlang-autoconf_ package it says: + +```bash +$ cat buildhistory/packages/riscv32imafdc-poky-linux/hello-erlang-autoconf/hello-erlang-autoconf/latest +PV = 0.1.0+git +PR = r0 +PKGV = 0.1.0+git0+6c7f37489e +RPROVIDES = +RDEPENDS = erlang-epmd erlang-erts erlang-kernel erlang-stdlib +RRECOMMENDS = +PKGSIZE = 12705 +FILES = /usr/lib/erlang/lib/hello-*/ebin /etc/hello.d /etc/hello.d/hello.boot /etc/init.d/hello.otp.system /usr/bin/hello.start /usr/bin/hello.stop +FILELIST = /etc/hello.d/hello.boot /etc/hello.d/hello.config /etc/init.d/hello.otp.system /usr/bin/hello.start /usr/bin/hello.stop /usr/lib/erlang/lib/hello-6c7f374/ebin/hello.app /usr/lib/erlang/lib/hello-6c7f374/ebin/hello.beam /usr/lib/erlang/lib/hello-6c7f374/ebin/hello_app.beam /usr/lib/erlang/lib/hello-6c7f374/ebin/hello_sup.beam +``` + +Looking into `RDEPENDS` it is clear what are necessary to be installed in order to run hello-erlang-autoconf application: + +```mermaid +classDiagram + + hello-erlang-autoconf ..> erlang-epmd : Dependency + hello-erlang-autoconf ..> erlang-erts : Dependency + hello-erlang-autoconf ..> erlang-kernel : Dependency + hello-erlang-autoconf ..> erlang-stdlib : Dependency +``` + +A close look into all installed files by hellor-erlang-autoconf: + +```bash +$ cat buildhistory/packages/riscv32imafdc-poky-linux/hello-erlang-autoconf/hello-erlang-autoconf/files-in-package.txt +drwxr-xr-x root root 4096 ./etc +drwxr-xr-x root root 4096 ./etc/hello.d +-rw-r--r-- root root 7550 ./etc/hello.d/hello.boot +-rwxr-xr-x root root 63 ./etc/hello.d/hello.config +drwxr-xr-x root root 4096 ./etc/init.d +-rwxr-xr-x root root 1525 ./etc/init.d/hello.otp.system +drwxr-xr-x root root 4096 ./usr +drwxr-xr-x root root 4096 ./usr/bin +-rwxr-xr-x root root 370 ./usr/bin/hello.start +-rwxr-xr-x root root 506 ./usr/bin/hello.stop +drwxr-xr-x root root 4096 ./usr/lib +drwxr-xr-x root root 4096 ./usr/lib/erlang +drwxr-xr-x root root 4096 ./usr/lib/erlang/lib +drwxr-xr-x root root 4096 ./usr/lib/erlang/lib/hello-6c7f374 +drwxr-xr-x root root 4096 ./usr/lib/erlang/lib/hello-6c7f374/ebin +-rw-r--r-- root root 231 ./usr/lib/erlang/lib/hello-6c7f374/ebin/hello.app +-rw-r--r-- root root 636 ./usr/lib/erlang/lib/hello-6c7f374/ebin/hello_app.beam +-rw-r--r-- root root 1024 ./usr/lib/erlang/lib/hello-6c7f374/ebin/hello.beam +-rw-r--r-- root root 800 ./usr/lib/erlang/lib/hello-6c7f374/ebin/hello_sup.beam +``` + +A few files. Just .beam objects and start scripts. An interesting fact, the following files: + +```bash +drwxr-xr-x root root 4096 ./usr/lib/erlang/lib/hello-6c7f374 +drwxr-xr-x root root 4096 ./usr/lib/erlang/lib/hello-6c7f374/ebin +-rw-r--r-- root root 231 ./usr/lib/erlang/lib/hello-6c7f374/ebin/hello.app +-rw-r--r-- root root 636 ./usr/lib/erlang/lib/hello-6c7f374/ebin/hello_app.beam +-rw-r--r-- root root 1024 ./usr/lib/erlang/lib/hello-6c7f374/ebin/hello.beam +-rw-r--r-- root root 800 ./usr/lib/erlang/lib/hello-6c7f374/ebin/hello_sup.beam +``` + +Get installed inside _/usr/lib/erlang/lib/_, this is where the standard Erlang/OTP is installed by erlang recipe from meta-erlang layer. + +More details about all erlang-* dependencies: + +```bash +$ cat buildhistory/packages/riscv32imafdc-poky-linux/erlang/erlang-epmd/latest +PV = 28.0.1 +PR = r0 +RPROVIDES = +RDEPENDS = base-files base-passwd glibc (>= 2.41+git0+6e489c17f8) libsystemd (>= 257.6) shadow +RRECOMMENDS = +PKGSIZE = 47150 +FILES = /usr/lib/erlang/erts-*/bin/epmd /usr/lib/erlang/bin/epmd /usr/bin/epmd /usr/lib/systemd/system/epmd.service /usr/lib/systemd/system/epmd.socket /etc/init.d /usr/lib/systemd/system-preset/98-erlang-epmd.preset /usr/lib/systemd/system/epmd.service /usr/lib/systemd/system/epmd.socket +FILELIST = /usr/bin/epmd /usr/lib/erlang/bin/epmd /usr/lib/erlang/erts-16.0.1/bin/epmd /usr/lib/systemd/system-preset/98-erlang-epmd.preset /usr/lib/systemd/system/epmd.service /usr/lib/systemd/system/epmd.socket +``` + +```bash +$ cat buildhistory/packages/riscv32imafdc-poky-linux/erlang/erlang-erts/latest +PV = 28.0.1 +PR = r0 +RPROVIDES = +RDEPENDS = glibc (>= 2.41+git0+6e489c17f8) ncurses-libtinfo (>= 6.5) zlib (>= 1.3.1) +RRECOMMENDS = +PKGSIZE = 4690380 +FILES = /usr/bin /usr/lib/erlang/releases /usr/lib/erlang/bin /usr/lib/erlang/erts-*/bin /usr/lib/erlang/lib/erts-*/ebin +FILELIST = /usr/bin/erl /usr/bin/escript /usr/bin/run_erl /usr/bin/to_erl /usr/lib/erlang/bin/erl /usr/lib/erlang/bin/erl_call /usr/lib/erlang/bin/escript /usr/lib/erlang/bin/no_dot_erlang.boot /usr/lib/erlang/bin/run_erl /usr/lib/erlang/bin/start /usr/lib/erlang/bin/start.boot /usr/lib/erlang/bin/start.script /usr/lib/erlang/bin/start_clean.boot /usr/lib/erlang/bin/start_erl /usr/lib/erlang/bin/start_sasl.boot /usr/lib/erlang/bin/to_erl /usr/lib/erlang/erts-16.0.1/bin/beam.smp /usr/lib/erlang/erts-16.0.1/bin/dyn_erl /usr/lib/erlang/erts-16.0.1/bin/erl /usr/lib/erlang/erts-16.0.1/bin/erl.src /usr/lib/erlang/erts-16.0.1/bin/erl_call /usr/lib/erlang/erts-16.0.1/bin/erl_child_setup /usr/lib/erlang/erts-16.0.1/bin/erlexec /usr/lib/erlang/erts-16.0.1/bin/escript /usr/lib/erlang/erts-16.0.1/bin/heart /usr/lib/erlang/erts-16.0.1/bin/inet_gethost /usr/lib/erlang/erts-16.0.1/bin/run_erl /usr/lib/erlang/erts-16.0.1/bin/start /usr/lib/erlang/erts-16.0.1/bin/start.src /usr/lib/erlang/erts-16.0.1/bin/start_erl.src /usr/lib/erlang/erts-16.0.1/bin/to_erl /usr/lib/erlang/releases/28/OTP_VERSION /usr/lib/erlang/releases/28/installed_application_versions /usr/lib/erlang/releases/28/no_dot_erlang.boot /usr/lib/erlang/releases/28/no_dot_erlang.rel /usr/lib/erlang/releases/28/no_dot_erlang.script /usr/lib/erlang/releases/28/start.boot /usr/lib/erlang/releases/28/start.script /usr/lib/erlang/releases/28/start_all_example.rel /usr/lib/erlang/releases/28/start_clean.boot /usr/lib/erlang/releases/28/start_clean.rel /usr/lib/erlang/releases/28/start_clean.script /usr/lib/erlang/releases/28/start_sasl.boot /usr/lib/erlang/releases/28/start_sasl.rel /usr/lib/erlang/releases/28/start_sasl.script /usr/lib/erlang/releases/RELEASES /usr/lib/erlang/releases/RELEASES.src /usr/lib/erlang/releases/start_erl.data +``` + +```bash +$ cat buildhistory/packages/riscv32imafdc-poky-linux/erlang/erlang-kernel/latest +PV = 28.0.1 +PR = r0 +RPROVIDES = +RDEPENDS = +RRECOMMENDS = +PKGSIZE = 2931802 +FILES = /usr/lib/erlang/lib/kernel-* +FILELIST = /usr/lib/erlang/lib/kernel-10.3.1/ebin/application.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/application_controller.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/application_master.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/application_starter.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/auth.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/code.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/code_server.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/disk_log.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/disk_log_1.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/disk_log_server.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/disk_log_sup.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/dist_ac.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/dist_util.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/erl_boot_server.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/erl_compile_server.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/erl_ddll.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/erl_debugger.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/erl_distribution.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/erl_epmd.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/erl_erts_errors.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/erl_kernel_errors.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/erl_reply.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/erl_signal_handler.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/erpc.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/error_handler.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/error_logger.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/erts_debug.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/file.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/file_io_server.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/file_server.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/gen_sctp.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/gen_tcp.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/gen_tcp_socket.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/gen_udp.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/gen_udp_socket.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/global.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/global_group.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/global_search.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/group.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/group_history.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/heart.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/inet.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/inet6_sctp.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/inet6_tcp.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/inet6_tcp_dist.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/inet6_udp.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/inet_config.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/inet_db.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/inet_dns.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/inet_dns_tsig.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/inet_epmd_dist.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/inet_epmd_socket.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/inet_gethost_native.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/inet_hosts.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/inet_parse.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/inet_res.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/inet_sctp.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/inet_tcp.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/inet_tcp_dist.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/inet_udp.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/kernel.app /usr/lib/erlang/lib/kernel-10.3.1/ebin/kernel.appup /usr/lib/erlang/lib/kernel-10.3.1/ebin/kernel.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/kernel_config.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/kernel_refc.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/local_tcp.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/local_udp.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/logger.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/logger_backend.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/logger_config.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/logger_disk_log_h.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/logger_filters.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/logger_formatter.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/logger_h_common.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/logger_handler.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/logger_handler_watcher.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/logger_olp.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/logger_proxy.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/logger_server.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/logger_simple_h.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/logger_std_h.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/logger_sup.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/net.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/net_adm.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/net_kernel.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/os.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/pg.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/pg2.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/prim_tty.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/prim_tty_sighandler.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/ram_file.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/raw_file_io.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/raw_file_io_compressed.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/raw_file_io_deflate.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/raw_file_io_delayed.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/raw_file_io_inflate.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/raw_file_io_list.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/rpc.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/seq_trace.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/socket.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/standard_error.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/trace.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/user_drv.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/user_sup.beam /usr/lib/erlang/lib/kernel-10.3.1/ebin/wrap_log_reader.beam +``` + +```bash +$ cat buildhistory/packages/riscv32imafdc-poky-linux/erlang/erlang-stdlib/latest +PV = 28.0.1 +PR = r0 +RPROVIDES = +RDEPENDS = +RRECOMMENDS = +PKGSIZE = 6571412 +FILES = /usr/lib/erlang/lib/stdlib-* +FILELIST = /usr/lib/erlang/lib/stdlib-7.0.1/ebin/argparse.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/array.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/base64.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/beam_lib.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/binary.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/c.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/calendar.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/dets.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/dets_server.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/dets_sup.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/dets_utils.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/dets_v9.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/dict.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/digraph.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/digraph_utils.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/edlin.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/edlin_context.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/edlin_expand.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/edlin_key.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/edlin_type_suggestion.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/epp.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/erl_abstract_code.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/erl_anno.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/erl_bits.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/erl_compile.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/erl_error.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/erl_eval.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/erl_expand_records.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/erl_features.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/erl_internal.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/erl_lint.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/erl_parse.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/erl_posix_msg.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/erl_pp.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/erl_scan.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/erl_stdlib_errors.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/erl_tar.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/error_logger_file_h.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/error_logger_tty_h.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/escript.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/ets.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/eval_bits.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/file_sorter.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/filelib.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/filename.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/gb_sets.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/gb_trees.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/gen.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/gen_event.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/gen_fsm.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/gen_server.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/gen_statem.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/io.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/io_lib.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/io_lib_format.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/io_lib_fread.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/io_lib_pretty.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/json.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/lists.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/log_mf_h.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/maps.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/math.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/ms_transform.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/orddict.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/ordsets.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/otp_internal.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/peer.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/pool.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/proc_lib.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/proplists.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/qlc.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/qlc_pt.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/queue.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/rand.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/random.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/re.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/sets.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/shell.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/shell_default.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/shell_docs.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/shell_docs_markdown.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/shell_docs_test.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/slave.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/sofs.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/stdlib.app /usr/lib/erlang/lib/stdlib-7.0.1/ebin/stdlib.appup /usr/lib/erlang/lib/stdlib-7.0.1/ebin/string.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/supervisor.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/supervisor_bridge.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/sys.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/timer.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/unicode.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/unicode_util.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/uri_string.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/win32reg.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/zip.beam /usr/lib/erlang/lib/stdlib-7.0.1/ebin/zstd.beam +``` + +Based on PKGSIZE for each package, we have the following graph showing which package consumes more space: + +```mermaid +pie title Size by package + "hello-erlang-autoconf" : 12705 + "erlang-epmd" : 47150 + "erlang-kernel" : 2931802 + "erlang-erts" : 4690380 + "erlang-stdlib" : 6571412 +``` + +| Package | Size | +| ------- | ---- | +| hellow-erlang-autoconf | 12705 | +| erlang-epmd | 47150 | +| erlang-kernel | 2931802 | +| erlang-erts | 4690380 | +| erlang-stdlib | 6571412 | +| Total | 14253449 | + +So, almost 15Mb is necessary for a simple erlang application. Nowadays it is almost nothing. But that raise some questions: + +1. Is that possible to reduce the size of ERTS ? + - Maybe using some configure and build flags for better code optimization + - Or even necessary detect which places in Erlang/OTP source code worth optimizations +1. Double check if debug symbols are present in each .beam file +1. erlang-stdlib is consuming most of the space. However, it has everything needed for building applications. It's a fact. + - Maybe there are open room for spliting erlang-stdlib in small libraries ?