2 Notes for the Qemu MIPS port
6 # ln -s u-boot.bin mips_bios.bin
8 qemu-system-mips -L . /dev/null -nographic
12 if you use a qemu version after commit 4224
15 # dd of=flash bs=1k count=4k if=/dev/zero
16 # dd of=flash bs=1k conv=notrunc if=u-boot.bin
18 # qemu-system-mips -M mips -pflash flash -monitor null -nographic
22 # dd of=ide bs=1k cout=100k if=/dev/zero
24 # sfdisk -C 261 -d ide
25 # partition table of ide
28 ide1 : start= 63, size= 32067, Id=83
29 ide2 : start= 32130, size= 32130, Id=83
30 ide3 : start= 64260, size= 4128705, Id=83
31 ide4 : start= 0, size= 0, Id= 0
34 # tools/mkimage -A mips -O linux -T kernel -C gzip -a 0x80010000 -e 0x80245650 -n "Linux 2.6.24.y" -d vmlinux.bin.gz uImage
36 # dd if=uImage bs=1k conv=notrunc seek=224 of=flash
38 # dd if=uImage bs=512 conv=notrunc seek=63 of=ide
40 # Generate ext2 on part 2
41 # Attached as loop device ide offset = 32130 * 512
42 # losetup -o 16450560 -f ide
43 # Format as ext2 ( arg2 : nb blocks)
44 # mke2fs /dev/loop0 16065
45 # losetup -d /dev/loop0
46 # Mount and copy uImage and initrd.gz to it
47 # mount -o loop,offset=16450560 -t ext2 ide /mnt
51 Now you can boot from flash, ide, ide+ext2 and tfp
53 # qemu-system-mips -M mips -pflash flash -monitor null -nographic -net nic -net user -tftp `pwd` -hda ide
55 II) How to debug U-Boot
57 In order to debug U-Boot you need to start qemu with gdb server support (-s)
58 and waiting the connection to start the CPU (-S)
60 # qemu-system-mips -S -s -M mips -pflash flash -monitor null -nographic -net nic -net user -tftp `pwd` -hda ide
62 in an other console you start gdb
64 1) Debugging of U-Boot Before Relocation
66 Before relocation, the addresses in the ELF file can be used without any problems
67 buy connecting to the gdb server localhost:1234
69 # mipsel-unknown-linux-gnu-gdb u-boot
71 Copyright (C) 2006 Free Software Foundation, Inc.
72 GDB is free software, covered by the GNU General Public License, and you are
73 welcome to change it and/or distribute copies of it under certain conditions.
74 Type "show copying" to see the conditions.
75 There is absolutely no warranty for GDB. Type "show warranty" for details.
76 This GDB was configured as "--host=i486-linux-gnu --target=mipsel-unknown-linux-gnu"...
77 (gdb) target remote localhost:1234
78 Remote debugging using localhost:1234
79 _start () at start.S:64
80 64 RVECENT(reset,0) /* U-boot entry point */
81 Current language: auto; currently asm
83 Breakpoint 1 at 0xbfc00cc8: file board.c, line 289.
87 Breakpoint 1, board_init_f (bootflag=<value optimized out>) at board.c:290
88 290 relocate_code (addr_sp, id, addr);
89 Current language: auto; currently c
93 2) Debugging of U-Boot After Relocation
95 For debugging U-Boot after relocation we need to know the address to which
96 U-Boot relocates itself to 0x87fa0000 by default.
97 And replace the symbol table to this offset.
100 Discard symbol table from `/private/u-boot-arm/u-boot'? (y or n) y
101 Error in re-setting breakpoint 1:
102 No symbol table is loaded. Use the "file" command.
104 (gdb) add-symbol-file u-boot 0x87fa0000
105 add symbol table from file "u-boot" at
106 .text_addr = 0x87fa0000
108 Reading symbols from /private/u-boot-arm/u-boot...done.
109 Breakpoint 1 at 0x87fa0cc8: file board.c, line 289.
113 Program received signal SIGINT, Interrupt.
114 0xffffffff87fa0de4 in udelay (usec=<value optimized out>) at time.c:78
115 78 while ((tmo - read_c0_count()) < 0x7fffffff)