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{mathrsfs}%
\usepackage{hyperref}%
\usepackage{xcolor}%
\usepackage[dvipsnames]{xcolor}%
\usepackage{scrpage2}%
\usepackage{multido}
\usepackage{pstricks}
\usepackage{colortbl}
\newcommand*\euler{\mathrm{e}}
\input{title.tex}

View File

@ -1,241 +1,216 @@
\section{Installation}
\subsection{SD card preparation}
\subsubsection{Partitions}
Format the SD card with two new partitions:
\lstsetbash
\begin{lstlisting}
fdisk /dev/mmcblk0
\end{lstlisting}
\section{Bootloader}
To build a bootloader for the project \textit{moray white 2} you have to do the
following steps:\\
\begin{enumerate}
\item Type \textbf{o} to erase all former partitions
\item Type \textbf{p} to list all existing partitions
\item Type \textbf{n}, then \textbf{p} to create the boot partition. Press
\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
\item check/edit build job file
\item check/edit configuration file
\item create release tag in gitlab
\end{enumerate}
\subsubsection{File systems}
Create the file systems for the new partitions:
\begin{lstlisting}
mkfs.vfat /dev/mmcblk0p1
mkfs.ext4 /dev/mmcblk0p2
\end{lstlisting}
Create mount points and mount the new partitions:
\begin{lstlisting}
mkdir boot
mkdir root
mount /dev/mmcblk0p1 boot
mount /dev/mmcblk0p2 root
\end{lstlisting}
\subsection{Build job file}
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:
\subsubsection{Download and extract root file system}
\begin{lstlisting}
wget http://archlinuxarm.org/os/\
ArchLinuxARM-rpi-2-latest.tar.gz
bsdtar -xpf ArchLinuxARM-rpi-2-latest.tar.gz -C root
sync
mv root/boot/* boot
\end{lstlisting}
Enable ssh root login:
\begin{lstlisting}
vim root/etc/ssh/sshd\_config
\end{lstlisting}
Find \texttt{\#PermitRootLogin yes} and uncommend it
\begin{lstlisting}
PermitRootLogin yes
\end{lstlisting}
Unmount both partitions
\begin{lstlisting}
umount boot root
\end{lstlisting}
\section{Configuration}
\subsection{User management}
\subsubsection{Create new user}
\begin{lstlisting}
useradd -m -g users -G wheel -s /bin/bash tkl
\end{lstlisting}
\captionof{table}{Values for build configutation}
\label{tab:var_build_confs}
\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:
\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}
passwd tkl
variables:
PROJECT: "white2-dbg"
...
\end{lstlisting}
Enable wheel group members as sudoers:
\begin{lstlisting}
EDITOR=vim visudo
\end{lstlisting}
Uncomment:
\begin{lstlisting}
%wheel ALL=(ALL) ALL
variables:
PROJECT: "white2-rel"
...
\end{lstlisting}
\subsection{Aliasing}
\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}
cd ~
vi .bashrc
moray/config/<build_config>/
\end{lstlisting}
Add:\\
\texttt{alias vi='vim'}
Amongst others informations regarding version numbers, deploy file names and
deploy locations are encapsulated in the \texttt{postlink} target.
\subsection{Customize vim}
Edit \texttt{.vimrc}:
\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}
syntax on "Syntax highlightning
set number "Line numbering
...
<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}
\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_BL_42_[0-9]+\.[0-9]+\.[0-9]+_RC[0-9]+
\end{lstlisting}
\subsection{Wifi}
Configure wifi network:
\textbf{Example}
\begin{lstlisting}
wifi-menu
\end{lstlisting}
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
release/white2/MO_BL_42_0.0.0_RC0
release/white2/MO_BL_42_255.255.255_RC255
\end{lstlisting}
\subsection{Ssh key login}
\begin{itemize}
\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:
\subsubsection{Release}
To create a release the tag name must match the following regular expression:
\begin{lstlisting}
cat id_rsa.pub >> authorized_keys
\end{lstlisting}
\end{itemize}
\subsection{Interfaces}
\subsubsection{I2C}
To enable i2c interface edit \texttt{/boot/config.txt}. \\
Uncomment \texttt{\#device\_tree\_param=i2c\_arm=on}\\
Load i2c modules while boot:
\begin{lstlisting}
/etc/modules-load.d/raspberry.conf
i2c-dev
i2c-bcm2708
\end{lstlisting}
Install package \texttt{i2c-tools}
Test i2c bus after reboot:
\begin{lstlisting}
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"
^release/white2/MO_BL_42_[0-9]+\.[0-9]+\.[0-9]+
\end{lstlisting}
\subsubsection{SPI}
To enable spi interface edit \texttt{/boot/config.txt}. \\
Uncomment \texttt{\#device\_tree\_param=spi=on}
\subsubsection{GPIO}
Create an udev rule to enable others than root accessing the gpio files:
\textbf{Example}
\begin{lstlisting}
/etc/udev/rules.d/98-gpio.rules
SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c 'chown -R root:gpio\
/sys/class/gpio; chmod -R 0777 /sys/class/gpio; chown -R \
root:gpio /sys/devices/virtual/gpio; chmod -R 0777 \
/sys/devices/virtual/gpio'"
release/white2/MO_BL_42_0.0.0
release/white2/MO_BL_42_255.255.255
\end{lstlisting}
\subsection{tools}
\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}
\textbf{Note:} Any tag which shouldn't trigger a release build must not match
these regular expression rules.
\section{Application}
For application building in the project \textit{moray white 2} the same steps as
for bootloader building are necessary:\\
\begin{enumerate}
\item check/edit build job file
\item check/edit configuration file
\item create release tag in gitlab
\end{enumerate}
\subsection{Build job file}
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}
echo "hostname" > /etc/hostname
variables:
PROJECT: "white2-dbg"
...
\end{lstlisting}
\begin{lstlisting}
variables:
PROJECT: "white2-rel"
...
\end{lstlisting}
\section{Applications}
\subsection{I2C-OLED}
\subsubsection{Oled Test application}
Clone test application:
\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}
git clone git@dabgit01.internal.novero.com:raspberry/\
oledpi.git
config/<build_config>/
\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}
Amongst others informations regarding version numbers, bootloader location,
deploy file names and deploy locations are encapsulated in the \texttt{postlink}
target.
\subsection{Weatherpi}
\subsubsection{Usb weatherstation test application}
Clone test application:
\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\\
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}
git clone git@dabgit01.internal.novero.com:raspberry/\
weatherpi.git
...
<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}
\subsubsection{Dependencies}
\begin{itemize}
\item \texttt{python2-pyusb} (AUR) (edit \texttt{PKGBUILD} and add
\texttt{'armv7h'} to \texttt{arch})
\item \texttt{libusb-compat}
\end{itemize}
\textbf{Example}
\begin{lstlisting}
release/white2/MO_WC_42_0.0.0_RC0
release/white2/MO_WC_42_255.255.255_RC255
\end{lstlisting}
\subsection{MQTT Broker}
Install mosquitto (AUR)\\
Install paho-mqtt client library:\\
\subsubsection{Release}
To create a release the tag name must match the following regular expression:
\begin{lstlisting}
pip2 install paho-mqtt
^release/white2/MO_WC_42_[0-9]+\.[0-9]+\.[0-9]+
\end{lstlisting}
Create config file:
\textbf{Example}
\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"
release/white2/MO_WC_42_0.0.0
release/white2/MO_WC_42_255.255.255
\end{lstlisting}
\textbf{Note:} Any tag which shouldn't trigger a release build must not match
these regular expression rules.

View File

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