Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
4e2e683
Create new branch based on 2022.05.x, add board/ config/ and opentric…
erichiggins Aug 19, 2022
04fe397
Add python-connexion package
erichiggins Aug 19, 2022
655fc2f
Add pybleno package
erichiggins Aug 19, 2022
891c465
Add websocketd package
erichiggins Aug 19, 2022
09d8825
Alter Config.in to include references to new packages
erichiggins Aug 19, 2022
94ef76c
Add pymemcache package, update Config.in, update opentrickler_dev_def…
erichiggins Aug 21, 2022
adbb10a
Merge branch '2022.05.x' into opentrickler-2022.05.x
erichiggins Sep 2, 2022
4493057
Inject name into setup for pymemcache package
erichiggins Sep 2, 2022
42120f1
Check in progress. Working Pi0 image, added Pi3
erichiggins Sep 17, 2022
5b10ceb
Create pizerow-dev-build.yml
erichiggins Sep 19, 2022
2aa6e76
Update pizerow-dev-build.yml
erichiggins Sep 20, 2022
0529691
Update pizerow-dev-build.yml
erichiggins Sep 20, 2022
209434b
Update pizerow-dev-build.yml
erichiggins Sep 20, 2022
8216561
Update pizerow-dev-build.yml
erichiggins Sep 20, 2022
7383675
Update pizerow-dev-build.yml
erichiggins Sep 20, 2022
e369bcc
Allow some python and pip checks to fail in fakeroot script
erichiggins Sep 21, 2022
55d9d5e
Merge branch 'opentrickler-2022.05.x' of github.com:ammolytics/opentr…
erichiggins Sep 21, 2022
aad4fe1
Update pizerow-dev-build.yml
erichiggins Sep 22, 2022
22511c9
Add some build optimizations
erichiggins Sep 22, 2022
e36ff92
make command args should be -j not -jN
erichiggins Sep 22, 2022
cadcd3f
Update pizerow-dev-build.yml
erichiggins Sep 22, 2022
5d6c6d1
Update pizerow-dev-build.yml
erichiggins Sep 27, 2022
1bab655
Update pizerow-dev-build.yml
erichiggins Sep 27, 2022
dc30aaf
Update pizerow-dev-build.yml
erichiggins Sep 27, 2022
2087e68
Update pizerow-dev-build.yml
erichiggins Sep 28, 2022
3b7c2e1
Update post-fakeroot.sh
erichiggins Sep 28, 2022
195c997
Update pizerow-dev-build.yml
erichiggins Sep 28, 2022
cb5da27
Update pizerow-dev-build.yml
erichiggins Sep 29, 2022
aaa15b4
Clean up build process, don't repeat steps. Use matrix to control bui…
erichiggins Sep 30, 2022
0e357e1
Fix build file
erichiggins Sep 30, 2022
9b54bde
Rename firmware workflow file to be more generic
erichiggins Sep 30, 2022
86e11ca
Try multiple builds. Run code analysis.
erichiggins Sep 30, 2022
550e828
Rename generic defconfigs for pi0w boards
erichiggins Oct 2, 2022
6a4078b
Rename pi0w images to be specific, same for board directory. Try usin…
erichiggins Oct 2, 2022
3e45ea6
Rename symlink for pi0w genimage config file to match board name.
erichiggins Oct 2, 2022
4d7e1eb
Update build-ot-firmware.yml
erichiggins Oct 3, 2022
362dfaf
Drop codeql, wasnt working for this project
erichiggins Oct 3, 2022
f8e4ab8
Add basic action that should keep my branch and the base branch synce…
erichiggins Oct 3, 2022
cc42564
Increase from 10 to 12 cpus
erichiggins Oct 3, 2022
65666c7
Update build-ot-firmware.yml
erichiggins Oct 5, 2022
70e42a4
Update sync-with-upstream.yml
erichiggins Oct 11, 2022
5f0386e
Update sync-with-upstream.yml
erichiggins Oct 11, 2022
162a76f
Update sync-with-upstream.yml
erichiggins Oct 12, 2022
0d84350
Update sync-with-upstream.yml
erichiggins Oct 12, 2022
aa03547
Update sync-with-upstream.yml
erichiggins Oct 12, 2022
a4618bc
Update sync-with-upstream.yml
erichiggins Oct 12, 2022
0afc10e
Update sync-with-upstream.yml
erichiggins Oct 12, 2022
e29e7b3
Update sync-with-upstream.yml
erichiggins Oct 12, 2022
404f360
Update sync-with-upstream.yml
erichiggins Oct 12, 2022
3fb75f6
Update sync-with-upstream.yml
erichiggins Oct 13, 2022
548cad6
Update sync-with-upstream.yml
erichiggins Oct 20, 2022
cc994d2
Update sync-with-upstream.yml
erichiggins Oct 20, 2022
12a0eca
Increase I2C speed
erichiggins Oct 20, 2022
d13f919
Add support for openjpeg to support displays
erichiggins Nov 12, 2022
2887bfc
Merge branch '2022.05.x' into opentrickler-2022.05.x
erichiggins Nov 12, 2022
76dcf5a
Reorg boards/ammolytics dirs. Add support for pizero2w.
erichiggins Mar 2, 2023
2c47a44
Add genimage files for zero2w and generic pi
erichiggins Mar 3, 2023
f7b740a
Ensure pip in post-fakeroot. Upgrade code package to 2.1.2
erichiggins Apr 5, 2023
1fc279a
Pull open trickler package from github release. Bump to version 2.1.3
erichiggins Apr 13, 2023
efba27c
Bump make -j from 12 to 14 for performance
erichiggins Apr 13, 2023
5047007
Bump to make -j 16
erichiggins Apr 14, 2023
dee8e8b
Update to open trickler version 2.2.0
erichiggins Nov 13, 2023
15aeb11
Update build-ot-firmware.yml
erichiggins Sep 7, 2024
bdcc36b
Update build-ot-firmware.yml
erichiggins Sep 7, 2024
9c2cde1
Update package version to 2.2.1. Pin version of bluezero in post fake…
erichiggins Sep 7, 2024
3c9d3c8
Fix shasum for opentrickler package
erichiggins Sep 8, 2024
d0a51e5
Update build-ot-firmware.yml
erichiggins Oct 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Open Trickler Buildroot

This repo creates the Linux firmware images for the Open Trickler project.


## Configuration

The following files and directories are the most relevant for Open Trickler:

- `configs/opentrickler_dev_defconfig`
- `configs/opentrickler_prod_defconfig`
- `package/python-opentrickler/`
- `board/ammolytics/opentrickler/`


## Build commands

make opentrickler_dev_defconfig
make

The resulting firmware images will be in `output/images/`.


## Syncing with upstream Buildroot

Always keep commits to the `opentrickler-2022.05.x` on top of the latest upstream `2022.05.x` branch.

git checkout 2022.05.x
git pull
git checkout opentrickler-2022.05.x
git merge 2022.05.x
git push origin opentrickler-2022.05.x


## Inspecting the image filesystem

First, use `fdisk` to list the partitions and block positions.

fdisk -l output/images/sdcard.img

Example output

Disk output/images/sdcard.img: 596 MiB, 624951808 bytes, 1220609 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device Boot Start End Sectors Size Id Type
output/images/sdcard.img1 * 1 65536 65536 32M c W95 FAT32 (LBA)
output/images/sdcard.img2 65537 1089536 1024000 500M 83 Linux
output/images/sdcard.img3 1089537 1220608 131072 64M c W95 FAT32 (LBA)


The math that determines the block offset needed to mount a parition

start * sector size = offset # equation
1 * 512 = 512 # BOOT parition
65537 * 512 = 33554944 # Linux root partition
1089537 * 512 = 557842944 # CODE parition


Mounting the paritions (read-only)

sudo mkdir /mnt/ot-img/boot /mnt/ot-img/rootfs /mnt/ot-img/code
sudo mount -o loop,ro,sync,offset=512 output/images/sdcard.img /mnt/ot-img/boot
sudo mount -o loop,ro,offset=33554944 -t ext4 output/images/sdcard.img /mnt/ot-img/rootfs
sudo mount -o loop,ro,sync,offset=557842944 output/images/sdcard.img /mnt/ot-img/code


Unmount the paritions

sudo umount /mnt/ot-img/boot
sudo umount /mnt/ot-img/rootfs
sudo umount /mnt/ot-img/code
91 changes: 91 additions & 0 deletions .github/workflows/build-ot-firmware.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Build the Open Trickler firmware images

name: build-ot-firmware

# Controls when the workflow will run
on:
# Note(eric): Disabled for now in favor of cron. Run on commits to existing PR.
#pull_request:
# types: [labeled, synchronize]
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
schedule:
# Monday at 1:00pm UTC which is usually 6:00am Pacific
- cron: '0 13 * * 1'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
firmware-build:
# The type of runner that the job will run on
runs-on: self-hosted

# Define the firmware matrix to build
strategy:
matrix:
board: [pi0w_dev, pizero2w_dev, pi0w_prod, pi3_dev]

outputs:
date: ${{ steps.date.outputs.date }}
sha: ${{ steps.sha.outputs.sha }}

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

- id: date
run: echo "::set-output name=date::$(date +'%Y%m%d')"

- id: sha
run: echo "::set-output name=sha::${GITHUB_SHA:0:7}"

- name: Python pre-flight check
run: |
pwd
ls -al
whoami
which python3
python3 --version
which pip3 || true
pip3 --version || true
pip3 freeze || true
python3 -m pip --version || true
python3 -m venv tmp-venv
. tmp-venv/bin/activate
which python
python --version
python -m ensurepip --upgrade
which pip
pip install --upgrade pip
pip freeze
pip install wheel
pip install bluezero==0.8.0 pybleno pyserial gpiozero pymemcache RPi.GPIO grpcio
deactivate

- name: Build firmware
run: |
make opentrickler_${{ matrix.board }}_defconfig
make -j35

- name: Package firmware image
run: |
ls -al output/images/
cp output/images/sdcard.img .
xz --keep --force sdcard.img
mv sdcard.img.xz opentrickler-${{ matrix.board }}-${{ steps.date.outputs.date }}-${{ steps.sha.outputs.sha }}.img.xz
shasum -a 256 opentrickler-${{ matrix.board }}-${{ steps.date.outputs.date }}-${{ steps.sha.outputs.sha }}.img.xz > shasum.txt
ls -al *sdcard.img*
du -sh *sdcard.img*

- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.board }} firmware
path: |
opentrickler-${{ matrix.board }}-${{ steps.date.outputs.date }}-${{ steps.sha.outputs.sha }}.img.xz
shasum.txt

- name: Garbage collection
run: |
make clean
rm shasum.txt *.img *.img.xz
40 changes: 40 additions & 0 deletions .github/workflows/sync-with-upstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Sync local branches with buildroot upstream on a regular basis.
name: sync-with-upstream

on:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
schedule:
# Monday at 12:30pm UTC which is usually 5:30am Pacific
- cron: '30 12 * * 1'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
sync:
runs-on: ubuntu-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

- name: Sync with upstream then merge local changes
run: |
which gh
whoami
cat .git/config
git config --list | head -20
git remote -v
git remote add upstream https://github.com/buildroot/buildroot.git
git remote -v
cat .git/config
tree .git/refs/
git fetch origin
git checkout 2022.05.x
git fetch upstream
git merge upstream/2022.05.x
git push origin 2022.05.x
git pull
tree .git/refs/
git checkout opentrickler-2022.05.x
git merge 2022.05.x

1 change: 1 addition & 0 deletions board/ammolytics/opentrickler-pi-generic
1 change: 1 addition & 0 deletions board/ammolytics/opentrickler-pi0w
1 change: 1 addition & 0 deletions board/ammolytics/opentrickler-pi3
1 change: 1 addition & 0 deletions board/ammolytics/opentrickler-pizero2w
1 change: 1 addition & 0 deletions board/ammolytics/opentrickler/cmdline.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
root=/dev/mmcblk0p2 rootwait
24 changes: 24 additions & 0 deletions board/ammolytics/opentrickler/config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Please note that this is only a sample, we recommend you to change it to fit
# your needs.
# You should override this file using a post-build script.
# See http://buildroot.org/manual.html#rootfs-custom
# and http://elinux.org/RPiconfig for a description of config.txt syntax

kernel=zImage

# To use an external initramfs file
#initramfs rootfs.cpio.gz

# Disable overscan assuming the display supports displaying the full resolution
# If the text shown on the screen disappears off the edge, comment this out
disable_overscan=1

# How much memory in MB to assign to the GPU on Pi models having
# 256, 512 or 1024 MB total memory
gpu_mem_256=100
gpu_mem_512=100
gpu_mem_1024=100


# Increase I2C speed to 400KHz, tries to reduce flicker on display
dtparam=i2c_baudrate=400000
4 changes: 4 additions & 0 deletions board/ammolytics/opentrickler/device_table.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/boot d 755 0 0 - - - - -
/code d 755 0 0 - - - - -
/usr/bin/python3.10 f 755 root root - - - - -
|xattr cap_net_raw+eip
54 changes: 54 additions & 0 deletions board/ammolytics/opentrickler/genimage-opentrickler-pi-generic.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
image boot.vfat {
vfat {
extraargs = "-n BOOT"
files = {
"bcm2708-rpi-b.dtb",
"bcm2708-rpi-b-plus.dtb",
"bcm2708-rpi-cm.dtb",
"rpi-firmware/bootcode.bin",
"rpi-firmware/fixup.dat",
"rpi-firmware/start.elf",
"rpi-firmware/overlays",
"cmdline.txt",
"config.txt",
"wpa_supplicant.conf",
"zImage"
}
}
size = 32M
}

image code.vfat {
vfat {
extraargs = "-n CODE"
files = {
"opentrickler",
"venv"
}
}
size = 64M
# For some reason, this fails the build.
#mountpoint = "/code"
}

image sdcard.img {
hdimage {
}

partition boot {
partition-type = 0xC
bootable = "true"
image = "boot.vfat"
}

partition rootfs {
partition-type = 0x83
image = "rootfs.ext4"
}

partition code {
partition-type = 0xC
image = "code.vfat"
}

}
52 changes: 52 additions & 0 deletions board/ammolytics/opentrickler/genimage-opentrickler-pi0w.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
image boot.vfat {
vfat {
extraargs = "-n BOOT"
files = {
"bcm2708-rpi-zero-w.dtb",
"rpi-firmware/bootcode.bin",
"rpi-firmware/fixup.dat",
"rpi-firmware/start.elf",
"rpi-firmware/overlays",
"cmdline.txt",
"config.txt",
"wpa_supplicant.conf",
"zImage"
}
}
size = 32M
}

image code.vfat {
vfat {
extraargs = "-n CODE"
files = {
"opentrickler",
"venv"
}
}
size = 64M
# For some reason, this fails the build.
#mountpoint = "/code"
}

image sdcard.img {
hdimage {
}

partition boot {
partition-type = 0xC
bootable = "true"
image = "boot.vfat"
}

partition rootfs {
partition-type = 0x83
image = "rootfs.ext4"
}

partition code {
partition-type = 0xC
image = "code.vfat"
}

}
Loading