This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TI kernel compile with a recent toolchain crashes

Other Parts Discussed in Thread: AM3874

I'm trying to compile 2.6.37 from git using a run of the mill crosstools-ng toolchain, 

arm-a8-linux-gnueabi-gcc (crosstool-NG 1.16.0) 4.6.3

The kernel crashes with a NULL pointer exception. Tracking it down, it seems that the mailbox names get corrupted between the time they are registered, and the time something tries to look them up.

Anyone has managed to find a fix for that problem? I'm not particularly keen of using a binary toolchain from 2009, from a company that no longer exists to do professional work.

PMU: registered new PMU device of type 0
** omap_mbox_register mbox name 'mailbox-dsp'
** omap_mbox_register mbox name 'mailbox-video'
** omap_mbox_register mbox name 'mailbox-vpss'
...
usbhid: USB HID core driver
omap_mbox_get 'mailbox-dsp' c04b54b8 c042d405
omap_mbox_get [c04b5528 c042d405]
omap_mbox_get ['mailbox-dsp']
omap_mbox_get 'mailbox-video' c04b54b8 c042d3f7
omap_mbox_get [c04b5528 c042d405]
omap_mbox_get ['mailbox-dsp']
omap_mbox_get [c04b5558 00000002]
omap_mbox_get ['(null)']
Unable to handle kernel NULL pointer dereference at virtual address 00000002

  • One has to love TI support here.

    Kernel is 4 years old, and is expected to be built with a binary toolchain made by a company that no longer exists. Other than that, all is well!

  • I found that a patch has been submitted over 2 years ago, by a TI person even, to fix this problem. Despite the various people reporting, and being hit by that problem, the fix has never been merged into the official "dustware" for the DM41XX kernel.

    Anyway, I give it to you, in case google lead you here.

    From c03773206bf2249a890c4d420ed32ef500630095 Mon Sep 17 00:00:00 2001
    From: Kevin Hilman <khilman@ti.com>
    Date: Fri, 11 Feb 2011 19:56:43 +0000
    Subject: [PATCH] OMAP2+: mailbox: fix lookups for multiple mailboxes

    The pointer math in omap_mbox_get() is not quite right, and leads to
    passing NULL to strcmp() when searching for an mbox that is not first
    in the list.

    Convert to using array indexing as is done in all the other functions
    which walk the mbox list.

    Tested on OMAP2420/n810, OMAP3630/zoom3, OMAP4430/Blaze

    Signed-off-by: Kevin Hilman <khilman@ti.com>
    Signed-off-by: Tony Lindgren <tony@atomide.com>
    ---
    arch/arm/plat-omap/mailbox.c | 11 +++++++----
    1 file changed, 7 insertions(+), 4 deletions(-)

    diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
    index 459b319..49d3208 100644
    --- a/arch/arm/plat-omap/mailbox.c
    +++ b/arch/arm/plat-omap/mailbox.c
    @@ -322,15 +322,18 @@ static void omap_mbox_fini(struct omap_mbox *mbox)

    struct omap_mbox *omap_mbox_get(const char *name, struct notifier_block *nb)
    {
    - struct omap_mbox *mbox;
    - int ret;
    + struct omap_mbox *_mbox, *mbox = NULL;
    + int i, ret;

    if (!mboxes)
    return ERR_PTR(-EINVAL);

    - for (mbox = *mboxes; mbox; mbox++)
    - if (!strcmp(mbox->name, name))
    + for (i = 0; (_mbox = mboxes[i]); i++) {
    + if (!strcmp(_mbox->name, name)) {
    + mbox = _mbox;
    break;
    + }
    + }

    if (!mbox)
    return ERR_PTR(-ENOENT);
    --
    1.7.10.4

  • Just ran into this same issue, with a DaVinci DM6168.

    Having fatal logic errors in TI's official distribution of the kernel source is not fun.

  • Ditto, AM3874 / DM8148.

  • Hi Graeme,

    AM3874/DM8148 EZSDK linux kernel 2.6.37 is tested with CodeSourcery Lite gcc tool chain.

    http://software-dl.ti.com/dsps/dsps_public_sw/ezsdk/latest/index_FDS.html

    4. CodeSourcery GCC Toolchain Installation

    4.1 Download the CodeSourcery GCC toolchain from the link provided below (use the IA32 GNU/Linux Installer).

    4.2 Execute the installer on the host with a .bin file extension as follows:

     ./arm-2009q1-203-arm-none-linux-gnueabi.bin

    4.3 Follow the installer instructions on the screen to do a Typical installation.

    4.4 There is no need to read the Code Sourcery Getting Started Guide at this time. You can read it later if necessary.

    http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/lite/?cmpid=7108&lite=arm&target_os=GNU%2FLinux&target_arch=ARM&returnURL=https%253A%252F%252Fsourcery.mentor.com%252FGNUToolchain%252Frelease858%253Flite%253Darm%2526cmpid%253D7108

    Best regards,
    Pavel

  • Hi Pavel,

    Thanks again -- I'm migrating from CodeSourcery lite to a Yocto build, which prefers to build and manage its own toolchain. The above patch solves the problem for me. If I run into too much trouble (should I expect problems?), I will probably migrate back to CodeSourcery. It would, of course, be nice to see this kind of patch integrated into TI's releases.

    best,

    Graeme

  • Graeme,

    Graeme Smecher said:
    I'm migrating from CodeSourcery lite to a Yocto build

    I can find that we support Yocto for MCSDK (ARM A15) and Sitara (AM335x) SDK, but I can not find any official Yocto support for DM814x/AM387x device. As this is the DM814x/AM387x hardware forum, you can also ask in the software Linux forum. I can find several threads in the Linux forum, which discussed Yocto support:

    http://e2e.ti.com/support/embedded/linux/f/354/t/264817.aspx

    http://e2e.ti.com/support/embedded/linux/f/354/t/137357.aspx

    http://e2e.ti.com/blogs_/b/toolsinsider/archive/2013/04/16/ti-sitara-linux-is-yocto-project-compatible.aspx

    Best regards,
    Pavel