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.

dvsdk apps & drivers with newer git kernels -- does not compile.

I am tracking down a problem with video encoding causing audio capture clicks.  The git kernel uses IRAM for ping pong buffers, and I would like to use a very recent git kernel with my dvsdk 'encode' application.

But CMEMK.KO and the other device drivers are tied to a specific kernel, and won't compile with the later kernels ( the ioctl prototype changed).

 

How can I get the example applications ( and device drivers)  from the dvdsk to work with later kernels?

 

Brett

  • Brett,

    TI's LinuxUtils package, of which CMEM is a part, contains device driver source code that should accommodate most Linux kernels for TI parts.  You do need to rebuild these device drivers, but they have been tested with recent GIT kernels, as well as older supported kernels.

    You say that the ioctl() prototype changed?  I find that unlikely, since that interface is used by everyone and has been stable for years.  What, in particular, is your problem when building, for instance, cmemk.ko?

    Regards,

    - Rob

     

  • [brettb@maven ti-dvsdk_dm365-evm_4_00_00_17]$ make cmem
    make -C /aux/home/brettb/workdir/sme100/dvsdk/ti-dvsdk_dm365-evm_4_00_00_17/linuxutils_2_25_04_10/packages/ti/sdo/linuxutils/cmem/src/interface ../../lib/cmem.a470MV
    make[1]: Entering directory `/aux/home/brettb/workdir/sme100/dvsdk/ti-dvsdk_dm365-evm_4_00_00_17/linuxutils_2_25_04_10/packages/ti/sdo/linuxutils/cmem/src/interface'
    make[1]: `../../lib/cmem.a470MV' is up to date.
    make[1]: Leaving directory `/aux/home/brettb/workdir/sme100/dvsdk/ti-dvsdk_dm365-evm_4_00_00_17/linuxutils_2_25_04_10/packages/ti/sdo/linuxutils/cmem/src/interface'
    make -C /aux/home/brettb/workdir/sme100/dvsdk/ti-dvsdk_dm365-evm_4_00_00_17/linuxutils_2_25_04_10/packages/ti/sdo/linuxutils/cmem/src/module
    make[1]: Entering directory `/aux/home/brettb/workdir/sme100/dvsdk/ti-dvsdk_dm365-evm_4_00_00_17/linuxutils_2_25_04_10/packages/ti/sdo/linuxutils/cmem/src/module'
    make -C /aux/home/brettb/workdir/sme100/dvsdk/ti-dvsdk_dm365-evm_4_00_00_17/../../kernel/davinci_git/linux-davinci M=`pwd` ARCH=arm CROSS_COMPILE=/opt/arm-2009q1//bin/arm-none-linux-gnueabi- \
                    EXTRA_CFLAGS="-DUSE_UDEV=1 -DMAX_POOLS=128" modules
    make[2]: Entering directory `/aux/home/brettb/workdir/sme100/kernel/davinci_git/linux-davinci'
      CC [M]  /aux/home/brettb/workdir/sme100/dvsdk/ti-dvsdk_dm365-evm_4_00_00_17/linuxutils_2_25_04_10/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.o
    /aux/home/brettb/workdir/sme100/dvsdk/ti-dvsdk_dm365-evm_4_00_00_17/linuxutils_2_25_04_10/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c:66:2: warning: #warning *** not a warning *** Note: LINUX_VERSION_CODE >= 2.6.26
    /aux/home/brettb/workdir/sme100/dvsdk/ti-dvsdk_dm365-evm_4_00_00_17/linuxutils_2_25_04_10/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c:246: error: unknown field 'ioctl' specified in initializer
    /aux/home/brettb/workdir/sme100/dvsdk/ti-dvsdk_dm365-evm_4_00_00_17/linuxutils_2_25_04_10/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c:246: warning: initialization from incompatible pointer type
    make[3]: *** [/aux/home/brettb/workdir/sme100/dvsdk/ti-dvsdk_dm365-evm_4_00_00_17/linuxutils_2_25_04_10/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.o] Error 1
    make[2]: *** [_module_/aux/home/brettb/workdir/sme100/dvsdk/ti-dvsdk_dm365-evm_4_00_00_17/linuxutils_2_25_04_10/packages/ti/sdo/linuxutils/cmem/src/module] Error 2
    make[2]: Leaving directory `/aux/home/brettb/workdir/sme100/kernel/davinci_git/linux-davinci'
    make[1]: *** [release] Error 2
    make[1]: Leaving directory `/aux/home/brettb/workdir/sme100/dvsdk/ti-dvsdk_dm365-evm_4_00_00_17/linuxutils_2_25_04_10/packages/ti/sdo/linuxutils/cmem/src/module'
    make: *** [cmem] Error 2

    [brettb@maven ti-dvsdk_dm365-evm_4_00_00_17]$ grep -i kernel Rules.make
    # The directory that points to your kernel source directory.
    #LINUXKERNEL_INSTALL_DIR=$(DVSDK_INSTALL_DIR)/psp/linux-kernel-source
    LINUXKERNEL_INSTALL_DIR=$(DVSDK_INSTALL_DIR)/../../kernel/davinci_git/linux-davinci
    [brettb@maven ti-dvsdk_dm365-evm_4_00_00_17]$

    ------------------------------------------------------------------

    from cmemk.c

    /* Forward declaration of system calls */
    static int ioctl(struct inode *inode, struct file *filp,
                     unsigned int cmd, unsigned long args);

    static int mmap(struct file *filp, struct vm_area_struct *vma);
    static int open(struct inode *inode, struct file *filp);
    static int release(struct inode *inode, struct file *filp);

    static struct file_operations cmem_fxns = {
        owner:   THIS_MODULE,
        ioctl:   ioctl,
        mmap:    mmap,
        open:    open,
        release: release
    };

     

    ------------------------------------------------------------

    from git tree

    linux-davinci/include/linux/fs.h

     

    /*
     * NOTE:
     * all file operations except setlease can be called without
     * the big kernel lock held in all filesystems.
     */
    struct file_operations {
        struct module *owner;
        loff_t (*llseek) (struct file *, loff_t, int);
        ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
        ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
        ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
        ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
        int (*readdir) (struct file *, void *, filldir_t);
        unsigned int (*poll) (struct file *, struct poll_table_struct *);
        long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
        long (*compat_ioctl) (struct file *, unsigned int, unsigned long);

        int (*mmap) (struct file *, struct vm_area_struct *);
        int (*open) (struct inode *, struct file *);
        int (*flush) (struct file *, fl_owner_t id);
        int (*release) (struct inode *, struct file *);
        int (*fsync) (struct file *, int datasync);
        int (*aio_fsync) (struct kiocb *, int datasync);
        int (*fasync) (int, struct file *, int);
        int (*lock) (struct file *, int, struct file_lock *);
        ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
        unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
        int (*check_flags)(int);
        int (*flock) (struct file *, int, struct file_lock *);
        ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
        ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
        int (*setlease)(struct file *, long, struct file_lock **);
    };

  • I found the linux utils here:

      http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/linuxutils/2_25/exports/linuxutils_2_25.tar.gz

    I'm trying to compile the linux device driver cmemk.ko

    Brett

     

     

  • Brett,

    Thanks for the pointers.  We were not aware of this recent kernel change.

    Officially, LinuxUtils (and therefore CMEM) is supported on DM365 using the LSP 2.10 release.  CMEM on other devices supports later GIT-based kernels, but not as late as the recent one that you're trying to use.  If you want to use LinuxUtils on DM365 with this new linux-davinci GIT kernel, you're kind of on your own to make the necessary changes.

    We don't have a fix for this (since we only just learned about this change through your build error).  Feel free to change cmemk.c yourself to accommodate this change.  I don't know the details of the required change, but I suspect that the existing CMEM ioctl() method implementation could simply move to the new unlocked_ioctl() interface (of course, with the removal of the initial 'inode' parameter) since cmemk.c code takes care to lock things when necessary.

    Once TI officially supports a part using a Linux kernel with this change, we will be required to make the changes to TI's LinuxUtils modules, but until then we can make no promises on supporting the new interface.

    Regards,

    - Rob

  • It should be an easy change. 

      http://comments.gmane.org/gmane.linux.kernel/1023121

    I will investigate.