
2013.01.08. 20:14 keltezéssel, Gabor Juhos írta:
The linux starting code of the qemu specific bootm implementation is very similar to the one which is used for regular boards. The preparation code is different but it makes no sense to keep that in a separate file.
The pach moves the qemu specific code into bootm.c, and removes the custom file. This allows to get rid of some duplicated code, and it collects bootm specific code into a single file. Additionaly, this allows to use the prep,go subcommands in qemu as well.
Signed-off-by: Gabor Juhos juhosg@openwrt.org Cc: Daniel Schwierzeck daniel.schwierzeck@googlemail.com
This is compile tested only. I don't have suitable kernel images for mips,mipsel,mips64,mipsel64 systems to try it yet.
Ok, I have tried this with the sample vmlinux image provided here: ftp://ftp.denx.de/pub/contrib/Jean-Christophe_Plagniol-Villard/qemu_mips/
It works as expected:
U-Boot 2013.01-rc2-00139-g926b2e4-dirty (Jan 10 2013 - 13:43:18)
Board: Qemu -M mips CPU: 24Kf proc_id=0x19300 DRAM: 128 MiB ## Unknown flash on Bank 1 - Size = 0x00000000 = 0 MB Flash: 0 Bytes *** Warning - bad CRC, using default environment
In: serial Out: serial Err: serial Net: NE2000 Hit any key to stop autoboot: 0 qemu-mips # run load_tftp Using NE2000 device TFTP from server 10.0.2.2; our IP address is 10.0.2.1 Filename '/initrd.gz'. Load address: 0x80800000 Loading: ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# # done Bytes transferred = 2663940 (28a604 hex) Using NE2000 device TFTP from server 10.0.2.2; our IP address is 10.0.2.1 Filename 'uImage'. Load address: 0x80500000 Loading: ################################################################# ################################################################# ################################################################# ################################################################# ######## done Bytes transferred = 1368045 (14dfed hex) qemu-mips # bootm start 0x80500000 ## Booting kernel from Legacy Image at 80500000 ... Image Name: Linux 2.6.24.y Created: 2013-01-09 16:27:15 UTC Image Type: MIPS Linux Kernel Image (gzip compressed) Data Size: 1367981 Bytes = 1.3 MiB Load Address: 80010000 Entry Point: 80245650 Verifying Checksum ... OK qemu-mips # bootm loados Uncompressing Kernel Image ... OK qemu-mips # bootm prep qemu-mips # bootm go
Starting kernel ...
Linux version 2.6.24.7-dirty (j@game.jcrosoft.org) (gcc version 4.2.1) #17 Sat Sep 6 19:31:26 CEST 2008 console [early0] enabled CPU revision is: 00019300 (MIPS 24K) FPU revision is: 00000000 Determined physical RAM map: memory: 08000000 @ 00000000 (usable) Initial ramdisk at: 0x80800000 (2663940 bytes) Zone PFN ranges: DMA 0 -> 4096 Normal 4096 -> 32768 Movable zone start PFN for each node early_node_map[1] active PFN ranges 0: 0 -> 32768 Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512 Kernel command line: root=/dev/ram0 init=/bin/sh console=ttyS0,115200 rd_start=0x80800000 rd_size=0x28A604 ethaddr=52:54:00:12:34:56 panic=1 Primary instruction cache 2kB, VIPT, 2-way, linesize 16 bytes. Primary data cache 2kB, 2-way, VIPT, no aliases, linesize 16 bytes Synthesized clear page handler (13 instructions). Synthesized copy page handler (22 instructions). Synthesized TLB refill handler (20 instructions). Synthesized TLB load handler fastpath (32 instructions). Synthesized TLB store handler fastpath (32 instructions). Synthesized TLB modify handler fastpath (31 instructions). Cache parity protection disabled PID hash table entries: 512 (order: 9, 2048 bytes) Console: colour dummy device 80x25 Dentry cache hash table entries: 16384 (order: 4, 65536 bytes) Inode-cache hash table entries: 8192 (order: 3, 32768 bytes) Memory: 119096k/131072k available (2272k kernel code, 11928k reserved, 483k data, 148k init, 0k highmem) Mount-cache hash table entries: 512 net_namespace: 64 bytes NET: Registered protocol family 16 NET: Registered protocol family 2 Time: MIPS clocksource has been installed. IP route cache hash table entries: 1024 (order: 0, 4096 bytes) TCP established hash table entries: 4096 (order: 3, 32768 bytes) TCP bind hash table entries: 4096 (order: 2, 16384 bytes) TCP: Hash tables configured (established 4096 bind 4096) TCP reno registered checking if image is initramfs...it isn't (no cpio magic); looks like an initrd Freeing initrd memory: 2601k freed fuse init (API version 7.9) JFS: nTxBlock = 951, nTxLock = 7609 io scheduler noop registered (default) Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled serial8250.0: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A console handover: boot [early0] -> real [ttyS0] RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize loop: module loaded ne.c:v1.10 9/23/94 Donald Becker (becker@scyld.com) Last modified Nov 1, 2000 by Paul Gortmaker NE*000 ethercard probe at 0x300:52:54:00:12:34:56 eth0: NE2000 found at 0x300, using IRQ 9. Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2 ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx hdc: QEMU DVD-ROM, ATAPI CD/DVD-ROM drive ide1 at 0x170-0x177,0x376 on irq 15 TCP cubic registered NET: Registered protocol family 1 NET: Registered protocol family 17 RPC: Registered udp transport module. RPC: Registered tcp transport module. RAMDISK: Compressed image found at block 0 VFS: Mounted root (cramfs filesystem) readonly. Freeing unused kernel memory: 148k freed
BusyBox v1.1.3 (Debian 1:1.1.3-3) Built-in shell (ash) Enter 'help' for a list of built-in commands.
/bin/sh: can't access tty; job control turned off ~ #
Additionally, I wanted to compile a Linux kernel for mips64/mipsel/mipsel64 to test these patches on those as well. However when I have tried to configure a recent kernel I noticed that it has no MIPS QEMU platform. That has been completely removed from Linux five years ago by:
commit 302922e5f6901eb6f29c58539631f71b3d9746b8 Author: Ralf Baechle ralf@linux-mips.org Date: Tue Jan 29 10:15:02 2008 +0000
[MIPS] Qemu: Remove platform.
The Qemu platform was originally implemented to have an easily supportable platform until Qemu reaches a state where it emulates a real world system. Since the latest release Qemu is capable of emulating the MIPSsim and Malta platforms, so this goal has been reached. The Qemu plaform is also rather underfeatured so less useful than a Malta emulation.
Maybe the qemu_mips specific bootm stuff should be removed completely from U-Boot?
-Gabor