Skip to content

Instantly share code, notes, and snippets.

@kanchudeep
Last active January 24, 2021 22:28
Show Gist options
  • Save kanchudeep/056f08b12e4dd7b5e6c8f44cafc2c1ad to your computer and use it in GitHub Desktop.
Save kanchudeep/056f08b12e4dd7b5e6c8f44cafc2c1ad to your computer and use it in GitHub Desktop.
Boot from USB:
1. Set SoC's OTP (One Time Programmable) memory for USB boot by executing:
echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt
2. After reboot you can check OTP has been programmed with:
vcgencmd otp_dump | grep 17
* Should return output: 17:3020000a
Build EDuke32:
1. Install dependencies:
sudo apt install build-essential flac freepats libflac-dev libgl1-mesa-dev \
libglu1-mesa-dev libgtk2.0-dev libsdl1.2-dev libsdl2-dev \
libsdl2-mixer-dev libsdl-mixer1.2-dev libvorbis-dev libvpx-dev nasm
2. Build:
make NOASM=1
make SDL_TARGET=1
make POLYMER=0 USE_OPENGL=0 NOASM=1
make USE_OPENGL=0 NOASM=1 LINKED_GTK=0 USE_LIBPNG=0
Build IOQuake3:
1. Install dependencies:
sudo apt install gcc build-essential libsdl2-2.0-0
2. Download source from:
https://codeload.github.com/raspberrypi/quake3/zip/master
3. In the source directory in file 'build_rpi_raspbian.sh' on line 35:
a. Remove '-lvmcs_rpc_client'.
b. Change '-lEGL -lGLESv2' to '-lbrcmEGL -lbrcmGLESv2'.
4. From the directory of source run:
./build_rpi_raspbian.sh
5. Copy '.pk?' files to 'build/release-linux-arm/baseq3'.
6. Update your permissions for directFB access:
sudo usermod -a -G video $(whoami)
7. Game files are under: './build/release-linux-arm/'.
Configure as Samba based NAS:
1. Install required packages:
sudo apt install samba samba-common-bin
2. Configure:
a. Open file:
sudo nano /etc/samba/smb.conf
b. Set following parameters under '[global]':
workgroup = WORKGROUP
wins support = yes
c. Append to the end:
[RaspberryPi NAS]
comment = Pi Server
public = yes
writeable = yes
browsable = yes
path = /path/to/share
create mask = 0755
directory mask = 0777
3. Restart service:
sudo service smbd restart
Configure as stand alone Wireless Access Point:
1. Install required packages:
sudo apt install dnsmasq hostapd
2. Since they are not configured, turn new software off:
sudo systemctl stop dnsmasq
sudo systemctl stop hostapd
3. Configure the static IP address:
a. Edit dhcpcd configuration file:
sudo nano /etc/dhcpcd.conf
b. Append to the end of the file:
interface wlan0
static ip_address=192.168.0.1/24
nohook wpa_supplicant
4. Restart the dhcpcd daemon:
sudo service dhcpcd restart
5. Configuring the DHCP server (dnsmasq):
a. Create a new configuration file:
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
sudo nano /etc/dnsmasq.conf
b. Add the following:
interface=wlan0
dhcp-range=192.168.0.2,192.168.0.21,255.255.255.0,24h
6. Configure the access point host software (hostapd):
a. Edit configuration file:
sudo nano /etc/hostapd/hostapd.conf
b. Add the following:
interface=wlan0
driver=nl80211
ssid=NameOfNetwork
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=AardvarkBadgerHedgehog
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP TKIP
rsn_pairwise=CCMP
c. Update hostapd default:
i. Open file:
sudo nano /etc/default/hostapd
ii. Edit line with '#DAEMON_CONF' to:
DAEMON_CONF="/etc/hostapd/hostapd.conf"
7. Start the services:
sudo systemctl start hostapd
sudo systemctl start dnsmasq
8. Add Routing and Masquerade:
a. Edit /etc/sysctl.conf:
sudo nano /etc/sysctl.conf
b. Uncomment this line:
net.ipv4.ip_forward=1
c. Add a masquerade for outbound traffic on eth0:
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
d. Save the iptables rule:
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
e.
i. Edit /etc/rc.local:
sudo nano /etc/rc.local
ii. Add just above "exit 0" to install rules on boot:
iptables-restore < /etc/iptables.ipv4.nat
* https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md
Connect UART GNSS receiver:
1. Connect pins:
[UART] -> [Pi]
3.3V -> Pin 1
5V -> Pin 2
GND -> Pin 6
RX -> Pin 8
TX -> Pin 10
2. Enable serial interface:
a. Under 'raspi-config' open 'Interface options > Serial'.
b. Select 'No' to 'Do you want console'.
c. Select 'Yes' to 'Do you want serial device'.
d. Reboot.
3. Device available under '/dev/serial0'.
Connect & use RTC (DS3231):
1. Connect module:
[RTC] -> [Pi]
3.3V -> Pin 1
SDA -> Pin 3
SCL -> Pin 5
-
GND -> Pin 9
2. Edit '/boot/config.txt' and append:
dtoverlay=i2c-rtc,ds3231
3. Edit '/lib/udev/hwclock-set' and modify to:
#if [ -e /run/systemd/system ] ; then
# exit 0
#fi
4. Reboot and check RTC with:
sudo hwclock -r # Read time directly from RTC module
* Other commands:
sudo hwclock -w # Update module time from system time
sudo hwclodk -s # Update system time from module time
sudo hwclock -c # Monitor drift between system time and module time
Get audio working in GQRX:
1. In 'Receiver Options' tab, to the right of 'Mode' dropdown, click the
'...' button.
2. Deselect 'DCR'.
Get current CPU frequencies:
sudo cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq
Install Dump1090-mutability:
Download and install latest deb:
https://github.com/mutability/dump1090/releases
Install FlightRadar24 data feeder:
1. Download and install deb from:
https://www.flightradar24.com/share-your-data
* Last version: https://repo-feed.flightradar24.com/rpi_binaries/fr24feed_1.0.19-15_armhf.deb
2. Run signup:
sudo fr24feed --signup
3. Install dump1090:
sudo /usr/lib/fr24/install_dump1090.sh
4. Restart service:
sudo systemctl restart fr24feed
* URLs:
http://<ip address>:8754/
http://<ip address>/dump1090/
* Account signup:
https://www.flightradar24.com/premium/signup?account=free
Install GQRX:
1. Get latest version from: http://gqrx.dk/download/gqrx-sdr-for-the-raspberry-pi
https://github.com/csete/gqrx/releases/download/v2.11.5/gqrx-sdr-2.11.5-linux-rpi3.tar.xz
2. Install dependencies:
sudo apt update
sudo apt install gnuradio gr-iqbal libportaudio2 libqt5svg5 libusb-1.0-0 libvolk1-bin qt5-default
3. Extract the downloaded GQRX archive to '/opt/gqrx-sdr'.
4. Copy the UDEV rules in '/opt/gqrx-sdr/udev' to '/etc/udev/rules.d':
sudo cp /opt/gqrx-sdr/udev/*.rules /etc/udev/rules.d/
5. Start GQRX:
/opt/gqrx-sdr/gqrx
Install MotionEye:
1. Install dependencies:
sudo apt install ffmpeg v4l-utils libmariadbclient18 libpq5 python-pip python-dev libssl-dev libcurl4-openssl-dev libjpeg-dev libz-dev
2. Install motion:
wget https://github.com/Motion-Project/motion/releases/download/release-4.1.1/pi_stretch_motion_4.1.1-1_armhf.deb
sudo dpkg -i pi_stretch_motion_4.1.1-1_armhf.deb
3. Install motionEye:
sudo pip install motioneye
4. Prepare configuration directory:
sudo mkdir -pv /etc/motioneye
sudo cp -v /usr/local/share/motioneye/extra/motioneye.conf.sample /etc/motioneye/motioneye.conf
5. Prepare media directory:
sudo mkdir -pv /var/lib/motioneye
6. Add init script, configured to run at startup and start motionEye server:
sudo cp -v /usr/local/share/motioneye/extra/motioneye.systemd-unit-local /etc/systemd/system/motioneye.service
sudo systemctl daemon-reload
sudo systemctl enable motioneye
sudo systemctl start motioneye
Packages on fresh install:
Add:
sudo apt install audacious exfat-* gparted gnome-disk-utility gnome-screenshot
Remove:
sudo apt purge bluej* greenfoot* idle* nodered* scratch* sonic-pi* squeak* python3-thonny* wolfram-engine* claws-mail* minecraft*
Write Raspbian image:
1. GNU/Linux:
sudo dd if=filename.img of=/dev/mmcblkX bs=4M status=progress conv=fsync
unzip -p filename.img.zip | sudo dd of=/dev/mmcblkX bs=4M status=progress conv=fsync
7z e -so filename.img.7z | sudo dd of=/dev/mmcblkX bs=4M status=progress conv=fsync
p7zip -c -d filename.img.zip | sudo dd of=/dev/mmcblkX bs=4M status=progress conv=fsync
2. Windows:
a. Download the Raspbian Stretch image ZIP file:
https://downloads.raspberrypi.org/raspbian_latest
b. Extract the ZIP file to get the image.
c. Download Rufus (software to write disk image file to SD card):
https://rufus.akeo.ie/downloads/rufus-3.1p.exe
d. Insert your SD card (making sure it is writeable).
e. Write disk image with Rufus:
i. Run Rufus.
ii. In 'Device' make sure the SD card is selected.
iii. In 'Boot selection' make sure 'Disk or ISO image (Please select)' is selected.
iv. Click 'SELECT' button and select the disk image.
v. Click 'START'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment