shost description of agricola release porcess
This commit is contained in:
		
							
								
								
									
										264
									
								
								content.tex
									
									
									
									
									
								
							
							
						
						
									
										264
									
								
								content.tex
									
									
									
									
									
								
							@@ -1,241 +1,41 @@
 | 
			
		||||
\section{Installation}
 | 
			
		||||
\subsection{SD card preparation}
 | 
			
		||||
\subsubsection{Partitions}
 | 
			
		||||
Format the SD card with two new partitions:
 | 
			
		||||
\lstsetbash
 | 
			
		||||
\section*{Agricola Release HowTo}
 | 
			
		||||
\subsection*{Create release branch}
 | 
			
		||||
A push event to a \textit{release/...} named branch will create release
 | 
			
		||||
candidates. These release candidates are deployed to agricola's project svn.
 | 
			
		||||
(\texttt{http://dabsvn01.internal.novero.com/svn/\ \\
 | 
			
		||||
0\_31X\_P0070\_agricola/trunk/development/software/\ \\
 | 
			
		||||
releases/release\_candidate/})\\
 | 
			
		||||
Checkout the new release branch:
 | 
			
		||||
\begin{lstlisting}
 | 
			
		||||
fdisk /dev/mmcblk0
 | 
			
		||||
git checkout -b release/<release_name>
 | 
			
		||||
\end{lstlisting}
 | 
			
		||||
\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
 | 
			
		||||
\end{enumerate}
 | 
			
		||||
 | 
			
		||||
\subsubsection{File systems}
 | 
			
		||||
Create the file systems for the new partitions:
 | 
			
		||||
Prepare build variables in the \textit{variables} section of the build job
 | 
			
		||||
file\\(\texttt{.gitlab-ci.yml} in agricola's root directory).
 | 
			
		||||
\begin{lstlisting}
 | 
			
		||||
mkfs.vfat /dev/mmcblk0p1
 | 
			
		||||
mkfs.ext4 /dev/mmcblk0p2
 | 
			
		||||
variables:
 | 
			
		||||
  PRODUCT_NAME: "AG"
 | 
			
		||||
  PRODUCT_VARIANT: "NA"
 | 
			
		||||
#  PRODUCT_VARIANT: "EU"
 | 
			
		||||
#  PRODUCT_VARIANT: "CN"
 | 
			
		||||
  PROJECT_VERSION: "10"
 | 
			
		||||
  SW_MAJOR: "1"
 | 
			
		||||
  SW_MINOR: "2"
 | 
			
		||||
\end{lstlisting}
 | 
			
		||||
Create mount points and mount the new partitions:
 | 
			
		||||
Push the new branch to the gitlab-server:
 | 
			
		||||
\begin{lstlisting}
 | 
			
		||||
mkdir boot
 | 
			
		||||
mkdir root
 | 
			
		||||
mount /dev/mmcblk0p1 boot
 | 
			
		||||
mount /dev/mmcblk0p2 root
 | 
			
		||||
git push --set-upstream release/<release_name> origin \
 | 
			
		||||
release/<release_name>
 | 
			
		||||
\end{lstlisting}
 | 
			
		||||
 | 
			
		||||
\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}
 | 
			
		||||
\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}
 | 
			
		||||
 | 
			
		||||
\subsection{Aliasing}
 | 
			
		||||
\begin{lstlisting}
 | 
			
		||||
cd ~
 | 
			
		||||
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}
 | 
			
		||||
 | 
			
		||||
\subsection{Wifi}
 | 
			
		||||
Configure wifi network:
 | 
			
		||||
\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
 | 
			
		||||
\end{lstlisting}
 | 
			
		||||
 | 
			
		||||
\subsection{Ssh key login}
 | 
			
		||||
\subsection*{Create release tag}
 | 
			
		||||
A \textit{release/174\_AG...} named tag in the agricola repository at the
 | 
			
		||||
gitlab server will create a release and deploys it to the agricola project
 | 
			
		||||
svn repository. To create the tag:
 | 
			
		||||
\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:
 | 
			
		||||
\begin{lstlisting}
 | 
			
		||||
cat id_rsa.pub >> authorized_keys
 | 
			
		||||
\end{lstlisting}
 | 
			
		||||
\item go to agricola's gitlab tags section \\
 | 
			
		||||
(\texttt{https://novgit05.novero.com/agricola/agricola/tags})
 | 
			
		||||
\item Hit the \textit{+ New tag} button
 | 
			
		||||
\item Choose a valid tag name \textit{(release/174\_AG...)}
 | 
			
		||||
\item Choose the above created release branch as source for the new tag.
 | 
			
		||||
\item Hit the \textit{Create tag} button
 | 
			
		||||
\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"
 | 
			
		||||
\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:
 | 
			
		||||
\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'"
 | 
			
		||||
\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}
 | 
			
		||||
 | 
			
		||||
\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}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user