BeagleBone Black: Compiling the Kernel: HDMI/[drm] fails?

Hi!

I have a BeagleBone Black with Debian Wheezy and want to cross-compile
the kernel (need some additional modules not in the default kernel).

So far, I succeeded compiling the kernel and running it on the BBB, but
then I get no HDMI output.

For building on my Debian Wheezy x86_64 I did:
----------------%<----------------%<----------------%<----------------
sudo echo "deb http://emdebian.org/~thibg/repo/ sid main" >>
/etc/apt/sources.list
sudo apt-get install emdebian-archive-keyring
sudo dpkg --add-architecture armhf
sudo apt-get update
sudp apt-get install gcc-4.7-arm-linux-gnueabihf lzop libncurses5-dev
cd /usr/bin
sudo ln -s arm-linux-gnueabihf-cpp-4.7 arm-linux-gnueabihf-cpp
sudo ln -s arm-linux-gnueabihf-gcc-4.7 arm-linux-gnueabihf-gcc
sudo ln -s arm-linux-gnueabihf-gcc-ar-4.7 arm-linux-gnueabihf-gcc-ar
sudo ln -s arm-linux-gnueabihf-gcc-nm-4.7 arm-linux-gnueabihf-gcc-nm
sudo ln -s arm-linux-gnueabihf-gcc-ranlib-4.7 arm-linux-gnueabihf-gcc-ranlib
sudo ln -s arm-linux-gnueabihf-gcov-4.7 arm-linux-gnueabihf-gcov

git clone git://git.denx.de/u-boot.git
cd u-boot/
git checkout v2014.07 -b tmp

wget -c
https://raw.githubusercontent.com/eewiki/u-boot-patches/master/v2014.07/0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch
patch -p1 < 0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x_evm_config
make -j4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
cd ..

git clone git://github.com/beagleboard/kernel
cd kernel
git checkout 3.8
./patch.sh
cd kernel
wget
http://arago-project.org/git/projects/?p=am33x-cm3.git\;a=blob_plain\;f=bin/am335x-pm-firmware.bin\;hb=HEAD
-O firmware/am335x-pm-firmware.bin
cp ../configs/beaglebone .config
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
# change nothing for testing; save .config
make -j4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
PATH="/path/to/u-boot/tools:$PATH" make -j4 ARCH=arm
CROSS_COMPILE=arm-linux-gnueabihf- uImage dtbs modules

mkdir -p ../../deploy/{modules,firmware,dtbs}
PATH="/path/to/u-boot/tools:$PATH" make ARCH=arm
CROSS_COMPILE=arm-linux-gnueabihf- modules_install
INSTALL_MOD_PATH=../../deploy/modules
PATH="/path/to/u-boot/tools:$PATH" make ARCH=arm
CROSS_COMPILE=arm-linux-gnueabihf- firmware_install
INSTALL_FW_PATH=../../deploy/firmware
find . -iname "*.dtb" -exec cp -v '{}' ../../deploy/dtbs
cp ./arch/arm/boot/zImage ../../deploy/

cd ../../deploy
# mount mmcblk0p1 "BOOT"
sudo cp --recursive dtbs /media/BOOT
sudo cp zImage /media/BOOT
# mount mmcblkp5 "rootfs"
sudo cp --recursive modules/lib/* /media/rootfs/lib
sudo cp --recursive firmware/* /media/rootfs/lib/firmware

# umount & eject mmcblk0
----------------%<----------------%<----------------%<----------------

If I then boot it, I see the new kernel beeing loaded, but when the
display is enabled, it fails. (system continues running, just no HDMI
display output); See the output on the debug serial:
----------------%<----------------%<----------------%<----------------
...
reading zImage
4416440 bytes read in 504 ms (8.4 MiB/s)
reading initrd.img
2606277 bytes read in 299 ms (8.3 MiB/s)
reading /dtbs/am335x-boneblack.dtb
25814 bytes read in 9 ms (2.7 MiB/s)
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Loading Ramdisk to 9efbb000, end 9f2374c5 ... OK
   Using Device Tree in place at 88000000, end 880094d5

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 3.8.13-00770-g917d12b (XXXX@localhost) (gcc
version 4.7.1 (Debian 4.7.1-7) ) #1 SMP Fri Aug 8 00:10:10 CEST 2014
[ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7),
cr=50c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing
instruction cache
[ 0.000000] Machine: Generic AM33XX (Flattened Device Tree), model:
TI AM335x BeagleBone
...
[ 2.395598] mmc1: BKOPS_EN bit is not set
[ 2.402845] mmc1: new high speed MMC card at address 0001
[ 2.409338] mmcblk1: mmc1:0001 MMC02G 1.78 GiB
[ 2.414514] mmcblk1boot0: mmc1:0001 MMC02G partition 1 1.00 MiB
[ 2.421408] mmcblk1boot1: mmc1:0001 MMC02G partition 2 1.00 MiB
[ 2.430001] mmcblk1: p1 p2
[ 2.435746] mmcblk1boot1: unknown partition table
[ 2.442937] mmcblk1boot0: unknown partition table
[ 2.475101] tilcdc 4830e000.fb: found TDA19988
[ 2.480588] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
[ 2.487616] [drm] No driver support for vblank timestamp query.
[ 2.548691] ------------[ cut here ]------------
[ 2.548733] WARNING: at drivers/gpu/drm/tilcdc/tilcdc_crtc.c:251
tilcdc_crtc_mode_set+0x3b/0x468()
[ 2.548743] Modules linked in:
[ 2.548791] [<c0010569>] (unwind_backtrace+0x1/0x8c) from
[<c002b713>] (warn_slowpath_common+0x33/0x48)
[ 2.548814] [<c002b713>] (warn_slowpath_common+0x33/0x48) from
[<c002b737>] (warn_slowpath_null+0xf/0x10)
[ 2.548836] [<c002b737>] (warn_slowpath_null+0xf/0x10) from
[<c01f0247>] (tilcdc_crtc_mode_set+0x3b/0x468)
[ 2.548877] [<c01f0247>] (tilcdc_crtc_mode_set+0x3b/0x468) from
[<c01e06f9>] (drm_crtc_helper_set_mode+0x147/0x22e)
[ 2.548904] [<c01e06f9>] (drm_crtc_helper_set_mode+0x147/0x22e) from
[<c01e0ca3>] (drm_crtc_helper_set_config+0x423/0x5e8)
[ 2.548929] [<c01e0ca3>] (drm_crtc_helper_set_config+0x423/0x5e8)
from [<c01dfee9>] (drm_fb_helper_set_par+0x39/0x74)
[ 2.548963] [<c01dfee9>] (drm_fb_helper_set_par+0x39/0x74) from
[<c01b1903>] (fbcon_init+0x233/0x30c)
[ 2.548989] [<c01b1903>] (fbcon_init+0x233/0x30c) from [<c01d06b5>]
(visual_init+0x71/0xb4)
[ 2.549014] [<c01d06b5>] (visual_init+0x71/0xb4) from [<c01d188f>]
(do_bind_con_driver+0x121/0x20e)
[ 2.549037] [<c01d188f>] (do_bind_con_driver+0x121/0x20e) from
[<c01d19cd>] (do_take_over_console+0x23/0x26)
[ 2.549060] [<c01d19cd>] (do_take_over_console+0x23/0x26) from
[<c01b1a13>] (do_fbcon_takeover+0x37/0x78)
[ 2.549091] [<c01b1a13>] (do_fbcon_takeover+0x37/0x78) from
[<c004068d>] (notifier_call_chain+0x21/0x3a)
[ 2.549117] [<c004068d>] (notifier_call_chain+0x21/0x3a) from
[<c0040751>] (__blocking_notifier_call_chain+0x27/0x34)
[ 2.549141] [<c0040751>] (__blocking_notifier_call_chain+0x27/0x34)
from [<c004076d>] (blocking_notifier_call_chain+0xf/0x10)
[ 2.549164] [<c004076d>] (blocking_notifier_call_chain+0xf/0x10) from
[<c01ac9cf>] (register_framebuffer+0x133/0x174)
[ 2.549190] [<c01ac9cf>] (register_framebuffer+0x133/0x174) from
[<c01e002d>] (drm_fb_helper_single_fb_probe+0x109/0x184)
[ 2.549216] [<c01e002d>] (drm_fb_helper_single_fb_probe+0x109/0x184)
from [<c01e01a5>] (drm_fb_helper_initial_config+0xfd/0x134)
[ 2.549245] [<c01e01a5>] (drm_fb_helper_initial_config+0xfd/0x134)
from [<c01f17a1>] (tilcdc_fbdev_cma_init+0x71/0x94)
[ 2.549270] [<c01f17a1>] (tilcdc_fbdev_cma_init+0x71/0x94) from
[<c01f22fd>] (tilcdc_load+0x46b/0x4be)
[ 2.549299] [<c01f22fd>] (tilcdc_load+0x46b/0x4be) from [<c01e7ad5>]
(drm_get_platform_dev+0x9f/0x14a)
[ 2.549334] [<c01e7ad5>] (drm_get_platform_dev+0x9f/0x14a) from
[<c01f68bd>] (platform_drv_probe+0xd/0xe)
[ 2.549361] [<c01f68bd>] (platform_drv_probe+0xd/0xe) from
[<c01f5e6f>] (driver_probe_device+0x67/0x144)
[ 2.549386] [<c01f5e6f>] (driver_probe_device+0x67/0x144) from
[<c01f5f81>] (__driver_attach+0x35/0x48)
[ 2.549408] [<c01f5f81>] (__driver_attach+0x35/0x48) from
[<c01f4f99>] (bus_for_each_dev+0x29/0x48)
[ 2.549432] [<c01f4f99>] (bus_for_each_dev+0x29/0x48) from
[<c01f5931>] (bus_add_driver+0x85/0x15c)
[ 2.549454] [<c01f5931>] (bus_add_driver+0x85/0x15c) from
[<c01f6261>] (driver_register+0x4d/0xa4)
[ 2.549478] [<c01f6261>] (driver_register+0x4d/0xa4) from
[<c000868d>] (do_one_initcall+0x61/0xec)
[ 2.549507] [<c000868d>] (do_one_initcall+0x61/0xec) from
[<c0649691>] (kernel_init_freeable+0xb9/0x14c)
[ 2.549535] [<c0649691>] (kernel_init_freeable+0xb9/0x14c) from
[<c038709f>] (kernel_init+0x7/0x90)
[ 2.549564] [<c038709f>] (kernel_init+0x7/0x90) from [<c000c73d>]
(ret_from_fork+0x11/0x34)
[ 2.549574] ---[ end trace db2e1923d881a249 ]---
[ 2.549595] [drm:drm_crtc_helper_set_config] *ERROR* failed to set
mode on [CRTC:3]
[ 2.549612] fbcon_init: detected unhandled fb_set_par error, error
code -22
[ 2.549905] ------------[ cut here ]------------
... # repeats several times and other modules get loaded/started
[ 11.359302] EXT4-fs (mmcblk0p5): re-mounted. Opts: (null)
[ 12.334853] EXT4-fs (mmcblk0p5): re-mounted. Opts: errors=remount-ro
[ 18.390179] net eth0: initializing cpsw version 1.12 (0)
[ 18.414139] net eth0: phy found : id is : 0x7c0f1
[ 18.435109] libphy: PHY 4a101000.mdio:01 not found
[ 18.445140] net eth0: phy 4a101000.mdio:01 not found on slave 1
[ 19.029224] ------------[ cut here ]------------
[ 19.029257] WARNING: at drivers/gpu/drm/tilcdc/tilcdc_crtc.c:251
tilcdc_crtc_mode_set+0x3b/0x468()
[ 19.029264] Modules linked in:
[ 19.029295] [<c0010569>] (unwind_backtrace+0x1/0x8c) from
[<c002b713>] (warn_slowpath_common+0x33/0x48)
[ 19.029308] [<c002b713>] (warn_slowpath_common+0x33/0x48) from
[<c002b737>] (warn_slowpath_null+0xf/0x10)
[ 19.029321] [<c002b737>] (warn_slowpath_null+0xf/0x10) from
[<c01f0247>] (tilcdc_crtc_mode_set+0x3b/0x468)
[ 19.029348] [<c01f0247>] (tilcdc_crtc_mode_set+0x3b/0x468) from
[<c01e06f9>] (drm_crtc_helper_set_mode+0x147/0x22e)
[ 19.029363] [<c01e06f9>] (drm_crtc_helper_set_mode+0x147/0x22e) from
[<c01e0ca3>] (drm_crtc_helper_set_config+0x423/0x5e8)
[ 19.029377] [<c01e0ca3>] (drm_crtc_helper_set_config+0x423/0x5e8)
from [<c01df379>] (drm_fb_helper_pan_display+0x3f/0x60)
[ 19.029393] [<c01df379>] (drm_fb_helper_pan_display+0x3f/0x60) from
[<c01abaff>] (fb_pan_display+0x8b/0xba)
[ 19.029412] [<c01abaff>] (fb_pan_display+0x8b/0xba) from [<c01b3ef5>]
(bit_update_start+0x11/0x22)
[ 19.029426] [<c01b3ef5>] (bit_update_start+0x11/0x22) from
[<c01b281f>] (fbcon_switch+0x2f3/0x2fa)
[ 19.029441] [<c01b281f>] (fbcon_switch+0x2f3/0x2fa) from [<c01d1465>]
(redraw_screen+0xab/0x156)
[ 19.029455] [<c01d1465>] (redraw_screen+0xab/0x156) from [<c01b22ef>]
(fbcon_do_set_font+0x20b/0x234)
[ 19.029469] [<c01b22ef>] (fbcon_do_set_font+0x20b/0x234) from
[<c01b24e7>] (fbcon_set_font+0x13f/0x184)
[ 19.029482] [<c01b24e7>] (fbcon_set_font+0x13f/0x184) from
[<c01d3d99>] (con_font_op+0xe5/0x2a8)
[ 19.029501] [<c01d3d99>] (con_font_op+0xe5/0x2a8) from [<c01cc5d7>]
(vt_ioctl+0xb33/0xcf8)
[ 19.029526] [<c01cc5d7>] (vt_ioctl+0xb33/0xcf8) from [<c01c6991>]
(tty_ioctl+0x763/0x7a6)
[ 19.029541] [<c01c6991>] (tty_ioctl+0x763/0x7a6) from [<c009de9d>]
(vfs_ioctl+0x15/0x20)
[ 19.029555] [<c009de9d>] (vfs_ioctl+0x15/0x20) from [<c009e63b>]
(do_vfs_ioctl+0x3ad/0x3e2)
[ 19.029565] [<c009e63b>] (do_vfs_ioctl+0x3ad/0x3e2) from [<c009e6a1>]
(sys_ioctl+0x31/0x4c)
[ 19.029582] [<c009e6a1>] (sys_ioctl+0x31/0x4c) from [<c000c681>]
(ret_fast_syscall+0x1/0x46)
[ 19.029588] ---[ end trace db2e1923d881a24c ]---
[ 19.029603] [drm:drm_crtc_helper_set_config] *ERROR* failed to set
mode on [CRTC:3]
[ 21.490263] libphy: 4a101000.mdio:00 - Link is Up - 100/Full

Debian GNU/Linux 7 debian ttyO0

debian login: XX
Password:
Last login: Thu Aug 7 23:18:41 CEST 2014 on ttyO0
Linux debian 3.8.13-00770-g917d12b #1 SMP Fri Aug 8 00:10:10 CEST 2014
armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
XX@debian:~$
----------------%<----------------%<----------------%<----------------

Is this just a problem on my setup, or are the repos broken?
How could I fix that?

It's the first time for me to compile a kernel, so I'm unsure how to
proceed from here...

cheers,
~flapflap

http://eewiki.net/display/linuxonarm/BeagleBone+Black

I few things Ive spotted that deviate from Robert’s instructions that I know works.

  1. sudp apt-get install gcc-4.7-arm-linux-gnueabihf lzop libncurses5-dev

  2. sudo dpkg --add-architecture armhf

  3. Manually setting symlinks from respective toolchain binaries.

  4. A lot of other things that may / may not be consistant with Robert’s build_kernel.sh script ( I have looked at it since early last year.

  5. Using SID’s APT repo which may / may not present package conflicts.

I built using these instructions most recently a couple months ago, and my BBB is happily chugging a long to this day . . .

$ uname -r
3.8.13-bone47

Prior Ive used these instruction many a time and they never failed to build a working “image” + kernel since early( ish ) last year. I also use Debian wheezy i386 ( stable ), since in the past I’ve had issues with x64 versions of Debian when it come to compiling “things” from source. These issues may be all , or mostly gone now days, but i386 has always been a “known quantity” for me.

I have NOT looked at Robert’s build_kernel.sh script since early last year. As it just works . . .

Thanks for picking up the topic!

William Hermans:

I few things Ive spotted that deviate from Robert's instructions that I
know works.

1) sudp apt-get install *gcc-4.7-arm-linux-gnueabihf* lzop libncurses5-dev
2) sudo dpkg --add-architecture
*armhf*
3) Manually setting symlinks from respective toolchain binaries.
4) A lot of other things that may / may not be consistant with
Robert's build_kernel.sh script ( I have looked at it since early last year.
5) Using SID's APT repo which may / may not present package conflicts.

I built using these instructions most recently a couple months ago, and my
BBB is happily chugging a long to this day . . .

*$ uname -r*

*3.8.13-bone47*

Prior Ive used these instruction many a time and they never failed to build
a working "image" + kernel since early( ish ) last year. I also use Debian
wheezy i386 ( stable ), since in the past I've had issues with x64 versions
of Debian when it come to compiling "things" from source. These issues may
be all , or mostly gone now days, but i386 has always been a "known
quantity" for me.

I'm now trying the slightly different build instructions from
  http://eewiki.net/display/linuxonarm/BeagleBone+Black
Maybe the result will be different. Although I'm not sure what's wrong
with the way I do it at the moment as the kernel is bootable and just
display/HDMI doesn't work.
I'll report back when I have new results.

Roberts instructions work. Known quantity and all . . . but hdmi not working could be a couple things. Anyway me linking those instructions was meant more for you to compare what you’ve done to known working instructions.

William Hermans:

Roberts instructions work. Known quantity and all . . . but hdmi not
working could be a couple things. Anyway me linking those instructions was
meant more for you to compare what you've done to known working
instructions.

I've done the procedure following Robert's instructions (for now,
without altering the kernel config) and it is working, including HDMI.

I'm still not sure what caused the problem. As my previous procedure is
very similar, the only major difference are the compilers (I think).
But anyways, it works now. Let's see if its still working with the other
kernel config :slight_smile:

~flapflap

So, the next time you build it your way. Keep an exact build log. Not sure how you build, but I use puTTY from Windows to my Debian i386 support system. Then, I have puTTY set to log every session.

This will help you spot stuff you’ve missed, or done potentially wrongly, and you can share that log with us to peruse in an attempt to spot problems too.

and it does \o/

So basically, it goes back to RTFM. Lesson learned.

Not necessarily. Try comparing your .config with Roberts. I see fb / DRM “gripes” in your boot log, so . . . yeah I missed that last night ( was tired ). I also see it pulled in the proper device tree file for the board.

So if comparing .configs does not turn up anything, I’d start examining Robert’s build_kernel.sh script, and see which patches it applies, if any. Passed that ? Compare each kernel tree perhaps ?

I’m going ot start looking through build_kernel.sh now, because I’m interested too, and haven’t looked in a while/

So if comparing .configs does not turn up anything, I’d start examining Robert’s build_kernel.sh script, and see which patches it applies

Yeah that was rich heh, there are literally 100’s of patches. Check out linux-dev/patches/ and linux-dev/patches.sh. Some pertain to the framebuffer, and SGX, and to be honest I’m not sure which patches you’d need to fix your problem.

William Hermans:

*So if comparing .configs does not turn up anything, I'd start examining
Robert's build_kernel.sh script, and see which patches it applies*

Yeah that was rich heh, there are literally 100's of patches. Check out
linux-dev/patches/ and linux-dev/patches.sh. Some pertain to the
framebuffer, and SGX, and to be honest I'm not sure which patches you'd
need to fix your problem.

This kernel business is still some black magic to me :slight_smile: But I'm looking
forward to understanding what's happening here and there.

At the moment, my only need is/was to add kexec to the kernel as the
default kernel doesn't provide kexec.
So far it seems to be there and the HDMI problem is gone, but when I
call /sbin/kexec in some init scripts I get a "Cannot open /proc/atags"
error. Maybe that's a bug in my scripts, maybe some other issue specific
to ARM/BBB (I read somewhere that /proc/atags is deprecated and device
trees should be used instead; on i386/x86_64 platforms the scripts work).

Did this get pushed to kexec?

http://lists.infradead.org/pipermail/kexec/2012-September/006787.html

@@ -96,6 +101,8 @@ void zImage_arm_usage(void)
  " --append=STRING Set the kernel command line to STRING.\n"
  " --initrd=FILE Use FILE as the kernel's initial ramdisk.\n"
  " --ramdisk=FILE Use FILE as the kernel's initial ramdisk.\n"
+ " --dtb=FILE Use FILE as the fdt blob.\n"
+ " --atags Use ATAGs instead of device-tree.\n"

you'll need the --dtb=xyz option...

Regards,

Robert Nelson:

At the moment, my only need is/was to add kexec to the kernel as the
default kernel doesn't provide kexec.
So far it seems to be there and the HDMI problem is gone, but when I
call /sbin/kexec in some init scripts I get a "Cannot open /proc/atags"
error. Maybe that's a bug in my scripts, maybe some other issue specific
to ARM/BBB (I read somewhere that /proc/atags is deprecated and device
trees should be used instead; on i386/x86_64 platforms the scripts work).

Did this get pushed to kexec?

[PATCH 7/7] ARM: Add device tree support to the ARM platform

It seems to be in there since kexec-tools-2.0.4, but not yet in wheezy:
https://qa.debian.org/developer.php?login=khalid%40debian.org

you'll need the --dtb=xyz option...

Thanks for the hint! I'll try and report whether it works.

~flapflap