This post was finally edited by mookeyj79 at 2023-4-12 06:12
Select the following menu options:- Full OS Image for flashing
- Orangepizero2 (or whatever board you are using)
- Current Mainline
- *User’s choice* (I only tested the Debian release, but I can’t imagine why the other wouldn’t work)
- *User’s choice* (I chose the Sever variant)
- *User’s choice* (I went with Standard, your mileage may vary)
Now grab some coffee because the script is going to download some required packages needed to setup the development environment. It will take a minute. If you get a popup for AptCatcherNG, just say yes.
After the setup is done, we need to modify the device’s .DTS file to set the USB-C port to OTG mode. Open a new terminal and type the following: - $ sudo nano kernel/orange-pi-5.13-sunxi64/arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts
Copy code** Note this file is specific the OPZ2 board! If you are compiling a for a different Orange Pi, you will need to find the .DTS file associated with your board. Use the chart on https://github.com/orangepi-xunlong/orangepi-build to help you find the right subfolder and .DTS file in the ‘dts’ folder above.**
Change 'dr_mode = "peripheral"' to 'dr_mode = "otg"'
Back in the setup script, set the following options:
*** Please take note of the ‘*’ or ‘M’ before the option. Change by selecting “Select”. Go back to the previous menu by selecting “Exit” ***
- Device Drivers
- USB support
- <M>Inventra Highspeed Dual Role Controller
- MUSB Mode Selection
- (X)Dual Role mode
- Disable DMA (always use PIO)
- USB Physical Layer drivers
- <M>NOP USB Transceiver Driver
- <M>USB Gadget Suppor
- [*] RNDIS
- USB Gadget precomposed configurations
- <M> Mass Storage Gadget
Copy code
Once done, select 'Save', 'OK', then 'Exit'.
Make any other tweaks you would like to make at this point, then select 'Exit' until out of the menu system. Don’t forget to save your changes before exiting!
Grab some more coffee and wait for the kernel to be built, configured, and updated. This part took over an hour for me.
Finally once that is done, you will have an image file located in 'orangepi-build/output/images/<buildversion>'. Use your favorite image burner, or the built in Disk Image Writer in Ubuntu to write it to a SD card.
There! We have an Orange Pi image with a customized kernel!
For the rest of the steps, I would follow this guide starting at step 7, modifying the steps as necessary:
I found a combination of the two worked best for creating the block device.
One final important note: Enabling the official Debian sources for apt and doing a dist-upgrade overwrites this kernel, losing the 'g_mass_storage' capability. I mean, yeah, duh, of course it does, but someone …. I …. had to learn this the hard way.
Sources:
|