skiffos / SkiffOS

Any Linux distribution, anywhere.
https://skiffos.com
MIT License
700 stars 52 forks source link

Odroid M1: one of the USB3.0 ports not working #218

Closed peterwilli closed 1 year ago

peterwilli commented 2 years ago

When I plug in any device (WiFi adapter, or external HDD) on the USB 2.0 ports it gets recognized but in the 3.0 port nothing happens aside from power being supplied to the device (I can hear the HDD spinning). dmesg leaves no logs before and after plugging something in.

Do I need to enable some kind of configuration to get USB3.0 working? Thanks!

paralin commented 2 years ago

That's odd, I'll try on my M1 here and check.

peterwilli commented 2 years ago

That's odd, I'll try on my M1 here and check.

That's a very fast reply! And super cool there's more M1 users out here. I can give a pre-build image if it helps.

I built it like this:

export SKIFF_CONFIG=odroid/m1,apps/compose
make configure
make br/menuconfig (I selected rtl8188eu and rtl8811cu here, drivers I needed for 2 wifi adapters to test).
make compile
...
Image flashing according to https://github.com/skiffos/SkiffOS/tree/master/configs/odroid/m1

I'm relatively new to SkiffOS, so it could be I didn't do the instructions right. One thing I did notice was that the compilation failed sometimes (a timeout error on a download), simply running it again solved things.

Reason why I didn't go with driver/wl instead of manually selecting the specific Wi-Fi chips I needed was because driver/wl didn't compile at all, and it failed at a Wi-Fi chip that was irrelevant to me (not sure if this all matters, but I thought it's better to give some context).

I'll run a build on a new workspace overnight with just export SKIFF_CONFIG=odroid/m1,skiff/core and no other edits whatsoever to see if that changes anything.

paralin commented 2 years ago

@peterwilli driver/wl just enables broadcom-sta: https://github.com/skiffos/SkiffOS/blob/master/configs/driver/wl/buildroot/wl

What you can do is add a file at overrides/buildroot/wifi

Contents should be (in plaintext):

BR2_PACKAGE_RTL8188EU=y

... I don't see a package for rtl8811cu? Do you need one added to buildroot?

The changes you make in br/menuconfig are temporary - next time Skiff generates the Buildroot config it will be overwritten. That's why you'll want to add it under overrides and possibly to your own custom config package like this: https://github.com/skiffos/skiff-ext-example/blob/master/configs/mycustom/device/buildroot/nm

In the future I'll add something which diffs the changes you made in menuconfig and automatically adds them to overrides/

peterwilli commented 2 years ago

@peterwilli driver/wl just enables broadcom-sta: https://github.com/skiffos/SkiffOS/blob/master/configs/driver/wl/buildroot/wl

What you can do is add a file at overrides/buildroot/wifi

Contents should be (in plaintext):

BR2_PACKAGE_RTL8188EU=y

... I don't see a package for rtl8811cu? Do you need one added to buildroot?

The changes you make in br/menuconfig are temporary - next time Skiff generates the Buildroot config it will be overwritten. That's why you'll want to add it under overrides and possibly to your own custom config package like this: https://github.com/skiffos/skiff-ext-example/blob/master/configs/mycustom/device/buildroot/nm

In the future I'll add something which diffs the changes you made in menuconfig and automatically adds them to overrides/

Hey thanks so much for replying. My new workspace sadly failed building overnight, so I can't test that out (my VM had too little space for 2 workspaces, thought it'd be enough).

... I don't see a package for rtl8811cu? Do you need one added to buildroot?

Well, whatever I did it did run, and Wifi worked. I probably selected this one (I don't remember exactly what I did): image

I did that because https://github.com/norazlybasarian/Comfast-CF-811AC (the USB adapter I have) has both RTL8811CU and RTL8821CU listed in their README.

The changes you make in br/menuconfig are temporary - next time Skiff generates the Buildroot config it will be overwritten.

Yeah I figured, that's why I didn't override config, but I didn't know how else to do it until you mentioned the "overrides/buildroot/wifi" thing, I'll try that after I found a way to get USB 3.0 to work (I don't really use USB 3.0 for speed but having 50% less ports makes it harder to hook up an external drive to it :()

I'll re-try a build of the basic export SKIFF_CONFIG=odroid/m1,skiff/core, no other modifications just to see if USB3.0 works then, but IDK when it's done, even on my AMD Ryzen 9 system it takes quite some time. I guess it's also because I'm in VirtualBox (Vagrant) but I couldn't get compilation to work with anything other than the buildroot box.

paralin commented 2 years ago

@peterwilli I'll check the usb3 on my M1 tomorrow, maybe a kernel update will fix it.

peterwilli commented 2 years ago

@peterwilli I'll check the usb3 on my M1 tomorrow, maybe a kernel update will fix it.

Thanks so much for your fast reply. I'll build the base image anyway, just to see if my modifications did anything, would be nice to know. How long does building take for you by the way?

paralin commented 2 years ago

@peterwilli There's a compiler cache under workspaces/.ccache

First build, maybe 40 mins

Second build, maybe 15 mins, as low as 10 mins even.

Of course, once you build it, you don't have to rebuild the entire thing usually - can just delete workspaces/*/build/linux-custom for example and then make compile to force rebuilding the kernel (as a basic example)

peterwilli commented 2 years ago

I think my build takes 3 hours or so, depending on how much I add. It's probably VirtualBox but running this build natively isn't really gonna happen I think!

paralin commented 2 years ago

@peterwilli Not sure exactly what you mean, but note that SkiffOS & Buildroot are cross-compilers, you can run "make compile" on any architecture build machine and it will cross-compile for the target

peterwilli commented 2 years ago

@peterwilli Not sure exactly what you mean, but note that SkiffOS & Buildroot are cross-compilers, you can run "make compile" on any architecture build machine and it will cross-compile for the target

In Ubuntu in Docker or NixOS (what I run natively) I didn't manage to set the dependencies right to compile. I don't remember what errors I got, but it was quite a hassle. I remember getting a segfault during compilation. The buildroot vagrant box works great so far but it takes time. Anyway, the image is done so I'm going to test it out right now.

peterwilli commented 2 years ago

I tried with a small image with just export SKIFF_CONFIG=odroid/m1,skiff/core, only modification is my SSH key is added by adding my public key to overrides/root_overlay/etc/skiff/authorized_keys. Booted from SD. One USB 3.0 port doesn't give power at all (but does when petitboot is still up) the other does but nothing gets recognized.

I can share the image if you like!

paralin commented 2 years ago

@peterwilli Checking on it today, I will try the USB ports on my M1 and see if I can reproduce.

That's very weird that it doesn't even give power

paralin commented 2 years ago

I was able to reproduce, checking if a kernel update fixes it.

paralin commented 2 years ago

This should now be working as of bd78505b10df76d5507cc84c000912d89c0bbd12

Updated the kernel to 5.18.12 and added a kernel defconfig which enables some options required to make all the hardware work correctly on the M1.

Please rm -rf ./workspaces/default/build/linux-custom and git pull and git submodule update then make configure compile.

You can update the running system with ./scripts/push_image.sh root@192.168.1.5 with your IP address of the M1 followed by reboot on the device.

paralin commented 2 years ago

Well, the top USB3.0 port seems to work, the bottom one not. Not sure why, will check into it more tomorrow. But at least the top USB3.0 port is working with xhci-hcd (USB3.0)

peterwilli commented 2 years ago

Well, the top USB3.0 port seems to work, the bottom one not. Not sure why, will check into it more tomorrow. But at least the top USB3.0 port is working with xhci-hcd (USB3.0)

For me the top worked as well, but it was only supplying power. When I plugged in something, dmesg didn't show anything. Please let me know if you find anything, because if this works, I'm comfortable enough running SkiffOS, the eMMC issue is only a minor inconvenience. It seems like a lovely OS!

paralin commented 2 years ago

@peterwilli the top one definitely works now, I am able to plug in a device & see it in dmesg.

peterwilli commented 2 years ago

@peterwilli the top one definitely works now, I am able to plug in a device & see it in dmesg.

Oh, I guess I'll have to try myself again. Did you do anything special with your build? Anything I can use to replicate your setup.

paralin commented 2 years ago

@peterwilli it worked after updating the kernel and adding more kernel config options: see this comment for how to update; https://github.com/skiffos/SkiffOS/issues/218#issuecomment-1188830518

peterwilli commented 2 years ago

Sorry, I missed those comments. I'll try right away!

peterwilli commented 2 years ago

@peterwilli the top one definitely works now, I am able to plug in a device & see it in dmesg.

@paralin I tried it and the top USB port works and is recognized. Thanks so much for the swift reply and fix from your end! I'll check out your changes because I'm curious what fixed it. I'll try out the eMMC thing too, and see what it does (to be able to at least read the eMMC).

paralin commented 2 years ago

@peterwilli as for why that one port in particular is not working, I bet it's an issue with the device tree (.dts) in the kernel.

Tobetter is currently working on a 5.19.x branch for the M1, I'll raise the issue on his repo if I can't find a fix

paralin commented 1 year ago

@peterwilli By the way - rtl8821cu is enabled on all skiffos configs now on default.

paralin commented 1 year ago

I think this is probably fixed now as of the latest kernel for odroid.