当前位置:网站首页>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
边栏推荐
猜你喜欢
自监督论文阅读笔记Efficient Self-supervised Vision Pretraining with Local Masked Reconstruction
Oracle 注释详解(--、/**/、rem)
【frp内网穿透】
IPC 通信 - IPC
自监督论文阅读笔记 TASK-RELATED SELF-SUPERVISED LEARNING FOR REMOTE SENSING IMAGE CHANGE DETECTION
优雅的拦截TabLayout的点击事件
梯度下降、反向传播
【源码解读】火爆的二舅币真的跑路了吗?
漫谈Map Reduce 参数优化
Kettle Spoon 安装配置详解
随机推荐
Browser multi-threaded off-screen rendering, compression and packaging scheme
Mysql 预准备语句详解(prepare、execute、deallocate)
softmax和最大熵
神经网络之感知机
经典论文-ResNet
EIP-5058 能否防止NFT项目方提桶跑路?
new / malloc / delete / free之间的区别
中国生物降解塑料行业市场运营态势及发展趋势研究报告2022~2028年
Sqli-labs-master shooting range 1-23 customs clearance detailed tutorial (basic)
Oracle null 有哪些注意事项【面试题】
Sqli-labs-master靶场1-23关通关详细教程(基础篇)
[XSS, file upload, file inclusion]
Qlik Sense 临时处理表数据详解(Resident)
ansible的安装和部署详细过程,配置清单基本操作
自监督论文阅读笔记Index Your Position: A Novel Self-Supervised Learning Method for Remote Sensing Images Sema
中国聚氯乙烯(PVC)土工膜发展动态及投资前景预测报告2022~2028年
【DC-5靶场渗透】
自监督论文阅读笔记Efficient Self-supervised Vision Pretraining with Local Masked Reconstruction
php连接数据库脚本
边缘辅助无人机网络的分层联邦学习