Ticket #937 (closed defect: fixed)

Opened 12 years ago

Last modified 11 years ago

Qemu doesn't want to flash images

Reported by: nikosverschore@… Owned by: balrogg@…
Priority: high Milestone:
Component: qemu-neo1973 Version: 2007.2
Severity: major Keywords:
Cc: buglog@…, balrogg@…, steve@…, kieran.fleming@…, frank@…, jestin.stoffel@… Blocked By:
Blocking: Estimated Completion (week):
HasPatchForReview: PatchReviewResult:
Reproducible:

Description

I did the install guide of http://wiki.openmoko.org/wiki/Qemu, but I cannot
flash the openmoko software. It's doesn't finish the flash.sh file. It generates
the following output:

U-Boot 1.2.0-moko9_r0 (Aug 19 2007 - 19:17:12)

DRAM: 128 MB
NAND: Bad block table not found for chip 0
Bad block table not found for chip 0
64 MiB
* Warning - bad CRC or NAND, using default environment

Video: 640x480x8 31kHz 59Hz
USB: S3C2410 USB Deviced
mtdparts variable not set, see 'help mtdparts'
mtdparts variable not set, see 'help mtdparts'
mtdparts variable not set, see 'help mtdparts'
mtdparts variable not set, see 'help mtdparts'
mtdparts variable not set, see 'help mtdparts'
In: serial
Out: serial
Err: serial
pcf_write: charging in Qualification Mode.
pcf_write: charge voltage 4.20V.
neo_lcd_rst_switch: LCD reset.
jbt6k74_command: Display on.
neo_vib_switch: Buzz, buzz.
neo_vib_switch: Vibrator stopped.
neo_bl_switch: LCD Backlight now on.
GTA01Bv4 #
GTA01Bv4 #
GTA01Bv4 # setenv dontask y
GTA01Bv4 # nand createbbt
Create BBT and erase everything ? <y/N>
Skipping bad block at 0x03ff0000
Skipping bad block at 0x03ff4000
Skipping bad block at 0x03ff8000
Skipping bad block at 0x03ffc000

Creating BBT. Please wait ...Bad block table not found for chip 0
Bad block table not found for chip 0
Bad block table written to 0x03ffc000, version 0x01
Bad block table written to 0x03ff8000, version 0x01

GTA01Bv4 # setenv bootcmd '

Change History

comment:1 Changed 12 years ago by nikosverschore@…

This problem is apparently ubuntu-gutsy-only.
For more users with the same problem see
http://wiki.openmoko.org/wiki/Automatic_emulation_in_Ubuntu#Problems

comment:2 Changed 12 years ago by sudharsh@…

also, on debian lenny...additionally flashing the local build spits out this

sudharsh@sup3rkiddo:~/Projects/openmoko$ make flash-qemu-local
( cd build/qemu && openmoko/flash.sh ../tmp/deploy/glibc/images/fic-gta01 )
/usr/bin/pngtopnm
/usr/bin/ppmtorgb3
make[1]: Entering directory `/home/sudharsh/Projects/openmoko/build/qemu/openmoko'
make[1]: `splash.gz' is up to date.
make[1]: Leaving directory `/home/sudharsh/Projects/openmoko/build/qemu/openmoko'
ls:
/home/sudharsh/Projects/openmoko/build/tmp/deploy/glibc/images/fic-gta01/u-boot-gta01b*.bin:
No such file or directory
basename: missing operand
Try `basename --help' for more information.
Using 'uImage-2.6.22.5-moko11+svnr2937-r3-fic-gta01.bin' as the kernel image.
Using
'OpenMoko?-sudharsh-openmoko-devel-image-glibc-ipk-P1-September-Snapshot-20071014-fic-gta01.rootfs.jffs2'
as the root filesystem image.
Using as bootloader.
make[1]: Entering directory `/home/sudharsh/Projects/openmoko/build/qemu/openmoko'
# Making an empty/erased flash image. Need a correct echo behavior.
echo -en
0377
0377
0377
0377
0377
0377
0377
0377 > .8b
cat .8b .8b > .16b # OOB is 16 bytes
cat .16b .16b .16b .16b .16b .16b .16b .16b > .512b
cat .16b .16b .16b .16b .16b .16b .16b .16b >> .512b
cat .16b .16b .16b .16b .16b .16b .16b .16b >> .512b
cat .16b .16b .16b .16b .16b .16b .16b .16b >> .512b
cat .512b .16b > .sec # A sector is 512 bytes of data + OOB
cat .sec .sec .sec .sec .sec .sec .sec .sec > .8sec
cat .8sec .8sec .8sec .8sec .8sec .8sec .8sec .8sec > .64sec
cat .64sec .64sec .64sec .64sec .64sec .64sec .64sec .64sec > .512sec
cat .512sec .512sec .512sec .512sec > .2ksec
cat .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec > .16ksec
# Neo NAND is 128k sectors big
cat .16ksec .16ksec .16ksec .16ksec .16ksec .16ksec .16ksec .16ksec >
openmoko-flash.base
rm -rf .8b .16b .512b .sec .8sec .64sec .512sec .2ksec .16ksec
make[1]: Leaving directory `/home/sudharsh/Projects/openmoko/build/qemu/openmoko'
Please wait, programming the NAND flash...
sleep: invalid time interval `setenv'
sleep: invalid time interval `dontask'
sleep: invalid time interval `y'
sleep: invalid time interval `nand'
sleep: invalid time interval `createbbt'
sleep: invalid time interval `setenv'
sleep: invalid time interval `bootcmd'
sleep: invalid time interval `\'setenv'
sleep: invalid time interval `bootargs'
sleep: invalid time interval `${bootargs_base}'
sleep: invalid time interval `${mtdparts};'
sleep: invalid time interval `bootm'
sleep: invalid time interval `0x31000000\

sleep: invalid time interval `setenv'
sleep: invalid time interval `menu_1'
sleep: invalid time interval `\'Set'
sleep: invalid time interval `console'
sleep: invalid time interval `to'
sleep: invalid time interval `USB:'
sleep: invalid time interval `setenv'
sleep: invalid time interval `stdin'
sleep: invalid time interval `usbtty;'
sleep: invalid time interval `setenv'
sleep: invalid time interval `stdout'
sleep: invalid time interval `usbtty;'
sleep: invalid time interval `setenv'
sleep: invalid time interval `stderr'
sleep: invalid time interval `usbtty\
sleep: invalid time interval `setenv'
sleep: invalid time interval `menu_2'
sleep: invalid time interval `\'Set'
sleep: invalid time interval `console'
sleep: invalid time interval `to'
sleep: invalid time interval `serial:'
sleep: invalid time interval `setenv'
sleep: invalid time interval `stdin'
sleep: invalid time interval `serial;'
sleep: invalid time interval `setenv'
sleep: invalid time interval `stdout'
sleep: invalid time interval `serial;'
sleep: invalid time interval `setenv'
sleep: invalid time interval `stderr'
sleep: invalid time interval `serial\

sleep: invalid time interval `setenv'
sleep: invalid time interval `menu_3'
sleep: invalid time interval `\'Power'
sleep: invalid time interval `off:'
sleep: invalid time interval `neo1973'
sleep: invalid time interval `power-off\
sleep: invalid time interval `setenv'
sleep: invalid time interval `splashimage'
sleep: invalid time interval `\'nand'
sleep: invalid time interval `read.e'
sleep: invalid time interval `splash'
sleep: invalid time interval `0x5000;'
sleep: invalid time interval `unzip'
sleep: invalid time interval `0x96000\

sleep: invalid time interval `setenv'
sleep: invalid time interval `mtdids'
sleep: invalid time interval `nand0=neo1973-nand'
sleep: invalid time interval `setenv'
sleep: invalid time interval `mtdparts'
sleep: invalid time interval
`mtdparts=neo1973-nand:0x00050000(u-boot),0x00004000(u-boot_env),0x00208000(kernel),0x00010000(splash),0x039a4000(rootfs)'
sleep: invalid time interval `#dynpart'
sleep: invalid time interval `nand'
sleep: invalid time interval `write.e'
sleep: invalid time interval `u-boot'
sleep: invalid time interval `dynenv'
sleep: invalid time interval `set'
sleep: invalid time interval `u-boot_env'
sleep: invalid time interval `saveenv'
Try `sleep --help' for more information.
openmoko/flash.sh: line 88: 7098 Terminated $qemu -mtdblock
"$script_dir/$flash_base" -kernel "$script_dir/$1" -serial stdio -nographic -usb
-monitor null 0<&0

U-boot failed to finish writing in setenv dontask y nand createbbt setenv
bootcmd 'setenv bootargs ${bootargs_base} ${mtdparts}; bootm 0x31000000' setenv
menu_1 'Set console to USB: setenv stdin usbtty; setenv stdout usbtty; setenv
stderr usbtty' setenv menu_2 'Set console to serial: setenv stdin serial; setenv
stdout serial; setenv stderr serial' setenv menu_3 'Power off: neo1973
power-off' setenv splashimage 'nand read.e 0x36000000 splash 0x5000; unzip
0x36000000 0x33d00000 0x96000' setenv mtdids nand0=neo1973-nand setenv mtdparts
mtdparts=neo1973-nand:0x00050000(u-boot),0x00004000(u-boot_env),0x00208000(kernel),0x00010000(splash),0x039a4000(rootfs)
#dynpart nand write.e 0x31000000 u-boot 0x1000 dynenv set u-boot_env saveenv
seconds, giving up.

make: * [flash-qemu-local] Error 255
sudharsh@sup3rkiddo:~/Projects/openmoko$

comment:3 Changed 12 years ago by kero@…

same on debian unstable. I've seen messed up typing on uboot-on-Neo, too.
Especially when I tried to change the charger, I could not type normally after
just one command (character typed only shows after the next character is typed)
Another occasion was when I pasted things with the mouse. Could it be
speed-related? tty baudrate? or another setting? of which all debian-derived
distros suffer?

NB: the link two posts earlier has no solutions.

Bye,
Kero.

PS: I split the flash script into five parts. Means I do not need five working
flashes in a row (which is a rare occurrence).

comment:4 Changed 12 years ago by balrogg@…

  • Cc balrogg@… added

comment:5 Changed 12 years ago by balrogg@…

Sudharshan's output clearly indicates that a file (an important one - the u-boot
image) could not be found, and that's why the u-boot image name argument is
empty in flash.sh and arguments are mismatched (the serie of u-boot commands is
taken as a parameter to "sleep"). This is probably a MokoMakefile? issue.

In turn the output from the bug description may be a qemu or u-boot bug, or an
incompatibility in the shell that comes with Ubuntu (i.e. the u-boot commands
string gets truncated or something..). Up to the point where it stops, the
output looks correctly. I'm unable to reproduce the bug.

BTW, I've hit the problem with serial port one character delay (buffering) too,
I don't think this one has anything to do with Ubuntu.

comment:6 Changed 12 years ago by bugslayer@…

Please note that I have the same problem on OpenSuse? 10.3. Even worse, I get:

ls: cannot access /home/openmoko/om/build/qemu/uImage-2.6.*-fic-gta01.bin: No
such file or directory
basename: missing operand
Try `basename --help' for more information.
ls: cannot access /home/openmoko/om/build/qemu/OpenMoko*.rootfs.jffs2: No such
file or directory
basename: missing operand
Try `basename --help' for more information.
ls: cannot access /home/openmoko/om/build/qemu/u-boot-gta01b*.bin: No such file
or directory
basename: missing operand
Try `basename --help' for more information.
Using as the kernel image.
Using
as the root filesystem image.
Using as bootloader.

So none of those three aobve files were found while "make openmoko-devel-image"
returns success.

comment:7 Changed 12 years ago by bugslayer@…

Besides, I've been experimenting with parameters of uboot() function in flash.sh
and I found that parameters mismatch is caused by passing empty strings instead
of filenames to uboot(). All that confirms #4. Btw, my output is similar to #2,
but with three files missing, as mentioned in #5.

comment:8 Changed 12 years ago by balrogg@…

This only confirms that you're facing a MokoMakefile? problem, unrelated to this
bugreport. Probably a directory name is wrong or the three files are not
downloaded at all.

comment:9 Changed 11 years ago by bugslayer@…

According to #6 and #7, I've opened B954.

comment:10 Changed 11 years ago by steve@…

  • Cc steve@… added

comment:11 Changed 11 years ago by kristijan.krsteski@…

The same problem on me.
Before this I do have feisty version 7.04 and things work just OK.
Now I upgrade to gutsy version 7.10 and the problem is present!
Is there some: How to resolve the problem guide?
Thanks

comment:12 Changed 11 years ago by laforge@…

  • Owner changed from laforge@… to dodji@…
  • Component changed from u-boot to qemu-neo1973

reassigning this to qemu, since it works on real hardware and the emulator
should resemble real hardware.

comment:13 Changed 11 years ago by balrogg@…

  • Owner changed from dodji@… to balrogg@…

comment:14 Changed 11 years ago by kieran.fleming@…

  • Cc kieran.fleming@… added

comment:15 Changed 11 years ago by nikosverschore@…

  • Severity changed from normal to major

This bug is blocking me from making things for the openmoko platform, since I
haven't a real neo1973 phone. So I've changed the severity to major.

comment:16 Changed 11 years ago by m.bitter@…

I've had the same problem on debian.
After correcting the path in MokoMakefile? (line 421)
to "../tmp/deploy/glibc/images/neo1973" the fash.sh find the correct images
from make openmoko-devel-image but after that I have the same problem as
reportet in Bug 937:

my output from make flash-qemu-local is now:

( cd build/qemu && openmoko/flash.sh ../tmp/deploy/glibc/images/neo1973 )
/usr/bin/pngtopnm
/usr/bin/ppmtorgb3
make[1]: Entering directory `/home/openmoko/build/qemu/openmoko'
make[1]: »splash.gz« ist bereits aktualisiert.
make[1]: Leaving directory `/home/openmoko/build/qemu/openmoko'
ls: /home/openmoko/build/tmp/deploy/glibc/images/neo1973/uImage-2.6.*-fic-gta01.bin:
Datei oder Verzeichnis nicht gefunden
basename: fehlender Operand
„basename --help“ gibt weitere Informationen.
Using as the kernel image.
Using 'OpenMoko?-openmoko-devel-image-glibc-ipk-P1-Snapshot-20071027-fic-gta01.rootfs.jffs2'
as the root filesystem image.
Using 'u-boot-gta01bv4-1.2.0+gitf34024d4a328e6edd906456da98d2c537155c4f7+svn2943-r1.bin'
as bootloader.
make[1]: Entering directory `/home/openmoko/build/qemu/openmoko'
# Making an empty/erased flash image. Need a correct echo behavior.
echo -en
0377
0377
0377
0377
0377
0377
0377
0377 > .8b
cat .8b .8b > .16b # OOB is 16 bytes
cat .16b .16b .16b .16b .16b .16b .16b .16b > .512b
cat .16b .16b .16b .16b .16b .16b .16b .16b >> .512b
cat .16b .16b .16b .16b .16b .16b .16b .16b >> .512b
cat .16b .16b .16b .16b .16b .16b .16b .16b >> .512b
cat .512b .16b > .sec # A sector is 512 bytes of data + OOB
cat .sec .sec .sec .sec .sec .sec .sec .sec > .8sec
cat .8sec .8sec .8sec .8sec .8sec .8sec .8sec .8sec > .64sec
cat .64sec .64sec .64sec .64sec .64sec .64sec .64sec .64sec > .512sec
cat .512sec .512sec .512sec .512sec > .2ksec
cat .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec > .16ksec
# Neo NAND is 128k sectors big
cat .16ksec .16ksec .16ksec .16ksec .16ksec .16ksec .16ksec .16ksec >
openmoko-flash.base
rm -rf .8b .16b .512b .sec .8sec .64sec .512sec .2ksec .16ksec
make[1]: Leaving directory `/home/openmoko/build/qemu/openmoko'
Please wait, programming the NAND flash...
300
neo_gsm_switch: GSM disabled.

U-Boot 1.3.0-rc11.2.0+gitf34024d4a328e6edd906456da98d2c537155c4f7+svn2943 (Oct
27 2007 - 14:50:08)

DRAM: 128 MB
NAND: Bad block table not found for chip 0
Bad block table not found for chip 0
64 MiB
* Warning - bad CRC or NAND, using default environment

Video: 640x480x8 31kHz 59Hz
USB: S3C2410 USB Deviced
mtdparts variable not set, see 'help mtdparts'
mtdparts variable not set, see 'help mtdparts'
mtdparts variable not set, see 'help mtdparts'
mtdparts variable not set, see 'help mtdparts'
mtdparts variable not set, see 'help mtdparts'
In: serial
Out: serial
Err: serial
pcf_write: charging in Qualification Mode.
pcf_write: charge voltage 4.20V.
neo_lcd_rst_switch: LCD reset.
jbt6k74_command: Display on.
neo_vib_switch: Buzz, buzz.
neo_vib_switch: Vibrator stopped.
neo_bl_switch: LCD Backlight now on.
GTA01Bv4 #
GTA01Bv4 #
GTA01Bv4 # setenv dontask y
GTA01Bv4 # nand createbbt
Create BBT and erase everything ? <y/N>
Skipping bad block at 0x03ff0000
Skipping bad block at 0x03ff4000
Skipping bad block at 0x03ff8000
Skipping bad block at 0x03ffc000

Creating BBT. Please wait ...Bad block table not found for chip 0
Bad block table not found for chip 0
Bad block table written to 0x03ffc000, version 0x01
Bad block table written to 0x03ff8000, version 0x01

GTA01Bv4 # setenv bootcmd 'openmoko/flash.sh: line 89: 15285 Beendet
$qemu -mtdblock "$script_dir/$flash_base" -kernel "$script_dir/$1" -serial
stdio -nographic -usb -monitor null 0<&0

U-boot failed to finish writing in 300 seconds, giving up.

make: * [flash-qemu-local] Fehler 255

comment:17 Changed 11 years ago by m.bitter@…

Sorry the comment #12 should go to Bug 954

comment:18 Changed 11 years ago by frank@…

  • Cc frank@… added

comment:19 Changed 11 years ago by toni@…

same info as for bug id 954:

i also had to change in ~/moko/build/qemu/openmoko/env

kernel_wildcard="uImage-2.6.*-fic-gta01.bin"

to

kernel_wildcard="uImage-2.6.*-neo1973.bin"

after that flash.sh hangs with the prompt

GTA01Bv4 # setenv bootcmd '

as mentioned in the wiki

http://wiki.openmoko.org/wiki/Talk:OpenMoko_under_QEMU

seems this is another bug, sorry but i could find the corresponding bug-id.

toni

comment:20 Changed 11 years ago by jestin.stoffel@…

  • Cc jestin.stoffel@… added

comment:21 Changed 11 years ago by pochun.hsu@…

Hi everyone,
I found that in $HOME/moko/build/qemu/openmoko/flash.sh at line 82.
If you use vi to open this file.
you can type :set list to show tab as I and newline as $.

Originally, line 82 looks like that
Iemu $1 <<< " $
there are a lot of spaces between " and $
So, I remove these spaces that makes line 82 looks like this
Iemu $1 <<< "$

Then, I found that the possibility to successfully execute 'make
flash-qemu-local' or 'make flash-qemu-official' is raised.

So, after I removed the garbage spaces and execute 'make flash-qemu-offical'
successfully. It shows me the following message:

All done.

Read the qemu manual and use a commandline like the following to boot:

$ arm-softmmu/qemu-system-arm -M neo -m 130 -mtdblock

openmoko/openmoko-flash.image -kernel openmoko/openmoko-kernel.bin -usb -show-cursor

Append '-snapshot' to make the flash image read-only so that every
time emulation starts in the original unmodified state.
Use [Enter] for AUX button, [Space] for POWER.
Append '-usbdevice keyboard' to attach a standard keyboard.


If you've configured qemu with --enable-phonesim (requieres Qt4 and
a C++ toolchain), use the following commandline to run phonesim:

$ (cd phonesim; LD_LIBRARY_PATH=lib ./phonesim -gui ../openmoko/neo1973.xml)&

The GUI is optional. When phonesim is running, append
'-serial tcp:localhost:12345' to qemu invocation. Security
note a la GLSA: phonesim listens on 0.0.0.0.

But things seems not done!

Even 'make flash-qemu-official' is successful, 'make run-qemu' still have problems.

qemu shows me that:

U-Boot 1.2.0-moko8_r0 (Aug 19 2007 - 19:17:12)

* BOOT MENU *

Boot
Set console to USB
Set condole to serial
Power off
Factory reset

Press [AUX] to select, [Power] to execute.

Then when I select Boot to execute, it always fail.

NAND read: device 0 offset 0x54000, size 0x208000

Reading data from 0x25be00 --100% complete.
2129920 bytes read:OK
##Booting image at 32000000 ...
Bad Magic Number

Press [AUX] to return to boot menu.


comment:22 Changed 11 years ago by balrogg@…

The spaces on the first line were inserted intentionally to account for the
characters that will be consumed between qemu starts emulation and u-boot starts
reading serial input. If they are removed, the initial u-boot commands will
likely be eaten, so I don't think it affects this bug.

I hear the users who observe this bug have mostly started seeing it after a
system upgrade. Does someone know which particular package upgrade breaks it?
I'm trying to run only the latest versions of everything but I'm unable to
reproduce.

comment:23 Changed 11 years ago by balrogg@…

I just made a full upgrade to Ubuntu 7.10 gutsy in a qemu VM (32 bit, x86) just
to reproduce this bug and it all works seamlessly here, so I don't know what to
blame.

comment:24 Changed 11 years ago by emoncrieff@…

on Debian Lenny, running on an 1.9GHz Intel Pentium IV with 1GB of RAM, I
observe the following behaviour:

On a fresh install of the MokoMakefile?, invoking "make qemu" hangs at the
following location:

neo_vib_switch: Buzz, buzz.
neo_vib_switch: Vibrator stopped.
neo_bl_switch: LCD Backlight now on.
GTA01Bv4 #
GTA01Bv4 # openmoko/flash.sh: line 88: 29829 Terminated $qemu
-mtdblock "$script_dir/$flash_base" -kernel "$script_dir/$1" -serial stdio
-nographic -usb -monitor null 0<&0

U-boot failed to finish writing in 300 seconds, giving up.

make: * [flash-qemu-official] Error 255

If I subsequently invoke "make qemu" again, it gets to the more-widely-reported
hanging place:

Creating BBT. Please wait ...Bad block table not found for chip 0
Bad block table not found for chip 0
Bad block table written to 0x03ffc000, version 0x01
Bad block table written to 0x03ff8000, version 0x01

GTA01Bv4 # setenv bootcmd 'openmoko/flash.sh: line 88: 30176 Terminated

$qemu -mtdblock "$script_dir/$flash_base" -kernel "$script_dir/$1" -serial

stdio -nographic -usb -monitor null 0<&0

U-boot failed to finish writing in 300 seconds, giving up.

make: * [flash-qemu-official] Error 255

I am happy to run any tests which anyone thinks would be helpful.

comment:25 Changed 11 years ago by kieran.fleming@…

I tried it again by deleting everything and starting with a fresh build using
'make qemu'. I got the bug again, but then after a few tries, it miraculously
worked! I know this isn't great for a bug report, so if you need to know
anything else, please ask. This is on a fresh install of gutsy with all updates
applied.

comment:26 Changed 11 years ago by toni@…

fresh installation of debian lenny:

GTA01Bv4 # setenv bootcmd 'openmoko/flash.sh: line 88: 3716 Terminated

$qemu -mtdblock "$script_dir/$flash_base" -kernel "$script_dir/$1" -serial

stdio -nographic -usb -monitor null 0<&0

U-boot failed to finish writing in 300 seconds, giving up.

make: * [flash-qemu-local] Error 255

on the 3rd run it get's a little further:

GTA01Bv4 # neo1973 power-ofopenmoko/flash.sh: line 88: 3638 Terminated

( sleep $2; kill $pid; sleep 1; kill -KILL $pid )

openmoko/flash.sh: line 88: 3640 Terminated $qemu -mtdblock
"$script_dir/$flash_base" -kernel "$script_dir/$1" -serial stdio -nographic -usb
-monitor null 0<&0

U-boot failed to finish writing in 60 seconds, giving up.

make: * [flash-qemu-local] Error 255

4th run and it once again hangs at setenv bootmcd ...:

GTA01Bv4 # setenv bootcmd 'openmoko/flash.sh: line 88: 3716 Terminated

$qemu -mtdblock "$script_dir/$flash_base" -kernel "$script_dir/$1" -serial

stdio -nographic -usb -monitor null 0<&0

U-boot failed to finish writing in 300 seconds, giving up.

make: * [flash-qemu-local] Error 255

comment:27 Changed 11 years ago by emoncrieff@…

I've tried attaching strace and ltrace to the running (hung) proceses, and I
receive no output.

I then hacked flash.sh to run the emulator under strace and ltrace, and that
introduced sufficiently different conditions that it is unclear if the data I
got is meaningful. It still didn't work, but it failed in different places, and
sometimes appeared to be running other than expected.

I can attach the output of the strace and ltrace runs if anyone is interested,
but it is quite large.

comment:28 Changed 11 years ago by balrogg@…

  • Status changed from new to assigned
  • Summary changed from Qemu doens't want to flash images to Qemu doesn't want to flash images

Okay, I was able to reproduce the bug today and I committed a workaround for
this into SVN. The issue is a bit mysterious and reveals a flaw in upstream
qemu and possibly a kernel bug.

The hang is caused by qemu giving full control to the target system (in this
case u-boot). Normally the qemu main loop translates target code blocks and
then executes them, and only after a block finishes executing qemu gets back to
its duties as a host process, such as displaying graphics, dealing with serial
input (e.g. u-boot commands), reacting to keyboard/mouse events etc. A
translation blocks ends when an interrupt occurs, a timer expires (by delivery
of a signal) or the block fills an entire code buffer. Since u-boot doesn't use
interrupts, and since it polls s3c2410 serial for received bytes in a very tight
loop (that fits very well into the code buffer), the control returns to host
only on timer expiry events. But. The Debian/Ubuntu? kernel 2.6.22 claims to
support dyntics, so that qemu uses dynticks for delivering timer expiry.
However the signals stop being delivered to qemu after a random period, I can't
explain why (yet), I suspect a kernel bug, so that the control constantly
remains in hands of target u-boot, and qemu main loop never gets a chance to
spin and fetch more serial input.

I hadn't had this problem when I tried Ubuntu the last time because I had not
rebooted into the new kernel after upgrading to 7.10, and with 2.6.21 kernels
everything seems to be fine. Later I built Gentoo on the vm (under qemu) and
today rebooted it back into Ubuntu for a while, this time with its new kernel,
and the bug could be observed (though not 100% reproducible, rather randomly).

I made the flash.sh script force unix timers instead of dyntics, it works around
the issue for me. Please test (svn r3434) and report back.

There are two issues, one is that of depending on timer events for performing
host tasks, and I will address it upstream.
Second issue is that of dynticks failing randomly, I will investigate it if I
have nothing better to do.

comment:29 Changed 11 years ago by botsnlinux@…

I'm still getting a similar error with the code I checked out this afternoon.

Please wait, programming the NAND flash...
Available alarm timers, in order of precedence:
unix
openmoko/flash.sh: line 88: 11928 Terminated $qemu -mtdblock
"$script_dir/$flash_base" -kernel "$script_dir/$1" -serial stdio -nographic -usb
-monitor null 0<&0

U-boot failed to finish writing in 120 seconds, giving up.

I'm running Ubuntu 7.10, kernel 2.6.22-14-generic.

comment:30 Changed 11 years ago by toni@…

i had this issue on debian lenny, with the latest checkout it works. thanks for
the fix. i'm running a custom 2.6.24-rc2 kernel.

one thing i had to fix was the sdl. qemu uses <SDL.h>, but under lenny
the sdl files are in <SDL/SDL.h>.

thanks
toni

comment:31 Changed 11 years ago by balrogg@…

  • Status changed from assigned to closed
  • Resolution set to fixed

Thanks for the report, in this case I'm closing the bug as fixed (even though
it's only worked around now). Users on irc have reported improvement as well,
except a tiny problem that recent OpenMoko?-openmoko-devel-* images grew to 50 MB
while 48 MB was the previous size limit, today increased to 56 MB (near physical
limits already).

In response to comment #24:
Changing SDL include paths are supposed to not be a problem because qemu
configure uses sdl-config --cflags to query include paths, please see if the
paths returned are correct. In any case that would be an upstream issue.

Please reopen the bug if the flashing issue is seen again. I will comment on
potential progress with dynticks here.

comment:32 Changed 11 years ago by balrogg@…

In r3500 I added an experimental fix for dynticks clocksource, avoiding dynticks
should now not be needed. It works for me but testing will be appreciated.

comment:33 Changed 11 years ago by jisakiel@…

  • Status changed from closed to reopened
  • Resolution fixed deleted

Unfortunately I'll have to reopen it. I'm getting the bug again. Kernel
2.6.24-zen1 (zen-sources), amd64 with dynticks on ubuntu gutsy. Compiling and
loading kqemu makes the whole process go faster, but I still get the same error.
With a freshly compiled qemu:

jisakiel@xpsm1330:~/openmoko/build/qemu$ openmoko/flash.sh
/usr/bin/pngtopnm
/usr/bin/ppmtorgb3
make: `splash.gz' está actualizado. [meaning: it's updated]
Using 'uImage-2.6.24+svnr4059-r4055-r3-neo1973.bin' as the kernel image.
Using
'OpenMoko?-openmoko-devel-image-glibc-ipk-P1-Snapshot-20080213-fic-gta01.rootfs.jffs2'
as the root filesystem image.
Using
'u-boot-gta01bv4-1.3.1+git0ec595243dc99edcd248bbcfbfd5a1dc860bde89+svn3817-r1.bin'
as bootloader.
# Making an empty/erased flash image. Need a correct echo behavior.
echo -en
0377
0377
0377
0377
0377
0377
0377
0377 > .8b
cat .8b .8b > .16b # OOB is 16 bytes
cat .16b .16b .16b .16b .16b .16b .16b .16b > .512b
cat .16b .16b .16b .16b .16b .16b .16b .16b >> .512b
cat .16b .16b .16b .16b .16b .16b .16b .16b >> .512b
cat .16b .16b .16b .16b .16b .16b .16b .16b >> .512b
cat .512b .16b > .sec # A sector is 512 bytes of data + OOB
cat .sec .sec .sec .sec .sec .sec .sec .sec > .8sec
cat .8sec .8sec .8sec .8sec .8sec .8sec .8sec .8sec > .64sec
cat .64sec .64sec .64sec .64sec .64sec .64sec .64sec .64sec > .512sec
cat .512sec .512sec .512sec .512sec > .2ksec
cat .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec > .16ksec
# Neo NAND is 128k sectors big
cat .16ksec .16ksec .16ksec .16ksec .16ksec .16ksec .16ksec .16ksec >
openmoko-flash.base
rm -rf .8b .16b .512b .sec .8sec .64sec .512sec .2ksec .16ksec
neo_gsm_switch: GSM disabled.

U-Boot 1.3.1+git0ec595243dc99edcd248bbcfbfd5a1dc860bde89+svn3817 (Jan 23 2008 -
11:35:09)

DRAM: 128 MB
NAND: Bad block table not found for chip 0
Bad block table not found for chip 0
64 MiB
* Warning - bad CRC or NAND, using default environment

Please wait, programming the NAND flash...
Video: 640x480x8 31kHz 59Hz
USB: S3C2410 USB Deviced
mtdparts variable not set, see 'help mtdparts'
mtdparts variable not set, see 'help mtdparts'
mtdparts variable not set, see 'help mtdparts'
mtdparts variable not set, see 'help mtdparts'
mtdparts variable not set, see 'help mtdparts'
pcf_write: charging in Qualification Mode.
pcf_write: charge voltage 4.20V.
neo_lcd_rst_switch: LCD reset.
jbt6k74_command: Display on.
neo_vib_switch: Buzz, buzz.
neo_vib_switch: Vibrator stopped.
neo_bl_switch: LCD Backlight now on.
penmoko/flash.sh: line 91: 1222 Terminado ( sleep $2; kill $pid;
sleep 1; kill -KILL $pid )
openmoko/flash.sh: line 91: 15305 Terminado $qemu -mtdblock
"$script_dir/$flash_base" -kernel "$script_dir/$1" -serial stdio -nographic -usb
-monitor null 0<&0

U-boot failed to finish writing in 60 seconds, giving up.

"Terminado" means "Killed" .

comment:34 Changed 11 years ago by balrogg@…

Ah, this is a different bug, but I believe I fixed this one last weekend. How
recent is your qemu source?

This bug appears because you're using u-boot 1.3.1 and all 1.3.x versions no
longer have a serial console by default. See #1224 for full explanation.
Please update your qemu and check if this works alright now.

comment:35 Changed 11 years ago by mokobugs_raven_expires_2008_09@…

I don't know if what i'm experiencing is this bug, Bug 954, Bug 1224 or even
something completely different, but (on an up-to-date Ubuntu Gutsy, having
already switched /bin/sh back to bash again) i get the following when trying to
"make flash-qemu-official":

[...]
# Making an empty/erased flash image. Need a correct echo behavior.
echo -en
0377
0377
0377
0377
0377
0377
0377
0377 > .8b
cat .8b .8b > .16b # OOB is 16 bytes
cat .16b .16b .16b .16b .16b .16b .16b .16b > .512b
cat .16b .16b .16b .16b .16b .16b .16b .16b >> .512b
cat .16b .16b .16b .16b .16b .16b .16b .16b >> .512b
cat .16b .16b .16b .16b .16b .16b .16b .16b >> .512b
cat .512b .16b > .sec # A sector is 512 bytes of data + OOB
cat .sec .sec .sec .sec .sec .sec .sec .sec > .8sec
cat .8sec .8sec .8sec .8sec .8sec .8sec .8sec .8sec > .64sec
cat .64sec .64sec .64sec .64sec .64sec .64sec .64sec .64sec > .512sec
cat .512sec .512sec .512sec .512sec > .2ksec
cat .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec > .16ksec
# Neo NAND is 128k sectors big
cat .16ksec .16ksec .16ksec .16ksec .16ksec .16ksec .16ksec .16ksec >
openmoko-flash.base
rm -rf .8b .16b .512b .sec .8sec .64sec .512sec .2ksec .16ksec
make[1]: Leaving directory '/home/raven/code/openmoko/build/qemu/openmoko'
Please wait, programming the NAND flash...
neo_gsm_switch: GSM disabled.

U-Boot 1.3.1+git10bbb38a402a2faf18858c451bcdc63d45888e6e+svn4118 (Feb 29 2008 -
04:36:26)

I2C: ready
DRAM: 128 MB
NAND: Bad block table not found for chip 0
Bad block table not found for chip 0
64 MiB
Video: 640x480x8 31kHz 59Hz
USB: S3C2410 USB Deviced
mtdparts variable not set, see 'help mtdparts'
mtdparts variable not set, see 'help mtdparts'
mtdparts variable not set, see 'help mtdparts'
mtdparts variable not set, see 'help mtdparts'
mtdparts variable not set, see 'help mtdparts'
pcf_write: charging in Qualification Mode.
pcf_write: charge voltage 4.20V.
neo_lcd_rst_switch: LCD reset.
jbt6k74_command: Display on.
neo_vib_switch: Buzz, buzz.
neo_vib_switch: Vibrator stopped.
neo_bl_switch: LCD Backlight now on.
qemu: fatal: Trying to execute code outside RAM or ROM at 0x00000000

R00=33f1fc04 R01=ffffffff R02=00000000 R03=34008524
R04=00000000 R05=00000000 R06=00000000 R07=00000000
R08=33f17fdc R09=00000000 R10=00000000 R11=00000000
R12=0000004a R13=33f14d84 R14=00000000 R15=00000000
PSR=60000153 -ZC- A svc32
s00=00000000( 0) s01=00000000( 0) d00=0000000000000000( 0)
s02=00000000( 0) s03=00000000( 0) d01=0000000000000000( 0)
s04=00000000( 0) s05=00000000( 0) d02=0000000000000000( 0)
s06=00000000( 0) s07=00000000( 0) d03=0000000000000000( 0)
s08=00000000( 0) s09=00000000( 0) d04=0000000000000000( 0)
s10=00000000( 0) s11=00000000( 0) d05=0000000000000000( 0)
s12=00000000( 0) s13=00000000( 0) d06=0000000000000000( 0)
s14=00000000( 0) s15=00000000( 0) d07=0000000000000000( 0)
s16=00000000( 0) s17=00000000( 0) d08=0000000000000000( 0)
s18=00000000( 0) s19=00000000( 0) d09=0000000000000000( 0)
s20=00000000( 0) s21=00000000( 0) d10=0000000000000000( 0)
s22=00000000( 0) s23=00000000( 0) d11=0000000000000000( 0)
s24=00000000( 0) s25=00000000( 0) d12=0000000000000000( 0)
s26=00000000( 0) s27=00000000( 0) d13=0000000000000000( 0)
s28=00000000( 0) s29=00000000( 0) d14=0000000000000000( 0)
s30=00000000( 0) s31=00000000( 0) d15=0000000000000000( 0)
FPSCR: 00000000
openmoko/flash.sh: line 91: 13847 Aborted (core dumped) $qemu
-mtdblock "$script_dir/$flash_base" -kernel "$script_dir/$1" -serial stdio
-nographic -usb -monitor null 0<&0

U-boot failed to finish writing in 300 seconds, giving up.

openmoko/flash.sh: line 95: echo: write error: Interrupted system call
openmoko/flash.sh: line 96: 13848 Terminated ( sleep $2; kill $pid;
sleep 1; kill -KILL $pid )
openmoko/flash.sh: line 96: kill: (-13788) - No such process
make: * [flash-qemu-official] Error 255

comment:36 Changed 11 years ago by balrogg@…

  • Status changed from reopened to closed
  • Resolution set to fixed

This is a u-boot bug, see openmoko-kernel archives to find a patch for this
bug (a u-boot patch).

Note: See TracTickets for help on using tickets.