https://www.qemu.org/docs/master/system/target-mips.html
Ubuntu 20.04
Linux version 5.4.0-58-generic (buildd@lcy01-amd64-004) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #64-Ubuntu SMP Wed Dec 9 08:16:25 UTC 2020
sudo apt install qemu
sudo apt install qemu-system
sueo apt install qemu-user
https://mipsdistros.mips.com/LinuxDistro/nanomips/buildroot/nanomips32r6_le_sf_2017.05-03-59-gf5595d6.ext4.xz
https://mipsdistros.mips.com/LinuxDistro/nanomips/kernels/v4.15.18-432-gb2eb9a8b07a1-20180627102142/generic_nano32r6el_page64k.xz
xz -d nanomips32r6_le_sf_2017.05-03-59-gf5595d6.ext4.xz
xz -c generic_nano32r6el_page64k.xz
xinpengc@xinpengc-VirtualBox:~/work/qemu$ qemu-system-mipsel -cpu I7200 -kernel generic_nano32r6el_page64k > -M malta -serial stdio -m 512 -hda nanomips32r6_le_sf_2017.05-03-59-gf5595d6.ext4 > -append "mem=256m@0x0 rw console=ttyS0 vga=cirrus vesa=0x111 root=/dev/sda" WARNING: Image format was not specified for ‘nanomips32r6_le_sf_2017.05-03-59-gf5595d6.ext4‘ and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the ‘raw‘ format explicitly to remove the restrictions. [ 0.000000] Linux version 4.15.18 (emubuild@mipscs567) (gcc version 6.3.0 (Codescape GNU Tools 2018.04-02 for nanoMIPS Linux)) #1 SMP Wed Jun 27 11:14:10 PDT 2018 [ 0.000000] GCRs appear to have been moved (expected them at 0x1fbf8000)! [ 0.000000] GCRs appear to have been moved (expected them at 0x1fbf8000)! [ 0.000000] CPU0 revision is: 00010000 (MIPS GENERIC QEMU) [ 0.000000] MIPS: machine is mti,malta [ 0.000000] Determined physical RAM map: [ 0.000000] memory: 10000000 @ 00000000 (usable) [ 0.000000] memory: 10000000 @ 90000000 (usable) [ 0.000000] earlycon: ns16550a0 at I/O port 0x3f8 (options ‘38400n8‘) [ 0.000000] bootconsole [ns16550a0] enabled [ 0.000000] User-defined physical RAM map: [ 0.000000] memory: 10000000 @ 00000000 (usable) [ 0.000000] Initrd not found or empty - disabling initrd [ 0.000000] MIPS CPS SMP unable to proceed without a CM [ 0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes. [ 0.000000] Primary data cache 32kB, 4-way, VIPT, no aliases, linesize 32 bytes [ 0.000000] Zone ranges: [ 0.000000] Normal [mem 0x0000000000000000-0x000000000fffffff] [ 0.000000] HighMem empty [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000000000000-0x000000000fffffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000000fffffff] [ 0.000000] random: fast init done [ 0.000000] percpu: Embedded 1 pages/cpu @(ptrval) s36620 r8192 d20724 u65536 [ 0.000000] Built 1 zonelists, mobility grouping off. Total pages: 4093 [ 0.000000] Kernel command line: mem=256m@0x0 rw console=ttyS0 vga=cirrus vesa=0x111 root=/dev/sda earlycon [ 0.000000] Dentry cache hash table entries: 32768 (order: 1, 131072 bytes) [ 0.000000] Inode-cache hash table entries: 16384 (order: 0, 65536 bytes) [ 0.000000] Writing ErrCtl register=00000000 [ 0.000000] Readback ErrCtl register=00000000 [ 0.000000] Memory: 252480K/262144K available (4920K kernel code, 505K rwdata, 1416K rodata, 384K init, 576K bss, 9664K reserved, 0K cma-reserved, 0K highmem) [ 0.000000] SLUB: HWalign=128, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 [ 0.000000] Hierarchical RCU implementation. [ 0.000000] RCU event tracing is enabled. [ 0.000000] RCU restricting CPUs from NR_CPUS=16 to nr_cpu_ids=1. [ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1 [ 0.000000] NR_IRQS: 128 [ 0.000000] timer_probe: no matching timers found [ 0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112585731 ns [ 0.000429] sched_clock: 32 bits at 100MHz, resolution 9ns, wraps every 21474814971ns [ 0.006646] Console: colour dummy device 80x25 [ 0.010345] Calibrating delay loop... 1280.16 BogoMIPS (lpj=26669056) [ 0.341981] pid_max: default: 32768 minimum: 301 [ 0.344415] Mount-cache hash table entries: 16384 (order: 0, 65536 bytes) [ 0.346444] Mountpoint-cache hash table entries: 16384 (order: 0, 65536 bytes) [ 0.396822] Performance counters: Either hardware does not support performance counters, or not yet implemented. [ 0.400013] Hierarchical SRCU implementation. [ 0.406954] smp: Bringing up secondary CPUs ... [ 0.407521] smp: Brought up 1 node, 1 CPU [ 0.422512] devtmpfs: initialized [ 0.436721] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635852588028829 ns [ 0.439095] futex hash table entries: 256 (order: -1, 32768 bytes) [ 0.443250] pinctrl core: initialized pinctrl subsystem [ 0.451790] NET: Registered protocol family 16 [ 0.479295] Can‘t analyze schedule() prologue at cc99562a [ 0.481101] pm-cps: no CM, non-coherent states unavailable [ 0.511977] vgaarb: loaded [ 0.513311] SCSI subsystem initialized [ 0.517966] usbcore: registered new interface driver usbfs [ 0.518924] usbcore: registered new interface driver hub [ 0.519556] usbcore: registered new device driver usb [ 0.520436] pps_core: LinuxPPS API ver. 1 registered [ 0.520764] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it> [ 0.521508] PTP clock support registered [ 0.535729] clocksource: Switched to clocksource MIPS [ 0.555315] NET: Registered protocol family 2 [ 0.565081] TCP established hash table entries: 16384 (order: 0, 65536 bytes) [ 0.566179] TCP bind hash table entries: 16384 (order: 1, 131072 bytes) [ 0.567004] TCP: Hash tables configured (established 16384 bind 16384) [ 0.570016] UDP hash table entries: 2048 (order: 0, 65536 bytes) [ 0.571046] UDP-Lite hash table entries: 2048 (order: 0, 65536 bytes) [ 0.574143] NET: Registered protocol family 1 [ 0.579349] RPC: Registered named UNIX socket transport module. [ 0.579856] RPC: Registered udp transport module. [ 0.580621] RPC: Registered tcp transport module. [ 0.580873] RPC: Registered tcp NFSv4.1 backchannel transport module. [ 0.594070] Initialise system trusted keyrings [ 0.596407] workingset: timestamp_bits=14 max_order=12 bucket_order=0 [ 0.615582] NFS: Registering the id_resolver key type [ 0.622084] Key type id_resolver registered [ 0.624000] Key type id_legacy registered [ 0.625030] nfs4filelayout_init: NFSv4 File Layout Driver Registering... [ 0.626881] Installing knfsd (copyright (C) 1996 okir@monad.swb.de). [ 0.630119] fuse init (API version 7.26) [ 0.650532] Key type asymmetric registered [ 0.653698] Asymmetric key parser ‘x509‘ registered [ 0.655773] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250) [ 0.656618] io scheduler noop registered [ 0.656824] io scheduler deadline registered [ 0.657955] io scheduler cfq registered (default) [ 0.658485] io scheduler mq-deadline registered [ 0.659560] io scheduler kyber registered [ 0.663061] OF: PCI: host bridge /gt64120/pci ranges: [ 0.663789] OF: PCI: No bus range found for /gt64120/pci, using [bus 00-ff] [ 0.664820] OF: PCI: IO 0x00000000..0x001fffff -> 0x00000000 [ 0.665788] OF: PCI: MEM 0x10000000..0x17ffffff -> 0x00000000 [ 0.668829] gt64120-pci 1be00000.gt64120:pci: PCI host bridge to bus 0000:00 [ 0.669666] pci_bus 0000:00: root bus resource [bus 00-ff] [ 0.670239] pci_bus 0000:00: root bus resource [io 0x0000-0x1fffff] [ 0.670507] pci_bus 0000:00: root bus resource [mem 0x10000000-0x17ffffff] (bus address [0x00000000-0x07ffffff]) [ 0.674322] pci 0000:00:00.0: [Firmware Bug]: reg 0x14: invalid BAR (can‘t size) [ 0.674841] pci 0000:00:00.0: [Firmware Bug]: reg 0x18: invalid BAR (can‘t size) [ 0.675698] pci 0000:00:00.0: [Firmware Bug]: reg 0x1c: invalid BAR (can‘t size) [ 0.676656] pci 0000:00:00.0: [Firmware Bug]: reg 0x20: invalid BAR (can‘t size) [ 0.677615] pci 0000:00:00.0: [Firmware Bug]: reg 0x24: invalid BAR (can‘t size) [ 0.681249] pci 0000:00:0a.1: legacy IDE quirk: reg 0x10: [io 0x01f0-0x01f7] [ 0.681519] pci 0000:00:0a.1: legacy IDE quirk: reg 0x14: [io 0x03f6] [ 0.681985] pci 0000:00:0a.1: legacy IDE quirk: reg 0x18: [io 0x0170-0x0177] [ 0.682279] pci 0000:00:0a.1: legacy IDE quirk: reg 0x1c: [io 0x0376] [ 0.684863] pci 0000:00:0a.3: quirk: [io 0x1000-0x103f] claimed by PIIX4 ACPI [ 0.685225] pci 0000:00:0a.3: quirk: [io 0x1100-0x110f] claimed by PIIX4 SMB [ 0.687456] pci 0000:00:12.0: vgaarb: VGA device added: decodes=io+mem,owns=none,locks=none [ 0.689641] pci 0000:00:12.0: BAR 0: assigned [mem 0x10000000-0x11ffffff pref] [ 0.690316] pci 0000:00:0b.0: BAR 6: assigned [mem 0x12000000-0x1207ffff pref] [ 0.691039] pci 0000:00:12.0: BAR 6: assigned [mem 0x12080000-0x1208ffff pref] [ 0.691619] pci 0000:00:12.0: BAR 1: assigned [mem 0x12090000-0x12090fff] [ 0.692580] pci 0000:00:0a.2: BAR 4: assigned [io 0x1040-0x105f] [ 0.692911] pci 0000:00:0b.0: BAR 0: assigned [io 0x1060-0x107f] [ 0.694010] pci 0000:00:0b.0: BAR 1: assigned [mem 0x12091000-0x1209101f] [ 0.694604] pci 0000:00:0a.1: BAR 4: assigned [io 0x1080-0x108f] [ 0.696761] pci 0000:00:0a.2: enabling device (0000 -> 0001) [ 0.790296] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled [ 0.800865] 1f000900.uart: ttyS2 at MMIO 0x1f000900 (irq = 20, base_baud = 230400) is a 16550A [ 0.803515] 3f8.uart: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A [ 0.807402] console [ttyS0] enabled [ 0.807402] console [ttyS0] enabled [ 0.808470] bootconsole [ns16550a0] disabled [ 0.808470] bootconsole [ns16550a0] disabled [ 0.810887] 2f8.uart: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A [ 0.842580] loop: module loaded [ 0.845296] ata_piix 0000:00:0a.1: enabling device (0000 -> 0001) [ 0.856513] scsi host0: ata_piix [ 0.859484] scsi host1: ata_piix [ 0.860511] ata1: PATA max UDMA/33 cmd 0x1f0 ctl 0x3f6 bmdma 0x1080 irq 14 [ 0.860938] ata2: PATA max UDMA/33 cmd 0x170 ctl 0x376 bmdma 0x1088 irq 15 [ 0.867745] 1e000000.flash: Found 1 x32 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000 [ 0.875306] Intel/Sharp Extended Query Table at 0x0031 [ 0.877146] Using buffer write method [ 0.889990] 3 ofpart partitions found on MTD device 1e000000.flash [ 0.892038] Creating 3 MTD partitions on "1e000000.flash": [ 0.894070] 0x000000000000-0x000000100000 : "YAMON" [ 0.898915] 0x000000100000-0x0000003e0000 : "User FS" [ 0.901964] 0x0000003e0000-0x000000400000 : "Board Config" [ 0.907740] libphy: Fixed MDIO Bus: probed [ 0.911077] tun: Universal TUN/TAP device driver, 1.6 [ 0.914473] pcnet32: pcnet32.c:v1.35 21.Apr.2008 tsbogend@alpha.franken.de [ 0.917961] pcnet32 0000:00:0b.0: enabling device (0000 -> 0003) [ 0.920702] pcnet32: PCnet/PCI II 79C970A at 0x1060, 52:54:00:12:34:56 assigned IRQ 10 [ 0.925668] pcnet32: eth0: registered as PCnet/PCI II 79C970A [ 0.927374] pcnet32: 1 cards_found [ 0.932403] ehci_hcd: USB 2.0 ‘Enhanced‘ Host Controller (EHCI) Driver [ 0.933322] ehci-pci: EHCI PCI platform driver [ 0.935007] ohci_hcd: USB 1.1 ‘Open‘ Host Controller (OHCI) Driver [ 0.938297] ohci-pci: OHCI PCI platform driver [ 0.939895] usbcore: registered new interface driver usb-storage [ 0.945872] rtc_cmos 70.rtc: rtc core: registered rtc_cmos as rtc0 [ 0.947858] rtc_cmos 70.rtc: alarms up to one day, 242 bytes nvram [ 0.951450] sdhci: Secure Digital Host Controller Interface driver [ 0.959792] sdhci: Copyright(c) Pierre Ossman [ 0.963071] usbcore: registered new interface driver usbhid [ 0.963470] usbhid: USB HID core driver [ 0.966503] ip_tables: (C) 2000-2006 Netfilter Core Team [ 0.969848] Initializing XFRM netlink socket [ 0.971660] NET: Registered protocol family 10 [ 0.981052] Segment Routing with IPv6 [ 0.982032] ip6_tables: (C) 2000-2006 Netfilter Core Team [ 0.984143] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver [ 0.987693] NET: Registered protocol family 17 [ 0.988269] NET: Registered protocol family 15 [ 0.989177] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this. [ 0.990412] Key type dns_resolver registered [ 0.993066] Loading compiled-in X.509 certificates [ 1.001604] rtc_cmos 70.rtc: setting system clock to 2020-12-18 14:50:41 UTC (1608303041) [ 1.141306] ata1.00: ATA-7: QEMU HARDDISK, 2.5+, max UDMA/100 [ 1.141866] ata1.00: 1048576 sectors, multi 16: LBA48 [ 1.145604] ata1.00: configured for UDMA/33 [ 1.163978] ata2.00: ATAPI: QEMU DVD-ROM, 2.5+, max UDMA/100 [ 1.164704] ata2.00: configured for UDMA/33 [ 1.168822] scsi 0:0:0:0: Direct-Access ATA QEMU HARDDISK 2.5+ PQ: 0 ANSI: 5 [ 1.178336] sd 0:0:0:0: [sda] 1048576 512-byte logical blocks: (537 MB/512 MiB) [ 1.180047] sd 0:0:0:0: Attached scsi generic sg0 type 0 [ 1.184236] scsi 1:0:0:0: CD-ROM QEMU QEMU DVD-ROM 2.5+ PQ: 0 ANSI: 5 [ 1.187511] sd 0:0:0:0: [sda] Write Protect is off [ 1.190913] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn‘t support DPO or FUA [ 1.192048] scsi 1:0:0:0: Attached scsi generic sg1 type 5 [ 1.220588] sd 0:0:0:0: [sda] Attached SCSI disk [ 1.221879] md: Waiting for all devices to be available before autodetect [ 1.222153] md: If you don‘t use raid, use raid=noautodetect [ 1.229409] md: Autodetecting RAID arrays. [ 1.229745] md: autorun ... [ 1.229914] md: ... autorun DONE. [ 1.242861] EXT4-fs (sda): couldn‘t mount as ext3 due to feature incompatibilities [ 1.251439] EXT4-fs (sda): couldn‘t mount as ext2 due to feature incompatibilities [ 1.290084] EXT4-fs (sda): mounted filesystem with ordered data mode. Opts: (null) [ 1.302894] VFS: Mounted root (ext4 filesystem) on device 8:0. [ 1.316137] devtmpfs: mounted [ 1.451179] Freeing unused kernel memory: 384K [ 1.456515] This architecture does not have kernel memory protection. [ 1.606110] EXT4-fs (sda): re-mounted. Opts: (null) Starting logging: OK Initializing random number generator... done. Starting rpcbind: OK Starting network: OK Starting NFS statd: OK Starting NFS services: OK Starting NFS daemon: [ 2.379771] NFSD: the nfsdcld client tracking upcall will be removed in 3.10. Please transition to using nfsdcltrack. [ 2.380599] NFSD: starting 90-second grace period (net f00000da) OK Starting NFS mountd: OK nanomips32r6-le-sf-soak 2017.05-03 nanomips32r6-le-sf-soak login: root
nanomips32r6-le-sf-soak 2017.05-03
nanomips32r6-le-sf-soak login: root
用户名root,没有密码,直接进入shell。
# ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 1 06:50 ? 00:00:00 init root 2 0 0 06:50 ? 00:00:00 [kthreadd] root 3 2 0 06:50 ? 00:00:00 [kworker/0:0] root 4 2 0 06:50 ? 00:00:00 [kworker/0:0H] root 5 2 0 06:50 ? 00:00:00 [kworker/u2:0] root 6 2 0 06:50 ? 00:00:00 [mm_percpu_wq] root 7 2 0 06:50 ? 00:00:00 [ksoftirqd/0] root 8 2 0 06:50 ? 00:00:00 [rcu_sched] root 9 2 0 06:50 ? 00:00:00 [rcu_bh] root 10 2 0 06:50 ? 00:00:00 [migration/0] root 11 2 0 06:50 ? 00:00:00 [cpuhp/0] root 12 2 0 06:50 ? 00:00:00 [kdevtmpfs] root 13 2 0 06:50 ? 00:00:00 [netns] root 14 2 0 06:50 ? 00:00:00 [oom_reaper] root 15 2 0 06:50 ? 00:00:00 [writeback] root 16 2 0 06:50 ? 00:00:00 [kworker/0:1] root 17 2 0 06:50 ? 00:00:00 [ksmd] root 18 2 0 06:50 ? 00:00:00 [crypto] root 19 2 0 06:50 ? 00:00:00 [kblockd] root 20 2 0 06:50 ? 00:00:00 [ata_sff] root 21 2 0 06:50 ? 00:00:00 [md] root 22 2 0 06:50 ? 00:00:00 [rpciod] root 23 2 0 06:50 ? 00:00:00 [xprtiod] root 24 2 0 06:50 ? 00:00:00 [kswapd0] root 25 2 0 06:50 ? 00:00:00 [nfsiod] root 44 2 0 06:50 ? 00:00:00 [scsi_eh_0] root 45 2 0 06:50 ? 00:00:00 [scsi_tmf_0] root 46 2 0 06:50 ? 00:00:00 [scsi_eh_1] root 47 2 0 06:50 ? 00:00:00 [scsi_tmf_1] root 48 2 0 06:50 ? 00:00:00 [kworker/u2:1] root 49 2 0 06:50 ? 00:00:00 [kworker/u2:2] root 50 2 0 06:50 ? 00:00:00 [kworker/u2:3] root 52 2 0 06:50 ? 00:00:00 [kworker/u2:4] root 54 2 0 06:50 ? 00:00:00 [ipv6_addrconf] root 55 2 0 06:50 ? 00:00:00 [kworker/0:1H] root 56 2 0 06:50 ? 00:00:00 [jbd2/sda-8] root 57 2 0 06:50 ? 00:00:00 [ext4-rsv-conver] root 69 1 0 06:50 ? 00:00:00 /sbin/syslogd -n root 72 1 0 06:50 ? 00:00:00 /sbin/klogd -n root 81 1 0 06:50 ? 00:00:00 /usr/bin/rpcbind root 95 1 0 06:50 ? 00:00:00 rpc.statd root 102 2 0 06:50 ? 00:00:00 [lockd] root 104 2 0 06:50 ? 00:00:00 [nfsd] root 105 2 0 06:50 ? 00:00:00 [nfsd] root 107 1 0 06:50 ? 00:00:00 rpc.mountd root 112 1 0 06:50 ttyS0 00:00:00 -sh root 121 112 0 06:51 ttyS0 00:00:00 ps -ef
原文:https://www.cnblogs.com/tangtangworld/p/14157558.html