{"id":15003572,"url":"https://github.com/torahappy/rpizero-linux-build","last_synced_at":"2025-10-30T11:30:30.184Z","repository":{"id":239883966,"uuid":"800884765","full_name":"aidatorajiro/rpizero-linux-build","owner":"aidatorajiro","description":"This is a script to build a custom raspberry pi kernel, including a kernel patch to fix dwc2 wakeup issue.","archived":false,"fork":false,"pushed_at":"2024-12-30T06:10:38.000Z","size":108,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-02T08:03:03.331Z","etag":null,"topics":["dwc2","hid","linux-kernel","raspberry-pi"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aidatorajiro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-15T07:24:29.000Z","updated_at":"2024-12-30T06:10:42.000Z","dependencies_parsed_at":"2024-10-12T07:41:21.131Z","dependency_job_id":"b21cc8cc-a2af-4145-979d-49602edb92ca","html_url":"https://github.com/aidatorajiro/rpizero-linux-build","commit_stats":null,"previous_names":["aidatorajiro/rpizero-linux-build"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidatorajiro%2Frpizero-linux-build","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidatorajiro%2Frpizero-linux-build/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidatorajiro%2Frpizero-linux-build/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidatorajiro%2Frpizero-linux-build/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aidatorajiro","download_url":"https://codeload.github.com/aidatorajiro/rpizero-linux-build/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238955744,"owners_count":19558453,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dwc2","hid","linux-kernel","raspberry-pi"],"created_at":"2024-09-24T18:59:02.604Z","updated_at":"2025-10-30T11:30:30.178Z","avatar_url":"https://github.com/aidatorajiro.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Raspberry pi zero kernel build tool \u0026 other scripts\n\nThis 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.\n\nA note for Pi5: in order for usb gadgets to work, it may be required to use Thunderbolt 4 or USB 4 cable specifically. You may also have to supply an additional 5V3A power supply through the GPIO pins after you connect a Thunderbolt or USB4 cable to your PC. Alternatively, you can also try using a USB 3.0 A-to-C cable and connect to the USB-A port on your PC, or if your PC doesn't have USB-A ports, combine a USB A-to-C cable and a A-to-C adapter.\n\nAlso, the directory `raspi_scripts` contains utilities to setup HID keyboard, RNDIS or ECM. Using a python library by @Danny-Dasilva (\u003chttps://github.com/Danny-Dasilva/Py_Keyboard\u003e)\n\nPatch reference: \u003chttps://github.com/pikvm/packages/blob/master/packages/linux-rpi-pikvm/1003-remote-wakeup.patch\u003e \u003chttps://github.com/raspberrypi/linux/issues/3977\u003e \u003chttp://www.dt8.jp/cgi-bin/adiary/adiary.cgi/0583\u003e\n\n1. Move to the project directory.\n1. (if you are using selinux, run this script to allow write access from docker) `sudo sh selinux.sh`\n1. `ln -s build.config.32_2709.sh build.config.sh` (change `build.config.32_2709.sh` according to the CPU and architecture. See \u003chttps://www.raspberrypi.com/documentation/computers/linux_kernel.html#cross-compiled-build-configuration\u003e for instructions.)\n1. `sh download.sh`\n1. `sh docker.sh`\n1. (inside docker) `cd /rpizero-linux-build`\n1. (inside docker) `sh clean.sh`\n1. (inside docker) `sh build.sh`\n1. (inside docker) `exit`\n1. Create a file named `names.sh` and set the contents as follows.\n   ```\n   MYHOSTNAME=\u003chostname of rpi zero including .local, or the ip address of it\u003e\n   MYUSERNAME=\u003cusername of rpi zero\u003e\n   MY_KERNEL_SUFFIX=wakeup\n   MY_KERNEL_NAME=kernel-$MY_KERNEL_SUFFIX\n   ```\n1. `sh pack.sh`\n1. `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`.\n1. ssh into the rpizero and edit `/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.\n   ```\n   [all]\n   dtoverlay=dwc2\n   kernel=kernel-wakeup.img\n   ```\n1. ssh into the rpizero and reboot\n\n## scripts and configs for rpi zero\n\n- `raspi_scripts/`: scripts to be run inside raspberry pi\n   - `etc/rc.local`: rc file to enable HID mouse and keyboard on startup\n   - `home/someusername`: scripts to control USB device\n      - `keyboard2.py`: control HID keyboard via command line  \n         Example1 : `p CONTROL ALT DEL`  \n         Example2 : `p ALT F4`  \n         Example3 : `p DOWN_ARROW`  \n         Example4 : `w sometext12345`\n   - `root/`: scripts to enable HID/Ether feature on startup\n      - `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 \u003chttps://www.catalog.update.microsoft.com/Search.aspx?q=USB%20RNDIS%20Gadget\u003e, and download the driver file named \"Acer Incorporated. - Other hardware - USB Ethernet/RNDIS Gadget\". On linux, it works without any configration.\n      - `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.\n      - `hid-double.sh`: enable both HID keyboard and Mouse.\n      - `hid.sh`: enable only HID keyboard.\n      - `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.\n\n- `host_scripts/`: scripts to be run from the remote computer that will control raspberry pi\n  - `qt.py`: Use PyQt5 to synchronize keyboard input and mouse movement  \n    USAGE: Alt+G to toggle mouse grabbing. After switching mouse grabbing on, just type text or moving mouse. Note that on MacOS, CTRL is interpreted as COMMAND/WINDOWS key, and COMMAND/WINDOWS is interpreted as CTRL key. The window is transparent, so you can use this application as a overlay, working together with remote desktop app such as RustDesk.\n  - `mouse.py`: Use Xlib to synchronize mouse movement\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftorahappy%2Frpizero-linux-build","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftorahappy%2Frpizero-linux-build","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftorahappy%2Frpizero-linux-build/lists"}