-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a182490
commit 186d28f
Showing
14 changed files
with
433 additions
and
52 deletions.
There are no files selected for viewing
Submodule .devcontainer
added at
190f80
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
# GitHub recommends pinning actions to a commit SHA. | ||
# To get a newer version, you will need to update the SHA. | ||
# You can also reference a tag or branch, but the action may change without warning. | ||
|
||
name: Release | ||
|
||
on: | ||
push: | ||
branches: main | ||
tags: v*.*.* | ||
|
||
pull_request: | ||
types: | ||
- synchronize | ||
- opened | ||
- reopened | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.sha }} | ||
cancel-in-progress: true | ||
|
||
|
||
jobs: | ||
|
||
create_release: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
discussions: write | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- | ||
name: Set up QEMU for multi-architecture builds | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Extract project name | ||
id: extract | ||
run: | | ||
echo proj="$(basename ${{github.workspace}})" >> $GITHUB_OUTPUT | ||
- | ||
name: Build Project | ||
uses: devcontainers/[email protected] | ||
with: | ||
subFolder: "${{github.workspace}}" | ||
configFile: .devcontainer/armhf-container/devcontainer.json | ||
push: never | ||
runCmd: | | ||
"/workspaces/${{steps.extract.outputs.proj}}/build.sh" | ||
- | ||
name: Release | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
fail_on_unmatched_files: true | ||
generate_release_notes: true | ||
files: | | ||
build/*.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,5 @@ | ||
# Prerequisites | ||
*.d | ||
|
||
# Object files | ||
*.o | ||
*.ko | ||
*.obj | ||
*.elf | ||
|
||
# Linker output | ||
*.ilk | ||
*.map | ||
*.exp | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Libraries | ||
*.lib | ||
*.a | ||
*.la | ||
*.lo | ||
|
||
# Shared objects (inc. Windows DLLs) | ||
*.dll | ||
*.so | ||
*.so.* | ||
*.dylib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
*.i*86 | ||
*.x86_64 | ||
*.hex | ||
|
||
# Debug files | ||
*.dSYM/ | ||
*.su | ||
*.idb | ||
*.pdb | ||
|
||
# Kernel Module Compile Results | ||
*.mod* | ||
*.cmd | ||
.tmp_versions/ | ||
modules.order | ||
Module.symvers | ||
Mkfile.old | ||
dkms.conf | ||
build/* | ||
deb/boot/* | ||
deb/lib/* | ||
deb/usr/* | ||
tools/build/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule ".devcontainer"] | ||
path = .devcontainer | ||
url = https://github.com/EffectiveRange/devcontainer-defs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
VERSION = $(shell grep Version: deb/DEBIAN/control | cut -d' ' -f2) | ||
# TODO: build module for all kernel versions | ||
KVER ?= 6.1.21+ | ||
TARGET ?= $(error TARGET not specified for deploy ) | ||
WSPDIR = $(shell dirname $(CURDIR) ) | ||
PKGNAME = mrhat-platform | ||
KONAME = er-mrhat-plat | ||
|
||
all: build/$(PKGNAME)_$(VERSION)-1_armhf.deb | ||
@true | ||
|
||
build/$(PKGNAME)_$(VERSION)-1_armhf.deb : driver build/$(PKGNAME).dtbo deb/DEBIAN/* | ||
mkdir -p build | ||
mkdir -p deb/lib/modules/$(KVER) | ||
mkdir -p deb/boot/overlays/ | ||
cp build/$(PKGNAME).dtbo deb/boot/overlays/ | ||
dpkg-deb --root-owner-group --build deb build/$(PKGNAME)_$(VERSION)-1_armhf.deb | ||
|
||
deb/lib/modules/$(KVER)/$(KONAME).ko: driver/*.c driver/Makefile | ||
mkdir -p build | ||
mkdir -p deb/lib/modules/$(KVER)/ | ||
rsync --delete -r ./driver/ /tmp/$(WSPDIR) | ||
schroot -c buildroot -u root -d /tmp/$(WSPDIR) -- make KVER=$(KVER) BQCFLAGS=$(BQCFLAGS) | ||
cp /tmp/$(WSPDIR)/$(KONAME).ko deb/lib/modules/$(KVER)/$(KONAME).ko | ||
|
||
driver: deb/lib/modules/$(KVER)/$(KONAME).ko | ||
@true | ||
|
||
clean: | ||
rm -rf deb/boot/ deb/lib/ build/ | ||
|
||
build/$(PKGNAME).dts.pre: $(PKGNAME).dts | ||
mkdir -p build/ | ||
cpp -nostdinc -undef -x assembler-with-cpp -I/var/chroot/buildroot/usr/src/linux-headers-$(KVER)/include -o build/$(PKGNAME).dts.pre $(PKGNAME).dts | ||
|
||
build/$(PKGNAME).dtbo: build/$(PKGNAME).dts.pre | ||
mkdir -p build/ | ||
dtc -I dts -O dtb -o build/$(PKGNAME).dtbo build/$(PKGNAME).dts.pre | ||
|
||
deploy: all | ||
rsync -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" -avhz --progress build/$(PKGNAME)_$(VERSION)-1_armhf.deb $(TARGET):/tmp/ | ||
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $(TARGET) -- sudo dpkg -r $(PKGNAME) | ||
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $(TARGET) -- sudo dpkg -i /tmp/$(PKGNAME)_$(VERSION)-1_armhf.deb | ||
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $(TARGET) -- sudo sed -ri '/^\s*dtoverlay=$(PKGNAME)/d' /boot/config.txt | ||
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $(TARGET) -- "echo dtoverlay=$(PKGNAME) | sudo tee -a /boot/config.txt" | ||
|
||
quickdeploy: driver | ||
scp deb/lib/modules/$(KVER)/$(KONAME).ko $(TARGET):/tmp/ | ||
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $(TARGET) -- sudo cp /tmp/$(KONAME).ko /lib/modules/$(KVER)/ | ||
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $(TARGET) -- "sudo rmmod $(KONAME) || true" | ||
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $(TARGET) -- "sudo modprobe $(KONAME) || true" | ||
|
||
|
||
.PHONY: clean all deploy quickdeploy driver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
pushd $(dirname $0) | ||
LAST_KVER="" | ||
for kver in $(ls -1 /var/chroot/buildroot/lib/modules); | ||
do | ||
LAST_KVER=$kver | ||
make driver KVER=$kver | ||
done | ||
make all KVER=$LAST_KVER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Package: mrhat-platform | ||
Version: 0.1.0 | ||
Maintainer: Effective Range Kft. | ||
Architecture: armhf | ||
Description: Device driver and device tree overlay for the Effective Range MrHat extension hat for RaspberryPi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
if [[ -z "$(grep er-mrhat-plat /etc/modules)" ]]; | ||
then | ||
echo "Adding er-mrhat-plat to /etc/modules ..." | ||
echo 'er-mrhat-plat' >> /etc/modules | ||
depmod | ||
fi | ||
|
||
echo "Please add 'dtoverlay=mrhat-platform' if needed, then reboot ..." | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
echo "Removing module autoload for er-mrhat-plat ..." | ||
sed -ri '/^\s*er-mrhat-plat/d' /etc/modules | ||
|
||
depmod | ||
|
||
echo "Removal of mrhat-platform completed, please remove 'dtoverlay=mrhat-platform' from /boot/config.txt if not needed anymore then reboot ..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
# removing existing dtb file, as it blocks installation | ||
rm -f /boot/overlays/mrhat-platform.dtbo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
obj-m += er-mrhat-plat.o | ||
|
||
KVER ?= $(shell uname -r) | ||
PWD := $(CURDIR) | ||
|
||
CFLAGS_er-mrhat-plat.o := -O2 -Wall -Werror $(BQCFLAGS) | ||
|
||
all: | ||
make -C /lib/modules/$(KVER)/build M=$(PWD) modules | ||
|
||
clean: | ||
make -C /lib/modules/$(KVER)/build M=$(PWD) clean |
Oops, something went wrong.