Skip to content

Commit

Permalink
Merge pull request #1 from PhotonVision/dev
Browse files Browse the repository at this point in the history
What's the worst that can happen
  • Loading branch information
mcm001 authored Dec 25, 2023
2 parents b5494de + c236ce3 commit 4865e5a
Show file tree
Hide file tree
Showing 11 changed files with 923 additions and 0 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Build driver
on:
push:
branches:
- 'master'
- 'releases/**'
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
include:
- name: limelight
script: ./install_limelight.sh
base_image: https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2023-12-11/2023-12-11-raspios-bookworm-arm64-lite.img.xz
- name: raspi
script: ./install_pi.sh
base_image: https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2023-12-11/2023-12-11-raspios-bookworm-arm64-lite.img.xz
# Orange pi default user seems bjork? also I can't find the where this file ends up in the image? https://github.com/Joshua-Riek/ubuntu-rockchip/blob/0710bd81f5619c25ccddb4e9d69ddbe73827f850/overlay/boot/firmware/user-data#L4
# - name: opi5
# script: ./install_opi5.sh
# base_image: https://github.com/Joshua-Riek/ubuntu-rockchip/releases/download/v1.30/ubuntu-22.04.3-preinstalled-server-arm64-orangepi-5.img.xz

name: "Build for ${{ matrix.name }}"

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch tags
run: git fetch --tags --force

- uses: pguyot/arm-runner-action@HEAD
id: install_deps
with:
image_additional_mb: 1500
base_image: ${{ matrix.base_image }}
commands: ${{ matrix.script }}

- name: Compress built image
run: |
mv ${{ steps.install_deps.outputs.image }} photonvision_${{ matrix.name }}.img
sudo xz -T 0 -v photonvision_${{ matrix.name }}.img
- uses: actions/upload-artifact@master
with:
name: photonvision_${{ matrix.name }}.img.xz
path: photonvision_${{ matrix.name }}.img.xz
if-no-files-found: error
retention-days: 1

release:
needs: [build]
runs-on: ubuntu-22.04
steps:
# Download literally every single artifact
- uses: actions/download-artifact@v4
- run: find
# Push to dev release
- uses: pyTooling/Actions/releaser@r0
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: 'Dev'
rm: true
files: |
**/*.xz
if: github.event_name == 'push'
# Upload all xz archives to GH tag if tagged
- uses: softprops/action-gh-release@v1
with:
files: |
**/*.xz
if: startsWith(github.ref, 'refs/tags/v')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42 changes: 42 additions & 0 deletions config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Automatically load overlays for detected DSI displays/cameras
display_auto_detect=1
camera_auto_detect=1

# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
max_framebuffers=2

# Run in 64-bit mode
arm_64bit=1

# Disable compensation for displays with overscan
disable_overscan=1

[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1

[pi4]
# Run as fast as firmware / board allows
arm_boost=1

[all]
##############################################################
### PHOTONVISION CAM CONFIG
### Comment/Uncomment to change which camera is supported
### Picam V1, V2 or HQ: uncomment (remove leading # ) from camera_auto_detect=1,
### and comment out all following lines
### IMX290/327/OV9281/Any other cameras that require additional overlays:
### Comment out (add a # ) to camera_auto_detect=1, and uncomment the line for
### the sensor you're trying to user

camera_auto_detect=1

# dtoverlay=imx290,clock-frequency=74250000
# dtoverlay=imx290,clock-frequency=37125000
# dtoverlay=imx378
# dtoverlay=ov9281

##############################################################
8 changes: 8 additions & 0 deletions files/pigpiod.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Unit]
Description=Daemon required to control GPIO pins via pigpio
[Service]
ExecStart=/usr/bin/pigpiod -l -n 127.0.0.1 -m
ExecStop=/bin/systemctl kill pigpiod
Type=forking
[Install]
WantedBy=multi-user.target
6 changes: 6 additions & 0 deletions files/rpi-blacklist.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#wifi
blacklist brcmfmac
blacklist brcmutil
#bt
blacklist btbcm
blacklist hci_uart
3 changes: 3 additions & 0 deletions files/wait.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[Service]
ExecStart=
ExecStart=/usr/lib/dhcpcd5/dhcpcd -q -w
49 changes: 49 additions & 0 deletions install_limelight.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Run normal photon installer

wget https://git.io/JJrEP -O install.sh
chmod +x install.sh
./install.sh
rm install.sh

echo "Installing additional things"
sudo apt-get update
apt-get install -y pigpiod pigpio device-tree-compiler
apt-get install -y network-manager
apt-get install -y net-tools
# libcamera-driver stuff
apt-get install -y libegl1 libopengl0 libopencv-core406 libgl1-mesa-dri libcamera0.1 libgbm1 libatomic1

# and edit boot partition

install -m 644 limelight/config.txt /boot/
install -m 644 userconf.txt /boot/

# install LL DTS
dtc -O dtb limelight/gloworm-dt.dts -o /boot/dt-blob.bin

# re-size FS, again, at next boot
wget https://raw.githubusercontent.com/PhotonVision/photon-pi-gen/arm64/stage2/01-sys-tweaks/files/resize2fs_once -O files/resize2fs_once
install -m 755 files/resize2fs_once "${ROOTFS_DIR}/etc/init.d/"

# Kill wifi and other networking things
install -v -m 644 files/wait.conf /etc/systemd/system/dhcpcd.service.d/
install -v files/rpi-blacklist.conf /etc/modprobe.d/blacklist.conf

# Update pigipio service file to listen locally
install -v -m 644 files/pigpiod.service /lib/systemd/system/pigpiod.service
systemctl daemon-reload

# Enable ssh/pigpiod
systemctl enable ssh
systemctl enable pigpiod

# Remove extra packages too

apt-get purge -y python3 gdb gcc g++ linux-headers* libgcc*-dev libqt* wpasupplicant wireless-tools firmware-atheros firmware-brcm80211 firmware-libertas firmware-misc-nonfree firmware-realtek raspberrypi-net-mods device-tree-compiler
apt-get autoremove -y

rm -rf /var/lib/apt/lists/*
apt-get clean

rm -rf /usr/share/doc
rm -rf /usr/share/locale/
25 changes: 25 additions & 0 deletions install_opi5.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
find /

find / -name user-data

apt-get update
apt-get upgrade -y

cd /tmp
wget https://git.io/JJrEP -O install.sh
chmod +x install.sh

sed -i 's/# AllowedCPUs=4-7/AllowedCPUs=4-7/g' install.sh

./install.sh

# Remove extra packages too

apt-get purge -y python3 gdb gcc g++ linux-headers* libgcc*-dev *qt*
apt-get autoremove -y

rm -rf /var/lib/apt/lists/*
apt-get clean

rm -rf /usr/share/doc
rm -rf /usr/share/locale/
45 changes: 45 additions & 0 deletions install_pi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Run normal photon installer

wget https://git.io/JJrEP -O install.sh
chmod +x install.sh
./install.sh
rm install.sh

echo "Installing additional things"
sudo apt-get update
apt-get install -y pigpiod pigpio device-tree-compiler
apt-get install -y network-manager
apt-get install -y net-tools
# libcamera-driver stuff + libatomic1 for wpilib
apt-get install -y libegl1 libopengl0 libopencv-core406 libgl1-mesa-dri libcamera0.1 libgbm1 libatomic1

# and edit boot partition
install -m 644 config.txt /boot/
install -m 644 userconf.txt /boot/

# Kill wifi and other networking things
install -v -m 644 files/wait.conf /etc/systemd/system/dhcpcd.service.d/
install -v files/rpi-blacklist.conf /etc/modprobe.d/blacklist.conf

# re-size FS, again, at next boot
wget https://raw.githubusercontent.com/PhotonVision/photon-pi-gen/arm64/stage2/01-sys-tweaks/files/resize2fs_once -O files/resize2fs_once
install -m 755 files/resize2fs_once "${ROOTFS_DIR}/etc/init.d/"

# Update pigipio service file to listen locally
install -v -m 644 files/pigpiod.service /lib/systemd/system/pigpiod.service
systemctl daemon-reload

# Enable ssh/pigpiod
systemctl enable ssh
systemctl enable pigpiod

# Remove extra packages too

apt-get purge -y python3 gdb gcc g++ linux-headers* libgcc*-dev device-tree-compiler
apt-get autoremove -y

rm -rf /var/lib/apt/lists/*
apt-get clean

rm -rf /usr/share/doc
rm -rf /usr/share/locale/
57 changes: 57 additions & 0 deletions limelight/config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[cm3]
dtparam=cam0_reg
dtparam=cam0_reg_gpio=3
dtoverlay=cm-swap-i2c0
dtoverlay=ov5647,cam0

# Automatically load overlays for detected cameras
camera_auto_detect=1

[cm4]
dtoverlay=ov5647

[all]

# Automatically load overlays for detected DSI displays
display_auto_detect=1

# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
dtparam=spi=on
dtparam=audio=off

max_framebuffers=2

# Run in 64-bit mode
arm_64bit=1

# Disable compensation for displays with overscan
disable_overscan=1

[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1

[pi4]
# Run as fast as firmware / board allows
arm_boost=1

[all]
#camera_auto_detect=1
gpu_mem=256

[cm3]
dtoverlay=enc28j60
dtoverlay=pi3-disable-bt
gpio=45=op,dh
disable_camera_led=1
disable_splash=1
force_eeprom_read=0
Loading

0 comments on commit 4865e5a

Please sign in to comment.