コード例 #1
0
ファイル: kerneltools.py プロジェクト: hknyldz/pisitools
def installHeaders(extraHeaders=None):
    """ Install the files needed to build out-of-tree kernel modules. """

    extras = ["drivers/media/dvb-core",
              "drivers/media/dvb-frontends",
              "drivers/media/tuners",
              "drivers/media/platform"]

    if extraHeaders:
        extras.extend(extraHeaders)

    pruned = ["include", "scripts", "Documentation"]
    wanted = ["Makefile*", "Kconfig*", "Kbuild*", "*.sh", "*.pl", "*.lds"]

    suffix = __getSuffix()
    headersDirectoryName = "usr/src/linux-headers-%s" % suffix

    # Get the destination directory for header installation
    destination = os.path.join(get.installDIR(), headersDirectoryName)
    shelltools.makedirs(destination)

    # First create the skel
    find_cmd = "find . -path %s -prune -o -type f \( -name %s \) -print" % \
                (
                    " -prune -o -path ".join(["'./%s/*'" % l for l in pruned]),
                    " -o -name ".join(["'%s'" % k for k in wanted])
                ) + " | cpio -pVd --preserve-modification-time %s" % destination

    shelltools.system(find_cmd)

    # Install additional headers
    for headers in extras:
        shelltools.system("cp -a %s/*.h %s/%s" % (headers, destination, headers))

    # Install remaining headers
    shelltools.system("cp -a %s %s" % (" ".join(pruned), destination))

    # Cleanup directories
    shelltools.system("rm -rf %s/scripts/*.o" % destination)
    shelltools.system("rm -rf %s/scripts/*/*.o" % destination)
    shelltools.system("rm -rf %s/Documentation/DocBook" % destination)

    # Finally copy the include directories found in arch/
    shelltools.system("(find arch -name include -type d -print | \
                        xargs -n1 -i: find : -type f) | \
                        cpio -pd --preserve-modification-time %s" % destination)

    # Copy Modules.symvers and System.map
    shutil.copy("Module.symvers", "%s/" % destination)
    shutil.copy("System.map", "%s/" % destination)

    # Copy .config file which will be needed by some external modules
    shutil.copy(".config", "%s/" % destination)

    # Settle the correct build symlink to this headers
    pisilinuxtools.dosym("/%s" % headersDirectoryName, "/lib/modules/%s/build" % suffix)
    pisilinuxtools.dosym("build", "/lib/modules/%s/source" % suffix)
コード例 #2
0
ファイル: kerneltools.py プロジェクト: hknyldz/pisitools
def installLibcHeaders(excludes=None):
    headers_tmp = os.path.join(get.installDIR(), 'tmp-headers')
    headers_dir = os.path.join(get.installDIR(), 'usr/include')

    make_cmd = "O=%s INSTALL_HDR_PATH=%s/install" % (headers_tmp, headers_tmp)

    # Cleanup temporary header directory
    shelltools.system("rm -rf %s" % headers_tmp)

    # Create directories
    shelltools.makedirs(headers_tmp)
    shelltools.makedirs(headers_dir)
    
    ###################Workaround begins here ...
    #Workaround information -- http://patches.openembedded.org/patch/33433/
    cpy_src="%s/linux-*/arch/x86/include/generated" % (get.workDIR())
    cpy_tgt="%s/arch/x86/include" % (headers_tmp)
    shelltools.makedirs(cpy_tgt)
    
    copy_cmd ="cp -Rv %s %s " % (cpy_src, cpy_tgt)
    
    shelltools.system(copy_cmd)
    #######################Workaround ends here ...
    
    # make defconfig and install the headers
    autotools.make("%s defconfig" % make_cmd)
    autotools.rawInstall(make_cmd, "headers_install")

    oldwd = os.getcwd()

    shelltools.cd(os.path.join(headers_tmp, "install", "include"))
    shelltools.system("find . -name '.' -o -name '.*' -prune -o -print | \
                       cpio -pVd --preserve-modification-time %s" % headers_dir)

    # Remove sound/ directory which is installed by alsa-headers
    shelltools.system("rm -rf %s/sound" % headers_dir)

    # Remove possible excludes given by actions.py
    if excludes:
        shelltools.system("rm -rf %s" % " ".join(["%s/%s" % (headers_dir, exc.strip("/")) for exc in excludes]))

    shelltools.cd(oldwd)

    # Remove tmp directory
    shelltools.system("rm -rf %s" % headers_tmp)