Jump to content

Enabling LCD in u-boot Kernel 4.7.2


Recommended Posts

Posted (edited)

<OT>

First post - so hi everyone and thanks for the great stuff here.

I am new to Armbian, just installed yesterday (replace bananian), migrated everything, fine.

</OT>

 

It took me several hours to get my 5" LCD display working on Bananapro but it's working now :-) . All the stuff to do it is there, however it wasn't easy for me as a noob to get the relevant items out and to adopt to changes that occurred over time.

So, by summarizing the different steps I'd like to give back - maybe it's useful. If I did not understand correctly, just drop me a note. Of course, dates and version numbers may progress. Full credits to @MartinKeppler and @zador.blood.stained

 

It's basically 2 steps: 

  1. You need a u-boot version that supports the LCD - must be compiled
  2. You need a dtb (Device Tree Blob) file that fits to your Kernel and supports pwm (Power for the LCD)

ad 1)

You need a Linux x64 PC to compile u-boot.

NOTE: If you want to compile on a Windows 10 Subsystem for Linux, build will fail due to fakeroot incompatibility. You need to replace fakeroot with fakeroot-tcp:

sudo update-alternatives --set fakeroot /usr/bin/fakeroot-tcp

Go to https://github.com/armbian/build and follow instructions from README.md (as root) with change in bold:

Quote

 

apt-get -y install git

git clone https://github.com/armbian/build

cd build

./compile.sh CREATE_PATCHES=yes

 

CREATE_PATCHES=yes tells the compile process to stop after downloading and preparing the sources, so they can be modified when needed (and yes, we need to do that)

This takes a loooong while when run for the first time on a vanilla linux.

Build u-boot and Kernel only (Kernel will not be needed).

The Build process downloads the Sources. So you can only modify them when prompted to do so.

When prompted to modify, change the following files:

build/cache/sources/u-boot/v2017.11/configs/Bananapro_defconfig 

For 5" display append the following (or see your params at http://linux-sunxi.org/LCD )

CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:24,pclk_khz:30000,le:40,ri:40,up:29,lo:13,hs:48,vs:3,sync:3,vmode:0" 

CONFIG_VIDEO_LCD_POWER="PH12" 

CONFIG_VIDEO_LCD_BL_EN="PH8" 

CONFIG_VIDEO_LCD_BL_PWM="PB2" 

build/cache/sources/u-boot/v2017.11/arch/arm/dts/sun7i-a20-bananapro.dts

build/cache/sources/u-boot/v2017.11/arch/arm/dts/sun7i-a20-bananapi.dts

build/cache/sources/linux-mainline/linux-4.14.y/arch/arm/boot/dts/sun7i-a20-bananapro.dts

build/cache/sources/linux-mainline/linux-4.14.y/arch/arm/boot/dts/sun7i-a20-bananapi.dts

Add (after &pio section) :

Quote

&pwm {
      pinctrl-names = "default";
      pinctrl-0 = <&pwm0_pins_a>, <&pwm1_pins_a>;
      status = "okay";
};

Let the compiler finish u-boot.

You will find build/output/debs/linux-u-boot-next-bananapipro_5.37_armhf.deb

install it on your pi using 

sudo dpkg -i linux-u-boot-next-bananapipro_5.37_armhf.deb

Step 1 completed.

 

ad 2)

To create a device specific file fitting to your Kernel and Board, you can recompile your kernel version directly on the PI. I used the guide supplied by @zador.blood.stained

mkdir kernel 

cd kernel 

git init . 

git remote add origin "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git" 

git fetch --depth 1 origin tags/v4.13.16

sudo git checkout -f FETCH_HEAD 

Then edit

arch/arm/boot/dts/sun7i-a20-bananapi.dts and 

arch/arm/boot/dts/sun7i-a20-bananapro.dts to include changes from above (add the &pwm section)

Run in the top directory of kernel source tree

sudo cp /boot/config-`uname -r` .config 

sudo make ARCH=arm dtbs

After the process is finished, you should get compiled DT files arch/arm/boot/dts/sun7i-a20-bananapi.dtb arch/arm/boot/dts/sun7i-a20-bananapro.dtb

Copy them to /boot/dtb, reboot and pray.

End of Step 2

 

DISCLAIMER: It worked for me - however you may end up with a non-bootable SD Card so be careful and have a backup :-)

 

Edited by Green Daddy
finish it, add disclaimer
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines