├── stage0 ├── 01-locale │ ├── 00-packages │ └── 00-debconf ├── 00-configure-apt │ ├── 01-packages │ ├── files │ │ ├── 51cache │ │ ├── raspi.list │ │ ├── sources.list │ │ └── raspberrypi.gpg.key │ └── 00-run.sh ├── 02-firmware │ └── 01-packages ├── files │ └── raspberrypi.gpg └── prerun.sh ├── stage1 ├── 02-net-tweaks │ ├── 00-packages │ └── 00-run.sh ├── 01-sys-tweaks │ ├── 00-packages │ ├── 00-patches │ │ ├── series │ │ └── 01-bashrc.diff │ ├── files │ │ ├── noclear.conf │ │ └── fstab │ └── 00-run.sh ├── prerun.sh ├── 03-install-packages │ └── 00-packages └── 00-boot-files │ ├── files │ ├── cmdline.txt │ └── config.txt │ └── 00-run.sh ├── stage5 ├── 01-sys-tweaks │ ├── files │ │ ├── i2c.conf │ │ ├── configServer_run │ │ ├── wpilibws-romi_log_run │ │ ├── romi.json │ │ ├── wpilibws-romi_run │ │ ├── romi-sayid.sh │ │ ├── resize2fs_once │ │ ├── romi_sayid │ │ └── uploadRomi.py │ ├── 00-packages │ └── 01-run.sh ├── prerun.sh ├── 02-net-tweaks │ ├── files │ │ ├── dnsmasq.conf │ │ └── hostapd.conf │ └── 01-run.sh └── EXPORT_IMAGE ├── export-image ├── 01-user-rename │ ├── 00-packages │ └── 01-run.sh ├── 03-network │ ├── files │ │ └── resolv.conf │ └── 01-run.sh ├── 02-set-sources │ └── 01-run.sh ├── 00-allow-rerun │ └── 00-run.sh ├── 04-set-partuuid │ └── 00-run.sh ├── prerun.sh └── 05-finalise │ └── 01-run.sh ├── stage4 ├── 01-sys-tweaks │ ├── files │ │ ├── picamera.conf │ │ ├── runService │ │ ├── configServer_run │ │ ├── camera_log_run │ │ ├── runInteractive │ │ ├── make.exe │ │ ├── camera_run │ │ ├── runCamera │ │ └── frc.json │ └── 01-run.sh ├── EXPORT_IMAGE ├── prerun.sh └── 02-net-tweaks │ ├── files │ ├── wpa_supplicant.conf │ └── raspi-blacklist.conf │ ├── 00-packages │ └── 01-run.sh ├── deps ├── tools │ ├── .clang │ ├── configServer │ │ ├── src │ │ │ ├── resources │ │ │ │ ├── romi_ext_io.png │ │ │ │ └── frcvision.css │ │ │ ├── WebSocketHandlers.h │ │ │ ├── VisionSettings.h │ │ │ ├── MyHttpConnection.h │ │ │ ├── Application.h │ │ │ ├── UploadHelper.h │ │ │ ├── SystemStatus.h │ │ │ ├── DataHistory.h │ │ │ ├── VisionSettings.cpp │ │ │ ├── NetworkSettings.h │ │ │ ├── VisionStatus.h │ │ │ ├── RomiStatus.h │ │ │ ├── UploadHelper.cpp │ │ │ ├── main.cpp │ │ │ ├── Application.cpp │ │ │ ├── SystemStatus.cpp │ │ │ ├── MyHttpConnection.cpp │ │ │ └── VisionStatus.cpp │ │ ├── gen_resource.py │ │ └── Makefile │ ├── setuidgids │ │ ├── Makefile │ │ └── src │ │ │ └── setuidgids.c │ ├── multiCameraServer │ │ ├── Makefile │ │ └── src │ │ │ └── multiCameraServer.cpp │ └── .clang-format └── examples │ ├── java-multiCameraServer │ ├── install.sh │ ├── runCamera │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── build.gradle │ ├── README.txt │ ├── gradlew.bat │ └── gradlew │ ├── cpp-multiCameraServer │ ├── runCamera │ ├── Makefile │ └── README.txt │ └── python-multiCameraServer │ ├── runCamera │ ├── README.txt │ └── multiCameraServer.py ├── stage2 ├── 01-sys-tweaks │ ├── files │ │ ├── ttyoutput.conf │ │ ├── bash.logout │ │ ├── 90-qemu.rules │ │ ├── ld.so.conf.d │ │ │ └── java_libs.conf │ │ ├── 50raspi │ │ ├── console-setup │ │ ├── rc.local │ │ ├── bash.bashrc │ │ ├── resize2fs_once │ │ └── jdk-11.0.1.jinfo │ ├── 00-packages-nr │ ├── 00-patches │ │ ├── series │ │ ├── 07-resize-init.diff │ │ ├── 04-inputrc.diff │ │ ├── 02-swap.diff │ │ ├── 01-useradd.diff │ │ └── 05-path.diff │ ├── 00-packages │ ├── 01-run.sh │ └── 00-debconf ├── prerun.sh ├── 03-set-timezone │ └── 02-run.sh └── 00-configure-apt │ └── 00-run.sh ├── .dockerignore ├── stage3 ├── prerun.sh └── 01-sys-tweaks │ ├── files │ ├── ld.so.conf.d │ │ └── frc_libs.conf │ ├── profile.d │ │ └── frc_pkgconfig.sh │ ├── rules.d │ │ └── pixy.rules │ ├── pkgconfig │ │ ├── wpimath.pc │ │ ├── wpiutil.pc │ │ ├── wpinet.pc │ │ ├── apriltag.pc │ │ ├── wpilibc.pc │ │ ├── cameraserver.pc │ │ ├── ntcore.pc │ │ └── cscore.pc │ └── FindJNI.cmake │ ├── 00-packages-nr │ └── 00-packages ├── docker-compose.yml ├── .gitignore ├── scripts ├── remove-comments.sed ├── dependencies_check ├── common └── qcow2_handling ├── config ├── depends ├── azure-docker └── Dockerfile ├── Dockerfile ├── azure-pipelines.yml ├── ThirdPartyNotices.txt ├── LICENSE.md └── imagetool.sh /stage0/01-locale/00-packages: -------------------------------------------------------------------------------- 1 | locales 2 | -------------------------------------------------------------------------------- /stage1/02-net-tweaks/00-packages: -------------------------------------------------------------------------------- 1 | netbase 2 | -------------------------------------------------------------------------------- /stage5/01-sys-tweaks/files/i2c.conf: -------------------------------------------------------------------------------- 1 | i2c-dev 2 | -------------------------------------------------------------------------------- /stage1/01-sys-tweaks/00-packages: -------------------------------------------------------------------------------- 1 | raspi-config 2 | -------------------------------------------------------------------------------- /export-image/01-user-rename/00-packages: -------------------------------------------------------------------------------- 1 | userconf-pi 2 | -------------------------------------------------------------------------------- /stage1/01-sys-tweaks/00-patches/series: -------------------------------------------------------------------------------- 1 | 01-bashrc.diff 2 | -------------------------------------------------------------------------------- /stage4/01-sys-tweaks/files/picamera.conf: -------------------------------------------------------------------------------- 1 | bcm2835_v4l2 2 | -------------------------------------------------------------------------------- /export-image/03-network/files/resolv.conf: -------------------------------------------------------------------------------- 1 | nameserver 8.8.8.8 2 | -------------------------------------------------------------------------------- /stage0/00-configure-apt/01-packages: -------------------------------------------------------------------------------- 1 | raspberrypi-archive-keyring 2 | -------------------------------------------------------------------------------- /deps/tools/.clang: -------------------------------------------------------------------------------- 1 | -std=c++11 -I../allwpilib/src/main/native/include 2 | -------------------------------------------------------------------------------- /stage1/01-sys-tweaks/files/noclear.conf: -------------------------------------------------------------------------------- 1 | [Service] 2 | TTYVTDisallocate=no 3 | -------------------------------------------------------------------------------- /stage2/01-sys-tweaks/files/ttyoutput.conf: -------------------------------------------------------------------------------- 1 | [Service] 2 | StandardOutput=tty 3 | -------------------------------------------------------------------------------- /stage0/00-configure-apt/files/51cache: -------------------------------------------------------------------------------- 1 | Acquire::http { Proxy "APT_PROXY"; }; 2 | -------------------------------------------------------------------------------- /stage0/02-firmware/01-packages: -------------------------------------------------------------------------------- 1 | raspberrypi-bootloader 2 | raspberrypi-kernel 3 | -------------------------------------------------------------------------------- /stage4/01-sys-tweaks/files/runService: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | sudo svc -u /service/camera 3 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | output/ 2 | work/ 3 | deploy/ 4 | apt-cacher-ng/ 5 | .git/objects/* 6 | -------------------------------------------------------------------------------- /stage4/01-sys-tweaks/files/configServer_run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /usr/local/sbin/configServer 3 | -------------------------------------------------------------------------------- /stage5/01-sys-tweaks/00-packages: -------------------------------------------------------------------------------- 1 | avrdude 2 | hostapd 3 | dnsmasq 4 | espeak 5 | python3-serial 6 | -------------------------------------------------------------------------------- /stage4/01-sys-tweaks/files/camera_log_run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /usr/local/frc/bin/netconsoleTee -u 3 | -------------------------------------------------------------------------------- /stage5/01-sys-tweaks/files/configServer_run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /usr/local/sbin/configServer --romi 3 | -------------------------------------------------------------------------------- /stage1/prerun.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | if [ ! -d "${ROOTFS_DIR}" ]; then 4 | copy_previous 5 | fi 6 | -------------------------------------------------------------------------------- /stage2/01-sys-tweaks/files/bash.logout: -------------------------------------------------------------------------------- 1 | sudo mount -o remount,ro / 2 | sudo mount -o remount,ro /boot 3 | -------------------------------------------------------------------------------- /stage2/prerun.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | if [ ! -d "${ROOTFS_DIR}" ]; then 4 | copy_previous 5 | fi 6 | -------------------------------------------------------------------------------- /stage3/prerun.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | if [ ! -d "${ROOTFS_DIR}" ]; then 4 | copy_previous 5 | fi 6 | -------------------------------------------------------------------------------- /stage4/EXPORT_IMAGE: -------------------------------------------------------------------------------- 1 | if [ "${USE_QEMU}" = "1" ]; then 2 | export IMG_SUFFIX="${IMG_SUFFIX}-qemu" 3 | fi 4 | -------------------------------------------------------------------------------- /stage4/prerun.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | if [ ! -d "${ROOTFS_DIR}" ]; then 4 | copy_previous 5 | fi 6 | -------------------------------------------------------------------------------- /stage5/prerun.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | if [ ! -d "${ROOTFS_DIR}" ]; then 4 | copy_previous 5 | fi 6 | -------------------------------------------------------------------------------- /stage0/files/raspberrypi.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpilibsuite/WPILibPi/HEAD/stage0/files/raspberrypi.gpg -------------------------------------------------------------------------------- /stage2/01-sys-tweaks/00-packages-nr: -------------------------------------------------------------------------------- 1 | cifs-utils 2 | libcamera-apps-lite 3 | mkvtoolnix 4 | python3-picamera2 5 | -------------------------------------------------------------------------------- /stage3/01-sys-tweaks/files/ld.so.conf.d/frc_libs.conf: -------------------------------------------------------------------------------- 1 | /usr/local/frc/lib 2 | /usr/local/frc/third-party/lib 3 | -------------------------------------------------------------------------------- /stage3/01-sys-tweaks/files/profile.d/frc_pkgconfig.sh: -------------------------------------------------------------------------------- 1 | export PKG_CONFIG_PATH=/usr/local/frc/lib/pkgconfig 2 | -------------------------------------------------------------------------------- /stage5/02-net-tweaks/files/dnsmasq.conf: -------------------------------------------------------------------------------- 1 | interface=wlan0 2 | dhcp-range=10.0.0.100,10.0.0.200,255.255.255.0,5m 3 | -------------------------------------------------------------------------------- /stage5/01-sys-tweaks/files/wpilibws-romi_log_run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /usr/local/frc/bin/netconsoleTee -u -p 7777 3 | -------------------------------------------------------------------------------- /stage4/01-sys-tweaks/files/runInteractive: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sudo svc -d /service/camera 3 | sleep 1 4 | exec ./runCamera 5 | -------------------------------------------------------------------------------- /stage1/03-install-packages/00-packages: -------------------------------------------------------------------------------- 1 | libraspberrypi-bin libraspberrypi0 raspi-config ca-certificates 2 | systemd-timesyncd 3 | -------------------------------------------------------------------------------- /stage4/01-sys-tweaks/files/make.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpilibsuite/WPILibPi/HEAD/stage4/01-sys-tweaks/files/make.exe -------------------------------------------------------------------------------- /deps/examples/java-multiCameraServer/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cp build/libs/java-multiCameraServer-all.jar runCamera /home/pi 3 | -------------------------------------------------------------------------------- /stage1/00-boot-files/files/cmdline.txt: -------------------------------------------------------------------------------- 1 | console=serial0,115200 console=tty1 root=ROOTDEV rootfstype=ext4 fsck.repair=yes rootwait 2 | -------------------------------------------------------------------------------- /stage2/01-sys-tweaks/00-patches/series: -------------------------------------------------------------------------------- 1 | 01-useradd.diff 2 | 02-swap.diff 3 | 04-inputrc.diff 4 | 05-path.diff 5 | 07-resize-init.diff 6 | -------------------------------------------------------------------------------- /deps/examples/cpp-multiCameraServer/runCamera: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "Waiting 5 seconds..." 3 | sleep 5 4 | exec ./multiCameraServerExample 5 | -------------------------------------------------------------------------------- /stage4/01-sys-tweaks/files/camera_run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd /home/pi 3 | exec 2>&1 4 | exec pgrphack /usr/local/bin/setuidgids pi ./runCamera 5 | -------------------------------------------------------------------------------- /stage4/02-net-tweaks/files/wpa_supplicant.conf: -------------------------------------------------------------------------------- 1 | ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev 2 | update_config=1 3 | country=US 4 | -------------------------------------------------------------------------------- /stage2/01-sys-tweaks/files/90-qemu.rules: -------------------------------------------------------------------------------- 1 | KERNEL=="sda", SYMLINK+="mmcblk0" 2 | KERNEL=="sda?", SYMLINK+="mmcblk0p%n" 3 | KERNEL=="sda2", SYMLINK+="root" 4 | -------------------------------------------------------------------------------- /stage4/02-net-tweaks/files/raspi-blacklist.conf: -------------------------------------------------------------------------------- 1 | #wifi 2 | blacklist brcmfmac 3 | blacklist brcmutil 4 | #bt 5 | blacklist btbcm 6 | blacklist hci_uart 7 | -------------------------------------------------------------------------------- /stage5/EXPORT_IMAGE: -------------------------------------------------------------------------------- 1 | export IMG_SUFFIX="${IMG_SUFFIX}-Romi" 2 | 3 | if [ "${USE_QEMU}" = "1" ]; then 4 | export IMG_SUFFIX="${IMG_SUFFIX}-qemu" 5 | fi 6 | -------------------------------------------------------------------------------- /deps/tools/configServer/src/resources/romi_ext_io.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpilibsuite/WPILibPi/HEAD/deps/tools/configServer/src/resources/romi_ext_io.png -------------------------------------------------------------------------------- /stage2/01-sys-tweaks/files/ld.so.conf.d/java_libs.conf: -------------------------------------------------------------------------------- 1 | /usr/lib/jvm/jdk-11.0.1/lib/jli 2 | /usr/lib/jvm/jdk-11.0.1/lib/minimal 3 | /usr/lib/jvm/jdk-11.0.1/lib 4 | -------------------------------------------------------------------------------- /stage4/01-sys-tweaks/files/runCamera: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ### TYPE: builtin 3 | echo "Waiting 5 seconds..." 4 | sleep 5 5 | exec /usr/local/frc/bin/multiCameraServer 6 | -------------------------------------------------------------------------------- /deps/examples/python-multiCameraServer/runCamera: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "Waiting 5 seconds..." 3 | sleep 5 4 | export PYTHONUNBUFFERED=1 5 | exec ./multiCameraServer.py 6 | -------------------------------------------------------------------------------- /stage1/00-boot-files/00-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | install -m 644 files/cmdline.txt "${ROOTFS_DIR}/boot/" 4 | install -m 644 files/config.txt "${ROOTFS_DIR}/boot/" 5 | -------------------------------------------------------------------------------- /deps/examples/java-multiCameraServer/runCamera: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "Waiting 5 seconds..." 3 | sleep 5 4 | exec env LD_LIBRARY_PATH=/usr/local/frc/lib java -jar java-multiCameraServer-all.jar 5 | -------------------------------------------------------------------------------- /deps/examples/java-multiCameraServer/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpilibsuite/WPILibPi/HEAD/deps/examples/java-multiCameraServer/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /stage5/01-sys-tweaks/files/romi.json: -------------------------------------------------------------------------------- 1 | { 2 | "ioConfig": ["dio", "ain", "ain", "pwm", "pwm"], 3 | "gyroZeroOffset": { 4 | "x": 0, 5 | "y": 0, 6 | "z": 0 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /deps/tools/setuidgids/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all clean 2 | 3 | all: setuidgids 4 | 5 | clean: 6 | rm -f setuidgids 7 | 8 | setuidgids: src/setuidgids.c 9 | ${CC} -O -Wall -D_GNU_SOURCE -o $@ $^ 10 | -------------------------------------------------------------------------------- /stage3/01-sys-tweaks/00-packages-nr: -------------------------------------------------------------------------------- 1 | libopenblas-dev liblapacke-dev 2 | libavcodec-dev libavformat-dev libswscale-dev libavresample-dev 3 | libgtk-3-dev 4 | libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev 5 | -------------------------------------------------------------------------------- /stage2/01-sys-tweaks/files/50raspi: -------------------------------------------------------------------------------- 1 | # never use pdiffs. Current implementation is very slow on low-powered devices 2 | Acquire::PDiffs "0"; 3 | 4 | # download up to 5 pdiffs: 5 | #Acquire::PDiffs::FileLimit "5"; 6 | -------------------------------------------------------------------------------- /stage4/02-net-tweaks/00-packages: -------------------------------------------------------------------------------- 1 | wpasupplicant wireless-tools firmware-atheros firmware-brcm80211 firmware-libertas firmware-misc-nonfree firmware-realtek 2 | raspberrypi-net-mods 3 | dhcpcd5 4 | network-manager 5 | net-tools 6 | -------------------------------------------------------------------------------- /stage2/03-set-timezone/02-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | echo "${TIMEZONE_DEFAULT}" > "${ROOTFS_DIR}/etc/timezone" 4 | rm "${ROOTFS_DIR}/etc/localtime" 5 | 6 | on_chroot << EOF 7 | dpkg-reconfigure -f noninteractive tzdata 8 | EOF 9 | -------------------------------------------------------------------------------- /stage0/00-configure-apt/files/raspi.list: -------------------------------------------------------------------------------- 1 | deb http://archive.raspberrypi.org/debian/ RELEASE main 2 | # Uncomment line below then 'apt-get update' to enable 'apt-get source' 3 | #deb-src http://archive.raspberrypi.org/debian/ RELEASE main 4 | -------------------------------------------------------------------------------- /stage3/01-sys-tweaks/files/rules.d/pixy.rules: -------------------------------------------------------------------------------- 1 | # Pixy device, set permissions 2 | SUBSYSTEM=="usb", ATTR{idVendor}=="b1ac", ATTR{idProduct}=="f000", MODE="0666" 3 | SUBSYSTEM=="usb", ATTR{idVendor}=="1fc9", ATTR{idProduct}=="000c", MODE="0666" 4 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | apt-cacher-ng: 5 | restart: unless-stopped 6 | image: sameersbn/apt-cacher-ng:latest 7 | ports: 8 | - "3142:3142" 9 | volumes: 10 | - ./apt-cacher-ng:/var/cache/apt-cacher-ng 11 | -------------------------------------------------------------------------------- /export-image/02-set-sources/01-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | rm -f "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" 4 | find "${ROOTFS_DIR}/var/lib/apt/lists/" -type f -delete 5 | on_chroot << EOF 6 | apt-get update 7 | apt-get -y dist-upgrade 8 | apt-get clean 9 | EOF 10 | -------------------------------------------------------------------------------- /stage5/01-sys-tweaks/files/wpilibws-romi_run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd /home/pi 3 | exec 2>&1 4 | exec pgrphack /usr/local/bin/setuidgids pi \ 5 | /home/pi/.nvm/versions/node/v14.15.0/bin/node \ 6 | /home/pi/.nvm/versions/node/v14.15.0/bin/wpilibws-romi -c /boot/romi.json 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | deploy/* 2 | work/* 3 | postrun.sh 4 | SKIP 5 | SKIP_IMAGES 6 | .pc 7 | *-pc 8 | apt-cacher-ng/ 9 | deps/tools/configServer/configServer 10 | deps/tools/multiCameraServer/multiCameraServer 11 | deps/tools/setuidgids/setuidgids 12 | *.o 13 | *.sw? 14 | *.debug 15 | -------------------------------------------------------------------------------- /stage1/02-net-tweaks/00-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | echo "${TARGET_HOSTNAME}" > "${ROOTFS_DIR}/etc/hostname" 4 | echo "127.0.1.1 ${TARGET_HOSTNAME}" >> "${ROOTFS_DIR}/etc/hosts" 5 | 6 | on_chroot << EOF 7 | SUDO_USER="${FIRST_USER_NAME}" raspi-config nonint do_net_names 1 8 | EOF 9 | -------------------------------------------------------------------------------- /stage4/01-sys-tweaks/files/frc.json: -------------------------------------------------------------------------------- 1 | { 2 | "team": 294, 3 | "cameras": [ 4 | { 5 | "name": "rPi Camera 0", 6 | "path": "/dev/video0", 7 | "pixel format": "mjpeg", 8 | "width": 160, 9 | "height": 120, 10 | "fps": 30 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /export-image/01-user-rename/01-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | if [[ "${DISABLE_FIRST_BOOT_USER_RENAME}" == "0" ]]; then 4 | on_chroot <<- EOF 5 | SUDO_USER="${FIRST_USER_NAME}" rename-user -f -s 6 | EOF 7 | else 8 | rm -f "${ROOTFS_DIR}/etc/xdg/autostart/piwiz.desktop" 9 | fi 10 | -------------------------------------------------------------------------------- /deps/examples/java-multiCameraServer/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=permwrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=permwrapper/dists 6 | -------------------------------------------------------------------------------- /stage5/02-net-tweaks/files/hostapd.conf: -------------------------------------------------------------------------------- 1 | interface=wlan0 2 | hw_mode=g 3 | channel=6 4 | wmm_enabled=0 5 | macaddr_acl=0 6 | auth_algs=1 7 | ignore_broadcast_ssid=0 8 | ssid=WPILibPi 9 | wpa=2 10 | wpa_key_mgmt=WPA-PSK 11 | wpa_pairwise=TKIP 12 | rsn_pairwise=CCMP 13 | wpa_passphrase=WPILib2021! 14 | -------------------------------------------------------------------------------- /export-image/00-allow-rerun/00-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | if [ ! -x "${ROOTFS_DIR}/usr/bin/qemu-arm-static" ]; then 4 | cp /usr/bin/qemu-arm-static "${ROOTFS_DIR}/usr/bin/" 5 | fi 6 | 7 | if [ -e "${ROOTFS_DIR}/etc/ld.so.preload" ]; then 8 | mv "${ROOTFS_DIR}/etc/ld.so.preload" "${ROOTFS_DIR}/etc/ld.so.preload.disabled" 9 | fi 10 | -------------------------------------------------------------------------------- /scripts/remove-comments.sed: -------------------------------------------------------------------------------- 1 | # Deletes comments and collapses whitespace in ##-packages files 2 | 3 | # Append (N)ext line to buffer 4 | # if (!)not ($)buffer is EOF, (b)ranch to (:)label loop 5 | :loop 6 | N 7 | $ !b loop 8 | 9 | # Buffer is "line1\nline2\n...lineN", del comments and collapse whitespace 10 | s/#[^\n]*//g 11 | s/[[:space:]]\{1,\}/ /g 12 | -------------------------------------------------------------------------------- /stage2/01-sys-tweaks/00-patches/07-resize-init.diff: -------------------------------------------------------------------------------- 1 | --- stage2.orig/rootfs/boot/cmdline.txt 2 | +++ stage2/rootfs/boot/cmdline.txt 3 | @@ -1 +1 @@ 4 | -console=serial0,115200 console=tty1 root=ROOTDEV rootfstype=ext4 fsck.repair=yes rootwait 5 | +console=serial0,115200 console=tty1 root=ROOTDEV rootfstype=ext4 fsck.repair=yes rootwait quiet init=/usr/lib/raspberrypi-sys-mods/firstboot 6 | -------------------------------------------------------------------------------- /stage0/prerun.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | if [ "$RELEASE" != "bullseye" ]; then 4 | echo "WARNING: RELEASE does not match the intended option for this branch." 5 | echo " Please check the relevant README.md section." 6 | fi 7 | 8 | if [ ! -d "${ROOTFS_DIR}" ] || [ "${USE_QCOW2}" = "1" ]; then 9 | bootstrap ${RELEASE} "${ROOTFS_DIR}" http://deb.debian.org/debian/ 10 | fi 11 | -------------------------------------------------------------------------------- /stage2/01-sys-tweaks/files/console-setup: -------------------------------------------------------------------------------- 1 | # CONFIGURATION FILE FOR SETUPCON 2 | 3 | # Consult the console-setup(5) manual page. 4 | 5 | ACTIVE_CONSOLES="/dev/tty[1-6]" 6 | 7 | CHARMAP="UTF-8" 8 | 9 | CODESET="guess" 10 | FONTFACE="" 11 | FONTSIZE="" 12 | 13 | VIDEOMODE= 14 | 15 | # The following is an example how to use a braille font 16 | # FONT='lat9w-08.psf.gz brl-8x8.psf' 17 | -------------------------------------------------------------------------------- /stage3/01-sys-tweaks/files/pkgconfig/wpimath.pc: -------------------------------------------------------------------------------- 1 | # Package Information for pkg-config 2 | 3 | prefix=/usr/local/frc 4 | exec_prefix=${prefix} 5 | includedir=${prefix}/include 6 | libdir=${exec_prefix}/lib 7 | 8 | Name: wpimath 9 | Description: WPILib Robotics Library Math 10 | Version: 2023.1.1 11 | Requires: wpiutil 12 | Libs: -L${libdir} -lwpimath 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /stage3/01-sys-tweaks/00-packages: -------------------------------------------------------------------------------- 1 | cmake 2 | libpython3.9-minimal 3 | libpython3.9-dev 4 | python3.9-minimal 5 | python3.9-dev 6 | python3-distutils 7 | python3-jinja2 8 | python3-numpy 9 | python3-pip 10 | python3-pycoral 11 | libedgetpu1-std 12 | libedgetpu-dev 13 | libtbb-dev 14 | libtbb2 15 | libusb-1.0-0-dev 16 | libz-dev 17 | swig 18 | pigpio 19 | python-pigpio 20 | python3-pigpio 21 | -------------------------------------------------------------------------------- /config: -------------------------------------------------------------------------------- 1 | IMG_NAME='WPILibPi_64' 2 | TARGET_HOSTNAME=wpilibpi 3 | FIRST_USER_PASS=raspberry 4 | DISABLE_FIRST_BOOT_USER_RENAME=1 5 | ENABLE_SSH=1 6 | PI_GEN=WPILibPi 7 | PI_GEN_REPO=https://github.com/wpilibsuite/WPILibPi 8 | LOCALE_DEFAULT=en_US.UTF-8 9 | KEYBOARD_KEYMAP=us 10 | KEYBOARD_LAYOUT="English (US) - English (US\\, international with dead keys)" 11 | TIMEZONE_DEFAULT=America/Los_Angeles 12 | -------------------------------------------------------------------------------- /stage3/01-sys-tweaks/files/pkgconfig/wpiutil.pc: -------------------------------------------------------------------------------- 1 | # Package Information for pkg-config 2 | 3 | prefix=/usr/local/frc 4 | exec_prefix=${prefix} 5 | includedir=${prefix}/include 6 | libdir=${exec_prefix}/lib 7 | 8 | Name: wpiutil 9 | Description: WPILib Robotics Library utilities 10 | Version: 2023.1.1 11 | Libs: -L${libdir} -lwpiutil -latomic 12 | Libs.private: -lpthread 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /stage3/01-sys-tweaks/files/pkgconfig/wpinet.pc: -------------------------------------------------------------------------------- 1 | # Package Information for pkg-config 2 | 3 | prefix=/usr/local/frc 4 | exec_prefix=${prefix} 5 | includedir=${prefix}/include 6 | libdir=${exec_prefix}/lib 7 | 8 | Name: wpinet 9 | Description: WPILib Robotics Library Networking 10 | Version: 2023.1.1 11 | Requires: wpiutil 12 | Libs: -L${libdir} -lwpinet 13 | Libs.private: -lpthread -lutil 14 | Cflags: -I${includedir} 15 | -------------------------------------------------------------------------------- /stage3/01-sys-tweaks/files/pkgconfig/apriltag.pc: -------------------------------------------------------------------------------- 1 | # Package Information for pkg-config 2 | 3 | prefix=/usr/local/frc 4 | exec_prefix=${prefix} 5 | includedir=${prefix}/include 6 | libdir=${exec_prefix}/lib 7 | 8 | Name: apriltag 9 | Description: WPILib Robotics Library AprilTags 10 | Version: 2023.1.1 11 | Requires: wpimath wpiutil 12 | Libs: -L${libdir} -lapriltag 13 | Libs.private: -lpthread 14 | Cflags: -I${includedir} 15 | -------------------------------------------------------------------------------- /stage1/01-sys-tweaks/files/fstab: -------------------------------------------------------------------------------- 1 | proc /proc proc defaults 0 0 2 | BOOTDEV /boot vfat defaults 0 2 3 | ROOTDEV / ext4 defaults,noatime 0 1 4 | tmpfs /tmp tmpfs nosuid,nodev 0 0 5 | tmpfs /var/log tmpfs nosuid,nodev 0 0 6 | tmpfs /var/tmp tmpfs nosuid,nodev 0 0 7 | -------------------------------------------------------------------------------- /stage2/00-configure-apt/00-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | echo "adding repo for edgetpu" 4 | echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" > "${ROOTFS_DIR}/etc/apt/sources.list.d/coral-edgetpu.list" 5 | 6 | curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor > "${ROOTFS_DIR}/etc/apt/trusted.gpg.d/google.gpg" 7 | on_chroot << EOF 8 | apt-get update 9 | apt-get dist-upgrade -y 10 | EOF 11 | -------------------------------------------------------------------------------- /stage3/01-sys-tweaks/files/pkgconfig/wpilibc.pc: -------------------------------------------------------------------------------- 1 | # Package Information for pkg-config 2 | 3 | prefix=/usr/local/frc 4 | exec_prefix=${prefix} 5 | includedir=${prefix}/include 6 | libdir=${exec_prefix}/lib 7 | 8 | Name: wpilibc 9 | Description: WPILib Robotics Library 10 | Version: 2023.1.1 11 | Requires: apriltag cameraserver ntcore cscore wpimath wpinet wpiutil 12 | Libs: -L${libdir} -lwpilibc -lwpiHal 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /stage3/01-sys-tweaks/files/pkgconfig/cameraserver.pc: -------------------------------------------------------------------------------- 1 | # Package Information for pkg-config 2 | 3 | prefix=/usr/local/frc 4 | exec_prefix=${prefix} 5 | includedir=${prefix}/include 6 | libdir=${exec_prefix}/lib 7 | 8 | Name: cameraserver 9 | Description: WPILib Robotics Library CameraServer 10 | Version: 2023.1.1 11 | Requires: cscore wpiutil 12 | Requires.private: ntcore 13 | Libs: -L${libdir} -lcameraserver 14 | Cflags: -I${includedir} 15 | -------------------------------------------------------------------------------- /stage3/01-sys-tweaks/files/pkgconfig/ntcore.pc: -------------------------------------------------------------------------------- 1 | # Package Information for pkg-config 2 | 3 | prefix=/usr/local/frc 4 | exec_prefix=${prefix} 5 | includedir=${prefix}/include 6 | libdir=${exec_prefix}/lib 7 | 8 | Name: ntcore 9 | Description: WPILib Robotics Library NetworkTables 10 | Version: 2023.1.1 11 | Requires: wpiutil 12 | Requires.private: wpinet 13 | Libs: -L${libdir} -lntcore 14 | Libs.private: -lpthread 15 | Cflags: -I${includedir} 16 | -------------------------------------------------------------------------------- /stage3/01-sys-tweaks/files/pkgconfig/cscore.pc: -------------------------------------------------------------------------------- 1 | # Package Information for pkg-config 2 | 3 | prefix=/usr/local/frc 4 | exec_prefix=${prefix} 5 | includedir=${prefix}/include 6 | libdir=${exec_prefix}/lib 7 | 8 | Name: cscore 9 | Description: WPILib Robotics Library CameraServer Core 10 | Version: 2023.1.1 11 | Requires: wpiutil opencv4 12 | Requires.private: wpinet 13 | Libs: -L${libdir} -lcscore 14 | Libs.private: -lpthread 15 | Cflags: -I${includedir} 16 | -------------------------------------------------------------------------------- /depends: -------------------------------------------------------------------------------- 1 | quilt 2 | parted 3 | realpath:coreutils 4 | qemu-arm-static:qemu-user-static 5 | debootstrap 6 | zerofree 7 | zip 8 | mkdosfs:dosfstools 9 | capsh:libcap2-bin 10 | bsdtar:libarchive-tools 11 | grep 12 | rsync 13 | xz:xz-utils 14 | curl 15 | xxd 16 | file 17 | git 18 | lsmod:kmod 19 | bc 20 | qemu-nbd:qemu-utils 21 | kpartx 22 | gpg 23 | pigz 24 | pkg-config 25 | gcc:build-essential 26 | cmake 27 | python3 28 | ant 29 | sudo 30 | java:openjdk-17-jdk 31 | -------------------------------------------------------------------------------- /stage2/01-sys-tweaks/00-patches/04-inputrc.diff: -------------------------------------------------------------------------------- 1 | Index: jessie-stage2/rootfs/etc/inputrc 2 | =================================================================== 3 | --- jessie-stage2.orig/rootfs/etc/inputrc 4 | +++ jessie-stage2/rootfs/etc/inputrc 5 | @@ -65,3 +65,7 @@ $endif 6 | # "\e[F": end-of-line 7 | 8 | $endif 9 | + 10 | +# mappings for up and down arrows search history 11 | +# "\e[B": history-search-forward 12 | +# "\e[A": history-search-backward 13 | -------------------------------------------------------------------------------- /stage3/01-sys-tweaks/files/FindJNI.cmake: -------------------------------------------------------------------------------- 1 | set(JNI_INCLUDE_DIRS "$ENV{ROOTFS_DIR}/usr/lib/jvm/java-17-openjdk-arm64/include" "$ENV{ROOTFS_DIR}/usr/lib/jvm/java-17-openjdk-arm64/include/linux") 2 | set(JNI_LIBRARIES ) 3 | set(JNI_FOUND YES) 4 | set(JAVA_AWT_LIBRARY ) 5 | set(JAVA_JVM_LIBRARY ) 6 | set(JAVA_INCLUDE_PATH "$ENV{ROOTFS_DIR}/usr/lib/jvm/java-17-openjdk-arm64/include") 7 | set(JAVA_INCLUDE_PATH2 "$ENV{ROOTFS_DIR}/usr/lib/jvm/java-17-openjdk-arm64/include/linux") 8 | set(JAVA_AWT_INCLUDE_PATH ) 9 | 10 | -------------------------------------------------------------------------------- /stage2/01-sys-tweaks/files/rc.local: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # 3 | # rc.local 4 | # 5 | # This script is executed at the end of each multiuser runlevel. 6 | # Make sure that the script will "exit 0" on success or any other 7 | # value on error. 8 | # 9 | # In order to enable or disable this script just change the execution 10 | # bits. 11 | # 12 | # By default this script does nothing. 13 | 14 | # Print the IP address 15 | _IP=$(hostname -I) || true 16 | if [ "$_IP" ]; then 17 | printf "My IP address is %s\n" "$_IP" 18 | fi 19 | 20 | exit 0 21 | -------------------------------------------------------------------------------- /stage2/01-sys-tweaks/files/bash.bashrc: -------------------------------------------------------------------------------- 1 | # set variable identifying the filesystem you work in (used in the prompt below) 2 | set_bash_prompt(){ 3 | fs_mode=$(mount | sed -n -e "s/^\/dev\/.* on \/ .*(\(r[w|o]\).*/\1/p") 4 | PS1='\[\033[01;32m\]\u@\h${fs_mode:+($fs_mode)}\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' 5 | } 6 | 7 | alias ro='sudo mount -o remount,ro / ; sudo mount -o remount,ro /boot' 8 | alias rw='sudo mount -o remount,rw / ; sudo mount -o remount,rw /boot' 9 | 10 | # setup fancy prompt 11 | PROMPT_COMMAND=set_bash_prompt 12 | -------------------------------------------------------------------------------- /stage0/00-configure-apt/files/sources.list: -------------------------------------------------------------------------------- 1 | deb http://deb.debian.org/debian RELEASE main contrib non-free 2 | deb http://security.debian.org/debian-security RELEASE-security main contrib non-free 3 | deb http://deb.debian.org/debian RELEASE-updates main contrib non-free 4 | # Uncomment deb-src lines below then 'apt-get update' to enable 'apt-get source' 5 | #deb-src http://deb.debian.org/debian RELEASE main contrib non-free 6 | #deb-src http://security.debian.org/debian-security RELEASE-security main contrib non-free 7 | #deb-src http://deb.debian.org/debian RELEASE-updates main contrib non-free 8 | -------------------------------------------------------------------------------- /stage1/01-sys-tweaks/00-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | install -d "${ROOTFS_DIR}/etc/systemd/system/getty@tty1.service.d" 4 | install -m 644 files/noclear.conf "${ROOTFS_DIR}/etc/systemd/system/getty@tty1.service.d/noclear.conf" 5 | install -v -m 644 files/fstab "${ROOTFS_DIR}/etc/fstab" 6 | 7 | on_chroot << EOF 8 | if ! id -u ${FIRST_USER_NAME} >/dev/null 2>&1; then 9 | adduser --disabled-password --gecos "" ${FIRST_USER_NAME} 10 | fi 11 | 12 | if [ -n "${FIRST_USER_PASS}" ]; then 13 | echo "${FIRST_USER_NAME}:${FIRST_USER_PASS}" | chpasswd 14 | fi 15 | echo "root:root" | chpasswd 16 | EOF 17 | 18 | 19 | -------------------------------------------------------------------------------- /export-image/04-set-partuuid/00-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | if [ "${NO_PRERUN_QCOW2}" = "0" ]; then 4 | 5 | IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img" 6 | 7 | IMGID="$(dd if="${IMG_FILE}" skip=440 bs=1 count=4 2>/dev/null | xxd -e | cut -f 2 -d' ')" 8 | 9 | BOOT_PARTUUID="${IMGID}-01" 10 | ROOT_PARTUUID="${IMGID}-02" 11 | 12 | sed -i "s/BOOTDEV/PARTUUID=${BOOT_PARTUUID}/" "${ROOTFS_DIR}/etc/fstab" 13 | sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" "${ROOTFS_DIR}/etc/fstab" 14 | 15 | sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" "${ROOTFS_DIR}/boot/cmdline.txt" 16 | 17 | fi 18 | 19 | -------------------------------------------------------------------------------- /stage2/01-sys-tweaks/00-patches/02-swap.diff: -------------------------------------------------------------------------------- 1 | Index: jessie-stage2/rootfs/etc/dphys-swapfile 2 | =================================================================== 3 | --- jessie-stage2.orig/rootfs/etc/dphys-swapfile 4 | +++ jessie-stage2/rootfs/etc/dphys-swapfile 5 | @@ -13,7 +13,7 @@ 6 | 7 | # set size to absolute value, leaving empty (default) then uses computed value 8 | # you most likely don't want this, unless you have an special disk situation 9 | -#CONF_SWAPSIZE= 10 | +CONF_SWAPSIZE=100 11 | 12 | # set size to computed value, this times RAM size, dynamically adapts, 13 | # guarantees that there is enough swap without wasting disk space on excess 14 | -------------------------------------------------------------------------------- /export-image/03-network/01-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | on_chroot << EOF 4 | rm -f /etc/resolv.conf 5 | 6 | touch /tmp/dhcpcd.resolv.conf 7 | ln -s /tmp/dhcpcd.resolv.conf /etc/resolv.conf 8 | 9 | #ls -l /etc/systemd/system/dhcpcd.service.d/ 10 | 11 | #sed -i -e 's/\/run\//\/var\/run\//' /etc/systemd/system/dhcpcd5.service 12 | 13 | cp /etc/dhcpcd.conf /boot/ 14 | chown -f 0:0 /boot/dhcpcd.conf 15 | ln -sf /boot/dhcpcd.conf /etc/dhcpcd.conf 16 | 17 | cp /etc/wpa_supplicant/wpa_supplicant.conf /boot/wpa_supplicant_wpilibpi.conf 18 | chown -f 0:0 /boot/wpa_supplicant_wpilibpi.conf 19 | ln -sf /boot/wpa_supplicant_wpilibpi.conf /etc/wpa_supplicant/wpa_supplicant.conf 20 | 21 | EOF 22 | -------------------------------------------------------------------------------- /stage5/01-sys-tweaks/files/romi-sayid.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [ -f /boot/default-ssid.txt ] || exit 0 4 | [ -f /boot/default-ssid.wav ] || exit 0 5 | [ -f /etc/hostapd/hostapd.conf ] || exit 0 6 | 7 | SSID=`grep ^ssid= /etc/hostapd/hostapd.conf | cut -c 6-` 8 | DEFAULTID=`cat /boot/default-ssid.txt 2>/dev/null` 9 | 10 | [ "$SSID" = "$DEFAULTID" ] || exit 0 11 | 12 | echo $$ > /run/romi_sayid.pid 13 | 14 | MESSAGE="Jr ner Ebzv. Lbh jvyy or nffvzvyngrq." 15 | 16 | while true 17 | do 18 | for i in {1..10} 19 | do 20 | aplay -q /boot/default-ssid.wav 21 | done 22 | echo $MESSAGE | tr 'A-Za-z' 'N-ZA-Mn-za-m' | espeak -s 140 -g 5 --stdin --stdout | aplay -q 23 | done 24 | -------------------------------------------------------------------------------- /deps/examples/cpp-multiCameraServer/Makefile: -------------------------------------------------------------------------------- 1 | DEPS_CFLAGS?=$(shell env PKG_CONFIG_PATH=/usr/local/frc/lib/pkgconfig pkg-config --cflags wpilibc) 2 | DEPS_LIBS?=$(shell env PKG_CONFIG_PATH=/usr/local/frc/lib/pkgconfig pkg-config --libs wpilibc) 3 | EXE=multiCameraServerExample 4 | DESTDIR?=/home/pi/ 5 | 6 | .PHONY: clean build install 7 | 8 | build: ${EXE} 9 | 10 | install: build 11 | cp ${EXE} runCamera ${DESTDIR} 12 | 13 | clean: 14 | rm ${EXE} *.o 15 | 16 | OBJS=main.o 17 | 18 | ${EXE}: ${OBJS} 19 | ${CXX} -pthread -g -o $@ $^ ${DEPS_LIBS} -Wl,--unresolved-symbols=ignore-in-shared-libs 20 | 21 | .cpp.o: 22 | ${CXX} -pthread -g -Og -c -o $@ -std=c++20 ${CXXFLAGS} ${DEPS_CFLAGS} $< 23 | -------------------------------------------------------------------------------- /azure-docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye 2 | 3 | ENV DEBIAN_FRONTEND noninteractive 4 | 5 | RUN apt-get -y update && \ 6 | apt-get -y install --no-install-recommends \ 7 | git vim parted pkg-config nodejs \ 8 | quilt coreutils qemu-user-static debootstrap zerofree zip dosfstools \ 9 | libarchive-tools libcap2-bin rsync grep udev xz-utils curl xxd file kmod bc\ 10 | binfmt-support ca-certificates qemu-utils kpartx fdisk gpg pigz\ 11 | crossbuild-essential-arm64 \ 12 | build-essential cmake python3 python3-distutils python3-jinja2 ant sudo openjdk-17-jdk \ 13 | && rm -rf /var/lib/apt/lists/* 14 | 15 | LABEL "com.azure.dev.pipelines.agent.handler.node.path"="/usr/bin/node" 16 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BASE_IMAGE=debian:bullseye 2 | FROM ${BASE_IMAGE} 3 | 4 | ENV DEBIAN_FRONTEND noninteractive 5 | 6 | RUN apt-get -y update && \ 7 | apt-get -y install --no-install-recommends \ 8 | git vim parted pkg-config \ 9 | quilt coreutils qemu-user-static debootstrap zerofree zip dosfstools \ 10 | libarchive-tools libcap2-bin rsync grep udev xz-utils curl xxd file kmod bc\ 11 | binfmt-support ca-certificates qemu-utils kpartx fdisk gpg pigz\ 12 | crossbuild-essential-arm64 \ 13 | build-essential cmake python3 python3-distutils python3-jinja2 ant sudo openjdk-17-jdk \ 14 | && rm -rf /var/lib/apt/lists/* 15 | 16 | COPY . /pi-gen/ 17 | 18 | VOLUME [ "/pi-gen/work", "/pi-gen/deploy"] 19 | -------------------------------------------------------------------------------- /deps/tools/configServer/src/WebSocketHandlers.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | #ifndef RPICONFIGSERVER_WEBSOCKETHANDLERS_H_ 6 | #define RPICONFIGSERVER_WEBSOCKETHANDLERS_H_ 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | namespace wpi { 14 | class WebSocket; 15 | } // namespace wpi 16 | 17 | void InitWs(wpi::WebSocket& ws); 18 | void ProcessWsText(wpi::WebSocket& ws, std::string_view msg); 19 | void ProcessWsBinary(wpi::WebSocket& ws, std::span msg); 20 | 21 | #endif // RPICONFIGSERVER_WEBSOCKETHANDLERS_H_ 22 | -------------------------------------------------------------------------------- /stage2/01-sys-tweaks/files/resize2fs_once: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ### BEGIN INIT INFO 3 | # Provides: resize2fs_once 4 | # Required-Start: 5 | # Required-Stop: 6 | # Default-Start: 3 7 | # Default-Stop: 8 | # Short-Description: Resize the root filesystem to fill partition 9 | # Description: 10 | ### END INIT INFO 11 | . /lib/lsb/init-functions 12 | case "$1" in 13 | start) 14 | log_daemon_msg "Starting resize2fs_once" 15 | ROOT_DEV=$(findmnt / -o source -n) && 16 | resize2fs $ROOT_DEV && 17 | update-rc.d resize2fs_once remove && 18 | rm /etc/init.d/resize2fs_once && 19 | sed -i '/vfat\|ext4/s/defaults/defaults,ro/' /etc/fstab && 20 | log_end_msg $? && 21 | reboot 22 | ;; 23 | *) 24 | echo "Usage: $0 start" >&2 25 | exit 3 26 | ;; 27 | esac 28 | -------------------------------------------------------------------------------- /stage0/00-configure-apt/00-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | install -m 644 files/sources.list "${ROOTFS_DIR}/etc/apt/" 4 | install -m 644 files/raspi.list "${ROOTFS_DIR}/etc/apt/sources.list.d/" 5 | sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list" 6 | sed -i "s/RELEASE/${RELEASE}/g" "${ROOTFS_DIR}/etc/apt/sources.list.d/raspi.list" 7 | 8 | if [ -n "$APT_PROXY" ]; then 9 | install -m 644 files/51cache "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" 10 | sed "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" -i -e "s|APT_PROXY|${APT_PROXY}|" 11 | else 12 | rm -f "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache" 13 | fi 14 | 15 | cat files/raspberrypi.gpg.key | gpg --dearmor > "${ROOTFS_DIR}/etc/apt/trusted.gpg.d/raspberrypi-archive-stable.gpg" 16 | on_chroot << EOF 17 | dpkg --add-architecture armhf 18 | apt-get update 19 | apt-get dist-upgrade -y 20 | EOF 21 | -------------------------------------------------------------------------------- /deps/examples/python-multiCameraServer/README.txt: -------------------------------------------------------------------------------- 1 | ====================== 2 | Deploying from desktop 3 | ====================== 4 | 5 | On the rPi web dashboard: 6 | 7 | 1) Make the rPi writable by selecting the "Writable" tab 8 | 2) In the rPi web dashboard Application tab, select the "Uploaded Python file" 9 | option for Application 10 | 3) Click "Browse..." and select the "multiCameraServer.py" file in 11 | your desktop project directory 12 | 4) Click Save 13 | 14 | The application will be automatically started. Console output can be seen by 15 | enabling console output in the Vision Status tab. 16 | 17 | ======================== 18 | Deploying locally on rPi 19 | ======================== 20 | 21 | 1) Copy multiCameraServer.py and runCamera to /home/pi 22 | 2) Run "./runInteractive" in /home/pi or "sudo svc -t /service/camera" to 23 | restart service. 24 | -------------------------------------------------------------------------------- /stage2/01-sys-tweaks/00-packages: -------------------------------------------------------------------------------- 1 | java-common 2 | ntp 3 | daemontools daemontools-run 4 | build-essential gdb 5 | busybox-syslogd 6 | ssh less fbset sudo psmisc strace ed ncdu crda 7 | console-setup keyboard-configuration debconf-utils parted 8 | build-essential manpages-dev bash-completion gdb pkg-config 9 | python-is-python3 10 | gdbserver 11 | python3-numpy libopenblas-base 12 | python3-rpi.gpio v4l-utils 13 | python3-gpiozero 14 | avahi-daemon 15 | lua5.1 16 | luajit 17 | hardlink ca-certificates curl 18 | fake-hwclock usbutils 19 | dosfstools 20 | dphys-swapfile 21 | raspberrypi-sys-mods 22 | apt-listchanges 23 | usb-modeswitch 24 | libpam-chksshpwd 25 | rpi-update 26 | libmtp-runtime 27 | htop 28 | policykit-1 29 | ssh-import-id 30 | rng-tools 31 | ethtool 32 | ntfs-3g 33 | pciutils 34 | rpi-eeprom 35 | raspinfo 36 | python3-picamera 37 | udisks2 38 | unzip zip p7zip-full 39 | file 40 | kms++-utils 41 | openjdk-17-jdk 42 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | resources: 2 | containers: 3 | - container: pi-gen 4 | image: wpilib/pi-gen:latest 5 | options: --privileged --cap-add=MKNOD 6 | 7 | jobs: 8 | - job: 'Main' 9 | pool: RoboRioConnections 10 | workspace: 11 | clean: false # Clean fails because the agent cannot remove files created by root 12 | timeoutInMinutes: 0 13 | container: pi-gen 14 | 15 | steps: 16 | - script: | 17 | sudo rm -rf $(Build.SourcesDirectory) $(Build.BinariesDirectory) 18 | displayName: 'Clean Workspace' 19 | - checkout: self 20 | submodules: true 21 | - script: | 22 | sudo sh -c 'dpkg-reconfigure qemu-user-static && ./build.sh' 23 | cp deploy/*.zip deploy/examples/*.zip $BUILD_ARTIFACTSTAGINGDIRECTORY 24 | displayName: 'Build Image' 25 | - task: PublishBuildArtifacts@1 26 | inputs: 27 | artifactName: 'FRCVisionImage' 28 | -------------------------------------------------------------------------------- /deps/examples/java-multiCameraServer/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | id 'application' 4 | id 'com.github.johnrengelman.shadow' version '7.1.2' apply false 5 | } 6 | 7 | mainClassName = 'Main' 8 | 9 | apply plugin: 'com.github.johnrengelman.shadow' 10 | 11 | repositories { 12 | mavenCentral() 13 | flatDir { 14 | dirs '/usr/local/frc/java', '.' 15 | } 16 | } 17 | 18 | dependencies { 19 | implementation 'com.google.code.gson:gson:2.8.5' 20 | 21 | implementation files('apriltag.jar') 22 | implementation files('wpimath.jar') 23 | implementation files('wpinet.jar') 24 | implementation files('wpiutil.jar') 25 | implementation files('ntcore.jar') 26 | implementation files('cscore.jar') 27 | implementation files('cameraserver.jar') 28 | implementation files('opencv-460.jar') 29 | implementation files('wpilibj.jar') 30 | implementation files('wpiHal.jar') 31 | } 32 | -------------------------------------------------------------------------------- /stage2/01-sys-tweaks/00-patches/01-useradd.diff: -------------------------------------------------------------------------------- 1 | Index: jessie-stage2/rootfs/etc/default/useradd 2 | =================================================================== 3 | --- jessie-stage2.orig/rootfs/etc/default/useradd 4 | +++ jessie-stage2/rootfs/etc/default/useradd 5 | @@ -5,7 +5,7 @@ 6 | # Similar to DHSELL in adduser. However, we use "sh" here because 7 | # useradd is a low level utility and should be as general 8 | # as possible 9 | -SHELL=/bin/sh 10 | +SHELL=/bin/bash 11 | # 12 | # The default group for users 13 | # 100=users on Debian systems 14 | @@ -29,7 +29,7 @@ SHELL=/bin/sh 15 | # The SKEL variable specifies the directory containing "skeletal" user 16 | # files; in other words, files such as a sample .profile that will be 17 | # copied to the new user's home directory when it is created. 18 | -# SKEL=/etc/skel 19 | +SKEL=/etc/skel 20 | # 21 | # Defines whether the mail spool should be created while 22 | # creating the account 23 | -------------------------------------------------------------------------------- /stage5/02-net-tweaks/01-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # enable wireless 4 | rm -f "${ROOTFS_DIR}/etc/modprobe.d/raspi-blacklist.conf" 5 | 6 | # Enable wifi on 5GHz models 7 | mkdir -p "${ROOTFS_DIR}/var/lib/systemd/rfkill/" 8 | echo 0 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-3f300000.mmcnr:wlan" 9 | echo 0 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-fe300000.mmcnr:wlan" 10 | 11 | # Install hostapd.conf to .orig so it's not activated on first boot 12 | install -m 644 files/hostapd.conf "${ROOTFS_DIR}/etc/hostapd/hostapd.conf.orig" 13 | install -m 644 files/dnsmasq.conf "${ROOTFS_DIR}/etc/dnsmasq.d/wpilib.conf" 14 | 15 | cat <> "${ROOTFS_DIR}/etc/wpa_supplicant/wpa_supplicant.conf" 16 | 17 | ###### BELOW THIS LINE EDITED BY RPICONFIGSERVER ###### 18 | network={ 19 | ssid="WPILibPi" 20 | psk="WPILib2021!" 21 | } 22 | END 23 | 24 | cat <> "${ROOTFS_DIR}/etc/dhcpcd.conf" 25 | 26 | ###### BELOW THIS LINE EDITED BY RPICONFIGSERVER ###### 27 | 28 | 29 | interface wlan0 30 | static ip_address=10.0.0.2/24 31 | static routers=0.0.0.0 32 | nohook wpa_supplicant 33 | END 34 | -------------------------------------------------------------------------------- /deps/tools/configServer/src/VisionSettings.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | #ifndef RPICONFIGSERVER_VISIONSETTINGS_H_ 6 | #define RPICONFIGSERVER_VISIONSETTINGS_H_ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | namespace wpi { 15 | class json; 16 | } // namespace wpi 17 | 18 | class VisionSettings { 19 | struct private_init {}; 20 | 21 | public: 22 | explicit VisionSettings(const private_init&) {} 23 | VisionSettings(const VisionSettings&) = delete; 24 | VisionSettings& operator=(const VisionSettings&) = delete; 25 | 26 | void Set(const wpi::json& data, std::function onFail); 27 | 28 | void UpdateStatus(); 29 | 30 | wpi::json GetStatusJson(); 31 | 32 | wpi::sig::Signal status; 33 | 34 | static std::shared_ptr GetInstance(); 35 | }; 36 | 37 | #endif // RPICONFIGSERVER_VISIONSETTINGS_H_ 38 | -------------------------------------------------------------------------------- /deps/examples/java-multiCameraServer/README.txt: -------------------------------------------------------------------------------- 1 | =================== 2 | Building on desktop 3 | =================== 4 | 5 | -------- 6 | Building 7 | -------- 8 | 9 | Java 17 is required to build. Set your path and/or JAVA_HOME environment 10 | variable appropriately. 11 | 12 | 1) Run "./gradlew build" 13 | 14 | --------- 15 | Deploying 16 | --------- 17 | 18 | On the rPi web dashboard: 19 | 20 | 1) Make the rPi writable by selecting the "Writable" tab 21 | 2) In the rPi web dashboard Application tab, select the "Uploaded Java jar" 22 | option for Application 23 | 3) Click "Browse..." and select the "java-multiCameraServer-all.jar" file in 24 | your desktop project directory in the build/libs subdirectory 25 | 4) Click Save 26 | 27 | The application will be automatically started. Console output can be seen by 28 | enabling console output in the Vision Status tab. 29 | 30 | ======================= 31 | Building locally on rPi 32 | ======================= 33 | 34 | 1) Run "./gradlew build" 35 | 2) Run "./install.sh" (replaces /home/pi/runCamera) 36 | 3) Run "./runInteractive" in /home/pi or "sudo svc -t /service/camera" to 37 | restart service. 38 | -------------------------------------------------------------------------------- /deps/tools/configServer/src/MyHttpConnection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | #ifndef RPICONFIGSERVER_MYHTTPCONNECTION_H_ 6 | #define RPICONFIGSERVER_MYHTTPCONNECTION_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | class MyHttpConnection : public wpi::HttpServerConnection, 16 | public std::enable_shared_from_this { 17 | public: 18 | explicit MyHttpConnection(std::shared_ptr stream); 19 | 20 | protected: 21 | void ProcessRequest() override; 22 | void SendFileResponse(int code, std::string_view codeText, 23 | std::string_view contentType, std::string_view filename, 24 | std::string_view extraHeader = {}); 25 | 26 | wpi::WebSocketServerHelper m_websocketHelper; 27 | }; 28 | 29 | #endif // RPICONFIGSERVER_MYHTTPCONNECTION_H_ 30 | -------------------------------------------------------------------------------- /deps/examples/cpp-multiCameraServer/README.txt: -------------------------------------------------------------------------------- 1 | ======================= 2 | Building locally on rPi 3 | ======================= 4 | 5 | 1) Run "make" 6 | 2) Run "make install" (replaces /home/pi/runCamera) 7 | 3) Run "./runInteractive" in /home/pi or "sudo svc -t /service/camera" to 8 | restart service. 9 | 10 | 11 | =================== 12 | Building on desktop 13 | =================== 14 | 15 | -------------- 16 | One time setup 17 | -------------- 18 | 19 | Install the Raspbian compiler [1] and put it on your PATH. 20 | 21 | [1]: https://github.com/wpilibsuite/raspbian-toolchain/releases 22 | 23 | -------- 24 | Building 25 | -------- 26 | 27 | Run "make" 28 | 29 | --------- 30 | Deploying 31 | --------- 32 | 33 | On the rPi web dashboard: 34 | 35 | 1) Make the rPi writable by selecting the "Writable" tab 36 | 2) In the rPi web dashboard Application tab, select the 37 | "Uploaded C++ executable" option for Application 38 | 3) Click "Browse..." and select the "multiCameraServerExample" executable in 39 | your desktop project directory 40 | 4) Click Save 41 | 42 | The application will be automatically started. Console output can be seen by 43 | enabling console output in the Vision Status tab. 44 | -------------------------------------------------------------------------------- /stage5/01-sys-tweaks/files/resize2fs_once: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ### BEGIN INIT INFO 3 | # Provides: resize2fs_once 4 | # Required-Start: 5 | # Required-Stop: 6 | # Default-Start: 3 7 | # Default-Stop: 8 | # Short-Description: Resize the root filesystem to fill partition 9 | # Description: 10 | ### END INIT INFO 11 | . /lib/lsb/init-functions 12 | case "$1" in 13 | start) 14 | log_daemon_msg "Starting resize2fs_once" 15 | ID=`grep ^Serial /proc/cpuinfo | cut -d ':' -f 2 | cut -c 10-` 16 | if [ -n "$ID" ]; then 17 | echo "WPILibPi-$ID" > /boot/default-ssid.txt 18 | sed -e "s/^ssid=WPILibPi$/ssid=WPILibPi-$ID/" /etc/hostapd/hostapd.conf.orig > /etc/hostapd/hostapd.conf 19 | ID_SPACES=`echo $ID | sed -e 's/\(.\)/\1 /g'` 20 | /usr/bin/espeak -s 140 -g 5 "WPILib Pi dash $ID_SPACES" --stdout > /boot/default-ssid.wav 21 | fi 22 | ROOT_DEV=$(findmnt / -o source -n) && 23 | resize2fs $ROOT_DEV && 24 | update-rc.d resize2fs_once remove && 25 | rm /etc/init.d/resize2fs_once && 26 | sed -i '/vfat\|ext4/s/defaults/defaults,ro/' /etc/fstab && 27 | log_end_msg $? && 28 | reboot 29 | ;; 30 | *) 31 | echo "Usage: $0 start" >&2 32 | exit 3 33 | ;; 34 | esac 35 | -------------------------------------------------------------------------------- /stage2/01-sys-tweaks/00-patches/05-path.diff: -------------------------------------------------------------------------------- 1 | Index: jessie-stage2/rootfs/etc/login.defs 2 | =================================================================== 3 | --- jessie-stage2.orig/rootfs/etc/login.defs 4 | +++ jessie-stage2/rootfs/etc/login.defs 5 | @@ -100,7 +100,7 @@ HUSHLOGIN_FILE .hushlogin 6 | # 7 | # (they are minimal, add the rest in the shell startup files) 8 | ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 9 | -ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games 10 | +ENV_PATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games 11 | 12 | # 13 | # Terminal permissions 14 | Index: jessie-stage2/rootfs/etc/profile 15 | =================================================================== 16 | --- jessie-stage2.orig/rootfs/etc/profile 17 | +++ jessie-stage2/rootfs/etc/profile 18 | @@ -4,7 +4,7 @@ 19 | if [ "`id -u`" -eq 0 ]; then 20 | PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 21 | else 22 | - PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" 23 | + PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games" 24 | fi 25 | export PATH 26 | 27 | -------------------------------------------------------------------------------- /stage4/02-net-tweaks/01-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | install -v -d "${ROOTFS_DIR}/etc/wpa_supplicant" 4 | install -v -m 600 files/wpa_supplicant.conf "${ROOTFS_DIR}/etc/wpa_supplicant/" 5 | 6 | # disable wireless 7 | install -m 644 files/raspi-blacklist.conf "${ROOTFS_DIR}/etc/modprobe.d/" 8 | 9 | on_chroot << EOF 10 | SUDO_USER="${FIRST_USER_NAME}" raspi-config nonint do_boot_wait 0 11 | SUDO_USER="${FIRST_USER_NAME}" raspi-config nonint do_netconf 1 12 | EOF 13 | 14 | if [ -v WPA_COUNTRY ]; then 15 | on_chroot <<- EOF 16 | SUDO_USER="${FIRST_USER_NAME}" raspi-config nonint do_wifi_country "${WPA_COUNTRY}" 17 | EOF 18 | fi 19 | 20 | if [ -v WPA_ESSID ] && [ -v WPA_PASSWORD ]; then 21 | on_chroot <> "${ROOTFS_DIR}/etc/wpa_supplicant/wpa_supplicant.conf" << EOL 27 | 28 | network={ 29 | ssid="${WPA_ESSID}" 30 | key_mgmt=NONE 31 | } 32 | EOL 33 | fi 34 | 35 | # Disable wifi on 5GHz models 36 | mkdir -p "${ROOTFS_DIR}/var/lib/systemd/rfkill/" 37 | echo 1 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-3f300000.mmcnr:wlan" 38 | echo 1 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-fe300000.mmcnr:wlan" 39 | -------------------------------------------------------------------------------- /deps/tools/configServer/src/Application.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | #ifndef RPICONFIGSERVER_APPLICATION_H_ 6 | #define RPICONFIGSERVER_APPLICATION_H_ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | namespace wpi { 16 | class json; 17 | } // namespace wpi 18 | 19 | class UploadHelper; 20 | 21 | class Application { 22 | struct private_init {}; 23 | 24 | public: 25 | explicit Application(const private_init&) {} 26 | Application(const Application&) = delete; 27 | Application& operator=(const Application&) = delete; 28 | 29 | void Set(std::string_view appType, 30 | std::function onFail); 31 | 32 | void FinishUpload(std::string_view appType, UploadHelper& helper, 33 | std::function onFail); 34 | 35 | void UpdateStatus(); 36 | 37 | wpi::json GetStatusJson(); 38 | 39 | wpi::sig::Signal status; 40 | 41 | static std::shared_ptr GetInstance(); 42 | }; 43 | 44 | #endif // RPICONFIGSERVER_APPLICATION_H_ 45 | -------------------------------------------------------------------------------- /stage5/01-sys-tweaks/files/romi_sayid: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ### BEGIN INIT INFO 3 | # Provides: romi_sayid 4 | # Required-Start: 5 | # Required-Stop: 6 | # Default-Start: 3 7 | # Default-Stop: 8 | # Short-Description: romi sayid 9 | # Description: Speaks the Romi unique ID to the audio output 10 | ### END INIT INFO 11 | 12 | DAEMON=/usr/local/frc/bin/romi-sayid.sh 13 | PIDFILE=/run/romi_sayid.pid 14 | 15 | . /lib/lsb/init-functions 16 | 17 | case "$1" in 18 | start) 19 | log_daemon_msg "Starting romi sayid" "romi_sayid" 20 | /sbin/start-stop-daemon --start --nicelevel 0 --quiet --oknodo --chdir "$PWD" --background --pidfile $PIDFILE --exec $DAEMON 21 | log_end_msg $? 22 | ;; 23 | stop) 24 | log_daemon_msg "Stopping romi sayid" "romi_sayid" 25 | killproc -p $PIDFILE $DAEMON TERM 26 | log_end_msg $? 27 | ;; 28 | status) 29 | if pidofproc -p $PIDFILE $DAEMON >/dev/null 2>&1; then 30 | echo "$DAEMON is running"; 31 | exit 0; 32 | else 33 | echo "$DAEMON is NOT running"; 34 | if test -f $PIDFILE; then exit 2; fi 35 | exit 3; 36 | fi 37 | ;; 38 | force-reload|restart) 39 | $0 stop 40 | $0 start 41 | ;; 42 | *) 43 | echo "Usage: /etc/init.d/romi_sayid {start|stop|restart|force-reload}" 44 | exit 1 45 | ;; 46 | esac 47 | -------------------------------------------------------------------------------- /stage1/01-sys-tweaks/00-patches/01-bashrc.diff: -------------------------------------------------------------------------------- 1 | --- a/rootfs/etc/skel/.bashrc 2 | +++ b/rootfs/etc/skel/.bashrc 3 | @@ -43,7 +43,7 @@ 4 | # uncomment for a colored prompt, if the terminal has the capability; turned 5 | # off by default to not distract the user: the focus in a terminal window 6 | # should be on the output of commands, not on the prompt 7 | -#force_color_prompt=yes 8 | +force_color_prompt=yes 9 | 10 | if [ -n "$force_color_prompt" ]; then 11 | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then 12 | @@ -57,7 +57,7 @@ 13 | fi 14 | 15 | if [ "$color_prompt" = yes ]; then 16 | - PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' 17 | + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \$\[\033[00m\] ' 18 | else 19 | PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' 20 | fi 21 | @@ -79,9 +79,9 @@ 22 | #alias dir='dir --color=auto' 23 | #alias vdir='vdir --color=auto' 24 | 25 | - #alias grep='grep --color=auto' 26 | - #alias fgrep='fgrep --color=auto' 27 | - #alias egrep='egrep --color=auto' 28 | + alias grep='grep --color=auto' 29 | + alias fgrep='fgrep --color=auto' 30 | + alias egrep='egrep --color=auto' 31 | fi 32 | 33 | # colored GCC warnings and errors 34 | -------------------------------------------------------------------------------- /deps/tools/configServer/src/UploadHelper.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | #ifndef RPICONFIGSERVER_UPLOADHELPER_H_ 6 | #define RPICONFIGSERVER_UPLOADHELPER_H_ 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | class UploadHelper { 16 | public: 17 | UploadHelper() = default; 18 | ~UploadHelper() { Close(); } 19 | 20 | UploadHelper(const UploadHelper&) = delete; 21 | UploadHelper& operator=(const UploadHelper&) = delete; 22 | 23 | UploadHelper(UploadHelper&& oth); 24 | UploadHelper& operator=(UploadHelper&& oth); 25 | 26 | explicit operator bool() const { return m_fd != -1; } 27 | 28 | const char* GetFilename() { return m_filename.c_str(); } 29 | int GetFD() const { return m_fd; } 30 | 31 | bool Open(std::string_view filename, bool text, 32 | std::function onFail); 33 | void Write(std::span contents); 34 | void Close(); 35 | 36 | private: 37 | std::string m_filename; 38 | int m_fd = -1; 39 | bool m_text; 40 | bool m_hasEol; 41 | }; 42 | 43 | #endif // RPICONFIGSERVER_UPLOADHELPER_H_ 44 | -------------------------------------------------------------------------------- /deps/tools/setuidgids/src/setuidgids.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | static int prot_gid(gid_t gid) 9 | { 10 | if (setgroups(1,&gid) == -1) return -1; 11 | return setgid(gid); /* _should_ be redundant, but on some systems it isn't */ 12 | } 13 | 14 | const char *account; 15 | struct passwd *pw; 16 | 17 | int main(int argc, char **argv, char **envp) 18 | { 19 | account = *++argv; 20 | if (!account || !*++argv) { 21 | fprintf(stderr, "setuidgids: usage: setuidgids account child"); 22 | exit(EXIT_FAILURE); 23 | } 24 | 25 | pw = getpwnam(account); 26 | if (!pw) { 27 | fprintf(stderr, "setuidgids: FATAL: unknown account %s", account); 28 | return EXIT_FAILURE; 29 | } 30 | 31 | if (prot_gid(pw->pw_gid) == -1) { 32 | fprintf(stderr, "setuidgids: FATAL: unable to setgid\n"); 33 | return EXIT_FAILURE; 34 | } 35 | if (initgroups(pw->pw_name, pw->pw_gid) == -1) { 36 | fprintf(stderr, "setuidgids: FATAL: unable to initgroups\n"); 37 | return EXIT_FAILURE; 38 | } 39 | if (setuid(pw->pw_uid) == -1) { 40 | fprintf(stderr, "setuidgids: FATAL: unable to setuid\n"); 41 | return EXIT_FAILURE; 42 | } 43 | 44 | execvpe(*argv,argv,envp); 45 | fprintf(stderr, "setuidgids: FATAL: unable to run %s\n", *argv); 46 | return EXIT_FAILURE; 47 | } 48 | -------------------------------------------------------------------------------- /deps/tools/configServer/src/resources/frcvision.css: -------------------------------------------------------------------------------- 1 | .feather { 2 | width: 16px; 3 | height: 16px; 4 | vertical-align: text-bottom; 5 | } 6 | 7 | @-webkit-keyframes spinnow { 8 | 100% { 9 | transform: rotate(360deg); 10 | -webkit-transform: rotate(360deg); 11 | } 12 | } 13 | @-moz-keyframes spinnow { 14 | 100% { 15 | transform: rotate(360deg); 16 | -moz-transform: rotate(360deg); 17 | } 18 | } 19 | @-ms-keyframes spinnow { 20 | 100% { 21 | transform: rotate(360deg); 22 | -ms-transform: rotate(360deg); 23 | } 24 | } 25 | 26 | .spin { 27 | animation: spinnow 5s infinite linear; 28 | } 29 | 30 | .brand-icon { 31 | width: 32px; 32 | height: 32px; 33 | -ms-interpolation-mode: bicubic; 34 | } 35 | 36 | /* 37 | * Console Log 38 | */ 39 | .log { 40 | white-space: pre-wrap; 41 | color: black; 42 | font-size: 0.85em; 43 | background: inherit; 44 | border: 0; 45 | padding: 0; 46 | height: 400px; 47 | overflow-y: scroll; 48 | } 49 | 50 | .log .inner-line { 51 | padding: 0 15px; 52 | margin-left: 84pt; 53 | text-indent: -84pt; 54 | margin-bottom: 0; 55 | } 56 | 57 | .log .inner-line:empty::after { 58 | content: '.'; 59 | visibility: hidden; 60 | } 61 | 62 | .log.no-indent .inner-line { 63 | margin-left: 0; 64 | text-indent: 0; 65 | } 66 | 67 | .log .line-selected { 68 | background-color: #ffb2b0; 69 | } 70 | -------------------------------------------------------------------------------- /deps/tools/multiCameraServer/Makefile: -------------------------------------------------------------------------------- 1 | # For a desktop build with the allwpilib source tree: 2 | #ALLWPILIB=/home/peter/project/frc/allwpilib 3 | #DEPS_CFLAGS= \ 4 | -I${ALLWPILIB}/wpiutil/src/main/native/include \ 5 | -I${ALLWPILIB}/wpinet/src/main/native/include \ 6 | -I${ALLWPILIB}/cameraserver/src/main/native/include \ 7 | -I${ALLWPILIB}/cscore/src/main/native/include \ 8 | -I${ALLWPILIB}/ntcore/src/main/native/include \ 9 | -I${ALLWPILIB}/build-ninja/ntcore/generated/main/native/include \ 10 | -I${ALLWPILIB}/wpiutil/src/main/native/thirdparty/llvm/include \ 11 | -I${ALLWPILIB}/wpiutil/src/main/native/thirdparty/sigslot/include \ 12 | -I${ALLWPILIB}/wpiutil/src/main/native/thirdparty/fmtlib/include \ 13 | -I${ALLWPILIB}/wpiutil/src/main/native/thirdparty/json/include \ 14 | -I${ALLWPILIB}/wpinet/src/main/native/thirdparty/libuv/include 15 | #DEPS_LIBS=-L${ALLWPILIB}/build-ninja/lib -lcameraserverd -lntcored -lcscored -lwpinetd -lwpiutild 16 | 17 | DEPS_CFLAGS?=$(shell pkg-config --cflags cameraserver ntcore wpiutil) 18 | DEPS_LIBS?=$(shell pkg-config --libs --static cameraserver ntcore wpiutil) 19 | CXXFLAGS?=-std=c++20 20 | FRC_JSON?=/boot/frc.json 21 | 22 | .PHONY: all clean 23 | 24 | all: multiCameraServer 25 | 26 | clean: 27 | rm -f multiCameraServer 28 | 29 | multiCameraServer: src/multiCameraServer.cpp 30 | ${CXX} -pthread -g -o $@ ${CXXFLAGS} ${DEPS_CFLAGS} '-DFRC_JSON="${FRC_JSON}"' $^ ${DEPS_LIBS} 31 | -------------------------------------------------------------------------------- /scripts/dependencies_check: -------------------------------------------------------------------------------- 1 | # dependencies_check 2 | # $@ Dependency files to check 3 | # 4 | # Each dependency is in the form of a tool to test for, optionally followed by 5 | # a : and the name of a package if the package on a Debian-ish system is not 6 | # named for the tool (i.e., qemu-user-static). 7 | dependencies_check() 8 | { 9 | local depfile deps missing 10 | 11 | for depfile in "$@"; do 12 | if [[ -e "$depfile" ]]; then 13 | deps="$(sed -f "${SCRIPT_DIR}/remove-comments.sed" < "${BASE_DIR}/depends")" 14 | 15 | fi 16 | for dep in $deps; do 17 | if ! hash "${dep%:*}" 2>/dev/null; then 18 | missing="${missing:+$missing }${dep#*:}" 19 | fi 20 | done 21 | done 22 | 23 | if [[ "$missing" ]]; then 24 | echo "Required dependencies not installed" 25 | echo 26 | echo "This can be resolved on Debian/Raspbian systems by installing:" 27 | echo "$missing" 28 | false 29 | fi 30 | 31 | # If we're building on a native arm platform, we don't need to check for 32 | # binfmt_misc or require it to be loaded. 33 | 34 | binfmt_misc_required=1 35 | 36 | case $(uname -m) in 37 | aarch64) 38 | binfmt_misc_required=0 39 | ;; 40 | arm*) 41 | binfmt_misc_required=0 42 | ;; 43 | esac 44 | 45 | if [[ "${binfmt_misc_required}" == "1" ]]; then 46 | if ! grep -q "/proc/sys/fs/binfmt_misc" /proc/mounts; then 47 | echo "Module binfmt_misc not loaded in host" 48 | echo "Please run:" 49 | echo " sudo modprobe binfmt_misc" 50 | exit 1 51 | fi 52 | fi 53 | } 54 | -------------------------------------------------------------------------------- /ThirdPartyNotices.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Raspberry Pi (Trading) Ltd. 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | 11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 14 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2021 FIRST and other WPILib contributors 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of FIRST, WPILib, nor the names of other WPILib 12 | contributors may be used to endorse or promote products derived from 13 | this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY FIRST AND OTHER WPILIB CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR 18 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR 19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /deps/tools/configServer/gen_resource.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import argparse 4 | import os 5 | import re 6 | 7 | parser = argparse.ArgumentParser(description='Generate resource .cpp file.') 8 | parser.add_argument('outputFile', help='output file') 9 | parser.add_argument('inputFile', help='input file') 10 | parser.add_argument('--prefix', dest='prefix', default='', help='C function prefix') 11 | parser.add_argument('--namespace', dest='namespace', default='', help='C++ namespace') 12 | 13 | args = parser.parse_args() 14 | 15 | with open(args.inputFile, "rb") as f: 16 | data = f.read() 17 | 18 | version = os.getenv('IMG_VERSION') 19 | if version is not None and b'IMG_VERSION' in data: 20 | data = data.replace(b'IMG_VERSION', version.encode('utf-8')) 21 | 22 | fileSize = len(data) 23 | 24 | inputBase = os.path.basename(args.inputFile) 25 | funcName = "GetResource_" + re.sub(r"[^a-zA-Z0-9]", "_", inputBase) 26 | 27 | with open(args.outputFile, "wt") as f: 28 | print("#include \n#include \nextern \"C\" {\nstatic const unsigned char contents[] = { ", file=f, end='') 29 | print(", ".join("0x%02x" % x for x in data), file=f, end='') 30 | print(" };", file=f) 31 | print("const unsigned char* {}{}(size_t* len) {{\n *len = {};\n return contents;\n}}\n}}".format(args.prefix, funcName, fileSize), file=f) 32 | 33 | if args.namespace: 34 | print("namespace {} {{".format(namespace), file=f) 35 | print("std::string_view {}() {{\n return std::string_view(reinterpret_cast(contents), {});\n}}".format(funcName, fileSize), file=f) 36 | if args.namespace: 37 | print("}", file=f) 38 | -------------------------------------------------------------------------------- /deps/tools/configServer/src/SystemStatus.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | #ifndef RPICONFIGSERVER_SYSTEMSTATUS_H_ 6 | #define RPICONFIGSERVER_SYSTEMSTATUS_H_ 7 | 8 | #include 9 | 10 | #include 11 | 12 | #include "DataHistory.h" 13 | 14 | namespace wpi { 15 | class json; 16 | } // namespace wpi 17 | 18 | class SystemStatus { 19 | struct private_init {}; 20 | 21 | public: 22 | explicit SystemStatus(const private_init&) {} 23 | SystemStatus(const SystemStatus&) = delete; 24 | SystemStatus& operator=(const SystemStatus&) = delete; 25 | 26 | void UpdateAll(); 27 | 28 | wpi::json GetStatusJson(); 29 | bool GetWritable(); 30 | 31 | wpi::sig::Signal status; 32 | wpi::sig::Signal writable; 33 | 34 | static std::shared_ptr GetInstance(); 35 | 36 | private: 37 | void UpdateMemory(); 38 | void UpdateCpu(); 39 | void UpdateNetwork(); 40 | void UpdateTemp(); 41 | 42 | DataHistory m_memoryFree; 43 | DataHistory m_memoryAvail; 44 | struct CpuData { 45 | uint64_t user; 46 | uint64_t nice; 47 | uint64_t system; 48 | uint64_t idle; 49 | uint64_t total; 50 | }; 51 | DataHistory m_cpu; 52 | struct NetworkData { 53 | uint64_t recvBytes = 0; 54 | uint64_t xmitBytes = 0; 55 | }; 56 | DataHistory m_network; 57 | DataHistory m_temp; 58 | }; 59 | 60 | #endif // RPICONFIGSERVER_SYSTEMSTATUS_H_ 61 | -------------------------------------------------------------------------------- /deps/tools/configServer/src/DataHistory.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | #ifndef RPICONFIGSERVER_DATAHISTORY_H_ 6 | #define RPICONFIGSERVER_DATAHISTORY_H_ 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | template 14 | class DataHistory { 15 | public: 16 | void Add(T val) { 17 | if (m_qty >= Size) { 18 | std::copy(&m_data[1], &m_data[Size], &m_data[0]); 19 | m_data[Size - 1] = val; 20 | } else { 21 | m_data[m_qty++] = val; 22 | } 23 | } 24 | 25 | /* first is "least recent", last is "most recent" */ 26 | bool GetFirstLast(T* first, T* last, size_t* qty) const { 27 | if (m_qty == 0) return false; 28 | if (first) *first = m_data[0]; 29 | if (last) *last = m_data[m_qty - 1]; 30 | if (qty) *qty = m_qty; 31 | return true; 32 | } 33 | 34 | /* only look at most recent "count" samples */ 35 | bool GetFirstLast(T* first, T* last, size_t* qty, size_t count) const { 36 | if (count == 0 || m_qty < count) return false; 37 | if (first) *first = m_data[m_qty - count]; 38 | if (last) *last = m_data[m_qty - 1]; 39 | if (qty) *qty = m_qty; 40 | return true; 41 | } 42 | 43 | T GetTotal(size_t* qty = nullptr) const { 44 | if (qty) *qty = m_qty; 45 | return std::accumulate(&m_data[0], &m_data[m_qty], 0); 46 | } 47 | 48 | private: 49 | T m_data[Size]; 50 | size_t m_qty = 0; 51 | }; 52 | 53 | #endif // RPICONFIGSERVER_DATAHISTORY_H_ 54 | -------------------------------------------------------------------------------- /stage2/01-sys-tweaks/files/jdk-11.0.1.jinfo: -------------------------------------------------------------------------------- 1 | name=jdk-11.0.1 2 | priority=900 3 | section=main 4 | 5 | hl rmid /usr/lib/jvm/jdk-11.0.1/bin/rmid 6 | hl java /usr/lib/jvm/jdk-11.0.1/bin/java 7 | hl keytool /usr/lib/jvm/jdk-11.0.1/bin/keytool 8 | hl jjs /usr/lib/jvm/jdk-11.0.1/bin/jjs 9 | hl pack200 /usr/lib/jvm/jdk-11.0.1/bin/pack200 10 | hl rmiregistry /usr/lib/jvm/jdk-11.0.1/bin/rmiregistry 11 | hl unpack200 /usr/lib/jvm/jdk-11.0.1/bin/unpack200 12 | hl jexec /usr/lib/jvm/jdk-11.0.1/lib/jexec 13 | jdkhl jlink /usr/lib/jvm/jdk-11.0.1/bin/jlink 14 | jdkhl jdeps /usr/lib/jvm/jdk-11.0.1/bin/jdeps 15 | jdkhl jinfo /usr/lib/jvm/jdk-11.0.1/bin/jinfo 16 | jdkhl jstat /usr/lib/jvm/jdk-11.0.1/bin/jstat 17 | jdkhl javadoc /usr/lib/jvm/jdk-11.0.1/bin/javadoc 18 | jdkhl jmod /usr/lib/jvm/jdk-11.0.1/bin/jmod 19 | jdkhl jhsdb /usr/lib/jvm/jdk-11.0.1/bin/jhsdb 20 | jdkhl jps /usr/lib/jvm/jdk-11.0.1/bin/jps 21 | jdkhl jstack /usr/lib/jvm/jdk-11.0.1/bin/jstack 22 | jdkhl jrunscript /usr/lib/jvm/jdk-11.0.1/bin/jrunscript 23 | jdkhl javac /usr/lib/jvm/jdk-11.0.1/bin/javac 24 | jdkhl javap /usr/lib/jvm/jdk-11.0.1/bin/javap 25 | jdkhl jar /usr/lib/jvm/jdk-11.0.1/bin/jar 26 | jdkhl jshell /usr/lib/jvm/jdk-11.0.1/bin/jshell 27 | jdkhl rmic /usr/lib/jvm/jdk-11.0.1/bin/rmic 28 | jdkhl jdeprscan /usr/lib/jvm/jdk-11.0.1/bin/jdeprscan 29 | jdkhl jimage /usr/lib/jvm/jdk-11.0.1/bin/jimage 30 | jdkhl jstatd /usr/lib/jvm/jdk-11.0.1/bin/jstatd 31 | jdkhl jmap /usr/lib/jvm/jdk-11.0.1/bin/jmap 32 | jdkhl jdb /usr/lib/jvm/jdk-11.0.1/bin/jdb 33 | jdkhl serialver /usr/lib/jvm/jdk-11.0.1/bin/serialver 34 | jdkhl jcmd /usr/lib/jvm/jdk-11.0.1/bin/jcmd 35 | jdkhl jarsigner /usr/lib/jvm/jdk-11.0.1/bin/jarsigner 36 | jdk jconsole /usr/lib/jvm/jdk-11.0.1/bin/jconsole 37 | -------------------------------------------------------------------------------- /deps/tools/configServer/src/VisionSettings.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | #include "VisionSettings.h" 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "VisionStatus.h" 14 | 15 | std::shared_ptr VisionSettings::GetInstance() { 16 | static auto inst = std::make_shared(private_init{}); 17 | return inst; 18 | } 19 | 20 | void VisionSettings::Set(const wpi::json& data, 21 | std::function onFail) { 22 | { 23 | // write file 24 | std::error_code ec; 25 | wpi::raw_fd_ostream os(FRC_JSON, ec, fs::F_Text); 26 | if (ec) { 27 | onFail("could not write " FRC_JSON); 28 | return; 29 | } 30 | data.dump(os, 4); 31 | os << '\n'; 32 | } 33 | 34 | // terminate vision process so it reloads the file 35 | VisionStatus::GetInstance()->Terminate(onFail); 36 | 37 | UpdateStatus(); 38 | } 39 | 40 | void VisionSettings::UpdateStatus() { status(GetStatusJson()); } 41 | 42 | wpi::json VisionSettings::GetStatusJson() { 43 | std::error_code ec; 44 | wpi::raw_fd_istream is(FRC_JSON, ec); 45 | if (ec) { 46 | fmt::print(stderr, "could not read {}\n", FRC_JSON); 47 | return wpi::json(); 48 | } 49 | 50 | try { 51 | wpi::json j = {{"type", "visionSettings"}, 52 | {"settings", wpi::json::parse(is)}}; 53 | return j; 54 | } catch (wpi::json::exception& e) { 55 | fmt::print(stderr, "could not parse {}\n", FRC_JSON); 56 | return wpi::json(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /deps/tools/configServer/src/NetworkSettings.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | #ifndef RPICONFIGSERVER_NETWORKSETTINGS_H_ 6 | #define RPICONFIGSERVER_NETWORKSETTINGS_H_ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | 15 | namespace wpi { 16 | class json; 17 | } // namespace wpi 18 | 19 | class NetworkSettings { 20 | struct private_init {}; 21 | 22 | public: 23 | explicit NetworkSettings(const private_init&) {} 24 | NetworkSettings(const NetworkSettings&) = delete; 25 | NetworkSettings& operator=(const NetworkSettings&) = delete; 26 | 27 | void SetLoop(std::shared_ptr loop) { 28 | m_loop = std::move(loop); 29 | } 30 | 31 | enum WifiMode { kBridge, kAccessPoint }; 32 | enum Mode { kDhcp, kStatic, kDhcpStatic }; 33 | 34 | void Set(Mode mode, std::string_view address, std::string_view mask, 35 | std::string_view gateway, std::string_view dns, 36 | WifiMode wifiAPMode, int wifiChannel, std::string_view wifiSsid, 37 | std::string_view wifiWpa2, Mode wifiMode, 38 | std::string_view wifiAddress, std::string_view wifiMask, 39 | std::string_view wifiGateway, std::string_view wifiDns, 40 | std::function onFail); 41 | 42 | void UpdateStatus(); 43 | 44 | wpi::json GetStatusJson(); 45 | 46 | wpi::sig::Signal status; 47 | 48 | static std::shared_ptr GetInstance(); 49 | 50 | private: 51 | std::shared_ptr m_loop; 52 | }; 53 | 54 | #endif // RPICONFIGSERVER_NETWORKSETTINGS_H_ 55 | -------------------------------------------------------------------------------- /stage0/00-configure-apt/files/raspberrypi.gpg.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP PUBLIC KEY BLOCK----- 2 | Version: GnuPG v1.4.12 (GNU/Linux) 3 | 4 | mQENBE/d7o8BCACrwqQacGJfn3tnMzGui6mv2lLxYbsOuy/+U4rqMmGEuo3h9m92 5 | 30E2EtypsoWczkBretzLUCFv+VUOxaA6sV9+puTqYGhhQZFuKUWcG7orf7QbZRuu 6 | TxsEUepW5lg7MExmAu1JJzqM0kMQX8fVyWVDkjchZ/is4q3BPOUCJbUJOsE+kK/6 7 | 8kW6nWdhwSAjfDh06bA5wvoXNjYoDdnSZyVdcYCPEJXEg5jfF/+nmiFKMZBraHwn 8 | eQsepr7rBXxNcEvDlSOPal11fg90KXpy7Umre1UcAZYJdQeWcHu7X5uoJx/MG5J8 9 | ic6CwYmDaShIFa92f8qmFcna05+lppk76fsnABEBAAG0IFJhc3BiZXJyeSBQaSBB 10 | cmNoaXZlIFNpZ25pbmcgS2V5iQE4BBMBAgAiBQJP3e6PAhsDBgsJCAcDAgYVCAIJ 11 | CgsEFgIDAQIeAQIXgAAKCRCCsSmSf6MwPk6vB/9pePB3IukU9WC9Bammh3mpQTvL 12 | OifbkzHkmAYxzjfK6D2I8pT0xMxy949+ThzJ7uL60p6T/32ED9DR3LHIMXZvKtuc 13 | mQnSiNDX03E2p7lIP/htoxW2hDP2n8cdlNdt0M9IjaWBppsbO7IrDppG2B1aRLni 14 | uD7v8bHRL2mKTtIDLX42Enl8aLAkJYgNWpZyPkDyOqamjijarIWjGEPCkaURF7g4 15 | d44HvYhpbLMOrz1m6N5Bzoa5+nq3lmifeiWKxioFXU+Hy5bhtAM6ljVb59hbD2ra 16 | X4+3LXC9oox2flmQnyqwoyfZqVgSQa0B41qEQo8t1bz6Q1Ti7fbMLThmbRHiuQEN 17 | BE/d7o8BCADNlVtBZU63fm79SjHh5AEKFs0C3kwa0mOhp9oas/haDggmhiXdzeD3 18 | 49JWz9ZTx+vlTq0s+I+nIR1a+q+GL+hxYt4HhxoA6vlDMegVfvZKzqTX9Nr2VqQa 19 | S4Kz3W5ULv81tw3WowK6i0L7pqDmvDqgm73mMbbxfHD0SyTt8+fk7qX6Ag2pZ4a9 20 | ZdJGxvASkh0McGpbYJhk1WYD+eh4fqH3IaeJi6xtNoRdc5YXuzILnp+KaJyPE5CR 21 | qUY5JibOD3qR7zDjP0ueP93jLqmoKltCdN5+yYEExtSwz5lXniiYOJp8LWFCgv5h 22 | m8aYXkcJS1xVV9Ltno23YvX5edw9QY4hABEBAAGJAR8EGAECAAkFAk/d7o8CGwwA 23 | CgkQgrEpkn+jMD5Figf/dIC1qtDMTbu5IsI5uZPX63xydaExQNYf98cq5H2fWF6O 24 | yVR7ERzA2w33hI0yZQrqO6pU9SRnHRxCFvGv6y+mXXXMRcmjZG7GiD6tQWeN/3wb 25 | EbAn5cg6CJ/Lk/BI4iRRfBX07LbYULCohlGkwBOkRo10T+Ld4vCCnBftCh5x2OtZ 26 | TOWRULxP36y2PLGVNF+q9pho98qx+RIxvpofQM/842ZycjPJvzgVQsW4LT91KYAE 27 | 4TVf6JjwUM6HZDoiNcX6d7zOhNfQihXTsniZZ6rky287htsWVDNkqOi5T3oTxWUo 28 | m++/7s3K3L0zWopdhMVcgg6Nt9gcjzqN1c0gy55L/g== 29 | =mNSj 30 | -----END PGP PUBLIC KEY BLOCK----- 31 | -------------------------------------------------------------------------------- /deps/tools/configServer/src/VisionStatus.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | #ifndef RPICONFIGSERVER_VISIONSTATUS_H_ 6 | #define RPICONFIGSERVER_VISIONSTATUS_H_ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | namespace wpi { 18 | class json; 19 | 20 | namespace uv { 21 | class Buffer; 22 | } // namespace uv 23 | } // namespace wpi 24 | 25 | class VisionStatus { 26 | struct private_init {}; 27 | 28 | public: 29 | explicit VisionStatus(const private_init&) {} 30 | VisionStatus(const VisionStatus&) = delete; 31 | VisionStatus& operator=(const VisionStatus&) = delete; 32 | 33 | void SetLoop(std::shared_ptr loop); 34 | 35 | void Up(std::function onFail); 36 | void Down(std::function onFail); 37 | void Terminate(std::function onFail); 38 | void Kill(std::function onFail); 39 | 40 | void UpdateStatus(); 41 | void ConsoleLog(wpi::uv::Buffer& buf, size_t len); 42 | void UpdateCameraList(); 43 | 44 | wpi::sig::Signal update; 45 | wpi::sig::Signal log; 46 | wpi::sig::Signal cameraList; 47 | 48 | static std::shared_ptr GetInstance(); 49 | 50 | private: 51 | void RunSvc(const char* cmd, std::function onFail); 52 | void RefreshCameraList(); 53 | 54 | std::shared_ptr m_loop; 55 | 56 | struct CameraInfo { 57 | cs::UsbCameraInfo info; 58 | std::vector modes; 59 | }; 60 | std::vector m_cameraInfo; 61 | }; 62 | 63 | #endif // RPICONFIGSERVER_VISIONSTATUS_H_ 64 | -------------------------------------------------------------------------------- /stage5/01-sys-tweaks/files/uploadRomi.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # This file uploads to the Romi using a USB cable 4 | 5 | import time 6 | import serial 7 | import os 8 | import sys 9 | import getopt 10 | import subprocess 11 | 12 | def main(argv): 13 | try: 14 | opts, args = getopt.getopt(argv,"hp:f:",["port=","file="]) 15 | except getopt.GetoptError as err: 16 | print(err) 17 | print("Example: uploadRomi.py -p /dev/ttyACM0 -f firmware/.pio/build/a-start32U4/firmware.hex") 18 | sys.exit(1) 19 | 20 | # Set Defaults 21 | usbport = '/dev/ttyACM0' 22 | hexfile = '$NVM_BIN/../lib/node_modules/@wpilib/wpilib-ws-robot-romi/firmware/.pio/build/a-star32U4/firmware.hex' 23 | 24 | for opt, arg in opts: 25 | if opt == "-h": 26 | print("uploadRomi.py -p -f ") 27 | sys.exit(1) 28 | if opt in ("-p", "--port"): 29 | usbport = arg 30 | if opt in ("-f", "--file"): 31 | hexfile = arg 32 | 33 | print("Beginning binary upload to Romi ...") 34 | 35 | # baudrate of 1200 resets the Arduino to boot mode for 8 seconds 36 | brate = 1200 37 | print("Resetting Romi to boot mode (should see quickly flashing yellow LED") 38 | conn = {} 39 | try: 40 | conn = serial.Serial(port=usbport, baudrate=1200) 41 | except serial.SerialException as err: 42 | print(err) 43 | sys.exit(1) 44 | 45 | if not conn.isOpen(): 46 | print("Problem connecting to port " + usbport) 47 | sys.exit(1) 48 | 49 | conn.close() 50 | # Allow Romi to go into boot mode 51 | sys.stdout.flush() 52 | time.sleep(1) 53 | # Upload binary to Romi 54 | print("Running imaging tool") 55 | sys.stdout.flush() 56 | sys.exit(subprocess.call(['avrdude', '-v', '-q', '-patmega32u4', '-cavr109', '-P' + usbport, '-b57600', '-D', '-Uflash:w:' + hexfile + ':i'], stderr=sys.stdout.fileno())) 57 | 58 | if __name__ == "__main__": 59 | main(sys.argv[1:]) 60 | 61 | -------------------------------------------------------------------------------- /deps/tools/configServer/src/RomiStatus.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | #ifndef RPICONFIGSERVER_ROMISTATUS_H_ 6 | #define RPICONFIGSERVER_ROMISTATUS_H_ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | namespace wpi { 18 | class json; 19 | 20 | namespace uv { 21 | class Buffer; 22 | } // namespace uv 23 | } // namespace wpi 24 | 25 | class RomiStatus { 26 | struct private_init {}; 27 | 28 | public: 29 | explicit RomiStatus(const private_init&) {} 30 | RomiStatus(const RomiStatus&) = delete; 31 | RomiStatus& operator=(const RomiStatus&) = delete; 32 | 33 | void SetLoop(std::shared_ptr loop); 34 | 35 | void Up(std::function onFail); 36 | void Down(std::function onFail); 37 | void Terminate(std::function onFail); 38 | void Kill(std::function onFail); 39 | 40 | void UpdateStatus(); 41 | void ConsoleLog(wpi::uv::Buffer& buf, size_t len); 42 | 43 | void FirmwareUpdate(std::function onFail); 44 | 45 | void UpdateConfig(std::function onFail); 46 | 47 | void SaveConfig(const wpi::json& data, bool restartService, 48 | std::function onFail); 49 | 50 | wpi::sig::Signal update; 51 | wpi::sig::Signal log; 52 | wpi::sig::Signal config; 53 | 54 | static std::shared_ptr GetInstance(); 55 | 56 | private: 57 | void RunSvc(const char* cmd, std::function onFail); 58 | wpi::json ReadRomiConfigFile(std::function onFail); 59 | wpi::json GetConfigJson(std::function onFail); 60 | 61 | std::shared_ptr m_loop; 62 | }; 63 | 64 | #endif // RPICONFIGSERVER_VISIONSTATUS_H_ 65 | -------------------------------------------------------------------------------- /deps/tools/configServer/src/UploadHelper.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | #include "UploadHelper.h" 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | UploadHelper::UploadHelper(UploadHelper&& oth) 20 | : m_filename{std::move(oth.m_filename)}, 21 | m_fd{oth.m_fd}, 22 | m_text{oth.m_text} { 23 | oth.m_fd = -1; 24 | } 25 | 26 | UploadHelper& UploadHelper::operator=(UploadHelper&& oth) { 27 | m_filename = std::move(oth.m_filename); 28 | m_fd = oth.m_fd; 29 | oth.m_fd = -1; 30 | m_text = oth.m_text; 31 | return *this; 32 | } 33 | 34 | bool UploadHelper::Open(std::string_view filename, bool text, 35 | std::function onFail) { 36 | m_text = text; 37 | m_hasEol = true; 38 | m_filename = filename; 39 | // make it a C string 40 | m_filename.push_back(0); 41 | m_filename.pop_back(); 42 | 43 | m_fd = mkstemp(m_filename.data()); 44 | if (m_fd < 0) { 45 | wpi::SmallString<64> msg; 46 | msg = "could not open temporary file: "; 47 | msg += std::strerror(errno); 48 | onFail(msg); 49 | } 50 | return m_fd >= 0; 51 | } 52 | 53 | void UploadHelper::Write(std::span contents) { 54 | if (m_fd < 0) return; 55 | // write contents 56 | wpi::raw_fd_ostream out(m_fd, false); 57 | if (m_text) { 58 | std::string_view str(reinterpret_cast(contents.data()), 59 | contents.size()); 60 | // convert any Windows EOL to Unix 61 | for (;;) { 62 | size_t idx = str.find("\r\n"); 63 | if (idx == std::string_view::npos) break; 64 | out << wpi::slice(str, 0, idx) << '\n'; 65 | str = wpi::slice(str, idx + 2, std::string_view::npos); 66 | } 67 | out << str; 68 | m_hasEol == str.empty() || str.back() == '\n'; 69 | } else { 70 | out << contents; 71 | } 72 | } 73 | 74 | void UploadHelper::Close() { 75 | if (m_fd < 0) return; 76 | // ensure text file ends with EOL 77 | if (m_text && !m_hasEol) { 78 | wpi::raw_fd_ostream out(m_fd, false); 79 | out << '\n'; 80 | } 81 | ::close(m_fd); 82 | m_fd = -1; 83 | } 84 | -------------------------------------------------------------------------------- /stage5/01-sys-tweaks/01-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | SUB_STAGE_DIR=${PWD} 4 | 5 | # Override resize2fs_once to add unique SSID setting on first boot 6 | install -m 755 files/resize2fs_once "${ROOTFS_DIR}/etc/init.d/" 7 | 8 | # Install romi_sayid.sh and startup script 9 | install -m 755 files/romi-sayid.sh "${ROOTFS_DIR}/usr/local/frc/bin/" 10 | install -m 755 files/romi_sayid "${ROOTFS_DIR}/etc/init.d/" 11 | 12 | on_chroot << EOF 13 | systemctl enable romi_sayid 14 | EOF 15 | 16 | # enable i2c 17 | install -m 644 files/i2c.conf "${ROOTFS_DIR}/etc/modules-load.d/" 18 | sed -i -e "s/^#dtparam=i2c_arm=on/dtparam=i2c_arm=on/" "${ROOTFS_DIR}/boot/config.txt" 19 | 20 | # Install upload tool 21 | install -v -d "${ROOTFS_DIR}/usr/src/wpilib-ws-romi/scripts" 22 | install -m 755 files/uploadRomi.py "${ROOTFS_DIR}/usr/src/wpilib-ws-romi/scripts/" 23 | sed -i -e "s,\\\$NVM_BIN,/home/${FIRST_USER_NAME}/.nvm/versions/node/v14.15.0/bin," "${ROOTFS_DIR}/usr/src/wpilib-ws-romi/scripts/uploadRomi.py" 24 | 25 | install -m 644 files/romi.json "${ROOTFS_DIR}/boot/" 26 | 27 | # Install NVM and Romi package 28 | on_chroot << EOF 29 | export HOME="/home/${FIRST_USER_NAME}" 30 | 31 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh | bash 32 | 33 | export NVM_DIR="/home/${FIRST_USER_NAME}/.nvm" 34 | source "/home/${FIRST_USER_NAME}/.nvm/nvm.sh" 35 | 36 | nvm install 14.15.0 37 | 38 | npm --unsafe-perm --user=1000 --group=1000 install -g @wpilib/wpilib-ws-robot-romi 39 | npm --unsafe-perm --user=1000 --group=1000 install -g i2c-bus 40 | EOF 41 | 42 | # Fix NVM/NPM owner/group 43 | chown -R 1000:1000 "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.nvm" 44 | chown -R 1000:1000 "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config" 45 | 46 | # Set up Romi service 47 | install -v -d "${ROOTFS_DIR}/service/wpilibws-romi" 48 | install -m 755 files/wpilibws-romi_run "${ROOTFS_DIR}/service/wpilibws-romi/run" 49 | install -v -d "${ROOTFS_DIR}/service/wpilibws-romi/log" 50 | install -m 755 files/wpilibws-romi_log_run "${ROOTFS_DIR}/service/wpilibws-romi/log/run" 51 | 52 | on_chroot << EOF 53 | cd /service/wpilibws-romi && rm -f supervise && ln -s /tmp/wpilibws-romi-supervise supervise 54 | cd /service/wpilibws-romi/log && rm -f supervise && ln -s /tmp/wpilibws-romi-log-supervise supervise 55 | cd /etc/service && rm -f wpilibws-romi && ln -s /service/wpilibws-romi . 56 | EOF 57 | 58 | # Replace configServer script to add romi flag 59 | install -v -d "${ROOTFS_DIR}/service/configServer" 60 | install -m 755 files/configServer_run "${ROOTFS_DIR}/service/configServer/run" 61 | 62 | -------------------------------------------------------------------------------- /export-image/prerun.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | if [ "${NO_PRERUN_QCOW2}" = "0" ]; then 4 | IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img" 5 | 6 | unmount_image "${IMG_FILE}" 7 | 8 | rm -f "${IMG_FILE}" 9 | 10 | rm -rf "${ROOTFS_DIR}" 11 | mkdir -p "${ROOTFS_DIR}" 12 | 13 | BOOT_SIZE="$((256 * 1024 * 1024))" 14 | ROOT_SIZE=$(du --apparent-size -s "${EXPORT_ROOTFS_DIR}" --exclude var/cache/apt/archives --exclude boot --block-size=1 | cut -f 1) 15 | 16 | # All partition sizes and starts will be aligned to this size 17 | ALIGN="$((4 * 1024 * 1024))" 18 | # Add this much space to the calculated file size. This allows for 19 | # some overhead (since actual space usage is usually rounded up to the 20 | # filesystem block size) and gives some free space on the resulting 21 | # image. 22 | ROOT_MARGIN="$(echo "($ROOT_SIZE * 0.2 + 200 * 1024 * 1024) / 1" | bc)" 23 | 24 | BOOT_PART_START=$((ALIGN)) 25 | BOOT_PART_SIZE=$(((BOOT_SIZE + ALIGN - 1) / ALIGN * ALIGN)) 26 | ROOT_PART_START=$((BOOT_PART_START + BOOT_PART_SIZE)) 27 | ROOT_PART_SIZE=$(((ROOT_SIZE + ROOT_MARGIN + ALIGN - 1) / ALIGN * ALIGN)) 28 | IMG_SIZE=$((BOOT_PART_START + BOOT_PART_SIZE + ROOT_PART_SIZE)) 29 | 30 | truncate -s "${IMG_SIZE}" "${IMG_FILE}" 31 | 32 | parted --script "${IMG_FILE}" mklabel msdos 33 | parted --script "${IMG_FILE}" unit B mkpart primary fat32 "${BOOT_PART_START}" "$((BOOT_PART_START + BOOT_PART_SIZE - 1))" 34 | parted --script "${IMG_FILE}" unit B mkpart primary ext4 "${ROOT_PART_START}" "$((ROOT_PART_START + ROOT_PART_SIZE - 1))" 35 | 36 | echo "Creating loop device..." 37 | cnt=0 38 | until LOOP_DEV="$(losetup --show --find --partscan "$IMG_FILE")"; do 39 | if [ $cnt -lt 5 ]; then 40 | cnt=$((cnt + 1)) 41 | echo "Error in losetup. Retrying..." 42 | sleep 5 43 | else 44 | echo "ERROR: losetup failed; exiting" 45 | exit 1 46 | fi 47 | done 48 | 49 | BOOT_DEV="${LOOP_DEV}p1" 50 | ROOT_DEV="${LOOP_DEV}p2" 51 | 52 | ROOT_FEATURES="^huge_file" 53 | for FEATURE in 64bit; do 54 | if grep -q "$FEATURE" /etc/mke2fs.conf; then 55 | ROOT_FEATURES="^$FEATURE,$ROOT_FEATURES" 56 | fi 57 | done 58 | mkdosfs -n boot -F 32 -s 4 -v "$BOOT_DEV" > /dev/null 59 | mkfs.ext4 -L rootfs -O "$ROOT_FEATURES" "$ROOT_DEV" > /dev/null 60 | 61 | mount -v "$ROOT_DEV" "${ROOTFS_DIR}" -t ext4 62 | mkdir -p "${ROOTFS_DIR}/boot" 63 | mount -v "$BOOT_DEV" "${ROOTFS_DIR}/boot" -t vfat 64 | 65 | rsync -aHAXx --exclude /var/cache/apt/archives --exclude /boot "${EXPORT_ROOTFS_DIR}/" "${ROOTFS_DIR}/" 66 | rsync -rtx "${EXPORT_ROOTFS_DIR}/boot/" "${ROOTFS_DIR}/boot/" 67 | fi 68 | -------------------------------------------------------------------------------- /scripts/common: -------------------------------------------------------------------------------- 1 | log (){ 2 | date +"[%T] $*" | tee -a "${LOG_FILE}" 3 | } 4 | export -f log 5 | 6 | bootstrap(){ 7 | local BOOTSTRAP_CMD=debootstrap 8 | local BOOTSTRAP_ARGS=() 9 | 10 | export http_proxy=${APT_PROXY} 11 | 12 | BOOTSTRAP_ARGS+=(--arch arm64) 13 | BOOTSTRAP_ARGS+=(--include gnupg) 14 | BOOTSTRAP_ARGS+=(--components "main,contrib,non-free") 15 | #BOOTSTRAP_ARGS+=(--keyring "${STAGE_DIR}/files/raspberrypi.gpg") 16 | BOOTSTRAP_ARGS+=(--exclude=info) 17 | BOOTSTRAP_ARGS+=(--include=ca-certificates) 18 | BOOTSTRAP_ARGS+=("$@") 19 | printf -v BOOTSTRAP_STR '%q ' "${BOOTSTRAP_ARGS[@]}" 20 | 21 | capsh $CAPSH_ARG -- -c "'${BOOTSTRAP_CMD}' $BOOTSTRAP_STR" || true 22 | 23 | if [ -d "$2/debootstrap" ] && ! rmdir "$2/debootstrap"; then 24 | cp "$2/debootstrap/debootstrap.log" "${STAGE_WORK_DIR}" 25 | log "bootstrap failed: please check ${STAGE_WORK_DIR}/debootstrap.log" 26 | return 1 27 | fi 28 | } 29 | export -f bootstrap 30 | 31 | copy_previous(){ 32 | if [ ! -d "${PREV_ROOTFS_DIR}" ]; then 33 | echo "Previous stage rootfs not found" 34 | false 35 | fi 36 | mkdir -p "${ROOTFS_DIR}" 37 | rsync -aHAXx --exclude var/cache/apt/archives "${PREV_ROOTFS_DIR}/" "${ROOTFS_DIR}/" 38 | } 39 | export -f copy_previous 40 | 41 | unmount(){ 42 | if [ -z "$1" ]; then 43 | DIR=$PWD 44 | else 45 | DIR=$1 46 | fi 47 | 48 | while mount | grep -q "$DIR"; do 49 | local LOCS 50 | LOCS=$(mount | grep "$DIR" | cut -f 3 -d ' ' | sort -r) 51 | for loc in $LOCS; do 52 | umount "$loc" 53 | done 54 | done 55 | } 56 | export -f unmount 57 | 58 | unmount_image(){ 59 | sync 60 | sleep 1 61 | LOOP_DEVICE=$(losetup --list | grep "$1" | cut -f1 -d' ') 62 | if [ -n "$LOOP_DEVICE" ]; then 63 | for part in "$LOOP_DEVICE"p*; do 64 | if DIR=$(findmnt -n -o target -S "$part"); then 65 | unmount "$DIR" 66 | fi 67 | done 68 | losetup -d "$LOOP_DEVICE" 69 | fi 70 | } 71 | export -f unmount_image 72 | 73 | on_chroot() { 74 | if ! mount | grep -q "$(realpath "${ROOTFS_DIR}"/proc)"; then 75 | mount -t proc proc "${ROOTFS_DIR}/proc" 76 | fi 77 | 78 | if ! mount | grep -q "$(realpath "${ROOTFS_DIR}"/dev)"; then 79 | mount --bind /dev "${ROOTFS_DIR}/dev" 80 | fi 81 | 82 | if ! mount | grep -q "$(realpath "${ROOTFS_DIR}"/dev/pts)"; then 83 | mount --bind /dev/pts "${ROOTFS_DIR}/dev/pts" 84 | fi 85 | 86 | if ! mount | grep -q "$(realpath "${ROOTFS_DIR}"/sys)"; then 87 | mount --bind /sys "${ROOTFS_DIR}/sys" 88 | fi 89 | 90 | capsh $CAPSH_ARG "--chroot=${ROOTFS_DIR}/" -- -e "$@" 91 | } 92 | export -f on_chroot 93 | 94 | update_issue() { 95 | echo -e "${IMG_NAME} ${IMG_VERSION} built on ${IMG_DATE}\nGenerated using ${PI_GEN}, ${PI_GEN_REPO}, ${GIT_HASH}, ${1}" > "${ROOTFS_DIR}/etc/rpi-issue" 96 | } 97 | export -f update_issue 98 | -------------------------------------------------------------------------------- /stage2/01-sys-tweaks/01-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | install -m 755 files/resize2fs_once "${ROOTFS_DIR}/etc/init.d/" 4 | 5 | install -d "${ROOTFS_DIR}/etc/systemd/system/rc-local.service.d" 6 | install -m 644 files/ttyoutput.conf "${ROOTFS_DIR}/etc/systemd/system/rc-local.service.d/" 7 | 8 | install -m 644 files/50raspi "${ROOTFS_DIR}/etc/apt/apt.conf.d/" 9 | 10 | install -m 644 files/console-setup "${ROOTFS_DIR}/etc/default/" 11 | 12 | install -m 755 files/rc.local "${ROOTFS_DIR}/etc/" 13 | 14 | if [ -n "${PUBKEY_SSH_FIRST_USER}" ]; then 15 | install -v -m 0700 -o 1000 -g 1000 -d "${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.ssh 16 | echo "${PUBKEY_SSH_FIRST_USER}" >"${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.ssh/authorized_keys 17 | chown 1000:1000 "${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.ssh/authorized_keys 18 | chmod 0600 "${ROOTFS_DIR}"/home/"${FIRST_USER_NAME}"/.ssh/authorized_keys 19 | fi 20 | 21 | if [ "${PUBKEY_ONLY_SSH}" = "1" ]; then 22 | sed -i -Ee 's/^#?[[:blank:]]*PubkeyAuthentication[[:blank:]]*no[[:blank:]]*$/PubkeyAuthentication yes/ 23 | s/^#?[[:blank:]]*PasswordAuthentication[[:blank:]]*yes[[:blank:]]*$/PasswordAuthentication no/' "${ROOTFS_DIR}"/etc/ssh/sshd_config 24 | fi 25 | 26 | # 27 | # Set up for read-only file system 28 | # 29 | on_chroot << EOF 30 | rm -rf /var/lib/dhcp/ /var/lib/misc /var/run /var/spool /var/lock 31 | ln -s /tmp /var/lib/dhcp 32 | ln -s /tmp /var/lib/misc 33 | ln -s /run /var/run 34 | ln -s /tmp /var/spool 35 | ln -s /tmp /var/lock 36 | sed -i -e 's/d \/var\/spool/#d \/var\/spool/' /usr/lib/tmpfiles.d/var.conf 37 | sed -i -e 's/\/var\/lib\/ntp/\/var\/tmp/' /etc/ntp.conf 38 | EOF 39 | 40 | cat files/bash.bashrc >> "${ROOTFS_DIR}/etc/bash.bashrc" 41 | 42 | cat files/bash.logout >> "${ROOTFS_DIR}/etc/bash.bash_logout" 43 | 44 | on_chroot << EOF 45 | systemctl disable hwclock.sh 46 | systemctl disable nfs-common 47 | systemctl disable rpcbind 48 | if [ "${ENABLE_SSH}" == "1" ]; then 49 | systemctl enable ssh 50 | else 51 | systemctl disable ssh 52 | fi 53 | systemctl enable regenerate_ssh_host_keys 54 | EOF 55 | 56 | if [ "${USE_QEMU}" = "1" ]; then 57 | echo "enter QEMU mode" 58 | install -m 644 files/90-qemu.rules "${ROOTFS_DIR}/etc/udev/rules.d/" 59 | on_chroot << EOF 60 | systemctl disable resize2fs_once 61 | EOF 62 | echo "leaving QEMU mode" 63 | else 64 | on_chroot << EOF 65 | systemctl enable resize2fs_once 66 | EOF 67 | fi 68 | 69 | on_chroot <&2 5 | exit 1 6 | fi 7 | 8 | progname=$(basename $0) 9 | 10 | function usage() 11 | { 12 | cat << HEREDOC 13 | 14 | Usage: 15 | Mount Image : $progname [--mount] [--image-name ] [--mount-point ] 16 | Umount Image: $progname [--umount] [--mount-point ] 17 | Cleanup NBD : $progname [--cleanup] 18 | 19 | arguments: 20 | -h, --help show this help message and exit 21 | -c, --cleanup cleanup orphaned device mappings 22 | -m, --mount mount image 23 | -u, --umount umount image 24 | -i, --image-name path to qcow2 image 25 | -p, --mount-point mount point for image 26 | 27 | This tool will use /dev/nbd1 as default for mounting an image. If you want to use another device, execute like this: 28 | NBD_DEV=/dev/nbd2 ./$progname --mount --image-name --mount-point 29 | 30 | HEREDOC 31 | } 32 | 33 | MOUNT=0 34 | UMOUNT=0 35 | IMAGE="" 36 | MOUNTPOINT="" 37 | 38 | nbd_cleanup() { 39 | DEVS="$(lsblk | grep nbd | grep disk | cut -d" " -f1)" 40 | if [ ! -z "${DEVS}" ]; then 41 | for d in $DEVS; do 42 | if [ ! -z "${d}" ]; then 43 | QDEV="$(ps xa | grep $d | grep -v grep)" 44 | if [ -z "${QDEV}" ]; then 45 | kpartx -d /dev/$d && echo "Unconnected device map removed: /dev/$d" 46 | fi 47 | fi 48 | done 49 | fi 50 | } 51 | 52 | # As long as there is at least one more argument, keep looping 53 | while [[ $# -gt 0 ]]; do 54 | key="$1" 55 | case "$key" in 56 | -h|--help) 57 | usage 58 | exit 59 | ;; 60 | -c|--cleanup) 61 | nbd_cleanup 62 | ;; 63 | -m|--mount) 64 | MOUNT=1 65 | ;; 66 | -u|--umount) 67 | UMOUNT=1 68 | ;; 69 | -i|--image-name) 70 | shift 71 | IMAGE="$1" 72 | ;; 73 | -p|--mount-point) 74 | shift 75 | MOUNTPOINT="$1" 76 | ;; 77 | *) 78 | echo "Unknown option '$key'" 79 | usage 80 | exit 81 | ;; 82 | esac 83 | # Shift after checking all the cases to get the next option 84 | shift 85 | done 86 | 87 | if [ "${MOUNT}" = "1" ] && [ "${UMOUNT}" = "1" ]; then 88 | usage 89 | echo "Concurrent mount options not possible." 90 | exit 91 | fi 92 | 93 | if [ "${MOUNT}" = "1" ] && ([ -z "${IMAGE}" ] || [ -z "${MOUNTPOINT}" ]); then 94 | usage 95 | echo "Can not mount image. Image path and/or mount point missing." 96 | exit 97 | fi 98 | 99 | if [ "${UMOUNT}" = "1" ] && [ -z "${MOUNTPOINT}" ]; then 100 | usage 101 | echo "Can not umount. Mount point parameter missing." 102 | exit 103 | fi 104 | 105 | export NBD_DEV="${NBD_DEV:-/dev/nbd1}" 106 | export MAP_BOOT_DEV=/dev/mapper/nbd1p1 107 | export MAP_ROOT_DEV=/dev/mapper/nbd1p2 108 | source scripts/qcow2_handling 109 | 110 | if [ "${MOUNT}" = "1" ]; then 111 | mount_qimage "${IMAGE}" "${MOUNTPOINT}" 112 | elif [ "${UMOUNT}" = "1" ]; then 113 | umount_qimage "${MOUNTPOINT}" 114 | fi 115 | -------------------------------------------------------------------------------- /stage1/00-boot-files/files/config.txt: -------------------------------------------------------------------------------- 1 | # For more options and information see 2 | # http://rpf.io/configtxt 3 | # Some settings may impact device functionality. See link above for details 4 | 5 | # uncomment if you get no picture on HDMI for a default "safe" mode 6 | #hdmi_safe=1 7 | 8 | # uncomment the following to adjust overscan. Use positive numbers if console 9 | # goes off screen, and negative if there is too much border 10 | #overscan_left=16 11 | #overscan_right=16 12 | #overscan_top=16 13 | #overscan_bottom=16 14 | 15 | # uncomment to force a console size. By default it will be display's size minus 16 | # overscan. 17 | #framebuffer_width=1280 18 | #framebuffer_height=720 19 | 20 | # uncomment if hdmi display is not detected and composite is being output 21 | #hdmi_force_hotplug=1 22 | 23 | # uncomment to force a specific HDMI mode (this will force VGA) 24 | #hdmi_group=1 25 | #hdmi_mode=1 26 | 27 | # uncomment to force a HDMI mode rather than DVI. This can make audio work in 28 | # DMT (computer monitor) modes 29 | #hdmi_drive=2 30 | 31 | # uncomment to increase signal to HDMI, if you have interference, blanking, or 32 | # no display 33 | #config_hdmi_boost=4 34 | 35 | # uncomment for composite PAL 36 | #sdtv_mode=2 37 | 38 | #uncomment to overclock the arm. 700 MHz is the default. 39 | #arm_freq=800 40 | 41 | # Uncomment some or all of these to enable the optional hardware interfaces 42 | #dtparam=i2c_arm=on 43 | #dtparam=i2s=on 44 | #dtparam=spi=on 45 | 46 | # Uncomment this to enable infrared communication. 47 | #dtoverlay=gpio-ir,gpio_pin=17 48 | #dtoverlay=gpio-ir-tx,gpio_pin=18 49 | 50 | # Additional overlays and parameters are documented /boot/overlays/README 51 | 52 | # Enable audio (loads snd_bcm2835) 53 | dtparam=audio=on 54 | 55 | # Enable camera 56 | start_x=1 57 | gpu_mem=128 58 | disable_camera_led=1 59 | 60 | # Automatically load overlays for detected cameras 61 | # This generally doesn't seem to work for V4L2 (what cscore uses); 62 | # Instead change this to 0 and uncomment the line for the sensor you want 63 | # to use. 64 | # Pi Camera Board v1.3: ov5647 65 | # Pi Camera Board v2: imx219 66 | camera_auto_detect=1 67 | #dtoverlay=imx219,media-controller=0 68 | #dtoverlay=imx290,clock-frequency=74250000,media-controller=0 69 | #dtoverlay=imx290,clock-frequency=37125000,media-controller=0 70 | #dtoverlay=imx378,media-controller=0 71 | #dtoverlay=ov5647,media-controller=0 72 | #dtoverlay=ov9281,media-controller=0 73 | 74 | # Automatically load overlays for detected DSI displays 75 | display_auto_detect=1 76 | 77 | # Enable DRM VC4 V3D driver 78 | dtoverlay=vc4-kms-v3d 79 | max_framebuffers=2 80 | 81 | # Run in 64-bit mode 82 | arm_64bit=1 83 | 84 | # Disable compensation for displays with overscan 85 | disable_overscan=1 86 | 87 | [cm4] 88 | # Enable host mode on the 2711 built-in XHCI USB controller. 89 | # This line should be removed if the legacy DWC2 controller is required 90 | # (e.g. for USB device mode) or if USB support is not required. 91 | otg_mode=1 92 | 93 | [all] 94 | 95 | [pi4] 96 | # Run as fast as firmware / board allows 97 | arm_boost=1 98 | 99 | [all] 100 | -------------------------------------------------------------------------------- /deps/examples/java-multiCameraServer/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if %ERRORLEVEL% equ 0 goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if %ERRORLEVEL% equ 0 goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | set EXIT_CODE=%ERRORLEVEL% 84 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 85 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 86 | exit /b %EXIT_CODE% 87 | 88 | :mainEnd 89 | if "%OS%"=="Windows_NT" endlocal 90 | 91 | :omega 92 | -------------------------------------------------------------------------------- /deps/tools/.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | Language: Cpp 3 | BasedOnStyle: Google 4 | AccessModifierOffset: -1 5 | AlignAfterOpenBracket: Align 6 | AlignConsecutiveAssignments: false 7 | AlignConsecutiveDeclarations: false 8 | AlignEscapedNewlines: Left 9 | AlignOperands: true 10 | AlignTrailingComments: true 11 | AllowAllParametersOfDeclarationOnNextLine: true 12 | AllowShortBlocksOnASingleLine: false 13 | AllowShortCaseLabelsOnASingleLine: false 14 | AllowShortFunctionsOnASingleLine: All 15 | AllowShortIfStatementsOnASingleLine: true 16 | AllowShortLoopsOnASingleLine: true 17 | AlwaysBreakAfterDefinitionReturnType: None 18 | AlwaysBreakAfterReturnType: None 19 | AlwaysBreakBeforeMultilineStrings: true 20 | AlwaysBreakTemplateDeclarations: true 21 | BinPackArguments: true 22 | BinPackParameters: true 23 | BraceWrapping: 24 | AfterClass: false 25 | AfterControlStatement: false 26 | AfterEnum: false 27 | AfterFunction: false 28 | AfterNamespace: false 29 | AfterObjCDeclaration: false 30 | AfterStruct: false 31 | AfterUnion: false 32 | BeforeCatch: false 33 | BeforeElse: false 34 | IndentBraces: false 35 | SplitEmptyFunction: true 36 | SplitEmptyRecord: true 37 | SplitEmptyNamespace: true 38 | BreakBeforeBinaryOperators: None 39 | BreakBeforeBraces: Attach 40 | BreakBeforeInheritanceComma: false 41 | BreakBeforeTernaryOperators: true 42 | BreakConstructorInitializersBeforeComma: false 43 | BreakConstructorInitializers: BeforeColon 44 | BreakAfterJavaFieldAnnotations: false 45 | BreakStringLiterals: true 46 | ColumnLimit: 80 47 | CommentPragmas: '^ IWYU pragma:' 48 | CompactNamespaces: false 49 | ConstructorInitializerAllOnOneLineOrOnePerLine: true 50 | ConstructorInitializerIndentWidth: 4 51 | ContinuationIndentWidth: 4 52 | Cpp11BracedListStyle: true 53 | DerivePointerAlignment: false 54 | DisableFormat: false 55 | ExperimentalAutoDetectBinPacking: false 56 | FixNamespaceComments: true 57 | ForEachMacros: 58 | - foreach 59 | - Q_FOREACH 60 | - BOOST_FOREACH 61 | IncludeCategories: 62 | - Regex: '^<.*\.h>' 63 | Priority: 1 64 | - Regex: '^<.*' 65 | Priority: 2 66 | - Regex: '.*' 67 | Priority: 3 68 | IncludeIsMainRegex: '([-_](test|unittest))?$' 69 | IndentCaseLabels: true 70 | IndentWidth: 2 71 | IndentWrappedFunctionNames: false 72 | JavaScriptQuotes: Leave 73 | JavaScriptWrapImports: true 74 | KeepEmptyLinesAtTheStartOfBlocks: false 75 | MacroBlockBegin: '' 76 | MacroBlockEnd: '' 77 | MaxEmptyLinesToKeep: 1 78 | NamespaceIndentation: None 79 | ObjCBlockIndentWidth: 2 80 | ObjCSpaceAfterProperty: false 81 | ObjCSpaceBeforeProtocolList: false 82 | PenaltyBreakAssignment: 2 83 | PenaltyBreakBeforeFirstCallParameter: 1 84 | PenaltyBreakComment: 300 85 | PenaltyBreakFirstLessLess: 120 86 | PenaltyBreakString: 1000 87 | PenaltyExcessCharacter: 1000000 88 | PenaltyReturnTypeOnItsOwnLine: 200 89 | PointerAlignment: Left 90 | ReflowComments: true 91 | SortIncludes: false 92 | SortUsingDeclarations: true 93 | SpaceAfterCStyleCast: false 94 | SpaceAfterTemplateKeyword: true 95 | SpaceBeforeAssignmentOperators: true 96 | SpaceBeforeParens: ControlStatements 97 | SpaceInEmptyParentheses: false 98 | SpacesBeforeTrailingComments: 2 99 | SpacesInAngles: false 100 | SpacesInContainerLiterals: true 101 | SpacesInCStyleCastParentheses: false 102 | SpacesInParentheses: false 103 | SpacesInSquareBrackets: false 104 | Standard: Auto 105 | TabWidth: 8 106 | UseTab: Never 107 | ... 108 | -------------------------------------------------------------------------------- /export-image/05-finalise/01-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img" 4 | INFO_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.info" 5 | EXAMPLE_DIR="${STAGE_WORK_DIR}/examples" 6 | 7 | mkdir -p "${EXAMPLE_DIR}" 8 | cp -p "${ROOTFS_DIR}"/home/${FIRST_USER_NAME}/zips/* "${EXAMPLE_DIR}/" 9 | 10 | on_chroot << EOF 11 | if [ -x /etc/init.d/fake-hwclock ]; then 12 | /etc/init.d/fake-hwclock stop 13 | fi 14 | if hash hardlink 2>/dev/null; then 15 | hardlink -t /usr/share/doc 16 | fi 17 | EOF 18 | 19 | if [ -d "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config" ]; then 20 | chmod 700 "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config" 21 | fi 22 | 23 | rm -f "${ROOTFS_DIR}/usr/bin/qemu-arm-static" 24 | 25 | if [ "${USE_QEMU}" != "1" ]; then 26 | if [ -e "${ROOTFS_DIR}/etc/ld.so.preload.disabled" ]; then 27 | mv "${ROOTFS_DIR}/etc/ld.so.preload.disabled" "${ROOTFS_DIR}/etc/ld.so.preload" 28 | fi 29 | fi 30 | 31 | rm -f "${ROOTFS_DIR}/etc/network/interfaces.dpkg-old" 32 | 33 | rm -f "${ROOTFS_DIR}/etc/apt/sources.list~" 34 | rm -f "${ROOTFS_DIR}/etc/apt/trusted.gpg~" 35 | 36 | rm -f "${ROOTFS_DIR}/etc/passwd-" 37 | rm -f "${ROOTFS_DIR}/etc/group-" 38 | rm -f "${ROOTFS_DIR}/etc/shadow-" 39 | rm -f "${ROOTFS_DIR}/etc/gshadow-" 40 | rm -f "${ROOTFS_DIR}/etc/subuid-" 41 | rm -f "${ROOTFS_DIR}/etc/subgid-" 42 | 43 | rm -f "${ROOTFS_DIR}"/var/cache/debconf/*-old 44 | rm -f "${ROOTFS_DIR}"/var/lib/dpkg/*-old 45 | 46 | rm -f "${ROOTFS_DIR}"/usr/share/icons/*/icon-theme.cache 47 | 48 | rm -f "${ROOTFS_DIR}/var/lib/dbus/machine-id" 49 | 50 | true > "${ROOTFS_DIR}/etc/machine-id" 51 | 52 | ln -nsf /proc/mounts "${ROOTFS_DIR}/etc/mtab" 53 | 54 | find "${ROOTFS_DIR}/var/log/" -type f -exec cp /dev/null {} \; 55 | 56 | rm -f "${ROOTFS_DIR}/root/.vnc/private.key" 57 | rm -f "${ROOTFS_DIR}/etc/vnc/updateid" 58 | 59 | update_issue "$(basename "${EXPORT_DIR}")" 60 | install -m 644 "${ROOTFS_DIR}/etc/rpi-issue" "${ROOTFS_DIR}/boot/issue.txt" 61 | 62 | cp "$ROOTFS_DIR/etc/rpi-issue" "$INFO_FILE" 63 | 64 | 65 | { 66 | if [ -f "$ROOTFS_DIR/usr/share/doc/raspberrypi-kernel/changelog.Debian.gz" ]; then 67 | firmware=$(zgrep "firmware as of" \ 68 | "$ROOTFS_DIR/usr/share/doc/raspberrypi-kernel/changelog.Debian.gz" | \ 69 | head -n1 | sed -n 's|.* \([^ ]*\)$|\1|p') 70 | printf "\nFirmware: https://github.com/raspberrypi/firmware/tree/%s\n" "$firmware" 71 | 72 | kernel="$(curl -s -L "https://github.com/raspberrypi/firmware/raw/$firmware/extra/git_hash")" 73 | printf "Kernel: https://github.com/raspberrypi/linux/tree/%s\n" "$kernel" 74 | 75 | uname="$(curl -s -L "https://github.com/raspberrypi/firmware/raw/$firmware/extra/uname_string7")" 76 | printf "Uname string: %s\n" "$uname" 77 | fi 78 | 79 | printf "\nPackages:\n" 80 | dpkg -l --root "$ROOTFS_DIR" 81 | } >> "$INFO_FILE" 82 | 83 | mkdir -p "${DEPLOY_DIR}" 84 | 85 | rm -f "${DEPLOY_DIR}/${ARCHIVE_FILENAME}${IMG_SUFFIX}.*" 86 | rm -f "${DEPLOY_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img" 87 | 88 | mv "$INFO_FILE" "$DEPLOY_DIR/" 89 | cp -Rp "${EXAMPLE_DIR}" "${DEPLOY_DIR}" 90 | 91 | if [ "${USE_QCOW2}" = "0" ] && [ "${NO_PRERUN_QCOW2}" = "0" ]; then 92 | ROOT_DEV="$(mount | grep "${ROOTFS_DIR} " | cut -f1 -d' ')" 93 | 94 | unmount "${ROOTFS_DIR}" 95 | zerofree "${ROOT_DEV}" 96 | 97 | unmount_image "${IMG_FILE}" 98 | else 99 | unload_qimage 100 | make_bootable_image "${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.qcow2" "$IMG_FILE" 101 | fi 102 | 103 | case "${DEPLOY_COMPRESSION}" in 104 | zip) 105 | pushd "${STAGE_WORK_DIR}" > /dev/null 106 | zip -"${COMPRESSION_LEVEL}" \ 107 | "${DEPLOY_DIR}/${ARCHIVE_FILENAME}${IMG_SUFFIX}.zip" "$(basename "${IMG_FILE}")" 108 | popd > /dev/null 109 | ;; 110 | gz) 111 | pigz --force -"${COMPRESSION_LEVEL}" "$IMG_FILE" --stdout > \ 112 | "${DEPLOY_DIR}/${ARCHIVE_FILENAME}${IMG_SUFFIX}.img.gz" 113 | ;; 114 | xz) 115 | xz --compress --force --threads 0 --memlimit-compress=50% -"${COMPRESSION_LEVEL}" \ 116 | --stdout "$IMG_FILE" > "${DEPLOY_DIR}/${ARCHIVE_FILENAME}${IMG_SUFFIX}.img.xz" 117 | ;; 118 | none | *) 119 | cp "$IMG_FILE" "$DEPLOY_DIR/" 120 | ;; 121 | esac 122 | -------------------------------------------------------------------------------- /stage4/01-sys-tweaks/01-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | SUB_STAGE_DIR=${PWD} 4 | 5 | # enable pi camera 6 | install -m 644 files/picamera.conf "${ROOTFS_DIR}/etc/modules-load.d/" 7 | 8 | install -m 644 files/frc.json "${ROOTFS_DIR}/boot/" 9 | 10 | # 11 | # Install tools sources 12 | # install to both image and work directory (to build) 13 | # 14 | sh -c "cd ${BASE_DIR}/deps/tools && tar cf - ." | \ 15 | sh -c "cd ${ROOTFS_DIR}/usr/src && tar xf -" 16 | sh -c "cd ${BASE_DIR}/deps && tar cf - tools" | \ 17 | sh -c "cd ${STAGE_WORK_DIR} && tar xf -" 18 | 19 | # 20 | # Build tools 21 | # 22 | pushd "${STAGE_WORK_DIR}/tools" 23 | 24 | export CXXFLAGS="-std=c++20 --sysroot=${ROOTFS_DIR} -Wl,-rpath -Wl,${ROOTFS_DIR}/opt/vc/lib" 25 | export PKG_CONFIG_DIR= 26 | export PKG_CONFIG_LIBDIR=${ROOTFS_DIR}/usr/lib/aarch64-linux-gnu/pkgconfig:${ROOTFS_DIR}/usr/lib/pkgconfig:${ROOTFS_DIR}/usr/share/pkgconfig:${ROOTFS_DIR}/usr/local/frc-static/lib/pkgconfig 27 | export PKG_CONFIG_SYSROOT_DIR=${ROOTFS_DIR} 28 | 29 | # setuidgids 30 | pushd setuidgids 31 | make CC=aarch64-linux-gnu-gcc 32 | install -m 755 setuidgids "${ROOTFS_DIR}/usr/local/bin/" 33 | 34 | popd 35 | 36 | # multiCameraServer 37 | pushd multiCameraServer 38 | make CXX=aarch64-linux-gnu-g++ 39 | install -m 755 multiCameraServer "${ROOTFS_DIR}/usr/local/frc/bin/" 40 | 41 | popd 42 | 43 | # configServer 44 | pushd configServer 45 | make CXX=aarch64-linux-gnu-g++ 46 | install -m 755 configServer "${ROOTFS_DIR}/usr/local/sbin/" 47 | 48 | popd 49 | 50 | popd 51 | 52 | # 53 | # Examples 54 | # install to both image and work directory (to build zips) 55 | # 56 | export PKG_CONFIG_LIBDIR=${ROOTFS_DIR}/usr/lib/aarch64-linux-gnu/pkgconfig:${ROOTFS_DIR}/usr/lib/pkgconfig:${ROOTFS_DIR}/usr/share/pkgconfig:${ROOTFS_DIR}/usr/local/frc/lib/pkgconfig 57 | 58 | sh -c "cd ${BASE_DIR}/deps && tar cf - examples" | \ 59 | sh -c "cd ${ROOTFS_DIR}/home/${FIRST_USER_NAME} && tar xf -" 60 | for dir in ${ROOTFS_DIR}/home/${FIRST_USER_NAME}/examples/*; do 61 | cp "${BASE_DIR}/LICENSE.md" "${dir}/" 62 | done 63 | chown -R 1000:1000 "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/examples" 64 | 65 | rm -rf "${STAGE_WORK_DIR}/examples" 66 | sh -c "cd ${BASE_DIR}/deps && tar cf - examples" | \ 67 | sh -c "cd ${STAGE_WORK_DIR} && tar xf -" 68 | for dir in ${STAGE_WORK_DIR}/examples/*; do 69 | cp "${BASE_DIR}/LICENSE.md" "${dir}/" 70 | done 71 | 72 | # build zips 73 | pushd "${STAGE_WORK_DIR}/examples" 74 | 75 | # add jar dependencies to java-multiCameraServer 76 | sh -c "cd ${ROOTFS_DIR}/usr/local/frc/java && tar cf - *.jar" | \ 77 | sh -c "cd java-multiCameraServer && tar xf -" 78 | 79 | # add header and library dependencies (excluding .debug files) to 80 | # cpp-multiCameraServer 81 | sh -c "cd ${ROOTFS_DIR}/usr/local/frc && tar cf - include" | \ 82 | sh -c "cd cpp-multiCameraServer && tar xf -" 83 | mkdir -p cpp-multiCameraServer/lib 84 | LIBS=`pkg-config --libs wpilibc | sed -e "s,-L[^ ]*,,g;s,-l\\([^ ]*\\),${ROOTFS_DIR}/usr/local/frc/lib/lib\\1.so,g"` 85 | for lib in ${LIBS}; do 86 | ln -sf ${lib} cpp-multiCameraServer/lib/ 87 | done 88 | 89 | # update Makefile to use cross-compiler and point to local dependencies 90 | cat > cpp-multiCameraServer/Makefile.new << EOF 91 | CXX=aarch64-linux-gnu-g++ 92 | DEPS_CFLAGS=`pkg-config --cflags wpilibc | sed -e "s,${ROOTFS_DIR}/usr/local/frc/,,g"` 93 | DEPS_LIBS=`pkg-config --libs wpilibc | sed -e "s,${ROOTFS_DIR}/usr/local/frc/,,g"` 94 | EOF 95 | sed -e '/^DEPS_/d' cpp-multiCameraServer/Makefile >> cpp-multiCameraServer/Makefile.new 96 | mv cpp-multiCameraServer/Makefile.new cpp-multiCameraServer/Makefile 97 | 98 | # add windows make executable 99 | cp "${SUB_STAGE_DIR}/files/make.exe" cpp-multiCameraServer/ 100 | 101 | zip -r java-multiCameraServer.zip java-multiCameraServer 102 | zip -r cpp-multiCameraServer.zip cpp-multiCameraServer 103 | zip -r python-multiCameraServer.zip python-multiCameraServer 104 | 105 | # install zips 106 | install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/zips/" 107 | install -v -o 1000 -g 1000 *.zip "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/zips/" 108 | 109 | popd 110 | 111 | # 112 | # Set up services 113 | # 114 | 115 | # configServer 116 | install -v -d "${ROOTFS_DIR}/service/configServer" 117 | install -m 755 files/configServer_run "${ROOTFS_DIR}/service/configServer/run" 118 | on_chroot << EOF 119 | cd /service/configServer && rm -f supervise && ln -s /tmp/configServer-supervise supervise 120 | cd /etc/service && rm -f configServer && ln -s /service/configServer . 121 | EOF 122 | 123 | # camera 124 | install -v -d "${ROOTFS_DIR}/service/camera" 125 | install -m 755 files/camera_run "${ROOTFS_DIR}/service/camera/run" 126 | install -v -d "${ROOTFS_DIR}/service/camera/log" 127 | install -m 755 files/camera_log_run "${ROOTFS_DIR}/service/camera/log/run" 128 | 129 | on_chroot << EOF 130 | cd /service/camera && rm -f supervise && ln -s /tmp/camera-supervise supervise 131 | cd /service/camera/log && rm -f supervise && ln -s /tmp/camera-log-supervise supervise 132 | cd /etc/service && rm -f camera && ln -s /service/camera . 133 | EOF 134 | 135 | # 136 | # Set up pi user scripts 137 | # 138 | install -m 755 -o 1000 -g 1000 files/runCamera "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/" 139 | install -m 755 -o 1000 -g 1000 files/runInteractive "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/" 140 | install -m 755 -o 1000 -g 1000 files/runService "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/" 141 | 142 | # 143 | # Create directory needed for GradleRIO deployment 144 | # 145 | install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/usr/local/frc/third-party/lib/" 146 | -------------------------------------------------------------------------------- /deps/tools/configServer/src/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include "MyHttpConnection.h" 21 | #include "NetworkSettings.h" 22 | #include "RomiStatus.h" 23 | #include "SystemStatus.h" 24 | #include "VisionStatus.h" 25 | 26 | namespace uv = wpi::uv; 27 | 28 | bool romi = false; 29 | static uint64_t startTime = wpi::Now(); 30 | 31 | int main(int argc, char* argv[]) { 32 | int port = 80; 33 | if (argc >= 2 && std::string_view{argv[1]} == "--romi") { 34 | --argc; 35 | ++argv; 36 | romi = true; 37 | } 38 | if (argc == 2) port = std::atoi(argv[1]); 39 | 40 | uv::Process::DisableStdioInheritance(); 41 | 42 | SystemStatus::GetInstance(); 43 | 44 | auto loop = uv::Loop::Create(); 45 | 46 | NetworkSettings::GetInstance()->SetLoop(loop); 47 | if (romi) RomiStatus::GetInstance()->SetLoop(loop); 48 | VisionStatus::GetInstance()->SetLoop(loop); 49 | 50 | loop->error.connect( 51 | [](uv::Error err) { fmt::print(stderr, "uv ERROR: {}\n", err.str()); }); 52 | 53 | auto tcp = uv::Tcp::Create(loop); 54 | 55 | // bind to listen address and port 56 | tcp->Bind("", port); 57 | 58 | // when we get a connection, accept it and start reading 59 | tcp->connection.connect([srv = tcp.get()] { 60 | auto tcp = srv->Accept(); 61 | if (!tcp) return; 62 | // fmt::print(stderr, "Got a connection\n"); 63 | 64 | // Close on error 65 | tcp->error.connect([s = tcp.get()](wpi::uv::Error err) { 66 | fmt::print(stderr, "stream error: {}\n", err.str()); 67 | s->Close(); 68 | }); 69 | 70 | auto conn = std::make_shared(tcp); 71 | tcp->SetData(conn); 72 | }); 73 | 74 | // start listening for incoming connections 75 | tcp->Listen(); 76 | 77 | fmt::print(stderr, "Listening on port {}\n", port); 78 | 79 | // start timer to collect system and vision status 80 | auto timer = uv::Timer::Create(loop); 81 | timer->Start(std::chrono::seconds(1), std::chrono::seconds(1)); 82 | timer->timeout.connect([&loop] { 83 | SystemStatus::GetInstance()->UpdateAll(); 84 | VisionStatus::GetInstance()->UpdateStatus(); 85 | if (romi) { 86 | RomiStatus::GetInstance()->UpdateStatus(); 87 | } 88 | }); 89 | 90 | // listen on port 6666 for console logging 91 | auto udpCon = uv::Udp::Create(loop); 92 | udpCon->Bind("127.0.0.1", 6666, UV_UDP_REUSEADDR); 93 | udpCon->StartRecv(); 94 | udpCon->received.connect( 95 | [](uv::Buffer& buf, size_t len, const sockaddr&, unsigned) { 96 | VisionStatus::GetInstance()->ConsoleLog(buf, len); 97 | }); 98 | 99 | // listen on port 7777 for romi console logging 100 | if (romi) { 101 | auto udpCon = uv::Udp::Create(loop); 102 | udpCon->Bind("127.0.0.1", 7777, UV_UDP_REUSEADDR); 103 | udpCon->StartRecv(); 104 | udpCon->received.connect( 105 | [](uv::Buffer& buf, size_t len, const sockaddr&, unsigned) { 106 | RomiStatus::GetInstance()->ConsoleLog(buf, len); 107 | }); 108 | } 109 | 110 | // create riolog console port 111 | auto tcpCon = uv::Tcp::Create(loop); 112 | tcpCon->Bind("", 1740); 113 | 114 | // when we get a connection, accept it 115 | tcpCon->connection.connect([ srv = tcpCon.get(), udpCon ] { 116 | auto tcp = srv->Accept(); 117 | if (!tcp) return; 118 | 119 | // close on error 120 | tcp->error.connect([s = tcp.get()](uv::Error err) { s->Close(); }); 121 | 122 | // copy console log to it with headers 123 | udpCon->received.connect( 124 | [ tcpSeq = std::make_shared(), tcpPtr = tcp.get() ]( 125 | uv::Buffer & buf, size_t len, const sockaddr&, unsigned) { 126 | // build buffers 127 | wpi::SmallVector bufs; 128 | wpi::raw_uv_ostream out(bufs, 4096); 129 | 130 | // Header is 2 byte len, 1 byte type, 4 byte timestamp, 2 byte 131 | // sequence num 132 | uint32_t ts = wpi::FloatToBits((wpi::Now() - startTime) * 1.0e-6); 133 | uint16_t pktlen = len + 1 + 4 + 2; 134 | const uint8_t contents[] = 135 | {static_cast((pktlen >> 8) & 0xff), 136 | static_cast(pktlen & 0xff), 12, 137 | static_cast((ts >> 24) & 0xff), 138 | static_cast((ts >> 16) & 0xff), 139 | static_cast((ts >> 8) & 0xff), 140 | static_cast(ts & 0xff), 141 | static_cast((*tcpSeq >> 8) & 0xff), 142 | static_cast(*tcpSeq & 0xff)}; 143 | out << std::span{contents}; 144 | out << std::string_view{buf.base, len}; 145 | (*tcpSeq)++; 146 | 147 | // send output 148 | tcpPtr->Write(bufs, [](auto bufs2, uv::Error) { 149 | for (auto buf : bufs2) buf.Deallocate(); 150 | }); 151 | }, 152 | tcp); 153 | }); 154 | 155 | // start listening for incoming connections 156 | tcpCon->Listen(); 157 | 158 | // run loop 159 | loop->Run(); 160 | } 161 | -------------------------------------------------------------------------------- /deps/tools/configServer/src/Application.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | #include "Application.h" 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include "UploadHelper.h" 21 | #include "VisionStatus.h" 22 | 23 | #define TYPE_TAG "### TYPE:" 24 | 25 | std::shared_ptr Application::GetInstance() { 26 | static auto inst = std::make_shared(private_init{}); 27 | return inst; 28 | } 29 | 30 | void Application::Set(std::string_view appType, 31 | std::function onFail) { 32 | std::string_view appDir; 33 | std::string_view appEnv; 34 | std::string_view appCommand; 35 | 36 | if (appType == "builtin") { 37 | appCommand = "/usr/local/frc/bin/multiCameraServer"; 38 | } else if (appType == "example-java") { 39 | appDir = "examples/java-multiCameraServer"; 40 | appCommand = 41 | "env LD_LIBRARY_PATH=/usr/local/frc/lib java -jar " 42 | "build/libs/java-multiCameraServer-all.jar"; 43 | } else if (appType == "example-cpp") { 44 | appDir = "examples/cpp-multiCameraServer"; 45 | appCommand = "./multiCameraServerExample"; 46 | } else if (appType == "example-python") { 47 | appDir = "examples/python-multiCameraServer"; 48 | appEnv = "export PYTHONUNBUFFERED=1"; 49 | appCommand = "/usr/bin/python3 multiCameraServer.py"; 50 | } else if (appType == "upload-java") { 51 | appCommand = 52 | "env LD_LIBRARY_PATH=/usr/local/frc/lib java -jar uploaded.jar"; 53 | } else if (appType == "upload-cpp") { 54 | appCommand = "./uploaded"; 55 | } else if (appType == "upload-python") { 56 | appEnv = "export PYTHONUNBUFFERED=1"; 57 | appCommand = "/usr/bin/python3 uploaded.py"; 58 | } else if (appType == "custom") { 59 | return; 60 | } else { 61 | onFail(fmt::format("unrecognized application type '{}'", appType)); 62 | return; 63 | } 64 | 65 | { 66 | // write file 67 | std::error_code ec; 68 | wpi::raw_fd_ostream os(EXEC_HOME "/runCamera", ec, fs::F_Text); 69 | if (ec) { 70 | onFail("could not write " EXEC_HOME "/runCamera"); 71 | return; 72 | } 73 | fmt::print(os, "#!/bin/sh\n"); 74 | fmt::print(os, "{} {}\n", TYPE_TAG, appType); 75 | fmt::print(os, "echo \"Waiting 5 seconds...\"\n"); 76 | fmt::print(os, "sleep 5\n"); 77 | if (!appDir.empty()) fmt::print(os, "cd {}\n", appDir); 78 | if (!appEnv.empty()) fmt::print(os, "{}\n", appEnv); 79 | fmt::print(os, "exec {}\n", appCommand); 80 | } 81 | 82 | // terminate vision process so it reloads 83 | VisionStatus::GetInstance()->Terminate(onFail); 84 | 85 | UpdateStatus(); 86 | } 87 | 88 | void Application::FinishUpload(std::string_view appType, UploadHelper& helper, 89 | std::function onFail) { 90 | std::string_view filename; 91 | if (appType == "upload-java") { 92 | filename = "/uploaded.jar"; 93 | } else if (appType == "upload-cpp") { 94 | filename = "/uploaded"; 95 | } else if (appType == "upload-python") { 96 | filename = "/uploaded.py"; 97 | } else { 98 | onFail(fmt::format("cannot upload application type '{}'", appType)); 99 | helper.Close(); 100 | return; 101 | } 102 | 103 | int fd = helper.GetFD(); 104 | 105 | // change ownership 106 | if (fchown(fd, APP_UID, APP_GID) == -1) { 107 | fmt::print(stderr, "could not change app ownership: {}\n", 108 | std::strerror(errno)); 109 | } 110 | 111 | // set file to be executable 112 | if (fchmod(fd, 0775) == -1) { 113 | fmt::print(stderr, "could not change app permissions: {}\n", 114 | std::strerror(errno)); 115 | } 116 | 117 | // close temporary file 118 | helper.Close(); 119 | 120 | auto pathname = fmt::format("{}{}", EXEC_HOME, filename); 121 | 122 | // remove old file (need to do this as we can't overwrite a running exe) 123 | if (unlink(pathname.c_str()) == -1) { 124 | fmt::print(stderr, "could not remove app executable: {}\n", 125 | std::strerror(errno)); 126 | } 127 | 128 | // rename temporary file to new file 129 | if (rename(helper.GetFilename(), pathname.c_str()) == -1) { 130 | fmt::print(stderr, "could not rename to app executable: {}\n", 131 | std::strerror(errno)); 132 | } 133 | 134 | // terminate vision process so it reloads 135 | VisionStatus::GetInstance()->Terminate(onFail); 136 | } 137 | 138 | void Application::UpdateStatus() { status(GetStatusJson()); } 139 | 140 | wpi::json Application::GetStatusJson() { 141 | wpi::json j = {{"type", "applicationSettings"}, 142 | {"applicationType", "custom"}}; 143 | 144 | std::error_code ec; 145 | wpi::raw_fd_istream is(EXEC_HOME "/runCamera", ec); 146 | if (ec) { 147 | fmt::print(stderr, "could not read {}/runCamera\n", EXEC_HOME); 148 | return j; 149 | } 150 | 151 | // scan file 152 | wpi::SmallString<256> lineBuf; 153 | while (!is.has_error()) { 154 | std::string_view line = wpi::trim(is.getline(lineBuf, 256)); 155 | if (wpi::starts_with(line, TYPE_TAG)) { 156 | j["applicationType"] = wpi::trim(wpi::substr(line, strlen(TYPE_TAG))); 157 | break; 158 | } 159 | } 160 | 161 | return j; 162 | } 163 | -------------------------------------------------------------------------------- /deps/tools/configServer/src/SystemStatus.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | #include "SystemStatus.h" 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | std::shared_ptr SystemStatus::GetInstance() { 17 | static auto sysStatus = std::make_shared(private_init{}); 18 | return sysStatus; 19 | } 20 | 21 | void SystemStatus::UpdateAll() { 22 | UpdateMemory(); 23 | UpdateCpu(); 24 | UpdateNetwork(); 25 | UpdateTemp(); 26 | status(GetStatusJson()); 27 | writable(GetWritable()); 28 | } 29 | 30 | wpi::json SystemStatus::GetStatusJson() { 31 | wpi::json j = {{"type", "systemStatus"}}; 32 | 33 | size_t qty; 34 | 35 | // memory 36 | { 37 | uint64_t first; 38 | if (m_memoryFree.GetFirstLast(&first, nullptr, &qty)) { 39 | j["systemMemoryFree1s"] = first / 1000; 40 | if (qty >= 5) 41 | j["systemMemoryFree5s"] = m_memoryFree.GetTotal() / qty / 1000; 42 | } 43 | if (m_memoryAvail.GetFirstLast(&first, nullptr, &qty)) { 44 | j["systemMemoryAvail1s"] = first / 1000; 45 | if (qty >= 5) 46 | j["systemMemoryAvail5s"] = m_memoryAvail.GetTotal() / qty / 1000; 47 | } 48 | } 49 | 50 | // cpu 51 | { 52 | CpuData first, last; 53 | if (m_cpu.GetFirstLast(&first, &last, nullptr, 2)) { 54 | uint64_t deltaTotal = last.total - first.total; 55 | if (deltaTotal != 0) { 56 | j["systemCpuUser1s"] = 57 | (last.user + last.nice - first.user - first.nice) * 100 / 58 | deltaTotal; 59 | j["systemCpuSystem1s"] = 60 | (last.system - first.system) * 100 / deltaTotal; 61 | j["systemCpuIdle1s"] = (last.idle - first.idle) * 100 / deltaTotal; 62 | } 63 | } 64 | if (m_cpu.GetFirstLast(&first, &last, nullptr, 6)) { 65 | uint64_t deltaTotal = last.total - first.total; 66 | if (deltaTotal != 0) { 67 | j["systemCpuUser5s"] = 68 | (last.user + last.nice - first.user - first.nice) * 100 / 69 | deltaTotal; 70 | j["systemCpuSystem5s"] = 71 | (last.system - first.system) * 100 / deltaTotal; 72 | j["systemCpuIdle5s"] = (last.idle - first.idle) * 100 / deltaTotal; 73 | } 74 | } 75 | } 76 | 77 | // network 78 | { 79 | NetworkData first, last; 80 | if (m_network.GetFirstLast(&first, &last, nullptr, 2)) { 81 | j["systemNetwork1s"] = (last.recvBytes + last.xmitBytes - 82 | first.recvBytes - first.xmitBytes) * 83 | 8 / 1000; 84 | } 85 | if (m_network.GetFirstLast(&first, &last, nullptr, 6)) { 86 | j["systemNetwork5s"] = (last.recvBytes + last.xmitBytes - 87 | first.recvBytes - first.xmitBytes) * 88 | 8 / 5000; 89 | } 90 | } 91 | 92 | // temperature 93 | { 94 | uint64_t first; 95 | if (m_temp.GetFirstLast(&first, nullptr, &qty)) { 96 | j["systemCpuTemp1s"] = first / 1000; 97 | if (qty >= 5) j["systemCpuTemp5s"] = m_temp.GetTotal() / qty / 1000; 98 | } 99 | } 100 | 101 | return j; 102 | } 103 | 104 | bool SystemStatus::GetWritable() { 105 | std::error_code ec; 106 | wpi::raw_fd_istream is("/proc/mounts", ec); 107 | if (ec) return false; 108 | wpi::SmallString<256> lineBuf; 109 | while (!is.has_error()) { 110 | std::string_view line = wpi::trim(is.getline(lineBuf, 256)); 111 | if (line.empty()) break; 112 | 113 | wpi::SmallVector strs; 114 | wpi::split(line, strs, ' ', -1, false); 115 | if (strs.size() < 4) continue; 116 | 117 | if (strs[1] == "/") return wpi::contains(strs[3], "rw"); 118 | } 119 | return false; 120 | } 121 | 122 | void SystemStatus::UpdateMemory() { 123 | std::error_code ec; 124 | wpi::raw_fd_istream is("/proc/meminfo", ec); 125 | if (ec) return; 126 | wpi::SmallString<256> lineBuf; 127 | while (!is.has_error()) { 128 | std::string_view line = wpi::trim(is.getline(lineBuf, 256)); 129 | if (line.empty()) break; 130 | 131 | std::string_view name, amtStr; 132 | std::tie(name, amtStr) = wpi::split(line, ':'); 133 | 134 | amtStr = wpi::trim(amtStr); 135 | if (auto amt = wpi::consume_integer(&amtStr, 10)) { 136 | if (name == "MemFree") { 137 | m_memoryFree.Add(*amt); 138 | } else if (name == "MemAvailable") { 139 | m_memoryAvail.Add(*amt); 140 | } 141 | } 142 | } 143 | } 144 | 145 | void SystemStatus::UpdateCpu() { 146 | std::error_code ec; 147 | wpi::raw_fd_istream is("/proc/stat", ec); 148 | if (ec) return; 149 | wpi::SmallString<256> lineBuf; 150 | while (!is.has_error()) { 151 | std::string_view line = wpi::trim(is.getline(lineBuf, 256)); 152 | if (line.empty()) break; 153 | 154 | std::string_view name, amtStr; 155 | std::tie(name, amtStr) = wpi::split(line, ' '); 156 | if (name == "cpu") { 157 | CpuData data; 158 | 159 | // individual values we care about 160 | amtStr = wpi::ltrim(amtStr); 161 | if (auto v = wpi::consume_integer(&amtStr, 10)) { 162 | data.user = *v; 163 | } else { 164 | break; 165 | } 166 | amtStr = wpi::ltrim(amtStr); 167 | if (auto v = wpi::consume_integer(&amtStr, 10)) { 168 | data.nice = *v; 169 | } else { 170 | break; 171 | } 172 | amtStr = wpi::ltrim(amtStr); 173 | if (auto v = wpi::consume_integer(&amtStr, 10)) { 174 | data.system = *v; 175 | } else { 176 | break; 177 | } 178 | amtStr = wpi::ltrim(amtStr); 179 | if (auto v = wpi::consume_integer(&amtStr, 10)) { 180 | data.idle = *v; 181 | } else { 182 | break; 183 | } 184 | 185 | // compute total 186 | data.total = data.user + data.nice + data.system + data.idle; 187 | for (;;) { 188 | amtStr = wpi::ltrim(amtStr); 189 | if (auto amt = wpi::consume_integer(&amtStr, 10)) { 190 | data.total += *amt; 191 | } else { 192 | break; 193 | } 194 | } 195 | 196 | m_cpu.Add(data); 197 | break; 198 | } 199 | } 200 | } 201 | 202 | void SystemStatus::UpdateNetwork() { 203 | std::error_code ec; 204 | wpi::raw_fd_istream is("/proc/net/dev", ec); 205 | if (ec) return; 206 | 207 | NetworkData data; 208 | 209 | wpi::SmallString<256> lineBuf; 210 | while (!is.has_error()) { 211 | std::string_view line = wpi::trim(is.getline(lineBuf, 256)); 212 | if (line.empty()) break; 213 | 214 | std::string_view name, amtStr; 215 | std::tie(name, amtStr) = wpi::split(line, ':'); 216 | name = wpi::trim(name); 217 | if (name.empty() || name == "lo") continue; 218 | 219 | wpi::SmallVector amtStrs; 220 | wpi::split(amtStr, amtStrs, ' ', -1, false); 221 | if (amtStrs.size() < 16) continue; 222 | 223 | // receive bytes 224 | if (auto amt = wpi::parse_integer(amtStrs[0], 10)) { 225 | data.recvBytes += *amt; 226 | } 227 | 228 | // transmit bytes 229 | if (auto amt = wpi::parse_integer(amtStrs[8], 10)) { 230 | data.xmitBytes += *amt; 231 | } 232 | } 233 | 234 | m_network.Add(data); 235 | } 236 | 237 | void SystemStatus::UpdateTemp() { 238 | std::error_code ec; 239 | wpi::raw_fd_istream is("/sys/class/thermal/thermal_zone0/temp", ec); 240 | if (ec) return; 241 | wpi::SmallString<256> lineBuf; 242 | while (!is.has_error()) { 243 | std::string_view line = wpi::trim(is.getline(lineBuf, 256)); 244 | if (line.empty()) break; 245 | 246 | if (auto amt = wpi::parse_integer(line, 10)) { 247 | m_temp.Add(*amt); 248 | } 249 | } 250 | } 251 | -------------------------------------------------------------------------------- /stage0/01-locale/00-debconf: -------------------------------------------------------------------------------- 1 | # Locales to be generated: 2 | # Choices: All locales, aa_DJ ISO-8859-1, aa_DJ.UTF-8 UTF-8, aa_ER UTF-8, aa_ER@saaho UTF-8, aa_ET UTF-8, af_ZA ISO-8859-1, af_ZA.UTF-8 UTF-8, ak_GH UTF-8, am_ET UTF-8, an_ES ISO-8859-15, an_ES.UTF-8 UTF-8, anp_IN UTF-8, ar_AE ISO-8859-6, ar_AE.UTF-8 UTF-8, ar_BH ISO-8859-6, ar_BH.UTF-8 UTF-8, ar_DZ ISO-8859-6, ar_DZ.UTF-8 UTF-8, ar_EG ISO-8859-6, ar_EG.UTF-8 UTF-8, ar_IN UTF-8, ar_IQ ISO-8859-6, ar_IQ.UTF-8 UTF-8, ar_JO ISO-8859-6, ar_JO.UTF-8 UTF-8, ar_KW ISO-8859-6, ar_KW.UTF-8 UTF-8, ar_LB ISO-8859-6, ar_LB.UTF-8 UTF-8, ar_LY ISO-8859-6, ar_LY.UTF-8 UTF-8, ar_MA ISO-8859-6, ar_MA.UTF-8 UTF-8, ar_OM ISO-8859-6, ar_OM.UTF-8 UTF-8, ar_QA ISO-8859-6, ar_QA.UTF-8 UTF-8, ar_SA ISO-8859-6, ar_SA.UTF-8 UTF-8, ar_SD ISO-8859-6, ar_SD.UTF-8 UTF-8, ar_SS UTF-8, ar_SY ISO-8859-6, ar_SY.UTF-8 UTF-8, ar_TN ISO-8859-6, ar_TN.UTF-8 UTF-8, ar_YE ISO-8859-6, ar_YE.UTF-8 UTF-8, as_IN UTF-8, ast_ES ISO-8859-15, ast_ES.UTF-8 UTF-8, ayc_PE UTF-8, az_AZ UTF-8, be_BY CP1251, be_BY.UTF-8 UTF-8, be_BY@latin UTF-8, bem_ZM UTF-8, ber_DZ UTF-8, ber_MA UTF-8, bg_BG CP1251, bg_BG.UTF-8 UTF-8, bho_IN UTF-8, bn_BD UTF-8, bn_IN UTF-8, bo_CN UTF-8, bo_IN UTF-8, br_FR ISO-8859-1, br_FR.UTF-8 UTF-8, br_FR@euro ISO-8859-15, brx_IN UTF-8, bs_BA ISO-8859-2, bs_BA.UTF-8 UTF-8, byn_ER UTF-8, ca_AD ISO-8859-15, ca_AD.UTF-8 UTF-8, ca_ES ISO-8859-1, ca_ES.UTF-8 UTF-8, ca_ES.UTF-8@valencia UTF-8, ca_ES@euro ISO-8859-15, ca_ES@valencia ISO-8859-15, ca_FR ISO-8859-15, ca_FR.UTF-8 UTF-8, ca_IT ISO-8859-15, ca_IT.UTF-8 UTF-8, cmn_TW UTF-8, crh_UA UTF-8, cs_CZ ISO-8859-2, cs_CZ.UTF-8 UTF-8, csb_PL UTF-8, cv_RU UTF-8, cy_GB ISO-8859-14, cy_GB.UTF-8 UTF-8, da_DK ISO-8859-1, da_DK.UTF-8 UTF-8, de_AT ISO-8859-1, de_AT.UTF-8 UTF-8, de_AT@euro ISO-8859-15, de_BE ISO-8859-1, de_BE.UTF-8 UTF-8, de_BE@euro ISO-8859-15, de_CH ISO-8859-1, de_CH.UTF-8 UTF-8, de_DE ISO-8859-1, de_DE.UTF-8 UTF-8, de_DE@euro ISO-8859-15, de_LI.UTF-8 UTF-8, de_LU ISO-8859-1, de_LU.UTF-8 UTF-8, de_LU@euro ISO-8859-15, doi_IN UTF-8, dv_MV UTF-8, dz_BT UTF-8, el_CY ISO-8859-7, el_CY.UTF-8 UTF-8, el_GR ISO-8859-7, el_GR.UTF-8 UTF-8, en_AG UTF-8, en_AU ISO-8859-1, en_AU.UTF-8 UTF-8, en_BW ISO-8859-1, en_BW.UTF-8 UTF-8, en_CA ISO-8859-1, en_CA.UTF-8 UTF-8, en_DK ISO-8859-1, en_DK.ISO-8859-15 ISO-8859-15, en_DK.UTF-8 UTF-8, en_GB ISO-8859-1, en_GB.ISO-8859-15 ISO-8859-15, en_GB.UTF-8 UTF-8, en_HK ISO-8859-1, en_HK.UTF-8 UTF-8, en_IE ISO-8859-1, en_IE.UTF-8 UTF-8, en_IE@euro ISO-8859-15, en_IN UTF-8, en_NG UTF-8, en_NZ ISO-8859-1, en_NZ.UTF-8 UTF-8, en_PH ISO-8859-1, en_PH.UTF-8 UTF-8, en_SG ISO-8859-1, en_SG.UTF-8 UTF-8, en_US ISO-8859-1, en_US.ISO-8859-15 ISO-8859-15, en_US.UTF-8 UTF-8, en_ZA ISO-8859-1, en_ZA.UTF-8 UTF-8, en_ZM UTF-8, en_ZW ISO-8859-1, en_ZW.UTF-8 UTF-8, eo ISO-8859-3, eo.UTF-8 UTF-8, es_AR ISO-8859-1, es_AR.UTF-8 UTF-8, es_BO ISO-8859-1, es_BO.UTF-8 UTF-8, es_CL ISO-8859-1, es_CL.UTF-8 UTF-8, es_CO ISO-8859-1, es_CO.UTF-8 UTF-8, es_CR ISO-8859-1, es_CR.UTF-8 UTF-8, es_CU UTF-8, es_DO ISO-8859-1, es_DO.UTF-8 UTF-8, es_EC ISO-8859-1, es_EC.UTF-8 UTF-8, es_ES ISO-8859-1, es_ES.UTF-8 UTF-8, es_ES@euro ISO-8859-15, es_GT ISO-8859-1, es_GT.UTF-8 UTF-8, es_HN ISO-8859-1, es_HN.UTF-8 UTF-8, es_MX ISO-8859-1, es_MX.UTF-8 UTF-8, es_NI ISO-8859-1, es_NI.UTF-8 UTF-8, es_PA ISO-8859-1, es_PA.UTF-8 UTF-8, es_PE ISO-8859-1, es_PE.UTF-8 UTF-8, es_PR ISO-8859-1, es_PR.UTF-8 UTF-8, es_PY ISO-8859-1, es_PY.UTF-8 UTF-8, es_SV ISO-8859-1, es_SV.UTF-8 UTF-8, es_US ISO-8859-1, es_US.UTF-8 UTF-8, es_UY ISO-8859-1, es_UY.UTF-8 UTF-8, es_VE ISO-8859-1, es_VE.UTF-8 UTF-8, et_EE ISO-8859-1, et_EE.ISO-8859-15 ISO-8859-15, et_EE.UTF-8 UTF-8, eu_ES ISO-8859-1, eu_ES.UTF-8 UTF-8, eu_ES@euro ISO-8859-15, eu_FR ISO-8859-1, eu_FR.UTF-8 UTF-8, eu_FR@euro ISO-8859-15, fa_IR UTF-8, ff_SN UTF-8, fi_FI ISO-8859-1, fi_FI.UTF-8 UTF-8, fi_FI@euro ISO-8859-15, fil_PH UTF-8, fo_FO ISO-8859-1, fo_FO.UTF-8 UTF-8, fr_BE ISO-8859-1, fr_BE.UTF-8 UTF-8, fr_BE@euro ISO-8859-15, fr_CA ISO-8859-1, fr_CA.UTF-8 UTF-8, fr_CH ISO-8859-1, fr_CH.UTF-8 UTF-8, fr_FR ISO-8859-1, fr_FR.UTF-8 UTF-8, fr_FR@euro ISO-8859-15, fr_LU ISO-8859-1, fr_LU.UTF-8 UTF-8, fr_LU@euro ISO-8859-15, fur_IT UTF-8, fy_DE UTF-8, fy_NL UTF-8, ga_IE ISO-8859-1, ga_IE.UTF-8 UTF-8, ga_IE@euro ISO-8859-15, gd_GB ISO-8859-15, gd_GB.UTF-8 UTF-8, gez_ER UTF-8, gez_ER@abegede UTF-8, gez_ET UTF-8, gez_ET@abegede UTF-8, gl_ES ISO-8859-1, gl_ES.UTF-8 UTF-8, gl_ES@euro ISO-8859-15, gu_IN UTF-8, gv_GB ISO-8859-1, gv_GB.UTF-8 UTF-8, ha_NG UTF-8, hak_TW UTF-8, he_IL ISO-8859-8, he_IL.UTF-8 UTF-8, hi_IN UTF-8, hne_IN UTF-8, hr_HR ISO-8859-2, hr_HR.UTF-8 UTF-8, hsb_DE ISO-8859-2, hsb_DE.UTF-8 UTF-8, ht_HT UTF-8, hu_HU ISO-8859-2, hu_HU.UTF-8 UTF-8, hy_AM UTF-8, hy_AM.ARMSCII-8 ARMSCII-8, ia_FR UTF-8, id_ID ISO-8859-1, id_ID.UTF-8 UTF-8, ig_NG UTF-8, ik_CA UTF-8, is_IS ISO-8859-1, is_IS.UTF-8 UTF-8, it_CH ISO-8859-1, it_CH.UTF-8 UTF-8, it_IT ISO-8859-1, it_IT.UTF-8 UTF-8, it_IT@euro ISO-8859-15, iu_CA UTF-8, iw_IL ISO-8859-8, iw_IL.UTF-8 UTF-8, ja_JP.EUC-JP EUC-JP, ja_JP.UTF-8 UTF-8, ka_GE GEORGIAN-PS, ka_GE.UTF-8 UTF-8, kk_KZ PT154, kk_KZ RK1048, kk_KZ.UTF-8 UTF-8, kl_GL ISO-8859-1, kl_GL.UTF-8 UTF-8, km_KH UTF-8, kn_IN UTF-8, ko_KR.EUC-KR EUC-KR, ko_KR.UTF-8 UTF-8, kok_IN UTF-8, ks_IN UTF-8, ks_IN@devanagari UTF-8, ku_TR ISO-8859-9, ku_TR.UTF-8 UTF-8, kw_GB ISO-8859-1, kw_GB.UTF-8 UTF-8, ky_KG UTF-8, lb_LU UTF-8, lg_UG ISO-8859-10, lg_UG.UTF-8 UTF-8, li_BE UTF-8, li_NL UTF-8, lij_IT UTF-8, lo_LA UTF-8, lt_LT ISO-8859-13, lt_LT.UTF-8 UTF-8, lv_LV ISO-8859-13, lv_LV.UTF-8 UTF-8, lzh_TW UTF-8, mag_IN UTF-8, mai_IN UTF-8, mg_MG ISO-8859-15, mg_MG.UTF-8 UTF-8, mhr_RU UTF-8, mi_NZ ISO-8859-13, mi_NZ.UTF-8 UTF-8, mk_MK ISO-8859-5, mk_MK.UTF-8 UTF-8, ml_IN UTF-8, mn_MN UTF-8, mni_IN UTF-8, mr_IN UTF-8, ms_MY ISO-8859-1, ms_MY.UTF-8 UTF-8, mt_MT ISO-8859-3, mt_MT.UTF-8 UTF-8, my_MM UTF-8, nan_TW UTF-8, nan_TW@latin UTF-8, nb_NO ISO-8859-1, nb_NO.UTF-8 UTF-8, nds_DE UTF-8, nds_NL UTF-8, ne_NP UTF-8, nhn_MX UTF-8, niu_NU UTF-8, niu_NZ UTF-8, nl_AW UTF-8, nl_BE ISO-8859-1, nl_BE.UTF-8 UTF-8, nl_BE@euro ISO-8859-15, nl_NL ISO-8859-1, nl_NL.UTF-8 UTF-8, nl_NL@euro ISO-8859-15, nn_NO ISO-8859-1, nn_NO.UTF-8 UTF-8, nr_ZA UTF-8, nso_ZA UTF-8, oc_FR ISO-8859-1, oc_FR.UTF-8 UTF-8, om_ET UTF-8, om_KE ISO-8859-1, om_KE.UTF-8 UTF-8, or_IN UTF-8, os_RU UTF-8, pa_IN UTF-8, pa_PK UTF-8, pap_AN UTF-8, pap_AW UTF-8, pap_CW UTF-8, pl_PL ISO-8859-2, pl_PL.UTF-8 UTF-8, ps_AF UTF-8, pt_BR ISO-8859-1, pt_BR.UTF-8 UTF-8, pt_PT ISO-8859-1, pt_PT.UTF-8 UTF-8, pt_PT@euro ISO-8859-15, quz_PE UTF-8, ro_RO ISO-8859-2, ro_RO.UTF-8 UTF-8, ru_RU ISO-8859-5, ru_RU.CP1251 CP1251, ru_RU.KOI8-R KOI8-R, ru_RU.UTF-8 UTF-8, ru_UA KOI8-U, ru_UA.UTF-8 UTF-8, rw_RW UTF-8, sa_IN UTF-8, sat_IN UTF-8, sc_IT UTF-8, sd_IN UTF-8, sd_IN@devanagari UTF-8, se_NO UTF-8, shs_CA UTF-8, si_LK UTF-8, sid_ET UTF-8, sk_SK ISO-8859-2, sk_SK.UTF-8 UTF-8, sl_SI ISO-8859-2, sl_SI.UTF-8 UTF-8, so_DJ ISO-8859-1, so_DJ.UTF-8 UTF-8, so_ET UTF-8, so_KE ISO-8859-1, so_KE.UTF-8 UTF-8, so_SO ISO-8859-1, so_SO.UTF-8 UTF-8, sq_AL ISO-8859-1, sq_AL.UTF-8 UTF-8, sq_MK UTF-8, sr_ME UTF-8, sr_RS UTF-8, sr_RS@latin UTF-8, ss_ZA UTF-8, st_ZA ISO-8859-1, st_ZA.UTF-8 UTF-8, sv_FI ISO-8859-1, sv_FI.UTF-8 UTF-8, sv_FI@euro ISO-8859-15, sv_SE ISO-8859-1, sv_SE.ISO-8859-15 ISO-8859-15, sv_SE.UTF-8 UTF-8, sw_KE UTF-8, sw_TZ UTF-8, szl_PL UTF-8, ta_IN UTF-8, ta_LK UTF-8, te_IN UTF-8, tg_TJ KOI8-T, tg_TJ.UTF-8 UTF-8, th_TH TIS-620, th_TH.UTF-8 UTF-8, the_NP UTF-8, ti_ER UTF-8, ti_ET UTF-8, tig_ER UTF-8, tk_TM UTF-8, tl_PH ISO-8859-1, tl_PH.UTF-8 UTF-8, tn_ZA UTF-8, tr_CY ISO-8859-9, tr_CY.UTF-8 UTF-8, tr_TR ISO-8859-9, tr_TR.UTF-8 UTF-8, ts_ZA UTF-8, tt_RU UTF-8, tt_RU@iqtelif UTF-8, ug_CN UTF-8, uk_UA KOI8-U, uk_UA.UTF-8 UTF-8, unm_US UTF-8, ur_IN UTF-8, ur_PK UTF-8, uz_UZ ISO-8859-1, uz_UZ.UTF-8 UTF-8, uz_UZ@cyrillic UTF-8, ve_ZA UTF-8, vi_VN UTF-8, wa_BE ISO-8859-1, wa_BE.UTF-8 UTF-8, wa_BE@euro ISO-8859-15, wae_CH UTF-8, wal_ET UTF-8, wo_SN UTF-8, xh_ZA ISO-8859-1, xh_ZA.UTF-8 UTF-8, yi_US CP1255, yi_US.UTF-8 UTF-8, yo_NG UTF-8, yue_HK UTF-8, zh_CN GB2312, zh_CN.GB18030 GB18030, zh_CN.GBK GBK, zh_CN.UTF-8 UTF-8, zh_HK BIG5-HKSCS, zh_HK.UTF-8 UTF-8, zh_SG GB2312, zh_SG.GBK GBK, zh_SG.UTF-8 UTF-8, zh_TW BIG5, zh_TW.EUC-TW EUC-TW, zh_TW.UTF-8 UTF-8, zu_ZA ISO-8859-1, zu_ZA.UTF-8 UTF-8 3 | locales locales/locales_to_be_generated multiselect ${LOCALE_DEFAULT} UTF-8 4 | # Default locale for the system environment: 5 | # Choices: None, C.UTF-8, en_GB.UTF-8 6 | locales locales/default_environment_locale select ${LOCALE_DEFAULT} 7 | -------------------------------------------------------------------------------- /deps/examples/python-multiCameraServer/multiCameraServer.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) FIRST and other WPILib contributors. 4 | # Open Source Software; you can modify and/or share it under the terms of 5 | # the WPILib BSD license file in the root directory of this project. 6 | 7 | import json 8 | import time 9 | import sys 10 | 11 | from cscore import CameraServer, VideoSource, UsbCamera, MjpegServer 12 | from ntcore import NetworkTableInstance, EventFlags 13 | 14 | # JSON format: 15 | # { 16 | # "team": , 17 | # "ntmode": <"client" or "server", "client" if unspecified> 18 | # "cameras": [ 19 | # { 20 | # "name": 21 | # "path": 22 | # "pixel format": <"MJPEG", "YUYV", etc> // optional 23 | # "width":