码迷,mamicode.com
首页 > 其他好文 > 详细

用Qemu搭建x86_64学习环境

时间:2017-02-25 21:36:25      阅读:1225      评论:0      收藏:0      [点我收藏+]

标签:named   ifconfig   span   number   reference   oop   pid   fine   standard   

作者信息

作者:彭东林

邮箱:pengdonglin137@163.com

QQ:405728433

软件平台

主机: Ubuntu14.04 64位版本

模拟器:Qemu-2.8.0

Linux内核版本: Linux-4.10

Busybox版本:busybox-1.24.2

工具链: gcc

具备的功能

模拟一个双核或者单核的x86_64架构的系统,根文件系统用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_64 x86_64_defconfig
3 make O=out_x86_64 menuconfig
4 make O=out_x86_64 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)
然后执行
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/lib64
15 sudo cp -arf /lib/x86_64-linux-gnu/* rootfs/lib64/
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行,拷贝的是x86_64的库。

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

6、Qemu支持网络

请参考博客:

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

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

7、运行脚本

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

1 sudo qemu-system-x86_64 2     -smp 2 3     -m 1024M 4     -kernel ./linux-4.10/out_x86_64/arch/x86_64/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_x86_64:hello.c
2     gcc $^ -o $@
3 clean:
4     $(RM) hello_x86_64 *.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.a6e1e3920655    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:41:09 CST 2017
 11 [    0.000000] Command line: root=/dev/ram0 rw rootfstype=ext4 console=ttyS0 init=/linuxrc
 12 [    0.000000] x86/fpu: Legacy x87 FPU detected.
 13 [    0.000000] e820: BIOS-provided physical RAM map:
 14 [    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
 15 [    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
 16 [    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
 17 [    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000003ffdffff] usable
 18 [    0.000000] BIOS-e820: [mem 0x000000003ffe0000-0x000000003fffffff] reserved
 19 [    0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
 20 [    0.000000] NX (Execute Disable) protection: active
 21 [    0.000000] SMBIOS 2.8 present.
 22 [    0.000000] DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.10.1-0-g8891697-prebuilt.qemu-project.org 04/01/2014
 23 [    0.000000] e820: last_pfn = 0x3ffe0 max_arch_pfn = 0x400000000
 24 [    0.000000] x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WC  UC- WT  
 25 [    0.000000] found SMP MP-table at [mem 0x000f6a90-0x000f6a9f] mapped at [ffff8800000f6a90]
 26 [    0.000000] Scanning 1 areas for low memory corruption
 27 [    0.000000] RAMDISK: [mem 0x3f76f000-0x3ffdffff]
 28 [    0.000000] ACPI: Early table checksum verification disabled
 29 [    0.000000] ACPI: RSDP 0x00000000000F6860 000014 (v00 BOCHS )
 30 [    0.000000] ACPI: RSDT 0x000000003FFE1936 000030 (v01 BOCHS  BXPCRSDT 00000001 BXPC 00000001)
 31 [    0.000000] ACPI: FACP 0x000000003FFE180A 000074 (v01 BOCHS  BXPCFACP 00000001 BXPC 00000001)
 32 [    0.000000] ACPI: DSDT 0x000000003FFE0040 0017CA (v01 BOCHS  BXPCDSDT 00000001 BXPC 00000001)
 33 [    0.000000] ACPI: FACS 0x000000003FFE0000 000040
 34 [    0.000000] ACPI: APIC 0x000000003FFE187E 000080 (v01 BOCHS  BXPCAPIC 00000001 BXPC 00000001)
 35 [    0.000000] ACPI: HPET 0x000000003FFE18FE 000038 (v01 BOCHS  BXPCHPET 00000001 BXPC 00000001)
 36 [    0.000000] No NUMA configuration found
 37 [    0.000000] Faking a node at [mem 0x0000000000000000-0x000000003ffdffff]
 38 [    0.000000] NODE_DATA(0) allocated [mem 0x3f76b000-0x3f76efff]
 39 [    0.000000] Zone ranges:
 40 [    0.000000]   DMA      [mem 0x0000000000001000-0x0000000000ffffff]
 41 [    0.000000]   DMA32    [mem 0x0000000001000000-0x000000003ffdffff]
 42 [    0.000000]   Normal   empty
 43 [    0.000000] Movable zone start for each node
 44 [    0.000000] Early memory node ranges
 45 [    0.000000]   node   0: [mem 0x0000000000001000-0x000000000009efff]
 46 [    0.000000]   node   0: [mem 0x0000000000100000-0x000000003ffdffff]
 47 [    0.000000] Initmem setup node 0 [mem 0x0000000000001000-0x000000003ffdffff]
 48 [    0.000000] ACPI: PM-Timer IO Port: 0x608
 49 [    0.000000] ACPI: LAPIC_NMI (acpi_id[0xff] dfl dfl lint[0x1])
 50 [    0.000000] IOAPIC[0]: apic_id 0, version 32, address 0xfec00000, GSI 0-23
 51 [    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
 52 [    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
 53 [    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
 54 [    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
 55 [    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
 56 [    0.000000] Using ACPI (MADT) for SMP configuration information
 57 [    0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
 58 [    0.000000] smpboot: Allowing 2 CPUs, 0 hotplug CPUs
 59 [    0.000000] PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
 60 [    0.000000] PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff]
 61 [    0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000effff]
 62 [    0.000000] PM: Registered nosave memory: [mem 0x000f0000-0x000fffff]
 63 [    0.000000] e820: [mem 0x40000000-0xfffbffff] available for PCI devices
 64 [    0.000000] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1910969940391419 ns
 65 [    0.000000] setup_percpu: NR_CPUS:64 nr_cpumask_bits:64 nr_cpu_ids:2 nr_node_ids:1
 66 [    0.000000] percpu: Embedded 34 pages/cpu @ffff88003f400000 s100824 r8192 d30248 u1048576
 67 [    0.000000] Built 1 zonelists in Node order, mobility grouping on.  Total pages: 257897
 68 [    0.000000] Policy zone: DMA32
 69 [    0.000000] Kernel command line: root=/dev/ram0 rw rootfstype=ext4 console=ttyS0 init=/linuxrc
 70 [    0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)
 71 [    0.000000] Memory: 1004968K/1048056K available (9278K kernel code, 1238K rwdata, 2804K rodata, 1180K init, 800K bss, 43088K reserved, 0K cma-reserved)
 72 [    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
 73 [    0.000000] Hierarchical RCU implementation.
 74 [    0.000000]     Build-time adjustment of leaf fanout to 64.
 75 [    0.000000]     RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=2.
 76 [    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=2
 77 [    0.000000] NR_IRQS:4352 nr_irqs:440 16
 78 [    0.000000] Console: colour VGA+ 80x25
 79 [    0.000000] console [ttyS0] enabled
 80 [    0.000000] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604467 ns
 81 [    0.000000] tsc: Unable to calibrate against PIT
 82 [    0.000000] tsc: using HPET reference calibration
 83 [    0.000000] tsc: Detected 3591.691 MHz processor
 84 [    0.000000] tsc: Marking TSC unstable due to TSCs unsynchronized
 85 [    0.009000] Calibrating delay loop (skipped), value calculated using timer frequency.. 7183.38 BogoMIPS (lpj=3591691)
 86 [    0.009000] pid_max: default: 32768 minimum: 301
 87 [    0.009000] ACPI: Core revision 20160930
 88 [    0.026676] ACPI: 1 ACPI AML tables successfully acquired and loaded
 89 [    0.027506] Security Framework initialized
 90 [    0.027662] SELinux:  Initializing.
 91 [    0.028700] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes)
 92 [    0.030126] Inode-cache hash table entries: 65536 (order: 7, 524288 bytes)
 93 [    0.032123] Mount-cache hash table entries: 2048 (order: 2, 16384 bytes)
 94 [    0.032317] Mountpoint-cache hash table entries: 2048 (order: 2, 16384 bytes)
 95 [    0.041861] mce: CPU supports 10 MCE banks
 96 [    0.042731] Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0
 97 [    0.042871] Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0, 1GB 0
 98 [    0.045503] Freeing SMP alternatives memory: 36K
 99 [    0.053762] smpboot: Max logical packages: 2
100 [    0.056935] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
101 [    0.067000] smpboot: CPU0: AMD QEMU Virtual CPU version 2.5+ (family: 0x6, model: 0x6, stepping: 0x3)
102 [    0.069535] Performance Events: PMU not available due to virtualization, using software events only.
103 [    0.074611] Huh? What family is it: 0x6?!
104 [    0.076109] smp: Bringing up secondary CPUs ...
105 [    0.078263] x86: Booting SMP configuration:
106 [    0.078388] .... node  #0, CPUs:      #1
107 [    0.154337] smp: Brought up 1 node, 2 CPUs
108 [    0.155166] smpboot: Total of 2 processors activated (22280.71 BogoMIPS)
109 [    0.165179] devtmpfs: initialized
110 [    0.173105] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275000 ns
111 [    0.173978] futex hash table entries: 512 (order: 3, 32768 bytes)
112 [    0.179029] RTC time: 10:20:14, date: 02/25/17
113 [    0.181124] kworker/u4:0 (20) used greatest stack depth: 14472 bytes left
114 [    0.184192] NET: Registered protocol family 16
115 [    0.198105] cpuidle: using governor menu
116 [    0.198283] PCCT header not found.
117 [    0.199162] ACPI: bus type PCI registered
118 [    0.203021] PCI: Using configuration type 1 for base access
119 [    0.206635] mtrr: your CPUs had inconsistent fixed MTRR settings
120 [    0.206808] mtrr: your CPUs had inconsistent variable MTRR settings
121 [    0.207207] mtrr: your CPUs had inconsistent MTRRdefType settings
122 [    0.207207] mtrr: probably your BIOS does not setup all CPUs.
123 [    0.207289] mtrr: corrected configuration.
124 [    0.210240] kworker/u4:1 (49) used greatest stack depth: 14160 bytes left
125 [    0.332230] HugeTLB registered 2 MB page size, pre-allocated 0 pages
126 [    0.335289] ACPI: Added _OSI(Module Device)
127 [    0.335405] ACPI: Added _OSI(Processor Device)
128 [    0.335598] ACPI: Added _OSI(3.0 _SCP Extensions)
129 [    0.335706] ACPI: Added _OSI(Processor Aggregator Device)
130 [    0.352062] ACPI: Interpreter enabled
131 [    0.352801] ACPI: (supports S0 S3 S4 S5)
132 [    0.352921] ACPI: Using IOAPIC for interrupt routing
133 [    0.353377] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
134 [    0.405360] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
135 [    0.405851] acpi PNP0A03:00: _OSC: OS supports [ASPM ClockPM Segments MSI]
136 [    0.406182] acpi PNP0A03:00: _OSC failed (AE_NOT_FOUND); disabling ASPM
137 [    0.406675] acpi PNP0A03:00: fail to add MMCONFIG information, cant access extended PCI configuration space under this bridge.
138 [    0.408902] PCI host bridge to bus 0000:00
139 [    0.409130] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7 window]
140 [    0.409375] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff window]
141 [    0.409544] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff window]
142 [    0.409704] pci_bus 0000:00: root bus resource [mem 0x40000000-0xfebfffff window]
143 [    0.410110] pci_bus 0000:00: root bus resource [bus 00-ff]
144 [    0.418473] pci 0000:00:01.1: legacy IDE quirk: reg 0x10: [io  0x01f0-0x01f7]
145 [    0.418682] pci 0000:00:01.1: legacy IDE quirk: reg 0x14: [io  0x03f6]
146 [    0.419036] pci 0000:00:01.1: legacy IDE quirk: reg 0x18: [io  0x0170-0x0177]
147 [    0.419211] pci 0000:00:01.1: legacy IDE quirk: reg 0x1c: [io  0x0376]
148 [    0.421322] pci 0000:00:01.3: quirk: [io  0x0600-0x063f] claimed by PIIX4 ACPI
149 [    0.421586] pci 0000:00:01.3: quirk: [io  0x0700-0x070f] claimed by PIIX4 SMB
150 [    0.446234] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)
151 [    0.447156] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)
152 [    0.447840] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)
153 [    0.448645] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11)
154 [    0.449094] ACPI: PCI Interrupt Link [LNKS] (IRQs *9)
155 [    0.451577] ACPI: Enabled 3 GPEs in block 00 to 0F
156 [    0.456364] pci 0000:00:02.0: vgaarb: setting as boot VGA device
157 [    0.456785] pci 0000:00:02.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
158 [    0.457063] pci 0000:00:02.0: vgaarb: bridge control possible
159 [    0.457190] vgaarb: loaded
160 [    0.459405] SCSI subsystem initialized
161 [    0.461363] ACPI: bus type USB registered
162 [    0.461864] usbcore: registered new interface driver usbfs
163 [    0.462260] usbcore: registered new interface driver hub
164 [    0.463169] usbcore: registered new device driver usb
165 [    0.464285] pps_core: LinuxPPS API ver. 1 registered
166 [    0.464402] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
167 [    0.465114] PTP clock support registered
168 [    0.469693] Advanced Linux Sound Architecture Driver Initialized.
169 [    0.470222] PCI: Using ACPI for IRQ routing
170 [    0.480295] NetLabel: Initializing
171 [    0.480406] NetLabel:  domain hash size = 128
172 [    0.480707] NetLabel:  protocols = UNLABELED CIPSOv4 CALIPSO
173 [    0.481464] NetLabel:  unlabeled traffic allowed by default
174 [    0.483049] HPET: 3 timers in total, 0 timers will be used for per-cpu timer
175 [    0.483386] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
176 [    0.483624] hpet0: 3 comparators, 64-bit 100.000000 MHz counter
177 [    0.487542] clocksource: Switched to clocksource hpet
178 [    0.588177] VFS: Disk quotas dquot_6.6.0
179 [    0.588490] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
180 [    0.590893] pnp: PnP ACPI init
181 [    0.598426] pnp: PnP ACPI: found 6 devices
182 [    0.646345] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns
183 [    0.648184] NET: Registered protocol family 2
184 [    0.652593] TCP established hash table entries: 8192 (order: 4, 65536 bytes)
185 [    0.652927] TCP bind hash table entries: 8192 (order: 5, 131072 bytes)
186 [    0.653350] TCP: Hash tables configured (established 8192 bind 8192)
187 [    0.653829] UDP hash table entries: 512 (order: 2, 16384 bytes)
188 [    0.654180] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
189 [    0.655286] NET: Registered protocol family 1
190 [    0.657374] RPC: Registered named UNIX socket transport module.
191 [    0.657527] RPC: Registered udp transport module.
192 [    0.657631] RPC: Registered tcp transport module.
193 [    0.657726] RPC: Registered tcp NFSv4.1 backchannel transport module.
194 [    0.657928] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
195 [    0.658245] pci 0000:00:01.0: PIIX3: Enabling Passive Release
196 [    0.658455] pci 0000:00:01.0: Activating ISA DMA hang workarounds
197 [    0.658751] pci 0000:00:02.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff]
198 [    0.662439] Trying to unpack rootfs image as initramfs...
199 [    0.669607] rootfs image is not initramfs (no cpio magic); looks like an initrd
200 [    0.698383] Freeing initrd memory: 8644K
201 [    0.699468] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x33c5a9ddad2, max_idle_ns: 440795219320 ns
202 [    0.703998] Scanning for low memory corruption every 60 seconds
203 [    0.710591] audit: initializing netlink subsys (disabled)
204 [    0.715333] audit: type=2000 audit(1488018013.711:1): initialized
205 [    0.718177] workingset: timestamp_bits=56 max_order=18 bucket_order=0
206 [    0.767956] NFS: Registering the id_resolver key type
207 [    0.769311] Key type id_resolver registered
208 [    0.769427] Key type id_legacy registered
209 [    0.785538] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
210 [    0.785794] io scheduler noop registered
211 [    0.785909] io scheduler deadline registered
212 [    0.786669] io scheduler cfq registered (default)
213 [    0.790956] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
214 [    0.791820] ACPI: Power Button [PWRF]
215 [    0.796240] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
216 [    0.819336] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
217 [    0.827662] Non-volatile memory driver v1.3
218 [    0.828391] Linux agpgart interface v0.103
219 [    0.830989] [drm] Initialized
220 [    0.867435] brd: module loaded
221 [    0.884703] loop: module loaded
222 [    0.896392] scsi host0: ata_piix
223 [    0.898573] scsi host1: ata_piix
224 [    0.899532] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc040 irq 14
225 [    0.899700] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc048 irq 15
226 [    0.901891] e100: Intel(R) PRO/100 Network Driver, 3.5.24-k2-NAPI
227 [    0.903095] e100: Copyright(c) 1999-2006 Intel Corporation
228 [    0.903345] e1000: Intel(R) PRO/1000 Network Driver - version 7.3.21-k8-NAPI
229 [    0.903494] e1000: Copyright (c) 1999-2006 Intel Corporation.
230 [    1.102661] ata2.00: ATAPI: QEMU DVD-ROM, 2.5+, max UDMA/100
231 [    1.117575] ata2.00: configured for MWDMA2
232 [    1.136964] scsi 1:0:0:0: CD-ROM            QEMU     QEMU DVD-ROM     2.5+ PQ: 0 ANSI: 5
233 [    1.183328] ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 11
234 [    1.202817] sr 1:0:0:0: [sr0] scsi3-mmc drive: 4x/4x cd/rw xa/form2 tray
235 [    1.203356] cdrom: Uniform CD-ROM driver Revision: 3.20
236 [    1.207728] sr 1:0:0:0: Attached scsi generic sg0 type 5
237 [    1.474617] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 52:54:00:12:34:56
238 [    1.474924] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
239 [    1.475549] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
240 [    1.475684] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
241 [    1.475951] sky2: driver version 1.30
242 [    1.478937] ehci_hcd: USB 2.0 Enhanced Host Controller (EHCI) Driver
243 [    1.479389] ehci-pci: EHCI PCI platform driver
244 [    1.479687] ohci_hcd: USB 1.1 Open Host Controller (OHCI) Driver
245 [    1.479960] ohci-pci: OHCI PCI platform driver
246 [    1.480557] uhci_hcd: USB Universal Host Controller Interface driver
247 [    1.481535] usbcore: registered new interface driver usblp
248 [    1.481907] usbcore: registered new interface driver usb-storage
249 [    1.483563] i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
250 [    1.486466] serio: i8042 KBD port at 0x60,0x64 irq 1
251 [    1.486739] serio: i8042 AUX port at 0x60,0x64 irq 12
252 [    1.489399] mousedev: PS/2 mouse device common for all mice
253 [    1.492800] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input1
254 [    1.494820] rtc_cmos 00:00: RTC can wake from S4
255 [    1.501611] rtc_cmos 00:00: rtc core: registered rtc_cmos as rtc0
256 [    1.502504] rtc_cmos 00:00: alarms up to one day, y3k, 114 bytes nvram, hpet irqs
257 [    1.505932] device-mapper: ioctl: 4.35.0-ioctl (2016-06-23) initialised: dm-devel@redhat.com
258 [    1.507045] hidraw: raw HID events driver (C) Jiri Kosina
259 [    1.514381] usbcore: registered new interface driver usbhid
260 [    1.514528] usbhid: USB HID core driver
261 [    1.524201] Netfilter messages via NETLINK v0.30.
262 [    1.524908] nf_conntrack version 0.5.0 (8192 buckets, 32768 max)
263 [    1.527255] ctnetlink v0.93: registering with nfnetlink.
264 [    1.530996] ip_tables: (C) 2000-2006 Netfilter Core Team
265 [    1.532741] Initializing XFRM netlink socket
266 [    1.534844] NET: Registered protocol family 10
267 [    1.540609] Segment Routing with IPv6
268 [    1.541294] ip6_tables: (C) 2000-2006 Netfilter Core Team
269 [    1.543144] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
270 [    1.545893] NET: Registered protocol family 17
271 [    1.546460] Key type dns_resolver registered
272 [    1.551682] registered taskstats version 1
273 [    1.553817]   Magic number: 5:185:326
274 [    1.554409] console [netcon0] enabled
275 [    1.554521] netconsole: network logging started
276 [    1.556368] ALSA device list:
277 [    1.556455]   No soundcards found.
278 [    1.704711] random: fast init done
279 [    2.121610] input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input3
280 [    2.123965] md: Waiting for all devices to be available before autodetect
281 [    2.124244] md: If you dont use raid, use raid=noautodetect
282 [    2.127659] md: Autodetecting RAID arrays.
283 [    2.127797] md: autorun ...
284 [    2.127870] md: ... autorun DONE.
285 [    2.129152] RAMDISK: gzip image found at block 0
286 [    2.878970] EXT4-fs (ram0): mounted filesystem with ordered data mode. Opts: (null)
287 [    2.879655] VFS: Mounted root (ext4 filesystem) on device 1:0.
288 [    2.881365] devtmpfs: mounted
289 [    2.920682] Freeing unused kernel memory: 1180K
290 [    2.920888] Write protecting the kernel read-only data: 14336k
291 [    2.923297] Freeing unused kernel memory: 940K
292 [    2.939472] Freeing unused kernel memory: 1292K
293 [    3.257523] mkdir (1031) used greatest stack depth: 14072 bytes left
294 [    3.278876] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
295 [    3.279905] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
296 [    3.286569] rcS (1026) used greatest stack depth: 14000 bytes left
297 [    3.286946] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
298 Please press Enter to activate this console. 
299 [root@x86_64 ]# 
300 [root@x86_64 ]# 
301 [root@x86_64 ]# mount -t nfs -o nolock 192.168.1.6:/nfsroot /mnt
302 [   18.415282] mount (1043) used greatest stack depth: 12744 bytes left
303 [root@x86_64 ]# 
304 [root@x86_64 ]# cd /mnt
305 [root@x86_64 mnt]# ls
306 a.out                    interrupt_gpm4_0.ko      passwd
307 dmesg.log                interrupt_xeint14_15.ko  shadow3
308 fdt                      interrupt_xeint26_29.ko  trace
309 group                    mtd0ro                   trace.txt
310 hello_32                 mtd1ro                   virt.dts
311 hello_aarch64            mtd2ro                   xeint26.ko
312 hello_x86_64             mtd3ro
313 [root@x86_64 mnt]# ./hello_x86_64 
314 Hello world.
315 [root@x86_64 mnt]# 
上面我们挂载了Host的共享目录

完。

用Qemu搭建x86_64学习环境

标签:named   ifconfig   span   number   reference   oop   pid   fine   standard   

原文地址:http://www.cnblogs.com/pengdonglin137/p/6442624.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!