#### Kernel UPDATE for SH1106 OLED display # references: # https://wiki.zerophone.org/index.php/Framebuffer_driver_for_SH1106 # https://github.com/notro/fbtft/wiki/Development # https://www.reddit.com/r/raspberry_pi/comments/4cnc12/sending_console_to_spi_displays/ ## NOTE Kernel versions are different for Stretch - note changes below # Needed for make menuconfig sudo apt-get update sudo apt-get dist-upgrade sudo apt-get -y install libncurses5-dev # this should already be done with norns install i think sudo apt-get install git bc raspberrypi-kernel-headers git clone --depth=1 https://github.com/raspberrypi/linux cd ~/linux # Driver file appears to already be there - but the set_gamma looks like it needs to be patched sed 's/u32 \*curves/unsigned long *curves/' drivers/staging/fbtft/fb_sh1106.c ## Preparing the kernel module compilation # check with linux kernel you have with (adjust version# path below if needed) uname -r cp /usr/src/linux-headers-4.14.34-v7+/Module.symvers . cp /usr/src/linux-headers-4.14.34-v7+/.config . make modules_prepare # this needs to generate some scripts for later make menuconfig Device Drivers ---> Staging Drivers ---> Support for small TFT LCD display modules ---> SH1106 driver # Save, Exit and then make prepare make -C ~/linux SUBDIRS=drivers/staging/fbtft modules ## move the drivers sudo cp -v ~/linux/drivers/staging/fbtft/*.ko /lib/modules/$(uname -r)/kernel/drivers/staging/fbtft/ sudo depmod -a # change the gpios below to what you have wired for your display sudo modprobe fbtft_device custom name=fb_sh1106 debug=1 speed=2000000 gpios=reset:25,dc:24 # check dmesg dmesg # test with (will show login prompt) con2fbmap 1 1 #Modprobe example commands: #sudo modprobe fbtft_device name=adafruit13m debug=1 speed=2000000 gpios=reset:25,dc:23 #sudo modprobe fbtft_device custom name=fb_sh1106 gpios=reset:5,dc:6 speed=32000000 sudo modprobe fbtft_device custom name=fb_sh1106 debug=1 speed=2000000 gpios=reset:25,dc:24 sudo modprobe fbtft_device name=adafruit22 debug=1 speed=2000000 gpios=reset:25,dc:24 # get this command to load at startup sudo nano /etc/rc.local #Add the modprobe command here # By default this script does nothing. sudo modprobe fbtft_device custom name=fb_sh1106 debug=1 speed=2000000 gpios=reset:25,dc:24 # EDIT NORNS SOURCE FOR SCREEN # edit norns/matron/src/hardware/screen.c sudo nano ~/norns/matron/src/hardware/screen.c # change line 138: # surfacefb = cairo_linuxfb_surface_create("/dev/fb0"); # to # surfacefb = cairo_linuxfb_surface_create("/dev/fb1"); # save # and then rebuild norns ./waf configure ./waf