bootloader howto
This commit is contained in:
parent
1c73229183
commit
6161624546
@ -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}
|
||||
|
291
content.tex
291
content.tex
@ -1,241 +1,102 @@
|
||||
\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}
|
||||
\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 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}
|
||||
\begin{lstlisting}
|
||||
echo "hostname" > /etc/hostname
|
||||
\end{lstlisting}
|
||||
\textbf{Note:} Any tag which shouldn't trigger a release build must not match
|
||||
these regular expression rules.
|
||||
|
||||
\section{Applications}
|
||||
\subsection{I2C-OLED}
|
||||
\subsubsection{Oled Test application}
|
||||
Clone test application:
|
||||
\begin{lstlisting}
|
||||
git clone git@dabgit01.internal.novero.com:raspberry/\
|
||||
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}
|
||||
|
||||
\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}
|
||||
|
||||
\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}
|
||||
|
Loading…
Reference in New Issue
Block a user