This is a script to build a custom raspberry pi kernel, including a kernel patch to fix dwc2 wakeup issue.
OTHER License
This is a script to build a custom raspberry pi kernel, including a kernel patch to fix dwc2 wakeup issue. I haven't tested, but probably works for Pi4 or Pi5.
Also, the directory raspi_scripts
contains utilities to setup HID keyboard, RNDIS or ECM. Using a python library by @Danny-Dasilva (https://github.com/Danny-Dasilva/Py_Keyboard)
Patch reference: https://github.com/pikvm/packages/blob/master/packages/linux-rpi-pikvm/1003-remote-wakeup.patch https://github.com/raspberrypi/linux/issues/3977 http://www.dt8.jp/cgi-bin/adiary/adiary.cgi/0583
sudo sh selinux.sh
sh download.sh
sh docker.sh
cd /rpizero-linux-build
sh clean.sh
sh build.sh
exit
names.sh
and set the contents as follows.
MYHOSTNAME=<hostname of rpi zero including .local, or the ip address of it>
MYUSERNAME=<username of rpi zero>
MY_KERNEL_SUFFIX=wakeup
MY_KERNEL_NAME=kernel-$MY_KERNEL_SUFFIX
sh pack.sh
sh packsend.sh
make sure you have SSH access to the rpi zero and it is connected to the local network. Alternatively, you can just copy generated files at install/
to the SD card. First, copy boot/firmware
into /
of the EFI partition (usually the first partition). Second, copy lib/modules
into lib/modules
of the root partition (usually the second partition). Beware of file ownership. All files should be owned by root
./boot/firmware/config.txt
. Add following lines to the boot configuration. Alternatively, you can edit the SD. The file is at /config.txt
in the EFI partition. If anything wrong happens (eg. the system doesn't start), please edit SD directly and delete these lines to revert all changes made to the system.
[all]
dtoverlay=dwc2
kernel=kernel-wakeup.img
raspi_scripts/
: scripts to be run inside raspberry pi
etc/rc.local
: rc file to enable HID mouse and keyboard on startuphome/someusername
: scripts to control USB device
keyboard2.py
: control HID keyboard via command linep CONTROL ALT DEL
p ALT F4
p DOWN_ARROW
w sometext12345
root/
: scripts to enable HID/Ether feature on startup
geth.sh
: Enable an old driver for ethernet over USB using RNDIS. On windows, you have to install a special driver to connect to the rpi zero. Go to https://www.catalog.update.microsoft.com/Search.aspx?q=USB%20RNDIS%20Gadget, and download the driver file named "Acer Incorporated. - Other hardware - USB Ethernet/RNDIS Gadget". On linux, it works without any configration.hid-and-eth.sh
: enable both HID and Ethernet-over-USB at the same time using a new driver. Unfortunately, there is no signed Windows driver for it.hid-double.sh
: enable both HID keyboard and Mouse.hid.sh
: enable only HID keyboard.remove.sh
: unloads all drivers so that you can use any of these scripts again. very unstable, so it is better to restart the rpi zero instead.host_scripts/
: scripts to be run from the remote computer that will control raspberry pi
qt.py
: Use PyQt5 to synchronize keyboard input and mouse movementmouse.py
: Use Xlib to synchronize mouse movement