milador / RaspberryPi-Joystick

A virtual HID USB joystick created using Raspberry Pi
MIT License
119 stars 29 forks source link

Fix kernel build instructions #15

Closed gdsports closed 1 year ago

gdsports commented 3 years ago

The whole repo must be cloned. Using "--depth=1" does not work.

I helped someone setup a Pi to do kernel builds and found my instructions do not work. :(

milador commented 3 years ago

Worked for me on pi4. I didn't use checkout however.

gdsports commented 3 years ago

As I recall, the build worked for Pi4 but the file does not work. I had to checkout the older source code to make sure the Pi4 version of usb_f_hid.ko works. But perhaps there is a difference between building on Pi versus Ubuntu. I was cross compiling on Ubuntu but my friend wants to build on Pi. I will verify the drivers work when done. I should switch to a USB 3.0 SSD or hard drive. SD card is too slow. I can eliminate the checkout if it is not really needed.

milador commented 3 years ago

I can also repeat compiling again. The only change I made was changing kernel/drivers/usb/gadget/function to drivers/usb/gadget/function and it worked on Pi4. Raspberry Pi Desktop could be another option as dual boot on PC for compiling it faster. I might try that.

milador commented 3 years ago

Here's what I did and works well:

sudo git clone --depth=1 --branch rpi-5.10.y https://github.com/raspberrypi/linux
cd linux

made changes to f_hid.c and then:

DEST=${HOME}/RaspberryPi-Joystick/XACGamepad/Drivers
TAIL=drivers/usb/gadget/function
NUMCPU=4

and the rest is the same.

KERNEL=kernel
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig
make -j ${NUMCPU} ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs
DESTDIR="${DEST}/5.10.11+/${TAIL}"
...