手机版
你好,游客 登录 注册
背景:
阅读新闻

QEMU上运行BusyBox详解

[日期:2019-03-30] 来源:Linux社区  作者:醉落红尘 [字体: ]

BusyBox

前文“在QEMU环境中使用GDB调试Linux内核”和"Initramfs 原理和实践" 分别描述了怎么用qemu来运行一个编译好的内核,以及怎么指定initramfs,但都是简单的演示。其实轮子已经有人造出来了,BusyBox项目就是这样一个工具集,提供了非常多的常用Linux命令,并且支持多平台。BusyBox项目的官网介绍如下:

BusyBox: The Swiss Army Knife of Embedded Linux

BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the options that are included provide the expected functionality and behave very much like their GNU counterparts. BusyBox provides a fairly complete environment for any small or embedded system.

我们可以把BusyBox作为一个用户空间运行在qemu启动的内核中,思路是把BusyBox打包成一个小型文件系统结构,并且归档到cpio文件中,作为系统启动的initramfs运行起来,这样我们就可以拥有一个类似Linux的操作界面和工具集。

编译内核,运行 qemu, 制作initramfs等过程可以参考前文,这里只着重介绍怎么把BusyBox打包成initramfs让Linux内核把它跑起来。

准备

统一下目录,之后的操作都会在$HOME/kernel/这个目录下进行,把环境变量TOP设置为这个目录

# TOP=$HOME/kernel/
# cd $TOP
# pwd
/root/kernel

下载和解压BusyBox

# wget https://busybox.net/downloads/busybox-1.27.2.tar.bz2
# tar -xf busybox-1.27.2.tar.bz2

Config BusyBox

# mkdir -pv ../obj/busybox-x86
mkdir: created directory ‘../obj’
mkdir: created directory ‘../obj/busybox-x86’
# make 0=../obj/busybox-x86 defconfig

0= 表示把build输出放在这个位置,这样就可以利用同一套源代码来build多个不同的configuration。

配置menuconfig

# make 0=../obj/busybox-x86 menuconfig

menuconfig需要完成如下2个配置

  • 开启静态编译, 避免链接shared libraries
  • 编译成x86 32位

1) 开启静态编译,在menuconfig界面,敲/, 搜索"static",可以看到在如下位置可以进行选项配置:

Busybox Settings --->
    Build Options --->
        [*] Build BusyBox as a static binary(no shared libs)

在"Build BusyBox as a static binary(no shared libs"选项上选Y。

2) 编译成x86 32位

在如下两个选项中输入对应的值:

(-m32 -march=i386) Additional CFLAGS
(-m32) Additional LDFLAGS

Build BusyBox

# cd ../obj/busybox-x86
# make -j2
# make install

制作initramfs文件

至此静态链接的BusyBox编译完成,可以将安装在_install目录下的文件和目录拎出来打包,按照initramfs要求的格式打包起来,打包的目标目录为新建的$TOP/initramfs/x86-busybox。

# mkdir -pv $TOP/initramfs/x86-busybox
mkdir: created directory ‘/initramfs’
mkdir: created directory ‘/initramfs/x86-busybox’
# cd $TOP/initramfs/x86-busybox
root@iZ8vb12um7qt3iuasi08caZ:/initramfs/x86-busybox# mkdir -pv {bin,sbin,etc,proc,sys,usr/{bin,sbin}}
mkdir: created directory ‘bin’
mkdir: created directory ‘sbin’
mkdir: created directory ‘etc’
mkdir: created directory ‘proc’
mkdir: created directory ‘sys’
mkdir: created directory ‘usr’
mkdir: created directory ‘usr/bin’
mkdir: created directory ‘usr/sbin’
# cp -av $TOP/obj/busybox-x86/_install/* .

initramfs需要一个init程序,可以写一个简单的shell脚本作为init:

# cat init
#!/bin/sh
mount -t proc none /proc
mount -t sysfs none /sys
echo -e "\nBoot took $(cut -d' ' -f1 /proc/uptime) seconds\n"
exec /bin/sh

加上执行权限

# chmod u+x init

将x86-busybox下面的内容打包归档成cpio文件,以供Linux内核做initramfs启动执行。

# find . -print0 | cpio --null -ov --format=newc | gzip -9 > $TOP/obj/initramfs-busybox-x86.cpio.gz

启动Linux

将 BusyBox cpio压缩文件作为initramfs启动Linux内核。

# cd $TOP
# qemu -kernel ./linux-3.18.6/arch/x86/boot/bzImage -initrd obj/initramfs-busybox-x86.cpio.gz -nographic -append "console=ttyS0"

启动后console打印启动信息,随后进入init程序指定的shell中。

完整的启动日志如下,里面能看到Linux内核在启动加载各个模块和驱动的过程:

[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 3.18.6 (root@iZ8vb12um7qt3iuasi08caZ) (gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) ) #1 SMP Wed Jul 4 20:08:15 CST 2018
[ 0.000000] e820: BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x0000000007ffdfff] usable
[ 0.000000] BIOS-e820: [mem 0x0000000007ffe000-0x0000000007ffffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[ 0.000000] Notice: NX (Execute Disable) protection missing in CPU!
[ 0.000000] SMBIOS 2.4 present.
[ 0.000000] e820: last_pfn = 0x7ffe max_arch_pfn = 0x100000
[ 0.000000] found SMP MP-table at [mem 0x000f0b20-0x000f0b2f] mapped at [c00f0b20]
[ 0.000000] Scanning 1 areas for low memory corruption
[ 0.000000] init_memory_mapping: [mem 0x00000000-0x000fffff]
[ 0.000000] init_memory_mapping: [mem 0x07800000-0x07bfffff]
[ 0.000000] init_memory_mapping: [mem 0x00100000-0x077fffff]
[ 0.000000] init_memory_mapping: [mem 0x07c00000-0x07ffdfff]
[ 0.000000] RAMDISK: [mem 0x07efa000-0x07feffff]
[ 0.000000] ACPI: Early table checksum verification disabled
[ 0.000000] ACPI: RSDP 0x000F0990 000014 (v00 BOCHS )
[ 0.000000] ACPI: RSDT 0x07FFFBC1 000034 (v01 BOCHS BXPCRSDT 00000001 BXPC 00000001)
[ 0.000000] ACPI: FACP 0x07FFF1C0 000074 (v01 BOCHS BXPCFACP 00000001 BXPC 00000001)
[ 0.000000] ACPI: DSDT 0x07FFE040 001180 (v01 BOCHS BXPCDSDT 00000001 BXPC 00000001)
[ 0.000000] ACPI: FACS 0x07FFE000 000040
[ 0.000000] ACPI: SSDT 0x07FFF234 0008DD (v01 BOCHS BXPCSSDT 00000001 BXPC 00000001)
[ 0.000000] ACPI: APIC 0x07FFFB11 000078 (v01 BOCHS BXPCAPIC 00000001 BXPC 00000001)
[ 0.000000] ACPI: HPET 0x07FFFB89 000038 (v01 BOCHS BXPCHPET 00000001 BXPC 00000001)
[ 0.000000] 0MB HIGHMEM available.
[ 0.000000] 127MB LOWMEM available.
[ 0.000000] mapped low ram: 0 - 07ffe000
[ 0.000000] low ram: 0 - 07ffe000
[ 0.000000] Zone ranges:
[ 0.000000] DMA [mem 0x00001000-0x00ffffff]
[ 0.000000] Normal [mem 0x01000000-0x07ffdfff]
[ 0.000000] HighMem empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x00001000-0x0009efff]
[ 0.000000] node 0: [mem 0x00100000-0x07ffdfff]
[ 0.000000] Initmem setup node 0 [mem 0x00001000-0x07ffdfff]
[ 0.000000] Using APIC driver default
[ 0.000000] ACPI: PM-Timer IO Port: 0xb008
[ 0.000000] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
[ 0.000000] ACPI: LAPIC_NMI (acpi_id[0xff] dfl dfl lint[0x1])
[ 0.000000] ACPI: IOAPIC (id[0x00] address[0xfec00000] gsi_base[0])
[ 0.000000] IOAPIC[0]: apic_id 0 already used, trying 1
[ 0.000000] IOAPIC[0]: apic_id 1, version 17, address 0xfec00000, GSI 0-23
[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
[ 0.000000] Using ACPI (MADT) for SMP configuration information
[ 0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[ 0.000000] smpboot: Allowing 1 CPUs, 0 hotplug CPUs
[ 0.000000] PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
[ 0.000000] PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff]
[ 0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000effff]
[ 0.000000] PM: Registered nosave memory: [mem 0x000f0000-0x000fffff]
[ 0.000000] e820: [mem 0x08000000-0xfffbffff] available for PCI devices
[ 0.000000] setup_percpu: NR_CPUS:8 nr_cpumask_bits:8 nr_cpu_ids:1 nr_node_ids:1
[ 0.000000] PERCPU: Embedded 15 pages/cpu @c7deb000 s31808 r0 d29632 u61440
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32412
[ 0.000000] Kernel command line: console=ttyS0
[ 0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[ 0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[ 0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.000000] Initializing CPU#0
[ 0.000000] Initializing HighMem for node 0 (00000000:00000000)
[ 0.000000] Memory: 116668K/130672K available (7482K kernel code, 490K rwdata, 2440K rodata, 644K init, 592K bss, 14004K reserved, 0K highmem)
[ 0.000000] virtual kernel memory layout:
[ 0.000000] fixmap : 0xfff16000 - 0xfffff000 ( 932 kB)
[ 0.000000] pkmap : 0xff800000 - 0xffc00000 (4096 kB)
[ 0.000000] vmalloc : 0xc87fe000 - 0xff7fe000 ( 880 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xc7ffe000 ( 127 MB)
[ 0.000000] .init : 0xc1a2f000 - 0xc1ad0000 ( 644 kB)
[ 0.000000] .data : 0xc174ee65 - 0xc1a2d880 (2938 kB)
[ 0.000000] .text : 0xc1000000 - 0xc174ee65 (7483 kB)
[ 0.000000] Checking if this processor honours the WP bit even in supervisor mode...Ok.
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[ 0.000000] NR_IRQS:2304 nr_irqs:256 0
[ 0.000000] Console: colour VGA+ 80x25
[ 0.000000] console [ttyS0] enabled
[ 0.000000] tsc: Fast TSC calibration using PIT
[ 0.000000] tsc: Detected 2499.939 MHz processor
[ 0.003270] Calibrating delay loop (skipped), value calculated using timer frequency.. 4999.87 BogoMIPS (lpj=2499939)
[ 0.004575] pid_max: default: 32768 minimum: 301
[ 0.005045] ACPI: Core revision 20140926
[ 0.023649] ACPI: All ACPI Tables successfully acquired
[ 0.025529] Security Framework initialized
[ 0.026442] SELinux: Initializing.
[ 0.027702] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.027899] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.037157] Initializing cgroup subsys freezer
[ 0.039288] Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0
[ 0.039288] Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0, 1GB 0
[ 0.083212] Freeing SMP alternatives memory: 28K (c1ad0000 - c1ad7000)
[ 0.090448] Enabling APIC mode: Flat. Using 1 I/O APICs
[ 0.094000] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[ 0.104691] smpboot: CPU0: Intel QEMU Virtual CPU version 2.0.0 (fam: 06, model: 06, stepping: 03)
[ 0.106000] Performance Events: Broken PMU hardware detected, using software events only.
[ 0.106401] Failed to access perfctr msr (MSR c1 is 0)
[ 0.115103] x86: Booted up 1 node, 1 CPUs
[ 0.115307] smpboot: Total of 1 processors activated (4999.87 BogoMIPS)
[ 0.124342] devtmpfs: initialized
[ 0.131951] RTC time: 5:49:58, date: 07/06/18
[ 0.140328] NET: Registered protocol family 16
[ 0.143178] kworker/u2:0 (15) used greatest stack depth: 7256 bytes left
[ 0.145192] kworker/u2:0 (16) used greatest stack depth: 7212 bytes left
[ 0.148062] cpuidle: using governor ladder
[ 0.148344] cpuidle: using governor menu
[ 0.149357] ACPI: bus type PCI registered
[ 0.152037] PCI: PCI BIOS revision 2.10 entry at 0xfd3bf, last bus=0
[ 0.152285] PCI: Using configuration type 1 for base access
[ 0.197800] ACPI: Added _OSI(Module Device)
[ 0.198036] ACPI: Added _OSI(Processor Device)
[ 0.198190] ACPI: Added _OSI(3.0 _SCP Extensions)
[ 0.198326] ACPI: Added _OSI(Processor Aggregator Device)
[ 0.227871] ACPI: Interpreter enabled
[ 0.228429] ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S1_] (20140926/hwxface-580)
[ 0.228816] ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S2_] (20140926/hwxface-580)
[ 0.230093] ACPI: (supports S0 S3 S4 S5)
[ 0.230322] ACPI: Using IOAPIC for interrupt routing
[ 0.231481] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[ 0.249641] kworker/u2:0 (74) used greatest stack depth: 7140 bytes left
[ 0.273460] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[ 0.274489] acpi PNP0A03:00: _OSC: OS supports [ASPM ClockPM Segments MSI]
[ 0.275063] acpi PNP0A03:00: _OSC failed (AE_NOT_FOUND); disabling ASPM
[ 0.277503] acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge.
[ 0.279268] PCI host bridge to bus 0000:00
[ 0.279599] pci_bus 0000:00: root bus resource [bus 00-ff]
[ 0.280000] pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7]
[ 0.280297] pci_bus 0000:00: root bus resource [io 0x0d00-0xadff]
[ 0.280521] pci_bus 0000:00: root bus resource [io 0xae0f-0xaeff]
[ 0.280752] pci_bus 0000:00: root bus resource [io 0xaf20-0xafdf]
[ 0.280973] pci_bus 0000:00: root bus resource [io 0xafe4-0xffff]
[ 0.281262] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff]
[ 0.281486] pci_bus 0000:00: root bus resource [mem 0x08000000-0xfebfffff]
[ 0.291071] pci 0000:00:01.1: legacy IDE quirk: reg 0x10: [io 0x01f0-0x01f7]
[ 0.291405] pci 0000:00:01.1: legacy IDE quirk: reg 0x14: [io 0x03f6]
[ 0.291697] pci 0000:00:01.1: legacy IDE quirk: reg 0x18: [io 0x0170-0x0177]
[ 0.292062] pci 0000:00:01.1: legacy IDE quirk: reg 0x1c: [io 0x0376]
[ 0.294150] pci 0000:00:01.3: quirk: [io 0xb000-0xb03f] claimed by PIIX4 ACPI
[ 0.294421] pci 0000:00:01.3: quirk: [io 0xb100-0xb10f] claimed by PIIX4 SMB
[ 0.314370] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)
[ 0.315707] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)
[ 0.316516] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)
[ 0.317925] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11)
[ 0.318384] ACPI: PCI Interrupt Link [LNKS] (IRQs *9)
[ 0.322000] ACPI: Enabled 16 GPEs in block 00 to 0F
[ 0.325891] vgaarb: setting as boot device: PCI:0000:00:02.0
[ 0.326000] vgaarb: device added: PCI:0000:00:02.0,decodes=io+mem,owns=io+mem,locks=none
[ 0.326042] vgaarb: loaded
[ 0.326221] vgaarb: bridge control possible 0000:00:02.0
[ 0.329030] SCSI subsystem initialized
[ 0.330885] ACPI: bus type USB registered
[ 0.331469] usbcore: registered new interface driver usbfs
[ 0.332358] usbcore: registered new interface driver hub
[ 0.332742] usbcore: registered new device driver usb
[ 0.333572] pps_core: LinuxPPS API ver. 1 registered
[ 0.333725] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.334441] PTP clock support registered
[ 0.336496] Advanced Linux Sound Architecture Driver Initialized.
[ 0.336746] PCI: Using ACPI for IRQ routing
[ 0.347575] NetLabel: Initializing
[ 0.347792] NetLabel: domain hash size = 128
[ 0.348035] NetLabel: protocols = UNLABELED CIPSOv4
[ 0.348876] NetLabel: unlabeled traffic allowed by default
[ 0.349442] cfg80211: Calling CRDA to update world regulatory domain
[ 0.350730] HPET: 3 timers in total, 0 timers will be used for per-cpu timer
[ 0.351514] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
[ 0.351828] hpet0: 3 comparators, 64-bit 100.000000 MHz counter
[ 0.355641] Switched to clocksource hpet
[ 0.369356] kworker/u2:0 (129) used greatest stack depth: 7036 bytes left
[ 0.372391] kworker/u2:0 (131) used greatest stack depth: 7004 bytes left
[ 0.446472] pnp: PnP ACPI init
[ 0.453853] pnp: PnP ACPI: found 6 devices
[ 0.512947] NET: Registered protocol family 2
[ 0.517348] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.517705] TCP bind hash table entries: 1024 (order: 1, 8192 bytes)
[ 0.517987] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.518871] TCP: reno registered
[ 0.519210] UDP hash table entries: 256 (order: 1, 8192 bytes)
[ 0.519484] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[ 0.521974] NET: Registered protocol family 1
[ 0.524418] RPC: Registered named UNIX socket transport module.
[ 0.524625] RPC: Registered udp transport module.
[ 0.524784] RPC: Registered tcp transport module.
[ 0.524919] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.525303] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
[ 0.525512] pci 0000:00:01.0: PIIX3: Enabling Passive Release
[ 0.525785] pci 0000:00:01.0: Activating ISA DMA hang workarounds
[ 0.531439] Unpacking initramfs...
[ 0.675369] Freeing initrd memory: 984K (c7efa000 - c7ff0000)
[ 0.678216] microcode: CPU0 sig=0x663, pf=0x1, revision=0x0
[ 0.678899] microcode: Microcode Update Driver: v2.00 <tigran@aivazian.fsnet.co.uk>, Peter Oruba
[ 0.680948] Scanning for low memory corruption every 60 seconds
[ 0.685750] futex hash table entries: 256 (order: 2, 16384 bytes)
[ 0.686365] audit: initializing netlink subsys (disabled)
[ 0.687372] audit: type=2000 audit(1530856198.686:1): initialized
[ 0.691943] HugeTLB registered 4 MB page size, pre-allocated 0 pages
[ 0.718779] VFS: Disk quotas dquot_6.5.2
[ 0.719482] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[ 0.730361] NFS: Registering the id_resolver key type
[ 0.731048] Key type id_resolver registered
[ 0.731072] Key type id_legacy registered
[ 0.732553] msgmni has been set to 229
[ 0.741321] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[ 0.741642] io scheduler noop registered
[ 0.741800] io scheduler deadline registered
[ 0.742875] io scheduler cfq registered (default)
[ 0.744380] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[ 0.747594] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
[ 0.748538] ACPI: Power Button [PWRF]
[ 0.753005] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[ 0.775925] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[ 0.784923] Non-volatile memory driver v1.3
[ 0.785534] Linux agpgart interface v0.103
[ 0.787899] [drm] Initialized drm 1.1.0 20060810
[ 0.798818] loop: module loaded
[ 0.810583] scsi host0: ata_piix
[ 0.813407] scsi host1: ata_piix
[ 0.814178] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc040 irq 14
[ 0.814477] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc048 irq 15
[ 0.819598] e100: Intel(R) PRO/100 Network Driver, 3.5.24-k2-NAPI
[ 0.819838] e100: Copyright(c) 1999-2006 Intel Corporation
[ 0.820450] e1000: Intel(R) PRO/1000 Network Driver - version 7.3.21-k8-NAPI
[ 0.820688] e1000: Copyright (c) 1999-2006 Intel Corporation.
[ 0.825817] ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 11
[ 1.079486] ata2.00: ATAPI: QEMU DVD-ROM, 2.0.0, max UDMA/100
[ 1.081283] ata2.00: configured for MWDMA2
[ 1.091229] scsi 1:0:0:0: CD-ROM QEMU QEMU DVD-ROM 2.0. PQ: 0 ANSI: 5
[ 1.106026] sr 1:0:0:0: [sr0] scsi3-mmc drive: 4x/4x cd/rw xa/form2 tray
[ 1.106503] cdrom: Uniform CD-ROM driver Revision: 3.20
[ 1.110180] sr 1:0:0:0: Attached scsi generic sg0 type 5
[ 1.115278] kworker/u2:1 (532) used greatest stack depth: 6996 bytes left
[ 1.137326] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 52:54:00:12:34:56
[ 1.137703] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
[ 1.138635] e1000e: Intel(R) PRO/1000 Network Driver - 2.3.2-k
[ 1.138849] e1000e: Copyright(c) 1999 - 2014 Intel Corporation.
[ 1.139355] sky2: driver version 1.30
[ 1.141534] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.141752] ehci-pci: EHCI PCI platform driver
[ 1.142412] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1.142665] ohci-pci: OHCI PCI platform driver
[ 1.143182] uhci_hcd: USB Universal Host Controller Interface driver
[ 1.143944] usbcore: registered new interface driver usblp
[ 1.144434] usbcore: registered new interface driver usb-storage
[ 1.145479] i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
[ 1.148516] serio: i8042 KBD port at 0x60,0x64 irq 1
[ 1.148818] serio: i8042 AUX port at 0x60,0x64 irq 12
[ 1.150864] mousedev: PS/2 mouse device common for all mice
[ 1.154622] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input1
[ 1.157418] rtc_cmos 00:00: RTC can wake from S4
[ 1.161431] rtc_cmos 00:00: rtc core: registered rtc_cmos as rtc0
[ 1.162329] rtc_cmos 00:00: alarms up to one day, 114 bytes nvram, hpet irqs
[ 1.164868] device-mapper: ioctl: 4.28.0-ioctl (2014-09-17) initialised: dm-devel@RedHat.com
[ 1.165935] hidraw: raw HID events driver (C) Jiri Kosina
[ 1.170218] usbcore: registered new interface driver usbhid
[ 1.170414] usbhid: USB HID core driver
[ 1.179052] Netfilter messages via NETLINK v0.30.
[ 1.179649] nf_conntrack version 0.5.0 (1838 buckets, 7352 max)
[ 1.182060] ctnetlink v0.93: registering with nfnetlink.
[ 1.185479] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 1.187322] TCP: cubic registered
[ 1.187471] Initializing XFRM netlink socket
[ 1.190281] NET: Registered protocol family 10
[ 1.196897] ip6_tables: (C) 2000-2006 Netfilter Core Team
[ 1.199403] sit: IPv6 over IPv4 tunneling driver
[ 1.202494] NET: Registered protocol family 17
[ 1.203544] Key type dns_resolver registered
[ 1.203714] mce: Unable to init device /dev/mcelog (rc: -5)
[ 1.204471] Using IPI No-Shortcut mode
[ 1.206427] registered taskstats version 1
[ 1.211671] Magic number: 10:770:819
[ 1.212397] console [netcon0] enabled
[ 1.212552] netconsole: network logging started
[ 1.214627] ALSA device list:
[ 1.214775] No soundcards found.
[ 1.253620] Freeing unused kernel memory: 644K (c1a2f000 - c1ad0000)
[ 1.255298] Write protecting the kernel text: 7484k
[ 1.255793] Write protecting the kernel read-only data: 2448k
[ 1.321502] mount (650) used greatest stack depth: 6948 bytes left

Boot took 1.34 seconds

/bin/sh: can't access tty; job control turned off
/ # [ 1.678389] tsc: Refined TSC clocksource calibration: 2499.937 MHz
[ 1.760577] input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input3
[ 2.679684] Switched to clocksource tsc

参考

How to Build A Custom Linux Kernel For Qemu

Linux公社的RSS地址https://www.linuxidc.com/rssFeed.aspx

本文永久更新链接地址https://www.linuxidc.com/Linux/2019-03/157825.htm

linux
相关资讯       busybox  QEMU运行BusyBox