失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > QEMU搭建ARM linux开发环境

QEMU搭建ARM linux开发环境

时间:2021-09-13 05:08:25

相关推荐

QEMU搭建ARM linux开发环境

qemu可以用来模拟嵌入式的开发板,很多的嵌入式开发技巧完全可以抛开开发板来做实验,甚至可以直接调试驱动。内核调试就更加方便了。

主要参考了:/p/94833e841742

但是完全按照这个来会有各种问题,一般情况下都是busybox和kernel的版本问题,我按照原来的博客的版本搞过一遍,各种报错,后来索性瞎几把整了。

主要有如下几点不一样:

1 busybox原来的说是要动态编译,我偏静态,免得我少拷贝lib出问题

2 kernel版本我试过很多个,但是各有各的问题,最后我用的最新版:linux-5.5

3 busybox我也用的最新版,老版本编译都编不过:busybox-1.31.1

4 编译器用的:arm-linux-gnueabihf/5.3.1

5 qemu用的:QEMU emulator version 4.2.0

6 使用博客里面那种小的文件系统,内存-m 512M足够,但是如果自己的文件系统这里的内存要放大,否则运行出问题

其他的基本上按照他的博客来就行了,另外,用图形界面启动会报sdl错误,我始终装不上这个库,索性就是用命令行来启动了。

启动参数为:

qemu-system-arm -M vexpress-a9 -m 512M -kernel ./zImage -dtb ./vexpress-v2p-ca9.dtb -nographic -append "root=/dev/mmcblk0 rw console=ttyAMA0" -sd rootfs.ext3

结果是这样的,成功了:

WARNING: Image format was not specified for 'rootfs.ext3' 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.Booting Linux on physical CPU 0x0Linux version 5.5.0 (oushaojun@ubuntu) (gcc version 5.3.1 0412 (Linaro GCC 5.3-.05)) #2 SMP Wed Mar 25 04:20:19 PDT CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387dCPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cacheOF: fdt: Machine model: V2P-CA9Memory policy: Data cache writebackReserved memory: created DMA memory pool at 0x4c000000, size 8 MiBOF: reserved mem: initialized node vram@4c000000, compatible id shared-dma-poolcma: Reserved 16 MiB at 0x7f000000CPU: All CPU(s) started in SVC mode.percpu: Embedded 19 pages/cpu s45696 r8192 d23936 u77824Built 1 zonelists, mobility grouping on. Total pages: 130048Kernel command line: root=/dev/mmcblk0 rw console=ttyAMA0printk: log_buf_len individual max cpu contribution: 4096 bytesprintk: log_buf_len total cpu_extra contributions: 12288 bytesprintk: log_buf_len min size: 16384 bytesprintk: log_buf_len: 32768 bytesprintk: early log buf free: 14852(90%)Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)mem auto-init: stack:off, heap alloc:off, heap free:offMemory: 492104K/524288K available (7168K kernel code, 430K rwdata, 1684K rodata, 1024K init, 157K bss, 15800K reserved, 16384K cma-reserved)SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1rcu: Hierarchical RCU implementation.rcu: RCU event tracing is enabled.rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16GIC CPU mask not found - kernel will fail to boot.GIC CPU mask not found - kernel will fail to boot.L2C: platform modifies aux control register: 0x0000 -> 0x02420000L2C: DT/platform modifies aux control register: 0x0000 -> 0x02420000L2C-310 enabling early BRESP for Cortex-A9L2C-310 full line of zeros enabled for Cortex-A9L2C-310 dynamic clock gating disabled, standby mode disabledL2C-310 cache controller enabled, 8 ways, 128 kBL2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x46420001random: get_random_bytes called from start_kernel+0x314/0x4b0 with crng_init=0sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971nsclocksource: arm,sp804: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 nsFailed to initialize '/smb@4000000/motherboard/iofpga@7,00000000/timer@12000': -22smp_twd: clock not found -2Console: colour dummy device 80x30Calibrating local timer... 92.08MHz.Calibrating delay loop... 572.62 BogoMIPS (lpj=2863104)pid_max: default: 32768 minimum: 301Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)CPU: Testing write buffer coherency: okCPU0: Spectre v2: using BPIALL workaroundCPU0: thread -1, cpu 0, socket 0, mpidr 80000000Setting up static identity map for 0x60100000 - 0x60100060rcu: Hierarchical SRCU implementation.smp: Bringing up secondary CPUs ...smp: Brought up 1 node, 1 CPUSMP: Total of 1 processors activated (572.62 BogoMIPS).CPU: All CPU(s) started in SVC mode.devtmpfs: initializedVFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 0clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 nsfutex hash table entries: 1024 (order: 4, 65536 bytes, linear)NET: Registered protocol family 16DMA: preallocated 256 KiB pool for atomic coherent allocationscpuidle: using governor ladderhw-breakpoint: debug architecture 0x4 unsupported.Serial: AMBA PL011 UART driver10009000.uart: ttyAMA0 at MMIO 0x10009000 (irq = 29, base_baud = 0) is a PL011 rev1printk: console [ttyAMA0] enabled1000a000.uart: ttyAMA1 at MMIO 0x1000a000 (irq = 30, base_baud = 0) is a PL011 rev11000b000.uart: ttyAMA2 at MMIO 0x1000b000 (irq = 31, base_baud = 0) is a PL011 rev11000c000.uart: ttyAMA3 at MMIO 0x1000c000 (irq = 32, base_baud = 0) is a PL011 rev1OF: amba_device_add() failed (-19) for /smb@4000000/motherboard/iofpga@7,00000000/wdt@f000OF: amba_device_add() failed (-19) for /memory-controller@100e0000OF: amba_device_add() failed (-19) for /memory-controller@100e1000OF: amba_device_add() failed (-19) for /watchdog@100e5000irq: type mismatch, failed to map hwirq-75 for interrupt-controller@1e001000!SCSI subsystem initializedusbcore: registered new interface driver usbfsusbcore: registered new interface driver hubusbcore: registered new device driver usbAdvanced Linux Sound Architecture Driver Initialized.clocksource: Switched to clocksource arm,sp804NET: Registered protocol family 2tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)TCP established hash table entries: 4096 (order: 2, 16384 bytes, linear)TCP bind hash table entries: 4096 (order: 3, 32768 bytes, linear)TCP: Hash tables configured (established 4096 bind 4096)UDP hash table entries: 256 (order: 1, 8192 bytes, linear)UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)NET: Registered protocol family 1RPC: Registered named UNIX socket transport module.RPC: Registered udp transport module.RPC: Registered tcp transport module.RPC: Registered tcp NFSv4.1 backchannel transport module.hw perfevents: enabled with armv7_cortex_a9 PMU driver, 5 counters availableworkingset: timestamp_bits=30 max_order=17 bucket_order=0squashfs: version 4.0 (/01/31) Phillip Lougherjffs2: version 2.2. (NAND) © 2001- Red Hat, Inc.9p: Installing v9fs 9p2000 file system supportio scheduler mq-deadline registeredio scheduler kyber registeredi2c i2c-0: Added multiplexed i2c bus 2drm-clcd-pl111 1001f000.clcd: assigned reserved memory node vram@4c000000drm-clcd-pl111 1001f000.clcd: using device-specific reserved memorydrm-clcd-pl111 1001f000.clcd: initializing Versatile Express PL111drm-clcd-pl111 1001f000.clcd: core tile graphics presentdrm-clcd-pl111 1001f000.clcd: this device will be deactivatedError: Driver 'vexpress-muxfpga' is already registered, aborting...drm-clcd-pl111 10020000.clcd: initializing Versatile Express PL111drm-clcd-pl111 10020000.clcd: DVI muxed to daughterboard 1 (core tile) CLCDdrm-clcd-pl111 10020000.clcd: found bridge on endpoint 0drm-clcd-pl111 10020000.clcd: Using non-panel bridge[drm] Supports vblank timestamp caching Rev 2 (21.10.).[drm] No driver support for vblank timestamp query.[drm] Initialized pl111 1.0.0 0317 for 10020000.clcd on minor 0Console: switching to colour frame buffer device 128x48drm-clcd-pl111 10020000.clcd: fb0: pl111drmfb frame buffer devicephysmap-flash 40000000.flash: physmap platform flash device: [mem 0x40000000-0x43ffffff]40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000Intel/Sharp Extended Query Table at 0x0031Using buffer write methodphysmap-flash 40000000.flash: physmap platform flash device: [mem 0x44000000-0x47ffffff]40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000Intel/Sharp Extended Query Table at 0x0031Using buffer write methodConcatenating MTD devices:(0): "40000000.flash"(1): "40000000.flash"into device "40000000.flash"physmap-flash 48000000.psram: physmap platform flash device: [mem 0x48000000-0x49ffffff]libphy: Fixed MDIO Bus: probedlibphy: smsc911x-mdio: probedsmsc911x 4e000000.ethernet eth0: MAC Address: 52:54:00:12:34:56isp1760 4f000000.usb: bus width: 32, oc: digitalisp1760 4f000000.usb: NXP ISP1760 USB Host Controllerisp1760 4f000000.usb: new USB bus registered, assigned bus number 1isp1760 4f000000.usb: Scratch test failed.isp1760 4f000000.usb: can't setup: -19isp1760 4f000000.usb: USB bus 1 deregisteredusbcore: registered new interface driver usb-storagertc-pl031 10017000.rtc: registered as rtc0mmci-pl18x 10005000.mmci: Got CD GPIOmmci-pl18x 10005000.mmci: Got WP GPIOmmci-pl18x 10005000.mmci: mmc0: PL181 manf 41 rev0 at 0x10005000 irq 25,26 (pio)ledtrig-cpu: registered to indicate activity on CPUsusbcore: registered new interface driver usbhidusbhid: USB HID core driverinput: AT Raw Set 2 keyboard as /devices/platform/smb@4000000/smb@4000000:motherboard/smb@4000000:motherboard:iofpga@7,00000000/10006000.kmi/serio0/input/input0aaci-pl041 10004000.aaci: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 24aaci-pl041 10004000.aaci: FIFO 512 entriesoprofile: using arm/armv7-ca9NET: Registered protocol family 179pnet: Installing 9P2000 supportRegistering SWP/SWPB emulation handlermmc0: new SD card at address 4567mmcblk0: mmc0:4567 QEMU! 32.0 MiB rtc-pl031 10017000.rtc: setting system clock to -03-25T11:38:52 UTC (1585136332)ALSA device list:#0: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 24random: fast init doneinput: ImExPS/2 Generic Explorer Mouse as /devices/platform/smb@4000000/smb@4000000:motherboard/smb@4000000:motherboard:iofpga@7,00000000/10007000.kmi/serio1/input/input2EXT4-fs (mmcblk0): mounting ext3 file system using the ext4 subsystemEXT4-fs (mmcblk0): mounted filesystem with ordered data mode. Opts: (null)ext3 filesystem being mounted at /root supports timestamps until 2038 (0x7fffffff)VFS: Mounted root (ext3 filesystem) on device 179:0.devtmpfs: mountedFreeing unused kernel memory: 1024KRun /sbin/init as init processrandom: crng init donecan't run '/etc/init.d/rcS': No such file or directoryPlease press Enter to activate this console. / # / # / # / # lsbin lib lost+found usrdev linuxrcsbin

如果觉得《QEMU搭建ARM linux开发环境》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。