用Qemu搭建x86_64学习环境

时间:2021-07-15 17:25:41

作者信息

作者:彭东林

邮箱: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的命令:

 #!/bin/bash
make O=out_x86_64 x86_64_defconfig
make O=out_x86_64 menuconfig
make O=out_x86_64 bzImage -j8
由于下面要用到ramdisk的启动方式,需要在kernel配置中支持:
 General setup  --->
----> [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support
Device Drivers --->
[*] Block devices --->
<*> RAM block device support
() 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,配置下面几项:

 Busybox Settings  --->
Build Options --->
[*] Build BusyBox as a static binary (no shared libs)
然后执行
     make -j4
make install

5、制作ramdisk镜像

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

 #!/bin/bash
sudo rm -rf rootfs
sudo rm -rf tmpfs
sudo rm -rf ramdisk*
sudo mkdir rootfs
sudo cp ../busybox-1.24./_install/* rootfs/ -raf
sudo mkdir -p rootfs/proc/
sudo mkdir -p rootfs/sys/
sudo mkdir -p rootfs/tmp/
sudo mkdir -p rootfs/root/
sudo mkdir -p rootfs/var/
sudo mkdir -p rootfs/mnt/
sudo cp etc rootfs/ -arf
sudo mkdir -p rootfs/lib64
sudo cp -arf /lib/x86_64-linux-gnu/* rootfs/lib64/
sudo rm rootfs/lib/*.a
sudo strip rootfs/lib/*
sudo mkdir -p rootfs/dev/
sudo mknod rootfs/dev/tty1 c 4 1
sudo mknod rootfs/dev/tty2 c 4 2
sudo mknod rootfs/dev/tty3 c 4 3
sudo mknod rootfs/dev/tty4 c 4 4
sudo mknod rootfs/dev/console c 5 1
sudo mknod rootfs/dev/null c 1 3
sudo dd if=/dev/zero of=ramdisk bs=1M count=32
sudo mkfs.ext4 -F ramdisk
sudo mkdir -p tmpfs
sudo mount -t ext4 ramdisk ./tmpfs/ -o loop
sudo cp -raf rootfs/* tmpfs/
sudo umount tmpfs
sudo gzip --best -c ramdisk > ramdisk.gz
上面需要注意的是第20行,拷贝的是x86_64的库。

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

6、Qemu支持网络

请参考博客:

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

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

7、运行脚本

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

 sudo qemu-system-x86_64 \
-smp \
-m 1024M \
-kernel ./linux-4.10/out_x86_64/arch/x86_64/boot/bzImage \
-nographic \
-append "root=/dev/ram0 rw rootfstype=ext4 console=ttyS0 init=/linuxrc" \
-initrd ./rootfs/ramdisk.gz \
-net nic,vlan= -net tap,vlan=,ifname=tap0

8、hello world

hello.c

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

Makefile

 hello_x86_64:hello.c
gcc $^ -o $@
clean:
$(RM) hello_x86_64 *.o
.PHONY: clean

9、启动log

 $./run.sh
sudo tunctl -u root -t tap0
TUNSETIFF: Device or resource busy
sudo ifconfig tap0 0.0.0.0 promisc up
sudo brctl addif br0 tap0
brctl show
bridge name bridge id STP enabled interfaces
br0 .a6e1e3920655 no eth0
tap0
[ 0.000000] Linux version 4.10. (pengdonglin@pengdonglin-dell) (gcc version 4.8. (Ubuntu 4.8.-2ubuntu1~14.04.) ) # SMP Sat Feb :: CST
[ 0.000000] Command line: root=/dev/ram0 rw rootfstype=ext4 console=ttyS0 init=/linuxrc
[ 0.000000] x86/fpu: Legacy x87 FPU detected.
[ 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-0x000000003ffdffff] usable
[ 0.000000] BIOS-e820: [mem 0x000000003ffe0000-0x000000003fffffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[ 0.000000] NX (Execute Disable) protection: active
[ 0.000000] SMBIOS 2.8 present.
[ 0.000000] DMI: QEMU Standard PC (i440FX + PIIX, ), BIOS rel-1.10.--g8891697-prebuilt.qemu-project.org //
[ 0.000000] e820: last_pfn = 0x3ffe0 max_arch_pfn = 0x400000000
[ 0.000000] x86/PAT: Configuration [-]: WB WC UC- UC WB WC UC- WT
[ 0.000000] found SMP MP-table at [mem 0x000f6a90-0x000f6a9f] mapped at [ffff8800000f6a90]
[ 0.000000] Scanning areas for low memory corruption
[ 0.000000] RAMDISK: [mem 0x3f76f000-0x3ffdffff]
[ 0.000000] ACPI: Early table checksum verification disabled
[ 0.000000] ACPI: RSDP 0x00000000000F6860 (v00 BOCHS )
[ 0.000000] ACPI: RSDT 0x000000003FFE1936 (v01 BOCHS BXPCRSDT BXPC )
[ 0.000000] ACPI: FACP 0x000000003FFE180A (v01 BOCHS BXPCFACP BXPC )
[ 0.000000] ACPI: DSDT 0x000000003FFE0040 0017CA (v01 BOCHS BXPCDSDT BXPC )
[ 0.000000] ACPI: FACS 0x000000003FFE0000
[ 0.000000] ACPI: APIC 0x000000003FFE187E (v01 BOCHS BXPCAPIC BXPC )
[ 0.000000] ACPI: HPET 0x000000003FFE18FE (v01 BOCHS BXPCHPET BXPC )
[ 0.000000] No NUMA configuration found
[ 0.000000] Faking a node at [mem 0x0000000000000000-0x000000003ffdffff]
[ 0.000000] NODE_DATA() allocated [mem 0x3f76b000-0x3f76efff]
[ 0.000000] Zone ranges:
[ 0.000000] DMA [mem 0x0000000000001000-0x0000000000ffffff]
[ 0.000000] DMA32 [mem 0x0000000001000000-0x000000003ffdffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node : [mem 0x0000000000001000-0x000000000009efff]
[ 0.000000] node : [mem 0x0000000000100000-0x000000003ffdffff]
[ 0.000000] Initmem setup node [mem 0x0000000000001000-0x000000003ffdffff]
[ 0.000000] ACPI: PM-Timer IO Port: 0x608
[ 0.000000] ACPI: LAPIC_NMI (acpi_id[0xff] dfl dfl lint[0x1])
[ 0.000000] IOAPIC[]: apic_id , version , address 0xfec00000, GSI -
[ 0.000000] ACPI: INT_SRC_OVR (bus bus_irq global_irq dfl dfl)
[ 0.000000] ACPI: INT_SRC_OVR (bus bus_irq global_irq high level)
[ 0.000000] ACPI: INT_SRC_OVR (bus bus_irq global_irq high level)
[ 0.000000] ACPI: INT_SRC_OVR (bus bus_irq global_irq high level)
[ 0.000000] ACPI: INT_SRC_OVR (bus bus_irq global_irq high level)
[ 0.000000] Using ACPI (MADT) for SMP configuration information
[ 0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[ 0.000000] smpboot: Allowing CPUs, 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 0x40000000-0xfffbffff] available for PCI devices
[ 0.000000] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: ns
[ 0.000000] setup_percpu: NR_CPUS: nr_cpumask_bits: nr_cpu_ids: nr_node_ids:
[ 0.000000] percpu: Embedded pages/cpu @ffff88003f400000 s100824 r8192 d30248 u1048576
[ 0.000000] Built zonelists in Node order, mobility grouping on. Total pages:
[ 0.000000] Policy zone: DMA32
[ 0.000000] Kernel command line: root=/dev/ram0 rw rootfstype=ext4 console=ttyS0 init=/linuxrc
[ 0.000000] PID hash table entries: (order: , bytes)
[ 0.000000] Memory: 1004968K/1048056K available (9278K kernel code, 1238K rwdata, 2804K rodata, 1180K init, 800K bss, 43088K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=, Order=-, MinObjects=, CPUs=, Nodes=
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] Build-time adjustment of leaf fanout to .
[ 0.000000] RCU restricting CPUs from NR_CPUS= to nr_cpu_ids=.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=, nr_cpu_ids=
[ 0.000000] NR_IRQS: nr_irqs:
[ 0.000000] Console: colour VGA+ 80x25
[ 0.000000] console [ttyS0] enabled
[ 0.000000] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: ns
[ 0.000000] tsc: Unable to calibrate against PIT
[ 0.000000] tsc: using HPET reference calibration
[ 0.000000] tsc: Detected 3591.691 MHz processor
[ 0.000000] tsc: Marking TSC unstable due to TSCs unsynchronized
[ 0.009000] Calibrating delay loop (skipped), value calculated using timer frequency.. 7183.38 BogoMIPS (lpj=)
[ 0.009000] pid_max: default: minimum:
[ 0.009000] ACPI: Core revision
[ 0.026676] ACPI: ACPI AML tables successfully acquired and loaded
[ 0.027506] Security Framework initialized
[ 0.027662] SELinux: Initializing.
[ 0.028700] Dentry cache hash table entries: (order: , bytes)
[ 0.030126] Inode-cache hash table entries: (order: , bytes)
[ 0.032123] Mount-cache hash table entries: (order: , bytes)
[ 0.032317] Mountpoint-cache hash table entries: (order: , bytes)
[ 0.041861] mce: CPU supports MCE banks
[ 0.042731] Last level iTLB entries: 4KB , 2MB , 4MB
[ 0.042871] Last level dTLB entries: 4KB , 2MB , 4MB , 1GB
[ 0.045503] Freeing SMP alternatives memory: 36K
[ 0.053762] smpboot: Max logical packages:
[ 0.056935] ..TIMER: vector=0x30 apic1= pin1= apic2=- pin2=-
[ 0.067000] smpboot: CPU0: AMD QEMU Virtual CPU version 2.5+ (family: 0x6, model: 0x6, stepping: 0x3)
[ 0.069535] Performance Events: PMU not available due to virtualization, using software events only.
[ 0.074611] Huh? What family is it: 0x6?!
[ 0.076109] smp: Bringing up secondary CPUs ...
[ 0.078263] x86: Booting SMP configuration:
[ 0.078388] .... node #, CPUs: #
[ 0.154337] smp: Brought up node, CPUs
[ 0.155166] smpboot: Total of processors activated (22280.71 BogoMIPS)
[ 0.165179] devtmpfs: initialized
[ 0.173105] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: ns
[ 0.173978] futex hash table entries: (order: , bytes)
[ 0.179029] RTC time: ::, date: //
[ 0.181124] kworker/u4: () used greatest stack depth: bytes left
[ 0.184192] NET: Registered protocol family
[ 0.198105] cpuidle: using governor menu
[ 0.198283] PCCT header not found.
[ 0.199162] ACPI: bus type PCI registered
[ 0.203021] PCI: Using configuration type for base access
[ 0.206635] mtrr: your CPUs had inconsistent fixed MTRR settings
[ 0.206808] mtrr: your CPUs had inconsistent variable MTRR settings
[ 0.207207] mtrr: your CPUs had inconsistent MTRRdefType settings
[ 0.207207] mtrr: probably your BIOS does not setup all CPUs.
[ 0.207289] mtrr: corrected configuration.
[ 0.210240] kworker/u4: () used greatest stack depth: bytes left
[ 0.332230] HugeTLB registered MB page size, pre-allocated pages
[ 0.335289] ACPI: Added _OSI(Module Device)
[ 0.335405] ACPI: Added _OSI(Processor Device)
[ 0.335598] ACPI: Added _OSI(3.0 _SCP Extensions)
[ 0.335706] ACPI: Added _OSI(Processor Aggregator Device)
[ 0.352062] ACPI: Interpreter enabled
[ 0.352801] ACPI: (supports S0 S3 S4 S5)
[ 0.352921] ACPI: Using IOAPIC for interrupt routing
[ 0.353377] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[ 0.405360] ACPI: PCI Root Bridge [PCI0] (domain [bus -ff])
[ 0.405851] acpi PNP0A03:: _OSC: OS supports [ASPM ClockPM Segments MSI]
[ 0.406182] acpi PNP0A03:: _OSC failed (AE_NOT_FOUND); disabling ASPM
[ 0.406675] acpi PNP0A03:: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge.
[ 0.408902] PCI host bridge to bus :
[ 0.409130] pci_bus :: root bus resource [io 0x0000-0x0cf7 window]
[ 0.409375] pci_bus :: root bus resource [io 0x0d00-0xffff window]
[ 0.409544] pci_bus :: root bus resource [mem 0x000a0000-0x000bffff window]
[ 0.409704] pci_bus :: root bus resource [mem 0x40000000-0xfebfffff window]
[ 0.410110] pci_bus :: root bus resource [bus -ff]
[ 0.418473] pci ::01.1: legacy IDE quirk: reg 0x10: [io 0x01f0-0x01f7]
[ 0.418682] pci ::01.1: legacy IDE quirk: reg 0x14: [io 0x03f6]
[ 0.419036] pci ::01.1: legacy IDE quirk: reg 0x18: [io 0x0170-0x0177]
[ 0.419211] pci ::01.1: legacy IDE quirk: reg 0x1c: [io 0x0376]
[ 0.421322] pci ::01.3: quirk: [io 0x0600-0x063f] claimed by PIIX4 ACPI
[ 0.421586] pci ::01.3: quirk: [io 0x0700-0x070f] claimed by PIIX4 SMB
[ 0.446234] ACPI: PCI Interrupt Link [LNKA] (IRQs * )
[ 0.447156] ACPI: PCI Interrupt Link [LNKB] (IRQs * )
[ 0.447840] ACPI: PCI Interrupt Link [LNKC] (IRQs *)
[ 0.448645] ACPI: PCI Interrupt Link [LNKD] (IRQs *)
[ 0.449094] ACPI: PCI Interrupt Link [LNKS] (IRQs *)
[ 0.451577] ACPI: Enabled GPEs in block to 0F
[ 0.456364] pci ::02.0: vgaarb: setting as boot VGA device
[ 0.456785] pci ::02.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
[ 0.457063] pci ::02.0: vgaarb: bridge control possible
[ 0.457190] vgaarb: loaded
[ 0.459405] SCSI subsystem initialized
[ 0.461363] ACPI: bus type USB registered
[ 0.461864] usbcore: registered new interface driver usbfs
[ 0.462260] usbcore: registered new interface driver hub
[ 0.463169] usbcore: registered new device driver usb
[ 0.464285] pps_core: LinuxPPS API ver. registered
[ 0.464402] pps_core: Software ver. 5.3. - Copyright - Rodolfo Giometti <giometti@linux.it>
[ 0.465114] PTP clock support registered
[ 0.469693] Advanced Linux Sound Architecture Driver Initialized.
[ 0.470222] PCI: Using ACPI for IRQ routing
[ 0.480295] NetLabel: Initializing
[ 0.480406] NetLabel: domain hash size =
[ 0.480707] NetLabel: protocols = UNLABELED CIPSOv4 CALIPSO
[ 0.481464] NetLabel: unlabeled traffic allowed by default
[ 0.483049] HPET: timers in total, timers will be used for per-cpu timer
[ 0.483386] hpet0: at MMIO 0xfed00000, IRQs , ,
[ 0.483624] hpet0: comparators, -bit 100.000000 MHz counter
[ 0.487542] clocksource: Switched to clocksource hpet
[ 0.588177] VFS: Disk quotas dquot_6.6.0
[ 0.588490] VFS: Dquot-cache hash table entries: (order , bytes)
[ 0.590893] pnp: PnP ACPI init
[ 0.598426] pnp: PnP ACPI: found devices
[ 0.646345] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: ns
[ 0.648184] NET: Registered protocol family
[ 0.652593] TCP established hash table entries: (order: , bytes)
[ 0.652927] TCP bind hash table entries: (order: , bytes)
[ 0.653350] TCP: Hash tables configured (established bind )
[ 0.653829] UDP hash table entries: (order: , bytes)
[ 0.654180] UDP-Lite hash table entries: (order: , bytes)
[ 0.655286] NET: Registered protocol family
[ 0.657374] RPC: Registered named UNIX socket transport module.
[ 0.657527] RPC: Registered udp transport module.
[ 0.657631] RPC: Registered tcp transport module.
[ 0.657726] RPC: Registered tcp NFSv4. backchannel transport module.
[ 0.657928] pci ::00.0: Limiting direct PCI/PCI transfers
[ 0.658245] pci ::01.0: PIIX3: Enabling Passive Release
[ 0.658455] pci ::01.0: Activating ISA DMA hang workarounds
[ 0.658751] pci ::02.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff]
[ 0.662439] Trying to unpack rootfs image as initramfs...
[ 0.669607] rootfs image is not initramfs (no cpio magic); looks like an initrd
[ 0.698383] Freeing initrd memory: 8644K
[ 0.699468] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x33c5a9ddad2, max_idle_ns: ns
[ 0.703998] Scanning for low memory corruption every seconds
[ 0.710591] audit: initializing netlink subsys (disabled)
[ 0.715333] audit: type= audit(1488018013.711:): initialized
[ 0.718177] workingset: timestamp_bits= max_order= bucket_order=
[ 0.767956] NFS: Registering the id_resolver key type
[ 0.769311] Key type id_resolver registered
[ 0.769427] Key type id_legacy registered
[ 0.785538] Block layer SCSI generic (bsg) driver version 0.4 loaded (major )
[ 0.785794] io scheduler noop registered
[ 0.785909] io scheduler deadline registered
[ 0.786669] io scheduler cfq registered (default)
[ 0.790956] input: Power Button as /devices/LNXSYSTM:/LNXPWRBN:/input/input0
[ 0.791820] ACPI: Power Button [PWRF]
[ 0.796240] Serial: / driver, ports, IRQ sharing enabled
[ 0.819336] :: ttyS0 at I/O 0x3f8 (irq = , base_baud = ) is a 16550A
[ 0.827662] Non-volatile memory driver v1.
[ 0.828391] Linux agpgart interface v0.
[ 0.830989] [drm] Initialized
[ 0.867435] brd: module loaded
[ 0.884703] loop: module loaded
[ 0.896392] scsi host0: ata_piix
[ 0.898573] scsi host1: ata_piix
[ 0.899532] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc040 irq
[ 0.899700] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc048 irq
[ 0.901891] e100: Intel(R) PRO/ Network Driver, 3.5.-k2-NAPI
[ 0.903095] e100: Copyright(c) - Intel Corporation
[ 0.903345] e1000: Intel(R) PRO/ Network Driver - version 7.3.-k8-NAPI
[ 0.903494] e1000: Copyright (c) - Intel Corporation.
[ 1.102661] ata2.: ATAPI: QEMU DVD-ROM, 2.5+, max UDMA/
[ 1.117575] ata2.: configured for MWDMA2
[ 1.136964] scsi :::: CD-ROM QEMU QEMU DVD-ROM 2.5+ PQ: ANSI:
[ 1.183328] ACPI: PCI Interrupt Link [LNKC] enabled at IRQ
[ 1.202817] sr :::: [sr0] scsi3-mmc drive: 4x/4x cd/rw xa/form2 tray
[ 1.203356] cdrom: Uniform CD-ROM driver Revision: 3.20
[ 1.207728] sr :::: Attached scsi generic sg0 type
[ 1.474617] e1000 ::03.0 eth0: (PCI:33MHz:-bit) :::::
[ 1.474924] e1000 ::03.0 eth0: Intel(R) PRO/ Network Connection
[ 1.475549] e1000e: Intel(R) PRO/ Network Driver - 3.2.-k
[ 1.475684] e1000e: Copyright(c) - Intel Corporation.
[ 1.475951] sky2: driver version 1.30
[ 1.478937] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.479389] ehci-pci: EHCI PCI platform driver
[ 1.479687] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1.479960] ohci-pci: OHCI PCI platform driver
[ 1.480557] uhci_hcd: USB Universal Host Controller Interface driver
[ 1.481535] usbcore: registered new interface driver usblp
[ 1.481907] usbcore: registered new interface driver usb-storage
[ 1.483563] i8042: PNP: PS/ Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq ,
[ 1.486466] serio: i8042 KBD port at 0x60,0x64 irq
[ 1.486739] serio: i8042 AUX port at 0x60,0x64 irq
[ 1.489399] mousedev: PS/ mouse device common for all mice
[ 1.492800] input: AT Translated Set keyboard as /devices/platform/i8042/serio0/input/input1
[ 1.494820] rtc_cmos :: RTC can wake from S4
[ 1.501611] rtc_cmos :: rtc core: registered rtc_cmos as rtc0
[ 1.502504] rtc_cmos :: alarms up to one day, y3k, bytes nvram, hpet irqs
[ 1.505932] device-mapper: ioctl: 4.35.-ioctl (--) initialised: dm-devel@redhat.com
[ 1.507045] hidraw: raw HID events driver (C) Jiri Kosina
[ 1.514381] usbcore: registered new interface driver usbhid
[ 1.514528] usbhid: USB HID core driver
[ 1.524201] Netfilter messages via NETLINK v0..
[ 1.524908] nf_conntrack version 0.5. ( buckets, max)
[ 1.527255] ctnetlink v0.: registering with nfnetlink.
[ 1.530996] ip_tables: (C) - Netfilter Core Team
[ 1.532741] Initializing XFRM netlink socket
[ 1.534844] NET: Registered protocol family
[ 1.540609] Segment Routing with IPv6
[ 1.541294] ip6_tables: (C) - Netfilter Core Team
[ 1.543144] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 1.545893] NET: Registered protocol family
[ 1.546460] Key type dns_resolver registered
[ 1.551682] registered taskstats version
[ 1.553817] Magic number: ::
[ 1.554409] console [netcon0] enabled
[ 1.554521] netconsole: network logging started
[ 1.556368] ALSA device list:
[ 1.556455] No soundcards found.
[ 1.704711] random: fast init done
[ 2.121610] input: ImExPS/ Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input3
[ 2.123965] md: Waiting for all devices to be available before autodetect
[ 2.124244] md: If you don't use raid, use raid=noautodetect
[ 2.127659] md: Autodetecting RAID arrays.
[ 2.127797] md: autorun ...
[ 2.127870] md: ... autorun DONE.
[ 2.129152] RAMDISK: gzip image found at block
[ 2.878970] EXT4-fs (ram0): mounted filesystem with ordered data mode. Opts: (null)
[ 2.879655] VFS: Mounted root (ext4 filesystem) on device :.
[ 2.881365] devtmpfs: mounted
[ 2.920682] Freeing unused kernel memory: 1180K
[ 2.920888] Write protecting the kernel read-only data: 14336k
[ 2.923297] Freeing unused kernel memory: 940K
[ 2.939472] Freeing unused kernel memory: 1292K
[ 3.257523] mkdir () used greatest stack depth: bytes left
[ 3.278876] e1000: eth0 NIC Link is Up Mbps Full Duplex, Flow Control: RX
[ 3.279905] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 3.286569] rcS () used greatest stack depth: bytes left
[ 3.286946] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Please press Enter to activate this console.
[root@x86_64 ]#
[root@x86_64 ]#
[root@x86_64 ]# mount -t nfs -o nolock 192.168.1.6:/nfsroot /mnt
[ 18.415282] mount () used greatest stack depth: bytes left
[root@x86_64 ]#
[root@x86_64 ]# cd /mnt
[root@x86_64 mnt]# ls
a.out interrupt_gpm4_0.ko passwd
dmesg.log interrupt_xeint14_15.ko shadow3
fdt interrupt_xeint26_29.ko trace
group mtd0ro trace.txt
hello_32 mtd1ro virt.dts
hello_aarch64 mtd2ro xeint26.ko
hello_x86_64 mtd3ro
[root@x86_64 mnt]# ./hello_x86_64
Hello world.
[root@x86_64 mnt]#
上面我们挂载了Host的共享目录

完。