编译 Linux 5.15 内核。我在 QEMU 中运行它,我传输原始 img 图像:
qemu-system-x86_64 -m 1G -k en -kernel linux-5.15.56/arch/x86_64/boot/bzImage -smp cpus=2 -initrd initrd.gz -hda ext4.img
磁盘没有在内核中定义,虽然 SATA、PCI 和 SCSI 似乎在内核中。
(initramfs) # insmod /modules/drivers/scsi/scsi_debug.ko
(initramfs) # ls /dev/sd*
sda
(initramfs) # /sbin/fdisk -l /dev/sda
Disk: /dev/sda: 8M, 8388608 bytes, 16384 sectors
1024 cylinders, 1 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Disk /dev/sda doesn`t contain a valid partition table
尽管即使在主机中,所有内容都已正确定义和安装:
root@kali: ~ # fdisk -l ext4.img
Disk ext4.img: 512 MiB, 536870912 bytes, 1048576 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc621c9d0
Device Boot Start End Sectors Size Id Type
ext4.img1 2048 1048575 1046528 511M 83 Linux
我在我的主题上搜索的唯一一件事(它帮助我解决了这个问题只是因为根本没有检测到磁盘(是的,当它/dev/sda
甚至不可见时))在这里:https ://superuser.com/ questions/269742/ drive-not-recognized-by-linux-when-launched-from-qemu我个人发现的所有问题都是由于 BIOS / 分区表曲线而导致磁盘看不到的问题 / 我们正在谈论新设备 /磁盘分区(NVMe、RAID 阵列),我们谈论的是已经配置好的操作系统。然后从字面上看,在谷歌的第一页上,无关紧要的话题就...(我为这么详细的介绍道歉,只是在我最后一个问题之后,当我被建议去谷歌时,我被烧毁了,在找到我的问题的答案(它在 Orange Pi Lite 上)之后,我去谷歌并没有找到一个接近我的问题的答案。因此,我也会抛出我谷歌的链接甚至截图,这样就没有聪明的人发送给谷歌/文档)。
我正在附加内核配置:
root@kali: ~ # cat config | grep -e SATA -e PCI -e SCSI
CONFIG_ACPI_PCI_SLOT=y
CONFIG_ACPI_APEI_PCIEAER=y
# Bus options (PCI etc.)
CONFIG_PCI_DIRECT=y
CONFIG_PCI_MMCONFIG=y
CONFIG_PCI_XEN=y
# CONFIG_PCI_CNB20LE_QUIRK is not set
# end of Bus options (PCI etc.)
CONFIG_BLK_MQ_PCI=y
# CONFIG_CAN_KVASER_PCIEFD is not set
CONFIG_CAN_PEAK_PCIEFD=m
CONFIG_CAN_EMS_PCI=m
CONFIG_CAN_KVASER_PCI=m
CONFIG_CAN_PEAK_PCI=m
CONFIG_CAN_PEAK_PCIEC=y
CONFIG_CAN_PLX_PCI=m
CONFIG_HAVE_PCI=y
CONFIG_PCI=y
CONFIG_PCI_DOMAINS=y
CONFIG_PCIEPORTBUS=y
CONFIG_HOTPLUG_PCI_PCIE=y
CONFIG_PCIEAER=y
CONFIG_PCIEAER_INJECT=m
# CONFIG_PCIE_ECRC is not set
CONFIG_PCIEASPM=y
CONFIG_PCIEASPM_DEFAULT=y
# CONFIG_PCIEASPM_POWERSAVE is not set
# CONFIG_PCIEASPM_POWER_SUPERSAVE is not set
# CONFIG_PCIEASPM_PERFORMANCE is not set
CONFIG_PCIE_PME=y
CONFIG_PCIE_DPC=y
CONFIG_PCIE_PTM=y
# CONFIG_PCIE_EDR is not set
CONFIG_PCI_MSI=y
CONFIG_PCI_MSI_IRQ_DOMAIN=y
CONFIG_PCI_QUIRKS=y
CONFIG_PCI_DEBUG=y
CONFIG_PCI_REALLOC_ENABLE_AUTO=y
CONFIG_PCI_STUB=y
CONFIG_PCI_PF_STUB=y
CONFIG_XEN_PCIDEV_FRONTEND=y
CONFIG_PCI_ATS=y
CONFIG_PCI_LOCKLESS_CONFIG=y
CONFIG_PCI_IOV=y
CONFIG_PCI_PRI=y
CONFIG_PCI_PASID=y
# CONFIG_PCI_P2PDMA is not set
CONFIG_PCI_LABEL=y
# CONFIG_PCI_HYPERV is not set
# CONFIG_PCIE_BUS_TUNE_OFF is not set
CONFIG_PCIE_BUS_DEFAULT=y
# CONFIG_PCIE_BUS_SAFE is not set
# CONFIG_PCIE_BUS_PERFORMANCE is not set
# CONFIG_PCIE_BUS_PEER2PEER is not set
CONFIG_HOTPLUG_PCI=y
CONFIG_HOTPLUG_PCI_ACPI=y
CONFIG_HOTPLUG_PCI_ACPI_IBM=m
CONFIG_HOTPLUG_PCI_CPCI=y
CONFIG_HOTPLUG_PCI_CPCI_ZT5550=m
CONFIG_HOTPLUG_PCI_CPCI_GENERIC=m
CONFIG_HOTPLUG_PCI_SHPC=y
# PCI controller drivers
CONFIG_PCI_HYPERV_INTERFACE=m
# DesignWare PCI Core Support
# CONFIG_PCIE_DW_PLAT_HOST is not set
# CONFIG_PCI_MESON is not set
# end of DesignWare PCI Core Support
# Mobiveil PCIe Core Support
# end of Mobiveil PCIe Core Support
# Cadence PCIe controllers support
# end of Cadence PCIe controllers support
# end of PCI controller drivers
# PCI Endpoint
# CONFIG_PCI_ENDPOINT is not set
# end of PCI Endpoint
# PCI switch controller drivers
# CONFIG_PCI_SW_SWITCHTEC is not set
# end of PCI switch controller drivers
CONFIG_MHI_BUS_PCI_GENERIC=m
CONFIG_ISCSI_IBFT_FIND=y
CONFIG_ISCSI_IBFT=m
# CONFIG_EFI_DISABLE_PCI_DMA is not set
CONFIG_MTD_PCI=m
# CONFIG_MTD_NAND_DENALI_PCI is not set
# CONFIG_SPI_INTEL_SPI_PCI is not set
CONFIG_BLK_DEV_PCIESSD_MTIP32XX=m
# CONFIG_DW_XDATA_PCIE is not set
# CONFIG_PCI_ENDPOINT_TEST is not set
# CONFIG_MISC_ALCOR_PCI is not set
CONFIG_MISC_RTSX_PCI=m
CONFIG_PVPANIC_PCI=m
# SCSI device support
CONFIG_SCSI_MOD=y
CONFIG_SCSI_COMMON=y
CONFIG_SCSI=y
CONFIG_SCSI_DMA=y
CONFIG_SCSI_NETLINK=y
# CONFIG_SCSI_PROC_FS is not set
# SCSI support type (disk, tape, CD-ROM)
# CONFIG_SCSI_ENCLOSURE is not set
CONFIG_SCSI_CONSTANTS=y
CONFIG_SCSI_LOGGING=y
CONFIG_SCSI_SCAN_ASYNC=y
# SCSI Transports
CONFIG_SCSI_SPI_ATTRS=m
CONFIG_SCSI_FC_ATTRS=m
CONFIG_SCSI_ISCSI_ATTRS=m
CONFIG_SCSI_SAS_ATTRS=m
CONFIG_SCSI_SAS_LIBSAS=m
CONFIG_SCSI_SAS_ATA=y
CONFIG_SCSI_SAS_HOST_SMP=y
CONFIG_SCSI_SRP_ATTRS=m
# end of SCSI Transports
CONFIG_SCSI_LOWLEVEL=y
CONFIG_ISCSI_TCP=m
CONFIG_ISCSI_BOOT_SYSFS=m
CONFIG_SCSI_CXGB3_ISCSI=m
CONFIG_SCSI_CXGB4_ISCSI=m
CONFIG_SCSI_BNX2_ISCSI=m
CONFIG_SCSI_BNX2X_FCOE=m
CONFIG_BE2ISCSI=m
CONFIG_SCSI_HPSA=m
CONFIG_SCSI_3W_9XXX=m
CONFIG_SCSI_3W_SAS=m
CONFIG_SCSI_ACARD=m
CONFIG_SCSI_AACRAID=m
CONFIG_SCSI_AIC7XXX=m
CONFIG_SCSI_AIC79XX=m
CONFIG_SCSI_AIC94XX=m
CONFIG_SCSI_MVSAS=m
# CONFIG_SCSI_MVSAS_DEBUG is not set
# CONFIG_SCSI_MVSAS_TASKLET is not set
CONFIG_SCSI_MVUMI=m
CONFIG_SCSI_DPT_I2O=m
CONFIG_SCSI_ADVANSYS=m
CONFIG_SCSI_ARCMSR=m
CONFIG_SCSI_ESAS2R=m
CONFIG_SCSI_MPT3SAS=m
CONFIG_SCSI_MPT2SAS_MAX_SGE=128
CONFIG_SCSI_MPT3SAS_MAX_SGE=128
CONFIG_SCSI_MPT2SAS=m
# CONFIG_SCSI_MPI3MR is not set
CONFIG_SCSI_SMARTPQI=m
CONFIG_SCSI_UFSHCD=m
CONFIG_SCSI_UFSHCD_PCI=m
# CONFIG_SCSI_UFS_DWC_TC_PCI is not set
# CONFIG_SCSI_UFSHCD_PLATFORM is not set
# CONFIG_SCSI_UFS_BSG is not set
# CONFIG_SCSI_UFS_HPB is not set
CONFIG_SCSI_HPTIOP=m
CONFIG_SCSI_BUSLOGIC=m
# CONFIG_SCSI_FLASHPOINT is not set
CONFIG_SCSI_MYRB=m
CONFIG_SCSI_MYRS=m
CONFIG_VMWARE_PVSCSI=m
CONFIG_XEN_SCSI_FRONTEND=m
CONFIG_SCSI_SNIC=m
# CONFIG_SCSI_SNIC_DEBUG_FS is not set
CONFIG_SCSI_DMX3191D=m
# CONFIG_SCSI_FDOMAIN_PCI is not set
CONFIG_SCSI_ISCI=m
CONFIG_SCSI_IPS=m
CONFIG_SCSI_INITIO=m
CONFIG_SCSI_INIA100=m
# CONFIG_SCSI_PPA is not set
# CONFIG_SCSI_IMM is not set
CONFIG_SCSI_STEX=m
CONFIG_SCSI_SYM53C8XX_2=m
CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
CONFIG_SCSI_SYM53C8XX_MMIO=y
CONFIG_SCSI_IPR=m
# CONFIG_SCSI_IPR_TRACE is not set
# CONFIG_SCSI_IPR_DUMP is not set
CONFIG_SCSI_QLOGIC_1280=m
CONFIG_SCSI_QLA_FC=m
CONFIG_SCSI_QLA_ISCSI=m
CONFIG_SCSI_LPFC=m
# CONFIG_SCSI_LPFC_DEBUG_FS is not set
# CONFIG_SCSI_EFCT is not set
CONFIG_SCSI_DC395x=m
CONFIG_SCSI_AM53C974=m
CONFIG_SCSI_WD719X=m
CONFIG_SCSI_DEBUG=m
CONFIG_SCSI_PMCRAID=m
CONFIG_SCSI_PM8001=m
CONFIG_SCSI_BFA_FC=m
CONFIG_SCSI_VIRTIO=m
CONFIG_SCSI_CHELSIO_FCOE=m
CONFIG_SCSI_LOWLEVEL_PCMCIA=y
CONFIG_SCSI_DH=y
CONFIG_SCSI_DH_RDAC=m
CONFIG_SCSI_DH_HP_SW=m
CONFIG_SCSI_DH_EMC=m
CONFIG_SCSI_DH_ALUA=m
# end of SCSI device support
CONFIG_SATA_HOST=y
CONFIG_SATA_ZPODD=y
CONFIG_SATA_PMP=y
CONFIG_SATA_AHCI=m
CONFIG_SATA_MOBILE_LPM_POLICY=3
# CONFIG_SATA_AHCI_PLATFORM is not set
# CONFIG_SATA_INIC162X is not set
CONFIG_SATA_ACARD_AHCI=m
CONFIG_SATA_SIL24=m
CONFIG_SATA_QSTOR=m
CONFIG_SATA_SX4=m
# SATA SFF controllers with BMDMA
# CONFIG_SATA_DWC is not set
CONFIG_SATA_MV=m
CONFIG_SATA_NV=m
CONFIG_SATA_PROMISE=m
CONFIG_SATA_SIL=m
CONFIG_SATA_SIS=m
CONFIG_SATA_SVW=m
CONFIG_SATA_ULI=m
CONFIG_SATA_VIA=m
CONFIG_SATA_VITESSE=m
# CONFIG_PATA_CMD640_PCI is not set
CONFIG_TCM_PSCSI=m
CONFIG_ISCSI_TARGET=m
CONFIG_ISCSI_TARGET_CXGB4=m
CONFIG_ARCNET_COM20020_PCI=m
CONFIG_B44_PCI_AUTOSELECT=y
CONFIG_B44_PCICORE_AUTOSELECT=y
CONFIG_B44_PCI=y
CONFIG_KSZ884X_PCI=m
CONFIG_NE2K_PCI=m
CONFIG_QED_ISCSI=y
# CONFIG_STMMAC_PCI is not set
CONFIG_ATH5K_PCI=y
CONFIG_ATH9K_PCI=y
# CONFIG_ATH9K_PCI_NO_EEPROM is not set
CONFIG_ATH10K_PCI=m
CONFIG_ATH11K_PCI=m
CONFIG_PCI_ATMEL=m
CONFIG_B43_PCI_AUTOSELECT=y
CONFIG_B43_PCICORE_AUTOSELECT=y
CONFIG_B43LEGACY_PCI_AUTOSELECT=y
CONFIG_B43LEGACY_PCICORE_AUTOSELECT=y
CONFIG_BRCMFMAC_PCIE=y
CONFIG_HOSTAP_PCI=m
CONFIG_P54_PCI=m
CONFIG_MWIFIEX_PCIE=m
CONFIG_RT2400PCI=m
CONFIG_RT2500PCI=m
CONFIG_RT61PCI=m
CONFIG_RT2800PCI=m
CONFIG_RT2800PCI_RT33XX=y
CONFIG_RT2800PCI_RT35XX=y
CONFIG_RT2800PCI_RT53XX=y
CONFIG_RT2800PCI_RT3290=y
CONFIG_RT2X00_LIB_PCI=m
CONFIG_RTLWIFI_PCI=m
CONFIG_RTW88_PCI=m
# CONFIG_QTNFMAC_PCIE is not set
CONFIG_PCI200SYN=m
CONFIG_MISDN_HFCPCI=m
CONFIG_SERIO_PCIPS2=m
CONFIG_SERIAL_8250_PCI=y
CONFIG_I2C_DESIGNWARE_PCI=m
CONFIG_SPI_PXA2XX_PCI=m
# PCI GPIO expanders
CONFIG_GPIO_PCI_IDIO_16=m
CONFIG_GPIO_PCIE_IDIO_24=m
# end of PCI GPIO expanders
# PCI-based Watchdog Cards
CONFIG_PCIPCWATCHDOG=m
CONFIG_WDTPCI=m
CONFIG_SSB_PCIHOST_POSSIBLE=y
CONFIG_SSB_PCIHOST=y
CONFIG_SSB_B43_PCI_BRIDGE=y
CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y
CONFIG_SSB_DRIVER_PCICORE=y
CONFIG_BCMA_HOST_PCI_POSSIBLE=y
CONFIG_BCMA_HOST_PCI=y
CONFIG_BCMA_DRIVER_PCI=y
CONFIG_MFD_INTEL_LPSS_PCI=m
CONFIG_MEDIA_PCI_SUPPORT=y
# Media digital TV PCI Adapters
CONFIG_DVB_B2C2_FLEXCOP_PCI=m
# CONFIG_DVB_B2C2_FLEXCOP_PCI_DEBUG is not set
CONFIG_DVB_SMIPCIE=m
CONFIG_TTPCI_EEPROM=m
CONFIG_FB_MB862XX_PCI_GDC=y
CONFIG_SND_PCI=y
CONFIG_SND_CMIPCI=m
CONFIG_SND_YMFPCI=m
# CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_PCI is not set
CONFIG_SND_SOC_SOF_PCI_DEV=m
CONFIG_SND_SOC_SOF_PCI=m
CONFIG_USB_PCI=y
CONFIG_USB_XHCI_PCI=m
# CONFIG_USB_XHCI_PCI_RENESAS is not set
CONFIG_USB_EHCI_PCI=m
CONFIG_USB_OHCI_HCD_PCI=m
# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
# CONFIG_TYPEC_TCPCI is not set
CONFIG_MMC_SDHCI_PCI=m
CONFIG_MMC_REALTEK_PCI=m
CONFIG_MMC_TOSHIBA_PCI=m
CONFIG_MEMSTICK_REALTEK_PCI=m
CONFIG_DW_DMAC_PCI=m
# CONFIG_DW_EDMA_PCIE is not set
CONFIG_UIO_PCI_GENERIC=m
CONFIG_VFIO_PCI_CORE=m
CONFIG_VFIO_PCI_MMAP=y
CONFIG_VFIO_PCI_INTX=y
CONFIG_VFIO_PCI=m
CONFIG_VFIO_PCI_VGA=y
CONFIG_VFIO_PCI_IGD=y
CONFIG_VIRTIO_PCI_LIB=m
CONFIG_VIRTIO_PCI=m
CONFIG_VIRTIO_PCI_LEGACY=y
CONFIG_VHOST_SCSI=m
CONFIG_XEN_PCIDEV_BACKEND=m
CONFIG_XEN_SCSI_BACKEND=m
CONFIG_COMEDI_PCI_DRIVERS=m
CONFIG_COMEDI_8255_PCI=m
CONFIG_COMEDI_ADDI_APCI_1032=m
CONFIG_COMEDI_ADDI_APCI_1500=m
CONFIG_COMEDI_ADDI_APCI_1516=m
CONFIG_COMEDI_ADDI_APCI_1564=m
CONFIG_COMEDI_ADDI_APCI_16XX=m
CONFIG_COMEDI_ADDI_APCI_2032=m
CONFIG_COMEDI_ADDI_APCI_2200=m
CONFIG_COMEDI_ADDI_APCI_3120=m
CONFIG_COMEDI_ADDI_APCI_3501=m
CONFIG_COMEDI_ADDI_APCI_3XXX=m
CONFIG_COMEDI_ADL_PCI6208=m
CONFIG_COMEDI_ADL_PCI7X3X=m
CONFIG_COMEDI_ADL_PCI8164=m
CONFIG_COMEDI_ADL_PCI9111=m
CONFIG_COMEDI_ADL_PCI9118=m
CONFIG_COMEDI_ADV_PCI1710=m
CONFIG_COMEDI_ADV_PCI1720=m
CONFIG_COMEDI_ADV_PCI1723=m
CONFIG_COMEDI_ADV_PCI1724=m
CONFIG_COMEDI_ADV_PCI1760=m
CONFIG_COMEDI_ADV_PCI_DIO=m
CONFIG_COMEDI_AMPLC_DIO200_PCI=m
CONFIG_COMEDI_AMPLC_PC236_PCI=m
CONFIG_COMEDI_AMPLC_PC263_PCI=m
CONFIG_COMEDI_AMPLC_PCI224=m
CONFIG_COMEDI_AMPLC_PCI230=m
CONFIG_COMEDI_CONTEC_PCI_DIO=m
CONFIG_COMEDI_DAS08_PCI=m
CONFIG_COMEDI_DYNA_PCI10XX=m
CONFIG_COMEDI_JR3_PCI=m
CONFIG_COMEDI_CB_PCIDAS64=m
CONFIG_COMEDI_CB_PCIDAS=m
CONFIG_COMEDI_CB_PCIDDA=m
CONFIG_COMEDI_CB_PCIMDAS=m
CONFIG_COMEDI_CB_PCIMDDA=m
CONFIG_COMEDI_NI_LABPC_PCI=m
CONFIG_COMEDI_NI_PCIDIO=m
CONFIG_COMEDI_NI_PCIMIO=m
# CONFIG_INTEL_SCU_PCI is not set
# CONFIG_PWM_LPSS_PCI is not set
CONFIG_INTEL_TH_PCI=m
# CONFIG_NFSD_SCSILAYOUT is not set
CONFIG_GENERIC_PCI_IOMAP=y