Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tlug: RedHat head-banging



On Fri, 19 Mar 1999, Dmytro Kovalev wrote:

> Any ideas how do they find proper kernel revision number? 

Stock modutils uses this code (edited for clarity):

static char *search_module_path(char *base)
{
  static const char default_path[] =
    ".:"
    "/linux/modules:"
    "/lib/modules/%s/fs:"
    "/lib/modules/%s/net:"
    (and so on, down the list of possible directories)

  char *path;
  struct utsname uts_info;

  path = (char *)default_path;
  uname(&uts_info);

  for (p = strtok(path, ":"); p != NULL ; p = strtok(NULL, ":"))
    {
      struct stat sb;

      len = snprintf(filename, PATH_MAX, p, uts_info.release);
      len += snprintf(filename+len, PATH_MAX-len, "/%s", base);

      if (stat(filename, &sb) == 0 && S_ISREG(sb.st_mode))
        return filename;

      snprintf(filename+len, PATH_MAX-len, ".o");

      if (stat(filename, &sb) == 0 && S_ISREG(sb.st_mode))
        return filename;
    }

  ( ... and on it goes ... )
}

It's going to go down the list, filling in possible %s with the kernel
rev, and attempt to load modules in the cooked pathlist.

> If I compile kernel and "make install_modules" they go into
> /lib/modules/2.0.36

As it should.  If a kernel is changed such that its modules are no longer
compatible, that kernel needs to have a different version number.

> Which directory then RH will pick up on next reboot?

I have no idea.  It depends on whether they modified their modutils, etc.

-- Chris

-------------------------------------------------------------------
Next Nomikai: March 19 (Fri), 19:30  Tengu TokyoEkiMae 03-3275-3691
Next Technical Meeting: April 10 (Sat), 12:30   place: Temple Univ.
-------------------------------------------------------------------
more info: http://www.tlug.gr.jp        Sponsor: Global Online Japan


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links