diff --git a/pisi/actionsapi/kerneltools.py b/pisi/actionsapi/kerneltools.py index 3391d346..0106337d 100644 --- a/pisi/actionsapi/kerneltools.py +++ b/pisi/actionsapi/kerneltools.py @@ -27,6 +27,9 @@ import pisi.actionsapi.autotools as autotools import pisi.actionsapi.pisitools as pisitools import pisi.actionsapi.shelltools as shelltools + +# Internal helpers for versioning stuff + def __getFlavour(): flavour = "" try: @@ -36,6 +39,12 @@ def __getFlavour(): return flavour +def __getSuffix(): + # Set suffix, e.g. "2.6.29_rc8-default" + suffix = "%s-%s" % (get.srcVERSION(), get.srcRELEASE()) + if __getFlavour(): + suffix += "-%s" % __getFlavour() + def __getExtraVersion(): extraversion = "" try: @@ -55,6 +64,12 @@ def __getExtraVersion(): return extraversion +def __getHeadersDirectoryName(): + return "usr/src/linux-headers-%s" % __getSuffix() + + +# Public callables + def configure(): # Set EXTRAVERSION extraversion = __getExtraVersion() @@ -76,34 +91,42 @@ def build(): autotools.make() def install(): - # Set suffix, e.g. "2.6.29_rc8-default" - suffix = "%s-%s" % (get.srcVERSION(), get.srcRELEASE()) - if __getFlavour(): - suffix += "-%s" % __getFlavour() + suffix = __getSuffix() - # Install the modules into /lib/modules - autotools.rawInstall("INSTALL_MOD_PATH=%s/" % get.installDIR(), - "modules_install") + # Check if loadable module support is available or not before doing module specific tasks + if re.search("CONFIG_MODULES=y", open(".config", "r").read().strip()): - # Install bzImage, symvers and System.map - pisitools.insinto("/lib/modules/%s/" % suffix, "System.map") - pisitools.insinto("/lib/modules/%s/" % suffix, "Module.symvers") + # Install the modules into /lib/modules + autotools.rawInstall("INSTALL_MOD_PATH=%s/" % get.installDIR(), + "modules_install") + + # Install Module.symvers and System.map + pisitools.insinto("/lib/modules/%s/" % suffix, "System.map") + pisitools.insinto("/lib/modules/%s/" % suffix, "Module.symvers") + + # Remove wrong symlinks + pisitools.remove("/lib/modules/%s/source" % suffix) + pisitools.remove("/lib/modules/%s/build" % suffix) + + # Remove modules.* files, they will autogenerated on next boot + # TODO: Ubuntu doesn't remove modules.order, reinvestigate. + pisitools.remove("/lib/modules/%s/modules.*" % suffix) + + + # Install kernel image + # TODO: For supporting more architectures in the future, we'll need a more + # flexible method here instead of hardcoding x86. pisitools.insinto("/boot/", "arch/x86/boot/bzImage", "kernel-%s" % suffix) - # Remove wrong symlinks - pisitools.remove("/lib/modules/%s/source" % suffix) - pisitools.remove("/lib/modules/%s/build" % suffix) - - # Remove modules.* files, they will autogenerated on next boot - # TODO: Ubuntu doesn't remove modules.order, reinvestigate. - pisitools.remove("/lib/modules/%s/modules.*" % suffix) def installHeaders(extra=[]): """ Install the files needed to build out-of-tree kernel modules. """ + pruned = ["include", "scripts"] wanted = ["Makefile*", "Kconfig*", "Kbuild*", "*.sh", "*.pl", "*.lds"] - destination = "%s/usr/src/linux-headers-%s" % (get.installDIR(), suffix) + # Get the destination directory for header installation + destination = os.path.join(get.installDIR(), __getHeadersDirectoryName()) shelltools.makedirs(destination) # First create the skel @@ -127,8 +150,21 @@ def installHeaders(extra=[]): xargs -n1 -i: find : -type f) | \ cpio -pd --preserve-modification-time %s" % destination) + # Settle the correct build symlink to this headers + pisitools.dosym("/%s" % __getHeadersDirectoryName(), + "/lib/modules/%s/build" % suffix) + def installSource(): - pass + destination = "usr/src/linux-source-%s" % __getSuffix() + + pisitools.dodir("/usr/src") + shelltools.copytree("../%s/" % WorkDir, os.path.join(get.installDIR(), destination)) + + # Cleanup the installed source + shelltools.cd(os.path.join(get.installDIR(), destination)) + autotools.make("clean") + autotools.make("modules_prepare") + def installDocumentation(): pass