x86上运行LoongArch的环境

news/2025/2/6 0:05:50/

很多朋友只有x86的系统,因为我们上学时代和工作机大部分都x86系统。loongson推出LoongArch指令集后,也想尝尝鲜或者作为一个开发者又不想买新的机器,此时就可以用到我下边为大家介绍的方法。

此处也给大家提供一个debian社区发布的官方的文档:

debian社区发布:LoongArch/sbuildQEMU - Debian Wiki

也可以参考我为大家已经整理好的资料 GitHub - loongson-zn/qemu-debian

如果你翻墙困难,我将整理的readme粘贴到此处:

  • 宿主机环境

 架      构:x86_64

系统环境:debian bookworm 

具体操作步骤:

  • 安装qemu-user
root@debian:~# apt install binfmt-support
root@debian:~# apt build-dep qemu-user-static
root@debian:~# git clone https://github.com/qemu/qemu.git
root@debian:~# cd qemu
root@debian:~/qemu# ./configure --static --disable-system --target-list=loongarch64-linux-user
root@debian:~/qemu# make
root@debian:~/qemu# cp build/loongarch64-linux-user/qemu-loongarch64 /usr/bin/qemu-loongarch64-static
root@debian:~/qemu# cat >/tmp/qemu-loongarch64 <<EOF
package qemu-user-static
type magic
offset 0
magic \x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02\x01                    
mask \xff\xff\xff\xff\xff\xff\xff\xfc\x00\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff
interpreter /usr/bin/qemu-loongarch64-static
EOFroot@debian:~/qemu# update-binfmts --import /tmp/qemu-loongarch64 
  • 制作LA最小镜像
root@debian:~# apt install debootstrap sbuild debian-ports-archive-keyring
root@debian:~# debootstrap --foreign --arch=loong64 --variant=buildd --include=debian-ports-archive-keyring --verbose --components=main --keyring=/etc/apt/trusted.gpg.d/debian-ports-archive-2023.gpg --resolve-deps --extra-suites=unreleased unstable /srv/chroots/sid-loong64-sbuild/ http://ftp.ports.debian.org/debian-ports
root@debian:~# cd /srv/chroots/sid-loong64-sbuild/
root@debian:/srv/chroots/sid-loong64-sbuild# cp /usr/bin/qemu-loongarch64-static usr/bin/
root@debian:/srv/chroots/sid-loong64-sbuild# chroot .
I have no name!@loongson01:/# /debootstrap/debootstrap --second-stage
  • 准备gcc编译器(我提供的gcc及qemu是支持lasx及lsx向量的,如果不需要,用debian仓库安装即可)
git clone https://github.com/loongson-zn/qemu-debian.git
cd qemu-debian/gcc_13.2.0-7.1_nodbg
apt install ./*
apt install gcc gfortran
mount -t proc proc proc
mount -t sysfs sys sys
mount -t devtmpfs dev dev 
mount -t devpts devpts dev/pts 
mount -t tmpfs shmfs dev/shm

写这篇博客是在2023.12.15,LA还处于正在推进debian社区 的阶段,此时的地址为:

#root@loongson01:~# cat /srv/chroots/sid-loong64-sbuild/etc/apt/sources.list     
# binary default
deb http://ftp.ports.debian.org/debian-ports unstable main 
deb http://ftp.ports.debian.org/debian-ports unreleased main


http://www.ppmy.cn/news/1271346.html

相关文章

飞天使-docker知识点7-docker-compose与namespaces

文章目录 docker-composenamespace与cgroup编辑中 docker-compose # cat docker-compose.yml version: 3.8 services:nginx-server:image: nginxcontainer_name: nginx-web1 # network_mode: bridge #网络1&#xff0c;使用docker安装后的默认网桥expose:- 80- 443ports:-…

稚晖君创业公司智元机器人再融资,金额超 6 亿元,投前估值 35 亿元

近期&#xff0c;创业公司智元机器人成功完成最新一轮A3融资。此次融资由多家知名投资机构共同参与&#xff0c;包括蓝驰创投、中科创星、鼎晖投资、长飞基金、C资本、高瓴创投、立景创新、三花控股集团、基石资本、临港新片区基金和银杏谷资本。据悉&#xff0c;本轮融资前估值…

Python移动未标注的图片数据集

Python移动未标注的图片数据集 前言前提条件相关介绍实验环境Python移动未标注的图片数据集情况一&#xff1a;有图&#xff0c;无标注文件代码实现输出结果 情况二&#xff1a;有图&#xff0c;有标注文件&#xff0c;但标注信息为空代码实现输出结果 情况一与情况二同时都考虑…

探索Linux服务器配置信息的命令

目录 前言1 uname2 lscpu3 free4 df5 lspci6 lsusb7 lshw结语 前言 Linux系统提供了许多命令&#xff0c;用于获取和查看服务器的软硬件配置信息。这些命令可以帮助管理员和用户了解系统的状态、资源使用情况以及硬件设备的相关信息。以下是一些常用的命令以及它们的作用、使用…

vue中实现PDF文件流预览

代码示例 <template><div class"print"><div v-if"!viewShow" class"opt-box"><div style"height: 700px; overflow: auto;"><el-table :data"tableData" border><el-table-column prop…

Python轴承故障诊断 (七)基于EMD-CNN-LSTM的故障分类

目录 前言 1 经验模态分解EMD的Python示例 2 轴承故障数据的预处理 2.1 导入数据 2.2 制作数据集和对应标签 2.3 故障数据的EMD分解可视化 2.4 故障数据的EMD分解预处理 3 基于EMD-CNN-LSTM的轴承故障诊断分类 3.1 训练数据、测试数据分组&#xff0c;数据分batch 3.…

怎么选择合适的3ds Max云渲染农场?

3ds Max 用户日常面临的一个共同挑战便是漫长的渲染周期。作为一个强大的三维建模和渲染软件&#xff0c;3ds Max 势必需处理大量的光照、材质和阴影计算任务&#xff0c;因此&#xff0c;良好的渲染方案对从业者而言尤为重口。 一、为何考虑3ds Max云渲染? 云渲染成为了解决…

第七章 SpringCloud Alibaba 实现微服务集成Sentinel

什么是Sentinel Sentinel (分布式系统的流量防卫兵) 是阿里开源的一套用于服务容错的综合性解决方案。它以流量 为切入点, 从流量控制、熔断降级、系统负载保护等多个维度来保护服务的稳定性。 Sentinel 具有以下特征: 丰富的应用场景&#xff1a;Sentinel 承接了阿里巴巴近 …