当前位置: 首页 > 工具软件 > Xen > 使用案例 >

在qemu vexpress-a15平台运行xen

虞高雅
2023-12-01

此文章参考xen官网网站的wiki,感兴趣的同学可以自行去学习。xen wiki链接网址

1)安装编译器:

sudo apt-get install gcc-arm-linux-gnueabihf

2)从uboot官方下载源码进行编译

git clone git://git.denx.de/u-boot.git u-boot
cd u-boot
git checkout v2015.10

构建uboot源码:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- vexpress_ca15_tc2_defconfig

make CROSS_COMPILE=arm-linux-gnueabihf- -j4

3)编译设备树

dtc工具安装:

sudo apt-get install device-tree-compiler

由dts生成dtb:
dtc -I dts -O dtb -o vexpress-v2p-ca15_a7.dtb vexpress-v2p-ca15_a7.dts

4)编译xen

安装编译环境:

sudo apt-get install bcc
sudo apt-get install liblzma-dev
sudo apt-get install python3-dev
sudo apt-get install libaio-dev
sudo apt-get install libssl-dev
sudo apt-get install libglib2.0-dev
sudo apt-get install libncurses5-dev
sudo apt-get install uuid-dev
sudo apt-get install iasl
sudo apt-get install libyajl-dev
sudo apt-get install flex
sudo apt-get install bison
sudo apt install u-boot-tools

获取xen源码:

git clone git://xenbits.xenproject.org/xen.git
cd xen
git checkout 2e9f5f726285deee96d7d9f89ce5680a0101111a -b stout_xen

配置xen:

cd stout_xen

XEN_TARGET_ARCH=arm32 ./configure

启动调试选项:

cd xen
make menuconfig XEN_TARGET_ARCH=arm32

    Debugging Options  --->

        [*]	  Developer Checks

		[*]   Early printk (Early printk with pl011 for versatile express│ │  

  │ │    (0x1c090000) Early printk, physical base address of debug UART

编译:

cd ..

make xen XEN_TARGET_ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabihf- debug=y -j4

制作Xen uImage镜像:

mkimage -A arm -T kernel -a 0x80200000 -e 0x80200000 -C none -d xen/xen xen/xen-uImage

5)在qemu上运行xen

u-boot启动xen:

qemu-system-aarch64 -machine vexpress-a15 -machine virtualization=true -cpu cortex-a15 -m 2048 -kernel u-boot -device loader,file=xen-uImage,force-raw=on,addr=0x80400000 -device loader,file=vexpress-v2p-ca15_a7.dtb,addr=0x81f00000 -nographic

U-Boot 2019.10 (Feb 09 2022 - 18:17:19 -0800)

DRAM:  1 GiB
WARNING: Caches not enabled
Flash: 128 MiB
MMC:   MMC: 0
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   smc911x-0
Hit any key to stop autoboot:  0 
=> bootm 0x80400000 - 0x81f00000

跳转至xen启动地址:

bootm 0x80400000 - 0x81f00000

U-Boot 2019.10 (Feb 09 2022 - 18:17:19 -0800)

DRAM:  1 GiB
WARNING: Caches not enabled
Flash: 128 MiB
MMC:   MMC: 0
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   smc911x-0
Hit any key to stop autoboot:  0 
=> bootm 0x80400000 - 0x81f00000
## Booting kernel from Legacy Image at 80400000 ...
   Image Name:   
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1048584 Bytes = 1 MiB
   Load Address: 80200000
   Entry Point:  80200000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 81f00000
   Booting using the fdt blob at 0x81f00000
   Loading Kernel Image
   Loading Device Tree to 9fe7f000, end 9fe8642b ... OK

Starting kernel ...

- UART enabled -
- Boot CPU booting -
- Setting up control registers -
- Turning on paging -
- Zero BSS -
- Ready -
(XEN) Checking for initrd in /chosen
(XEN) RAM: 0000000080000000 - 000000009fffffff
(XEN) RAM: 00000000a0000000 - 00000000bfffffff
(XEN) 
(XEN) MODULE[0]: 0000000080200000 - 000000008033e290 Xen         
(XEN) MODULE[1]: 000000009fe7f000 - 000000009fe84000 Device Tree 
(XEN) MODULE[2]: 00000000a0008000 - 00000000a0a08000 Kernel      
(XEN)  RESVD[0]: 000000009ffd1000 - 000000009ffd1138
(XEN) 
(XEN) 
(XEN) Command line: dom0_mem=512M console=dtuart dtuart=serial0 dom0_vcpus_pin hmp-unsafe=true dom0_max_vcpus=1 bootscrub=0 loglvl=all
(XEN) PFN compression on bits 18...18
(XEN) Xen heap: 00000000be000000-00000000c0000000 (8192 pages)
(XEN) Dom heap: 253952 pages
(XEN) Domain heap initialised
(XEN) Booting using Device Tree
(XEN) Platform: VERSATILE EXPRESS
(XEN) Looking for dtuart at "serial0", options ""
 Xen 4.16-unstable
(XEN) Xen version 4.16-unstable (hdwei@) (arm-linux-gnueabihf-gcc (Linaro GCC 6.5-2018.12) 6.5.0) debug=y Wed Feb  9 19:00:54 PST 2022
(XEN) Latest ChangeSet: Fri Sep 3 15:10:43 2021 +0200 git:2d4978e-dirty
(XEN) build-id: 27adefed2e9ad2dd30659e074fbc2c6de5d6cd64
(XEN) Processor: 412fc0f1: "ARM Limited", variant: 0x2, part 0xc0f,rev 0x1
(XEN) 32-bit Execution:
(XEN)   Processor Features: 00001131:00011011
(XEN)     Instruction Sets: AArch32 A32 Thumb Thumb-2 ThumbEE Jazelle
(XEN)     Extensions: GenericTimer Security
(XEN)   Debug Features: 02010555
(XEN)   Auxiliary Features: 00000000
(XEN)   Memory Model Features: 10201105 20000000
(XEN)                          01240000 02102211
(XEN)   ISA Features: 02101110 13112111 21232041
(XEN)                 11112131 10011142 00000000
(XEN) Set SYS_FLAGS to 00000000802000f0 (002000f0)
(XEN) SMP: Allowing 1 CPUs
(XEN) Generic Timer IRQ: phys=30 hyp=26 virt=27 Freq: 62500 KHz
(XEN) GICv2 initialization:
(XEN)         gic_dist_addr=000000002c001000
(XEN)         gic_cpu_addr=000000002c002000
(XEN)         gic_hyp_addr=000000002c004000
(XEN)         gic_vcpu_addr=000000002c006000
(XEN)         gic_maintenance_irq=25
(XEN) GICv2: 160 lines, 1 cpu, secure (IID 00000000).
(XEN) XSM Framework v1.0.0 initialized
(XEN) Initialising XSM SILO mode
(XEN) Using scheduler: SMP Credit Scheduler rev2 (credit2)
(XEN) Initializing Credit2 scheduler
(XEN)  load_precision_shift: 18
(XEN)  load_window_shift: 30
(XEN)  underload_balance_tolerance: 0
(XEN)  overload_balance_tolerance: -3
(XEN)  runqueues arrangement: socket
(XEN)  cap enforcement granularity: 10ms
(XEN) load tracking window length 1073741824 ns
(XEN) Allocated console ring of 16 KiB.
(XEN) VFP implementer 0x41 architecture 4 part 0x30 variant 0xf rev 0x0
(XEN) CPU0: Guest atomics will try 1 times before pausing the domain
(XEN) Brought up 1 CPUs
(XEN) I/O virtualisation disabled
(XEN) P2M: 40-bit IPA
(XEN) P2M: 3 levels with order-1 root, VTCR 0x80003558
(XEN) Scheduling granularity: cpu, 1 CPU per sched-resource
(XEN) Adding cpu 0 to runqueue 0
(XEN)  First cpu on runqueue, activating
(XEN) alternatives: Patching with alt table 002d267c -> 002d276c
(XEN) CPU0 will execute ICIALLU on guest exit
(XEN) *** LOADING DOMAIN 0 ***
(XEN) Loading d0 kernel from boot module @ 00000000a0008000
(XEN) 
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Could not set up DOM0 guest OS
(XEN) ****************************************
(XEN) 
(XEN) Reboot in five seconds...


 

 类似资料: