Skip to content

Commit 8fbd6bc

Browse files
committed
Add support for Luckfox PicoKVM
Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
1 parent 3e7d8fb commit 8fbd6bc

File tree

114 files changed

+4665
-3259
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+4665
-3259
lines changed

.devcontainer/devcontainer.json

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- name: Upload artifact
4646
uses: actions/upload-artifact@v4
4747
with:
48-
name: jetkvm-app
48+
name: kvm-app
4949
path: |
50-
bin/jetkvm_app
50+
bin/kvm_app
5151
device-tests.tar.gz

.github/workflows/smoketest.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ jobs:
4242
sudo ip r r $CI_HOST via $CI_WG_GATEWAY dev wg-ci
4343
ping -c1 $CI_HOST || (echo "Failed to ping $CI_HOST" && sudo wg show wg-ci && ip r && exit 1)
4444
env:
45-
CI_HOST: ${{ vars.JETKVM_CI_HOST }}
46-
CI_WG_IPS: ${{ vars.JETKVM_CI_WG_IPS }}
47-
CI_WG_GATEWAY: ${{ vars.JETKVM_CI_GATEWAY }}
48-
CI_WG_ALLOWED_IPS: ${{ vars.JETKVM_CI_WG_ALLOWED_IPS }}
49-
CI_WG_PUBLIC: ${{ secrets.JETKVM_CI_WG_PUBLIC }}
50-
CI_WG_PRIVATE: ${{ secrets.JETKVM_CI_WG_PRIVATE }}
51-
CI_WG_ENDPOINT: ${{ secrets.JETKVM_CI_WG_ENDPOINT }}
45+
CI_HOST: ${{ vars.KVM_CI_HOST }}
46+
CI_WG_IPS: ${{ vars.KVM_CI_WG_IPS }}
47+
CI_WG_GATEWAY: ${{ vars.KVM_CI_GATEWAY }}
48+
CI_WG_ALLOWED_IPS: ${{ vars.KVM_CI_WG_ALLOWED_IPS }}
49+
CI_WG_PUBLIC: ${{ secrets.KVM_CI_WG_PUBLIC }}
50+
CI_WG_PRIVATE: ${{ secrets.KVM_CI_WG_PRIVATE }}
51+
CI_WG_ENDPOINT: ${{ secrets.KVM_CI_WG_ENDPOINT }}
5252
- name: Configure SSH
5353
run: |
5454
# Write SSH private key to a file
@@ -66,9 +66,9 @@ jobs:
6666
IdentityFile $SSH_PRIVATE_KEY
6767
EOF
6868
env:
69-
CI_USER: ${{ vars.JETKVM_CI_USER }}
70-
CI_HOST: ${{ vars.JETKVM_CI_HOST }}
71-
CI_SSH_PRIVATE: ${{ secrets.JETKVM_CI_SSH_PRIVATE }}
69+
CI_USER: ${{ vars.KVM_CI_USER }}
70+
CI_HOST: ${{ vars.KVM_CI_HOST }}
71+
CI_SSH_PRIVATE: ${{ secrets.KVM_CI_SSH_PRIVATE }}
7272
- name: Run tests
7373
run: |
7474
set -e
@@ -116,12 +116,12 @@ jobs:
116116
set -e
117117
# Copy the binary to the remote host
118118
echo "+ Copying the application to the remote host"
119-
cat bin/jetkvm_app | gzip | ssh jkci "cat > /userdata/jetkvm/jetkvm_app.update.gz"
119+
cat bin/kvm_app | gzip | ssh jkci "cat > /userdata/picokvm/kvm_app.update.gz"
120120
# Deploy and run the application on the remote host
121121
echo "+ Deploying the application on the remote host"
122122
ssh jkci ash <<EOF
123123
# Extract the binary
124-
gzip -d /userdata/jetkvm/jetkvm_app.update.gz
124+
gzip -d /userdata/picokvm/kvm_app.update.gz
125125
# Flush filesystem buffers to ensure all data is written to disk
126126
sync
127127
# Clear the filesystem caches to force a read from disk
@@ -130,22 +130,22 @@ jobs:
130130
reboot -d 5 -f &
131131
EOF
132132
sleep 10
133-
echo "Deployment complete, waiting for JetKVM to come back online "
133+
echo "Deployment complete, waiting for KVM to come back online "
134134
function check_online() {
135135
for i in {1..60}; do
136136
if ping -c1 -w1 -W1 -q $CI_HOST >/dev/null; then
137-
echo "JetKVM is back online"
137+
echo "KVM is back online"
138138
return 0
139139
fi
140140
echo -n "."
141141
sleep 1
142142
done
143-
echo "JetKVM did not come back online within 60 seconds"
143+
echo "KVM did not come back online within 60 seconds"
144144
return 1
145145
}
146146
check_online
147147
env:
148-
CI_HOST: ${{ vars.JETKVM_CI_HOST }}
148+
CI_HOST: ${{ vars.KVM_CI_HOST }}
149149
- name: Run smoke tests
150150
run: |
151151
echo "+ Checking the status of the device"
@@ -157,13 +157,13 @@ jobs:
157157
ssh jkci ash > $local_log_tar <<'EOF'
158158
log_path=$(mktemp -d)
159159
dmesg > $log_path/dmesg.log
160-
cp /userdata/jetkvm/last.log $log_path/last.log
160+
cp /userdata/picokvm/last.log $log_path/last.log
161161
tar -czf - -C $log_path .
162162
EOF
163163
tar -xf $local_log_tar
164164
cat dmesg.log last.log
165165
env:
166-
CI_HOST: ${{ vars.JETKVM_CI_HOST }}
166+
CI_HOST: ${{ vars.KVM_CI_HOST }}
167167
- name: Upload logs
168168
uses: actions/upload-artifact@v4
169169
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ bin/*
22
static/*
33
.idea
44
.DS_Store
5+
.vscode
56

67
device-tests.tar.gz

CODE_OF_CONDUCT.md

Lines changed: 0 additions & 130 deletions
This file was deleted.

Makefile

Lines changed: 7 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
22
BUILDDATE ?= $(shell date -u +%FT%T%z)
33
BUILDTS ?= $(shell date -u +%s)
44
REVISION ?= $(shell git rev-parse HEAD)
5-
VERSION_DEV ?= 0.4.5-dev$(shell date +%Y%m%d%H%M)
6-
VERSION ?= 0.4.4
5+
VERSION_DEV ?= 0.0.1-dev
6+
VERSION ?= 0.0.1
77

88
PROMETHEUS_TAG := github.com/prometheus/common/version
9-
KVM_PKG_NAME := github.com/jetkvm/kvm
9+
KVM_PKG_NAME := kvm
1010

1111
GO_BUILD_ARGS := -tags netgo
1212
GO_RELEASE_BUILD_ARGS := -trimpath $(GO_BUILD_ARGS)
@@ -22,68 +22,19 @@ BIN_DIR := $(shell pwd)/bin
2222

2323
TEST_DIRS := $(shell find . -name "*_test.go" -type f -exec dirname {} \; | sort -u)
2424

25-
hash_resource:
26-
@shasum -a 256 resource/jetkvm_native | cut -d ' ' -f 1 > resource/jetkvm_native.sha256
27-
28-
build_dev: hash_resource
25+
build_dev:
2926
@echo "Building..."
3027
$(GO_CMD) build \
3128
-ldflags="$(GO_LDFLAGS) -X $(KVM_PKG_NAME).builtAppVersion=$(VERSION_DEV)" \
3229
$(GO_RELEASE_BUILD_ARGS) \
33-
-o $(BIN_DIR)/jetkvm_app cmd/main.go
34-
35-
build_test2json:
36-
$(GO_CMD) build -o $(BIN_DIR)/test2json cmd/test2json
37-
38-
build_gotestsum:
39-
@echo "Building gotestsum..."
40-
$(GO_CMD) install gotest.tools/gotestsum@latest
41-
cp $(shell $(GO_CMD) env GOPATH)/bin/linux_arm/gotestsum $(BIN_DIR)/gotestsum
42-
43-
build_dev_test: build_test2json build_gotestsum
44-
# collect all directories that contain tests
45-
@echo "Building tests for devices ..."
46-
@rm -rf $(BIN_DIR)/tests && mkdir -p $(BIN_DIR)/tests
47-
48-
@cat resource/dev_test.sh > $(BIN_DIR)/tests/run_all_tests
49-
@for test in $(TEST_DIRS); do \
50-
test_pkg_name=$$(echo $$test | sed 's/^.\///g'); \
51-
test_pkg_full_name=$(KVM_PKG_NAME)/$$(echo $$test | sed 's/^.\///g'); \
52-
test_filename=$$(echo $$test_pkg_name | sed 's/\//__/g')_test; \
53-
$(GO_CMD) test -v \
54-
-ldflags="$(GO_LDFLAGS) -X $(KVM_PKG_NAME).builtAppVersion=$(VERSION_DEV)" \
55-
$(GO_BUILD_ARGS) \
56-
-c -o $(BIN_DIR)/tests/$$test_filename $$test; \
57-
echo "runTest ./$$test_filename $$test_pkg_full_name" >> $(BIN_DIR)/tests/run_all_tests; \
58-
done; \
59-
chmod +x $(BIN_DIR)/tests/run_all_tests; \
60-
cp $(BIN_DIR)/test2json $(BIN_DIR)/tests/ && chmod +x $(BIN_DIR)/tests/test2json; \
61-
cp $(BIN_DIR)/gotestsum $(BIN_DIR)/tests/ && chmod +x $(BIN_DIR)/tests/gotestsum; \
62-
tar czfv device-tests.tar.gz -C $(BIN_DIR)/tests .
30+
-o $(BIN_DIR)/kvm_app cmd/main.go
6331

6432
frontend:
6533
cd ui && npm ci && npm run build:device
6634

67-
dev_release: frontend build_dev
68-
@echo "Uploading release..."
69-
@shasum -a 256 bin/jetkvm_app | cut -d ' ' -f 1 > bin/jetkvm_app.sha256
70-
rclone copyto bin/jetkvm_app r2://jetkvm-update/app/$(VERSION_DEV)/jetkvm_app
71-
rclone copyto bin/jetkvm_app.sha256 r2://jetkvm-update/app/$(VERSION_DEV)/jetkvm_app.sha256
72-
73-
build_release: frontend hash_resource
35+
build_release: frontend
7436
@echo "Building release..."
7537
$(GO_CMD) build \
7638
-ldflags="$(GO_LDFLAGS) -X $(KVM_PKG_NAME).builtAppVersion=$(VERSION)" \
7739
$(GO_RELEASE_BUILD_ARGS) \
78-
-o bin/jetkvm_app cmd/main.go
79-
80-
release:
81-
@if rclone lsf r2://jetkvm-update/app/$(VERSION)/ | grep -q "jetkvm_app"; then \
82-
echo "Error: Version $(VERSION) already exists. Please update the VERSION variable."; \
83-
exit 1; \
84-
fi
85-
make build_release
86-
@echo "Uploading release..."
87-
@shasum -a 256 bin/jetkvm_app | cut -d ' ' -f 1 > bin/jetkvm_app.sha256
88-
rclone copyto bin/jetkvm_app r2://jetkvm-update/app/$(VERSION)/jetkvm_app
89-
rclone copyto bin/jetkvm_app.sha256 r2://jetkvm-update/app/$(VERSION)/jetkvm_app.sha256
40+
-o bin/kvm_app cmd/main.go

0 commit comments

Comments
 (0)