Installazione Raspberry Pi

Da Caos per caso.
Jump to navigation Jump to search

Abilitazione di SSH

cd /boot
touch ssh # per abilitare SSH
sudo raspi-config # per entrare nel tool di configurazione

Configurare IP statico

Connessione WiFi

Create il file wpa_supplicant.conf nella partizione di boot.

country=it
update_config=1
ctrl_interface=/var/run/wpa_supplicant

network={
    scan_ssid=1
    ssid="WiFiName"
    psk="password"
    key_mgmt=WPA-PSK
}

Oppure dal Raspberry in /etc/wpa_supplicant/wpa_supplicant.conf

Assegnazione dell'IP

In fondo al file /etc/dhcpcd.conf aggiungere:

interface wlan0
static ip_address=192.168.100.43/24
static routers=192.168.100.1
static domain_name_servers=192.168.100.1 8.8.8.8

Gestione delle immagini disco

Creazione e backup delle immagini disco

# Elenco delle schede SD montate
sudo fdisk -l
# Installazione scheda SD
sudo dd bs=4M if=raspbian-stretch.img of=/dev/sdb status=progress conv=fsync
# Backup scheda SD
sudo dd bs=4M if=/dev/sdb of=image-`date +%Y%m%d`.img status=progress
# Create a smaller image of the SD...
sudo dd bs=4M status=progress if=/dev/sdb | gzip > image-`date +%Y%m%d`.gz
# ...and restore it
sudo gzip -dc image.gz | dd bs=4M of=/dev/sdb status=progress


Montare un file img

fdisk -l /path/to/image

Mostra:

Disk Stick.img: 3984 MB, 3984588800 bytes
249 heads, 6 sectors/track, 5209 cylinders, total 7782400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0004bfaa

   Device Boot      Start         End      Blocks   Id  System
Stick.img1   *         128     8015999     4007936    b  W95 FAT32

So I have a block-size of 512 bytes and the start-block is 128. The offset is 512 * 128 = 65536. So the mount command would be

Code:

mount -o loop,offset=65536 Stick.img /mnt/tmp

Configurazione dell'ambiente

Configurazione dell'ambiente

Per rendere python3 default vedi: [1]

Attivare le connessioni della Raspberry tramite raspi-config:

P4 SPI         Enable/Disable automatic loading of SPI kernel module
P5 I2C         Enable/Disable automatic loading of I2C kernel module

Installazione Software

sudo apt-get install vim

Installazione librerie

sudo apt-get install python3-smbus