├── README.md ├── bookworm.pdf ├── boot.pdf ├── cron.pdf ├── ethernet-configfs.sh ├── ethernetgadget.pdf ├── fstab.pdf ├── gui-id.sh ├── mass-storage-gadget.pdf ├── nas.pdf ├── netboot0.pdf ├── set-cron.sh └── set-rc-local.sh /README.md: -------------------------------------------------------------------------------- 1 | # Guides 2 | ## End of Lift Notice: 3 | This repo will be archived on or shortly after 2025-02-28. Any new issues opened will likely be ignored. 4 | 5 | This is to protect my health (both physical and mental) and also a direct result of some of the feedback (and demands) made over the last few months. 6 | 7 | Please don't offer to take over this repo. Any such offers will be ignored. 8 | ## End notice 9 | 10 | A collection of guides on using and configuring a Raspberry Pi. 11 | 12 | | File | Contents | 13 | | ------ | ------ | 14 | | cron.pdf | Cron A - Beginner's Guide | 15 | | boot.pdf | Running A Program At Start Up - A Beginner's Guide | 16 | | ethernetgadget.pdf | USB Ethernet Gadget - A Beginner's Guide | 17 | | ethernet-configfs.sh | Shell script to accompany the above | 18 | | fstab.pdf | Using fstab - A Beginner's Guide | 19 | | mass-storage-gadget.pdf | USB Mass Storage Gadget - A Beginner's Guide | 20 | | nas.pdf | Building A Pi Based NAS | 21 | | netboot0.pdf | Network Boot A Pi Zero Via The USB Ethernet Gadget | 22 | 23 | While aimed at Raspberry Pi and Raspberry Pi OS, cron.pdf, boot.pdf, fstab.pdf, and nas.pdf are also applicable to most modern Linux distributions regardless of the hardware platform. 24 | 25 | For corrections, additions, suggestion, etc. please open an issue. 26 | 27 | Issues requesting video tutorials/guides will be summarily closed. As will any issues not relating to the Raspberry Pi. 28 | -------------------------------------------------------------------------------- /bookworm.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thagrol/Guides/c949ef9f959aa4f870aa16d424d08883ee23dca8/bookworm.pdf -------------------------------------------------------------------------------- /boot.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thagrol/Guides/c949ef9f959aa4f870aa16d424d08883ee23dca8/boot.pdf -------------------------------------------------------------------------------- /cron.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thagrol/Guides/c949ef9f959aa4f870aa16d424d08883ee23dca8/cron.pdf -------------------------------------------------------------------------------- /ethernet-configfs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## 4 | ## load libcomposite and configure an ethernet gadget 5 | ## run at boot from systemd, cron, or rc.local 6 | ## must be run as root or with sudo 7 | ## 8 | 9 | # 10 | # configuration parameters. 11 | # sensible defaults but change as desired 12 | GADGETDIR='mygadget' # full path should not be supplied 13 | SERIAL=`cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2` # Pi's serial number 14 | HOSTPREFIX="02" # hex, two digits only 15 | DEVICEPREFIX="06" # hex, two digits only 16 | MANUFACTURER="nobody" 17 | PRODUCT='nothing' 18 | INCLUDEUART=0 # set to 1 if a serial gadget is needed for troubleshooting 19 | # 20 | 21 | # calculate MAC addresses 22 | padded='00000000000000'$SERIAL 23 | for i in -10 -8 -6 -4 -2; do 24 | basemac=$basemac':'${padded: $i:2} 25 | done 26 | hostmac=$HOSTPREFIX$basemac 27 | devmac=$DEVICEPREFIX$basemac 28 | 29 | # am I root? 30 | if [ $# != 0 ]; then 31 | echo "Must be root" >&2 32 | exit 1 33 | fi 34 | 35 | modprobe libcomposite 36 | if [ $? -ne 0 ]; then 37 | echo "unable to load libcomposite, exiting" 38 | exit 1 39 | fi 40 | 41 | mkdir -p /sys/kernel/config/usb_gadget/$GADGETDIR 42 | cd /sys/kernel/config/usb_gadget/$GADGETDIR 43 | echo 0x1d6b > idVendor 44 | echo 0x0104 > idProduct 45 | echo 0x0100 > bcdDevice 46 | echo 0x0200 > bcdUSB 47 | mkdir -p strings/0x409 48 | echo $SERIAL > strings/0x409/serialnumber 49 | echo $MANUFACTURER > strings/0x409/manufacturer 50 | echo $PRODUCT > strings/0x409/product 51 | mkdir -p configs/c.1/strings/0x409 52 | echo "Config 1: ECM network" > configs/c.1/strings/0x409/configuration 53 | echo 250 > configs/c.1/MaxPower 54 | mkdir -p functions/ecm.usb0 55 | echo $hostmac > functions/ecm.usb0/host_addr 56 | echo $devmac > functions/ecm.usb0/dev_addr 57 | ln -s functions/ecm.usb0 configs/c.1/ 58 | if [ $INCLUDEUART -eq 1 ]; then 59 | mkdir -p functions/acm.usb0 60 | ln -s functions/acm.usb0 configs/c.1/ 61 | fi 62 | ls /sys/class/udc > UDC 63 | -------------------------------------------------------------------------------- /ethernetgadget.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thagrol/Guides/c949ef9f959aa4f870aa16d424d08883ee23dca8/ethernetgadget.pdf -------------------------------------------------------------------------------- /fstab.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thagrol/Guides/c949ef9f959aa4f870aa16d424d08883ee23dca8/fstab.pdf -------------------------------------------------------------------------------- /gui-id.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # simple(ish) script to idenfity which GUI desktop is in use. 4 | # currently assumes that only a single desktop will be active 5 | # and that said desktop is on the real console 6 | # 7 | # Based on a script by dom found at 8 | # https://forums.raspberrypi.com/viewtopic.php?t=383250#p2290558 9 | 10 | if pgrep labwc > /dev/null; then 11 | echo "Running Wayland and labwc" 12 | elif pgrep wayfire > /dev/null; then 13 | echo "Running Wayland and wayfire" 14 | elif pgrep Xorg > /dev/null; then 15 | if pgrep -f "lxsession -s LXDE-pi" > /dev/null; then 16 | echo "Running X11 and lxde with RPiOS UI mods." 17 | elif pgrep -f lxsession > /dev/null; then 18 | echo "Running X11 and lxde" 19 | else 20 | echo "Running X11 with non-default session/window manager" 21 | fi 22 | else 23 | echo "Unable to determine. Is the desktop running?" 24 | fi 25 | -------------------------------------------------------------------------------- /mass-storage-gadget.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thagrol/Guides/c949ef9f959aa4f870aa16d424d08883ee23dca8/mass-storage-gadget.pdf -------------------------------------------------------------------------------- /nas.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thagrol/Guides/c949ef9f959aa4f870aa16d424d08883ee23dca8/nas.pdf -------------------------------------------------------------------------------- /netboot0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thagrol/Guides/c949ef9f959aa4f870aa16d424d08883ee23dca8/netboot0.pdf -------------------------------------------------------------------------------- /set-cron.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # configure interactive shell to simulate running under cron 4 | # call from a shell running as the desired user 5 | # or via sudo -u username 6 | # or via sudo -u username 7 | 8 | pushd $HOME 9 | 10 | env -i PS1="$LOGNAME:cron test $ " HOME=$HOME LOGNAME=$LOGNAME LANG=$LANG SHELL=/bin/sh PATH=/usr/bin:/bin /bin/sh 11 | 12 | popd 13 | -------------------------------------------------------------------------------- /set-rc-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # configure interactive shell to simulate running under rc.local 4 | # does not set JOURNAL_STREAM and INVOCATION_ID 5 | # must be run as root or with sudo 6 | 7 | if [ $# != 0 ]; then 8 | echo "must be root" > /dev/stderr 9 | exit 1 10 | fi 11 | 12 | pushd / 13 | 14 | env -i PS1="rc.local test $ " TERM=linux LANG=$LANG PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin sh 15 | 16 | popd 17 | --------------------------------------------------------------------------------