<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Quickstart Tutorial</title><link>https://forge.codesys.com/tol/wharfie/wiki/Quickstart%2520Tutorial/</link><description>Recent changes to Quickstart Tutorial</description><language>en</language><lastBuildDate>Sun, 25 Feb 2018 13:11:10 -0000</lastBuildDate><atom:link href="https://forge.codesys.com/tol/wharfie/wiki/Quickstart%20Tutorial/feed" rel="self" type="application/rss+xml"></atom:link><item><title>Quickstart Tutorial modified by Ingo</title><link>https://forge.codesys.com/tol/wharfie/wiki/Quickstart%2520Tutorial/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -1,3 +1,7 @@
+[TOC]
+
+[[include ref=IndexMain]]
+
 This tutorial guides you on a basic setup of a debian based root filesystem. Without knowing anything about "wharfie", we can define what we want:

 * Bootable debian with systemd
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ingo</dc:creator><pubDate>Sun, 25 Feb 2018 13:11:10 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com0fc08526dbebad825500c5bcec6b6cd97804ee86</guid></item><item><title>Quickstart Tutorial modified by Ingo</title><link>https://forge.codesys.com/tol/wharfie/wiki/Quickstart%2520Tutorial/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;This tutorial guides you on a basic setup of a debian based root filesystem. Without knowing anything about "wharfie", we can define what we want:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Bootable debian with systemd&lt;/li&gt;
&lt;li&gt;Our desired username and password&lt;/li&gt;
&lt;li&gt;Wireless network&lt;/li&gt;
&lt;li&gt;SSH access&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To make everything a bit more specific, we configure the system for the Raspberry Pi Zero W.&lt;/p&gt;
&lt;h1 id="step-1-debian-base-system"&gt;Step 1: Debian Base System&lt;/h1&gt;
&lt;p&gt;With the simple Statement "FROM", we can decide which debian version and which architecture we want to use. The exact syntax is:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;FROM debian_&amp;lt;architecture&amp;gt;_&amp;lt;version&amp;gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;When doing anything with the Raspberry Pi, you have to know which CPU version you have, as you will need to select the correct architecture. Don't think, that this is not necessary, as Raspbian can serve all variants with a single image. They can do this, as they selected a compromise between the two major architecture variants, which debian is using.&lt;/p&gt;
&lt;p&gt;But no worries, the rule is easy:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Single Core: armel&lt;/li&gt;
&lt;li&gt;Multi Core: armhf&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As the Raspberry Pi Zero hosts a single core CPU, we are using "armel".&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;FROM debian_armel_stretch
TO rpi.tar
&lt;/pre&gt;&lt;/div&gt;


&lt;h1 id="step-2-bootable-debian-with-systemd"&gt;Step 2: Bootable debian with systemd&lt;/h1&gt;
&lt;p&gt;We are installing the following pakets:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;systemd-sysv: This paket installs systemd, as well as the compatibility wrapper generator for system V. It is actually still a good idea, as some pakets (like dhcpcd5) still uses system V init scripts.&lt;/li&gt;
&lt;li&gt;dhcpcd5: This will enable the configuration of the IP address, using DHCP.&lt;/li&gt;
&lt;li&gt;wpa_supplicant: This will enable us to connect to a WPA secured access point.&lt;/li&gt;
&lt;li&gt;openssh: This will enable SSH access to the device.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We will install everything with the following two flags:&lt;br/&gt;
&lt;strong&gt;-y&lt;/strong&gt; to answer all questions during installation with "yes"&lt;br/&gt;
*&lt;em&gt;-no-install-recommends&lt;/em&gt; to install only fix dependencies and keep the system small&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;RUN apt-get update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; apt-get install -y -no-install-recommends systemd-sysv dhcpcd5 wpa_supplicant openssh
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Now we just need the following actions, to add a proper /etc/fstab file.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;ADD files/fstab /etc/fstab
&lt;/pre&gt;&lt;/div&gt;


&lt;h1 id="step-3-username-and-password"&gt;Step 3: Username and password&lt;/h1&gt;
&lt;p&gt;It should be rather selfexplainatory. This concept is widely used in docker images to add specific users and change their passwords.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;RUN useradd -ms /bin/bash wharfie&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"wharfie:wharfie"&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; chpasswd&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"root:root"&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; chpasswd&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;h1 id="step-4-wireless-network"&gt;Step 4: Wireless network&lt;/h1&gt;
&lt;p&gt;To load the network driver and to start wpa_supplicant for connecting to our access point, we use the following actions.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;ADD files/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
ADD files/wireless.conf /etc/modules-load.d/wireless.conf
RUN sed -i &lt;span class="s1"&gt;'s,^Requires,#Requires,'&lt;/span&gt; /lib/systemd/system/wpa_supplicant@.service&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;wpa_supplicant@wlan0.service&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;We are starting wpa_supplicant for our interface wlan0. Dhcpcd is by default configured to assign IP addresses to every available network interface. So /etc/network/interfaces is not used at all.&lt;/p&gt;
&lt;h1 id="step-5-make-a-bootable-image"&gt;Step 5: Make a bootable image&lt;/h1&gt;
&lt;p&gt;The result of the build would currently be a simple tar archive. To bring this root filesystem onto a bootable SD card image, containing a bootloader, a kernel, kernel modules and all necessary firmware files, we can use a script from the folder "examples/bootstrategy/raspberrypi.sh". This is downloading the most current raspian image and is exchanging the rootfilesystem.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;RUN HOST &lt;span class="se"&gt;\&lt;/span&gt;
    ../../bootstrategy/raspberrypi.sh rpi.img
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Note, that RUN HOST is executed from a subfolder of your current working directory, which contains the full root filesystem. Therefore a relative path needs to contain an additional "../".&lt;/p&gt;
&lt;h1 id="final-the-resulting-file"&gt;Final: The resulting file&lt;/h1&gt;
&lt;p&gt;All the steps above, need to be written into a file named "Wharfile". You should create a new folder for your image, where you can place this file.&lt;/p&gt;
&lt;p&gt;The additional files which are needed can be placed where you like, but it's recommended to use a subfolder (e.g. "files/" or "root/") to collect all files which are added using the ADD command.&lt;/p&gt;
&lt;p&gt;Here is the listing of the file. You file find a slighly changed version of it in the "examples" folder of wharfie.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;FROM debian_armel_stretch
TO rpi.tar

RUN apt-get update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; apt-get install -y -no-install-recommends systemd-sysv dhcpcd5 wpa_supplicant openssh

ADD files/fstab /etc/fstab

RUN useradd -ms /bin/bash wharfie&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"wharfie:wharfie"&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; chpasswd&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"root:root"&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; chpasswd&lt;span class="p"&gt;;&lt;/span&gt;

ADD files/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
ADD files/wireless.conf /etc/modules-load.d/wireless.conf
RUN sed -i &lt;span class="s1"&gt;'s,^Requires,#Requires,'&lt;/span&gt; /lib/systemd/system/wpa_supplicant@.service&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;wpa_supplicant@wlan0.service&lt;span class="p"&gt;;&lt;/span&gt;

RUN HOST &lt;span class="se"&gt;\&lt;/span&gt;
    ../../bootstrategy/raspberrypi.sh rpi.img
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;To build the image, just change into the newly created folder, containing the "Wharfile" and type the command "wharfie". You will be asked to enter your password, as some of the actions during build need root access.&lt;/p&gt;
&lt;p&gt;After the image is created, it can be used on the target. In case of the Raspberry Pi from this example, the file "rpi.img" can be written on an SD card using the tool "dd".&lt;/p&gt;
&lt;p&gt;Have fun!&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ingo</dc:creator><pubDate>Wed, 14 Feb 2018 13:20:37 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com14b837e3e5f9357dee1a2241a810a875fc7591fd</guid></item></channel></rss>