feat: bundle Linux KneronPLUS wheel in installer

- Add scripts/linux/ directory for Linux-specific KneronPLUS wheel
- installer/app.go: add Linux case to wheel selection (scripts/linux/)
- build-installer-linux.sh: search ~/Downloads/KL520Web/package/ubuntu/
  and kneron_plus source dir for KneronPLUS*.whl
- Makefile: add Linux wheel copy to installer-payload target

Without the kp module, devices can be scanned (via pyusb fallback)
but cannot connect, load models, or run inference.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
jim800121chen 2026-03-25 19:34:57 +08:00
parent 99dc2f2a34
commit 0c540b5a35
3 changed files with 34 additions and 7 deletions

View File

@ -141,6 +141,12 @@ installer-payload: build-server-tray ## Stage payload files for GUI installer
cp "$$MACOS_WHL" installer/payload/scripts/macos/; \
echo " KneronPLUS macOS wheel bundled."; \
fi
@mkdir -p installer/payload/scripts/linux
@LINUX_WHL="$$(find ~/Downloads/KL520Web/package/ubuntu -name 'KneronPLUS*.whl' 2>/dev/null | head -1)"; \
if [ -n "$$LINUX_WHL" ]; then \
cp "$$LINUX_WHL" installer/payload/scripts/linux/; \
echo " KneronPLUS Linux wheel bundled."; \
fi
@# Copy WinUSB driver files (for Windows installer)
@mkdir -p installer/payload/drivers/amd64
cp server/scripts/drivers/kneron_winusb.inf installer/payload/drivers/

View File

@ -457,16 +457,23 @@ func (inst *Installer) setupPythonVenv(installDir string) error {
}
// Install KneronPLUS SDK wheel if bundled in payload.
// On macOS, prefer the macOS-specific wheel (v2.0.0 with .dylib);
// on Windows, prefer the Windows wheel (v3.1.2 with .dll).
// Each platform has its own wheel with platform-specific native libraries:
// macOS: scripts/macos/KneronPLUS*.whl (v2.0.0 with .dylib)
// Linux: scripts/linux/KneronPLUS*.whl (v2.0.0/v3.1.2 with .so)
// Windows: scripts/KneronPLUS*.whl (v3.1.2 with .dll)
scriptsDir := filepath.Join(installDir, "scripts")
var kpWheel string
if runtime.GOOS == "darwin" {
// macOS wheels are stored in scripts/macos/ subdirectory
switch runtime.GOOS {
case "darwin":
macMatches, _ := filepath.Glob(filepath.Join(scriptsDir, "macos", "KneronPLUS*.whl"))
if len(macMatches) > 0 {
kpWheel = macMatches[0]
}
case "linux":
linuxMatches, _ := filepath.Glob(filepath.Join(scriptsDir, "linux", "KneronPLUS*.whl"))
if len(linuxMatches) > 0 {
kpWheel = linuxMatches[0]
}
}
if kpWheel == "" {
// Fallback: pick any KneronPLUS wheel in scripts/ (Windows or generic)

View File

@ -111,13 +111,27 @@ cp scripts/kneron_detect.py installer/payload/scripts/
cp server/scripts/firmware/KL520/*.bin installer/payload/scripts/firmware/KL520/ 2>/dev/null || true
cp server/scripts/firmware/KL720/*.bin installer/payload/scripts/firmware/KL720/ 2>/dev/null || true
# Copy KneronPLUS wheel if available
kp_wheel=$(find "$REPO_ROOT" -maxdepth 2 -name 'KneronPLUS*linux*.whl' 2>/dev/null | head -1)
# Copy KneronPLUS wheel if available (Linux-specific)
mkdir -p installer/payload/scripts/linux
kp_wheel=""
# Search order: KL520Web ubuntu package → kneron_plus source zip extract → repo root
for search_dir in \
"$HOME/Downloads/KL520Web/package/ubuntu" \
"$REPO_ROOT/kneron_plus/python/package/ubuntu" \
"$REPO_ROOT"; do
found=$(find "$search_dir" -maxdepth 1 -name 'KneronPLUS*.whl' 2>/dev/null | head -1)
if [ -n "$found" ]; then
kp_wheel="$found"
break
fi
done
if [ -n "$kp_wheel" ]; then
cp "$kp_wheel" installer/payload/scripts/
cp "$kp_wheel" installer/payload/scripts/linux/
info "KneronPLUS wheel bundled: $(basename "$kp_wheel")"
else
warn "KneronPLUS wheel not found, skipping."
warn " Expected in: ~/Downloads/KL520Web/package/ubuntu/"
fi
file_count=$(find installer/payload -type f | wc -l)