Beispiel #1
0
def init():
    import bitsconfig
    bitsconfig.init()

    import grubcmds
    grubcmds.register()

    import bits
    import os
    try:
        import acpi
        mcfg = acpi.parse_table("MCFG")
        if mcfg is None:
            print 'No ACPI MCFG Table found. This table is required for PCI Express.'
        else:
            for mcfg_resource in mcfg.resources:
                if mcfg_resource.segment == 0:
                    if mcfg_resource.address >= (1 << 32):
                        print "Error: PCI Express base above 32 bits is unsupported by BITS"
                        break
                    bits.pcie_set_base(mcfg_resource.address)
                    os.putenv('pciexbase', '{:#x}'.format(mcfg_resource.address))
                    os.putenv('pcie_startbus', '{:#x}'.format(mcfg_resource.start_bus))
                    os.putenv('pcie_endbus', '{:#x}'.format(mcfg_resource.end_bus))
                    break
            else:
                print "Error initializing PCI Express base from MCFG: no resource with segment 0"
    except Exception as e:
        print "Error occurred initializing PCI Express base from MCFG:"
        print e

    import readline
    readline.init()
    import rlcompleter_extra

    import testacpi
    testacpi.register_tests()
    try:
        import testefi
        testefi.register_tests()
    except ImportError as e:
        pass
    import testsmrr
    testsmrr.register_tests()
    import smilatency
    smilatency.register_tests()
    import mptable
    mptable.register_tests()

    from cpudetect import cpulib
    cpulib.register_tests()

    import testsuite
    testsuite.finalize_cfgs()

    import sysinfo
    sysinfo.log_sysinfo()
    import smbios
    smbios.log_smbios_info()
    try:
        import efi
        efi.log_efi_info()
    except ImportError as e:
        pass

    batch = bitsconfig.config.get("bits", "batch").strip()
    if batch:
        import redirect
        print "\nBatch mode enabled:", batch
        for batch_keyword in batch.split():
            print "\nRunning batch operation", batch_keyword
            try:
                if batch_keyword == "test":
                    testsuite.run_all_tests()
                with redirect.logonly():
                    if batch_keyword == "acpi":
                        import acpi
                        print acpi.dumptables()
                    if batch_keyword == "smbios":
                        import smbios
                        smbios.dump_raw()
            except:
                print "\nError in batch operation", batch_keyword
                import traceback
                traceback.print_exc()

        print "\nBatch mode complete\n"
        redirect.write_logfile("/boot/bits-log.txt")

    import __builtin__
    __builtin__.help = _Helper()

    import pydoc
    import ttypager
    pydoc.getpager = ttypager.getpager
Beispiel #2
0
def init():
    import_start_msg("bitsconfig")
    import bitsconfig
    end_msg()
    init_start_msg("bitsconfig")
    bitsconfig.init()
    end_msg()

    import_start_msg("grubcmds")
    import grubcmds
    end_msg()
    init_start_msg("grubcmds")
    grubcmds.register()
    end_msg()

    import_start_msg("bits")
    import bits
    end_msg()
    import os
    import sys
    try:
        import acpi
        init_start_msg("PCI Express MCFG detection", False)
        mcfg = acpi.parse_table("MCFG")
        if mcfg is None:
            print 'No ACPI MCFG Table found. This table is required for PCI Express.'
        else:
            for mcfg_resource in mcfg.resources:
                if mcfg_resource.segment == 0:
                    if mcfg_resource.address >= (1 << 32):
                        print "Error: PCI Express base above 32 bits is unsupported by BITS"
                        break
                    bits.pcie_set_base(mcfg_resource.address)
                    os.putenv('pciexbase', '{:#x}'.format(mcfg_resource.address))
                    os.putenv('pcie_startbus', '{:#x}'.format(mcfg_resource.start_bus))
                    os.putenv('pcie_endbus', '{:#x}'.format(mcfg_resource.end_bus))
                    break
            else:
                print "Error initializing PCI Express base from MCFG: no resource with segment 0"
    except Exception as e:
        print "Error occurred initializing PCI Express base from MCFG:"
        print e
    init_end_msg("PCI Express MCFG detection")

    import_start_msg("readline")
    import readline
    end_msg()
    init_start_msg("readline")
    readline.init()
    end_msg()
    import_start_msg("rlcompleter_extra")
    import rlcompleter_extra
    end_msg()

    import_start_msg("testacpi")
    import testacpi
    end_msg()
    init_start_msg("testacpi")
    testacpi.register_tests()
    end_msg()
    if sys.platform == "BITS-EFI":
        import_start_msg("testefi")
        import testefi
        end_msg()
        init_start_msg("testefi")
        testefi.register_tests()
        end_msg()
    import_start_msg("testsmrr")
    import testsmrr
    end_msg()
    testsmrr.register_tests()
    import_start_msg("smilatency")
    import smilatency
    end_msg()
    init_start_msg("smilatency")
    smilatency.register_tests()
    end_msg()
    import_start_msg("mptable")
    import mptable
    end_msg()
    init_start_msg("mptable")
    mptable.register_tests()
    end_msg()
    import_start_msg("cpulib")
    from cpudetect import cpulib
    end_msg()
    init_start_msg("cpulib")
    cpulib.register_tests()
    end_msg()

    import_start_msg("testsuite")
    import testsuite
    end_msg()
    init_start_msg("testsuite")
    testsuite.finalize_cfgs()
    end_msg()
    import_start_msg("sysinfo")
    import sysinfo
    end_msg()
    init_start_msg("sysinfo", False)
    sysinfo.log_sysinfo()
    init_end_msg("sysinfo")
    import_start_msg("smbios")
    import smbios
    end_msg()
    init_start_msg("smbios", False)
    smbios.log_smbios_info()
    init_end_msg("smbios")
    if sys.platform == "BITS-EFI":
        import_start_msg("efi")
        import efi
        end_msg()
        init_start_msg("efi", False)
        efi.log_efi_info()
        init_end_msg("efi")

    batch = bitsconfig.config.get("bits", "batch").strip()
    if batch:
        import redirect
        print "\nBatch mode enabled:", batch
        for batch_keyword in batch.split():
            print "\nRunning batch operation", batch_keyword
            try:
                if batch_keyword == "test":
                    testsuite.run_all_tests()
                with redirect.logonly():
                    if batch_keyword == "acpi":
                        import acpi
                        print acpi.dumptables()
                    if batch_keyword == "smbios":
                        import smbios
                        smbios.dump_raw()
            except:
                print "\nError in batch operation", batch_keyword
                import traceback
                traceback.print_exc()

        print "\nBatch mode complete\n"
        redirect.write_logfile("/boot/bits-log.txt")

    import_start_msg("cpumenu")
    import cpumenu
    end_msg()
    init_start_msg("cpumenu")
    cpumenu.generate_cpu_menu()
    end_msg()

    import_start_msg("bootmenu")
    import bootmenu
    end_msg()
    init_start_msg("bootmenu")
    bootmenu.generate_boot_menu()
    end_msg()

    import_start_msg("mwaitmenu")
    import mwaitmenu
    end_msg()
    init_start_msg("mwaitmenu")
    mwaitmenu.generate_mwait_menu()
    end_msg()

    import_start_msg("builtin")
    import __builtin__
    end_msg()
    __builtin__.help = _Helper()
Beispiel #3
0
def init():
    with import_annotation("bitsconfig"):
        import bitsconfig
    with init_annotation("bitsconfig"):
        bitsconfig.init()

    with import_annotation("grubcmds"):
        import grubcmds
    with init_annotation("grubcmds"):
        grubcmds.register()

    with import_annotation("bits"):
        import bits

    with import_annotation("os"):
        import os

    with import_annotation("sys"):
        import sys
    sys.argv = []

    with init_annotation("PCI Express MCFG detection"):
        try:
            import acpi
            mcfg = acpi.parse_table("MCFG")
            if mcfg is None:
                print 'No ACPI MCFG Table found. This table is required for PCI Express.'
            else:
                for mcfg_resource in mcfg.resources:
                    if mcfg_resource.segment == 0:
                        if mcfg_resource.address >= (1 << 32):
                            print "Error: PCI Express base above 32 bits is unsupported by BITS"
                            break
                        bits.pcie_set_base(mcfg_resource.address)
                        os.putenv('pciexbase',
                                  '{:#x}'.format(mcfg_resource.address))
                        os.putenv('pcie_startbus',
                                  '{:#x}'.format(mcfg_resource.start_bus))
                        os.putenv('pcie_endbus',
                                  '{:#x}'.format(mcfg_resource.end_bus))
                        break
                else:
                    print "Error initializing PCI Express base from MCFG: no resource with segment 0"
        except Exception as e:
            print "Error occurred initializing PCI Express base from MCFG:"
            print e

    with import_annotation("readline"):
        import readline
    with init_annotation("readline"):
        readline.init()
    with import_annotation("rlcompleter_extra"):
        import rlcompleter_extra

    with import_annotation("testacpi"):
        import testacpi
    with init_annotation("testacpi"):
        testacpi.register_tests()

    if sys.platform == "BITS-EFI":
        with import_annotation("testefi"):
            import testefi
        with init_annotation("testefi"):
            testefi.register_tests()

    with import_annotation("testsmrr"):
        import testsmrr
    with init_annotation("testsmrr"):
        testsmrr.register_tests()

    with import_annotation("smilatency"):
        import smilatency
    with init_annotation("smilatency"):
        smilatency.register_tests()

    with import_annotation("mptable"):
        import mptable
    with init_annotation("mptable"):
        mptable.register_tests()

    with import_annotation("cpulib"):
        from cpudetect import cpulib
    with init_annotation("cpulib"):
        cpulib.register_tests()

    with import_annotation("testsuite"):
        import testsuite
    with init_annotation("testsuite"):
        testsuite.finalize_cfgs()

    with import_annotation("sysinfo"):
        import sysinfo
    with init_annotation("sysinfo"):
        sysinfo.log_sysinfo()

    with import_annotation("smbios"):
        import smbios
    with init_annotation("smbios"):
        smbios.log_smbios_info()

    if sys.platform == "BITS-EFI":
        with import_annotation("efi"):
            import efi
        with init_annotation("efi"):
            efi.log_efi_info()
            efi.register_keyboard_interrupt_handler()

    batch = bitsconfig.config.get("bits", "batch").strip()
    if batch:
        import redirect
        print "\nBatch mode enabled:", batch
        for batch_keyword in batch.split():
            print "\nRunning batch operation", batch_keyword
            try:
                if batch_keyword == "test":
                    testsuite.run_all_tests()
                with redirect.logonly():
                    if batch_keyword == "acpi":
                        import acpi
                        print acpi.dumptables()
                    if batch_keyword == "smbios":
                        import smbios
                        smbios.dump_raw()
            except:
                print "\nError in batch operation", batch_keyword
                import traceback
                traceback.print_exc()

        print "\nBatch mode complete\n"
        redirect.write_logfile("/boot/bits-log.txt")

    with import_annotation("cpumenu"):
        import cpumenu
    with init_annotation("cpumenu"):
        cpumenu.generate_cpu_menu()

    with import_annotation("bootmenu"):
        import bootmenu
    with init_annotation("bootmenu"):
        bootmenu.generate_boot_menu()

    with import_annotation("mwaitmenu"):
        import mwaitmenu
    with init_annotation("mwaitmenu"):
        mwaitmenu.generate_mwait_menu()

    with import_annotation("__builtin__"):
        import __builtin__
    with init_annotation("__builtin__"):
        __builtin__.help = _Helper()