pyavitz / debian-image-builder

Debian image builder for single board computers
Other
139 stars 33 forks source link

g_ether / otg #95

Closed jayofelony closed 6 months ago

jayofelony commented 6 months ago

Hey there!!

First of, love your work. But how do I enable OTG? When I add g_ether to /etc/modules-load.d/modules.conf and let it boot, it does not show in ifconfig of my host laptop. Any ideas?

I am using the BPi M4 Zero build.

pyavitz commented 6 months ago

Because I'm in the middle of debugging things, I ended up changing the &usbotg node to dr_mode = "host". Try this overlay and see if it works.

wget https://github.com/pyavitz/binary/releases/download/060420/allwinner-usb-otg-mode.dts
add-overlay allwinner-usb-otg-mode.dts

Add it to /boot/extlinux/extlinux.conf: ../user-overlays/allwinner-usb-otg-mode.dtbo

Example:

fdtoverlays ../user-overlays/allwinner-usb-otg-mode.dtbo

Reboot.

jayofelony commented 6 months ago

Okay, if only I had the means to connect a keyboard haha. I guess I will wait for an update on your end. Thanks for the heads up though!

pyavitz commented 6 months ago

Give me a sec and I'll adjust the DTS back and push it.

jayofelony commented 6 months ago

Might I also suggest to use pishrink to shrink the final image. That makes it suitable to flash with RPi imager.

pyavitz commented 6 months ago

Might I also suggest to use pishrink to shrink the final image. That makes it suitable to flash with RPi imager.

I was using a script based on pishrink but its ONLY viable for use with ext4. Which is why I stopped using it. Last I was told, the RPI Imager was working again, after I made changes to the shrink function. Guess not.

Here; partial revert; https://github.com/pyavitz/debian-image-builder/commit/ccd48721b62f49a52719a6437a0de213713e7745 git pull

Hopefully the OTG works now.

Sorry about that.

jayofelony commented 6 months ago

Ok thanks! I will try building a new image immediately. I will keep you posted.

jayofelony commented 6 months ago

Okay, I can confirm it boots by connecting to a hdmi display. I cannot get any further as I do not have a usb-c keyboard. But on my linux host I do not get an otg connection.

image

I added g_ether to /etc/modules-load.d/modules.conf, also added a usb0-cfg to /etc/network/interfaces.d/.

pyavitz commented 6 months ago

Okay, I can confirm it boots by connecting to a hdmi display. I cannot get any further as I do not have a usb-c keyboard. But on my linux host I do not get an otg connection.

I added g_ether to /etc/modules-load.d/modules.conf, also added a usb0-cfg to /etc/network/interfaces.d/.

Does this functionality work on the BPI images?

I've only had the unit for like a week and honestly hadn't tested OTG mode until now. I'll investigate and if you find anything let me know.

EDIT: I do get this;

[1589974.441258] usb 6-2: Product: RNDIS/Ethernet Gadget
[1589974.441262] usb 6-2: Manufacturer: Linux 6.1.31 with musb-hdrc
[1589974.442068] cdc_subset: probe of 6-2:1.0 failed with error -22
[1589974.442843] cdc_ether 6-2:1.0 usb0: register 'cdc_ether' at usb-0000:00:1d.7-2, CDC Ethernet Device, 9a:a5:02:16:98:4d
jayofelony commented 6 months ago

Okay, it seems to be called cdc_ether. i will try that module

Edit:

Also nothing, it does support otg. I know the image supplied by bpi does have otg

pyavitz commented 6 months ago

Okay, it seems to be called cdc_ether. i will try that module

Edit:

Also nothing, it does support otg. I know the image supplied by bpi does have otg

Getting there;

── NETWORK
Hostname:    bananapim4zero
Tether:      usb1 UP 10.55.0.1 
Wireless:    wlan0 UP 10.0.0.XXX

Doesn't seem to broadcast though unless I have a wifi connection going for some reason. Could be my configuration?

jayofelony commented 6 months ago

You probably know more about this than me, I am just an end user.

pyavitz commented 6 months ago

You probably know more about this than me, I am just an end user.

Only time I've ever used OTG was when testing it on Pis. Not honestly all that familiar with the config aspect of it.

EDIT:

Another oddity; if I kill wifi the connection stays available?

── NETWORK
Hostname:    bananapim4zero
Tether:      usb1 UP 10.55.0.1 

Anyway, I made some changes to the defconfig. If you wanna rebuild the kernel and give it a whirl.

jayofelony commented 6 months ago

Ahhh its called usb1, usually it is called usb0. I am building new image and will add 2 network configs, for usb0 and usb1.

pyavitz commented 6 months ago

I don't know. Sometimes it comes up for me and sometimes it doesn't. Could be the PC I'm using... The USB ports on it are kind of iffy.

I'm also using an overlay for it as well and a script I created, but I'm honestly not sure yet if they are required. If you can't get it to come up at all, I'll pass them ur way.

jayofelony commented 6 months ago

My host ubuntu now sees the device connected, I have a internet sharing script. But there is still no route to host.

SSH is enabled by default?

pyavitz commented 6 months ago

My host ubuntu now sees the device connected, I have a internet sharing script. But there is still no route to host.

SSH is enabled by default?

yes

jayofelony commented 6 months ago

It works! It is indeed usb1, not usb0 like most the times

jayofelony commented 6 months ago

image

image

pyavitz commented 6 months ago

It works! It is indeed usb1, not usb0 like most the times

good good

jayofelony commented 6 months ago

/etc/resolv.conf doesnt seem to get auto-populated. I manually added nameserver 8.8.8.8 to make it resolve hostnames

pyavitz commented 6 months ago

/etc/resolv.conf doesnt seem to get auto-populated. I manually added nameserver 8.8.8.8 to make it resolve hostnames

As a work-around try;

sudo mv /etc/resolv.conf /etc/resolv.conf.orig
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf
echo "nameserver 8.8.4.4" | sudo tee -a /etc/resolv.conf

reboot

jayofelony commented 6 months ago

Yeah, I done that