Please refer to the <a href="../../tutorials/hello_world/">&ldquo;Hello World&rdquo;</a> tutorial instead.
</div>
<p>Here we show an example on how to build &ldquo;burnable&rdquo; SD images for Raspberry Pi with Luet. This approach lets you describe and version OTA upgrades for your embedded devices, delivering upgrades as layer upgrades on the Pi.</p>
<p>The other good side of the medal is that you can build a Luet package repository with multiple distributions (e.g. <code>Raspbian</code>, <code>OpenSUSE</code>, <code>Gentoo</code>, &hellip; ) and switch among them in runtime. In the above example <code>Raspbian</code> and <code>Funtoo</code> (at the time of writing) are available.</p>
<p>You have to run the following steps inside an ARM board to produce arm-compatible binaries. Any distribution with Docker will work. Note that the same steps could be done in a cross-compilation approach, or with qemu-binfmt in a amd64 host.</p>
<p>You will also need in your host:</p>
<ul>
<li>Docker</li>
<li>Luet installed (+container-diff) in <code>/usr/bin/luet</code> (arm build)</li>
<li>make</li>
</ul>
<h2 id="build-the-packages">Build the packages</h2>
<p>Clone the repository <a href="https://github.com/Luet-lab/luet-embedded">https://github.com/Luet-lab/luet-embedded</a></p>
<p>If a rebuild is needed, just do <code>sudo make rebuild-all</code> after applying the changes.</p>
<h2 id="create-the-repository">Create the repository</h2>
<pre><code>$&gt; sudo make create-repo
...
</code></pre>
<h2 id="serve-the-repo-locally">Serve the repo locally</h2>
<pre><code>$&gt; make serve-repo
...
</code></pre>
<h2 id="create-the-flashable-image">Create the flashable image</h2>
<h3 id="funtoo-based-system">Funtoo based system</h3>
<pre><code>$&gt; sudo LUET_PACKAGES='distro/funtoo-1.4 distro/raspbian-boot-0.20191208 system/luet-develop-0.5' make image
...
</code></pre>
<h3 id="raspbian-based-system">Raspbian based system</h3>
<pre><code>$&gt; sudo LUET_PACKAGES='distro/raspbian-0.20191208 distro/raspbian-boot-0.20191208 system/luet-develop-0.5' make image
...
</code></pre>
<p>At the end of the process, a file <code>luet_os.img</code>, ready to be flashed to an SD card, should be present in the current directory.</p>
<p>In order to build and add <a href="https://luet.io/docs/concepts/packages/">packages</a> to the exiting repository, simply add or edit the <a href="https://luet.io/docs/concepts/packages/specfile">specfiles</a> under the <code>distro</code> folder. When doing <code>make rebuild-all</code> the packages will be automatically compiled and made available to the local repository.</p>
<p>In order to build a specific version, a full <a href="https://luet.io/docs/concepts/packages/">package</a> definition (triple of <code>category</code>, <code>name</code> and <code>version</code>) has to be specified.
INFO Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
ERROR Error: Failed compiling development/toolchain-go-0.6: failed building package image: Could not push image: quay.io/mocaccino/micro-toolchain:latest toolchain-go-development-0.6-builder.dockerfile: Could not build image: quay.io/mocaccino/micro-toolchain:latest toolchain-go-development-0.6-builder.dockerfile: Failed running command: : exit status 1
ERROR Bailing out
</code></pre><p>means the user you are running the build command can&rsquo;t either connect to docker or <code>docker</code> is not started.</p>
<p>Check if the user you are running the build is in the <code>docker</code> group, or if the <code>docker</code> daemon is started.</p>
<p>Luet by default if run with multiple packages summarize errors and can be difficult to navigate to logs, but if you think you might have found a bug, run the build with <code>--debug</code> before opening an issue.</p>
<h2 id="why-the-name-luet">Why the name <code>luet</code>?</h2>
<p>Well, I have the idea that programs should be small, so they are not difficult to type and easy to remember, and easy to stick in. <code>luet</code> is really a combination of the first letters of my fiancee name (Lucia) and my name (Ettore) <code>lu+et = luet</code>! and besides, happen to be also a <a href="http://www.comuniterrae.it/punto/ponte-luet/">small bridge</a> in Italy ;)</p>
<p>The Docker image <code>quay.io/luet/base</code> is a <code>scratch</code> Docker image always kept up-to-date with the latest luet version. That image can be used to bootstrap new images with Luet repositories with the packages you want, from the repositories you prefer.</p>
<p>For example we can mount a config file, and later on install a package:</p>
<span style="color:#8f5902;font-style:italic"># Try your new image!</span>
docker run -ti --entrypoint /bin/bash --rm luet-runtime-test-image
</code></pre></div><p>In this way we will create a new image, with only <code>luet</code> and <code>bash</code>, and nothing else from a scratch image.</p>
<td>Example repository to host package browser websites on gh-pages. It uses the package-browser extension to generate HTML pages from a list of luet repositories</td>