Qemu flash boot up does not work

我怕爱的太早我们不能终老 提交于 2019-12-21 05:43:08

问题


I have a rather old (published in 2009) embedded ARM linux book that uses u-boot and qemu. The usage of qemu with the u-boot binary explained in the book is as follows:

qemu-system-arm -M connex -pflash u-boot.bin -nographic

It uses qemu 0.9.1, and mine is 2.1.0:

qemu-system-arm --version
QEMU emulator version 2.1.0, Copyright (c) 2003-2008 Fabrice Bellard

When I executed the same command, however, I got these error messages.

qemu-system-arm: failed to read the initial flash content
qemu-system-arm: Initialization of device cfi.pflash01 failed

What might be wrong? Is this from the new command parameter? I have this site that uses different command, but when I tried that I see a blank screen.

qemu-system-arm -M versatilepb -m 128M -nographic -kernel u-boot.bin

I use Mac OS X maverick for qemu.


回答1:


I have tried this:

dd if=/dev/zero of=flash.bin bs=4096 count=4096
arm-linux-gnueabihf-as -o add.o add.S
arm-linux-gnueabihf-ld -Ttext=0x0 -o add.elf add.o
arm-linux-gnueabihf-objcopy -O binary add.elf add.bin
dd if=add.bin of=flash.bin bs=4096 conv=notrunc
qemu-system-arm -M connex -pflash flash.bin -nographic -serial /dev/null -gdb tcp::1234 -S

where add.S is:

.text
entry: b start
arr:    .byte 1, 2, 3, 4, 5, 6
eoa:
.align
start:  
    ldr r0, =eoa
    ldr r1, =arr
    mov r3, #0
loop:
    ldrb r2, [r1], #1
    add r3, r2, r3
    cmp r1, r0
    bne loop
stop:   b stop

And it seems that program works fine ...

qemu-system-arm --version
QEMU emulator version 2.0.0 (Debian 2.0.0+dfsg-2ubuntu1.5), Copyright (c) 2003-2008 Fabrice Bellard



回答2:


With Alex's help, I could run gumstix on qemu.

  1. The binary should be transformed into flash format with dd command.

    • dd if=/dev/zero of=flash.bin bs=4096 count=4096
    • dd if=u-boot.bin of=flash.bin bs=4096 conv=notrunc
  2. The qemu should be given a parameter to use stdio for serial communication

    qemu-system-arm -M connex -pflash flash.bin -serial stdio

Then, I see the screen output:

pxa2xx_clkcfg_write: CPU frequency change attempt


U-Boot 1.1.4 (Oct  6 2014 - 14:51:37) - 200 MHz - 

*** Welcome to Gumstix ***

U-Boot code: A3F00000 -> A3F23138  BSS: -> A3F58258
RAM Configuration:
Bank #0: a0000000 64 MB
Flash: 16 MB
Using default environment

SMC91C1111-0
Net:   SMC91C1111-0
Hit any key to stop autoboot:  0 
Instruction Cache is ON
### JFFS2 loading 'boot/uImage' to 0xa2000000
Scanning JFFS2 FS:  done.
find_inode failed for name=boot
load: Failed to find inode
### JFFS2 LOAD ERROR<0> for boot/uImage!
GUM> 

Refer to the source code(gumstix.c).



来源:https://stackoverflow.com/questions/26203514/qemu-flash-boot-up-does-not-work

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!