Raspberry OS setup

From FlightGear wiki
Jump to navigation Jump to search

Raspberry PI

The Raspberry Pi is a series of small single-board computers developed in the United Kingdom by the Raspberry Pi Foundation to promote the teaching of basic computer science in schools and in developing countries. [Raspberry Pi Wiki]

Raspberry Pi Generation 3

Latest Generation (4th generation) are provided with :

  • Broadcom BCM2711, Quad core Cortex-A72 (ARM v8) 64-bit SoC @ 1.5GHz
  • OpenGL ES 3.0 graphics
  • 1GB, 2GB or 4GB SDRAM (depending on model)
  • 40 Pin I/O connector

Linux operating system can be deployed on this board. I/O connector give access to some interesting buses as like the I2C.

OS setup

FG interface is not packaged in the form of a distribution. You will need to install an OS before deploying FG Interface.
In order to be on to be always up to date, I have chosen the official distribution of raspberry: Raspbian.
There is no problem in using other distribution (Pidora, archlinux ... etc) with FG Interface, as long as Python 3 and its smbus modules (I2C management) are available.

Download Raspbian

So, first step will be to download Raspbian distribution. [Download Raspbian]

Download the RASPBIAN JESSIE LITE version (Zip file)

Unzip & Burn the Raspbian

You have now to unzip & burn the image on sd card. So plugin your SD Card into your card reader. The SD card will be totally erased, so if you have content in it, make backup now.

I have formated & writing the img with the Win32DiskImager tool under Windows but under linux you can use [Etcher].
More details on installation procedure : https://www.raspberrypi.org/documentation/installation/installing-images/README.md.

Raspbian downloaded Unzip Raspbian Unzip Raspbian

Win32DiskImager tool Win32DiskImager select img to burn & drive where SD card is loadedd Starting burning the image on sd card

Burning IMG OK

Start SSH Daemon at Boot time

By Default, ssh daemon is not anymore active by default.
To activate the ssh daemon at boot time, you need to add an empty file named ssh (without any extension) on the /boot partition of your SD Card

Set SSH file to start sshd daemon at boot

You can now plugin your sd card into your raspberry pi

Boot raspberry and 1st connexion

Plug your RJ45 network interface & plug power.
If you have not connected a screen to the Raspberry, you must determine the IP address that was assigned to your Raspberry. To do this, you must consult the DHCP leases that have been issued in the management interface of your box or router.
All you need is a Putty type client under windows, or the terminal under linux to connect to the Raspberry.

1st time raspberry is booted, you have to log in with the following credentials :

  • user : pi
  • password : raspberry

Using Putty Windows Client

Download & install the Putty Client : [Download Putty].

Start Putty

Starting Putty Client

  • Set IP address your found for your Raspberry Pi in Host Name (or IP Address)
  • Set Port : 22
  • Set Connection Type : SSH

Set IP address your found for your raspberry, check that ssh is tick.

  • Click Open
login as: pi
pi@192.168.0.130's password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Jun 15 19:54:08 2017 from 192.168.0.248

SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

pi@raspberrypi:~ $

Using Ssh client under linux

Open a terminal and call ssh client :

daweed@FARMERSALOON ~ $ ssh pi@192.168.0.130
pi@192.168.0.130's password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Jun 15 19:54:08 2017 from 192.168.0.248

SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

pi@raspberrypi:~ $

Update & Upgrade Raspbian

Update Repository

pi@raspberrypi:~ $ sudo apt-get update
Get:1 http://archive.raspberrypi.org jessie InRelease [22.9 kB]
Get:2 http://mirrordirector.raspbian.org jessie InRelease [14.9 kB]
Get:3 http://mirrordirector.raspbian.org jessie/main armhf Packages [9,533 kB]
Get:4 http://archive.raspberrypi.org jessie/main armhf Packages [163 kB]
Get:5 http://archive.raspberrypi.org jessie/ui armhf Packages [57.9 kB]
Ign http://archive.raspberrypi.org jessie/main Translation-en_GB
Ign http://archive.raspberrypi.org jessie/main Translation-en
Ign http://archive.raspberrypi.org jessie/ui Translation-en_GB
Ign http://archive.raspberrypi.org jessie/ui Translation-en
Get:6 http://mirrordirector.raspbian.org jessie/contrib armhf Packages [43.3 kB]
Get:7 http://mirrordirector.raspbian.org jessie/non-free armhf Packages [84.2 kB]
Get:8 http://mirrordirector.raspbian.org jessie/rpi armhf Packages [1,356 B]
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en
Ign http://mirrordirector.raspbian.org jessie/main Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/main Translation-en
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en
Fetched 9,920 kB in 51s (193 kB/s)
Reading package lists... Done

pi@raspberrypi:~ $

Upgrade the system

pi@raspberrypi:~ $ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  bind9-host binutils ca-certificates initramfs-tools libbind9-90 libc-bin libc-dev-bin libc6 libc6-dbg libc6-dev libdns-export100 libdns100
  libgnutls-deb0-28 libgnutls-openssl27 libicu52 libirs-export91 libisc-export95 libisc95 libisccc90 libisccfg-export90 libisccfg90 libldap-2.4-2
  liblwres90 libraspberrypi-bin libraspberrypi-dev libraspberrypi-doc libraspberrypi0 librtmp1 libsystemd0 libtasn1-6 libtirpc1 libudev1
  libwbclient0 locales login multiarch-support passwd perl perl-base perl-modules raspberrypi-bootloader raspberrypi-kernel raspberrypi-sys-mods
  raspi-config rpcbind samba-common sudo systemd systemd-sysv tzdata udev unzip vim-common vim-tiny wget
55 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 109 MB of archives.
After this operation, 4,494 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y

  raspi-config rpcbind samba-common sudo systemd systemd-sysv tzdata udev unzip vim-common vim-tiny wget
55 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 109 MB of archives.
After this operation, 4,494 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.raspberrypi.org/debian/ jessie/main raspberrypi-sys-mods armhf 20170519 [8,662 B]
Get:2 http://archive.raspberrypi.org/debian/ jessie/main libraspberrypi-dev armhf 1.20170427-1 [401 kB]
Get:3 http://mirrordirector.raspbian.org/raspbian/ jessie/main login armhf 1:4.2-3+deb8u4 [716 kB]
Get:4 http://archive.raspberrypi.org/debian/ jessie/main libraspberrypi-doc armhf 1.20170427-1 [31.4 MB]
Get:5 http://mirrordirector.raspbian.org/raspbian/ jessie/main perl armhf 5.20.2-3+deb8u7 [2,073 kB]
Get:6 http://mirrordirector.raspbian.org/raspbian/ jessie/main libc6-dev armhf 2.19-18+deb8u9 [1,724 kB]
Get:7 http://mirrordirector.raspbian.org/raspbian/ jessie/main perl-base armhf 5.20.2-3+deb8u7 [1,102 kB]
Get:8 http://mirrordirector.raspbian.org/raspbian/ jessie/main libc6-dbg armhf 2.19-18+deb8u9 [3,178 kB]
Get:9 http://mirrordirector.raspbian.org/raspbian/ jessie/main libc-dev-bin armhf 2.19-18+deb8u9 [231 kB]
Get:10 http://mirrordirector.raspbian.org/raspbian/ jessie/main multiarch-support armhf 2.19-18+deb8u9 [181 kB]
Get:11 http://mirrordirector.raspbian.org/raspbian/ jessie/main libbind9-90 armhf 1:9.9.5.dfsg-9+deb8u11 [41.5 kB]
...
Get:50 http://mirrordirector.raspbian.org/raspbian/ jessie/main sudo armhf 1.8.10p3-1+deb8u4 [830 kB]
Get:51 http://mirrordirector.raspbian.org/raspbian/ jessie/main unzip armhf 6.0-16+deb8u3 [142 kB]
Get:52 http://archive.raspberrypi.org/debian/ jessie/main libraspberrypi-bin armhf 1.20170427-1 [334 kB]
Get:53 http://archive.raspberrypi.org/debian/ jessie/main libraspberrypi0 armhf 1.20170427-1 [844 kB]
Get:54 http://archive.raspberrypi.org/debian/ jessie/main raspberrypi-bootloader armhf 1.20170427-1 [3,303 kB]
Get:55 http://archive.raspberrypi.org/debian/ jessie/main raspi-config all 20170503 [18.8 kB]
Fetched 109 MB in 3min 11s (566 kB/s)
Reading changelogs... Done
Extracting templates from packages: 100%
Preconfiguring packages ...
(Reading database ... 31449 files and directories currently installed.)
Preparing to unpack .../login_1%3a4.2-3+deb8u4_armhf.deb ...
Unpacking login (1:4.2-3+deb8u4) over (1:4.2-3+deb8u3) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up login (1:4.2-3+deb8u4) ...
...
Setting up libraspberrypi-bin (1.20170427-1) ...
Setting up raspi-config (20170503) ...
Processing triggers for libc-bin (2.19-18+deb8u9) ...
Processing triggers for initramfs-tools (0.120+deb8u3) ...
Processing triggers for ca-certificates (20141019+deb8u3) ...
Updating certificates in /etc/ssl/certs... 0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d....done.
pi@raspberrypi:~ $

Reboot the Raspberry Pi and login after reboot

pi@raspberrypi:~ $ sudo reboot

Create the fgint group and user

Create a user that will own interface on the raspberry.

pi@raspberrypi:~ $ sudo groupadd fgint
pi@raspberrypi:~ $ sudo useradd -c 'Flightgear Interface User' -d /home/fgint -m -s /bin/bash -g fgint fgint
pi@raspberrypi:~ $ sudo passwd fgint 
Enter new UNIX password:
Retype new UNIX password:
pi@raspberrypi:~ $ sudo usermod -G spi,i2c,gpio,input,adm,sudo fgint
pi@raspberrypi:~ $ id fgint
uid=1001(fgint) gid=1001(fgint) groups=1001(fgint),4(adm),27(sudo),101(input),999(spi),998(i2c),997(gpio)
pi@raspberrypi:~ $

It is very important that the user fgint belongs to the spi, i2c, gpio, input, adm and sudo groups in order to have access to the necessary resources of Raspberry for the correct functioning of the software part and to avoid operating the interface With user pi or root