Compare commits

...

2 Commits

Author SHA1 Message Date
Thomas Klaehn
6088c8eb2a wip 2016-12-08 11:05:11 +01:00
Thomas Klaehn
6161624546 bootloader howto 2016-10-14 15:22:03 +02:00
3 changed files with 182 additions and 204 deletions

View File

@ -20,8 +20,11 @@ citecolor = black]{hyperref}%
\usepackage{amsfonts}% \usepackage{amsfonts}%
\usepackage{mathrsfs}% \usepackage{mathrsfs}%
\usepackage{hyperref}% \usepackage{hyperref}%
\usepackage{xcolor}% \usepackage[dvipsnames]{xcolor}%
\usepackage{scrpage2}% \usepackage{scrpage2}%
\usepackage{multido}
\usepackage{pstricks}
\usepackage{colortbl}
\newcommand*\euler{\mathrm{e}} \newcommand*\euler{\mathrm{e}}
\input{title.tex} \input{title.tex}

View File

@ -1,241 +1,216 @@
\section{Installation} \section{Bootloader}
\subsection{SD card preparation} To build a bootloader for the project \textit{moray white 2} you have to do the
\subsubsection{Partitions} following steps:\\
Format the SD card with two new partitions:
\lstsetbash
\begin{lstlisting}
fdisk /dev/mmcblk0
\end{lstlisting}
\begin{enumerate} \begin{enumerate}
\item Type \textbf{o} to erase all former partitions \item check/edit build job file
\item Type \textbf{p} to list all existing partitions \item check/edit configuration file
\item Type \textbf{n}, then \textbf{p} to create the boot partition. Press \item create release tag in gitlab
\textbf{RETURN} to accept the first sector, then \textbf{+100M} for the
last sector
\item Type \textbf{t}, then \textbf{c} to set the partition type to FAT32
\item Type \textbf{n}, then \textbf{p} to create the root partition. Press
\textbf{RETURN} to accept the first sector, then \textbf{RETURN} for the
last sector
\item Type \textbf{w} to write the new partition table
\end{enumerate} \end{enumerate}
\subsubsection{File systems} \subsection{Build job file}
Create the file systems for the new partitions: The build job file (\texttt{.gitlab-ci.yml}) could be found in the root
directory of the repository. Here only the build configuration is done. In the
\texttt{variables} Section the variable \texttt{PROJECT} contains the current
build configuration.\\
Possible build configurations:
\captionof{table}{Values for build configutation}
\label{tab:var_build_confs}
\begin{tabular}{l l}
\cellcolor{black}\color{white}build config & \cellcolor{black}\color{white}meaning \\
white2-dbg & use the debug configuration to build the release\\
white2-rel & use the release configuration to build the release\\\\
\end{tabular}
\textbf{Example}
\lstsetbash
\begin{lstlisting} \begin{lstlisting}
mkfs.vfat /dev/mmcblk0p1 variables:
mkfs.ext4 /dev/mmcblk0p2 PROJECT: "white2-dbg"
...
\end{lstlisting} \end{lstlisting}
Create mount points and mount the new partitions:
\begin{lstlisting} \begin{lstlisting}
mkdir boot variables:
mkdir root PROJECT: "white2-rel"
mount /dev/mmcblk0p1 boot ...
mount /dev/mmcblk0p2 root
\end{lstlisting} \end{lstlisting}
\subsubsection{Download and extract root file system} \subsection{Configuration file}
The configuration file (\texttt{configuration.xml}) depends on the build
configuration (\texttt{white2-dbg} or \texttt{white2-rel}) and could be found
in following folder (relative to the repositories root folder):\\
\begin{lstlisting} \begin{lstlisting}
wget http://archlinuxarm.org/os/\ moray/config/<build_config>/
ArchLinuxARM-rpi-2-latest.tar.gz
bsdtar -xpf ArchLinuxARM-rpi-2-latest.tar.gz -C root
sync
mv root/boot/* boot
\end{lstlisting} \end{lstlisting}
Enable ssh root login: Amongst others informations regarding version numbers, deploy file names and
deploy locations are encapsulated in the \texttt{postlink} target.
\captionof{table}{Release relevant attributes in configuration file}
\label{tab:conf_vars}
\begin{tabular}{l l}
\cellcolor{black}\color{white}attributes & \cellcolor{black}\color{white}meaning \\
OUT\_EXECUTABLE\_NAME & file name for the bootloader executable\\
REL\_VERSION & version numbering scheme\\
OUT\_DEPLOY\_PATH & subversion link to deploy the release to\\\\
\end{tabular}
It's usually enough to change \texttt{OUT\_EXECUTABLE\_NAME} and
\texttt{REL\_VERSION} according to the release numbering scheme.\\\\
\textbf{Example}
\begin{lstlisting} \begin{lstlisting}
vim root/etc/ssh/sshd\_config ...
<attribute name="OUT_EXECUTABLE_NAME"
value="MO_BL_42_3.0.6_dbg.S19"/>
<attribute name="REL_VERSION"
value="42.3.0.6"/>
<attribute name="OUT_DEPLOY_PATH"
value="http://dabsvn01.internal.novero.com/svn/\
0_31X_P0521_moray_white2/trunk/development/\
software/releases/WTC/"/>
...
\end{lstlisting} \end{lstlisting}
Find \texttt{\#PermitRootLogin yes} and uncommend it \subsection{Create release tag in gitlab}
To create a release candidate a tag in gitlab has to be created. Of course this
could be done either locally (don't forget to push the tag) or by using the
gitlab ui.
\subsubsection{Release candidate}
To create a release candidate the tag name must match the following regular
expression:
\begin{lstlisting} \begin{lstlisting}
PermitRootLogin yes ^release/white2/MO_BL_42_[0-9]+\.[0-9]+\.[0-9]+_RC[0-9]+
\end{lstlisting}
Unmount both partitions
\begin{lstlisting}
umount boot root
\end{lstlisting} \end{lstlisting}
\section{Configuration} \textbf{Example}
\subsection{User management}
\subsubsection{Create new user}
\begin{lstlisting} \begin{lstlisting}
useradd -m -g users -G wheel -s /bin/bash tkl release/white2/MO_BL_42_0.0.0_RC0
\end{lstlisting} release/white2/MO_BL_42_255.255.255_RC255
\begin{tabular}{ l l }
\texttt{-m} & create user name home directory\\
\texttt{-g} & initial login group\\
\texttt{-G} & list of supplementary groups - comma separated\\
\texttt{-s} & path and file name of default login shell\\
\end{tabular}\\
Set password for the new user:
\begin{lstlisting}
passwd tkl
\end{lstlisting}
Enable wheel group members as sudoers:
\begin{lstlisting}
EDITOR=vim visudo
\end{lstlisting}
Uncomment:
\begin{lstlisting}
%wheel ALL=(ALL) ALL
\end{lstlisting} \end{lstlisting}
\subsection{Aliasing} \subsubsection{Release}
To create a release the tag name must match the following regular expression:
\begin{lstlisting} \begin{lstlisting}
cd ~ ^release/white2/MO_BL_42_[0-9]+\.[0-9]+\.[0-9]+
vi .bashrc
\end{lstlisting}
Add:\\
\texttt{alias vi='vim'}
\subsection{Customize vim}
Edit \texttt{.vimrc}:
\begin{lstlisting}
syntax on "Syntax highlightning
set number "Line numbering
\end{lstlisting} \end{lstlisting}
\subsection{Wifi} \textbf{Example}
Configure wifi network:
\begin{lstlisting} \begin{lstlisting}
wifi-menu release/white2/MO_BL_42_0.0.0
\end{lstlisting} release/white2/MO_BL_42_255.255.255
Enable wifi network permanent:
\begin{lstlisting}
netctl enable wlan0-<network_name>
\end{lstlisting}
\subsubsection{Deactivate wifi device sleep mode}
\begin{lstlisting}
pacman -S iw
echo ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan*", \
RUN+="/usr/bin/iw dev \%k set power\_save off\" \
> etc/udev/rules.d/70-wifi-powersave.rules
\end{lstlisting} \end{lstlisting}
\subsection{Ssh key login} \textbf{Note:} Any tag which shouldn't trigger a release build must not match
\begin{itemize} these regular expression rules.
\item Create \texttt{.ssh/} folder in users home directory
\item Copy public key file (i.e. \texttt{id\_rsa.pub}) into \texttt{.ssh}
folder
\item Authorize public key:
\begin{lstlisting}
cat id_rsa.pub >> authorized_keys
\end{lstlisting}
\end{itemize}
\subsection{Interfaces} \section{Application}
\subsubsection{I2C} For application building in the project \textit{moray white 2} the same steps as
To enable i2c interface edit \texttt{/boot/config.txt}. \\ for bootloader building are necessary:\\
Uncomment \texttt{\#device\_tree\_param=i2c\_arm=on}\\ \begin{enumerate}
Load i2c modules while boot: \item check/edit build job file
\begin{lstlisting} \item check/edit configuration file
/etc/modules-load.d/raspberry.conf \item create release tag in gitlab
\end{enumerate}
i2c-dev \subsection{Build job file}
i2c-bcm2708 The build job file (\texttt{.gitlab-ci.yml}) could be found in the root
\end{lstlisting} directory of the repository. Here only the build configuration is done. In the
Install package \texttt{i2c-tools} \texttt{variables} Section the variable \texttt{PROJECT} contains the current
Test i2c bus after reboot: build configuration.\\
\begin{lstlisting} Possible build configurations:
i2cdetect -y 1
\end{lstlisting}
Set permissions for i2c device access:
\begin{lstlisting}
/etc/udev/rules.d/99-i2c.rules
KERNEL=="i2c-1", MODE="0777" \captionof{table}{Values for build configutation}
\label{tab:var_build_confs}
\begin{tabular}{l l}
\cellcolor{black}\color{white}build config & \cellcolor{black}\color{white}meaning \\
white2-dbg & use the debug configuration to build the release\\
white2-rel & use the release configuration to build the release\\\\
\end{tabular}
\textbf{Example}
\lstsetbash
\begin{lstlisting}
variables:
PROJECT: "white2-dbg"
...
\end{lstlisting}
\begin{lstlisting}
variables:
PROJECT: "white2-rel"
...
\end{lstlisting} \end{lstlisting}
\subsubsection{SPI} \subsection{Configuration file}
To enable spi interface edit \texttt{/boot/config.txt}. \\ The configuration file (\texttt{configuration.xml}) depends on the build
Uncomment \texttt{\#device\_tree\_param=spi=on} configuration (\texttt{white2-dbg} or \texttt{white2-rel}) and could be found
in following folder (relative to the repositories root folder):\\
\subsubsection{GPIO}
Create an udev rule to enable others than root accessing the gpio files:
\begin{lstlisting} \begin{lstlisting}
/etc/udev/rules.d/98-gpio.rules config/<build_config>/
\end{lstlisting}
Amongst others informations regarding version numbers, bootloader location,
deploy file names and deploy locations are encapsulated in the \texttt{postlink}
target.
SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c 'chown -R root:gpio\ \captionof{table}{Release relevant attributes in configuration file}
/sys/class/gpio; chmod -R 0777 /sys/class/gpio; chown -R \ \label{tab:conf_vars}
root:gpio /sys/devices/virtual/gpio; chmod -R 0777 \ \begin{tabular}{l l}
/sys/devices/virtual/gpio'" \cellcolor{black}\color{white}attributes & \cellcolor{black}\color{white}meaning \\
OUT\_EXECUTABLE\_NAME & file name for the bootloader executable\\
REL\_VERSION & version numbering scheme\\
IN\_BOOTLOADER\_URL & path to the bootloader url containing the\\
& regarding bootloader executable\\
OUT\_DEPLOY\_PATH & subversion link to deploy the release to\\\\
\end{tabular}
It's usually enough to change \texttt{OUT\_EXECUTABLE\_NAME} and
\texttt{REL\_VERSION} according to the release numbering scheme. Only in case of
a changed bootloader the \texttt{IN\_BOOTLOADER\_URL} has to be changed.\\\\
\textbf{Example}
\begin{lstlisting}
...
<attribute name="OUT_EXECUTABLE_NAME"
value="MO_BL_42_3.0.6_dbg.S19"/>
<attribute name="REL_VERSION"
value="42.3.0.6"/>
<attribute name="IN_BOOTLOADER_URL" value="http://\
dabsvn01/svn/0_31X_P0521_moray_white2/trunk/\
development/software/releases/WTC/Bootloader/\
MO_BL_42_3.1.6.S19"/>
<attribute name="OUT_DEPLOY_PATH"
value="http://dabsvn01.internal.novero.com/svn/\
0_31X_P0521_moray_white2/trunk/development/\
software/releases/WTC/"/>
...
\end{lstlisting}
\subsection{Create release tag in gitlab}
To create a release candidate a tag in gitlab has to be created. Of course this
could be done either locally (don't forget to push the tag) or by using the
gitlab ui.
\subsubsection{Release candidate}
To create a release candidate the tag name must match the following regular
expression:
\begin{lstlisting}
^release/white2/MO_WC_42_[0-9]+\.[0-9]+\.[0-9]+_RC[0-9]+
\end{lstlisting} \end{lstlisting}
\subsection{tools} \textbf{Example}
\begin{itemize}
\item \texttt{fakeroot}
\item \texttt{gcc}
\item \texttt{git}
\item \texttt{make}
\item \texttt{patch}
\item \texttt{python2, python2-pip}
\item \texttt{wget}
\end{itemize}
\subsection{Hostname}
\begin{lstlisting} \begin{lstlisting}
echo "hostname" > /etc/hostname release/white2/MO_WC_42_0.0.0_RC0
release/white2/MO_WC_42_255.255.255_RC255
\end{lstlisting} \end{lstlisting}
\section{Applications} \subsubsection{Release}
\subsection{I2C-OLED} To create a release the tag name must match the following regular expression:
\subsubsection{Oled Test application}
Clone test application:
\begin{lstlisting} \begin{lstlisting}
git clone git@dabgit01.internal.novero.com:raspberry/\ ^release/white2/MO_WC_42_[0-9]+\.[0-9]+\.[0-9]+
oledpi.git
\end{lstlisting}
\subsubsection{Install driver}
Clone oled driver:
\begin{lstlisting}
git clone https://github.com/rm-hull/ssd1306.git
\end{lstlisting}
Install it:
\begin{lstlisting}
python2 setup.py install
\end{lstlisting}
\subsubsection{Dependencies}
\begin{itemize}
\item \texttt{python-smbus/python2-smbus} (AUR)
\item \texttt{i2c-tool-git} (AUR)
\item \texttt{libjpeg-turbo}
\item \texttt{pillow} install using pip \texttt{(pip/pip2 install pillow)}
\end{itemize}
\subsection{Weatherpi}
\subsubsection{Usb weatherstation test application}
Clone test application:
\begin{lstlisting}
git clone git@dabgit01.internal.novero.com:raspberry/\
weatherpi.git
\end{lstlisting} \end{lstlisting}
\subsubsection{Dependencies} \textbf{Example}
\begin{itemize} \begin{lstlisting}
\item \texttt{python2-pyusb} (AUR) (edit \texttt{PKGBUILD} and add release/white2/MO_WC_42_0.0.0
\texttt{'armv7h'} to \texttt{arch}) release/white2/MO_WC_42_255.255.255
\item \texttt{libusb-compat} \end{lstlisting}
\end{itemize}
\textbf{Note:} Any tag which shouldn't trigger a release build must not match
these regular expression rules.
\subsection{MQTT Broker}
Install mosquitto (AUR)\\
Install paho-mqtt client library:\\
\begin{lstlisting}
pip2 install paho-mqtt
\end{lstlisting}
Create config file:
\begin{lstlisting}
cp /etc/mosquitto.conf.example /etc/mosquitto.conf
\end{lstlisting}
Start mosquitto broker service:
\begin{lstlisting}
systemctl enable mosquitto.service
systemctl start mosquitto.service
\end{lstlisting}
\subsubsection{Test}
Subscribe to a topic:
\begin{lstlisting}
mosquitto_sub -t "topic/path"
\end{lstlisting}
Populate a message:
\begin{lstlisting}
mosquitto_pub -t "topic/path" -m "message payload"
\end{lstlisting}

View File

@ -1,4 +1,4 @@
\newcommand{\docname}{HowTo} \newcommand{\docname}{Create release}
\newcommand{\prjname}{arch linux on raspberry pi} \newcommand{\prjname}{moray white2}
\newcommand{\docversion}{0.1} \newcommand{\docversion}{0.1}
\newcommand{\docauthor}{Thomas Klaehn} \newcommand{\docauthor}{Thomas Klaehn}