litex-hub / linux-on-litex-vexriscv

Linux on LiteX-VexRiscv
BSD 2-Clause "Simplified" License
552 stars 174 forks source link

add schoko support and usb host configs resolves #288 #293

Closed machdyne closed 1 year ago

machdyne commented 1 year ago

I've added support for the Schoko computer (a litex-boards PR is also pending) and config files for USB host support.

This can be built with:

$ make BR2_EXTERNAL=../linux-on-litex-vexriscv/buildroot/ litex_vexriscv_usbhost_defconfig
Dolu1990 commented 1 year ago

Hi ^^ Thanks :D

How big the cpio and linux Image are with those feature additions ?

machdyne commented 1 year ago

8.1M Image 3.5M rootfs.cpio

I have the WLAN options enabled but I haven't been able to get USB wifi working yet.

BTW something that might be useful to add is this line to the default /etc/inittab: ::respawn:/sbin/getty -L 115200 tty0

This brings up a login prompt under the penguin and lets you login with a USB keyboard.

Dolu1990 commented 1 year ago

8.1M Image

It may already overflow the default ramfs size ^^ (8.0MiB)

What's about instead of extending the current default buildconfig, we add one with your config ? ex : linux-on-litex-vexriscv/buildroot_usb_host ?

I have the WLAN options enabled but I haven't been able to get USB wifi working yet.

Ahhh WLAN is realy a paine in the ass to enable all the proper configs, i had it once working via a SPI dongle, but not easy. never tried with USB

BTW something that might be useful to add is this line to the default /etc/inittab: ::respawn:/sbin/getty -L 115200 tty0 This brings up a login prompt under the penguin and lets you login with a USB keyboard.

Nice to know :D Sure

Thanks :)

machdyne commented 1 year ago

I made those changes, please let me know if I need to do anything differently.

I removed the WLAN options but the Image size is now ~8.5M ... it still boots and seems to work fine, but I do see this:

[   22.830562] Initramfs unpacking failed: invalid magic at start of compressed archive
[   24.153895] Freeing initrd memory: 8192K

I have also tested USB ethernet and it works great.

Dolu1990 commented 1 year ago

It may already overflow the default ramfs size ^^ (8.0MiB)

Hooo my bad, you are all good, i mixed cpio and kernel size

Also, stupid me, instead of having a separated buildroot_usb_host folder, the best would be to add a defconfig in : https://github.com/litex-hub/linux-on-litex-vexriscv/tree/master/buildroot/configs

and adding an alternative linux.config in https://github.com/litex-hub/linux-on-litex-vexriscv/blob/master/buildroot/board/litex_vexriscv/linux.config

That way, we will avoid duplicating the whole thing :)

Sorry, i didn't tinked about it

I have also tested USB ethernet and it works great.

Nice :D

Which usb dongle did you used ? there is quite a few which would not work (require USB high speed)

Initramfs unpacking failed: invalid magic at start of compressed archive

no worries about it, i always had it

Dolu1990 commented 1 year ago

Look good to me, Thanks :D

machdyne commented 1 year ago

I removed the last commit and there is now:

buildroot/configs/litex_vexriscv_usbhost_defconfig and buildroot/board/litex_vexriscv/linux_usbhost.config

It might also make sense to create a separate board directory (litex_vexriscv_usbhost?) in order to add the inittab entry to a separate rootfs_overlay so the login prompt shows up when using the USB host configs?

The ethernet dongle I used was a "Giochem" USB 2.0 10/100Mbps RTL8152 USB ethernet adapter with the option:

CONFIG_USB_RTL8152=y
Dolu1990 commented 1 year ago

It might also make sense to create a separate board directory (litex_vexriscv_usbhost?) in order to add the inittab entry to a separate rootfs_overlay so the login prompt shows up when using the USB host configs?

Yes, i think that's a good idea.

machdyne commented 1 year ago

I've added the litex_vexriscv_usbhost board directory. There is a pending PR to add Schoko in litex-boards, it looks like the tests will fail in the meantime.

machdyne commented 1 year ago

The tests should now pass as the litex-boards PR for Schoko has been merged.

machdyne commented 1 year ago

I was doing --with-coherent-dma on the command line, I've now enabled it in make.py when usb_host is enabled.

Dolu1990 commented 1 year ago

Hoo nice catch :) Running regressions

enjoy-digital commented 1 year ago

Thanks @machdyne for the board support and USB-Host integration! This merged.