编译pciutils在windows 环境上使用的方法:
新方法:
使用交叉编译的方法,在使用Linux环境上编译,Windows上运行即可:
- 使用Linux系统 (e.g. Ubuntu、Debian),或使用在Windows的上的Linux子系统(Windows应用商店下载安装Ubuntu等)。
- 安装交叉编译工具
mingw-w64
(Ubuntu命令sudo apt install mingw-64
) - 在pciutils 文件夹下
- 运行
make CROSS_COMPILE=x86_64-w64-mingw32- HOST=x86_64-windows ZLIB=no IDSDIR=""
(来自README.Windows)- 完成(可看到lspci.exe,setpci.exe,example.exe等,拷贝到Windows上即可运行)
pciutils源码路径:Tags · pciutils/pciutils
问题列表:
- 编译注意事项和要求见:README.Windows
- 详细命令参数见:pcilib.man
- Cannot retrieve resource data of PCI device on Windows · Issue #108
· pciutils/pciutils - cannot access PCI configuration space on Windows · Issue #147 ·
pciutils/pciutils
附:
Windows debug:设置Windows调试/测试模式 - 内核开发
bcdedit /set debug on 启用或禁用操作系统项的内核调试。关闭用off
bcdedit /set testsigning on
启用测试签名选项,可以加载没有数字签名的驱动程序。
注意,如果电脑开启了安全启动或者BitLocker,可能需要先关闭它们才能修改这个选项。
启用测试签名后,Windows 会在桌面的四个角落显示一个水印,提醒你系统处于测试模式。
关闭用off
bcdedit /set loadoptions ddisable_integrity_checks
禁用完整性检查,可以加载没有数字签名的驱动程序。这个选项只对 32 位版本的 Windows Vista 和更高版本的 Windows 有效。
bcdedit /deletevalue loadoptions 删除完整性检查选项
bcdedit /set nointegritychecks on 禁用驱动程序强制签名的,同bcdedit /set loadoptions ddisable_integrity_checks
C:\WINDOWS\system32> bcdedit /?
BCDEDIT - Boot Configuration Data Store Editor
The Bcdedit.exe command-line tool modifies the boot configuration data store.
The boot configuration data store contains boot configuration parameters and
controls how the operating system is booted. These parameters were previously
in the Boot.ini file (in BIOS-based operating systems) or in the nonvolatile
RAM entries (in Extensible Firmware Interface-based operating systems). You can
use Bcdedit.exe to add, delete, edit, and append entries in the boot
configuration data store.
For detailed command and option information, type bcdedit.exe /? <command>. For
example, to display detailed information about the /createstore command, type:
bcdedit.exe /? /createstore
For an alphabetical list of topics in this help file, run "bcdedit /? TOPICS".
Commands that operate on a store
================================
/store Used to specify a BCD store other than the current system default.
/createstore Creates a new and empty boot configuration data store.
/export Exports the contents of the system store to a file. This file
can be used later to restore the state of the system store.
/import Restores the state of the system store using a backup file
created with the /export command.
/sysstore Sets the system store device (only affects EFI systems, does
not persist across reboots, and is only used in cases where
the system store device is ambiguous).
Commands that operate on entries in a store
===========================================
/copy Makes copies of entries in the store.
/create Creates new entries in the store.
/delete Deletes entries from the store.
/mirror Creates mirror of entries in the store.
Run bcdedit /? ID for information about identifiers used by these commands.
Commands that operate on entry options
======================================
/deletevalue Deletes entry options from the store.
/set Sets entry option values in the store.
Run bcdedit /? TYPES for a list of datatypes used by these commands.
Run bcdedit /? FORMATS for a list of valid data formats.
Commands that control output
============================
/enum Lists entries in the store.
/v Command-line option that displays entry identifiers in full,
rather than using names for well-known identifiers.
Use /v by itself as a command to display entry identifiers
in full for the ACTIVE type.
Running "bcdedit" by itself is equivalent to running "bcdedit /enum ACTIVE".
Commands that control the boot manager
======================================
/bootsequence Sets the one-time boot sequence for the boot manager.
/default Sets the default entry that the boot manager will use.
/displayorder Sets the order in which the boot manager displays the
multiboot menu.
/timeout Sets the boot manager time-out value.
/toolsdisplayorder Sets the order in which the boot manager displays
the tools menu.
Commands that control Emergency Management Services for a boot application
==========================================================================
/bootems Enables or disables Emergency Management Services
for a boot application.
/ems Enables or disables Emergency Management Services for an
operating system entry.
/emssettings Sets the global Emergency Management Services parameters.
Command that control debugging
==============================
/bootdebug Enables or disables boot debugging for a boot application.
/dbgsettings Sets the global debugger parameters.
/debug Enables or disables kernel debugging for an operating system
entry.
/hypervisorsettings Sets the hypervisor parameters.
Command that control remote event logging
=========================================
/eventsettings Sets the global remote event logging parameters.
/event Enables or disables remote event logging for an operating
system entry.
C:\WINDOWS\system32> bcdedit /? TYPES
TYPES
The /set and /deletevalue commands require a <datatype> as a parameter.
<datatype> uniquely identifies both the data format and meaning of the value.
Data types are identified using either a name or a custom type. The names are
listed below, along with their data formats (in parentheses) and a short
description of the custom type. If a format is not specified, then the
description lists the literal values that you can use for that type. For
information about data formats, run "bcdedit /? formats".
The following types are valid for any entry. For information about types that
are specific to a particular entry, such as boot manager entries or the Windows
OS Loader entries, see the end of this help topic.
Entries
=======
DESCRIPTION (string) Defines the description of the entry.
PATH (string) Defines the path to the application.
DEVICE (device) Defines the device that the application resides on.
INHERIT (list) Defines the list of entries to be inherited.
For information about additional types for device objects, run
"bcdedit /? TYPES DEVOBJECT".
For information about additional types for particular applications,
run "bcdedit /? TYPES <apptype>", where <apptype> is one of the following:
BOOTAPP Boot applications. These types also apply to the boot manager,
memory diagnostic application, Windows OS loader, and the resume
application.
BOOTMGR Boot manager.
BOOTSECTOR Boot sector application.
CUSTOMTYPES Custom types.
DEVOBJECT Device object additional options.
FWBOOTMGR Firmware boot manager
MEMDIAG Memory diagnostic application
NTLDR OS loader that shipped with earlier Windows OS
OSLOADER Windows Vista OS loader
RESUME Resume application
bcdedit /? TYPES BOOTAPP
bcdedit /? TYPES BOOTMGR
bcdedit /? TYPES BOOTSECTOR
bcdedit /? TYPES DEVOBJECT
bcdedit /? TYPES FWBOOTMGR
bcdedit /? TYPES MEMDIAG
bcdedit /? TYPES NTLDR
bcdedit /? TYPES OSLOADER
bcdedit /? TYPES RESUME
C:\WINDOWS\system32> bcdedit /? TYPES BOOTAPP
BOOT APPLICATION
The following types apply to entries for boot applications. These types also
apply to the boot manager, memory diagnostic application, Windows OS loader,
and the resume application. For information about data formats for these types,
run "bcdedit /? FORMATS".
Display
=======
GRAPHICSRESOLUTION Defines the graphics resolution, 1024x768, 800x600,
1024x600, etc.
HIGHESTMODE (bool) Enables boot applications to use the highest
graphical mode exposed by the firmware.
GRAPHICSMODEDISABLED (bool) Disables graphics mode.
HIGHESTMODE (bool) Forces the highest resolution supported by the
firmware.
NOVESA (bool) Disables the use of Video Electronics Standards
Association (VESA) display modes. (Defunct.)
NOVGA (bool) Disables the use of VGA modes entirely.
BOOTUXDISABLED (bool) Disables boot graphics.
Debugging
=========
BAUDRATE (integer) Defines the baud rate for the serial debugger.
BOOTDEBUG (bool) Enables the boot debugger.
CHANNEL (integer) Defines the channel for the 1394 debugger.
BUSPARAMS (string) Defines the PCI bus, device, and function numbers
of the debugging device. For example, 1.5.0
describes the debugging device on bus 1, device 5,
function 0.
DEBUGADDRESS (integer) Defines the address of a serial port for the
debugger.
DEBUGPORT (integer) Defines the serial port number for the serial
debugger.
DEBUGSTART Can be ACTIVE, AUTOENABLE or DISABLE.
DEBUGTYPE Can be SERIAL, 1394, USB, NET or LOCAL.
DHCP (bool) Controls use of DHCP by the network debugger.
DHCP set to false forces local link only address.
HOSTIP Defines the host IP address for the network
debugger.
KEY Holds the key used to encrypt the network debug
connection.
NOUMEX (bool) Causes user-mode exceptions to be ignored.
PORT (integer) Defines the network port for the network debugger.
TARGETNAME (string) Defines the target name for the USB debugger.
Memory
======
BADMEMORYACCESS (bool) Allows an application to use the memory described
by the bad memory list.
BADMEMORYLIST (integerlist) Defines the list of Page Frame Numbers
describing faulty memory in the system.
TRUNCATEMEMORY (integer) Disregard all memory at or above the specified
physical address.
AVOIDLOWMEMORY (integer) Avoid using memory below the specified physical
address in the boot loader as much as possible.
LINEARADDRESS57 Controls whether five-level paging is enabled for
an application. Can be DEFAULT, OPTOUT or OPTIN.
Emergency Management Services
=============================
BOOTEMS (bool) Enables Emergency Management Services.
EMSBAUDRATE (integer) Defines the baud rate for Emergency Management
Services.
EMSPORT (integer) Defines the serial port number for Emergency
Management Services.
Devices and Hardware
===========================
CONFIGACCESSPOLICY Can be DEFAULT or DISALLOWMMCONFIG.
FIRSTMEGABYTEPOLICY Can be USENONE, USEALL or USEPRIVATE.
EXTENDEDINPUT (bool) Enables extended console input functionality.
Applications
============
LOCALE (string) Defines the locale of the boot application.
NOUMEX (bool) Causes user-mode exceptions to be ignored.
Recovery
========
RECOVERYENABLED (bool) Enables the recovery sequence.
RECOVERYSEQUENCE (list) Defines the recovery sequence.
Verification
============
TESTSIGNING (bool) Allows pre-release test code signing certificates.
FLIGHTSIGNING (bool) Allows flight-signed code signing certificates.
ADDITIONALCIPOLICY(string) Defines locations of additional code integrity policies.
Error Screens
=============
BOOTSHUTDOWNDISABLED (bool) Indicates that the machine should not shutdown
after displaying an error screen for 1 minute.
The default is to attempt the shutdown. This
does not work on legacy firmware.
BOOTERRORUX (integer) Defines the graphics experience for boot errors.
Can be Legacy, Standard or Simple. Valid only on
keyboard-less devices.
For additional types that apply to the boot manager, memory diagnostic
application, windows OS loader, or the resume application, run
"bcdedit /? TYPES <apptype>", where <apptype> is one of the following:
BOOTMGR The boot manager.
MEMDIAG The memory diagnostic application.
OSLOADER The Windows OS loader.
RESUME The resume application.
✓
C:\WINDOWS\system32> bcdedit /? TYPES BOOTMGR
BOOT MANAGER
The following types apply only to entries for the boot manager. For information
about data formats for these types, run "bcdedit /? FORMATS".
Boot
====
BOOTSEQUENCE (list) Defines the one-time boot sequence.
PERSISTBOOTSEQUENCE (bool) Enables persisting a boot sequence across multiple
boots.
DEFAULT (id) Defines the default boot entry.
TIMEOUT (integer) Defines the boot manager time to wait, in seconds,
before the boot manager selects a default entry.
Resume
======
RESUME (bool) Indicates that a resume operation should be
attempted.
RESUMEOBJECT (id) Provides the identifier of the resume application
object.
HIBERBOOT (bool) Indicates that a hiberboot resume should be
attempted. This is used along with the RESUME setting
and should not be modified.
Display
=======
DISPLAYBOOTMENU (bool) Enables the boot menu display.
DISPLAYORDER (list) Defines the boot manager display order list.
TOOLSDISPLAYORDER (list) Defines the boot manager tools display order
list.
For additional types that apply to the boot manager, run
"bcdedit /? TYPES BOOTAPP".
✓
C:\WINDOWS\system32> bcdedit /? TYPES BOOTSECTOR
BOOT SECTOR
Boot Sector type applies to entries that contain bootsector in the form of a
file. Currently there are no additional options for this type.
✓
C:\WINDOWS\system32> bcdedit /? TYPES DEVOBJECT
DEVICE ADDITIONAL OPTIONS
The following types apply to device additional options entries. For information
about data formats for these types, run "bcdedit /? FORMATS".
The following options are valid for the device additional options entry:
Ramdisk
=======
EXPORTASCD (bool) Enables exporting the RAM disk as a CD.
RAMDISKIMAGELENGTH (integer) Defines the image length for the RAM disk.
RAMDISKIMAGEOFFSET (integer) Defines the image offset for the RAM disk.
RAMDISKSDIDEVICE (device) Defines the device on which the SDI file is
located.
RAMDISKSDIPATH (string) Defines the path to the SDI file.
RAMDISKTFTPCLIENTPORT (integer) Defines the Trivial File Transfer Protocol
(TFTP) client port for the RAM disk Windows
Imaging (WIM) file.
RAMDISKTFTPBLOCKSIZE (integer) Defines the Trivial File Transfer Protocol
(TFTP) block size for the RAM disk Windows
Imaging (WIM) file.
RAMDISKTFTPWINDOWSIZE (integer) Defines the Trivial File Transfer Protocol
(TFTP) window size for RAM disk Windows
imaging (WIM) file.
RAMDISKMCENABLED (bool) Enables or disables Multicast for RAM disk
Windows Imaging (WIM) file.
RAMDISKMCTFTPFALLBACK (bool) Enables fallback to TFTP if Multicast
fails.
RAMDISKTFTPVARWINDOW (bool) Enables or disables Trivial File Transfer
Protocol (TFTP) Variable window size
extension.
✓
C:\WINDOWS\system32> bcdedit /? TYPES FWBOOTMGR
FIRMWARE BOOT MANAGER
The following types apply only to entries for the firmware boot manager. For
information about data formats for these types, run "bcdedit /? FORMATS".
Boot
====
BOOTSEQUENCE (list) Defines the one-time boot sequence.
DEFAULT (id) Defines the default boot entry.
TIMEOUT (integer) Defines the boot manager time to wait, in seconds.
Display
=======
DISPLAYORDER (list) Defines the boot manager display order list.
✓
C:\WINDOWS\system32> bcdedit /? TYPES MEMDIAG
MEMORY DIAGNOSTIC APPLICATION
The following types apply only to entries for memory diagnostic application
entries. For information about data formats for these types, run
"bcdedit /? FORMATS".
Test
====
PASSCOUNT (integer) The number of iterations that will be run.
TESTMIX Can be BASIC or EXTENDED.
CACHEENABLE (boolean) Overrides the default cache settings of the testmix.
For additional types that apply to the memory diagnostic application, run
"bcdedit /? TYPES BOOTAPP".
✓
C:\WINDOWS\system32> bcdedit /? TYPES NTLDR
NTLDR based OS LOADER
Currently there are no additional options for this type.
✓
C:\WINDOWS\system32> bcdedit /? TYPES OSLOADER
WINDOWS OS LOADER
The following types can be used only for Windows OS Loader entries. For
information about data formats for these types, run "bcdedit /? FORMATS".
Boot
====
BOOTLOG (bool) Enables the system initialization log.
BOOTSTATUSPOLICY Can be DisplayAllFailures, IgnoreAllFailures,
IgnoreShutdownFailures, IgnoreBootFailures,
IgnoreCheckpointFailures, DisplayShutdownFailures,
DisplayBootFailures, or DisplayCheckpointFailures.
LASTKNOWNGOOD (bool) Enables boot to last known good configuration.
NOCRASHAUTOREBOOT (bool) Disables automatic restart on crash.
RESUMEOBJECT (id) Defines the identifier of the resume object that
is associated with this operating system object.
SAFEBOOT Can be Minimal, Network or DsRepair
SAFEBOOTALTERNATESHELL (bool) Uses the alternate shell when booted into
Safe mode.
SOS (bool) Displays additional boot information.
WINPE (bool) Enables the computer to boot to Windows PE.
Display
=======
BOOTUX Defines the graphics experience during boot. Can be
Disabled, Basic or Standard. (Defunct.)
BOOTMENUPOLICY Defines the type of boot menus the system will use.
Can be Legacy or Standard.
Options
=======
ADVANCEDOPTIONS (bool) Enables advanced options.
LOADOPTIONS (string) Defines any additional options that are not covered
by other types.
OPTIONSEDIT (bool) Enables the options editor.
Processors and APICs
====================
CLUSTERMODEADDRESSING (integer) Defines the maximum number of processors to
include in a single Advanced Programmable
Interrupt Controller (APIC) cluster.
CONFIGFLAGS (integer) Specifies processor-specific configuration flags.
MAXPROC (bool) Reports the maximum number of processors in the
system.
NUMPROC (integer) Uses only the specified number of processors.
ONECPU (bool) Forces only the boot CPU to be used.
RESTRICTAPICCLUSTER (integer) Defines the largest APIC cluster number to
be used by the system.
USEPHYSICALDESTINATION (bool) Forces the use of the physical APIC.
USELEGACYAPICMODE (bool) Forces the use of legacy APIC mode even if
the processors and chipset support extended
APIC mode.
X2APICPOLICY (integer) Enables the use of extended APIC mode if the
processors and chipset support extended APIC mode.
Can be Enabled, Disabled or Default.
MAXGROUP (bool) Maximizes the number of groups created in group
configuration.
GROUPAWARE (bool) Forces drivers to be aware of multiple groups in a
multi-group environment.
GROUPSIZE (integer) Specifies the size of all processor groups. Must
be an integer of power of 2.
Hardware Abstraction Layer (HAL) & KERNEL
=========================================
HAL (string) Defines the file name for a private HAL.
HALBREAKPOINT (bool) Enables the special hardware abstraction layer
(HAL) breakpoint.
KERNEL (string) Defines the file name for a private kernel.
USEPLATFORMCLOCK (bool) Forces the use of a platform clock source for the
system's performance counter.
FORCELEGACYPLATFORM(bool) Forces the OS to assume the presence of legacy
PC devices like CMOS, keyboard controller etc.
TSCSYNCPOLICY Controls the TSC synchronization policy.
Can be Default, Legacy or Enhanced.
VESA, PCI, VGA, and TPM
=======================
USEFIRMWAREPCISETTINGS (bool) Uses BIOS-configured Peripheral Component
Interconnect (PCI) resources.
MSI Can be Default or ForceDisable.
VGA (bool) Forces the use of the VGA display driver.
TPMBOOTENTROPY Can be Default, ForceDisable, or ForceEnable.
Debugging and Performance
=========================
DBGTRANSPORT (string) Defines the file name for a private debugger
transport.
DEBUG (bool) Enables kernel debugging.
PERFMEM (integer) Specifies the size (in megabytes) of the buffer to
allocate for performance data logging.
Memory
======
INCREASEUSERVA (integer) Increases the amount of virtual address space
that the user-mode processes can use, in MBs.
NOLOWMEM (bool) Disables the use of low memory.
NX Can be OptIn, OptOut, AlwaysOn or AlwaysOff.
PAE Can be Default, ForceEnable, ForceDisable.
REMOVEMEMORY (integer) Removes memory, in MBs, from the total available
memory that the operating system can use.
Drivers and System Root
=======================
DRIVERLOADFAILUREPOLICY Can be Fatal or UseErrorControl.
EMS (bool) Enables kernel Emergency Management Services.
OSDEVICE (device) Defines the device that contains the system root.
SYSTEMROOT (string) Defines the path to the system root.
Hypervisor
==========
HYPERVISORLAUNCHTYPE Controls the hypervisor launch type.
Can be Off or Auto.
HYPERVISORDEBUG (bool) Enables hypervisor debugging.
HYPERVISORDEBUGTYPE Can be SERIAL, 1394, or NET.
HYPERVISORDEBUGPORT (integer) Defines the serial port number for the
serial debugger.
HYPERVISORBAUDRATE (integer) Defines the baud rate for the serial
debugger.
HYPERVISORCHANNEL (integer) Defines the channel for the 1394 debugger.
HYPERVISORHOSTIP (integer) Defines the IPv4 address of the debugger
host for the network debugger.
HYPERVISORHOSTPORT (integer) Defines the UDP port to communicate with on
the debugger host for the network debugger.
HYPERVISORBUSPARAMS (string) Defines the PCI bus, device, and function
numbers of the debugging device. For
example, 1.5.0 describes the debugging
device on bus 1, device 5, function 0.
HYPERVISORUSELARGEVTLB (bool) Increases virtual TLB size.
HYPERVISORIOMMUPOLICY Controls the hypervisor IOMMU policy.
Can be default, enable or disable.
Virtual Secure Mode
===================
VSMLAUNCHTYPE Controls the Virtual Secure Mode launch type.
Can be Off or Auto.
For additional types that apply to the Windows OS Loader, run
"bcdedit /? TYPES BOOTAPP".
✓
C:\WINDOWS\system32> bcdedit /? TYPES RESUME
RESUME LOADER
The following types apply to entries for the resume loader. For information
about data formats for these types, run "bcdedit /? FORMATS".
Display
=======
BOOTUX Defines the graphics experience during resume.
Can be Disabled, Basic, or Standard. (Defunct.)
BOOTMENUPOLICY Defines the type of boot menus the system will
use. Can be Legacy or Standard.
Hibernation file
================
FILEDEVICE (Device) Specifies the device containing the hibernation
file.
FILEPATH (String) Specifies the path of the hibernation file.
Other
=====
ASSOCIATEDOSDEVICE (Device) Names the OS device associated with the
hibernated OS. This is only useful in cases
where the hibernation file is not stored on
the OS device.
CUSTOMSETTINGS (Boolean) Allows resume loader to use custom settings.
PAE (Boolean) Indicates whether the hibernated OS was
running with PAE enabled.
For additional types that apply to the resume application, run
"bcdedit /? TYPES BOOTAPP".
C:\WINDOWS\system32> bcdedit /? FORMATS
The following describes the formats of the data that are required for
<datatypes> used with the /set command. The format that is required depends on
the <datatypes> that you specify with the /set command. For more information
about the formats associated with each <datatype>, run "bcdedit /? TYPES".
bool A boolean value. The following values correspond to TRUE:
1, ON, YES, TRUE
The following values correspond to FALSE:
0, OFF, NO, FALSE
device A device can be one of the following types:
BOOT
PARTITION=<drive>
HD_PARTITION=<drive>
FILE=[<parent>]<path>
RAMDISK=[<parent>]<path>,<optionsid>
VHD=[<parent>]<path>,<locatecustom>
LOCATE[=<locatecustom>]
The options for these types are:
<drive> A drive letter with a colon and no trailing
backslashes.
<parent> (Required) Can be either BOOT, LOCATE, or a drive
letter with colon. The square brackets do not
indicate that this is optional, but are a literal
part of the syntax.
<path> A path to the file (or .wim file) from the root of
the parent device.
<optionsid> The identifier to the device options entry that
contains the system deployment image (SDI) options
for the RAM disk. This is usually
{ramdisksdioptions}.
<locatecustom> Supplies an optional element used to locate a
device by looking for a specified path. The
default locate element for a device is its
application path (systemroot for an osdevice).
Custom values must be specified using custom
element syntax (see -help types customtypes),
for example: locate=custom:22000002.
id An entry identifier, which refers to an entry in the boot configuration
data store. Run "bcdedit /? ID" for more information about identifiers.
integer A 64-bit integer type. Some integer types can be set using enumerated
values.
integerlist A list of one or more 64-bit integers, separated by spaces.
This list should not be enclosed in quotation marks.
list An entry identifier list. It contains one or more entry identifiers
separated by spaces. The list should not be enclosed in quotation
marks.
string A literal string. If it contains spaces, it should be surrounded by
quotation marks ("").