/Legendary-OrangePi-i96

Image containing fixes for the Orange Pi i96 from the community for USB, WiFi, spidev, and others as well as a OS version upgrade all the way to Debian Bullseye

Primary LanguageCMIT LicenseMIT

Legendary-OrangePi-i96

An image for the Orange Pi i96 made from fixes around the internet as well as a set of build system modifications (to the official OrangePi_Build tool) to be able to build it yourself if desired. Debian Bullseye (11) is available.

You do not have to build this yourself. Images are available here in the releases section.

My blog post that birthed this image is located here on jamesachambers.com.

Fixes

  1. Adds fixed version of WiringPi tool as well as an altenative tool "opio" and fixes GPIO pin assignments
  2. Adds spidev interface to access SPI over the GPIO pins
  3. Adds OPi.GPIO library (able to drive SPI devices such as the Waveshare e-ink display)
  4. Adds ntp to assist with fixing time on first startup -- use "sudo ntpd -gq" to force a time sync once you've set your correct timezone (sudo dpkg-reconfigure tzdata)
  5. Adds ability to use the i96 as a HID device (mouse/keyboard emulation)
  6. Add CAN module support (MCP251x tested so far)
  7. Fixed SD card port to support "High Speed" timing mode (can be seen with sudo cat /sys/kernel/debug/mmc0/ios)
  8. Fixed TRIM support (sudo fstrim -av)
  9. Fixed notorious WiFi issues caused by missing crda package and no regulatory domain set (see first startup instructions to set REGDOMAIN)
  10. Fixed Bluetooth and set it up to work at startup using bluetooth patchram utility
  11. Fixed wireless and bluetooth MAC addresses changing each startup
  12. Fixed USB port to allow "High Speed" USB devices instead of locking them to "Full Speed"
  13. Fixed buggy UART not resetting properly which often breaks copying/pasting through a serial terminal
  14. Fixed sound issues that would prevent rebooting the system successfully after first startup
  15. Fixed GPIO permissions errors on startup
  16. Fixed low entropy (random number) issues by installing haveged service
  17. Fixed orangepi user missing group membership for audio, bluetooth, netdev, gpio

First Startup Instructions

Set correct timezone:
sudo dpkg-reconfigure tzdata
Sync time:
sudo ntpd -gq
Set correct locale:
sudo apt install locales -y && sudo dpkg-reconfigure locales
Set wireless regulatory country:
sudo nano /etc/default/crda
Add your two letter country code (mine is US) to the end of the bottom line (after the equals sign) that says REGDOMAIN=
Press Ctrl+X then Y to save the file.

Build Instructions

You should first clone the OrangePi_Build repository:
git clone https://github.com/orangepi-xunlong/OrangePi_Build.git --depth=1
cd OrangePi_Build
./Build_OrangePi.sh

Choose the "Orange Pi i96" option which will create the "OrangePiRDA" folder.

The files in this repository are meant to replace the stock OrangePiRDA ones that are generated (specifically in the scripts folder). You simply copy them over the top of your generated folder like this:
cd ..
git clone https://github.com/TheRemote/Legendary-OrangePi-i96.git
cp -R Legendary-OrangePi-i96/OrangePiRDA/* OrangePiRDA/
You may now build the image the same way I did!
Ubuntu is not building correctly yet.

Version History

  1. September 28th 2022 - V1.29 - Adjust lower bound of txpower curve to improve WiFi stability -- you can increase WiFi debugging verbosity with echo 4 > /sys/kernel/debug/rdawfmac/mmc*/dbglevel. You can use 5 for the highest level of verbosity to help debug the driver (still lots of problems to find / solve and this will help see what the driver is doing)
  2. September 27th 2022 - V1.28 - Restore some WiFi regulatory settings such as country code '99' which has a special meaning in the cfg80211 driver
  3. September 27th 2022 - V1.27 - Fixed WiFi txpower driver settings (can be set between 10-20dBm with iwconfig wlan0 txpower 20 or iw dev wlan0 set txpower fixed 2000)
  4. September 27th 2022 - V1.26 - Add CAN module support for MCP251x (thanks MZA, OrangePi-I96-Work), add can-utils package
  5. September 26th 2022 - V1.25 - Removed deprecated default ssh options, more WiFi driver cleanup
  6. September 25th 2022 - V1.24 - Disable some WiFi crda / regulatory overrides hardcoded in drivers (there is now some regulatory activity in dmesg!). There's more work to do on it but it's definitely better than it was
  7. September 25th 2022 - V1.23 - Fixed many dmesg errors related to WiFi, rda-mmc, and others
  8. September 25th 2022 - V1.22 - Ported wireless fixes to source instead of binary driver, more distributions.sh organization into functions, add packages wireless-tools/lshw/haveged/libnl-3-dev/libnl-genl-3-dev, use rootfs caching more efficiently for rebuilding
  9. September 24th 2022 - V1.21 - Fixed "unrecognized mount option 'hidepid=invisible' or missing value" error
  10. September 24th 2022 - V1.20 - Fixed SD card driver to correctly support high-speed mode, fixed TRIM support, decreased boot time by about 10 seconds by reducing rda-backlight timeout, cleaned up distributions.sh into organized functions
  11. September 23rd 2022 - V1.19 - Add OPi.GPIO library (supports devices such as the Waveshare e-paper display (thanks Michael, OPi.GPIO fork), add orangepi user to gpio group, general cleanup/removal of script portions related to other platforms than RDA
  12. September 22nd 2022 - V1.18 - Enable CONFIG_SND_USB to allow for USB soundcard use
  13. September 20th 2022 - V1.17 - Add further spidev fixes (thanks MZA, OrangePi-I96-Work)
  14. September 19th 2022 - V1.16 - Add cpufrequtils package (thanks Marco, PR #5)
  15. September 18th 2022 - V1.15 - Fix Bluetooth to have fixed MAC address stored in /data/misc/bluetooth (thanks Marco, PR #4)
  16. September 16th 2022 - V1.14 - Add bluez-tools package
  17. September 16th 2022 - V1.13 - Add Bluetooth patchram to enable bluetooth (thanks Marco, Bluetooth patchram fix)
  18. September 14th 2022 - V1.12 - Add fixed WiringPi library (thanks MZA, WiringPi Fork)
  19. September 10th 2022 - V1.11 - Fix USB gadget conflict (thanks SteveGotthardt, PR #2)
  20. September 10th 2022 - V1.10 - Adds USB serial connection. Set ACL to remove warnings from log files (thanks SteveGotthardt, PR #2)
  21. September 4th 2022 - V1.9 - Adds ability to use the i96 as a HID device (thanks jakeau, PR #1)
  22. September 3rd 2022 - V1.8 - Add crda package and instructions to configure regulatory domain (REGDOMAIN)
  23. September 2nd 2022 - V1.7 - Enable systemd-resolved service to help with DNS over WiFi, remove crashing hostapd service, fix e2scrub_all service, add orangepi user to audio, bluetooth, netdev
  24. September 2nd 2022 - V1.6 - Fix spidev
  25. September 1st 2022 - V1.5 - Adds spidev interface to access SPI over the GPIO pins
  26. August 31th 2022 - V1.4 - remove applying default locale due to breaking serial console on some systems (see first startup instructions to apply your correct locale instead of me applying mine which was causing problems), fix startup permissions errors related to GPIO
  27. August 30th 2022 - V1.3 - Add patb's gpio_fixup.sh script to fix GPIO pins on startup / gpio tool replacement / wireless LAN MAC address fix
  28. August 26th 2022 - V1.2 - Added ntp package to help with time issues (use "sudo ntpd -gq" on first startup), fixed locales issue
  29. August 24th 2022 - V1.1 - Added sound fix and UART fix from official OrangePi repository pull requests
  30. August 23rd 2022 - V1.0 - Initial Release

Credits

The drama surrounding this board is ridiculous. Is it a great board? Not really. It also costs like $7 on Amazon. Is it a good board for $7? Yes it is, especially in 2022 when Pis are routinely over $100.

This board honestly isn't more broken than any other boards were at release. It just never got support and it was almost right from the start. It never received support from Armbian and Orange Pi has never supported it either (I mean most of the fixes in this were submitted to their official repository years ago with no response). There are much more popular and widely used boards with much more serious hardware defects that are supported by both Armbian and Orange Pi (as they're well aware).

It's hard to say why everyone's jimmies were so rustled but from what I can tell it's mostly groupthink and political nonsense that has nothing to do with how defective the board actually is. There were only 2 Pull Requests to even integrate from Orange Pi's repository as well as the USB issue. Those are pretty much the only known issues with the board other than the flaky WiFI. That is honestly a better track record than definitely most of Orange Pi's other boards and most boards in general. Again, as someone who has been working with SBCs for nearly a decade and still has their Raspberry Pi 1 Model B's to prove it, what are you guys talking about? This board is too toxic to touch with a flaky WiFI and some easily resolved kernel driver issues? What?

The lack of support is real though and has real consequences. What hope is there then? The community basically. This image is just a compilation of fixes from people who dreamed of something better for the board and submitted PRs or fixes around the internet as well as patching Orange Pi's imaging tool to produce images that aren't literally 5 years outdated (although the kernel still is).

Is it enough? You'll have to judge for yourself if it's enough but it is enough to make this a decent headless Bullseye board with one working high speed USB 2.0 port. The original ones really weren't which is why this was born.


Credit to Gabor Hidvegi for the patch itself as I found his patch (which wasn't as effective for the 2G version as he would have liked due to the modem initialization dropping the speed) to be working as-is for the regular i96 without the 2G modem present.
Credit to GMMan for the pull request on the official repository to fix sound playback kernel parameter issues
Credit to GMMan again for the pull request on the official repository to fix UART serial issues fixing copy/pasting
Credit to patb for gpio_fixup.sh / devmem2.py which fixes the GPIO pins and the gpio tool replacement for WiringPi
Credit to MesihK for the gpio files permissions fix
Credit to Yoshie for enough hints to enable the spidev interface
Credit to jakeau for adding the ability to use the i96 as a HID device (PR #1)
Credit to SteveGotthardt for adding the USB serial connection and fixing ACL entries to eliminate warnings (PR #2)
Credit to MZA for fixing the WiringPi library to work with the i96 as well as fixes to the spidev interface
Credit to Marco for fixing the Bluetooth patchram utility to work with the i96 as well as fixing the Bluetooth MAC address (PR #4)
Credit to Michael for adding i96 support to OPi.GPIO library. Also see his Waveshare e-paper display fork for getting a Waveshare e-ink screen working with the i96