FBCP移植
** 如果使用FBCP移植,则不能运行2inch屏幕的示例程序,SPI会被占用!**
对于Bullseye系统的配置方法
下载运行驱动
打开树莓派终端,执行:
sudo apt-get install unzip -y
sudo apt-get install cmake -y
sudo wget https://www.waveshare.net/w/upload/6/6b/OLED_LCD_HAT_A.zip
sudo unzip ./OLED_LCD_HAT_A.zip
sudo cp OLED_LCD_HAT_A.dtbo /boot/overlays/
sudo wget https://www.waveshare.net/w/upload/6/66/Rpi-fbcp.zip
sudo unzip ./Rpi-fbcp.zip
cd rpi-fbcp/
sudo mkdir build
cd build
sudo cmake ..
sudo make -j8
sudo install fbcp /usr/local/bin/fbcp
sudo ./fbcp
编辑config.txt文件
sudo nano /boot/config.txt
屏蔽下图对应的语句
在config.txt最后加入以下代码
dtparam=spi=on
dtoverlay=OLED_LCD_HAT_A
hdmi_force_hotplug=1
max_usb_current=1
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
hdmi_cvt 640 480 60 6 0 0 0
hdmi_drive=2
display_rotate=0
设置开机自启动
sudo cp ~/rpi-fbcp/build/fbcp /usr/local/bin/fbcp
sudo nano /etc/rc.local
在 exit 0 前面添加 fbcp&。注意一定要添加"&" 后台运行,否则可能会出现系统不能启动的情况。
随后需要进行重启
sudo reboot
重启后即可正常显示
对于Bookworm系统的配置方法
必须是基于bookworm-lite版本操作,64位 lite、32位 lite
下载必要的软件
-
更新系统
sudo apt update && sudo apt upgrade && sudo apt full-upgrade -y -
安装xorg服务
sudo apt-get install --no-install-recommends xserver-xorg -ysudo apt-get install --no-install-recommends xinit -y -
安装桌面管理器
sudo apt install lightdm -y -
安装树莓派官方GUI
sudo apt install raspberrypi-ui-mods -y -
安装浏览器(可选)
sudo apt install chromium-browser -y
下载运行驱动
打开树莓派终端,执行:
sudo apt-get install unzip -y
sudo apt-get install cmake -y
sudo wget https://www.waveshare.net/w/upload/6/6b/OLED_LCD_HAT_A.zip
sudo unzip ./OLED_LCD_HAT_A.zip
sudo cp OLED_LCD_HAT_A.dtbo /boot/overlays/
sudo wget https://www.waveshare.net/w/upload/6/66/Rpi-fbcp.zip
sudo unzip ./Rpi-fbcp.zip
cd rpi-fbcp/
sudo rm -rf build
sudo mkdir build
cd build
sudo cmake ..
sudo make
sudo install fbcp /usr/local/bin/fbcp
编辑config.txt文件
sudo nano /boot/firmware/config.txt
屏蔽下图对应的语句
在config.txt最后加入以下代码
dtparam=spi=on
dtoverlay=OLED_LCD_HAT_A:rotate=90
hdmi_force_hotplug=1
max_usb_current=1
hdmi_group=2
hdmi_mode=87
hdmi_cvt 640 480 60 6 0 0 0
hdmi_drive=2
display_rotate=0
设置自启动startx与fbcp
-
打开.bash_profile文件,如果没有.bash_profile文件则自己创建一个
sudo nano ~/.bash_profile
把以下代码加到.bash_profile文件最下面
if [ "$(cat /proc/device-tree/model | cut -d ' ' -f 3)" = "5" ]; then
# rpi 5B configuration
export FRAMEBUFFER=/dev/fb1
startx 2> /tmp/xorg_errors
else
# Non-pi5 configuration
export FRAMEBUFFER=/dev/fb0
fbcp &
startx 2> /tmp/xorg_errors
fi
-
打开99-fbturbo.~文件,若已经存在此文件需要确认fb为fb0
sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.~
把以下代码加到99-fbturbo.~文件里面
Section "Device"
Identifier "Allwinner A10/A13 FBDEV"
Driver "fbturbo"
Option "fbdev" "/dev/fb0"
Option "SwapbuffersWait" "true"
EndSection
设置CLI自动登录
sudo raspi-config nonint do_boot_behaviour B2
sudo raspi-config nonint do_wayland W1
sudo reboot
重启后主屏幕即可正常显示。
Note1:确保树莓派的用户名为pi否则无法正常自动登录
Note2:设置上述所有配置后,系统每次重启期间都会变久一点,SSH也需要等待一会儿才能进入;