如何在QEMU中使用交叉编译的Linux Kernel for Versatile Express Board正确安装Debian根文件系统?

时间:2015-05-08 14:59:27

标签: linux-kernel filesystems arm qemu

我使用此链接编译了一个自定义内核:

https://balau82.wordpress.com/2012/03/31/compile-linux-kernel-3-2-for-arm-and-emulate-with-qemu/

我需要一个适当的根文件系统来与内核一起安装。它应该能够更新(apt-get),其中一个明显的选择是Debian rootfs。我从http://s3.armhf.com/dist/basefs/ubuntu-trusty-14.04-armhf.com-20140603.tar.xz

下载了一个预构建的Debian rootfs

我解压缩了文件并创建了一个.cpio图像。当我尝试在QEMU中使用以下命令安装它时,我收到内核崩溃错误。我一直试图调试它好多天但我无法向前迈进一步。任何帮助表示赞赏。

qemu-system-arm -M vexpress-a9 -kernel linux-3.2/arch/arm/boot/zImage -initrd ../Downloads/ubuntu-trusty-14.04-armhf.com-20140603.cpio -m 512M -append "console=ttyAMA0" -nographic

日志是:

pulseaudio: set_sink_input_volume() failed
pulseaudio: Reason: Invalid argument
pulseaudio: set_sink_input_mute() failed
pulseaudio: Reason: Invalid argument
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0
Initializing cgroup subsys cpuset
Linux version 3.2.0 (root@zorro-Inspiron-N5110) (gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-12ubuntu1) ) #2 SMP Sun Apr 26 03:01:28 IST 2015
CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: ARM-Versatile Express
Memory policy: ECC disabled, Data cache writealloc
sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956ms
PERCPU: Embedded 7 pages/cpu @808a1000 s4864 r8192 d15616 u32768
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 130048
Kernel command line: console=ttyAMA0
PID hash table entries: 2048 (order: 1, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 512MB = 512MB total
Memory: 405916k/405916k available, 118372k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0xa0800000 - 0xf8000000   (1400 MB)
    lowmem  : 0x80000000 - 0xa0000000   ( 512 MB)
    modules : 0x7f000000 - 0x80000000   (  16 MB)
      .text : 0x80008000 - 0x80429a8c   (4231 kB)
      .init : 0x8042a000 - 0x80456300   ( 177 kB)
      .data : 0x80458000 - 0x8047e1e0   ( 153 kB)
       .bss : 0x8047e204 - 0x8049ca28   ( 123 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Hierarchical RCU implementation.
NR_IRQS:128
Console: colour dummy device 80x30
Calibrating delay loop... 607.02 BogoMIPS (lpj=3035136)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 1 counters available
Brought up 1 CPUs
SMP: Total of 1 processors activated (607.02 BogoMIPS).
NET: Registered protocol family 16
L310 cache controller enabled
l2x0: 8 ways, CACHE_ID 0x410000c8, AUX_CTRL 0x02420000, Cache size: 131072 B
hw-breakpoint: debug architecture 0x0 unsupported.
Serial: AMBA PL011 UART driver
mb:uart0: ttyAMA0 at MMIO 0x10009000 (irq = 37) is a PL011 rev1
console [ttyAMA0] enabled
mb:uart1: ttyAMA1 at MMIO 0x1000a000 (irq = 38) is a PL011 rev1
mb:uart2: ttyAMA2 at MMIO 0x1000b000 (irq = 39) is a PL011 rev1
mb:uart3: ttyAMA3 at MMIO 0x1000c000 (irq = 40) is a PL011 rev1
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Advanced Linux Sound Architecture Driver Version 1.0.24.
Switching to clocksource v2m-timer1
NET: Registered protocol family 2
IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
TCP established hash table entries: 16384 (order: 5, 131072 bytes)
TCP bind hash table entries: 16384 (order: 5, 131072 bytes)
TCP: Hash tables configured (established 16384 bind 16384)
TCP reno registered
UDP hash table entries: 256 (order: 1, 8192 bytes)
UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Unpacking initramfs...
Initramfs unpacking failed: no cpio magic
Freeing initrd memory: 109104K
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
msgmni has been set to 1005
io scheduler noop registered (default)
clcd-pl11x ct:clcd: PL111 rev2 at 0x10020000
clcd-pl11x ct:clcd: CT-CA9X4 hardware, XVGA display
v2m_cfg_write: writing 03c8eee0 to 00110001
v2m_cfg_write: writing 00000000 to 00710000
v2m_cfg_write: writing 00000002 to 00b10000
Console: switching to colour frame buffer device 128x48
smsc911x: Driver version 2008-10-21
smsc911x-mdio: probed
smsc911x smsc911x: eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=ffffffff:01, irq=-1)
smsc911x smsc911x: eth0: MAC Address: 52:54:00:12:34:56
isp1760 isp1760: NXP ISP1760 USB Host Controller
isp1760 isp1760: new USB bus registered, assigned bus number 1
isp1760 isp1760: Scratch test failed.
isp1760 isp1760: can't setup
isp1760 isp1760: USB bus 1 deregistered
isp1760: Failed to register the HCD device
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
mousedev: PS/2 mouse device common for all mice
rtc-pl031 mb:rtc: rtc core: registered pl031 as rtc0
mmci-pl18x mb:mmci: mmc0: PL181 manf 41 rev0 at 0x10005000 irq 41,42 (pio)
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
aaci-pl041 mb:aaci: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 43
aaci-pl041 mb:aaci: FIFO 512 entries
ALSA device list:
  #0: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 43
oprofile: using arm/armv7-ca9
IPv4 over IPv4 tunneling driver
ip_tables: (C) 2000-2006 Netfilter Core Team
arp_tables: (C) 2002 David S. Miller
TCP cubic registered
NET: Registered protocol family 17
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 0
rtc-pl031 mb:rtc: setting system clock to 2015-04-30 18:31:55 UTC (1430418715)
input: AT Raw Set 2 keyboard as /devices/mb:kmi0/serio0/input/input0
input: ImExPS/2 Generic Explorer Mouse as /devices/mb:kmi1/serio1/input/input1
Root-NFS: no NFS server address
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "(null)" or unknown-block(2,0)
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
[<8001469c>] (unwind_backtrace+0x0/0xf8) from [<8031d884>] (panic+0x5c/0x190)
[<8031d884>] (panic+0x5c/0x190) from [<8042ac50>] (mount_block_root+0x16c/0x220)
[<8042ac50>] (mount_block_root+0x16c/0x220) from [<8042adc4>] (mount_root+0xc0/0xe0)
[<8042adc4>] (mount_root+0xc0/0xe0) from [<8042af10>] (prepare_namespace+0x12c/0x180)
[<8042af10>] (prepare_namespace+0x12c/0x180) from [<8042a920>] (kernel_init+0x138/0x16c)
[<8042a920>] (kernel_init+0x138/0x16c) from [<8000f0a8>] (kernel_thread_exit+0x0/0x8)

1 个答案:

答案 0 :(得分:0)

好的,我自己试了一下。 得到它成功安装根fs的地方,但它仍然没有100%正常,它在系统初始化期间挂起.. pl见下面的详细信息:

  1. 对于像Ubuntu这样的大型rootfs需要更多内存;所以我改变了&#34; -m 512M&#34;到&#34; -m 1024M&#34;
  2. 需要传递root =参数(root = / dev / ram);使用ramdisk
  3. 要求将init作为&#34; rdinit = / sbin / init&#34; (rd = ram disk)

    $ qemu-system-arm -m 1024M -M vexpress-a9 -kernel ./staging/images/zImage -initrd ~/Downloads/arm_ubn.cpio -append "console=ttyAMA0 rdinit=/sbin/init root=/dev/ram" -nographic
    pulseaudio: set_sink_input_volume() failed
    pulseaudio: Reason: Invalid argument
    pulseaudio: set_sink_input_mute() failed
    pulseaudio: Reason: Invalid argument
    Booting Linux on physical CPU 0x0
    Initializing cgroup subsys cpuset
    Linux version 3.14.34 (root@kaiwan-ThinkPad-X220) (gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29) ) #4 SMP Thu Apr 16 07:05:22 IST 2015
    

    - 剪断 -

    Unpacking initramfs...
    Freeing initrd memory: 247084K (88000000 - 9714b000)
    CPU PMU: probing PMU on CPU 0
    
    --snip--
    
  4.  random: init urandom read with 1 bits of entropy available
        input: ImExPS/2 Generic Explorer Mouse as /devices/mb:kmi1/serio1/input/input2
        init: plymouth-upstart-bridge main process (581) terminated with status 1
        init: plymouth-upstart-bridge main process ended, respawning
        init: ureadahead main process (587) terminated with status 5
        init: plymouth-upstart-bridge main process (594) terminated with status 1
        init: plymouth-upstart-bridge main process ended, respawning
        init: plymouth-upstart-bridge main process (597) terminated with status 1
        init: plymouth-upstart-bridge main process ended, respawning
        init: mounted-tmp main process (626) terminated with status 1
    

    它现在挂在这里。 :( 怀疑它与Ubuntu Linux的根文件系统的复杂初始化有关..