• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Development Tools » Code Composer Studio » Code Composer Forum » #include <linux/module.h> is showing as an unresolved inclusion even though make compiles succesfully
Share
Code Composer Studio
  • Forum
  • Announcements
Options
  • Subscribe via RSS
Common Questions
  • Code Composer Studio Forum Usage Guidelines

  • Resources
  • Code Composer Studio (CCStudio) Product Folder
  • Troubleshooting CCS
  • CCS Wiki
  • Download CCS
  • Order CCS
  • Tools Insider Blog
  • Bug Tracking
  • Forums

    #include <linux/module.h> is showing as an unresolved inclusion even though make compiles succesfully

    This question is not answered
    Christopher Grey
    Posted by Christopher Grey
    on Apr 04 2012 14:04 PM
    Intellectual370 points

    I'm trying to get myself setup to do kernel driver development. So I start where everybody does, writing the hello world kernel module. I did this 1st pointed at the Ubuntu Linux stuff. Then updated the makefile for cross-compiling the same driver code for a Beaglebone's Sitara AM-335x processor. After getting the makefile paths updated, I now have that working and runnable on the Beaglebone.

    After importing the very simple project into Code Composer Studio v5.1, CCS indicates that the #include <linux/module.h> is an unresolved inclusion. I find that hard to believe since it makes just fine. However after searching through the SDK, I don't find a module.h anywhere in there. I recall the install also stuck something related to arm-arago-gnueabi- in my /usr directory, so I also did a search in there and didn't see anything. I suspect the module.h is somewhere on my machine, it's just in a folder I'm not looking in. So there's some detail I'm missing, and evidently CCS is missing it too about where to find it. Although if I search through the Linux source that Ubuntu is running (/usr/src/linux-headers-3.0.0-17/include/linux), there is a module.h file.

    So in newbie explanation level detail, what's the deal with <linux/module.h> resolving when I run make, but not really existing when go look for it in my TI SDK installation folder (SDK 5.03.03)? And more importantly, how do I fix this in Code Composer so I can go back to trusting what it is telling me about the code I'm writing?

    Once I get past the hello world phase of getting to module driver development, it's my intention to move onto some existing code that's been written but is very dated code that I suspect was written for Linux 2.4.x and needs to be updated to compile for a 2.6/3.x Linux kernel. But before I can make any headway there, I need to understand some fundamentals about how kernel modules are built that isn't being explained in any of the Google searches or in the documentation I'm reading.

    cross compile arago module.h unresolved inclusion
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Christopher Grey
      Posted by Christopher Grey
      on Apr 04 2012 14:12 PM
      Intellectual370 points

      By the way, here's what my hello world kernel module code looks like....

      Makefile:

      obj-m += hello-1.o
      #    KERNELDIR ?= /lib/modules/$(shell uname -r)/build
          TOOLCHAIN ?= /home/cgrey/ti-sdk-am335x-evm-05.03.03.00
          KERNELDIR ?= $(TOOLCHAIN)/board-support/linux-am33x
          CROSS_COMPILER ?= $(TOOLCHAIN)/linux-devkit/bin
          PWD := $(shell pwd)
      all:
          $(MAKE) -C $(KERNELDIR) M=$(PWD) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILER)/arm-arago-linux-gnueabi- modules

      clean:
          $(MAKE) -C $(KERNELDIR) M=$(PWD) clean

      And the C-code:

      /*  
       *  hello−1.c − The simplest kernel module.
       */
      #include <linux/module.h>       /* Needed by all modules */
      #include <linux/kernel.h>       /* Needed for KERN_INFO */
      int init_module(void)
      {
              printk(KERN_INFO "Hello world 1.\n");
              /*
               * A non 0 return means init_module failed; module can't be loaded.
               */
              return 0;
      }
      void cleanup_module(void)
      {
              printk(KERN_INFO "Goodbye world 1.\n");
      }


      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Christopher Grey
      Posted by Christopher Grey
      on Apr 05 2012 06:50 AM
      Intellectual370 points

      Well after getting some sleep and looking at this differently, I see now I shouldn't trust the GUI for much. When I use the "find" command in the terminal, I see there is a module.h file in my SDK...lots of them in fact. And there is one right where there's supposed to be. So that solves that mystery and I feel like a total noob. 

      Knowing the file does exist, I'm assuming the only thing to do at this point is figure out how to get CCS to search into the includes folders that have these files. Since there are lots of .h file folders and subfolders, is there a way to tell CCS that you want to include a folder AND all of its subfolders in the indexing search for *.c/*.h files? If so, I'm not finding it. After adding the folder that will allow CCS to locate the module.h file, it now correctly shows the file as a known inclusion and lets me navigate to it via F3. However inside this file, there are references to other .h files that are in an /asm folder. For example, there's #include <asm/module.h> that CCS can't find. When I hit F3, it comes up and says it couldn't find the file in red at the bottom. The interesting thing is the file isn't underlined or identified as an unidentified inclusion. I'm assuming that's just a sign the indexer needs to run. Looking back at the find results of my original module.h search, I find that there are a number of asm/module.h files that look like they are for different platforms. Since I'm working with an ARM, I added that path to my project's includes. And now CCS seems to be working as I expect. I guess it was just late in the day yesterday and I wasn't seeing the forest for all the damn trees in the way.

      Now I'm having to tell CCS all this info manually. I'm assuming that the correct paths to look in are known by make thanks to already created makefiles that key off of the ARCH= choice. But my question at this point...is there a way I can get CCS to be more intelligent about "figuring out" the proper include paths for itself based on a make target I define in CCS? Or is that asking too much of CCS?

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    TI E2E™ Community
    • Support Forums
    • Blogs
    • Videos
    • Groups
    • Site Support & Feedback
    • Settings
    TI E2E™ Community Groups
    • TI University Program
    • Make the Switch
    • Microcontroller Projects
    • Motor Drive & Control
    Other Communities
    • Deyisupport
    • Designsomething.org
    • beagleboard.org
    • TI on Element 14
    • TI on TechXchangeSM
    Other Technical & Support Resources
    • WEBENCH® Design Center
    • Product Information Centers
    • Technical Documents
    • TI Design Network
    • TI Technical Articles
    • TI Training

    All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

    Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

    Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
    TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

    TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
    embedded processors, along with software, tools and the industry’s largest sales/support staff.

    © Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
    Trademarks | Privacy Policy | Terms of Use