Files
pages/2023/09/24/rpi-ubuntu.html
2025-12-31 16:00:29 +00:00

375 lines
28 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>在树莓派4B上安装Ubuntu以及各种操作 | Mayx的博客</title>
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="在树莓派4B上安装Ubuntu以及各种操作" />
<meta name="author" content="mayx" />
<meta property="og:locale" content="zh_CN" />
<meta name="description" content="明明在普通的电脑上也能完成这些操作……😥" />
<meta property="og:description" content="明明在普通的电脑上也能完成这些操作……😥" />
<meta property="og:site_name" content="Mayx的博客" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2023-09-24T00:00:00+08:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="在树莓派4B上安装Ubuntu以及各种操作" />
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
<meta name="yandex-verification" content="fc0e535abed800be" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2023-09-24T00:00:00+08:00","datePublished":"2023-09-24T00:00:00+08:00","description":"明明在普通的电脑上也能完成这些操作……😥","headline":"在树莓派4B上安装Ubuntu以及各种操作","mainEntityOfPage":{"@type":"WebPage","@id":"/2023/09/24/rpi-ubuntu.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2023/09/24/rpi-ubuntu.html"}</script>
<!-- End Jekyll SEO tag -->
<link rel="canonical" href="https://mabbs.github.io/2023/09/24/rpi-ubuntu.html" />
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
<link rel="stylesheet" href="/assets/css/style.css?v=1767196818" />
<!--[if !IE]> -->
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
<!-- <![endif]-->
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
<link rel="me" href="https://github.com/Mabbs" />
<script src="/assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
var lastUpdated = new Date("Thu, 01 Jan 2026 00:00:18 +0800");
var BlogAPI = "https://summary.mayx.eu.org";
</script>
<script src="/assets/js/main.js"></script>
<!--[if !IE]> -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-137710294-1');
</script>
<script src="/assets/js/instant.page.js" type="module"></script>
<!-- <![endif]-->
</head>
<body>
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript这不影响你的浏览但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer这不影响你的浏览但可能会有一些功能无法使用……</small></marquee><![endif]-->
<div class="wrapper">
<header class="h-card">
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
<p class="p-note">Mayx's Home Page</p>
<form action="/search.html">
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." />&#160;<input type="submit" value="搜索" />
</form>
<br />
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
<ul class="downloads">
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
</ul>
</header>
<section class="h-entry">
<small><time class="date dt-published" datetime="2023-09-24T00:00:00+08:00">24 September 2023</time> - 字数统计4134 - 阅读大约需要13分钟 - Hits: <span id="/2023/09/24/rpi-ubuntu.html" class="visitors">Loading...</span></small>
<h1 class="p-name">在树莓派4B上安装Ubuntu以及各种操作</h1>
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
<div id="outdate" style="display:none;">
<hr /><p>
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
</p>
</div>
<script>
daysold = Math.floor((new Date().getTime() - new Date("Sun, 24 Sep 2023 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
if (daysold > 90) {
document.getElementById("outdate").style.display = "block";
document.getElementById("outime").innerHTML = daysold;
}
</script>
<hr />
<b>AI摘要</b>
<p id="ai-output">这篇文章介绍了作者在树莓派4B上安装Ubuntu的经历。一开始尝试安装Windows 11并使用ESXi-Arm Fling遭遇问题如内存卡浪费和存储限制。由于对Windows的不满意作者决定安装Ubuntu过程中遇到了登录密码设置的困扰软件提示不明确。尽管如此最终成功安装了Ubuntu并编译并运行了PiFmAdv项目但初始遇到编译问题。作者还尝试了通过QEMU-KVM在树莓派上跑Windows虚拟机对比了与裸机的性能发现虚拟机表现不佳。此外虽然尝试让树莓派运行x86程序如postjson工具但由于性能受限效果并不理想。总结全文作者表示树莓派除了FM电台功能其他操作在普通电脑上也能完成质疑购买它的意义但也提到挖掘其潜力的过程满足了自己的探索欲望。</p>
<hr />
<ul><li><a href="#起因">起因</a></li><li><a href="#用树莓派整点什么">用树莓派整点什么</a><ul><li><a href="#整点fm电台">整点FM电台</a></li><li><a href="#整点大语言模型llama">整点大语言模型LLaMA</a></li><li><a href="#整点qemu-kvm-windows虚拟机">整点QEMU-KVM Windows虚拟机</a></li><li><a href="#让树莓派运行x86程序">让树莓派运行x86程序</a></li></ul></li><li><a href="#感想">感想</a></li></ul>
<hr />
<main class="post-content e-content" role="main"><p>明明在普通的电脑上也能完成这些操作……😥<!--more--></p>
<h1 id="起因">
<a href="#起因"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 起因
</h1>
<p>自从上次我给我的树莓派4B-8GiB内存版<a href="/2023/05/22/rpi-win.html">安装了Windows11</a>以后我感觉这个东西上是真的鸡肋速度慢而且兼容性还差指令集有缺失连很多需要用到加密库的软件都不能正常运行……后来我就重装了一个ESXi-Arm Fling但是装这个也有个问题就是它不能使用TF卡存储东西我还特地为了Windows买了个64GiB的TF卡结果装虚拟机还用不了😂U盘我也只有一个32GiB的ESXi-Arm Fling如果想要正常的存储配置信息就至少需要占用掉3*4GiB的空间这样虚拟机就只能使用20GiB的空间……真的全都是垃圾20GiB能开几个虚拟机啊开了也没啥能用的。所以这个树莓派就一直在吃灰。 </p><p>
后来我又想整点活想着干脆安装个Ubuntu好了反正放着也是吃灰也错过了最佳卖树莓派的机会就用起来吧安装Ubuntu的时候居然也是各种碰壁😓一开始我用树莓派镜像烧录器闭着眼睛直接选了Ubuntu Server系统我还以为它可以像安装树莓派系统那样第一次启动的时候让我设置密码结果烧录完之后引导就直接让登录了我连密码都不知道要怎么登录啊😥网上搜了一下有默认密码输进去之后显示需要让我更改密码结果这个需要更改的密码怎么设置都不能生效😰后来去Ubuntu官网看了一眼才知道原来需要在烧录中选择高级设置手动设置密码才行……网上这些教程都是垃圾这个软件也一样🤬啥提示都没有不看文档就只能靠猜了😢。 </p><p>
最后终于把Ubuntu安装好了可以开始整活了😁。</p>
<h1 id="用树莓派整点什么">
<a href="#用树莓派整点什么"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 用树莓派整点什么
</h1>
<h2 id="整点fm电台">
<a href="#整点fm电台"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 整点FM电台
</h2>
<p>安装好Ubuntu后我最先想干的事情还是整<a href="/2022/03/27/radio.html">FM电台</a>,毕竟这真的就是树莓派唯一和其他设备不一样的地方了啊,于是我就编译了一下<a href="https://github.com/miegl/PiFmAdv">PiFmAdv</a>并运行,结果不知道为什么一运行树莓派就直接死机……于是我退而求其次,选择了<a href="https://github.com/markondej/fm_transmitter">fm_transmitter</a>这个倒是能运行不过操作和树莓派3B区别相当大首先编译得要用<code class="language-plaintext highlighter-rouge">make GPIO21=1</code>然后杜邦线也要插到第40个接口具体如下图打x的位置</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>,--------------------------------.
| ooooooooooooooooooox J8 +======
| 1ooooooooooooooooooo PoE | Net
| Wi 1o +======
| Fi Pi Model 4B V1.4 oo |
| ,----. +---+ +====
| |D| |SoC | |RAM| |USB3
| |S| | | | | +====
| |I| `----' +---+ |
| |C| +====
| |S| |USB2
| pwr |hd| |hd| |I||A| +====
`-| |---|m0|---|m1|----|V|-------'
</code></pre></div></div>
<p>CPU和GPU也全部需要定频运行另外设置频率不能超过93 MHz……我调了半天才能正常运行……还有就是不像之前PiFmAdv那个项目可以使用立体声感觉树莓派4B还不如3B…… </p><p>
不过我写着写着感觉好像不太对劲看了一眼我上次写电台的那篇文章的时间比PiFmAdv最后一次更新还要早看了一眼提交发现人家已经把问题解决了难怪我运行不起来原来是代码没用最新的🤣刚刚更新了一下代码之后再运行已经没有任何问题了立体声啥的都能正常使用了。不过Makefile还是没改……aarch64的系统运行依然会出问题😥……其实改起来也很简单把Makefile里面的两个参数换成</p>
<pre><code class="language-Makefile"> CFLAGS = $(STD_CFLAGS) -march=armv8-a -ffast-math -DRASPI=4
TARGET = pi4
</code></pre>
<p>就可以正常编译了。</p>
<h2 id="整点大语言模型llama">
<a href="#整点大语言模型llama"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 整点大语言模型LLaMA
</h2>
<p>因为我的树莓派有8GiB内存之前我在我的8GiB内存的<a href="/2023/04/05/ai.html">MacBook Pro上跑LLaMA</a>都没问题那在树莓派上跑个LLaMA应该也没问题所以就想试试看。跑起来非常简单<a href="https://github.com/ggerganov/llama.cpp">llama.cpp</a>拉下来然后直接编译就行了但是实际跑起来速度非常慢大概1token要1-2秒……根本用不成不过现在的llama.cpp已经非常完善了支持各种各样的硬件加速无论是在我的MacBook上还是用N卡、A卡甚至手机使用OpenCL似乎都可以进行硬件加速。这些都能得到很不错的速度那树莓派呢树莓派用的好像是博通的叫什么VideoCore的显卡我搜了一下貌似没有办法使用OpenCL……不过搜的过程中发现似乎可以<a href="https://qengineering.eu/install-vulkan-on-raspberry-pi.html">装Vulkan</a>虽然llama.cpp不能使用Vulkan不过ncnn框架似乎可以使用Vulkan跑个waifu2x也算不浪费这个树莓派的GPU啊只是安了半天发现不连接屏幕貌似安了也识别不了……所以还是算了吧……</p>
<h2 id="整点qemu-kvm-windows虚拟机">
<a href="#整点qemu-kvm-windows虚拟机"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 整点QEMU-KVM Windows虚拟机
</h2>
<p>当时我在树莓派上安装Windows11的时候听说在虚拟机上运行的效果要比裸机安装效果更好我听到之后认为这是胡说八道哪有虚拟机比裸机运行效果好的啊不过树莓派嘛……说不定会有因为驱动不完整之类的情况毕竟如果是在虚拟机里安装系统外面的Linux系统可以使用无线网卡而直接安装Windows是不能使用无线网卡的所以这次我也打算试试看反正树莓派上使用虚拟机是可以使用KVM加速的所以试试也没关系。 </p><p>
安装QEMU也很简单直接执行</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>apt <span class="nb">install </span>qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virtinst virt-manager qemu-system-arm qemu-efi-aarch64 seabios vgabios
</code></pre></div></div>
<p>就可以了安装系统的话也很简单首先去下载Windows所需要的驱动<a href="https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/">virtio-win</a>然后下载Windows ARM版的安装光盘这个去MSDN I tell you下载就行了之后下载一个VNC客户端用来连接虚拟机的屏幕然后创建硬盘</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>qemu-img create <span class="nt">-f</span> vhdx <span class="nt">-o</span> <span class="nv">subformat</span><span class="o">=</span>fixed system.vhdx 30G
</code></pre></div></div>
<p>准备好这些以后就可以启动虚拟机了,启动的命令如下:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>qemu-system-aarch64 <span class="nt">-M</span> virt-2.12 <span class="nt">-smp</span> 4 <span class="nt">-m</span> 4G <span class="nt">-cpu</span> host <span class="nt">-enable-kvm</span> <span class="nt">-bios</span> /usr/share/qemu-efi-aarch64/QEMU_EFI.fd <span class="nt">-device</span> ramfb <span class="nt">-device</span> qemu-xhci,id<span class="o">=</span>xhci <span class="nt">-usb</span> <span class="nt">-device</span> usb-kbd <span class="nt">-device</span> usb-mouse <span class="nt">-device</span> usb-tablet <span class="nt">-k</span> en-us <span class="nt">-device</span> virtio-balloon <span class="nt">-device</span> virtio-rng <span class="nt">-device</span> virtio-blk,drive<span class="o">=</span>system <span class="nt">-drive</span> <span class="k">if</span><span class="o">=</span>none,id<span class="o">=</span>system,format<span class="o">=</span>raw,media<span class="o">=</span>disk,file<span class="o">=</span>system.vhdx <span class="nt">-device</span> usb-storage,drive<span class="o">=</span><span class="nb">install</span> <span class="nt">-drive</span> <span class="k">if</span><span class="o">=</span>none,id<span class="o">=</span><span class="nb">install</span>,format<span class="o">=</span>raw,media<span class="o">=</span>cdrom,file<span class="o">=</span>win10.iso <span class="nt">-device</span> usb-storage,drive<span class="o">=</span>drivers <span class="nt">-drive</span> <span class="k">if</span><span class="o">=</span>none,id<span class="o">=</span>drivers,media<span class="o">=</span>cdrom,file<span class="o">=</span>virtio-win.iso <span class="nt">-device</span> virtio-net,disable-legacy<span class="o">=</span>on,netdev<span class="o">=</span>net0 <span class="nt">-netdev</span> user,id<span class="o">=</span>net0,hostfwd<span class="o">=</span>tcp::3389-:3389 <span class="nt">-vnc</span> :1
</code></pre></div></div>
<p>然后就能像正常安装Windows系统那样安装了其中需要注意的一点是安装的时候会读不到硬盘需要加载光盘中的驱动其他缺失的驱动光盘里基本上都有直接安装就行。另外第一次重启前最好把<code class="language-plaintext highlighter-rouge">-device usb-storage,drive=install -drive if=none,id=install,format=raw,media=cdrom,file=win10.iso</code>删掉安装好之后可以打开远程桌面就可以直接使用树莓派的IP去连接Windows系统还能有完整的分辨率和音频支持。 </p><p>
既然装好了虚拟机那么我就应该验证一下虚拟机是不是真的比物理机安装效果更好了。具体怎么验证呢我又找了一个树莓派4B-4GiB内存版在上面安装直接安装同版本的Windows ARM版然后把两个树莓派的频率都调为1.8GHz在两个Windows系统上下载了7-Zip ARM版跑一遍基准测试结果裸机安装的总体评分为6.1GIPS左右虚拟机是5.1GIPS左右这很明显裸机还是更强嘛虚拟机唯一的优势就是可以用无线网络罢了说到网络我也测了一下这个速度在同样使用有线网络的情况下虚拟机因为用的是user模式效果很差连50Mbps都跑不到而裸机可以超过100Mbps。至于qemu怎么使用其他网络模式我也不太会整起来好像还挺麻烦的。总的来看树莓派安装QEMU-KVM运行Windows实在是不怎么样……一样是个垃圾。</p>
<h2 id="让树莓派运行x86程序">
<a href="#让树莓派运行x86程序"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 让树莓派运行x86程序
</h2>
<p>既然安装了QEMU那就该玩玩跨指令集的东西了当然跨指令集是没办法使用KVM了而且树莓派不像MacBook的Rosetta 2那样有硬件加速效果肯定会非常差不过我已经做好了觉悟还是想整个玩玩。怎么整呢非常简单只要运行</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>apt <span class="nb">install </span>qemu-user-binfmt
</code></pre></div></div>
<p>就好了那到底是什么软件让我想大费周章的让树莓派运行x86程序呢其实是一个叫做<a href="http://cdn.ouapi.com/postjson_linux.zip">postjson</a>的接口测试工具似乎是拿Go写的但是没有开源也没有ARM64的二进制文件所以就只好用QEMU啦试了一下还真能运行而且就像Rosetta 2那样直接当作原生的程序运行就可以效果挺不错不过CPU占用非常高一运行一个CPU核心就占满了😂也就是勉强能用的水平吧。</p>
<h1 id="感想">
<a href="#感想"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 感想
</h1>
<p>搞了这么多东西之后发现树莓派除了那个FM电台不能在普通电脑上操作其他不是和普通的电脑一样吗🤣那买树莓派还有什么意义不如买个二手手机不过有了树莓派就感觉越垃圾越想挖掘它的作用这可能就是它存在的意义吧🤣。</p></main>
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E6%A0%91%E8%8E%93%E6%B4%BE"><em>树莓派</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=Ubuntu"><em>Ubuntu</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2023-09-24-rpi-ubuntu.md">查看原始文件</a></span></small>
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
<p id="suggest-container">Loading...</p>
<script>
var suggest = $("#suggest-container");
$.get(BlogAPI + "/suggest?id=/2023/09/24/rpi-ubuntu.html&update=" + lastUpdated.valueOf(), function (data) {
if (data.length) {
getSearchJSON(function (search) {
suggest.empty();
var searchMap = {};
for (var i = 0; i < search.length; i++) {
searchMap[search[i].url] = search[i];
}
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
for (var j = 0; j < data.length; j++) {
var item = searchMap[data[j].id];
if (item) {
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
link.hover(
function(e) {
tooltip.text($(this).data('content'))
.css({
top: e.pageY + 10,
left: e.pageX + 10
})
.show();
},
function() {
tooltip.hide();
}
).mousemove(function(e) {
tooltip.css({
top: e.pageY + 10,
left: e.pageX + 10
});
}).data('content', contentPreview);
suggest.append(link);
suggest.append(' - ' + item.date + '<br />');
}
}
});
} else {
suggest.html("暂无推荐文章……");
}
});
</script>
<br />
<div class="pagination">
<span class="prev">
<a href="/2023/09/06/satellite.html">
上一篇:关于卫星通信的一些看法
</a>
</span>
<br />
<span class="next">
<a href="/2023/10/21/game.html">
下一篇在MacBook玩游戏的各种方法
</a>
</span>
</div>
<!--[if !IE]> -->
<link rel="stylesheet" href="/assets/css/gitalk.css">
<script src="/assets/js/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
var gitalk = new Gitalk({
clientID: '36557aec4c3cb04f7ac6',
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
repo: 'mabbs.github.io',
owner: 'Mabbs',
admin: ['Mabbs'],
id: '/2023/09/24/rpi-ubuntu', // Ensure uniqueness and length less than 50
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
})
gitalk.render('gitalk-container')
</script>
<!-- <![endif]-->
</section>
<!--[if !IE]> -->
<div id="landlord" style="left:5px;bottom:0px;">
<div class="message" style="opacity:0"></div>
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
<div class="live_talk_input_body">
<form id="live_talk_input_form">
<div class="live_talk_input_name_body" >
<input type="checkbox" id="load_this" />
<input type="hidden" id="post_id" value="/2023/09/24/rpi-ubuntu.html" />
<label for="load_this">
<span style="font-size: 11px; color: #fff;">&#160;想问这篇文章</span>
</label>
</div>
<div class="live_talk_input_text_body">
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
</div>
</form>
</div>
<input name="live_talk" id="live_talk" value="1" type="hidden" />
<div class="live_ico_box" style="display:none;">
<div class="live_ico_item type_info" id="showInfoBtn"></div>
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
<div class="live_ico_item type_music" id="musicButton"></div>
<div class="live_ico_item type_youdu" id="youduButton"></div>
<div class="live_ico_item type_quit" id="hideButton"></div>
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
<input id="duType" value="douqilai" type="hidden" />
</div>
</div>
<div id="open_live2d">召唤伊斯特瓦尔</div>
<!-- <![endif]-->
<footer>
<p>
<small>Made with ❤ by Mayx<br />Last updated at 2026-01-01 00:00:18<br /> 总字数614622 - 文章数178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
</p>
</footer>
</div>
<script src="/assets/js/scale.fix.js"></script>
<!--[if !IE]> -->
<script src="/assets/js/main_new.js"></script>
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
<script src="/Live2dHistoire/live2d/js/message.js"></script>
<!-- <![endif]-->
</body>
</html>