예제 #1
0
파일: kernel.py 프로젝트: Poohby/autotest
    def build(self, make_opts = '', logfile = '', extraversion='autotest'):
        """build the kernel

        make_opts
                additional options to make, if any
        """
        os_dep.commands('gcc', 'make')
        if logfile == '':
            logfile = os.path.join(self.log_dir, 'kernel_build')
        os.chdir(self.build_dir)
        if extraversion:
            self.extraversion(extraversion)
        self.set_cross_cc()
        # setup_config_file(config_file, config_overrides)

        # Not needed on 2.6, but hard to tell -- handle failure
        utils.system('make dep', ignore_status=True)
        threads = 2 * utils.count_cpus()
        build_string = 'make -j %d %s %s' % (threads, make_opts,
                                     self.build_target)
                                # eg make bzImage, or make zImage
        print build_string
        utils.system(build_string)
        if kernel_config.modules_needed('.config'):
            utils.system('make -j %d modules' % (threads))

        kernel_version = self.get_kernel_build_ver()
        kernel_version = re.sub('-autotest', '', kernel_version)
        self.logfile.write('BUILD VERSION: %s\n' % kernel_version)

        utils.force_copy(self.build_dir+'/System.map',
                                  self.results_dir)
예제 #2
0
    def __init__(self, file_img, file_size):
        """
        Creates a virtual partition, keeping record of the device created
        under /dev/mapper (device attribute) so test writers can use it
        on their filesystem tests.

        @param file_img: Path to the desired disk image file.
        @param file_size: Size of the desired image in Bytes.
        """
        logging.debug('Sanity check before attempting to create virtual '
                      'partition')
        try:
            os_dep.commands('sfdisk', 'losetup', 'kpartx')
        except ValueError, e:
            e_msg = 'Unable to create virtual partition: %s' % e
            raise error.AutotestError(e_msg)
예제 #3
0
    def __init__(self, file_img, file_size):
        """
        Creates a virtual partition, keeping record of the device created
        under /dev/mapper (device attribute) so test writers can use it
        on their filesystem tests.

        @param file_img: Path to the desired disk image file.
        @param file_size: Size of the desired image in Bytes.
        """
        logging.debug('Sanity check before attempting to create virtual '
                      'partition')
        try:
            os_dep.commands('sfdisk', 'losetup', 'kpartx')
        except ValueError, e:
            e_msg = 'Unable to create virtual partition: %s' % e
            raise error.AutotestError(e_msg)
예제 #4
0
    def setup(self, tarball='osdl-aim-7.0.1.13.tar.gz'):
        tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir)
        utils.extract_tarball_to_dir(tarball, self.srcdir)

        self.job.setup_dep(['libaio'])
        libs = '-L' + self.autodir + '/deps/libaio/lib -laio'
        cflags = '-I ' + self.autodir + '/deps/libaio/include'
        var_libs = 'LIBS="' + libs + '"'
        var_cflags = 'CFLAGS="' + cflags + '"'
        self.make_flags = var_libs + ' ' + var_cflags

        os_dep.commands('autoconf', 'automake', 'libtoolize')
        os.chdir(self.srcdir)
        utils.system('./bootstrap')
        utils.system('./configure')
        # we can't use patch here, as the Makefile is autogenerated
        # so we can't tell exactly what it looks like.
        # Perform some foul in-place sed hackery instead.
        for file in ('Makefile', 'src/Makefile'):
            utils.system('sed -i "s/^CFLAGS =/CFLAGS +=/" ' + file)
            utils.system('sed -i "s/^LIBS =/LIBS +=/" ' + file)
        utils.system(self.make_flags + ' make')
        os.rename('src/reaim', 'reaim')
예제 #5
0
파일: reaim.py 프로젝트: Poohby/autotest
    def setup(self, tarball = 'osdl-aim-7.0.1.13.tar.gz'):
        tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir)
        utils.extract_tarball_to_dir(tarball, self.srcdir)

        self.job.setup_dep(['libaio'])
        libs = '-L' + self.autodir + '/deps/libaio/lib -laio'
        cflags = '-I ' + self.autodir + '/deps/libaio/include'
        var_libs = 'LIBS="' + libs + '"'
        var_cflags  = 'CFLAGS="' + cflags + '"'
        self.make_flags = var_libs + ' ' + var_cflags

        os_dep.commands('autoconf', 'automake', 'libtoolize')
        os.chdir(self.srcdir)
        utils.system('./bootstrap')
        utils.system('./configure')
        # we can't use patch here, as the Makefile is autogenerated
        # so we can't tell exactly what it looks like.
        # Perform some foul in-place sed hackery instead.
        for file in ('Makefile', 'src/Makefile'):
            utils.system('sed -i "s/^CFLAGS =/CFLAGS +=/" ' + file)
            utils.system('sed -i "s/^LIBS =/LIBS +=/" ' + file)
        utils.system(self.make_flags + ' make')
        os.rename('src/reaim', 'reaim')
예제 #6
0
파일: xen.py 프로젝트: wenhann/chromiumos
    def build(self, make_opts = '', logfile = '', extraversion='autotest'):
        """build xen

        make_opts
                additional options to make, if any
        """
        self.log('running build')
        os_dep.commands('gcc', 'make')
        # build xen with extraversion flag
        os.environ['XEN_EXTRAVERSION'] = '-unstable-%s'% extraversion
        if logfile == '':
            logfile = os.path.join(self.log_dir, 'xen_build')
        os.chdir(self.build_dir)
        self.log('log_dir: %s ' % self.log_dir)
        self.job.logging.tee_redirect_debug_dir(self.log_dir, log_name=logfile)

        # build xen hypervisor and user-space tools
        targets = ['xen', 'tools']
        threads = 2 * utils.count_cpus()
        for t in targets:
            build_string = 'make -j %d %s %s' % (threads, make_opts, t)
            self.log('build_string: %s' % build_string)
            utils.system(build_string)

        # make a kernel job out of the kernel from the xen src if one isn't provided
        if self.kjob is None:
            # get xen kernel tree ready
            self.log("prep-ing xen'ified kernel source tree")
            utils.system('make prep-kernels')

            v = self.get_xen_kernel_build_ver()
            self.log('building xen kernel version: %s' % v)

            # build xen-ified kernel in xen tree
            kernel_base_tree = os.path.join(self.build_dir, \
                    'linux-%s' % self.get_xen_kernel_build_ver())

            self.log('kernel_base_tree = %s' % kernel_base_tree)
            # fix up XENGUEST value in EXTRAVERSION; we can't have
            # files with '$(XENGEUST)' in the name, =(
            self.fix_up_xen_kernel_makefile(kernel_base_tree)

            # make the kernel job
            self.kjob = self.job.kernel(kernel_base_tree)

            # hardcoding dom0 config (no modules for testing, yay!)
            # FIXME: probe host to determine which config to pick
            c = self.build_dir + '/buildconfigs/linux-defconfig_xen0_x86_32'
            self.log('using kernel config: %s ' % c)
            self.kjob.config(c)

            # Xen's kernel tree sucks; doesn't use bzImage, but vmlinux
            self.kjob.set_build_target('vmlinuz')

            # also, the vmlinuz is not out in arch/*/boot, ARGH! more hackery
            self.kjob.set_build_image(self.job.tmpdir + '/build/linux/vmlinuz')

        self.kjob.build()

        self.job.logging.restore()

        xen_version = self.get_xen_build_ver()
        self.log('BUILD VERSION: Xen: %s Kernel:%s' % \
                        (xen_version, self.kjob.get_kernel_build_ver()))