Basic packages

$ sudo apt-get clean
$ sudo apt-get update -y
$ sudo apt-get dist-upgrade -y
$ sudo apt-get install gcc make git-core

Wi-Fi

Configuration

echo '
network={
    ssid="YOURSSID1"
    psk="YOURPASSWORD1"
    scan_ssid=1
}

network={
    ssid="YOURSSID2"
    psk="YOURPASSWORD2"
    scan_ssid=1
}
' >> '/etc/wpa_supplicant/wpa_supplicant.conf'
$ sudo ifdown wlan0
$ sudo ifup wlan0

Audio

$ alsamixer

Raspbian

Configuration

echo -e 'pi\npi' | passwd pi;
echo -e 'root\nroot' | passwd root;
echo 'RPI3BP' > '/etc/hostname';
rm -f '/etc/localtime';
echo 'Asia/Shanghai' > '/etc/timezone';
dpkg-reconfigure --frontend noninteractive tzdata;
echo 'en_US.UTF-8 UTF-8' > '/etc/locale.gen';
echo 'LANG=en_US.UTF-8' > '/etc/default/locale';
dpkg-reconfigure --frontend noninteractive locales;
/usr/bin/raspi-config --expand-rootfs;
$ sudo dpkg-reconfigure locales
$ sudo dpkg-reconfigure tzdata
$ sudo dpkg-reconfigure keyboard-configuration
$ sudo export LANGUAGE=en_US.UTF-8
$ sudo export LANG=en_US.UTF-8
$ sudo export LC_ALL=en_US.UTF-8
$ sudo locale-gen en_US.UTF-8

edit /etc/default/keyboard

$ sudo setxkbmap us

write to sd card

$ diskutil list
$ diskutil unmountDisk /dev/disk2
$ sudo dd if=~/Downloads/image.img of=/dev/disk2 bs=1024k

apt sources

$ sudo apt-get autoremove -y "wolfram*"
$ sudo rm -rf "/etc/apt/sources.list.d/wolfram.list"
$ sudo rm -rf "/etc/apt/sources.list.d/collabora.list"

edit /etc/apt/sources.list

deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi```

GPG error

apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 8B48AD6246925553

BCM2835

drivers

$ wget "http://www.airspayce.com/mikem/bcm2835/bcm2835-1.38.tar.gz"
$ tar zxf "bcm2835-1.38.tar.gz"
$ ./configure
$ make
$ make check
$ sudo make install

wiringPi

$ git clone "git://git.drogon.net/wiringPi"
$ cd wiringPi
$ ./build