Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling arm64 support #1130

Open
EmbeddedAndroid opened this issue Feb 10, 2025 · 19 comments
Open

Enabling arm64 support #1130

EmbeddedAndroid opened this issue Feb 10, 2025 · 19 comments

Comments

@EmbeddedAndroid
Copy link
Contributor

EmbeddedAndroid commented Feb 10, 2025

I'd like to open this issue to track the progress of adding ARM64 support to this project. @dorssel and I spoke last week about getting this supported in the project, and this is the follow up.

Issues to resolve:

  • It is required to have signed arm64 vboxusb and vboxmon drivers provided to this project
    • The released version of virtualbox does not have arm64 support
    • Virtualbox is now providing developer snapshots releases which contain the arm64 signed drivers required
      • We have tested the installation and can confirm usbipd list shows connected usb devices on arm64
  • Create an ARM64 build configuration for the project
  • Testing and validation on arm64 hardware

Proposal:

  • Extract the drivers from the virtualbox development snapshot image, and open a PR to add them into this project.
  • Need to build a statically linked distro-independent arm64 usbip client, and archive it as a proper artifact
  • Add the arm64 build configuration
  • Fix the signing of the arm64 drivers from the vbox testbuilds
  • Get some folks to help test the arm64 builds and report issues.
    • Testable arm64 installer can be found here
    • How to test on arm64
      • You first need to disable signing verification by launching an admin powershell session and running the follow command
        • bcdedit.exe /set testsigning on
        • Reboot
        • Run Installer
  • Once validation has completed, make a release to include MSI's for both architectures.

Please let me know your thoughts on this approach and any feedback you may have.

@dorssel
Copy link
Owner

dorssel commented Feb 12, 2025

I identified another work item.

https://github.com/dorssel/usbipd-win/tree/master/Usbipd/WSL contains a pre-built (x64!) statically linked distro-independent usbip client. I built this myself, but I'm moving it to GitHub repo so it becomes a proper artifact to include.. This needs to be built for ARM64 as well.

@EmbeddedAndroid
Copy link
Contributor Author

I identified another work item.

https://github.com/dorssel/usbipd-win/tree/master/Usbipd/WSL contains a pre-built (x64!) statically linked distro-independent usbip client. I built this myself, but I'm moving it to GitHub repo so it becomes a proper artifact to include.. This needs to be built for ARM64 as well.

Nice catch, we noticed this when attempting to test end to end. Hadn't had a chance to dig in, but I've updated the issue to add this.

@EmbeddedAndroid
Copy link
Contributor Author

EmbeddedAndroid commented Feb 13, 2025

I identified another work item.

https://github.com/dorssel/usbipd-win/tree/master/Usbipd/WSL contains a pre-built (x64!) statically linked distro-independent usbip client. I built this myself, but I'm moving it to GitHub repo so it becomes a proper artifact to include.. This needs to be built for ARM64 as well.

I've built a statically linked distro-independent (using the libudev-zero project as described in the WSL README)

tyler@QCOM-4SBddNNiHM:~/WSL2-Linux-Kernel/tools/usb/usbip$ usbip help
usage: usbip [--debug] [--log] [--tcp-port PORT] [version]
             [help] <command> <args>

  attach     Attach a remote USB device
  detach     Detach a remote USB device
  list       List exportable or local USB devices
  bind       Bind device to usbip-host.ko
  unbind     Unbind device from usbip-host.ko
  port       Show imported USB devices

tyler@QCOM-4SBddNNiHM:~/WSL2-Linux-Kernel/tools/usb/usbip$ file usbip
usbip: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, BuildID[sha1]=933f7e3dd4692fd3a38f88002e458b9838365b55, for GNU/Linux 3.7.0, stripped

Shall I email it to you so you can upload it as an artifact? or just open a MR for adding it to the project?

@EmbeddedAndroid
Copy link
Contributor Author

@dorssel re: usbip - if you want help setting up this a proper project to produce the builds for x64/arm64 let me know, happy to help out.

@dorssel
Copy link
Owner

dorssel commented Feb 13, 2025

@dorssel re: usbip - if you want help setting up this a proper project to produce the builds for x64/arm64 let me know, happy to help out.

Already have a private repo that does this for x64. Will publish soon. Don't know if it can be used to cross-compile for ARM64 (public Linux GitHub bots are native x64). But the build steps will be the same, so it can easily be repeated on an ARM64 Linux distro, just not automated.

@dorssel
Copy link
Owner

dorssel commented Feb 13, 2025

I've built a statically linked distro-independent (using the libudev-zero project as described in the WSL README)

Whoops, I missed that you've already done this. Great!

Shall I email it to you so you can upload it as an artifact? or just open a MR for adding it to the project?

Just open a PR. I don't want to clobber the build pipeline for usbipd-win. So eventually I want these built as a separate project, which exposes this as its artifact. And then consume the artifact from this project. But for now we'll just commit the binary.

@EmbeddedAndroid
Copy link
Contributor Author

I've built a statically linked distro-independent (using the libudev-zero project as described in the WSL README)

Whoops, I missed that you've already done this. Great!

Shall I email it to you so you can upload it as an artifact? or just open a MR for adding it to the project?

Just open a PR. I don't want to clobber the build pipeline for usbipd-win. So eventually I want these built as a separate project, which exposes this as its artifact. And then consume the artifact from this project. But for now we'll just commit the binary.

Got it, will do. We are going to do some end to end testing today and if everything looks good I will send the PR.

Once you open the project up, I'm happy to send a PR to enable cross compilation or I can offer a native ARM64 github runner. Whatever your preference is, I'm ok with.

@dorssel
Copy link
Owner

dorssel commented Feb 13, 2025

I'll just make the projects MultiTarget. Cross-compilation of C# is a breeze. NativeAOT for ARM64 should also work, even on x64. Then we can make 2 proper MSIs, one for each target. I guess you are running usbipd with x64 emulation on ARM64 now? That's not optimal for performance, of coarse.

@EmbeddedAndroid
Copy link
Contributor Author

I'll just make the projects MultiTarget. Cross-compilation of C# is a breeze. NativeAOT for ARM64 should also work, even on x64. Then we can make 2 proper MSIs, one for each target. I guess you are running usbipd with x64 emulation on ARM64 now? That's not optimal for performance, of coarse.

Ok sounds good to me. Yes, right now we are running usbipd in x64 emulation on arm64 hosts atm, and it is less than ideal from a performance standpoint.

I'm going to start working on the changes needed to build the arm64 MSI, but I have some questions :)

Do you have instructions for building this project? I checked on the wiki, but didn't find anything.

The reason I ask is that I'm not used to building on Windows but I want to make sure I'm using the right tools. Right now I have:

  • The source checked out via git
  • The code opened in Visual Studio Code
  • I am using the build-install.yml workflow file as a guide.
  • Here are my setup and build steps I'm currently using via the Visual Studio Code terminal
winget install Microsoft.VisualStudio.2022.BuildTools --force --override "--wait --passive --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows11SDK.22000"
winget install Microsoft.DotNet.SDK.9
dotnet tool restore
dotnet restore
dotnet restore Installer
dotnet build --configuration Release
dotnet publish --configuration Release --no-build Usbipd
dotnet publish --configuration Release --no-build Usbipd.PowerShell
dotnet build --configuration Release --no-restore Installer

This can produce the x64 installer msi, but I don't see a way to generate new target configurations (i.e. arm64) without manually editing the .csproj files directly.

Does this seem like the right environment? Or another path you would recommend?

@EmbeddedAndroid
Copy link
Contributor Author

We have confirmation from the team with the drivers merged in #1132 and the usbip client I compiled that we are able to enumerate USB devices on the WSL side.

@dorssel
Copy link
Owner

dorssel commented Feb 13, 2025

We have confirmation from the team with the drivers merged in #1132 and the usbip client I compiled that we are able to enumerate USB devices on the WSL side.

w00t w00t!

I'm well on the way making the usbipd ARM64. If you can commit the usbip client ... expect a dedicated ARM64 installer soon.

@EmbeddedAndroid
Copy link
Contributor Author

We have confirmation from the team with the drivers merged in #1132 and the usbip client I compiled that we are able to enumerate USB devices on the WSL side.

w00t w00t!

I'm well on the way making the usbipd ARM64. If you can commit the usbip client ... expect a dedicated ARM64 installer soon.

Quick one on the usbip client. How do you want to handle the two binaries?

My idea was to create architecture specific directories for each usbip binary. Then I guess the installer would decide which to deploy? Otherwise, I could do some bash hackery to check the system architecture at runtime, and call the right binary.

Let me know what approach you'd like to take and I'll submit the PR.

@dorssel
Copy link
Owner

dorssel commented Feb 13, 2025

My idea was to create architecture specific directories for each usbip binary. Then I guess the installer would decide which to deploy? Otherwise, I could do some bash hackery to check the system architecture at runtime, and call the right binary.

Let me know what approach you'd like to take and I'll submit the PR.

Yep, same trick as before. Move the current binary into a subdirect x64 here https://github.com/dorssel/usbipd-win/tree/master/Usbipd/WSL. And then add the ARM one.

This time I'll let the publishing fix it, like here: https://github.com/dorssel/usbipd-win/blob/master/Usbipd/Usbipd.csproj#L45-L49

WiX won't even know about it...

@dorssel
Copy link
Owner

dorssel commented Feb 14, 2025

Done, see #1136

@EmbeddedAndroid
Copy link
Contributor Author

EmbeddedAndroid commented Feb 15, 2025

@AndreasKunar you'll need to disable signing by running the command below in admin mode, and reboot before running the installer (until we fix that issue)

bcdedit.exe /set testsigning on

@dorssel
Copy link
Owner

dorssel commented Feb 17, 2025

@dorssel re: usbip - if you want help setting up this a proper project to produce the builds for x64/arm64 let me know, happy to help out.

Already have a private repo that does this for x64. Will publish soon. Don't know if it can be used to cross-compile for ARM64 (public Linux GitHub bots are native x64). But the build steps will be the same, so it can easily be repeated on an ARM64 Linux distro, just not automated.

Still WIP (not the right pin on the WSL version), no README, etc.) But here is the project https://github.com/dorssel/usbipd-win-wsl/

Artifacts (again: not the right version yet) example: https://github.com/dorssel/usbipd-win-wsl/actions/runs/13358929116

Bonus: no "diff" anymore, just the right build options. See the build action.

@dorssel
Copy link
Owner

dorssel commented Feb 17, 2025

@dorssel re: usbip - if you want help setting up this a proper project to produce the builds for x64/arm64 let me know, happy to help out.

Already have a private repo that does this for x64. Will publish soon. Don't know if it can be used to cross-compile for ARM64 (public Linux GitHub bots are native x64). But the build steps will be the same, so it can easily be repeated on an ARM64 Linux distro, just not automated.

Still WIP (not the right pin on the WSL version), no README, etc.) But here is the project https://github.com/dorssel/usbipd-win-wsl/

Artifacts (again: not the right version yet) example: https://github.com/dorssel/usbipd-win-wsl/actions/runs/13358929116

Bonus: no "diff" anymore, just the right build options. See the build action.

@EmbeddedAndroid
All done. See https://github.com/dorssel/usbipd-win/tree/master/Usbipd/WSL

@EmbeddedAndroid
Copy link
Contributor Author

@dorssel re: usbip - if you want help setting up this a proper project to produce the builds for x64/arm64 let me know, happy to help out.

Already have a private repo that does this for x64. Will publish soon. Don't know if it can be used to cross-compile for ARM64 (public Linux GitHub bots are native x64). But the build steps will be the same, so it can easily be repeated on an ARM64 Linux distro, just not automated.

Still WIP (not the right pin on the WSL version), no README, etc.) But here is the project https://github.com/dorssel/usbipd-win-wsl/
Artifacts (again: not the right version yet) example: https://github.com/dorssel/usbipd-win-wsl/actions/runs/13358929116
Bonus: no "diff" anymore, just the right build options. See the build action.

@EmbeddedAndroid All done. See https://github.com/dorssel/usbipd-win/tree/master/Usbipd/WSL

Perfect, looks great to me. Thanks!

@EmbeddedAndroid
Copy link
Contributor Author

Quick update on the driver signing.

We have signed drivers internally. I've built the installer with those drivers internally for us to perform some validation on.

A discussion ongoing about who the right entity should be to do the signing for the drivers released in this project. Once that concludes, we will get them added here asap. Sorry for the delay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants