用Qemu搭建x86学习环境

作者信息

作者:彭东林

邮箱:pengdonglin137@163.com

QQ:405728433

软件平台

主机: Ubuntu14.04 64位版本

模拟器:Qemu-2.8.0

Linux内核版本: Linux-4.10

Busybox版本:busybox-1.24.2

工具链: gcc

具备的功能

模拟一个双核或者单核的x86架构的系统,根文件系统用ramdisk的形式,跟Host之间采用NFS的方式实现文件共享。

正文

1、Qemu的编译安装

请参考博文用qemu搭建aarch64学习环境

2、工具链

Ubuntu系统自带的gcc

3、Linux内核编译

登录https://www.kernel.org/,   下载最新的Linux版本,目前最新的是Linux-4.10。 

下面是编译下面要用的kernel的命令:

1     #!/bin/bash
2     make O=out_x86 i386_defconfig
3     make O=out_x86 menuconfig
4     make O=out_x86 bzImage -j8

由于下面要用到ramdisk的启动方式,需要在kernel配置中支持:

1     General setup  --->
2        ----> [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support
3     Device Drivers  --->
4        [*] Block devices  --->
5                <*>   RAM block device support
6                (65536) Default RAM disk size (kbytes)

这里我们给ramdisk设置的默认大小是64MB

4、制作根文件系统

登录https://busybox.net/downloads/下载要用的busybox版本,这里我下的是busybox-1.24.2

这里需要注意的是,由于我们的Host是Ubuntu14.04 64bit,所以用gcc默认编译出的文件只能用于x86_64系统,如果要编译出能在x86上面运行的程序,需要在编译的时候传递必要的参数。

执行make menuconfig,配置下面几项:

1     Busybox Settings  --->
2        Build Options  --->
3             [*] Build BusyBox as a static binary (no shared libs)
4             (-m32 -march=i386 -mtune=i386) Additional CFLAGS
5             (-m32) Additional LDFLAGS

然后执行

1     make -j4
2     make install

5、制作ramdisk镜像

下面制作启动用的ramdisk,我把这个过程写成了脚本,如下:

 1     #!/bin/bash
 2     sudo rm -rf rootfs
 3     sudo rm -rf tmpfs
 4     sudo rm -rf ramdisk*
 5     sudo mkdir rootfs
 6     sudo cp ../busybox-1.24.2/_install/*  rootfs/ -raf
 7     sudo mkdir -p rootfs/proc/
 8     sudo mkdir -p rootfs/sys/
 9     sudo mkdir -p rootfs/tmp/
10     sudo mkdir -p rootfs/root/
11     sudo mkdir -p rootfs/var/
12     sudo mkdir -p rootfs/mnt/
13     sudo cp etc rootfs/ -arf
14     sudo mkdir -p rootfs/lib
15     sudo cp -arf /lib/i386-linux-gnu/* rootfs/lib/
16     sudo rm rootfs/lib/*.a
17     sudo strip rootfs/lib/*
18     sudo mkdir -p rootfs/dev/
19     sudo mknod rootfs/dev/tty1 c 4 1
20     sudo mknod rootfs/dev/tty2 c 4 2
21     sudo mknod rootfs/dev/tty3 c 4 3
22     sudo mknod rootfs/dev/tty4 c 4 4
23     sudo mknod rootfs/dev/console c 5 1
24     sudo mknod rootfs/dev/null c 1 3
25     sudo dd if=/dev/zero of=ramdisk bs=1M count=32
26     sudo mkfs.ext4 -F ramdisk
27     sudo mkdir -p tmpfs
28     sudo mount -t ext4 ramdisk ./tmpfs/  -o loop
29     sudo cp -raf rootfs/*  tmpfs/
30     sudo umount tmpfs
31     sudo gzip --best -c ramdisk > ramdisk.gz

上面需要注意的是第20行,拷贝的是i386的库。

用到的文件可以到这里下载。

6、Qemu支持网络

请参考博客:

用Qemu模拟vexpress-a9 --- 配置 qemu 的网络功能

用Qemu模拟vexpress-a9 (三)--- 实现用u-boot引导Linux内核

7、运行脚本

下面是运行脚本,支持网络

1     sudo qemu-system-i386 \
2        -smp 2 \
3        -m 1024M \
4        -kernel ./linux-4.10/out_x86/arch/x86/boot/bzImage \
5        -nographic \
6        -append "root=/dev/ram0 rw rootfstype=ext4 console=ttyS0 init=/linuxrc" \
7        -initrd ./rootfs/ramdisk.gz \
8        -net nic,vlan=0 -net tap,vlan=0,ifname=tap0

8、hello world

hello.c

1     #include <stdio.h>
2     int main(int argc, const char *argv[])
3     {
4     printf("Hello world.\n");
5     return 0;
6     }

Makefile

1     hello_32:hello.c
2     gcc -m32 -march=i386 -mtune=i386 $^ -o $@
3     clean:
4     $(RM) hello_32 *.o
5     .PHONY: clean

9、启动log

  1     $./run.sh
  2     sudo tunctl -u root -t tap0
  3     TUNSETIFF: Device or resource busy
  4     sudo ifconfig tap0 0.0.0.0 promisc up
  5     sudo brctl addif br0 tap0
  6     brctl show
  7     bridge name bridge id STP enabled interfaces
  8     br0 8000.eaca1d86f75f no eth0
  9     tap0
 10     [    0.000000] Linux version 4.10.0 (pengdonglin@pengdonglin-dell) (gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) ) #1 SMP Sat Feb 25 01:32:26 CST 2017
 11     [    0.000000] x86/fpu: Legacy x87 FPU detected.
 12     [    0.000000] e820: BIOS-provided physical RAM map:
 13     [    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
 14     [    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
 15     [    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
 16     [    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000003ffdffff] usable
 17     [    0.000000] BIOS-e820: [mem 0x000000003ffe0000-0x000000003fffffff] reserved
 18     [    0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
 19     [    0.000000] Notice: NX (Execute Disable) protection missing in CPU!
 20     [    0.000000] SMBIOS 2.8 present.
 21     [    0.000000] DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.10.1-0-g8891697-prebuilt.qemu-project.org 04/01/2014
 22     [    0.000000] e820: last_pfn = 0x3ffe0 max_arch_pfn = 0x100000
 23     [    0.000000] MTRR: Disabled
 24     [    0.000000] x86/PAT: MTRRs disabled, skipping PAT initialization too.
 25     [    0.000000] x86/PAT: Configuration [0-7]: WB  WT  UC- UC  WB  WT  UC- UC  
 26     [    0.000000] found SMP MP-table at [mem 0x000f6a90-0x000f6a9f] mapped at [c00f6a90]
 27     [    0.000000] Scanning 1 areas for low memory corruption
 28     [    0.000000] RAMDISK: [mem 0x3fb4d000-0x3ffdffff]
 29     [    0.000000] Allocated new RAMDISK: [mem 0x3736b000-0x377fdc05]
 30     [    0.000000] Move RAMDISK from [mem 0x3fb4d000-0x3ffdfc05] to [mem 0x3736b000-0x377fdc05]
 31     [    0.000000] ACPI: Early table checksum verification disabled
 32     [    0.000000] ACPI: RSDP 0x00000000000F6860 000014 (v00 BOCHS )
 33     [    0.000000] ACPI: RSDT 0x000000003FFE1936 000030 (v01 BOCHS  BXPCRSDT 00000001 BXPC 00000001)
 34     [    0.000000] ACPI: FACP 0x000000003FFE180A 000074 (v01 BOCHS  BXPCFACP 00000001 BXPC 00000001)
 35     [    0.000000] ACPI: DSDT 0x000000003FFE0040 0017CA (v01 BOCHS  BXPCDSDT 00000001 BXPC 00000001)
 36     [    0.000000] ACPI: FACS 0x000000003FFE0000 000040
 37     [    0.000000] ACPI: APIC 0x000000003FFE187E 000080 (v01 BOCHS  BXPCAPIC 00000001 BXPC 00000001)
 38     [    0.000000] ACPI: HPET 0x000000003FFE18FE 000038 (v01 BOCHS  BXPCHPET 00000001 BXPC 00000001)
 39     [    0.000000] 135MB HIGHMEM available.
 40     [    0.000000] 887MB LOWMEM available.
 41     [    0.000000]   mapped low ram: 0 - 377fe000
 42     [    0.000000]   low ram: 0 - 377fe000
 43     [    0.000000] Zone ranges:
 44     [    0.000000]   DMA      [mem 0x0000000000001000-0x0000000000ffffff]
 45     [    0.000000]   Normal   [mem 0x0000000001000000-0x00000000377fdfff]
 46     [    0.000000]   HighMem  [mem 0x00000000377fe000-0x000000003ffdffff]
 47     [    0.000000] Movable zone start for each node
 48     [    0.000000] Early memory node ranges
 49     [    0.000000]   node   0: [mem 0x0000000000001000-0x000000000009efff]
 50     [    0.000000]   node   0: [mem 0x0000000000100000-0x000000003ffdffff]
 51     [    0.000000] Initmem setup node 0 [mem 0x0000000000001000-0x000000003ffdffff]
 52     [    0.000000] Using APIC driver default
 53     [    0.000000] ACPI: PM-Timer IO Port: 0x608
 54     [    0.000000] ACPI: LAPIC_NMI (acpi_id[0xff] dfl dfl lint[0x1])
 55     [    0.000000] IOAPIC[0]: apic_id 0, version 32, address 0xfec00000, GSI 0-23
 56     [    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
 57     [    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
 58     [    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
 59     [    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
 60     [    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
 61     [    0.000000] Using ACPI (MADT) for SMP configuration information
 62     [    0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
 63     [    0.000000] smpboot: Allowing 2 CPUs, 0 hotplug CPUs
 64     [    0.000000] PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
 65     [    0.000000] PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff]
 66     [    0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000effff]
 67     [    0.000000] PM: Registered nosave memory: [mem 0x000f0000-0x000fffff]
 68     [    0.000000] e820: [mem 0x40000000-0xfffbffff] available for PCI devices
 69     [    0.000000] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1910969940391419 ns
 70     [    0.000000] setup_percpu: NR_CPUS:8 nr_cpumask_bits:8 nr_cpu_ids:2 nr_node_ids:1
 71     [    0.000000] percpu: Embedded 20 pages/cpu @f6b40000 s51084 r0 d30836 u81920
 72     [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260238
 73     [    0.000000] Kernel command line: root=/dev/ram0 rw rootfstype=ext4 console=ttyS0 init=/linuxrc
 74     [    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
 75     [    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
 76     [    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
 77     [    0.000000] Initializing CPU#0
 78     [    0.000000] Initializing HighMem for node 0 (000377fe:0003ffe0)
 79     [    0.000000] Initializing Movable for node 0 (00000000:00000000)
 80     [    0.000000] Memory: 1020616K/1048056K available (8665K kernel code, 791K rwdata, 2608K rodata, 740K init, 616K bss, 27440K reserved, 0K cma-reserved, 139144K highmem)
 81     [    0.000000] virtual kernel memory layout:
 82     [    0.000000]     fixmap  : 0xfff16000 - 0xfffff000   ( 932 kB)
 83     [    0.000000]     pkmap   : 0xff800000 - 0xffc00000   (4096 kB)
 84     [    0.000000]     vmalloc : 0xf7ffe000 - 0xff7fe000   ( 120 MB)
 85     [    0.000000]     lowmem  : 0xc0000000 - 0xf77fe000   ( 887 MB)
 86     [    0.000000]       .init : 0xc1bcd000 - 0xc1c86000   ( 740 kB)
 87     [    0.000000]       .data : 0xc18767f9 - 0xc1bcbc00   (3413 kB)
 88     [    0.000000]       .text : 0xc1000000 - 0xc18767f9   (8665 kB)
 89     [    0.000000] Checking if this processor honours the WP bit even in supervisor mode...Ok.
 90     [    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
 91     [    0.000000] Hierarchical RCU implementation.
 92     [    0.000000] Build-time adjustment of leaf fanout to 32.
 93     [    0.000000] RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=2.
 94     [    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=2
 95     [    0.000000] NR_IRQS:2304 nr_irqs:440 16
 96     [    0.000000] Console: colour VGA+ 80x25
 97     [    0.000000] console [ttyS0] enabled
 98     [    0.000000] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604467 ns
 99     [    0.000000] tsc: Unable to calibrate against PIT
100     [    0.000000] tsc: using HPET reference calibration
101     [    0.000000] tsc: Detected 3591.694 MHz processor
102     [    0.007775] Calibrating delay loop (skipped), value calculated using timer frequency.. 7183.38 BogoMIPS (lpj=3591694)
103     [    0.008377] pid_max: default: 32768 minimum: 301
104     [    0.008594] ACPI: Core revision 20160930
105     [    0.024739] ACPI: 1 ACPI AML tables successfully acquired and loaded
106     [    0.025401] Security Framework initialized
107     [    0.025561] SELinux:  Initializing.
108     [    0.026077] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
109     [    0.026244] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
110     [    0.036746] Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0
111     [    0.037026] Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0, 1GB 0
112     [    0.038602] Freeing SMP alternatives memory: 36K
113     [    0.046078] smpboot: Max logical packages: 2
114     [    0.046445] Enabling APIC mode:  Flat.  Using 1 I/O APICs
115     [    0.049000] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
116     [    0.059000] smpboot: CPU0: Intel QEMU Virtual CPU version 2.5+ (family: 0x6, model: 0x6, stepping: 0x3)
117     [    0.061377] Performance Events: PMU not available due to virtualization, using software events only.
118     [    0.066376] smp: Bringing up secondary CPUs ...
119     [    0.067926] x86: Booting SMP configuration:
120     [    0.068054] .... node  #0, CPUs:      #1
121     [    0.008000] Initializing CPU#1
122     [    0.133078] smp: Brought up 1 node, 2 CPUs
123     [    0.134067] smpboot: Total of 2 processors activated (22285.22 BogoMIPS)
124     [    0.143032] devtmpfs: initialized
125     [    0.149863] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275000 ns
126     [    0.150090] futex hash table entries: 512 (order: 3, 32768 bytes)
127     [    0.155150] RTC time: 10:01:40, date: 02/25/17
128     [    0.157028] kworker/u4:0 (20) used greatest stack depth: 7132 bytes left
129     [    0.161333] NET: Registered protocol family 16
130     [    0.173097] cpuidle: using governor menu
131     [    0.173970] ACPI: bus type PCI registered
132     [    0.177353] PCI: PCI BIOS revision 2.10 entry at 0xfd536, last bus=0
133     [    0.177600] PCI: Using configuration type 1 for base access
134     [    0.207832] kworker/u4:0 (139) used greatest stack depth: 7092 bytes left
135     [    0.289247] HugeTLB registered 4 MB page size, pre-allocated 0 pages
136     [    0.292279] ACPI: Added _OSI(Module Device)
137     [    0.292521] ACPI: Added _OSI(Processor Device)
138     [    0.292643] ACPI: Added _OSI(3.0 _SCP Extensions)
139     [    0.292781] ACPI: Added _OSI(Processor Aggregator Device)
140     [    0.309740] ACPI: Interpreter enabled
141     [    0.310448] ACPI: (supports S0 S3 S4 S5)
142     [    0.310597] ACPI: Using IOAPIC for interrupt routing
143     [    0.311277] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
144     [    0.359893] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
145     [    0.360294] acpi PNP0A03:00: _OSC: OS supports [ASPM ClockPM Segments MSI]
146     [    0.360639] acpi PNP0A03:00: _OSC failed (AE_NOT_FOUND); disabling ASPM
147     [    0.361141] acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge.
148     [    0.363225] PCI host bridge to bus 0000:00
149     [    0.363415] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7 window]
150     [    0.363746] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff window]
151     [    0.363907] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff window]
152     [    0.364025] pci_bus 0000:00: root bus resource [mem 0x40000000-0xfebfffff window]
153     [    0.364263] pci_bus 0000:00: root bus resource [bus 00-ff]
154     [    0.373072] pci 0000:00:01.1: legacy IDE quirk: reg 0x10: [io  0x01f0-0x01f7]
155     [    0.373307] pci 0000:00:01.1: legacy IDE quirk: reg 0x14: [io  0x03f6]
156     [    0.373576] pci 0000:00:01.1: legacy IDE quirk: reg 0x18: [io  0x0170-0x0177]
157     [    0.374036] pci 0000:00:01.1: legacy IDE quirk: reg 0x1c: [io  0x0376]
158     [    0.376153] pci 0000:00:01.3: quirk: [io  0x0600-0x063f] claimed by PIIX4 ACPI
159     [    0.376333] pci 0000:00:01.3: quirk: [io  0x0700-0x070f] claimed by PIIX4 SMB
160     [    0.399641] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)
161     [    0.400465] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)
162     [    0.401214] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)
163     [    0.401834] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11)
164     [    0.402236] ACPI: PCI Interrupt Link [LNKS] (IRQs *9)
165     [    0.404694] ACPI: Enabled 3 GPEs in block 00 to 0F
166     [    0.408495] pci 0000:00:02.0: vgaarb: setting as boot VGA device
167     [    0.408873] pci 0000:00:02.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
168     [    0.409112] pci 0000:00:02.0: vgaarb: bridge control possible
169     [    0.409248] vgaarb: loaded
170     [    0.410945] SCSI subsystem initialized
171     [    0.414000] ACPI: bus type USB registered
172     [    0.414797] usbcore: registered new interface driver usbfs
173     [    0.415427] usbcore: registered new interface driver hub
174     [    0.415718] usbcore: registered new device driver usb
175     [    0.417317] pps_core: LinuxPPS API ver. 1 registered
176     [    0.417613] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
177     [    0.418106] PTP clock support registered
178     [    0.420634] Advanced Linux Sound Architecture Driver Initialized.
179     [    0.421307] PCI: Using ACPI for IRQ routing
180     [    0.430601] NetLabel: Initializing
181     [    0.431026] NetLabel:  domain hash size = 128
182     [    0.431139] NetLabel:  protocols = UNLABELED CIPSOv4 CALIPSO
183     [    0.432960] NetLabel:  unlabeled traffic allowed by default
184     [    0.434622] HPET: 3 timers in total, 0 timers will be used for per-cpu timer
185     [    0.435078] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
186     [    0.435253] hpet0: 3 comparators, 64-bit 100.000000 MHz counter
187     [    0.439456] clocksource: Switched to clocksource hpet
188     [    0.525641] VFS: Disk quotas dquot_6.6.0
189     [    0.525932] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
190     [    0.528559] pnp: PnP ACPI init
191     [    0.534353] pnp: PnP ACPI: found 6 devices
192     [    0.610325] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns
193     [    0.612328] NET: Registered protocol family 2
194     [    0.616573] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
195     [    0.616866] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
196     [    0.617208] TCP: Hash tables configured (established 8192 bind 8192)
197     [    0.617669] UDP hash table entries: 512 (order: 2, 16384 bytes)
198     [    0.617902] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
199     [    0.619276] NET: Registered protocol family 1
200     [    0.621262] RPC: Registered named UNIX socket transport module.
201     [    0.621413] RPC: Registered udp transport module.
202     [    0.621520] RPC: Registered tcp transport module.
203     [    0.621619] RPC: Registered tcp NFSv4.1 backchannel transport module.
204     [    0.621843] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
205     [    0.622119] pci 0000:00:01.0: PIIX3: Enabling Passive Release
206     [    0.622445] pci 0000:00:01.0: Activating ISA DMA hang workarounds
207     [    0.622864] pci 0000:00:02.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff]
208     [    0.626815] Trying to unpack rootfs image as initramfs...
209     [    0.632405] rootfs image is not initramfs (no cpio magic); looks like an initrd
210     [    0.666987] Freeing initrd memory: 4684K
211     [    0.672966] Scanning for low memory corruption every 60 seconds
212     [    0.682999] audit: initializing netlink subsys (disabled)
213     [    0.684270] audit: type=2000 audit(1488016899.683:1): initialized
214     [    0.688482] workingset: timestamp_bits=30 max_order=18 bucket_order=0
215     [    0.696134] kworker/u4:0 (673) used greatest stack depth: 6924 bytes left
216     [    0.697355] kworker/u4:1 (681) used greatest stack depth: 6828 bytes left
217     [    0.723760] NFS: Registering the id_resolver key type
218     [    0.724638] Key type id_resolver registered
219     [    0.724750] Key type id_legacy registered
220     [    0.738476] bounce: pool size: 64 pages
221     [    0.738973] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
222     [    0.739724] io scheduler noop registered
223     [    0.739854] io scheduler deadline registered
224     [    0.740441] io scheduler cfq registered (default)
225     [    0.745788] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
226     [    0.746719] ACPI: Power Button [PWRF]
227     [    0.750459] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
228     [    0.795390] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
229     [    0.801266] Non-volatile memory driver v1.3
230     [    0.801804] Linux agpgart interface v0.103
231     [    0.803292] [drm] Initialized
232     [    0.855762] brd: module loaded
233     [    0.872555] loop: module loaded
234     [    0.883782] scsi host0: ata_piix
235     [    0.886438] scsi host1: ata_piix
236     [    0.886980] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc040 irq 14
237     [    0.887640] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc048 irq 15
238     [    0.891250] e100: Intel(R) PRO/100 Network Driver, 3.5.24-k2-NAPI
239     [    0.891388] e100: Copyright(c) 1999-2006 Intel Corporation
240     [    0.891622] e1000: Intel(R) PRO/1000 Network Driver - version 7.3.21-k8-NAPI
241     [    0.891804] e1000: Copyright (c) 1999-2006 Intel Corporation.
242     [    1.133121] ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 11
243     [    1.137419] ata2.00: ATAPI: QEMU DVD-ROM, 2.5+, max UDMA/100
244     [    1.138767] ata2.00: configured for MWDMA2
245     [    1.147488] scsi 1:0:0:0: CD-ROM            QEMU     QEMU DVD-ROM     2.5+ PQ: 0 ANSI: 5
246     [    1.169985] sr 1:0:0:0: [sr0] scsi3-mmc drive: 4x/4x cd/rw xa/form2 tray
247     [    1.170454] cdrom: Uniform CD-ROM driver Revision: 3.20
248     [    1.174183] sr 1:0:0:0: Attached scsi generic sg0 type 5
249     [    1.425975] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 52:54:00:12:34:56
250     [    1.426582] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
251     [    1.427218] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
252     [    1.427352] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
253     [    1.427623] sky2: driver version 1.30
254     [    1.430418] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
255     [    1.430583] ehci-pci: EHCI PCI platform driver
256     [    1.430883] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
257     [    1.431247] ohci-pci: OHCI PCI platform driver
258     [    1.431509] uhci_hcd: USB Universal Host Controller Interface driver
259     [    1.431906] usbcore: registered new interface driver usblp
260     [    1.432264] usbcore: registered new interface driver usb-storage
261     [    1.432929] i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
262     [    1.436670] serio: i8042 KBD port at 0x60,0x64 irq 1
263     [    1.436951] serio: i8042 AUX port at 0x60,0x64 irq 12
264     [    1.439909] mousedev: PS/2 mouse device common for all mice
265     [    1.444141] rtc_cmos 00:00: RTC can wake from S4
266     [    1.445672] rtc_cmos 00:00: rtc core: registered rtc_cmos as rtc0
267     [    1.446270] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input1
268     [    1.447351] rtc_cmos 00:00: alarms up to one day, y3k, 114 bytes nvram, hpet irqs
269     [    1.449199] device-mapper: ioctl: 4.35.0-ioctl (2016-06-23) initialised: dm-devel@redhat.com
270     [    1.449995] hidraw: raw HID events driver (C) Jiri Kosina
271     [    1.458419] usbcore: registered new interface driver usbhid
272     [    1.458590] usbhid: USB HID core driver
273     [    1.469901] Netfilter messages via NETLINK v0.30.
274     [    1.474476] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
275     [    1.476415] ctnetlink v0.93: registering with nfnetlink.
276     [    1.478914] ip_tables: (C) 2000-2006 Netfilter Core Team
277     [    1.480537] Initializing XFRM netlink socket
278     [    1.482724] NET: Registered protocol family 10
279     [    1.488410] Segment Routing with IPv6
280     [    1.488994] ip6_tables: (C) 2000-2006 Netfilter Core Team
281     [    1.490959] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
282     [    1.493871] NET: Registered protocol family 17
283     [    1.494457] Key type dns_resolver registered
284     [    1.494596] mce: Unable to init device /dev/mcelog (rc: -5)
285     [    1.495295] Using IPI No-Shortcut mode
286     [    1.497003] registered taskstats version 1
287     [    1.499416]   Magic number: 5:873:22
288     [    1.499855] console [netcon0] enabled
289     [    1.499971] netconsole: network logging started
290     [    1.501668] ALSA device list:
291     [    1.501771]   No soundcards found.
292     [    1.663847] random: fast init done
293     [    1.695501] tsc: Refined TSC clocksource calibration: 3591.682 MHz
294     [    1.695834] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x33c5a15be52, max_idle_ns: 440795280454 ns
295     [    2.080707] input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input3
296     [    2.083629] md: Waiting for all devices to be available before autodetect
297     [    2.083856] md: If you don't use raid, use raid=noautodetect
298     [    2.087671] md: Autodetecting RAID arrays.
299     [    2.087899] md: autorun ...
300     [    2.088004] md: ... autorun DONE.
301     [    2.089417] RAMDISK: gzip image found at block 0
302     [    2.761025] clocksource: Switched to clocksource tsc
303     [    3.085065] EXT4-fs (ram0): mounted filesystem with ordered data mode. Opts: (null)
304     [    3.085708] VFS: Mounted root (ext4 filesystem) on device 1:0.
305     [    3.087372] devtmpfs: mounted
306     [    3.124532] Freeing unused kernel memory: 740K
307     [    3.124956] Write protecting the kernel text: 8668k
308     [    3.125632] Write protecting the kernel read-only data: 2620k
309     [    3.206262] mkdir (1034) used greatest stack depth: 6716 bytes left
310     [    3.431630] mdev (1036) used greatest stack depth: 6472 bytes left
311     [    3.465204] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
312     [    3.472420] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
313     [    3.475559] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
314     Please press Enter to activate this console.
315     [root@x86 ]#
316     [root@x86 ]#
317     [root@x86 ]# mount -t nfs -o nolock 192.168.1.6:/nfsroot /mnt
318     [   20.664186] mount (1050) used greatest stack depth: 5816 bytes left
319     [root@x86 ]#
320     [root@x86 ]# cd /mnt/
321     [root@x86 mnt]# ls
322     a.out                    interrupt_xeint14_15.ko  shadow3
323     dmesg.log                interrupt_xeint26_29.ko  trace
324     fdt                      mtd0ro                   trace.txt
325     group                    mtd1ro                   virt.dts
326     hello_32                 mtd2ro                   xeint26.ko
327     hello_aarch64            mtd3ro
328     interrupt_gpm4_0.ko      passwd
329     [root@x86 mnt]# ./hello_32
330     Hello world.
331     [root@x86 mnt]#
上面我们挂载了Host的共享目录

完。

posted @ 2017-02-25 19:57 摩斯电码 阅读(...) 评论(...) 编辑 收藏