MIPS: qemu_mips: update doc to use all disk and boot linux kernel
[pandora-u-boot.git] / doc / README.qemu_mips
1
2 Notes for the Qemu MIPS port
3
4 I) Example usage:
5
6 # ln -s u-boot.bin mips_bios.bin
7 start it:
8 qemu-system-mips -L . /dev/null -nographic
9
10 or
11
12 if you use a qemu version after commit 4224
13
14 create image:
15 # dd of=flash bs=1k count=4k if=/dev/zero
16 # dd of=flash bs=1k conv=notrunc if=u-boot.bin
17 start it:
18 # qemu-system-mips -M mips -pflash flash -monitor null -nographic
19
20 Ide Disk
21
22 # dd of=ide bs=1k cout=100k if=/dev/zero
23
24 # sfdisk -C 261 -d ide
25 # partition table of ide
26 unit: sectors
27
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
32
33 # Generate uImage
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
35 # Copy to Flash
36 # dd if=uImage bs=1k conv=notrunc seek=224 of=flash
37 # Copy to ide
38 # dd if=uImage bs=512 conv=notrunc seek=63 of=ide
39
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
48 # Umount it
49 # umount /mnt
50
51 Now you can boot from flash, ide, ide+ext2 and tfp
52
53 # qemu-system-mips -M mips -pflash flash -monitor null -nographic -net nic -net user -tftp `pwd` -hda ide
54
55 II) How to debug U-Boot
56
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)
59
60 # qemu-system-mips -S -s -M mips -pflash flash -monitor null -nographic -net nic -net user -tftp `pwd` -hda ide
61
62 in an other console you start gdb
63
64 1) Debugging of U-Boot Before Relocation
65
66 Before relocation, the addresses in the ELF file can be used without any problems
67 buy connecting to the gdb server localhost:1234
68
69 # mipsel-unknown-linux-gnu-gdb u-boot
70 GNU gdb 6.6
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
82 (gdb)  b board.c:289
83 Breakpoint 1 at 0xbfc00cc8: file board.c, line 289.
84 (gdb) c
85 Continuing.
86
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
90 (gdb) p/x addr
91 $1 = 0x87fa0000
92
93 2) Debugging of U-Boot After Relocation
94
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.
98
99 (gdb) symbol-file
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.
103 No symbol file now.
104 (gdb) add-symbol-file u-boot 0x87fa0000
105 add symbol table from file "u-boot" at
106         .text_addr = 0x87fa0000
107 (y or n) y
108 Reading symbols from /private/u-boot-arm/u-boot...done.
109 Breakpoint 1 at 0x87fa0cc8: file board.c, line 289.
110 (gdb) c
111 Continuing.
112
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)