GEM5学习(4): 运行全系统模式的ARM系统
详细说明可以见官网 gem5: Extending gem5 for ARM
下载镜像
mkdir -p cpu_tests/benchmarks/bin/arm
cd cpu_tests/benchmarks/bin/arm
wget dist.gem5.org/dist/v22-0/test-progs/cpu-tests/bin/arm/Bubblesort
wget dist.gem5.org/dist/v22-0/test-progs/cpu-tests/bin/arm/FloatMM
构建仿真器
构建arm 的仿真器
scons build/ARM/gem5.opt -j 20
运行脚本
设置环境
export IMG_ROOT=/absolute/path/to/fs_images/
运行脚本
fs 版本就是跑起来有点慢
./build/ARM/gem5.opt configs/example/arm/fs_bigLITTLE.py \--caches \--bootloader="$IMG_ROOT/binaries/boot.arm"\--kernel="$IMG_ROOT/binaries/vmlinux.arm"\--disk="$IMG_ROOT/disks/m5_exit.squashfs.arm" \--bootscript=path/to/bootscript.rcS
下面是不分输出日志
==== m5 terminal: Terminal 0 ====
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.18.0+ (arm-employee@arm-computer) (gcc version 7.4.0 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1)) #1 SMP PREEMPT Wed Nov 6 14:11:58 GMT 2019
[ 0.000000] CPU: ARMv7 Processor [410fc0f0] revision 0 (ARMv7), cr=14c5387d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[ 0.000000] OF: fdt: Machine model: V2P-CA15
[ 0.000000] bootconsole [earlycon0] enabled
[ 0.000000] earlycon: pl11 at MMIO 0x1c090000 (options '')
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.18.0+ (arm-employee@arm-computer) (gcc version 7.4.0 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1)) #1 SMP PREEMPT Wed Nov 6 14:11:58 GMT 2019
[ 0.000000] CPU: ARMv7 Processor [410fc0f0] revision 0 (ARMv7), cr=14c5387d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[ 0.000000] OF: fdt: Machine model: V2P-CA15
[ 0.000000] bootconsole [earlycon0] enabled
[ 0.000000] earlycon: pl11 at MMIO 0x1c090000 (options '')
[ 0.000000] bootconsole [pl11] enabled
[ 0.000000] bootconsole [pl11] enabled
[ 0.000000] Truncating memory at 0x80000000 to fit in 32-bit physical address space
[ 0.000000] Truncating memory at 0x80000000 to fit in 32-bit physical address space
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] cma: Reserved 16 MiB at 0xfec00000
[ 0.000000] cma: Reserved 16 MiB at 0xfec00000
[ 0.000000] On node 0 totalpages: 524287
[ 0.000000] On node 0 totalpages: 524287
[ 0.000000] Normal zone: 2862 pages used for memmap
[ 0.000000] Normal zone: 2862 pages used for memmap
[ 0.000000] Normal zone: 0 pages reserved
[ 0.000000] Normal zone: 0 pages reserved
[ 0.000000] Normal zone: 325632 pages, LIFO batch:31
[ 0.000000] Normal zone: 325632 pages, LIFO batch:31
[ 0.000000] HighMem zone: 198655 pages, LIFO batch:31
[ 0.000000] HighMem zone: 198655 pages, LIFO batch:31
[ 0.000000] random: get_random_bytes called from start_kernel+0xa0/0x494 with crng_init=0
[ 0.000000] random: get_random_bytes called from start_kernel+0xa0/0x494 with crng_init=0
[ 0.000000] percpu: Embedded 18 pages/cpu @(ptrval) s41292 r8192 d24244 u73728
[ 0.000000] percpu: Embedded 18 pages/cpu @(ptrval) s41292 r8192 d24244 u73728
[ 0.000000] pcpu-alloc: s41292 r8192 d24244 u73728 alloc=18*4096
[ 0.000000] pcpu-alloc: s41292 r8192 d24244 u73728 alloc=18*4096
[ 0.000000] pcpu-alloc: [0] 0 [0] 1
[ 0.000000] pcpu-alloc: [0] 0 [0] 1
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 521425
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 521425
[ 0.000000] Kernel command line: earlyprintk earlycon=pl011,0x1c090000 console=ttyAMA0 lpj=19988480 norandmaps loglevel=8 mem=2GiB root=/dev/vda1 rw init=/sbin/init vmalloc=768MB
[ 0.000000] Kernel command line: earlyprintk earlycon=pl011,0x1c090000 console=ttyAMA0 lpj=19988480 norandmaps loglevel=8 mem=2GiB root=/dev/vda1 rw init=/sbin/init vmalloc=768MB
[ 0.000000] Dentry cache hash table entries: 262144 (order: 8, 1048576 bytes)
[ 0.000000] Dentry cache hash table entries: 262144 (order: 8, 1048576 bytes)
[ 0.000000] Inode-cache hash table entries: 131072 (order: 7, 524288 bytes)
[ 0.000000] Inode-cache hash table entries: 131072 (order: 7, 524288 bytes)
[ 0.000000] Memory: 2048700K/2097148K available (8192K kernel code, 447K rwdata, 1732K rodata, 1024K init, 167K bss, 32064K reserved, 16384K cma-reserved, 778236K highmem)
[ 0.000000] Memory: 2048700K/2097148K available (8192K kernel code, 447K rwdata, 1732K rodata, 1024K init, 167K bss, 32064K reserved, 16384K cma-reserved, 778236K highmem)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
[ 0.000000] vmalloc : 0xd0000000 - 0xff800000 ( 760 MB)
[ 0.000000] lowmem : 0x80000000 - 0xcf800000 (1272 MB)
[ 0.000000] pkmap : 0x7fe00000 - 0x80000000 ( 2 MB)
[ 0.000000] modules : 0x7f000000 - 0x7fe00000 ( 14 MB)
[ 0.000000] .text : 0x(ptrval) - 0x(ptrval) (9184 kB)
[ 0.000000] .init : 0x(ptrval) - 0x(ptrval) (1024 kB)
[ 0.000000] .data : 0x(ptrval) - 0x(ptrval) ( 448 kB)
[ 0.000000] .bss : 0x(ptrval) - 0x(ptrval) ( 168 kB)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
[ 0.000000] vmalloc : 0xd0000000 - 0xff800000 ( 760 MB)
[ 0.000000] lowmem : 0x80000000 - 0xcf800000 (1272 MB)
[ 0.000000] pkmap : 0x7fe00000 - 0x80000000 ( 2 MB)
[ 0.000000] modules : 0x7f000000 - 0x7fe00000 ( 14 MB)
[ 0.000000] .text : 0x(ptrval) - 0x(ptrval) (9184 kB)
[ 0.000000] .init : 0x(ptrval) - 0x(ptrval) (1024 kB)
[ 0.000000] .data : 0x(ptrval) - 0x(ptrval) ( 448 kB)
[ 0.000000] .bss : 0x(ptrval) - 0x(ptrval) ( 168 kB)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[ 0.000000] Preemptible hierarchical RCU implementation.
[ 0.000000] Preemptible hierarchical RCU implementation.
[ 0.000000] RCU restricting CPUs from NR_CPUS=32 to nr_cpu_ids=2.
[ 0.000000] RCU restricting CPUs from NR_CPUS=32 to nr_cpu_ids=2.
[ 0.000000] Tasks RCU enabled.
[ 0.000000] Tasks RCU enabled.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] Offload RCU callbacks from CPUs: (none).
[ 0.000000] Offload RCU callbacks from CPUs: (none).
[ 0.000000] clk_gem5_energy_ctrl: No cpu-map in DT! Falling back to old detection method!
[ 0.000000] clk_gem5_energy_ctrl: No cpu-map in DT! Falling back to old detection method!
[ 0.000000] clk_gem5_energy_ctrl: No clusters in DT! Falling back to using CPU topology!
[ 0.000000] clk_gem5_energy_ctrl: No clusters in DT! Falling back to using CPU topology!
[ 0.000002] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000002] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000236] arch_timer: cp15 and mmio timer(s) running at 25.16MHz (virt/virt).
[ 0.000236] arch_timer: cp15 and mmio timer(s) running at 25.16MHz (virt/virt).
[ 0.000363] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x5cdd39714, max_idle_ns: 440795202620 ns
[ 0.000363] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x5cdd39714, max_idle_ns: 440795202620 ns
[ 0.000547] sched_clock: 56 bits at 25MHz, resolution 39ns, wraps every 4398046511084ns
[ 0.000547] sched_clock: 56 bits at 25MHz, resolution 39ns, wraps every 4398046511084ns
[ 0.000684] Switching to timer-based delay loop, resolution 39ns
[ 0.000684] Switching to timer-based delay loop, resolution 39ns
[ 0.000860] Console: colour dummy device 80x30
[ 0.000860] Console: colour dummy device 80x30
[ 0.000941] Calibrating delay loop (skipped) preset value.. 9994.24 BogoMIPS (lpj=19988480)
[ 0.000941] Calibrating delay loop (skipped) preset value.. 9994.24 BogoMIPS (lpj=19988480)
[ 0.001084] pid_max: default: 32768 minimum: 301
[ 0.001084] pid_max: default: 32768 minimum: 301
[ 0.001213] Mount-cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.001213] Mount-cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.001342] Mountpoint-cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.001342] Mountpoint-cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.001687] CPU: Testing write buffer coherency: ok
[ 0.001687] CPU: Testing write buffer coherency: ok
[ 0.001776] CPU0: Spectre v2: firmware did not set auxiliary control register IBE bit, system vulnerable
[ 0.001776] CPU0: Spectre v2: firmware did not set auxiliary control register IBE bit, system vulnerable
[ 0.002033] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.002033] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.024250] Setting up static identity map for 0x80100000 - 0x80100060
[ 0.024250] Setting up static identity map for 0x80100000 - 0x80100060
[ 0.032237] Hierarchical SRCU implementation.
[ 0.032237] Hierarchical SRCU implementation.
[ 0.048255] smp: Bringing up secondary CPUs ...
[ 0.048255] smp: Bringing up secondary CPUs ...
上面的这些输出需要通过串口模拟器的才能看到
cd util
make
./util/term/m5term 3456