当前位置:网站首页>Qemu 搭建Armv8 平台
Qemu 搭建Armv8 平台
2022-08-03 05:23:00 【SEVENTHD7】
1. 安装依赖库
sudo apt-get install ninja-build
sudo apt-get install libglib2.0-dev
sudo apt-get install libpixman-1-dev
2. 安装python3.6
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.6
sudo apt install python3.6-dev
sudo update-alternatives --install /usr/bin/python3 python3
/usr/bin/python3.5
1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
- sudo apt install python3-pip
3.安装GCC
# 命令最后的 20和50是优先级,如果使用auto选择模式,系统将默认使用优先级高的
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 20
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 50
4.安装ninja
https://github.com/ninja-build/ninja/releases
可下载 执行文件
如果是源码需要自行编译按装
5.编译Qemu
- glib-2.56/gthread-2.0
https://download.gnome.org/sources/glib/2.56/
- zlib
http://www.zlib.net/https://sourceforge.net/projects/libpng/files/zlib
- libffi
https://sourceware.org/pub/libffi/
- autoconf
ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.gz
autoreconf: running: aclocal -I m4 --output=aclocal.m4t
Can't exec "aclocal": 没有那个文件或目录 at /usr/share/autoconf/Autom4te/FileUtils.pm line 326.
autoreconf: failed to run aclocal: No such file or directory解决办法:
sudo apt -y install autotools-dev automake m4 perl
sudo apt -y install libtool
.libpcre
sudo apt install libpcre3-dev
.libmount
sudo apt install libmount-dev
.pixman-1
sudo apt install libpixman-1-dev
6 armv8 环境
6.1 查看可以安装的版本
apt-cache search aarch64-linux-gnu
cpp-9-aarch64-linux-gnu - GNU C preprocessor
cpp-aarch64-linux-gnu - GNU C preprocessor (cpp) for the arm64 architecture
g++-9-aarch64-linux-gnu - GNU C++ compiler (cross compiler for arm64 architecture)
g++-aarch64-linux-gnu - GNU C++ compiler for the arm64 architecture
gcc-9-aarch64-linux-gnu - GNU C compiler (cross compiler for arm64 architecture)
gcc-9-aarch64-linux-gnu-base - GCC,GNU 编译器套装(基本软件包)
gcc-aarch64-linux-gnu - GNU C compiler for the arm64 architecture
binutils-aarch64-linux-gnu - GNU binary utilities, for aarch64-linux-gnu target
binutils-aarch64-linux-gnu-dbg - GNU binary utilities, for aarch64-linux-gnu target (debug symbols)
cpp-10-aarch64-linux-gnu - GNU C 预处理器
g++-10-aarch64-linux-gnu - GNU C++ compiler (cross compiler for arm64 architecture)
gcc-10-aarch64-linux-gnu - GNU C compiler (cross compiler for arm64 architecture)
gcc-10-aarch64-linux-gnu-base - GCC,GNU 编译器套装(基本软件包)
gccgo-10-aarch64-linux-gnu - GNU Go compiler
gccgo-9-aarch64-linux-gnu - GNU Go compiler
gccgo-aarch64-linux-gnu - Go compiler (based on GCC) for the arm64 architecture
cpp-8-aarch64-linux-gnu - GNU C preprocessor
g++-8-aarch64-linux-gnu - GNU C++ compiler (cross compiler for arm64 architecture)
gcc-10-plugin-dev-aarch64-linux-gnu - Files for GNU GCC plugin development.
gcc-8-aarch64-linux-gnu - GNU C compiler (cross compiler for arm64 architecture)
gcc-8-aarch64-linux-gnu-base - GCC, the GNU Compiler Collection (base package)
gcc-8-plugin-dev-aarch64-linux-gnu - Files for GNU GCC plugin development.
gcc-9-plugin-dev-aarch64-linux-gnu - Files for GNU GCC plugin development.
gccgo-8-aarch64-linux-gnu - GNU Go compiler
gdc-10-aarch64-linux-gnu - GNU D compiler (version 2) (cross compiler for arm64 architecture)
gdc-8-aarch64-linux-gnu - GNU D compiler (version 2) (cross compiler for arm64 architecture)
gdc-9-aarch64-linux-gnu - GNU D compiler (version 2) (cross compiler for arm64 architecture)
gdc-aarch64-linux-gnu - GNU D compiler (based on GCC) for the arm64 architecture
gfortran-10-aarch64-linux-gnu - GNU Fortran compiler
gfortran-8-aarch64-linux-gnu - GNU Fortran compiler
gfortran-9-aarch64-linux-gnu - GNU Fortran compiler
gfortran-aarch64-linux-gnu - GNU Fortran 95 compiler for the arm64 architecture
gm2-10-aarch64-linux-gnu - GNU Modula-2 compiler (cross compiler for arm64 architecture)
gm2-9-aarch64-linux-gnu - GNU Modula-2 compiler (cross compiler for arm64 architecture)
gm2-aarch64-linux-gnu - GNU Modula-2 compiler (based on GCC) for the arm64 architecture
gnat-10-aarch64-linux-gnu - GNU Ada compiler
gnat-8-aarch64-linux-gnu - GNU Ada compiler
gnat-8-sjlj-aarch64-linux-gnu - GNU Ada compiler (setjump/longjump runtime library)
gnat-9-aarch64-linux-gnu - GNU Ada compiler
gobjc++-10-aarch64-linux-gnu - GNU Objective-C++ compiler
gobjc++-8-aarch64-linux-gnu - GNU Objective-C++ compiler
gobjc++-9-aarch64-linux-gnu - GNU Objective-C++ compiler
gobjc++-aarch64-linux-gnu - GNU Objective-C++ compiler for the arm64 architecture
gobjc-10-aarch64-linux-gnu - GNU Objective-C compiler
gobjc-8-aarch64-linux-gnu - GNU Objective-C compiler
gobjc-9-aarch64-linux-gnu - GNU Objective-C compiler
6.1 gcc-aarch64-linux-gnu
sudo apt-get install gcc-aarch64-linux-gnu gcc-5-aarch64-linux-gnu
6.2 设置ARM gcc版本
sudo update-alternatives --install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-gcc-5 5
sudo update-alternatives --install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-gcc-7 7
6.3 选择gcc-5
$ sudo update-alternatives --config aarch64-linux-gnu-gcc
There are 2 choices for the alternative aarch64-linux-gnu-gcc (providing /usr/bin/aarch64-linux-gnu-gcc).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/aarch64-linux-gnu-gcc-7 7 auto mode
1 /usr/bin/aarch64-linux-gnu-gcc-5 5 manual mode
2 /usr/bin/aarch64-linux-gnu-gcc-7 7 manual modePress <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/bin/aarch64-linux-gnu-gcc-5 to provide /usr/bin/aarch64-linux-gnu-gcc (aarch64-linux-gnu-gcc) in manual mode
6.4 查看版本
aarch64-linux-gnu-gcc -v
7 编译内核
配置内核硬件环境
Makefile
#ARCH ?= $(SUBARCH)
#CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)ARCH ?= arm64
CROSS_COMPILE ?= aarch64-linux-gnu-
make menuconfig:
Platform Selection[*] ARMv8 Software model (Versatile Express )
ARM VersatileExpress开发板(简称VE板)是ARM公司推出的,提供给厂商评估ARM内核的高效的软硬件平台
Q1:
security/selinux/include/classmap.h:245:2: error: #error New address family defined, please update secclass_map.
245 | #error New address family defined, please update secclass_map.Instead of relying on the host definition, include linux/socket.h in classmap.h to have PF_MAX.Q2:
编译linux内核版本4.19编译scripts目录时报错
查询报错文件sign-file.c文件,报错内容为fatal error: openssl/opensslv.h: No such file or directory
根据查找为编译环境中缺少libcrypto库,编译环境为ubuntu环境
安装libcrypto库命令Q3:sudo apt-get install libssl-dev
make[1]: *** 没有规则可制作目标“debian/canonical-certs.pem”,由“certs/x509
签名:不需要CONFIG_SYSTEM_TRUSTED_KEYS=""
CONFIG_SYSTEM_REVOCATION_KEYS="
Q4:aarch64-linux-gnu-ld: arch/arm64/kernel/traps.o: in function `arm64_ftr_reg_user_value':
/home/lx/work/linux/linux-4.14.10/./arch/arm64/include/asm/cpufeature.h:191: undefined reference to `__ubsan_handle_type_mismatch_v1'
aarch64-linux-gnu-ld: /home/lx/work/linux/linux-4.14.10/./arch/arm64/include/asm/cpufeature.h:191: undefined reference to `__ubsan_handle_type_mismatch_v1'
aarch64-linux-gnu-ld: /home/lx/work/linux/linux-4.14.10/./arch/arm64/include/asm/cpufeature.h:191: undefined reference to `__ubsan_handle_type_mismatch_v1'
aarch64-linux-gnu-ld: arch/arm64/kernel/traps.o: in function `ctr_read_handler':
/home/lx/work/linux/linux-4.14.10/arch/arm64/kernel/traps.c:493: undefined reference to `__ubsan_handle_type_mismatch_v1'
aarch64-linux-gnu-ld: arch/arm64/kernel/traps.o: in function `pt_regs_write_reg':
/home/lx/work/linux/linux-4.14.10/./arch/arm64/include/asm/ptrace.h:243: undefined reference to `__ubsan_handle_type_mismatch_v1'
aarch64-linux-gnu-ld: arch/arm64/kernel/traps.o:/home/lx/work/linux/linux-4.14.10/./arch/arm64/include/asm/ptrace.h:243: more undefined references to `__ubsan_handle_type_mismatch_v1' follow
make: *** [Makefile:1008: vmlinux] Error 1
8 qemu启动内核
qemu-system-aarch64 -machine virt -cpu cortex-a57 -machine type=virt -nographic -m 2048 -smp 2 -kernel arch/arm64/boot/Image --append "rdinit=/linuxrc console=ttyAMA0"
9 挂载硬盘
查看硬盘
$ fdisk -l
设备 起点 末尾 扇区 大小 类型
/dev/nvme0n1p1 2048 534527 532480 260M EFI 系统
/dev/nvme0n1p2 534528 567295 32768 16M Microsoft 保留
/dev/nvme0n1p3 567296 401051647 400484352 191G Microsoft 基本数据
/dev/nvme0n1p4 401051648 579309567 178257920 85G Microsoft 基本数据
/dev/nvme0n1p5 579309568 998739255 419429688 200G Microsoft 基本数据
/dev/nvme0n1p6 998742016 1000204287 1462272 714M Windows 恢复环 table
$ sudo fdisk /dev/sda
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xcd6d4a4c.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-8, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-8, default 8):
Using default value 8
Command (m for help): p
Disk /dev/sda: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xcd6d4a4c
Device Boot Start End Blocks Id System
/dev/sda1 1 652 5237158+ 83 Linux
边栏推荐
- 取某一区间中素数的个数--洛谷P1865 A % B Problem
- 优雅的拦截TabLayout的点击事件
- 中国生活垃圾处理行业十四五规划与投融资模式分析报告2022~2028年
- 经典论文-ResNet
- Oracle count(1)、count(*)、count(列) 区别详解
- 自监督论文阅读笔记 Self-Supervised Deep Learning for Vehicle Detection in High-Resolution Satellite Imagery
- spark sql 报错 Can‘t zip RDDs with unequal numbers of partitions
- 二阶段提问总结
- docker mysql 容器中执行mysql脚本文件并解决乱码
- opencv透视变化
猜你喜欢
自监督论文阅读笔记SELF-SUPERVISED SPECTRAL MATCHING NETWORK FOR HYPERSPECTRAL TARGET DETECTION
自监督论文阅读笔记FIAD net: a Fast SAR ship detection network based on feature integration attention and self
Kettle 从资源库中载入新的转换出错(Invalid byte 1 of 1-byte UTF-8 sequence)
Playing with Markdown(2) - Extraction and Manipulation of Abstract Syntax Trees
The ` monorepo ` ` hoist ` mechanism lead to the change of the loading configuration file path
Leetcode刷题——一些用层次遍历解决的问题(111. 二叉树的最小深度、104. 二叉树的最大深度、226. 翻转二叉树、剑指 Offer 27. 二叉树的镜像)
嵌入式实验二
自监督论文阅读笔记 TASK-RELATED SELF-SUPERVISED LEARNING FOR REMOTE SENSING IMAGE CHANGE DETECTION
解决Gradle Download缓慢的百种方法
ansible的安装和部署详细过程,配置清单基本操作
随机推荐
Kotlin 中的泛型介绍
NFT租赁提案EIP-5006步入最后审核!让海外大型游戏的链改成为可能
中国食品微生物检测行业深度监测及投资战略规划建议报告2022~2028年
中国聚氯乙烯(PVC)土工膜发展动态及投资前景预测报告2022~2028年
C# 数组之回溯法
arm64麒麟安装paddlehub(国产化)注意事项
自监督论文阅读笔记Index Your Position: A Novel Self-Supervised Learning Method for Remote Sensing Images Sema
Kettle 从资源库中载入新的转换出错(Invalid byte 1 of 1-byte UTF-8 sequence)
中国认证认可服务行业“十四五”发展规划及经营模式分析报告2022~2028年
经典论文-ResNet
SAP HANA 新增一列时报错详解
对象の使用
【HQL】(一)json字符串处理json_tuple和get_json_object
进程间通讯 (IPC 技术) - 信号
嵌入式实验四
Mysql 预准备语句详解(prepare、execute、deallocate)
联邦学习摘录
网络间通信
自监督论文阅读笔记 Self-supervised Learning in Remote Sensing: A Review
Leetcode刷题——128. 最长连续序列