Sunday, January 26, 2014

element14 BB-View and the Debian Beta

This is a post I made at the element14 Community pages:

I thought some other might like to know how to get the BB-View working under the latest Debian beta images.

Unfortunately, you are going to have to recompile the Kernel. The video works fine without a recompile (the red/blue swap is easy to fix), but the touchscreen control connections are not the same as the standard TI 4-wire interface. I tried to patch the ti_am335x_tsc.c file, so the changes would be limited to a dts recompile, but I haven't been able to get that working yet (I'm pretty sure it is a state machine / bit assignment issue). But anyway, here are the steps that you need to perform.....

Overview

1) Download the necessary files
     a) Robert Nelson's handy tools for compiling the Beaglebone kernel
     b) BB-View source for Angstrom
2) Build the default kernel
3) Patch the Kernel and perform a fast recompile
4) Copy the new kernel to the Beaglebone
5) Edit the xorg.conf file to correct the Red/Blue color swap
6) Revel in the 4 days you just saved 

Let's Get Started

I am using Ubuntu 12.04 LTS 64 bit running in a VirtualBox VM to compile the kernel:
Make a new folder called bb-view, this is where our build will happen.
> mkdir bb-view
> cd bb-view

Install git, if you haven't already:
> apt-get install git

Clone Robert Nelson's linux-dev project locally. Be prepared for a large download (~100 Mb for the cross-compiler and ~700 Mb for the kernel source).
> git clone https://github.com/RobertCNelson/linux-dev.git

Change into the new linux-dev folder and select branch/tag that matches the Debian version.
> cd linux-dev
> git checkout 3.8.13-bone37 -b tmp

Now we need to build the base image, so our cape drivers folder gets populated. The script will tell you if you need to do or install anything else. 
> ./build_kernel.sh

Come back in an hour or so.....(You might want to download the Angstrom source from element14 now)

Patching the Kernel

Extract two files from the Angstrom source:
> unzip angstrom-source.zip
> tar -zxf bb-black-kernel-3.8.13-bb-view.tar.bz2
> cp ./kernel/kernel/drivers/input/touchscreen/ti_am335x_tsc.c  ~/bb-view/linux-dev/KERNEL/drivers/input/touchscreen/
> cp ./kernel/kernel/firmware/capes/BB-VIEW-LCD7-01-00A0.dts  ~/bb-view/linux-dev/KERNEL/firmware/capes/

Now we need to let the compiler know that we want to add the firmware to the build:
> nano   ~/bb-view/linux-dev/KERNEL/firmware/Makefile

Add the following line somewhere near line 192 (CTRL-C will display current cursor position):
BB-VIEW-LCD7-01-00A0.dtbo \

Don't forget the trailing backslash....it is important. Now save and exit by doing CTRL-O, Enter, CTRL-X.
Change back to the linux-dev root folder:
> cd   ~/bb-view/linux-dev

Now issue the kernel rebuild command, this won't take very long at all:
> ./tools/rebuild.sh


Copy Kernel to BBB

The following instructions assume that you already have the Debian beta installed and booted up on the BBB.
The easiest way is to copy the files over the network, via the 'scp' command:
> scp   ~/bb-view/linux-dev/deploy/3.8.13-bone37.zImage   debian@192.168.7.2:/home/debian
Replace debian (both instances) with the username you are running on the BBB and 192.168.7.2 with the IP address of the BBB.

Now log into the BBB and copy the kernel image to the boot partition:
> ssh debian@192.168.7.2
bbb>  sudo cp 3.8.13-bone37.zImage   /boot/uboot/zImage

We need to do one more thing before the LCD will work. Since the cape doesn't have an EEPROM, we need to black-list the HDMI drivers and force-load the BB-VIEW drivers in the boot command file:
bbb>  sudo  nano  /boot/uboot/uEnv.txt

Find the "optargs" line and edit it to be:
optargs=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN  capemgr.enable_partno=BB-VIEW-LCD7-01
Notice that the preceding "#" has been removed. You don't want to disable BB-BONE-EMMC-2G, or you won't be able to boot from eMMC.
Now save and exit by doing CTRL-O, Enter, CTRL-X.

Reboot the BBB and the LCD should now work....except the blue and red are reversed.

Fixing Red/Blue Color Swap

This is due to errata in the TI AM335x processor when switching between 16 and 24 bit video modes. To fix this, we must first find the name of our screen:
> ssh debian@192.168.7.2
bbb> cat  /var/log/Xorg.0.log  |  grep  screen
Mine was "Builtin Default fbdev Screen 0"

Now we edit our X configuration file:
bbb> sudo nano  /usr/share/X11/xorg.conf.d/10-evdev.conf

and add a "Screen" section at the end of the file:
Section "Screen"
        Identifier "Builtin Default fbdev Screen 0"
        Monitor "Configured Monitor"
        Device "Configured Video Device"
        DefaultDepth 24
EndSection
Save and exit by doing CTRL-O, Enter, CTRL-X.
Reboot and enjoy!

1 comment:

  1. I cant get any kernel folder when i executed "./build_kernel.sh" command. Please help.

    ReplyDelete