Skip to content

Commit

Permalink
Merge pull request #1 from EffectiveRange/dev
Browse files Browse the repository at this point in the history
enable operation from external battery
  • Loading branch information
effective-range authored Jul 23, 2024
2 parents fda0b86 + 950f27d commit 99bea06
Show file tree
Hide file tree
Showing 16 changed files with 2,943 additions and 22 deletions.
744 changes: 744 additions & 0 deletions .clang-format

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ jobs:
uses: devcontainers/[email protected]
with:
subFolder: "${{github.workspace}}"
configFile: .devcontainer/amd64-container/devcontainer.json
configFile: .devcontainer/armhf-container/devcontainer.json
push: never
runCmd: |
make -C "/workspaces/${{steps.extract.outputs.proj}}/" all
"/workspaces/${{steps.extract.outputs.proj}}/build.sh"
-
name: Release
uses: softprops/action-gh-release@v1
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
build/*
mrhat-rx8130/boot/*
mrhat-rx8130/boot/*
mrhat-rx8130/lib/*
mrhat-rx8130/usr/*
tools/build/*
53 changes: 53 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

VERSION = $(shell grep Version: mrhat-rx8130/DEBIAN/control | cut -d' ' -f2)
# TODO: build module for all kernel versions
KVER ?= 6.1.21+
TARGET ?= $(error TARGET not specified for deploy )

all: build/mrhat-rx8130_$(VERSION)-1_armhf.deb
@true

build/mrhat-rx8130_$(VERSION)-1_armhf.deb : driver tools mrhat-rx8130/DEBIAN/* build/mrhat-rx8130.dtbo
mkdir -p build
mkdir -p mrhat-rx8130/boot/overlays/
cp build/mrhat-rx8130.dtbo mrhat-rx8130/boot/overlays/
dpkg-deb --root-owner-group --build mrhat-rx8130 build/mrhat-rx8130_$(VERSION)-1_armhf.deb

mrhat-rx8130/lib/modules/$(KVER)/rtc-rx8130.ko: driver/*.c driver/Makefile
mkdir -p build/$(KVER)
mkdir -p mrhat-rx8130/lib/modules/$(KVER)
rsync --delete -r ./driver/ /tmp/drv-rx8130ce
schroot -c buildroot -u root -d /tmp/drv-rx8130ce -- make KVER=$(KVER)
cp /tmp/drv-rx8130ce/rtc-rx8130.ko mrhat-rx8130/lib/modules/$(KVER)/rtc-rx8130.ko

driver: mrhat-rx8130/lib/modules/$(KVER)/rtc-rx8130.ko
@true

clean:
rm -rf mrhat-rx8130/boot/ mrhat-rx8130/lib/ mrhat-rx8130/usr build/ tools/build

build/mrhat-rx8130.dts.pre: mrhat-rx8130.dts
mkdir -p build/
cpp -nostdinc -undef -x assembler-with-cpp -I/var/chroot/buildroot/usr/src/linux-headers-$(KVER)/include -o build/mrhat-rx8130.dts.pre mrhat-rx8130.dts

build/mrhat-rx8130.dtbo: build/mrhat-rx8130.dts.pre
mkdir -p build/
dtc -I dts -O dtb -o build/mrhat-rx8130.dtbo build/mrhat-rx8130.dts.pre

deploy: all
rsync -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" -avhz --progress build/mrhat-rx8130_$(VERSION)-1_armhf.deb $(TARGET):/tmp/
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $(TARGET) -- sudo dpkg -r mrhat-rx8130
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $(TARGET) -- sudo dpkg -i /tmp/mrhat-rx8130_$(VERSION)-1_armhf.deb

quickdeploy: driver
scp mrhat-rx8130/lib/modules/$(KVER)/rtc-rx8130.ko $(TARGET):/tmp/
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $(TARGET) -- sudo cp /tmp/rtc-rx8130.ko /lib/modules/$(KVER)/

tools:
mkdir -p tools/build
mkdir -p mrhat-rx8130/usr/local/bin
xcmake -S tools -B tools/build
cmake --build tools/build
cmake --install tools/build --prefix mrhat-rx8130/usr/local/

.PHONY: clean all deploy quickdeploy driver tools
9 changes: 9 additions & 0 deletions build.sh
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
12 changes: 12 additions & 0 deletions driver/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
obj-m += rtc-rx8130.o

KVER ?= $(shell uname -r)
PWD := $(CURDIR)

CFLAGS_rtc-rx8130.o := -O2 -Wall -Werror

all:
make -C /lib/modules/$(KVER)/build M=$(PWD) modules

clean:
make -C /lib/modules/$(KVER)/build M=$(PWD) clean
Loading

0 comments on commit 99bea06

Please sign in to comment.