feat: bundle WinUSB driver files and libusb DLL in repo

Add installer/drivers/ with all Windows USB driver dependencies:
- kneron_winusb.inf (KL520/KL720 WinUSB driver)
- amd64/WdfCoInstaller01011.dll (WDF co-installer)
- amd64/winusbcoinstaller2.dll (WinUSB co-installer)
- libusb-1.0.dll (USB communication library)

Previously these files were sourced from external local_service_win/
directory which may not exist on build machines. Now all build
scripts (Makefile, build-installer.ps1) source from the repo.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
jim800121chen 2026-03-26 09:19:54 +08:00
parent d7982554fa
commit dc896bea4f
6 changed files with 98 additions and 16 deletions

View File

@ -145,13 +145,14 @@ installer-payload: build-server-tray ## Stage payload files for GUI installer
cp installer/wheels/linux/KneronPLUS*.whl installer/payload/scripts/linux/; \
echo " KneronPLUS Linux wheel bundled."; \
fi
@# Copy WinUSB driver files (for Windows installer)
@# Copy WinUSB driver files from repo (for Windows installer)
@mkdir -p installer/payload/drivers/amd64
cp server/scripts/drivers/kneron_winusb.inf installer/payload/drivers/
@if [ -d "../local_service_win/LocalAPI/win_driver/amd64" ]; then \
cp ../local_service_win/LocalAPI/win_driver/amd64/WdfCoInstaller01011.dll installer/payload/drivers/amd64/; \
cp ../local_service_win/LocalAPI/win_driver/amd64/winusbcoinstaller2.dll installer/payload/drivers/amd64/; \
echo " WinUSB driver files bundled."; \
@if [ -f "installer/drivers/kneron_winusb.inf" ]; then \
cp installer/drivers/kneron_winusb.inf installer/payload/drivers/; \
cp installer/drivers/amd64/WdfCoInstaller01011.dll installer/payload/drivers/amd64/; \
cp installer/drivers/amd64/winusbcoinstaller2.dll installer/payload/drivers/amd64/; \
cp installer/drivers/libusb-1.0.dll installer/payload/scripts/; \
echo " WinUSB driver + libusb bundled."; \
fi
@echo "Payload staged in installer/payload/"

View File

@ -0,0 +1,82 @@
; kneron_winusb.inf
; WinUSB driver for Kneron KL520 and KL720 USB AI accelerators
; Supports: KL520 (PID 0x0100), KL720 KDP legacy (PID 0x0200), KL720 KDP2 (PID 0x0720)
[Strings]
DeviceName520 = "Kneron KL520"
DeviceName720 = "Kneron KL720"
DeviceName720v2 = "Kneron KL720 v2"
VendorName = "Kneron Inc."
SourceName = "Kneron WinUSB Install Disk"
DeviceGUID = "{A897B340-F751-4FEE-8DAD-40EC8BC77200}"
[Version]
Signature = "$Windows NT$"
Class = "USBDevice"
ClassGuid = {88bae032-5a81-49f0-bc3d-a4ff138216d6}
Provider = %VendorName%
CatalogFile = kneron_winusb.cat
DriverVer = 03/09/2026, 6.1.7600.16385
[ClassInstall32]
Addreg = WinUSBDeviceClassReg
[WinUSBDeviceClassReg]
HKR,,,0,"Universal Serial Bus devices"
HKR,,Icon,,-20
[Manufacturer]
%VendorName% = KneronDevices,NTamd64
[KneronDevices.NTamd64]
%DeviceName520% = USB_Install, USB\VID_3231&PID_0100
%DeviceName720% = USB_Install, USB\VID_3231&PID_0200
%DeviceName720v2% = USB_Install, USB\VID_3231&PID_0720
[USB_Install]
Include = winusb.inf
Needs = WINUSB.NT
[USB_Install.Services]
Include = winusb.inf
AddService = WinUSB,0x00000002,WinUSB_ServiceInstall
[WinUSB_ServiceInstall]
DisplayName = "WinUSB - Kneron USB Device"
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %12%\WinUSB.sys
[USB_Install.Wdf]
KmdfService = WINUSB, WinUsb_Install
[WinUSB_Install]
KmdfLibraryVersion = 1.11
[USB_Install.HW]
AddReg = AddDeviceInterfaceGUID
[AddDeviceInterfaceGUID]
HKR,,DeviceInterfaceGUIDs,0x10000,%DeviceGUID%
[USB_Install.CoInstallers]
AddReg = CoInstallers_AddReg
CopyFiles = CoInstallers_CopyFiles
[CoInstallers_AddReg]
HKR,,CoInstallers32,0x00010000,"WdfCoInstaller01011.dll,WdfCoInstaller","WinUSBCoInstaller2.dll"
[CoInstallers_CopyFiles]
WinUSBCoInstaller2.dll
WdfCoInstaller01011.dll
[DestinationDirs]
CoInstallers_CopyFiles = 11
[SourceDisksNames]
1 = %SourceName%
[SourceDisksFiles.amd64]
WinUSBCoInstaller2.dll = 1,amd64
WdfCoInstaller01011.dll = 1,amd64

Binary file not shown.

View File

@ -76,13 +76,13 @@ Copy-Item scripts\kneron_detect.py installer\payload\scripts\
Copy-Item server\scripts\firmware\KL520\*.bin installer\payload\scripts\firmware\KL520\
Copy-Item server\scripts\firmware\KL720\*.bin installer\payload\scripts\firmware\KL720\
# Copy libusb DLL if available
$libusbSrc = Join-Path $repoRoot "local_service_win\third_party\Kneron_DFUT\bin\libusb-1.0.dll"
# Copy libusb DLL from repo
$libusbSrc = "installer\drivers\libusb-1.0.dll"
if (Test-Path $libusbSrc) {
Copy-Item $libusbSrc installer\payload\scripts\
Write-Host " libusb-1.0.dll bundled." -ForegroundColor Green
} else {
Write-Host " libusb-1.0.dll not found, skipping." -ForegroundColor Yellow
Write-Host " libusb-1.0.dll not found in installer\drivers\, skipping." -ForegroundColor Yellow
}
# Copy KneronPLUS wheel from repo
@ -94,16 +94,15 @@ if ($kpWheel) {
Write-Host " KneronPLUS wheel not found in installer\wheels\windows\, skipping." -ForegroundColor Yellow
}
# Copy WinUSB driver files (INF + co-installers)
# Copy WinUSB driver files from repo (INF + co-installers)
New-Item -ItemType Directory -Force -Path installer\payload\drivers\amd64 | Out-Null
Copy-Item server\scripts\drivers\kneron_winusb.inf installer\payload\drivers\
$winDriverDir = Join-Path $repoRoot "local_service_win\LocalAPI\win_driver\amd64"
if (Test-Path $winDriverDir) {
Copy-Item (Join-Path $winDriverDir "WdfCoInstaller01011.dll") installer\payload\drivers\amd64\
Copy-Item (Join-Path $winDriverDir "winusbcoinstaller2.dll") installer\payload\drivers\amd64\
Copy-Item installer\drivers\kneron_winusb.inf installer\payload\drivers\
if (Test-Path "installer\drivers\amd64\WdfCoInstaller01011.dll") {
Copy-Item installer\drivers\amd64\WdfCoInstaller01011.dll installer\payload\drivers\amd64\
Copy-Item installer\drivers\amd64\winusbcoinstaller2.dll installer\payload\drivers\amd64\
Write-Host " WinUSB driver files bundled." -ForegroundColor Green
} else {
Write-Host " WinUSB co-installer DLLs not found, skipping." -ForegroundColor Yellow
Write-Host " WinUSB co-installer DLLs not found in installer\drivers\amd64\, skipping." -ForegroundColor Yellow
}
$fileCount = (Get-ChildItem -Recurse installer\payload -File).Count