用Qemu搭建x86学习环境

时间:2021-08-20 01:30:52

作者信息

作者:彭东林

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

     #!/bin/bash
make O=out_x86 i386_defconfig
make O=out_x86 menuconfig
make O=out_x86 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)
(-m32 -march=i386 -mtune=i386) Additional CFLAGS
(-m32) Additional LDFLAGS

然后执行

     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/lib
sudo cp -arf /lib/i386-linux-gnu/* rootfs/lib/
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行,拷贝的是i386的库。

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

6、Qemu支持网络

请参考博客:

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

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

7、运行脚本

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

     sudo qemu-system-i386 \
-smp \
-m 1024M \
-kernel ./linux-4.10/out_x86/arch/x86/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_32:hello.c
gcc -m32 -march=i386 -mtune=i386 $^ -o $@
clean:
$(RM) hello_32 *.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 .eaca1d86f75f 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] 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] Notice: NX (Execute Disable) protection missing in CPU!
[ 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 = 0x100000
[ 0.000000] MTRR: Disabled
[ 0.000000] x86/PAT: MTRRs disabled, skipping PAT initialization too.
[ 0.000000] x86/PAT: Configuration [-]: WB WT UC- UC WB WT UC- UC
[ 0.000000] found SMP MP-table at [mem 0x000f6a90-0x000f6a9f] mapped at [c00f6a90]
[ 0.000000] Scanning areas for low memory corruption
[ 0.000000] RAMDISK: [mem 0x3fb4d000-0x3ffdffff]
[ 0.000000] Allocated new RAMDISK: [mem 0x3736b000-0x377fdc05]
[ 0.000000] Move RAMDISK from [mem 0x3fb4d000-0x3ffdfc05] to [mem 0x3736b000-0x377fdc05]
[ 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] 135MB HIGHMEM available.
[ 0.000000] 887MB LOWMEM available.
[ 0.000000] mapped low ram: - 377fe000
[ 0.000000] low ram: - 377fe000
[ 0.000000] Zone ranges:
[ 0.000000] DMA [mem 0x0000000000001000-0x0000000000ffffff]
[ 0.000000] Normal [mem 0x0000000001000000-0x00000000377fdfff]
[ 0.000000] HighMem [mem 0x00000000377fe000-0x000000003ffdffff]
[ 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] Using APIC driver default
[ 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 @f6b40000 s51084 r0 d30836 u81920
[ 0.000000] Built zonelists in Zone order, mobility grouping on. Total pages:
[ 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] Dentry cache hash table entries: (order: , bytes)
[ 0.000000] Inode-cache hash table entries: (order: , bytes)
[ 0.000000] Initializing CPU#
[ 0.000000] Initializing HighMem for node (000377fe:0003ffe0)
[ 0.000000] Initializing Movable for node (:)
[ 0.000000] Memory: 1020616K/1048056K available (8665K kernel code, 791K rwdata, 2608K rodata, 740K init, 616K bss, 27440K reserved, 0K cma-reserved, 139144K highmem)
[ 0.000000] virtual kernel memory layout:
[ 0.000000] fixmap : 0xfff16000 - 0xfffff000 ( kB)
[ 0.000000] pkmap : 0xff800000 - 0xffc00000 ( kB)
[ 0.000000] vmalloc : 0xf7ffe000 - 0xff7fe000 ( MB)
[ 0.000000] lowmem : 0xc0000000 - 0xf77fe000 ( MB)
[ 0.000000] .init : 0xc1bcd000 - 0xc1c86000 ( kB)
[ 0.000000] .data : 0xc18767f9 - 0xc1bcbc00 ( kB)
[ 0.000000] .text : 0xc1000000 - 0xc18767f9 ( kB)
[ 0.000000] Checking if this processor honours the WP bit even in supervisor mode...Ok.
[ 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.694 MHz processor
[ 0.007775] Calibrating delay loop (skipped), value calculated using timer frequency.. 7183.38 BogoMIPS (lpj=)
[ 0.008377] pid_max: default: minimum:
[ 0.008594] ACPI: Core revision
[ 0.024739] ACPI: ACPI AML tables successfully acquired and loaded
[ 0.025401] Security Framework initialized
[ 0.025561] SELinux: Initializing.
[ 0.026077] Mount-cache hash table entries: (order: , bytes)
[ 0.026244] Mountpoint-cache hash table entries: (order: , bytes)
[ 0.036746] Last level iTLB entries: 4KB , 2MB , 4MB
[ 0.037026] Last level dTLB entries: 4KB , 2MB , 4MB , 1GB
[ 0.038602] Freeing SMP alternatives memory: 36K
[ 0.046078] smpboot: Max logical packages:
[ 0.046445] Enabling APIC mode: Flat. Using I/O APICs
[ 0.049000] ..TIMER: vector=0x30 apic1= pin1= apic2=- pin2=-
[ 0.059000] smpboot: CPU0: Intel QEMU Virtual CPU version 2.5+ (family: 0x6, model: 0x6, stepping: 0x3)
[ 0.061377] Performance Events: PMU not available due to virtualization, using software events only.
[ 0.066376] smp: Bringing up secondary CPUs ...
[ 0.067926] x86: Booting SMP configuration:
[ 0.068054] .... node #, CPUs: #
[ 0.008000] Initializing CPU#
[ 0.133078] smp: Brought up node, CPUs
[ 0.134067] smpboot: Total of processors activated (22285.22 BogoMIPS)
[ 0.143032] devtmpfs: initialized
[ 0.149863] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: ns
[ 0.150090] futex hash table entries: (order: , bytes)
[ 0.155150] RTC time: ::, date: //
[ 0.157028] kworker/u4: () used greatest stack depth: bytes left
[ 0.161333] NET: Registered protocol family
[ 0.173097] cpuidle: using governor menu
[ 0.173970] ACPI: bus type PCI registered
[ 0.177353] PCI: PCI BIOS revision 2.10 entry at 0xfd536, last bus=
[ 0.177600] PCI: Using configuration type for base access
[ 0.207832] kworker/u4: () used greatest stack depth: bytes left
[ 0.289247] HugeTLB registered MB page size, pre-allocated pages
[ 0.292279] ACPI: Added _OSI(Module Device)
[ 0.292521] ACPI: Added _OSI(Processor Device)
[ 0.292643] ACPI: Added _OSI(3.0 _SCP Extensions)
[ 0.292781] ACPI: Added _OSI(Processor Aggregator Device)
[ 0.309740] ACPI: Interpreter enabled
[ 0.310448] ACPI: (supports S0 S3 S4 S5)
[ 0.310597] ACPI: Using IOAPIC for interrupt routing
[ 0.311277] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[ 0.359893] ACPI: PCI Root Bridge [PCI0] (domain [bus -ff])
[ 0.360294] acpi PNP0A03:: _OSC: OS supports [ASPM ClockPM Segments MSI]
[ 0.360639] acpi PNP0A03:: _OSC failed (AE_NOT_FOUND); disabling ASPM
[ 0.361141] acpi PNP0A03:: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge.
[ 0.363225] PCI host bridge to bus :
[ 0.363415] pci_bus :: root bus resource [io 0x0000-0x0cf7 window]
[ 0.363746] pci_bus :: root bus resource [io 0x0d00-0xffff window]
[ 0.363907] pci_bus :: root bus resource [mem 0x000a0000-0x000bffff window]
[ 0.364025] pci_bus :: root bus resource [mem 0x40000000-0xfebfffff window]
[ 0.364263] pci_bus :: root bus resource [bus -ff]
[ 0.373072] pci ::01.1: legacy IDE quirk: reg 0x10: [io 0x01f0-0x01f7]
[ 0.373307] pci ::01.1: legacy IDE quirk: reg 0x14: [io 0x03f6]
[ 0.373576] pci ::01.1: legacy IDE quirk: reg 0x18: [io 0x0170-0x0177]
[ 0.374036] pci ::01.1: legacy IDE quirk: reg 0x1c: [io 0x0376]
[ 0.376153] pci ::01.3: quirk: [io 0x0600-0x063f] claimed by PIIX4 ACPI
[ 0.376333] pci ::01.3: quirk: [io 0x0700-0x070f] claimed by PIIX4 SMB
[ 0.399641] ACPI: PCI Interrupt Link [LNKA] (IRQs * )
[ 0.400465] ACPI: PCI Interrupt Link [LNKB] (IRQs * )
[ 0.401214] ACPI: PCI Interrupt Link [LNKC] (IRQs *)
[ 0.401834] ACPI: PCI Interrupt Link [LNKD] (IRQs *)
[ 0.402236] ACPI: PCI Interrupt Link [LNKS] (IRQs *)
[ 0.404694] ACPI: Enabled GPEs in block to 0F
[ 0.408495] pci ::02.0: vgaarb: setting as boot VGA device
[ 0.408873] pci ::02.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
[ 0.409112] pci ::02.0: vgaarb: bridge control possible
[ 0.409248] vgaarb: loaded
[ 0.410945] SCSI subsystem initialized
[ 0.414000] ACPI: bus type USB registered
[ 0.414797] usbcore: registered new interface driver usbfs
[ 0.415427] usbcore: registered new interface driver hub
[ 0.415718] usbcore: registered new device driver usb
[ 0.417317] pps_core: LinuxPPS API ver. registered
[ 0.417613] pps_core: Software ver. 5.3. - Copyright - Rodolfo Giometti <giometti@linux.it>
[ 0.418106] PTP clock support registered
[ 0.420634] Advanced Linux Sound Architecture Driver Initialized.
[ 0.421307] PCI: Using ACPI for IRQ routing
[ 0.430601] NetLabel: Initializing
[ 0.431026] NetLabel: domain hash size =
[ 0.431139] NetLabel: protocols = UNLABELED CIPSOv4 CALIPSO
[ 0.432960] NetLabel: unlabeled traffic allowed by default
[ 0.434622] HPET: timers in total, timers will be used for per-cpu timer
[ 0.435078] hpet0: at MMIO 0xfed00000, IRQs , ,
[ 0.435253] hpet0: comparators, -bit 100.000000 MHz counter
[ 0.439456] clocksource: Switched to clocksource hpet
[ 0.525641] VFS: Disk quotas dquot_6.6.0
[ 0.525932] VFS: Dquot-cache hash table entries: (order , bytes)
[ 0.528559] pnp: PnP ACPI init
[ 0.534353] pnp: PnP ACPI: found devices
[ 0.610325] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: ns
[ 0.612328] NET: Registered protocol family
[ 0.616573] TCP established hash table entries: (order: , bytes)
[ 0.616866] TCP bind hash table entries: (order: , bytes)
[ 0.617208] TCP: Hash tables configured (established bind )
[ 0.617669] UDP hash table entries: (order: , bytes)
[ 0.617902] UDP-Lite hash table entries: (order: , bytes)
[ 0.619276] NET: Registered protocol family
[ 0.621262] RPC: Registered named UNIX socket transport module.
[ 0.621413] RPC: Registered udp transport module.
[ 0.621520] RPC: Registered tcp transport module.
[ 0.621619] RPC: Registered tcp NFSv4. backchannel transport module.
[ 0.621843] pci ::00.0: Limiting direct PCI/PCI transfers
[ 0.622119] pci ::01.0: PIIX3: Enabling Passive Release
[ 0.622445] pci ::01.0: Activating ISA DMA hang workarounds
[ 0.622864] pci ::02.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff]
[ 0.626815] Trying to unpack rootfs image as initramfs...
[ 0.632405] rootfs image is not initramfs (no cpio magic); looks like an initrd
[ 0.666987] Freeing initrd memory: 4684K
[ 0.672966] Scanning for low memory corruption every seconds
[ 0.682999] audit: initializing netlink subsys (disabled)
[ 0.684270] audit: type= audit(1488016899.683:): initialized
[ 0.688482] workingset: timestamp_bits= max_order= bucket_order=
[ 0.696134] kworker/u4: () used greatest stack depth: bytes left
[ 0.697355] kworker/u4: () used greatest stack depth: bytes left
[ 0.723760] NFS: Registering the id_resolver key type
[ 0.724638] Key type id_resolver registered
[ 0.724750] Key type id_legacy registered
[ 0.738476] bounce: pool size: pages
[ 0.738973] Block layer SCSI generic (bsg) driver version 0.4 loaded (major )
[ 0.739724] io scheduler noop registered
[ 0.739854] io scheduler deadline registered
[ 0.740441] io scheduler cfq registered (default)
[ 0.745788] input: Power Button as /devices/LNXSYSTM:/LNXPWRBN:/input/input0
[ 0.746719] ACPI: Power Button [PWRF]
[ 0.750459] Serial: / driver, ports, IRQ sharing enabled
[ 0.795390] :: ttyS0 at I/O 0x3f8 (irq = , base_baud = ) is a 16550A
[ 0.801266] Non-volatile memory driver v1.
[ 0.801804] Linux agpgart interface v0.
[ 0.803292] [drm] Initialized
[ 0.855762] brd: module loaded
[ 0.872555] loop: module loaded
[ 0.883782] scsi host0: ata_piix
[ 0.886438] scsi host1: ata_piix
[ 0.886980] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc040 irq
[ 0.887640] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc048 irq
[ 0.891250] e100: Intel(R) PRO/ Network Driver, 3.5.-k2-NAPI
[ 0.891388] e100: Copyright(c) - Intel Corporation
[ 0.891622] e1000: Intel(R) PRO/ Network Driver - version 7.3.-k8-NAPI
[ 0.891804] e1000: Copyright (c) - Intel Corporation.
[ 1.133121] ACPI: PCI Interrupt Link [LNKC] enabled at IRQ
[ 1.137419] ata2.: ATAPI: QEMU DVD-ROM, 2.5+, max UDMA/
[ 1.138767] ata2.: configured for MWDMA2
[ 1.147488] scsi :::: CD-ROM QEMU QEMU DVD-ROM 2.5+ PQ: ANSI:
[ 1.169985] sr :::: [sr0] scsi3-mmc drive: 4x/4x cd/rw xa/form2 tray
[ 1.170454] cdrom: Uniform CD-ROM driver Revision: 3.20
[ 1.174183] sr :::: Attached scsi generic sg0 type
[ 1.425975] e1000 ::03.0 eth0: (PCI:33MHz:-bit) :::::
[ 1.426582] e1000 ::03.0 eth0: Intel(R) PRO/ Network Connection
[ 1.427218] e1000e: Intel(R) PRO/ Network Driver - 3.2.-k
[ 1.427352] e1000e: Copyright(c) - Intel Corporation.
[ 1.427623] sky2: driver version 1.30
[ 1.430418] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.430583] ehci-pci: EHCI PCI platform driver
[ 1.430883] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1.431247] ohci-pci: OHCI PCI platform driver
[ 1.431509] uhci_hcd: USB Universal Host Controller Interface driver
[ 1.431906] usbcore: registered new interface driver usblp
[ 1.432264] usbcore: registered new interface driver usb-storage
[ 1.432929] i8042: PNP: PS/ Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq ,
[ 1.436670] serio: i8042 KBD port at 0x60,0x64 irq
[ 1.436951] serio: i8042 AUX port at 0x60,0x64 irq
[ 1.439909] mousedev: PS/ mouse device common for all mice
[ 1.444141] rtc_cmos :: RTC can wake from S4
[ 1.445672] rtc_cmos :: rtc core: registered rtc_cmos as rtc0
[ 1.446270] input: AT Translated Set keyboard as /devices/platform/i8042/serio0/input/input1
[ 1.447351] rtc_cmos :: alarms up to one day, y3k, bytes nvram, hpet irqs
[ 1.449199] device-mapper: ioctl: 4.35.-ioctl (--) initialised: dm-devel@redhat.com
[ 1.449995] hidraw: raw HID events driver (C) Jiri Kosina
[ 1.458419] usbcore: registered new interface driver usbhid
[ 1.458590] usbhid: USB HID core driver
[ 1.469901] Netfilter messages via NETLINK v0..
[ 1.474476] nf_conntrack version 0.5. ( buckets, max)
[ 1.476415] ctnetlink v0.: registering with nfnetlink.
[ 1.478914] ip_tables: (C) - Netfilter Core Team
[ 1.480537] Initializing XFRM netlink socket
[ 1.482724] NET: Registered protocol family
[ 1.488410] Segment Routing with IPv6
[ 1.488994] ip6_tables: (C) - Netfilter Core Team
[ 1.490959] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 1.493871] NET: Registered protocol family
[ 1.494457] Key type dns_resolver registered
[ 1.494596] mce: Unable to init device /dev/mcelog (rc: -)
[ 1.495295] Using IPI No-Shortcut mode
[ 1.497003] registered taskstats version
[ 1.499416] Magic number: ::
[ 1.499855] console [netcon0] enabled
[ 1.499971] netconsole: network logging started
[ 1.501668] ALSA device list:
[ 1.501771] No soundcards found.
[ 1.663847] random: fast init done
[ 1.695501] tsc: Refined TSC clocksource calibration: 3591.682 MHz
[ 1.695834] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x33c5a15be52, max_idle_ns: ns
[ 2.080707] input: ImExPS/ Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input3
[ 2.083629] md: Waiting for all devices to be available before autodetect
[ 2.083856] md: If you don't use raid, use raid=noautodetect
[ 2.087671] md: Autodetecting RAID arrays.
[ 2.087899] md: autorun ...
[ 2.088004] md: ... autorun DONE.
[ 2.089417] RAMDISK: gzip image found at block
[ 2.761025] clocksource: Switched to clocksource tsc
[ 3.085065] EXT4-fs (ram0): mounted filesystem with ordered data mode. Opts: (null)
[ 3.085708] VFS: Mounted root (ext4 filesystem) on device :.
[ 3.087372] devtmpfs: mounted
[ 3.124532] Freeing unused kernel memory: 740K
[ 3.124956] Write protecting the kernel text: 8668k
[ 3.125632] Write protecting the kernel read-only data: 2620k
[ 3.206262] mkdir () used greatest stack depth: bytes left
[ 3.431630] mdev () used greatest stack depth: bytes left
[ 3.465204] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 3.472420] e1000: eth0 NIC Link is Up Mbps Full Duplex, Flow Control: RX
[ 3.475559] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Please press Enter to activate this console.
[root@x86 ]#
[root@x86 ]#
[root@x86 ]# mount -t nfs -o nolock 192.168.1.6:/nfsroot /mnt
[ 20.664186] mount () used greatest stack depth: bytes left
[root@x86 ]#
[root@x86 ]# cd /mnt/
[root@x86 mnt]# ls
a.out interrupt_xeint14_15.ko shadow3
dmesg.log interrupt_xeint26_29.ko trace
fdt mtd0ro trace.txt
group mtd1ro virt.dts
hello_32 mtd2ro xeint26.ko
hello_aarch64 mtd3ro
interrupt_gpm4_0.ko passwd
[root@x86 mnt]# ./hello_32
Hello world.
[root@x86 mnt]#
上面我们挂载了Host的共享目录

完。