<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>arm64 &#8211; richliu&#039;s blog</title>
	<atom:link href="https://blog.richliu.com/tag/arm64/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.richliu.com</link>
	<description>Linux, 工作, 生活, 家人</description>
	<lastBuildDate>Mon, 10 Feb 2025 14:46:18 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>
	<item>
		<title>Ragflow on ARM64</title>
		<link>https://blog.richliu.com/2025/02/10/6176/ragflow-on-arm64/</link>
					<comments>https://blog.richliu.com/2025/02/10/6176/ragflow-on-arm64/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Mon, 10 Feb 2025 14:46:17 +0000</pubDate>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[Ampere]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[DeepSeek]]></category>
		<category><![CDATA[Ragflow]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=6176</guid>

					<description><![CDATA[<p>RAGFlow is an open-source RAG (Retrieval-Augmented Gene [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2025/02/10/6176/ragflow-on-arm64/">Ragflow on ARM64</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p><a href="https://ragflow.io/" target="_blank" rel="noopener"><strong>RAGFlow</strong></a> is an open-source RAG (Retrieval-Augmented Generation) engine built on deep document understanding. It is very easy to use and install. However, RAGFlow does not officially support the ARM64 platform, so it needs to be built from source for deployment on ARM64 systems.</p>



<span id="more-6176"></span>



<p>In this article, I will skip other steps such as installing Ollama.</p>



<p><strong>System Specifications:</strong></p>



<ul class="wp-block-list">
<li><strong>OS:</strong> Ubuntu 22.04 on an ARM64 virtual machine</li>



<li><strong>CPU:</strong> Ampere Altra</li>



<li><strong>DRAM:</strong> 32GB (allocated to the VM, though smaller models do not require this much memory)</li>
</ul>



<p>At the time of writing, Infinity does not support the ARM64 platform, but that is not an issue since we do not need it. RAGFlow uses Elasticsearch as its default AI database engine, and Elasticsearch does support the ARM64 platform.</p>



<h2 class="wp-block-heading">Building RAGFlow on ARM64</h2>



<p>Build ragflow command [ref. <a href="https://ragflow.io/docs/dev/build_docker_image" target="_blank" rel="noopener">Build a RAGFlow Docker Image</a>]</p>



<pre class="wp-block-preformatted">git clone https://github.com/infiniflow/ragflow.git<br />cd ragflow/<br />docker build --build-arg LIGHTEN=1 -f Dockerfile -t &lt;username&gt;/ragflow:&lt;version&gt; .<br /><br />docker build --build-arg LIGHTEN=1 -f Dockerfile -t user/ragflow:v0.16.0 .</pre>



<p>If everything is set up correctly, the Docker images will display an output similar to the following:</p>



<pre class="wp-block-preformatted">docker images<br />REPOSITORY                                      TAG                            IMAGE ID       CREATED         SIZE<br />user/ragflow                                    v0.16.0                        8a71ac9cb2fa   3 hours ago     5.73GB</pre>



<p>Note that this image does not include pre-built models. However, models can be installed separately using other methods.</p>



<h2 class="wp-block-heading">Running RAGFlow</h2>



<p>Before running the <code><strong>docker-compose</strong></code> command, assign the RAGFlow Docker image name to the <code><strong>docker-compose</strong></code> configuration.</p>



<pre class="wp-block-preformatted">export RAGFLOW_IMAGE=user/ragflow:v0.16.0<br />docker compose -f docker/docker-compose.yml up -d</pre>



<p>If everything is set up correctly, you should see a message similar to the following:</p>



<pre class="wp-block-preformatted">[+] Running 10/10<br /> <img src="https://s.w.org/images/core/emoji/15.0.3/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Network docker_ragflow      Created                                                                         0.2s<br /> <img src="https://s.w.org/images/core/emoji/15.0.3/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Volume "docker_minio_data"  Created                                                                         0.0s<br /> <img src="https://s.w.org/images/core/emoji/15.0.3/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Volume "docker_redis_data"  Created                                                                         0.0s<br /> <img src="https://s.w.org/images/core/emoji/15.0.3/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Volume "docker_esdata01"    Created                                                                         0.0s<br /> <img src="https://s.w.org/images/core/emoji/15.0.3/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Volume "docker_mysql_data"  Created                                                                         0.0s<br /> <img src="https://s.w.org/images/core/emoji/15.0.3/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Container ragflow-mysql     Healthy                                                                        21.7s<br /> <img src="https://s.w.org/images/core/emoji/15.0.3/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Container ragflow-minio     Started                                                                         1.1s<br /> <img src="https://s.w.org/images/core/emoji/15.0.3/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Container ragflow-redis     Started                                                                         1.1s<br /> <img src="https://s.w.org/images/core/emoji/15.0.3/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Container ragflow-es-01     Started                                                                         1.1s<br /> <img src="https://s.w.org/images/core/emoji/15.0.3/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Container ragflow-server    Started                                                                        22.3s<br /></pre>



<p>Downloading Models with Ollama</p>



<p>Ollama needs to download certain models for system functionality. Here’s an easy way to download the models—you can choose the ones you prefer.</p>



<pre class="wp-block-preformatted">ollama pull deepseek-r1:14b<br />ollama pull deepseek-r1:32b<br />ollama pull smartcreation/bge-large-zh-v1.5:latest</pre>



<p>After downloading the Ollama models, you need to add them in the <strong>&#8220;USER → Model Providers → Add Ollama Model&#8221;</strong> section. Below is an example of how to add the Deepseek model. Once you understand the process, you can add more models as needed.</p>



<p>At a minimum, you will need one chat model and one embedding model.</p>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="764" height="913" src="https://blog.richliu.com/wp-content/uploads/2025/02/image-1.png" alt="" class="wp-image-6177" srcset="https://blog.richliu.com/wp-content/uploads/2025/02/image-1.png 764w, https://blog.richliu.com/wp-content/uploads/2025/02/image-1-502x600.png 502w" sizes="(max-width: 764px) 100vw, 764px" /></figure>



<p>After pressing <strong>OK</strong>, you can configure the <strong>System Model Settings</strong>, which should look something like this:</p>



<figure class="wp-block-image size-full"><img decoding="async" width="761" height="933" src="https://blog.richliu.com/wp-content/uploads/2025/02/image-2.png" alt="" class="wp-image-6178" srcset="https://blog.richliu.com/wp-content/uploads/2025/02/image-2.png 761w, https://blog.richliu.com/wp-content/uploads/2025/02/image-2-489x600.png 489w" sizes="(max-width: 761px) 100vw, 761px" /></figure>



<p>Using RAGFlow</p>



<p>Now, you are ready to use the&nbsp;<strong>Knowledge Base</strong>&nbsp;and&nbsp;<strong>Chat</strong>&nbsp;features to explore RAGFlow.</p>



<p>For example, you can ask the engine to generate an ARM SIMD sample code based on the ARMv8 documentation.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1742" height="1021" src="https://blog.richliu.com/wp-content/uploads/2025/02/image-3.png" alt="" class="wp-image-6179" srcset="https://blog.richliu.com/wp-content/uploads/2025/02/image-3.png 1742w, https://blog.richliu.com/wp-content/uploads/2025/02/image-3-600x352.png 600w, https://blog.richliu.com/wp-content/uploads/2025/02/image-3-768x450.png 768w, https://blog.richliu.com/wp-content/uploads/2025/02/image-3-1536x900.png 1536w, https://blog.richliu.com/wp-content/uploads/2025/02/image-3-816x478.png 816w" sizes="(max-width: 1742px) 100vw, 1742px" /></figure>



<p>Conclusion</p>



<p>RAGFlow is an easy-to-use RAG framework. Although it does not provide a default ARM64 image, you can still build it from source to obtain a functional version of RAGFlow.</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2025/02/10/6176/ragflow-on-arm64/">Ragflow on ARM64</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2025/02/10/6176/ragflow-on-arm64/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Gentoo ARM64 Altra Compile chromium Issue</title>
		<link>https://blog.richliu.com/2024/10/10/6052/gentoo-arm64-altra-compile-chromium-issue/</link>
					<comments>https://blog.richliu.com/2024/10/10/6052/gentoo-arm64-altra-compile-chromium-issue/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 09 Oct 2024 17:22:12 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[aarch64]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[AltraMax]]></category>
		<category><![CDATA[Ampere]]></category>
		<category><![CDATA[arm64]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=6052</guid>

					<description><![CDATA[<p>When compile the chromium on my Altra platform, it meet [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2024/10/10/6052/gentoo-arm64-altra-compile-chromium-issue/">Gentoo ARM64 Altra Compile chromium Issue</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>When compile the chromium on my Altra platform, it meet compile problem like this</p>



<span id="more-6052"></span>



<pre class="wp-block-preformatted">no-dangling-assignment-gsl -std=c++20 -Wno-trigraphs -gsimple-template-names -fno-exceptio00:01:51 [472/19443]
nc++ -isystem../../third_party/libc++/src/include -isystem../../third_party/libc++abi/src/include -fvisibility
-inlines-hidden -O2 -pipe -march=armv8.2-a -Wno-unknown-warning-option -c ../../third_party/libyuv/source/comp
are_neon64.cc -o obj/third_party/libyuv/libyuv_neon/compare_neon64.o
../../third_party/libyuv/source/compare_neon64.cc:175:8: error: instruction requires: dotprod
  175 |       "udot        v4.4s, v0.16b, v6.16b         \n"
      |        ^
&lt;inline asm>:14:1: note: instantiated into assembly here
   14 | udot        v4.4s, v0.16b, v6.16b
      | ^
../../third_party/libyuv/source/compare_neon64.cc:176:8: error: instruction requires: dotprod
  176 |       "udot        v5.4s, v1.16b, v6.16b         \n"
      |        ^
&lt;inline asm>:15:1: note: instantiated into assembly here
   15 | udot        v5.4s, v1.16b, v6.16b
      | ^
../../third_party/libyuv/source/compare_neon64.cc:204:8: error: instruction requires: dotprod
  204 |       "udot        v4.4s, v0.16b, v0.16b         \n"
      |        ^
&lt;inline asm>:10:1: note: instantiated into assembly here
   10 | udot        v4.4s, v0.16b, v0.16b
      | ^
../../third_party/libyuv/source/compare_neon64.cc:205:8: error: instruction requires: dotprod
  205 |       "udot        v5.4s, v1.16b, v1.16b         \n"
      |        ^
&lt;inline asm>:11:1: note: instantiated into assembly here
   11 | udot        v5.4s, v1.16b, v1.16b
      | ^
4 errors generated.
[10940/63891] aarch64-unknown-linux-gnu-clang++-18 -MD -MF obj/third_party/libyuv/libyuv_neon/rotate_neon.o.d</pre>



<p>Seems because some -march/-mcpu/-mtune drop &#8216;dotprod&#8217; parameters, it needs to add the extension manuall. &#8216;+dotprod&#8217;.</p>



<p>Edit the file /etc/portage/make.conf, and change the COMMON_FLAGS to </p>



<pre class="wp-block-preformatted">COMMON_FLAGS="-mcpu=neoverse-n1+crc+crypto+ssbs+dotprod -O2 -pipe"</pre>



<p>It can use the following command to get current CPU flag</p>



<pre class="wp-block-preformatted">gcc -v -E -x c /dev/null -o /dev/null -march=native -mcpu=native 2>&amp;1 | grep /cc1</pre>



<p>Thanks Gentoo user zukunf to provide those information. </p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2024/10/10/6052/gentoo-arm64-altra-compile-chromium-issue/">Gentoo ARM64 Altra Compile chromium Issue</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2024/10/10/6052/gentoo-arm64-altra-compile-chromium-issue/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>LLM Chat WebGUI and Fine-Turning on Ampere Altra ARM64 Platform</title>
		<link>https://blog.richliu.com/2024/03/10/5852/llm-chat-webgui-and-fine-turning-on-ampere-altra-arm64-platform/</link>
					<comments>https://blog.richliu.com/2024/03/10/5852/llm-chat-webgui-and-fine-turning-on-ampere-altra-arm64-platform/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sun, 10 Mar 2024 07:30:53 +0000</pubDate>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[aarch64]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[Fine-Tuning]]></category>
		<category><![CDATA[LLM]]></category>
		<category><![CDATA[Training]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=5852</guid>

					<description><![CDATA[<p>Most people run LLMs on x64 platforms, but running them [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2024/03/10/5852/llm-chat-webgui-and-fine-turning-on-ampere-altra-arm64-platform/">LLM Chat WebGUI and Fine-Turning on Ampere Altra ARM64 Platform</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Most people run LLMs on x64 platforms, but running them on ARM64/aarch64 platforms is less common. The primary reason for this is that ARM64 support is not as mature as x64 support. Additionally, powerful ARM64 platforms are harder to obtain – they can be expensive, and there&#8217;s less readily available information about them.</p>



<p>Qualcomm&#8217;s new desktop SoCs might change this landscape. However, we can still leverage the Ampere Altra platform to run LLMs.</p>



<p>Since this is a personal blog, most articles here are my personal notes. I&#8217;ll keep them updated as my understanding evolves.</p>



<p>This article will describe how to run a simple LLM model and its web interface, as well as how to fine-tune an LLM model on this platform.</p>



<span id="more-5852"></span>



<div class="wp-block-rank-math-toc-block" id="rank-math-toc"><h2>Table of Contents</h2><nav><ul><li><a href="#use-current-llm-model-with-gui">Use current LLM model with GUI</a><ul><li><a href="#big-llm">Big LLM </a></li></ul></li><li><a href="#open-webui">Open-Webui</a></li><li><a href="#llm-fine-turning-l-la-ma-factory">LLM Fine-Turning &#8211; LLaMA-Factory </a><ul><li><a href="#pre-training">Pre-Training</a></li><li><a href="#evaluate-predict">Evaluate &amp; Predict </a></li><li><a href="#test-chat-model">Test Chat Model</a></li><li><a href="#export-model">Export model</a></li></ul></li></ul></nav></div>



<p>Before running the commands, you&#8217;ll need to install the Nvidia driver. Refer to this article, &#8220;[<a href="https://blog.richliu.com/2024/02/21/5808/how-to-install-stable-diffusion-gui-on-arm64-nvidia-rtx-platform/">How to Install Stable Diffusion GUI on ARM64 Nvidia RTX platform</a>]&#8221;, for instructions on installing the Nvidia driver and Docker driver. </p>



<p>Ollama and Open-Webui don&#8217;t require a GPU. However, having a GPU is beneficial. Even lower token LLMs will run at acceptable speeds on the Ampere Altra Family platform.</p>



<p>This article&#8217;s hardware setup is as follows:</p>



<ul class="wp-block-list">
<li>CPU : Ampere Altra Family </li>



<li>Board: AsRock ALTRAD8UD </li>



<li>GPU: Nvidia RTX 4080</li>
</ul>



<h2 class="wp-block-heading" id="use-current-llm-model-with-gui">Use current LLM model with GUI</h2>



<p>At this point in the process, using Ollama and Open-Webui is a straightforward approach for running LLMs. Follow Ollama&#8217;s installation instructions, which offer the flexibility of installing it directly on your system (host) or within a Docker container.</p>



<pre class="wp-block-preformatted">curl -fsSL https://ollama.com/install.sh | sh</pre>



<p>By default, the Ollama service listens on localhost (127.0.0.1). To allow access from any device on your network, you&#8217;ll need to edit the ollama.service file.</p>



<p>In the [Service] section, add the following line:</p>



<pre class="wp-block-preformatted">Environment="OLLAMA_HOST=0.0.0.0:11434"</pre>



<p>For Open-Webui, we recommend using Docker for a simpler solution. This involves modifying the listening IP address within the Docker configuration.</p>



<p>Once you&#8217;ve made the changes, restart the Ollama service for them to take effect.</p>



<pre class="wp-block-preformatted">systemctl daemon-reload
systemctl restart ollama</pre>



<p>Run the ollama command and try it</p>



<pre class="wp-block-preformatted"># ollama run llama2
&gt;&gt;&gt; who are you

I'm LLaMA, an AI assistant developed by Meta AI that can understand and respond to human input in a conversational manner.
I'm here to help you with any questions or topics you'd like to discuss! Is there something specific you'd like to talk
about or ask?

&gt;&gt;&gt; </pre>



<p>If doesn&#8217;t work, try to restart ollama and try again. </p>



<h3 class="wp-block-heading" id="big-llm">Big LLM </h3>



<p>If choose some big LLM like LLaMA2-70b or Qwen </p>



<h2 class="wp-block-heading" id="open-webui">Open-Webui</h2>



<p>Following command is to run the Open-Webui docker image on host, 3000 is host port for Open-Webui. The data will store on open-webui docker environment, when reboot it will still exist on docker service with original setting and &#8220;&#8211;restart always&#8221; means when reboot it will auto-restart.</p>



<pre class="wp-block-preformatted">docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main</pre>



<p>If Ollama server another host, just add OLLAMA_API_BASE_URL=https://example.com/api to the docker command, </p>



<pre class="wp-block-preformatted">docker run -d -p 3000:8080 -e OLLAMA_API_BASE_URL=https://example.com/api -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main</pre>



<p>Upon login, you&#8217;ll need to provide an email and password. Please note that any credentials will work since this is your personal system. Once logged in, you can also edit the OLLAMA_API_BASE on the settings page.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1307" height="875" src="https://blog.richliu.com/wp-content/uploads/2024/03/image.png" alt="" class="wp-image-5853" srcset="https://blog.richliu.com/wp-content/uploads/2024/03/image.png 1307w, https://blog.richliu.com/wp-content/uploads/2024/03/image-600x402.png 600w, https://blog.richliu.com/wp-content/uploads/2024/03/image-768x514.png 768w, https://blog.richliu.com/wp-content/uploads/2024/03/image-816x546.png 816w" sizes="(max-width: 1307px) 100vw, 1307px" /></figure>



<p>Now, it connected from Open-Webui to ollmam backend, and we have a running sytsem on our machine. <br />Run sample chat here and choice llama2:latest as LLM model. </p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2205" height="761" src="https://blog.richliu.com/wp-content/uploads/2024/03/image-1.png" alt="" class="wp-image-5854" srcset="https://blog.richliu.com/wp-content/uploads/2024/03/image-1.png 2205w, https://blog.richliu.com/wp-content/uploads/2024/03/image-1-600x207.png 600w, https://blog.richliu.com/wp-content/uploads/2024/03/image-1-768x265.png 768w, https://blog.richliu.com/wp-content/uploads/2024/03/image-1-1536x530.png 1536w, https://blog.richliu.com/wp-content/uploads/2024/03/image-1-2048x707.png 2048w, https://blog.richliu.com/wp-content/uploads/2024/03/image-1-816x282.png 816w" sizes="(max-width: 2205px) 100vw, 2205px" /></figure>



<p></p>



<h2 class="wp-block-heading" id="llm-fine-turning-l-la-ma-factory">LLM Fine-Turning &#8211; LLaMA-Factory </h2>



<p>Fine-tuning LLMs ideally requires a GPU card for better performance. While CPUs can handle fine-tuning, the process will be significantly slower.</p>



<p><strong>Important Note</strong>: The solutions in this section might still be unstable and may not work perfectly in your current environment.</p>



<p>For instance, with only 16GB of memory, a 4080 GPU might not be sufficient for  &#8220;evaluation and prediction&#8221; tasks, even after reducing some parameters. This still can lead to CUDA out-of-memory errors.</p>



<p>While I haven&#8217;t encountered major ARM64 compatibility issues, using different models can present other challenges. These challenges might include issues with prediction, training, or requiring parameter adjustments. Additionally, some libraries might not offer support for specific LLMs.</p>



<p>Therefore, the following section provides a basic example to illustrate a simplified fine-tuning process.</p>



<p>For fine-tuning solutions, we&#8217;ve chosen <a href="https://github.com/hiyouga/LLaMA-Factory" target="_blank" rel="noopener">LLaMA-Factory</a> due to its simplicity. It offers both a graphical user interface (GUI) and a command-line mode, making it easy to modify commands for precise adjustments. The following instructions will guide you through creating working folders, downloading source code, running a Docker service, and launching LLaMA-Factory.</p>



<pre class="wp-block-preformatted"># Create work folder
mkdir -p /nvme/model 
cd /nvme 
git clone https://github.com/hiyouga/LLaMA-Factory.git

# Run docker, it will use host GPU and map the folder into docker.
sudo docker run --gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 -it --rm \
     -v /nvme:/nvme \
     -p 7860:7860 \
     nvcr.io/nvidia/pytorch:24.01-py3

# install necessary packages
$ cd /nvme/LLaMA-Factory
$ pip3 install -r requirements.txt
$ pip3 install tiktoken transformers_stream_generator

# run the LLaMA-Factory
$ CUDA_VISIBLE_DEVICES=0 python src/train_web.py</pre>



<p>Now, it can acces the webgui via http://host IP:7860.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1506" height="857" src="https://blog.richliu.com/wp-content/uploads/2024/03/image-2.png" alt="" class="wp-image-5855" srcset="https://blog.richliu.com/wp-content/uploads/2024/03/image-2.png 1506w, https://blog.richliu.com/wp-content/uploads/2024/03/image-2-600x341.png 600w, https://blog.richliu.com/wp-content/uploads/2024/03/image-2-768x437.png 768w, https://blog.richliu.com/wp-content/uploads/2024/03/image-2-816x464.png 816w" sizes="(max-width: 1506px) 100vw, 1506px" /></figure>



<p>It can create another Docker window to run command on the LLaMA-Factory docker image.</p>



<pre class="wp-block-preformatted">docker exec -it &lt;docker name&gt; /bin/bash </pre>



<p>for download LLMs, you need to use git download from huggingface, ex: </p>



<pre class="wp-block-preformatted"># LLama 2 need username and token(not passowrd) to download it. 
git clone https://huggingface.co/meta-llama/Llama-2-7b-hf

# Qwen
git clone https://huggingface.co/Qwen/Qwen1.5-1.8B-Chat
git clone https://huggingface.co/Qwen/Qwen1.5-1.8B</pre>



<h3 class="wp-block-heading" id="pre-training">Pre-Training</h3>



<p>Model name, choice the LLMs name , like Qwen1.5-1.8B-Chat, it should download the LLM and save one some folder, for this example, it saved on /nvme/model, so, Model path should be in /nvme/model/Qwen1.5-1.8B-Chat. </p>



<p>First time, I suggest to use small LLM for fine-tuning, Qweb1.5-0.8B might have issue, will suggest from 1.5-1.8B to start. </p>



<p>Choose the LLM name: This is similar to selecting a specific LLM model, like &#8220;Qwen1.5-1.8B-Chat&#8221;. The instructions will indicate your LLM folder. For this example, the model would be saved in /nvme/model/Qwen1.5-1.8B-Chat.</p>



<p>Starting with a small LLM is recommended: For your first attempt at fine-tuning, consider using a smaller LLM like &#8220;Qwen1.5-1.8B&#8221;. It&#8217;s possible that &#8220;Qweb1.5-0.8B&#8221; might cause issues, so we recommend starting with models in the 1.5-1.8B range.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1822" height="1206" src="https://blog.richliu.com/wp-content/uploads/2024/03/image-3.png" alt="" class="wp-image-5856" srcset="https://blog.richliu.com/wp-content/uploads/2024/03/image-3.png 1822w, https://blog.richliu.com/wp-content/uploads/2024/03/image-3-600x397.png 600w, https://blog.richliu.com/wp-content/uploads/2024/03/image-3-768x508.png 768w, https://blog.richliu.com/wp-content/uploads/2024/03/image-3-1536x1017.png 1536w, https://blog.richliu.com/wp-content/uploads/2024/03/image-3-816x540.png 816w" sizes="(max-width: 1822px) 100vw, 1822px" /></figure>



<p>Here are the fine-tuning options you can adjust in LLaMA-Factory:</p>



<p><strong>Dataset</strong>: You can add datasets to this mode. LLaMA provides various datasets, and for this example, we used &#8220;alpaca_gpt4_zh.&#8221;<br /><strong>Gradient accumulation</strong>: This is currently set to 4.<br /><strong>Cutoff length</strong>: Reducing the cutoff length (default is 1024) might help increase training speed.<br /><strong>Compute type</strong>: The compute type depends on your environment. In this case, fp16 works, but bp16 doesn&#8217;t sometimes.<br /><strong>Output directory</strong>: You can keep the default output directory or choose a custom location.<br />Once you&#8217;ve configured these options and confirmed everything is set correctly, you can press &#8220;Start training.&#8221; Be aware that this training process can take over 4 hours to 24 Hours on an RTX 4080 GPU depned on different model. </p>



<h3 class="wp-block-heading" id="evaluate-predict">Evaluate &amp; Predict </h3>



<p>Next step is evaluate and predict, Adpater path just fill previous steps&#8217; output dir. Dataset is the same. </p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2059" height="1207" src="https://blog.richliu.com/wp-content/uploads/2024/03/image-4.png" alt="" class="wp-image-5857" srcset="https://blog.richliu.com/wp-content/uploads/2024/03/image-4.png 2059w, https://blog.richliu.com/wp-content/uploads/2024/03/image-4-600x352.png 600w, https://blog.richliu.com/wp-content/uploads/2024/03/image-4-768x450.png 768w, https://blog.richliu.com/wp-content/uploads/2024/03/image-4-1536x900.png 1536w, https://blog.richliu.com/wp-content/uploads/2024/03/image-4-2048x1201.png 2048w, https://blog.richliu.com/wp-content/uploads/2024/03/image-4-816x478.png 816w" sizes="(max-width: 2059px) 100vw, 2059px" /></figure>



<p>When everything is ready, press Start. Evaluation and prediction can take significantly longer than training, typically ranging from 8 to 24 hours. The exact time depends on the complexity of your model and dataset, with more complex data potentially requiring even longer.</p>



<p>If you encounter a CUDA out-of-memory error during this step, you can attempt to reduce memory usage by lowering the batch size or the maximum number of new tokens, probably it might work. [<a href="https://github.com/hiyouga/LLaMA-Factory/issues/1191" target="_blank" rel="noopener">ref</a>]</p>



<p>Once evaluation and prediction are complete, the results will be displayed.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2008" height="304" src="https://blog.richliu.com/wp-content/uploads/2024/03/image-5.png" alt="" class="wp-image-5858" srcset="https://blog.richliu.com/wp-content/uploads/2024/03/image-5.png 2008w, https://blog.richliu.com/wp-content/uploads/2024/03/image-5-600x91.png 600w, https://blog.richliu.com/wp-content/uploads/2024/03/image-5-768x116.png 768w, https://blog.richliu.com/wp-content/uploads/2024/03/image-5-1536x233.png 1536w, https://blog.richliu.com/wp-content/uploads/2024/03/image-5-816x124.png 816w" sizes="(max-width: 2008px) 100vw, 2008px" /></figure>



<h3 class="wp-block-heading" id="test-chat-model">Test Chat Model</h3>



<p>You can test chat result by load module. </p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2077" height="1043" src="https://blog.richliu.com/wp-content/uploads/2024/03/image-6.png" alt="" class="wp-image-5859" srcset="https://blog.richliu.com/wp-content/uploads/2024/03/image-6.png 2077w, https://blog.richliu.com/wp-content/uploads/2024/03/image-6-600x301.png 600w, https://blog.richliu.com/wp-content/uploads/2024/03/image-6-768x386.png 768w, https://blog.richliu.com/wp-content/uploads/2024/03/image-6-1536x771.png 1536w, https://blog.richliu.com/wp-content/uploads/2024/03/image-6-2048x1028.png 2048w, https://blog.richliu.com/wp-content/uploads/2024/03/image-6-816x410.png 816w, https://blog.richliu.com/wp-content/uploads/2024/03/image-6-400x200.png 400w" sizes="(max-width: 2077px) 100vw, 2077px" /></figure>



<h3 class="wp-block-heading" id="export-model">Export model</h3>



<p>Remember to fill export dir, in here I used &#8220;/nvme/newmodel/Qwen1.5-1.8B-Chat&#8221;</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2077" height="1030" src="https://blog.richliu.com/wp-content/uploads/2024/03/image-7.png" alt="" class="wp-image-5860" srcset="https://blog.richliu.com/wp-content/uploads/2024/03/image-7.png 2077w, https://blog.richliu.com/wp-content/uploads/2024/03/image-7-600x298.png 600w, https://blog.richliu.com/wp-content/uploads/2024/03/image-7-768x381.png 768w, https://blog.richliu.com/wp-content/uploads/2024/03/image-7-1536x762.png 1536w, https://blog.richliu.com/wp-content/uploads/2024/03/image-7-2048x1016.png 2048w, https://blog.richliu.com/wp-content/uploads/2024/03/image-7-816x405.png 816w" sizes="(max-width: 2077px) 100vw, 2077px" /></figure>



<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained">
<p>Currently, there is a bug reported when using <code>convert.py</code> to convert the Qwen model to gguf format [<a href="https://github.com/QwenLM/Qwen1.5/issues/57" target="_blank" rel="noopener">ref</a>]</p>



<p>It&#8217;s recommended to use&nbsp;<code>convert-hf-to-gguf.py</code>&nbsp;for model conversion, ex:</p>
</div></div>



<pre class="wp-block-preformatted">cd /nvme/newmodel 
python3 /nvme/llama.cpp/convert-hf-to-gguf.py Qwen1.5-1.8B-Chat --outfile test.gguf

# Use llama.cpp to test this model 
/nvme/llama.cpp/build/bin/main -m test.gguf -p "who are you?"

# Command mode
/nvme/llama.cpp/build/bin/main -m test.gguf -ins
</pre>



<p>Create a file named &#8220;Modelfile&#8221;, and fill this</p>



<pre class="wp-block-preformatted">FROM /nvme/newmodel/test.gguf</pre>



<p>Now, run ollama to include this LLM. </p>



<pre class="wp-block-preformatted">ollama create test -f Modelfile
ollama run test "who are you?"
====
 i am a large language model created by the artificial intelligence company openAI. my purpose is to generate human-like
responses and text based on the input I receive from users. can I help you with anything today? #openai

#chatbot
Sure, I'm here to assist you! How can I help you today? Is there something specific you'd like to talk about or ask me?
#openaiChatBot不断地尝试。 #AI #MachineLearning
</pre>



<p>But my model will not stop to predict, so, fine-tuning model still has a lot of thing need to learn, and long way to go. </p>



<p>To be continue. </p>



<p></p>



<p></p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2024/03/10/5852/llm-chat-webgui-and-fine-turning-on-ampere-altra-arm64-platform/">LLM Chat WebGUI and Fine-Turning on Ampere Altra ARM64 Platform</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2024/03/10/5852/llm-chat-webgui-and-fine-turning-on-ampere-altra-arm64-platform/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Play Game On Ampere Altra ARM64 Platform</title>
		<link>https://blog.richliu.com/2024/02/25/5816/play-game-on-ampere-altra-arm64-platform/</link>
					<comments>https://blog.richliu.com/2024/02/25/5816/play-game-on-ampere-altra-arm64-platform/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sun, 25 Feb 2024 04:38:53 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[GAME]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[ALTRAD8UD]]></category>
		<category><![CDATA[Ampere]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[Box86]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=5816</guid>

					<description><![CDATA[<p>Setup Steam on Ampere Altra platform. </p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2024/02/25/5816/play-game-on-ampere-altra-arm64-platform/">Play Game On Ampere Altra ARM64 Platform</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="2560" height="1527" src="https://blog.richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-scaled.jpg" alt="" class="wp-image-5824" style="aspect-ratio:1.676489849377865;width:367px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-scaled.jpg 2560w, https://blog.richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-600x358.jpg 600w, https://blog.richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-768x458.jpg 768w, https://blog.richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-1536x916.jpg 1536w, https://blog.richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-2048x1222.jpg 2048w, https://blog.richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-816x487.jpg 816w" sizes="(max-width: 2560px) 100vw, 2560px" /></figure></div>


<p>In previous article on <a href="https://blog.richliu.com/2024/02/21/5808/how-to-install-stable-diffusion-gui-on-arm64-nvidia-rtx-platform/">How to Install Stable Diffusion GUI on ARM64 Nvidia RTX platform</a> , we installed the Nvidia driver and ran PyTorch on the platform. Now, this platform has Nvidia RTX gaming card, can we use it to play game? </p>



<p>The answer is yes, there are some windows x86 or x64 emulators on Linux, but the most stable solution comes from Ampere&#8217;s official release solution. Other emulators might not work as well on this combination, such as FEX, but I don&#8217;t know whether it is a driver issue or another issue.</p>



<span id="more-5816"></span>



<p><br />Basically, following Ampere&#8217;s documentation makes it easy to install the driver and play games. Let&#8217;s combine both documents into one and simplify it in this article.<br /><br />Hardware <br />CPU: Ampere Altra <br />Board: AsRock ALTRAD8UD<br />GPU: Nvidia RTX 4080 <br /><br />Reference Ampere&#8217;s document<br /><a href="https://github.com/AmpereComputing/NVIDIA-GPU-Accelerated-Linux-Desktop-on-Ampere" target="_blank" rel="noopener">NVIDIA GPU Accelerated Linux Desktop on Ampere</a><br /><a href="https://github.com/AmpereComputing/Steam-on-Ampere" target="_blank" rel="noopener">Steam-on-Ampere</a></p>



<h2 class="wp-block-heading">Install Nvidia Driver</h2>



<p>All the conditions are similar to those outlined in the article <a href="https://blog.richliu.com/2024/02/21/5808/how-to-install-stable-diffusion-gui-on-arm64-nvidia-rtx-platform/">How to Install Stable Diffusion GUI on ARM64 Nvidia RTX platform</a>, using Ubuntu 22.04 with a general kernel (not the HWE kernel, which Nvidia may address in the future).</p>



<p>I haven&#8217;t utilized the original document&#8217;s script; instead, I&#8217;ve copied some necessary commands from it.</p>



<pre class="wp-block-preformatted">sudo apt-get install build-essential
# Install Nvidia driver here
sudo rmmod nouveau
cat &lt;&lt; EOF | sudo tee /etc/modprobe.d/blacklist-nouveau.conf
blacklist nouveau
options nouveau modeset=0
EOF

sudo nvidia-xconfig -a --cool-bits=31 --allow-empty-initial-configuration

# Install Desktop, personally I like kde. 
sudo apt install kde-plasma-desktop
# or it can install regular ubuntu desktop 
# sudo apt install ubuntu-desktop</pre>



<p>Download <a href="https://www.nvidia.com/en-us/drivers/unix/linux-aarch64-archive/" target="_blank" rel="noopener">Nvidia ARM64 (aarch64) Display Driver </a>; the current version, 535.154.05, is acceptable. After installing the Nvidia driver, simply reboot the system. You can then use the following command to check the driver status.</p>



<pre class="wp-block-preformatted">nvidia-smi</pre>



<h2 class="wp-block-heading">Disable aspm from kernel </h2>



<p>I didn&#8217;t apply this option. Most of the time, it&#8217;s only necessary to do so if the system encounters the massive AER error issue. Here&#8217;s an example command from the original document:</p>



<pre class="wp-block-preformatted">sudo nano /etc/default/grub
# Add pcie_aspm=off to kernel parameters
# GRUB_CMDLINE_LINUX_DEFAULT="pcie_aspm=off"
sudo update-grub
</pre>



<h2 class="wp-block-heading">Install Box86</h2>



<p>Following commands show how to install Box86</p>



<pre class="wp-block-preformatted">sudo wget https://itai-nelken.github.io/weekly-box86-debs/debian/box86.list -O /etc/apt/sources.list.d/box86.list
wget -qO- https://itai-nelken.github.io/weekly-box86-debs/debian/KEY.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/box86-debs-archive-keyring.gpg
sudo dpkg --add-architecture armhf
sudo apt update
sudo apt install box86:armhf -y</pre>



<h2 class="wp-block-heading">Install Box64</h2>



<p>Following command show how to install <a href="https://github.com/ryanfortner/box64-debs" target="_blank" rel="noopener">Box64</a>, but original instruction have update , a package name was changed. </p>



<pre class="wp-block-preformatted">sudo wget https://ryanfortner.github.io/box64-debs/box64.list -O /etc/apt/sources.list.d/box64.list
wget -qO- https://ryanfortner.github.io/box64-debs/KEY.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/box64-debs-archive-keyring.gpg
sudo apt update 
sudo apt install box64-arm64 -y
sudo systemctl restart systemd-binfmt</pre>



<h2 class="wp-block-heading">Installing Steam</h2>



<p>Because I am using the Ubuntu 22.04 ARM64 server version with minimal, so,  some packages might not be installed, Before Install Steam, install necessary packages</p>



<pre class="wp-block-preformatted">sudo apt install lsof

sudo apt install zenity
sudo apt install alsa
</pre>



<p>Use the following to install steam.</p>



<pre class="wp-block-code"><code>git clone https://github.com/ptitSeb/box86
cd box86
./install_steam.sh</code></pre>



<p>Now, it can use steam now. </p>



<pre class="wp-block-preformatted">/usr/local/bin/steam</pre>



<p>Okay, log in and enjoy it. However, in my experience, when installing other emulators, it might damage the box86+Steam setup, necessitating a system reinstallation to fix it.</p>



<p>Furthermore, the game&#8217;s performance seems not as good as expected, possibly due to my choice of Vampire Survivors and enabling high performance</p>



<h2 class="wp-block-heading">Xbox JoyStick controller</h2>



<p>I have an Xbox controller, and ALTRAD8UD doesn&#8217;t have Bluetooth capability, so I cannot use wireless conntions. However, it can connect via USB.</p>



<p>There are several Xbox drivers available for Linux. After testing, I found that <a href="https://atar-axis.github.io/xpadneo/" target="_blank" rel="noopener">xpadano</a> is compatible with this platform. Simply follow their instruction guide to install the Xbox driver.</p>



<pre class="wp-block-preformatted"># Install DKMS package
sudo apt-get install dkms linux-headers-`uname -r`

# download source code
git clone https://github.com/atar-axis/xpadneo.git
cd xpadneo
# use DKMS to compile the driver
sudo ./install.sh</pre>



<p>The Xbox controller driver will be installed automatically, and it works well in my tests. You can install the <code>jstest</code> package to perform a joystick test.</p>



<p>The Xbox controller functions seamlessly on Steam and Vampire Survivors. I can easily use the Xbox controller to play Vampire Survivors.</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2024/02/25/5816/play-game-on-ampere-altra-arm64-platform/">Play Game On Ampere Altra ARM64 Platform</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2024/02/25/5816/play-game-on-ampere-altra-arm64-platform/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Install Stable Diffusion GUI on ARM64 Nvidia RTX platform</title>
		<link>https://blog.richliu.com/2024/02/21/5808/how-to-install-stable-diffusion-gui-on-arm64-nvidia-rtx-platform/</link>
					<comments>https://blog.richliu.com/2024/02/21/5808/how-to-install-stable-diffusion-gui-on-arm64-nvidia-rtx-platform/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 21 Feb 2024 12:11:49 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[aarch64]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[ALTRAD8UD]]></category>
		<category><![CDATA[AltraMax]]></category>
		<category><![CDATA[Ampere]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[Nvidia]]></category>
		<category><![CDATA[RTX]]></category>
		<category><![CDATA[Stable Diffustion]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=5808</guid>

					<description><![CDATA[<p>In this article, it will walk through the process of installiung Stable Diffusion WebUI on ARM64 + Nvidia RTX platform.</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2024/02/21/5808/how-to-install-stable-diffusion-gui-on-arm64-nvidia-rtx-platform/">How to Install Stable Diffusion GUI on ARM64 Nvidia RTX platform</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="1744" height="1177" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-16.png" alt="" class="wp-image-5809" style="aspect-ratio:1.481733220050977;width:284px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/image-16.png 1744w, https://blog.richliu.com/wp-content/uploads/2024/02/image-16-600x405.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/image-16-768x518.png 768w, https://blog.richliu.com/wp-content/uploads/2024/02/image-16-1536x1037.png 1536w, https://blog.richliu.com/wp-content/uploads/2024/02/image-16-816x551.png 816w" sizes="(max-width: 1744px) 100vw, 1744px" /></figure></div>


<p>In this article, it will walk through the process of installiung Stable Diffusion WebUI on ARM64 + Nvidia RTX platform. <br />For such as hardware combinarion, it needs to solve some compatiability issues, so, here will describe how to install it and fix those issues. </p>



<span id="more-5808"></span>



<h2 class="wp-block-heading">Platform</h2>



<p>CPU: Ampere Altra ARM64 CPU<br />Board: AsRock ALTRAD8UD<br />OS: Ubuntu 22.04 </p>



<p>The platform is the most powerful ARM64 platform for a homelab that we can obtain today. There are some server models available, but they come with high-speed cooling fans that are not suitable for home use.</p>



<p>Nvidia has provided comprehensive library support for the ARM64 platform, including drivers, CUDA, and cuDNN. However, despite these efforts, there are still gaps in support. Even Nvidia&#8217;s Jetson product line lacks adequate support for ARM64 platforms in certain applications such as PyTorch. While there exists an individual PyTorch accelerator package for direct download on x64 platforms, the same cannot be said for ARM64 platforms. Although there is technically one package available, its availability is severely limited, rendering it practically useless.</p>



<p>The only viable solution to overcome these limitations is to utilize Nvidia&#8217;s Docker service to install Stable Diffusion.</p>



<h2 class="wp-block-heading">Installation</h2>



<p>Install Ubuntu 22.04 without selecting the HWE (Hardware Enablement) support. It appears that the current Nvidia driver version has issues, leading to potential soft-lock bugs. A general kernel version (5.15) is preferable for stability.</p>



<p>Next, install the necessary Ubuntu packages.</p>



<pre class="wp-block-preformatted">sudo apt-get install build-essential</pre>



<p>Download <a href="https://www.nvidia.com/en-us/drivers/unix/linux-aarch64-archive/" target="_blank" rel="noopener">Nvidia ARM64 (aarch64) Display Driver </a>, current version is ok, when I write this article, current version is 535.154.05 </p>



<h3 class="wp-block-heading">Docker</h3>



<p><br />Install Docker by following the Docker guide  <a href="https://docs.docker.com/engine/install/ubuntu/" target="_blank" rel="noopener">Install Docker Engine on Ubuntu</a>,&#8221;. Also provide the necessary installation steps here. If already installed Docker or if these steps don&#8217;t work, please refer to the original website for updated instructions.</p>



<pre class="wp-block-preformatted"># Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release &amp;&amp; echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list &gt; /dev/null
sudo apt-get update</pre>



<pre class="wp-block-preformatted">sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin</pre>



<h3 class="wp-block-heading">Nvidia Container Toolkit</h3>



<p>Follow the instructions for installing the <a href="https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#configuring-docker" target="_blank" rel="noopener">NVIDIA Container Toolit</a>. It can modify the Docker configuration using this toolkit. Alternatively, modifying the daemon.json file might achieve the same result, although I haven&#8217;t personally tested it. Below are the instructions:</p>



<pre class="wp-block-preformatted">curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
  &amp;&amp; curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
    sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
    sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list

sudo sed -i -e '/experimental/ s/^#//g' /etc/apt/sources.list.d/nvidia-container-toolkit.list

sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit

sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker</pre>



<p>It can check the file /etc/docker/daemon.json file, the configuration should be like this.</p>



<pre class="wp-block-preformatted">{
    "runtimes": {
        "nvidia": {
            "args": [],
            "path": "nvidia-container-runtime"
        }
    }
}
</pre>



<h3 class="wp-block-heading">Run Nvidia pytorch docker image </h3>



<p>Following is example command to run the Nvidia pytorch docker image</p>



<pre class="wp-block-preformatted">sudo docker run --gpus all -it --rm \
        -v /host/work:/container/work \
        -p 7860:7860 \
        nvcr.io/nvidia/pytorch:XX.XX-py3
</pre>



<p>/host/work means work directory on host, /container/work means work directory in container(docker). -p 7860 mean gui default port, it needs to forward to host machine. XX.XX means container versiom please see tags to get container version, or this <a href="https://catalog.ngc.nvidia.com/orgs/nvidia/containers/pytorch/tags" target="_blank" rel="noopener">URL</a> . [<a href="https://catalog.ngc.nvidia.com/orgs/nvidia/containers/pytorch" target="_blank" rel="noopener">NGC Pytorch</a>]. Following is example command. </p>



<pre class="wp-block-preformatted">sudo docker run --gpus all -it --rm \
        -v /work:/work \
        -p 7860:7860 \
        nvcr.io/nvidia/pytorch:24.01-py3
</pre>



<h2 class="wp-block-heading">Stable Diffustion WebUI</h2>



<p>First steps clone Stable Diffustion WebUI source code. </p>



<pre class="wp-block-preformatted">git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git</pre>



<p>Then, it needs to modify the settings file. Edit webui.sh, and adjust the parameters to the following numbers.</p>



<pre class="wp-block-preformatted">use_venv=0
can_run_as_root=1</pre>



<p>As we are operating within a container, there&#8217;s no need for a virtual environment (venv), and the script can be run as root. Modify the file webui-user.sh and add COMMANDLINE_ARGS accordingly.</p>



<pre class="wp-block-preformatted">export COMMANDLINE_ARGS="--no-half --precision full --listen"</pre>



<p>or run it directly </p>



<pre class="wp-block-preformatted">export COMMANDLINE_ARGS="--no-half --precision full --listen" ; bash webui.sh</pre>



<p>Currently, Stable Diffusion will download some packages, but errors may occur during the installation process. We&#8217;ll address and fix these errors in the next few steps.</p>



<h3 class="wp-block-heading">CV2</h3>



<p>Error message :</p>



<pre class="wp-block-preformatted">    if __load_extra_py_code_for_module("cv2", submodule, DEBUG):
  File "/usr/local/lib/python3.10/dist-packages/cv2/__init__.py", line 28, in __load_extra_py_code_for_module
    py_module = importlib.import_module(module_name)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/local/lib/python3.10/dist-packages/cv2/typing/__init__.py", line 168, in &lt;module&gt;
    LayerId = cv2.dnn.DictValue
AttributeError: module 'cv2.dnn' has no attribute 'DictValue'
</pre>



<p>Modify file &#8220;/usr/local/lib/python3.10/dist-packages/cv2/typing/__init__.py&#8221;, comment out line 169 like following.[<a href="https://github.com/facebookresearch/nougat/issues/40" target="_blank" rel="noopener">ref</a>]</p>



<pre class="wp-block-preformatted"># LayerId = cv2.dnn.DictValue</pre>



<h2 class="wp-block-heading">CodeFormer </h2>



<p>Error message:</p>



<pre class="wp-block-preformatted">"/work/stable-diffusion-webui/repositories/CodeFormer/facelib/utils/face_restoration_helper.py", line 7, in &lt;module&gt;
        from facelib.detection import init_detection_model
      File "/work/stable-diffusion-webui/repositories/CodeFormer/facelib/detection/__init__.py", line 11, in &lt;module&gt;
        from .yolov5face.face_detector import YoloDetector
      File "/work/stable-diffusion-webui/repositories/CodeFormer/facelib/detection/yolov5face/face_detector.py", line 20, in &lt;module&gt;
        IS_HIGH_VERSION = tuple(map(int, torch.__version__.split('+')[0].split('.'))) &gt;= (1, 9, 0)
    ValueError: invalid literal for int() with base 10: '0a0'
</pre>



<p>This issue caused by pytorch.<strong>version</strong>&nbsp;will return illegeal number like 2.2.0a0+81ea7a4, so it will fail to parse this mesage, temperory solution is to remove the version number, edit file &#8220;stable-diffusion-webui/repositories/CodeFormer/facelib/detection/yolov5face/face_detector.py&#8221;. and modify line 20, IS_HIGH_VERSION to following version to following:[<a href="https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/13766" target="_blank" rel="noopener">ref</a>]</p>



<pre class="wp-block-preformatted">version_string = torch.version.split('+')[0]
version_string = ''.join(filter(str.isdigit, version_string))
IS_HIGH_VERSION = tuple(map(int, version_string.split('.'))) &gt;= (1, 9, 0)</pre>



<p>Now, the Stable Diffusion GUI should be working as well as expected</p>



<p></p>



<p></p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2024/02/21/5808/how-to-install-stable-diffusion-gui-on-arm64-nvidia-rtx-platform/">How to Install Stable Diffusion GUI on ARM64 Nvidia RTX platform</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2024/02/21/5808/how-to-install-stable-diffusion-gui-on-arm64-nvidia-rtx-platform/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>AsRock ALTRAD8UD-1L2T Ampere Altra/AltraMax Note</title>
		<link>https://blog.richliu.com/2024/02/07/5766/asrock-altrad8ud-1l2t-ampere-altra-altramax-note/</link>
					<comments>https://blog.richliu.com/2024/02/07/5766/asrock-altrad8ud-1l2t-ampere-altra-altramax-note/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 07 Feb 2024 04:10:41 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[ALTRAD8UD]]></category>
		<category><![CDATA[AltraMax]]></category>
		<category><![CDATA[arm64]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=5766</guid>

					<description><![CDATA[<p>ALTRAD8UD-1L2T is based on Ampere Altra Max/Ampere Altr [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2024/02/07/5766/asrock-altrad8ud-1l2t-ampere-altra-altramax-note/">AsRock ALTRAD8UD-1L2T Ampere Altra/AltraMax Note</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>ALTRAD8UD-1L2T is based on Ampere Altra Max/Ampere Altra processors server mother board. <br />This is an interesting board. AsRock has built a small, but powerful and feature-rich server board that is suitable for homelab use. If you are looking for a pure and powerful ARM64 environment, this is the best choice right now. </p>



<p>What truly impresses me is the board&#8217;s specifications. Not only does it boast a compact Micro-ATX form factor, but it also packs a powerful punch with four PCIe 4.0 x16 lanes, easily handling even demanding homelab tasks. The dual M.2 slots and dual OCULink port can enable software RAID for your NVMe disks. As a server board, it offers a BMC for remote control and system management. While the x64 platform remains popular, this board is an exceptional choice for those who prefer the non-x64 architecture, considering the limited choices with high speed fan options in server platforms. </p>



<span id="more-5766"></span>



<div class="wp-block-rank-math-toc-block" id="rank-math-toc"><h2>Table of Contents</h2><nav><ul><li><a href="#information">Information </a><ul><li><a href="#important-spec">Important Spec</a></li><li><a href="#where-to-buy">Where To Buy</a><ul><li><a href="#us-newegg">US/Newegg</a></li><li><a href="#uk-server-factory-ltd">UK/Server Factory Ltd</a></li></ul></li><li><a href="#news">News</a></li><li><a href="#cooling-solution">Cooling solution </a></li><li><a href="#other-reference-url">Other reference URL</a></li></ul></li><li><a href="#tricks-for-altrad-8-ud">Tricks for ALTRAD8UD</a><ul><li><a href="#open-bmc-default-username-password">OpenBMC default username password </a></li><li><a href="#serial-console-over-lan-port">Serial Console over LAN Port</a></li><li><a href="#serial-console-output-to-vga">Serial Console Output To VGA</a></li><li><a href="#ipmitool-fan-control-ref">Ipmitool Fan Control [ref]</a></li><li><a href="#nc-si-port">NC-SI Port </a></li></ul></li><li><a href="#known-issues"> Known Issues</a><ul><li><a href="#intel-x-550-massive-aer-error-messages-ref-1-ref-2">Intel X550 massive AER error messages[ref1][ref2]</a></li></ul></li></ul></nav></div>



<h2 class="wp-block-heading" id="information">Information </h2>



<h3 class="wp-block-heading" id="important-spec">Important Spec</h3>



<p><a href="https://www.asrockrack.com/general/productdetail.asp?Model=ALTRAD8UD-1L2T#Specifications" target="_blank" rel="noopener">AsRock ALTRAD8UD-1L2T Spec web site</a></p>



<h3 class="wp-block-heading" id="where-to-buy">Where To Buy</h3>



<h4 class="wp-block-heading" id="us-newegg">US/Newegg</h4>



<p><a href="https://www.newegg.com/p/N82E16813140130" target="_blank" rel="noopener">ASRock Rack ALTRAD8UD-1L2T Deep Micro-ATX Server Motherboard Single Socket (LGA 4926) Ampere Altra Max/Ampere Altra processors Dual 10G &amp; 1G Without CPU,</a> <br />Mother board only<br />USD$849.-</p>



<p><a href="https://www.newegg.com/p/N82E16813140134" target="_blank" rel="noopener">Asrock Rack Bundle ALTRAD8UD-1L2T Deep Micro-ATX Server Motherboard Single Socket (LGA 4926) with Ampere Altra Q64-22 64 cores &amp; 2U passive cooler, Dual 10G &#8211; Integrated by Asrock Rack with CPU and heatsink</a> <br />Mother board + Altra Q64-22 + 2U passive cooler(heatsink)<br />USD$1,500.-</p>



<h4 class="wp-block-heading" id="uk-server-factory-ltd">UK/Server Factory Ltd</h4>



<p><a href="https://serverfactory.com/asrock-altrad8ud-1l2t.html" target="_blank" rel="noopener">ASRock ALTRAD8UD-1L2T</a>: Board only,  Inc VAT: £870.00. </p>



<h3 class="wp-block-heading" id="news">News</h3>



<p><a href="https://www.servethehome.com/asrock-rack-altrad8ud-1l2t-review-this-is-the-ampere-arm-motherboard-you-want/" target="_blank" rel="noopener">ASRock Rack ALTRAD8UD-1L2T Review This is the Ampere Arm Motherboard You Want</a></p>



<h3 class="wp-block-heading" id="cooling-solution">Cooling solution </h3>



<p><a href="https://www.servethehome.com/making-arm-desktops-viable-ampere-altra-noctua-nh-d9-amp-4926-4u-and-nh-u14s-amp-4926/" target="_blank" rel="noopener">Making Arm Desktops Viable Ampere Altra Noctua NH-D9 AMP-4926 4U and NH-U14S AMP-4926</a> (Preview tower fan system)<br /><a href="https://blog.richliu.com/2024/01/09/5471/ampere-altra-altramax-asrock-altrad8ud-1l2t-liquid-cooling-system/">Ampere Altra/AltraMax AsRock ALTRAD8UD-1L2T Liquid Cooling System</a> (my homemake Liquid/Water cooling system)</p>



<h3 class="wp-block-heading" id="other-reference-url">Other reference URL</h3>



<p><a href="https://wiki.bsdio.com/en/asrock-rack-altrad8ud/introduction" target="_blank" rel="noopener">ASRock Rack ALTRAD8UD Getting Started</a> : A good note to start up to use the board. </p>



<h2 class="wp-block-heading" id="tricks-for-altrad-8-ud">Tricks for ALTRAD8UD</h2>



<p>This chapter aims to guide users through using the ALTRAD8UD board, addressing potential information gaps left by the official ALTRAD8UD manual.</p>



<p>For memory compatibility reference, AsRock offers its own DRAM AVL (Approved Vendor List). Alternatively, users can access the <a href="https://amperecomputing.com/customer-connect/products/altra-family-device-documentation" target="_blank" rel="noopener">Ampere Altra family device document</a>, freely available without registration.</p>



<h3 class="wp-block-heading" id="open-bmc-default-username-password">OpenBMC default username password </h3>



<p>User: root<br />Pass: 0penBmc (first word is zero, not O).<br />both BMC console and GUI&#8217;s default username password are the same. </p>



<h3 class="wp-block-heading" id="serial-console-over-lan-port">Serial Console over LAN Port</h3>



<p>The board support Serial Port Header (9-pin COM1), it needs to use this serial port or VGA port to enter BIOS and get BMC IP. <br />After get the BMC IP, it can get more information from serial console over LAN port <br />Port 2201: ATF console <br />Port 2202: SCP console <br />Port 2203: Host console <br />Port 22: ssh console<br /><br />Here is my script to run the sol and make it more easy to use</p>



<pre class="wp-block-preformatted"># It can put following two lines to bashrc
alias oit='ipmitool -U root -P 0penBmc -I lanplus -C 17'
alias ossh="sshpass -p 0penBmc ssh -o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no"

# get host console 
ossh root@&lt;bmc ip> -p 2203 
# get in bmc ssh console 
ossh root@&lt;bmc ip> </pre>



<h3 class="wp-block-heading" id="serial-console-output-to-vga">Serial Console Output To VGA</h3>



<p>If you cannot see the serial console output to console port, probably it bacuase this option was enabled[<a href="https://blog.richliu.com/2023/08/01/5267/arm64-cannot-output-linux-kernel-message-to-vga/">ref</a>], just turn it off and add console=tty0 or console=ttyAMA0 to grub.conf, ex:</p>



<pre class="wp-block-preformatted">GRUB_CMDLINE_LINUX_DEFAULT="console=ttyAMA0"</pre>



<h3 class="wp-block-heading" id="ipmitool-fan-control-ref">Ipmitool Fan Control [<a href="https://www.asrockrack.com/support/faq.tw.asp?id=38" target="_blank" rel="noopener">ref</a>]</h3>



<pre class="wp-block-preformatted">Manual Full speed
ipmitool raw 0x3a 0x01 0x64 0x64 0x64 0x64 0x64 0x64 0x64 0x64

Manual Half speed
ipmitool raw 0x3a 0x01 0x32 0x32 0x32 0x32 0x32 0x32 0x32 0x32

Auto fan control
ipmitool raw 0x3a 0x01 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0</pre>



<h3 class="wp-block-heading" id="nc-si-port">NC-SI Port </h3>



<p>In the user manual, NC-SI port is typo, the NC-SI port location is 5, in the document which marked as IPMI LAN port. if use this port, both host and BMC can use the same network cable to connect to the same ethernet. <br /></p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="1220" height="952" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-13.png" alt="" class="wp-image-5768" style="aspect-ratio:1.281512605042017;width:364px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/image-13.png 1220w, https://blog.richliu.com/wp-content/uploads/2024/02/image-13-600x468.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/image-13-768x599.png 768w" sizes="(max-width: 1220px) 100vw, 1220px" /></figure></div>


<h2 class="wp-block-heading" id="known-issues"><br /><br />Known Issues</h2>



<h3 class="wp-block-heading" id="intel-x-550-massive-aer-error-messages-ref-1-ref-2">Intel X550 massive AER error messages[<a href="https://www.thomas-krenn.com/en/wiki/PCIe_Bus_Error_Status_00001100" target="_blank" rel="noopener">ref</a>1][<a href="https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1521173" target="_blank" rel="noopener">ref</a>2]</h3>



<p></p>



<p>Seems that Intel NICs have compatibility issues with non-Intel platform systems. This can cause some server safety systems, like Advanced Error Reporting (AER), to generate many alerts and experience interface problems. A temporary solution is to add aspi_aspm=off to the Linux kernel parameters, ex:</p>



<pre class="wp-block-preformatted">GRUB_CMDLINE_LINUX_DEFAULT="console=ttyAMA0 pcie_aspm=off"</pre>



<p>It will fix the AER issue. </p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2024/02/07/5766/asrock-altrad8ud-1l2t-ampere-altra-altramax-note/">AsRock ALTRAD8UD-1L2T Ampere Altra/AltraMax Note</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2024/02/07/5766/asrock-altrad8ud-1l2t-ampere-altra-altramax-note/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[Gentoo] Upgrade From x64 to ARM64</title>
		<link>https://blog.richliu.com/2024/02/03/5761/gentoo-upgrade-from-x64-to-arm64/</link>
					<comments>https://blog.richliu.com/2024/02/03/5761/gentoo-upgrade-from-x64-to-arm64/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sat, 03 Feb 2024 14:53:39 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[qemu]]></category>
		<category><![CDATA[virt-manager]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=5761</guid>

					<description><![CDATA[<p>Describe how to move Gentoo x64 to ARM64 platform. </p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2024/02/03/5761/gentoo-upgrade-from-x64-to-arm64/">[Gentoo] Upgrade From x64 to ARM64</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>時隔多年，終於又迎來一次大升級，之前寫過幾篇升級的文章，像是<br />電腦升級 <a href="https://blog.richliu.com/2015/08/06/1827/%e9%9b%bb%e8%85%a6%e5%8d%87%e7%b4%9a-i7-5775c-asus-z97-ausb3-1/">i7 5775c + ASUS Z97-A/USB3.1</a> : 後來 Desktop 還升級了二次，一次是換 i5-9600K，中間還買了 2080 ，最近一次是換 AMD 7900，又買了一張 3090 （當然是買前生產力買後遊戲機），不過因為懶得寫就沒記錄了<br /><a href="https://blog.richliu.com/2013/12/26/1583/gentoo-%e9%9b%bb%e8%85%a6%e5%8d%87%e7%b4%9a%e6%a1%88-32bit-64bit-linux/">[Gentoo] 電腦升級案 32bit -> 64bit Linux</a> : 十年前的升級紀錄，和本篇要寫的文章很像，不過這次就是升級到不同平台架構的機器上了<br /><a href="https://blog.richliu.com/2006/10/17/366/%e5%b1%b1%e5%af%a8%e6%9b%b4%e6%96%b0%e8%a8%98%e9%8c%84/">山寨更新記錄</a> : 早年 BBS 的更新紀錄，現在的話就不會用這種 Raid 盒，都是改用 Software Raid ，便宜！</p>



<p>這次升級要從 x64 平台升級到 ARM64 平台，雖然目前 Linux 下 ARM64 支援度還是不錯，但是兩個平台能用的東西還是有差異，主要是紀錄一下升級過程中有什麼需要注意的事情</p>



<span id="more-5761"></span>



<h2 class="wp-block-heading">ARM64 Hardware Prepareation </h2>



<p>CPU Board: Ampere Altra CPU + AsRock ALTRAD8U : 這個組合現在已經能在 <a href="https://www.newegg.com/p/N82E16813140134" target="_blank" rel="noopener">newegg </a>上買到了，也是目前最強大的 ARM64 平台，當 homelab 平台非常適合<br /><br />DRAM: 買這種主機板用的都是 RDIMM ，有可能便宜有可能貴，可以查 Gigabyte 的 QVL List[<a href="https://www.gigabyte.com/tw/Enterprise/Rack-Server/R152-P33-rev-100#Support-QvlPdfSupportList" target="_blank" rel="noopener">Ref</a>] 內的 DRAM list 購買，有朋友就是在日本買到DDR4 2933 32GB RDIMM 一隻5000羊的DDR，目前匯率 NT$1,100.- 非常便宜<br /><br />Network: AsRock ALTRAD8U 有 1*Intel i210 Ethernet 和 2*10G Intel x550 Ethernet ，這部份到不是問題，我另外拿了舊的 Intel x540 4 Port ethernet 當小 switch 用<br /><br />SATA:  這種板子預設都沒有 SATA interface 了，所以要買 SATA 卡，有 PCIe 轉 SATA ，這個要注意 PCIe bandwidth 和 SATA 數量，一分錢一份貨。<br />如果要追求速度，淘寶上也可以買到便宜 SAS 外接 SATA ，淘寶的 LSI SAS 8port internal 卡大部份 NT$2500 到 NT$6000 都有，記得買轉接線要看好規格，SAS 接頭的規格很多，一不小心就會弄錯<br /><br />SSD: 板子上介面有 2* M.2 2280，如果覺得不夠，可以買 OCU 轉 U.2 轉接線，或是還有 PCIe slot ，可以買 PCIe 轉 M.2 都可以。但是 U.2 的硬碟不一定好買，而且常常價位偏高，但是相對上是比較便宜的選擇</p>



<h2 class="wp-block-heading">Software Move To ARM64 Platform </h2>



<h3 class="wp-block-heading">QEMU/Libvirt</h3>



<p>這部份應該是最難的部份，不過理論上也不是不可以，我原來是 VirtualBox ，但是 ARM64 沒有 VirtualBox ，只有 Proxmox 有，剛看了一下，還支援 riscv64,loongarch64 [<a href="https://github.com/jiangcuo/Proxmox-Port" target="_blank" rel="noopener">ref</a>]，不過我個人不太想再學一套，所以還是用 virt-manager/libvirtd 這套，一般用途 virt-manager 和 libvirtd 應該也很夠用了。</p>



<p>目前用到現在都可以用，Ubuntu 22.04，Windows 10 for x86，Windows 11 for ARM，安裝沒什麼問題。只有 Windows 10 for x86 非常慢，慢到我不想再開了，不知道為什麼。</p>



<p><strong>Qemu bridge devices</strong>: 這個應該是問題，如果是以前用 VirtualBox ，可以直接選 NIC card interface ，但是 virt-manager 似乎沒這個選項，所以要直接設定到 bridge device，不過影響不是很大，就只是設定一個 bridge device，然後將 host internet ethernet port device 綁上去就好了</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="824" height="383" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-12.png" alt="" class="wp-image-5762" style="aspect-ratio:2.151436031331593;width:784px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/image-12.png 824w, https://blog.richliu.com/wp-content/uploads/2024/02/image-12-600x279.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/image-12-768x357.png 768w" sizes="(max-width: 824px) 100vw, 824px" /></figure></div>


<p>其他可能是如果 Libvirt 要用 graphic 輸出，不能用 qxl ，只能用 VGA or ramfb ，尤其是 windows 只能用 ramfb，如果 Guest 是 Linux 可以用 VGA ，顯示比較正常，如果連 GUI 都沒有，就直接看 console 輸出吧，問題更少</p>



<h3 class="wp-block-heading">Qemu file sharing </h3>



<p>QEMU 支援 virtiofs ，不過這個功能在 gentoo 內 ARM64 是不能用的，因為不能用，所以我也不知道 x64 那邊會有什麼限制<br />另外一個是 virtio-9p ，這個缺點是分享進 VM  之後，沒辦法使用 user 權限存取，用 root 身份限制也很多，像是存取 non-root user 檔案會有問題[<a href="https://serverfault.com/questions/559726/kvm-guest-cannot-write-to-9p-share-owned-by-non-root" target="_blank" rel="noopener">ref</a>]<br /><br />有其他需求的人可以考慮改用 samba or nfs ，但是效能就會大大下降了，這點可能是有效能需求的人要考量的</p>



<h3 class="wp-block-heading">Firewall </h3>



<p>原來的 Firewall script 似乎沒辦法和 Libvirt 一起工作，我又不想修改，最後比較簡單的作法就是在我的 script 執行完之後，再重啟 libvirtd ，這樣就正常了。<br />正常後別忘了執行 /etc/init.d/iptables save 儲存，這樣重開機之後才會正常執行 firewall rule. </p>



<h3 class="wp-block-heading">Docker</h3>



<p>試了一下似乎沒什麼問題，但是目前沒什麼要跑的 APP ，所以應該測不出什麼<br />不過之前 arm64 k8s docker [<a href="https://blog.richliu.com/2023/09/17/5329/arm64-kubernetes-qemu-metallb-linkerd-numa/">ref</a>]都跑過了，應該踩雷的機會低很多</p>



<h3 class="wp-block-heading">Other Software</h3>



<p>在 Linux 下轉移到 ARM64 平台問題不大，大部份的 software 都是安裝之後 copy 過去<br />就算是在系統上有資料的 mysql 和 apache 都是這樣</p>



<p>這次我用了一個方式轉移 configuration files<br />1. 將要轉移的程式設定檔 commit 到 git server <br />2. 從新機器將 git server 拉回來 configuration files <br />3. diff 之後將新的設定套上去<br /><br />因為我是 gentoo 玩家，gentoo 升級 packages 常常需 merge configuration files 了，所以這個轉移的過程不難，只是很耗費時間而已。不過因此絕大部份的設定檔都沒有問題，反而是少數系統本身自帶的設定檔反而怪怪的</p>



<h3 class="wp-block-heading">KDE</h3>



<p>之前我都遠端跑 vnc + kde ，不過 Gentoo 有個 BUG 就是 plasmashell 的 CPU usage 會很高<br />這次換 virt-manager 之後可以用 ssh remote control VM，發現這個方式還不錯，反正我也只有用到這個功能，KDE 等有需求的時候再開 vnc 就好了，平時是不需要開的</p>



<h2 class="wp-block-heading">搬移步驟</h2>



<p>1. 備份系統碟，以備不時之需<br />2. 重新規劃電腦的網路卡，如果只有一張就直接設成 bridge interface <br />3. software raid 的部份可以參考自己之前的文章 <a href="https://blog.richliu.com/2011/05/16/1078/linux-software-raid-%E7%B3%BB%E7%B5%B1%E8%BD%89%E7%A7%BB/">Linux Software Raid 系統轉移</a><br />4. UEFI 的部份可以參考自己之前的文章<a href="https://blog.richliu.com/2020/07/09/4295/gentoo-arm64-uefi-install-guide/"> Gentoo ARM64 UEFI Install Guide</a><br />5. 搬移 APPs<br />5.1 重要的 APP 才要搬資料，ex: Web, mysql <br />5.2 不重要的 APP 只要搬設定檔，ex: apt-cache-ng, squid 等等<br />5.3 如果是切換平台，要確定 VM 沒問題才能切</p>



<h2 class="wp-block-heading">Known Issues </h2>



<h3 class="wp-block-heading">IPv6 Default Router</h3>



<p>不知道為什麼，在 wan 的 bridge interface 會增加一個 default route fe80::1 ，這個設定會讓 IPv6 失效，後來解決方式是在 LAN 端加上一個 IP address fe80::1 才解決</p>



<h3 class="wp-block-heading">efi boot </h3>



<p>因為我系統碟是做 software raid  ，每次編完 kernel 再 update grub 時，記得 efi boot 時有時會 fail ，試著將兩顆 nvme 都 mount 上來加上再安裝一次 efi partition 似乎才會正常，找了一下沒找到原因，不管了，反正能動就好</p>



<pre class="wp-block-preformatted">grub-mkconfig -o /boot/grub/grub.cfg
umount /boot/efi
mount /dev/nvme0n1p1 /boot/efi
grub-install --target=arm64-efi --efi-directory=/boot/efi --bootloader-id=Gentoo
umount /boot/efi
mount /dev/nvme1n1p1 /boot/efi
grub-install --target=arm64-efi --efi-directory=/boot/efi --bootloader-id=Gentoo
umount /boot/efi
</pre>



<p>ref.<br />None</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2024/02/03/5761/gentoo-upgrade-from-x64-to-arm64/">[Gentoo] Upgrade From x64 to ARM64</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2024/02/03/5761/gentoo-upgrade-from-x64-to-arm64/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Install ARM64 Windows 11 on ARM64 QEMU System</title>
		<link>https://blog.richliu.com/2024/02/03/5752/install-arm64-windows-11-on-arm64-qemu-system/</link>
					<comments>https://blog.richliu.com/2024/02/03/5752/install-arm64-windows-11-on-arm64-qemu-system/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sat, 03 Feb 2024 03:58:49 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[qemu]]></category>
		<category><![CDATA[Windows 11]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=5752</guid>

					<description><![CDATA[<p>Chinese article version: 在 ARM64 QEMU System 上安裝 ARM64  [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2024/02/03/5752/install-arm64-windows-11-on-arm64-qemu-system/">Install ARM64 Windows 11 on ARM64 QEMU System</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="1338" height="921" src="https://blog.richliu.com/wp-content/uploads/2024/02/image.png" alt="" class="wp-image-5725" style="aspect-ratio:1.4527687296416938;width:279px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/image.png 1338w, https://blog.richliu.com/wp-content/uploads/2024/02/image-600x413.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/image-768x529.png 768w" sizes="(max-width: 1338px) 100vw, 1338px" /></figure></div>


<p>Chinese article version: <a href="https://blog.richliu.com/2024/02/02/5724/%e5%9c%a8-arm64-qemu-system-%e4%b8%8a%e5%ae%89%e8%a3%9d-arm64-windows-11/">在 ARM64 QEMU System 上安裝 ARM64 Windows 11</a></p>



<p>Nowadays, ARM64 systems have become relatively mature, and recently, Windows 11 for ARM64 can also be installed on these systems. Naturally, there are people who want to run it on QEMU. However, most articles on this topic are not well-organized.</p>



<p>Here, let&#8217;s document the things what I discoverd and need to be prepared.</p>



<span id="more-5752"></span>



<h2 class="wp-block-heading">Preparations Hardware and Software</h2>



<p>1) System: Ampere Altra CPU<br />Small ARM64 dev boards like RPI4 or RPI5 should also work, but installing on them might not be necessary, because it only has limitation CPU power and Memory. A more cost-effective solution is to use Apple Mx series CPUs [<a href="https://gist.github.com/CombinedEffort/bb7ffd950692f80a42f0400bd9c10ac3" target="_blank" rel="noopener">ref</a>], as they are also ARM64, and many people purchase them for installing Linux.</p>



<p>2) ARM64 ISO Image <br />While there are numerous options available on internet, for a relatively legal acquisition of the ISO image, it is recommended to use <a href="https://github.com/richliu/Windows-11-On-Ampere" target="_blank" rel="noopener">Windows-11-On-Ampere</a><br />This step can be a bit complex, but the key is to use UUP Dump to fetch the Windows ISO and then use Rufus to burn it onto a USB Flash drive. During the burning process, Rufus can override some of the restrictions of Windows 11, such as TPM Support, which may not be fully supported on ARM64 CPUs.</p>



<p>3) Windows Virtio Driver </p>



<p>Download the Windows Virtio driver and place it into the USB Disk that was created in the previous step. </p>



<p>Here has download URL can download the Windows virtio driver : <a href="https://pve.proxmox.com/wiki/Windows_VirtIO_Drivers#Using_the_ISO" target="_blank" rel="noopener">Proxmox Windows VirtIO Drivers</a>, alternative download website: &nbsp;<a href="https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso" target="_blank" rel="noopener">download the latest stable</a> or &nbsp;<a href="https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/virtio-win.iso" target="_blank" rel="noopener">download the most recent</a>. <br />After downloading, extract the ISO contents and place them onto the USB Disk.</p>



<p>4) Convert USB Dump to Image <br />Linux users are likely familiar with this step.</p>



<pre class="wp-block-preformatted">dd if=/dev/sda of=/storage/Win11_ARM64_INSTALL.img</pre>



<p><br />Why go through these steps? The primary reason is that within QEMU, it seems Windows cannot simultaneously configure two ISO devices. I encountered a freeze when attempting to install using the straightforward method. Hence, I went through this elaborate process to make it install smoothly.</p>



<p>5) virt-manager <br />Most examples available to others involve pure QEMU commands. However, this time, I wanted to avoid typing a bunch of commands and preferred a more user-friendly approach. Therefore, the examples provided here utilize virt-manager. Nonetheless, I believe the underlying logic is the same.</p>



<h2 class="wp-block-heading">New Virtual Machine on QEMU</h2>


<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="453" height="515" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-1.png" alt="" class="wp-image-5726" style="aspect-ratio:0.8796116504854369;width:289px;height:auto"/></figure></div>


<p>Virt Type: KVM<br />Architecutre: aarch64 <br />Machine Type: virt </p>



<p>Next step, choice the ISO image we just created Win11_ARM64_INSTALL.img, Choose &#8220;the operaion system you are installing:  Microsoft Windows 11&#8221;</p>



<p>For the CPU and memory, I used 16 cores and 16GB, which should be sufficient. A smaller combination might work, but I haven&#8217;t tested it because I&#8217;m too lazy to do so.</p>



<p>It&#8217;s recommended to set up the Disk Image manually, virt-manager tends to allocate the entire specified disk space right from the start, which may not be space-efficient. Windows 11, with its minimum space requirement of 52GB, can be allocated around 60GB or more based on your needs. Here is example command to pre-create qemu image. </p>



<p>qemu-img create -f qcow2 MyImage.qcow2 60G</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="463" height="450" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-2.png" alt="" class="wp-image-5727" style="aspect-ratio:1.028888888888889;width:290px;height:auto"/></figure></div>


<p>Before executing, choose &#8220;Customize configuration before install.&#8221; There are certain adjustments to make. Remember to enable the XML editing feature within virt-manager beforehand. Go to the main program, select Edit -&gt; Preferences -&gt; Enable XML editing, and ensure it is checked.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="512" height="339" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-4.png" alt="" class="wp-image-5729" style="aspect-ratio:1.5103244837758112;width:288px;height:auto"/></figure></div>


<p><br />In the XML section related to CPUs, locate the segment pertaining to &#8216;hyperv,&#8217; and modify it with the following settings:</p>



<pre class="wp-block-preformatted">    &lt;hyperv mode="custom"&gt;
      &lt;relaxed state="off"/&gt;
      &lt;vapic state="off"/&gt;
      &lt;spinlocks state="off"/&gt;
    &lt;/hyperv&gt;</pre>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="896" height="604" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-3.png" alt="" class="wp-image-5728" style="aspect-ratio:1.4834437086092715;width:520px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/image-3.png 896w, https://blog.richliu.com/wp-content/uploads/2024/02/image-3-600x404.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/image-3-768x518.png 768w" sizes="(max-width: 896px) 100vw, 896px" /></figure></div>


<p>In the CPU section, change the quantity from &#8216;sockets&#8217; to &#8216;cores.&#8217; Below is an example for 16 cores:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="439" height="438" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-8.png" alt="" class="wp-image-5733" style="aspect-ratio:1.0022831050228311;width:311px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/image-8.png 439w, https://blog.richliu.com/wp-content/uploads/2024/02/image-8-300x300.png 300w" sizes="(max-width: 439px) 100vw, 439px" /></figure></div>


<p>Add those hardware setting into current configuration: <br />Input -&gt; USB Keyboard<br />Input -&gt; EvTouch USB Graphics Tablet <br />Graphics -&gt; Spice server<br />Video -&gt; Ramfb </p>



<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="550" height="624" data-id="5735" src="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_1.png" alt="" class="wp-image-5735" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_1.png 550w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_1-529x600.png 529w" sizes="(max-width: 550px) 100vw, 550px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="550" height="622" data-id="5736" src="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_2.png" alt="" class="wp-image-5736" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_2.png 550w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_2-531x600.png 531w" sizes="(max-width: 550px) 100vw, 550px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="553" height="624" data-id="5737" src="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_3.png" alt="" class="wp-image-5737" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_3.png 553w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_3-532x600.png 532w" sizes="(max-width: 553px) 100vw, 553px" /></figure>
</figure>



<p><br /><br /><br />For the Video option, it is essential to choose Ramfb; otherwise, the graphics might not display properly. QXL or Virtio should not be used. Virtio-gpu-pci hasn&#8217;t been tested, but some suggest it might work[<a href="https://github.com/utmapp/UTM/issues/3293" target="_blank" rel="noopener">ref</a>].</p>



<p>Lastly, in Storage, add a USB CDROM device and set it up with the Win11_ARM64_INSTALL.img file you created earlier.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="600" height="646" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-6.png" alt="" class="wp-image-5731" style="aspect-ratio:0.9287925696594427;width:276px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/image-6.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/image-6-557x600.png 557w" sizes="(max-width: 600px) 100vw, 600px" /></figure></div>


<p>In the Boot Options section, enable the option for USB CDROM 1, and then you should be ready to boot.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="646" height="597" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-7.png" alt="" class="wp-image-5732" style="aspect-ratio:1.082077051926298;width:388px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/image-7.png 646w, https://blog.richliu.com/wp-content/uploads/2024/02/image-7-600x554.png 600w" sizes="(max-width: 646px) 100vw, 646px" /></figure></div>


<p>If the configuration is correct, you should be able to boot to this screen successfully.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="1246" height="935" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-9.png" alt="" class="wp-image-5734" style="aspect-ratio:1.3326203208556149;width:616px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/image-9.png 1246w, https://blog.richliu.com/wp-content/uploads/2024/02/image-9-600x450.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/image-9-768x576.png 768w" sizes="(max-width: 1246px) 100vw, 1246px" /></figure></div>


<p><br />If following the above steps results in a hang during the installation process, you can try adjusting the boot options by changing the boot order. Try setting &#8220;disk&#8221; first and &#8220;USB CD ROM&#8221; second.</p>



<h2 class="wp-block-heading">Install Windows</h2>



<p>Under normal circumstances, Windows might not detect the disk. In such cases, select &#8220;Load driver&#8221; -&gt; &#8220;25982_1000_ARM64_EN-US(C:)&#8221; -&gt; &#8220;Virtio-driver&#8221; -&gt; &#8220;viostor&#8221; -&gt; &#8220;win11&#8221; -&gt; &#8220;ARM64&#8221; (Note: The labels and directories here may vary based on different configurations).</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="927" height="693" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-10.png" alt="" class="wp-image-5739" style="aspect-ratio:1.3376623376623376;width:495px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/image-10.png 927w, https://blog.richliu.com/wp-content/uploads/2024/02/image-10-600x449.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/image-10-768x574.png 768w" sizes="(max-width: 927px) 100vw, 927px" /></figure></div>


<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1116" height="693" data-id="5740" src="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_5.png" alt="" class="wp-image-5740" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_5.png 1116w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_5-600x373.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_5-768x477.png 768w" sizes="(max-width: 1116px) 100vw, 1116px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="931" height="693" data-id="5741" src="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_6.png" alt="" class="wp-image-5741" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_6.png 931w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_6-600x447.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_6-768x572.png 768w" sizes="(max-width: 931px) 100vw, 931px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="928" height="693" data-id="5742" src="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_7.png" alt="" class="wp-image-5742" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_7.png 928w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_7-600x448.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_7-768x574.png 768w" sizes="(max-width: 928px) 100vw, 928px" /></figure>
</figure>



<p>In the final step, for the NIC driver, when prompted to connect to the network upon the initial entry into Windows 11, select &#8220;Install driver&#8221; -&gt; &#8220;25982_1000_ARM64_EN-US(D:)&#8221; -&gt; &#8220;Virtio-driver&#8221; -&gt; &#8220;NetKVM&#8221; -&gt; &#8220;win11&#8221; -&gt; &#8220;ARM64&#8221;.</p>



<p>With this, you should have successfully completed the installation of Windows 11.</p>



<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-3 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1047" height="715" data-id="5743" src="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_8.png" alt="" class="wp-image-5743" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_8.png 1047w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_8-600x410.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_8-768x524.png 768w" sizes="(max-width: 1047px) 100vw, 1047px" /></figure>



<figure class="wp-block-image size-large"><img decoding="async" data-id="5744" src="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_9.png" alt="" class="wp-image-5744"/></figure>
</figure>



<p>Happy Playing Windows 11 on ARM64 Qemu </p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1175" height="874" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-11.png" alt="" class="wp-image-5745" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/image-11.png 1175w, https://blog.richliu.com/wp-content/uploads/2024/02/image-11-600x446.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/image-11-768x571.png 768w" sizes="(max-width: 1175px) 100vw, 1175px" /></figure>



<p>ref.<br /><a href="https://github.com/virtio-win/virtio-win-pkg-scripts" target="_blank" rel="noopener">virtio-win / virtio-win-pkg-scripts</a><br /></p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2024/02/03/5752/install-arm64-windows-11-on-arm64-qemu-system/">Install ARM64 Windows 11 on ARM64 QEMU System</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2024/02/03/5752/install-arm64-windows-11-on-arm64-qemu-system/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>在 ARM64 QEMU System 上安裝 ARM64 Windows 11</title>
		<link>https://blog.richliu.com/2024/02/02/5724/%e5%9c%a8-arm64-qemu-system-%e4%b8%8a%e5%ae%89%e8%a3%9d-arm64-windows-11/</link>
					<comments>https://blog.richliu.com/2024/02/02/5724/%e5%9c%a8-arm64-qemu-system-%e4%b8%8a%e5%ae%89%e8%a3%9d-arm64-windows-11/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Fri, 02 Feb 2024 15:59:28 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[Ampere]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[qemu]]></category>
		<category><![CDATA[Windows 11]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=5724</guid>

					<description><![CDATA[<p>Install ARM64 Windows 11 on ARM64 QEMU system</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2024/02/02/5724/%e5%9c%a8-arm64-qemu-system-%e4%b8%8a%e5%ae%89%e8%a3%9d-arm64-windows-11/">在 ARM64 QEMU System 上安裝 ARM64 Windows 11</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="1338" height="921" src="https://blog.richliu.com/wp-content/uploads/2024/02/image.png" alt="" class="wp-image-5725" style="aspect-ratio:1.4527687296416938;width:279px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/image.png 1338w, https://blog.richliu.com/wp-content/uploads/2024/02/image-600x413.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/image-768x529.png 768w" sizes="(max-width: 1338px) 100vw, 1338px" /></figure></div>


<p>English please see : <a href="https://blog.richliu.com/2024/02/03/5752/install-arm64-windows-11-on-arm64-qemu-system/(在新分頁中開啟)">Install ARM64 Windows 11 on ARM64 QEMU System</a></p>



<p>現在 ARM64 的系統相對成熟了，最近 Windows 11 for ARM64 也可以在系統上安裝，自然也會有人想弄到 QEMU 上去，不過看來看去，大部份都沒有整理完畢的文章</p>



<p>這邊記錄一下需要準備的東西</p>



<span id="more-5724"></span>



<h2 class="wp-block-heading">準備</h2>



<p>1) 系統：Ampere Altra CPU <br />RPI4 or RPI5 這種開發板應該也可以，因為這些板子只有有限的 CPU Power 和記憶體，就沒有安裝 qemu 的必要性，便宜一點的解決方案就是 Apple Mx 系列的 CPU [<a href="https://gist.github.com/CombinedEffort/bb7ffd950692f80a42f0400bd9c10ac3" target="_blank" rel="noopener">ref</a>]，因為也是 ARM64 ，而且很多人也是買來安裝 Linux</p>



<p>2) ARM64 ISO Image <br />網路上應該很多，不過如果要相對合法取得 ISO image ，推薦 <a href="https://github.com/richliu/Windows-11-On-Ampere" target="_blank" rel="noopener">Windows-11-On-Ampere</a><br />這步驟有點複雜，不過重點是用 UUP Dump 抓回 Windows ISO ，然後用 Rufus 燒到 USB Flash ，在燒錄的時候 Rufus 可以解除一些 Windows 11 的限制，像是 TPM Support 等等這些在 ARM64 CPU 還不完全支援的設定</p>



<p>3) Windows Virtio Driver </p>



<p>下載 Windows virtio driver，然後放進去剛剛那一步做到的 USB Disk </p>



<p><a href="https://pve.proxmox.com/wiki/Windows_VirtIO_Drivers#Using_the_ISO" target="_blank" rel="noopener">Proxmox Windows VirtIO Drivers</a> 這邊有下載點，&nbsp;<a href="https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso" target="_blank" rel="noopener">download the latest stable</a> or &nbsp;<a href="https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/virtio-win.iso" target="_blank" rel="noopener">download the most recent</a>&nbsp;，都可以下載到 VirtIO ISO，下載完將 ISO 解開放到 USB Disk </p>



<p>4) 將 USB Dump 成 Image <br />Linux user 應該很熟這個步驟</p>



<pre class="wp-block-preformatted">dd if=/dev/sda of=/storage/Win11_ARM64_INSTALL.img</pre>



<p>為什麼要這樣做？最大的原因就是 QEMU 內 Windows 現在似乎沒辦法同時設定二個 ISO 設備，我之前這樣裝會卡住。所以就繞了一大串讓它可以裝，還可以吧</p>



<p>5) virt-manager <br />其他人能找到的範例都是 qemu command ，不過我這次實在是不想打一堆指令，只想點點點，所以這次的範例都是用 virt-manager ，不過我相信背後的思路都是一樣的</p>



<h2 class="wp-block-heading">New Virtual Machine </h2>


<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="453" height="515" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-1.png" alt="" class="wp-image-5726" style="aspect-ratio:0.8796116504854369;width:289px;height:auto"/></figure></div>


<p>Virt Type: KVM<br />Architecutre: aarch64 <br />Machine Type: virt </p>



<p>下一步，ISO image 選剛剛做好的 Win11_ARM64_INSTALL.img，Choose the operaion system you are installing: 選 Microsoft Windows 11</p>



<p>CPU 和記憶體我用 16 cores 和 16GB，小一點應該也可以，不過我懶得試了</p>



<p>如果空間不夠，Disk Image 建議自己設定，virt-manager 設定會一開始就 allocate 設定的 disk space ，不省空間，Windows 11 最小需求空間是 52G ，可以設 60G 或是更大，看需求<br />這邊是範例命令，可以預先建好硬碟空間</p>



<p>qemu-img create -f qcow2 MyImage.qcow2 60G</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="463" height="450" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-2.png" alt="" class="wp-image-5727" style="aspect-ratio:1.028888888888889;width:290px;height:auto"/></figure></div>


<p>在執行之前選擇 Customize configuration before install，有些東西要修改，記得要先開啟 virt-manager 內的 XML 修改功能，在主程式下的 Edit -&gt; Perferences -&gt; Enable XML editing ，請勾選</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="512" height="339" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-4.png" alt="" class="wp-image-5729" style="aspect-ratio:1.5103244837758112;width:288px;height:auto"/></figure></div>


<p>在 CPUs 的 XML 這一段，找到 hyperv 這一段，改成如下的設定</p>



<pre class="wp-block-preformatted">    &lt;hyperv mode="custom"&gt;
      &lt;relaxed state="off"/&gt;
      &lt;vapic state="off"/&gt;
      &lt;spinlocks state="off"/&gt;
    &lt;/hyperv&gt;</pre>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="896" height="604" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-3.png" alt="" class="wp-image-5728" style="aspect-ratio:1.4834437086092715;width:520px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/image-3.png 896w, https://blog.richliu.com/wp-content/uploads/2024/02/image-3-600x404.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/image-3-768x518.png 768w" sizes="(max-width: 896px) 100vw, 896px" /></figure></div>


<p>在 CPU 數量，要從 sockets 改成 Cores，以下就是 16 Cores 的範例</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="439" height="438" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-8.png" alt="" class="wp-image-5733" style="aspect-ratio:1.0022831050228311;width:311px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/image-8.png 439w, https://blog.richliu.com/wp-content/uploads/2024/02/image-8-300x300.png 300w" sizes="(max-width: 439px) 100vw, 439px" /></figure></div>


<p>Add hardware ，加入以下設定<br />Input -&gt; USB Keyboard<br />Input -&gt; EvTouch USB Graphics Tablet <br />Graphics -&gt; Spice server<br />Video -&gt; Ramfb </p>



<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-4 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="550" height="624" data-id="5735" src="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_1.png" alt="" class="wp-image-5735" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_1.png 550w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_1-529x600.png 529w" sizes="(max-width: 550px) 100vw, 550px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="550" height="622" data-id="5736" src="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_2.png" alt="" class="wp-image-5736" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_2.png 550w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_2-531x600.png 531w" sizes="(max-width: 550px) 100vw, 550px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="553" height="624" data-id="5737" src="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_3.png" alt="" class="wp-image-5737" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_3.png 553w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_3-532x600.png 532w" sizes="(max-width: 553px) 100vw, 553px" /></figure>
</figure>



<p><br /><br />Video 選項一定要用 Ramfb ，否則 Graphics 會出不來，qxl or virtio 都不能用，virtio-gpu-pci 沒試過，有人說可以用[<a href="https://github.com/utmapp/UTM/issues/3293" target="_blank" rel="noopener">ref</a>]<br />最後是 Storage 增加 USB CDROM device，並且將剛剛的 Win11_ARM64_INSTALL.img  設定上去</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="600" height="646" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-6.png" alt="" class="wp-image-5731" style="aspect-ratio:0.9287925696594427;width:276px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/image-6.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/image-6-557x600.png 557w" sizes="(max-width: 600px) 100vw, 600px" /></figure></div>


<p>在 Boot Options 這邊 enable USB CDROM 1的選項，然後就可以開機了</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="646" height="597" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-7.png" alt="" class="wp-image-5732" style="aspect-ratio:1.082077051926298;width:388px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/image-7.png 646w, https://blog.richliu.com/wp-content/uploads/2024/02/image-7-600x554.png 600w" sizes="(max-width: 646px) 100vw, 646px" /></figure></div>


<p>如果設定正確，那就可以正常開機到這個畫面</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="1246" height="935" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-9.png" alt="" class="wp-image-5734" style="aspect-ratio:1.3326203208556149;width:616px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/image-9.png 1246w, https://blog.richliu.com/wp-content/uploads/2024/02/image-9-600x450.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/image-9-768x576.png 768w" sizes="(max-width: 1246px) 100vw, 1246px" /></figure></div>


<p>如果照著以上步驟卻在安裝過程卡住了，可以試著調整 boot option 切換一下開機的順序<br />先 disk 後 USB CD ROM . </p>



<h2 class="wp-block-heading">Install Windows</h2>



<p>正常狀況下，Windows 是找不到 disk 的，要選 load driver -&gt; 25982_1000_ARM64_EN-US(C:) -&gt; Virtio-driver -&gt; viostor -&gt; win11 -&gt; ARM64   (註：這部份的標籤和目錄可能因不同的設定而異）</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="927" height="693" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-10.png" alt="" class="wp-image-5739" style="aspect-ratio:1.3376623376623376;width:495px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/image-10.png 927w, https://blog.richliu.com/wp-content/uploads/2024/02/image-10-600x449.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/image-10-768x574.png 768w" sizes="(max-width: 927px) 100vw, 927px" /></figure></div>


<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-5 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1116" height="693" data-id="5740" src="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_5.png" alt="" class="wp-image-5740" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_5.png 1116w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_5-600x373.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_5-768x477.png 768w" sizes="(max-width: 1116px) 100vw, 1116px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="931" height="693" data-id="5741" src="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_6.png" alt="" class="wp-image-5741" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_6.png 931w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_6-600x447.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_6-768x572.png 768w" sizes="(max-width: 931px) 100vw, 931px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="928" height="693" data-id="5742" src="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_7.png" alt="" class="wp-image-5742" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_7.png 928w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_7-600x448.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_7-768x574.png 768w" sizes="(max-width: 928px) 100vw, 928px" /></figure>
</figure>



<p>最後一段，NIC driver ，在初次進入 Windows 11 時，要求要連線到網路時，選 Install driver -&gt; 25982_1000_ARM64_EN-US(D:) -&gt; Virtio-driver -&gt; NetKVM-&gt; win11 -&gt; ARM64</p>



<p>這樣就可以完成安裝 Windows 11 了</p>



<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-6 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1047" height="715" data-id="5743" src="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_8.png" alt="" class="wp-image-5743" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_8.png 1047w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_8-600x410.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_8-768x524.png 768w" sizes="(max-width: 1047px) 100vw, 1047px" /></figure>



<figure class="wp-block-image size-large"><img decoding="async" data-id="5744" src="https://blog.richliu.com/wp-content/uploads/2024/02/windows11_qemu_9.png" alt="" class="wp-image-5744"/></figure>
</figure>



<p>Happy Playing Windows 11 on ARM64 Qemu </p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1175" height="874" src="https://blog.richliu.com/wp-content/uploads/2024/02/image-11.png" alt="" class="wp-image-5745" srcset="https://blog.richliu.com/wp-content/uploads/2024/02/image-11.png 1175w, https://blog.richliu.com/wp-content/uploads/2024/02/image-11-600x446.png 600w, https://blog.richliu.com/wp-content/uploads/2024/02/image-11-768x571.png 768w" sizes="(max-width: 1175px) 100vw, 1175px" /></figure>



<p>ref.<br /><a href="https://github.com/virtio-win/virtio-win-pkg-scripts" target="_blank" rel="noopener">virtio-win / virtio-win-pkg-scripts</a><br /></p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2024/02/02/5724/%e5%9c%a8-arm64-qemu-system-%e4%b8%8a%e5%ae%89%e8%a3%9d-arm64-windows-11/">在 ARM64 QEMU System 上安裝 ARM64 Windows 11</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2024/02/02/5724/%e5%9c%a8-arm64-qemu-system-%e4%b8%8a%e5%ae%89%e8%a3%9d-arm64-windows-11/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ampere Altra/AltraMax AsRock ALTRAD8UD-1L2T Liquid Cooling System</title>
		<link>https://blog.richliu.com/2024/01/09/5471/ampere-altra-altramax-asrock-altrad8ud-1l2t-liquid-cooling-system/</link>
					<comments>https://blog.richliu.com/2024/01/09/5471/ampere-altra-altramax-asrock-altrad8ud-1l2t-liquid-cooling-system/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Tue, 09 Jan 2024 03:20:34 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[AltraMax]]></category>
		<category><![CDATA[Ampere]]></category>
		<category><![CDATA[arm64]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=5471</guid>

					<description><![CDATA[<p>Chinese version Article is here (Ampere Altra/AltraMax  [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2024/01/09/5471/ampere-altra-altramax-asrock-altrad8ud-1l2t-liquid-cooling-system/">Ampere Altra/AltraMax AsRock ALTRAD8UD-1L2T Liquid Cooling System</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-scaled.jpg" alt="" class="wp-image-5462" style="aspect-ratio:1.3333333333333333;width:224px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-scaled.jpg 2560w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-600x450.jpg 600w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-768x576.jpg 768w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-1536x1152.jpg 1536w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-2048x1536.jpg 2048w" sizes="(max-width: 2560px) 100vw, 2560px" /></figure></div>


<p>Chinese version Article is <a href="ttps://blog.richliu.com/2024/01/09/5446/ampere-altra-altramax-加asrock-altrad8ud-1l2t-水冷方案/">here (Ampere Altra/AltraMax 加AsRock ALTRAD8UD-1L2T 水冷方案)</a><br />2024/01<a href="https://www.servethehome.com/making-arm-desktops-viable-ampere-altra-noctua-nh-d9-amp-4926-4u-and-nh-u14s-amp-4926/" target="_blank" rel="noopener">/31 Update: Ampere will have 2U passive cooler Making Arm Desktops Viable Ampere Altra Noctua NH-D9 AMP-4926 4U and NH-U14S AMP-4926</a></p>



<p>The Ampere Altra/AltraMax CPU features a maximum of 128 ARM64 cores, typically found in cloud server. However, cloud server Care not suitable for placement in offices or homes due to the high-speed fans used for heat dissipation. The noise generated by these fans is generally intolerable for regular users. Additionally, adapting server motherboards to standard consumer motherboards is inconvenient. If there is a desire to utilize such a CPU in a different setting, the <a href="https://www.adlinktech.com/products/Computer_on_Modules/COM-HPC-Server-Carrier-and-Starter-Kit/Ampere_Altra_Developer_Platform?lang=en" target="_blank" rel="noopener">ADLink Ampere Altra Dev Platform</a> presents a viable solution, complete with the option for liquid cooling.</p>



<p>Another solution is the <a href="https://www.newegg.com/p/N82E16813140134" target="_blank" rel="noopener">AsRock ALTRAD8UD-1L2T</a>, currently available on <a href="https://www.newegg.com/p/N82E16813140134" target="_blank" rel="noopener">Newegg</a>. Paired with an Ampere Altra Q64-22 CPU (64 cores, 2.2GHz), it comes with a complimentary 2U passive heatsink, priced at US$1,500, which can be considered affordable. However, it&#8217;s worth noting that the included heatsink is passive. If you prefer liquid cooling over installing a fan on the passive heatsink, then this article is the right guide for you.</p>



<span id="more-5471"></span>



<p><br />The author have adding a declaration at the beginning of articles that may pose potential risks:</p>



<ul class="wp-block-list">
<li>This article is not an official endorsement by Ampere, Newegg, or any other mentioned merchants or vendors. It is solely a personal record.</li>



<li>The author has a business relationship related to the production of the mentioned motherboard.</li>



<li>The author is a first-time to use liquid cooling computer system , and the content may not be entirely accurate. Please be aware of potential risks.</li>



<li>This article is not an official document from Ampere or AsRock.</li>



<li>The original article is in Chinese, and the English translation is done using machine translation. Please forgive any inaccuracies in wording.</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">I am not responsible for any consequences resulting from this article; for example, losses incurred due to improper implementation of instructions provided in this article.</mark></li>
</ul>



<p>The Ampere system primarily focuses on Cloud-native CPUs, and as of now, there is no manufacturer producing general-purpose cooling systems for it. The included 2U passive heatsink in this system is designed for server use, utilizing high-speed server fans for heat dissipation. While the Q64-22 included by Newegg has lower power consumption, its only cooling method involves direct airflow from an electric fan. Alternatively, users may resort to attaching an 8-inch fan onto it. Such cooling solutions are deemed unacceptable for enthusiasts and professionals like myself.</p>



<p>If you intend to upgrade the cooling system, typical tower-type coolers require replacing the fixture on the back of the motherboard. Moreover, compatibility with the fastening mechanisms of this specific motherboard can be challenging to find. Considering that only front-facing screws can be used, the only viable cooling solution is a liquid cooling system. Therefore, I have been experimenting with a liquid cooling solution that works for this scenario. I&#8217;m sharing this information for those adventurous individuals who might encounter similar challenges, and perhaps this approach can inspire some creative solutions.</p>



<p>In the upcoming sections of this article, I will guide you on how to set up a liquid cooling system specifically tailored for the Ampere Altra on the ALTRAD8UD-1L2T motherboard. In theory, since the screw hole positions are the same, this method should be applicable to other Ampere motherboards as well. However, the focus of this content will primarily be on the ALTRAD8UD-1L2T. The article will also cover any pitfalls encountered during assembly and the items needed for the setup(Chinese website).</p>



<h2 class="wp-block-heading">Preparation</h2>



<h3 class="wp-block-heading">ALTRAD8UD-1L2T</h3>



<p><br />You can find the specifications for this motherboard online, and I won&#8217;t repeat them here. However, what might confuse some people is the term &#8220;Deep mATX.&#8221; This is a specification unique to AsRock, where they increase the depth dimension of the mATX form factor while maintaining the standard width. The purpose is to provide more space to accommodate additional components. This particular specification is commonly seen in AsRock&#8217;s server-grade motherboards.</p>



<h3 class="wp-block-heading">Chassis</h3>



<p>Generally, most computer cases should work. However, I made a mistake on my end by choosing a case that was too small. The case I purchased is the Antec P110 Silent. While it has liquid cooling mounting points, it is not suitable for adding a liquid cooling system. The internal space is too limited, lacking a designated area for securing the water pump. Additionally, the Antec P110 liquid cooling radiator cannot be placed at the top as it interferes with the motherboard. Consequently, the radiator had to be positioned at the front of the case.</p>



<p>When making a purchase, it&#8217;s crucial to choose a case that is suitable for water cooling. In more extreme cases, considering a caseless system might be an option (hopefully, this can be updated in the next release).</p>



<p>Cases designed for liquid cooling systems typically have more significant internal space to accommodate a water pump, and there is ample room for fans without obstruction. Some all-in-one water cooling designs may be more compact and might not encounter this issue.</p>



<h3 class="wp-block-heading">Liquid Cooling System</h3>



<p><br />Liquid cooling systems have some considerations to take into account:</p>



<ul class="wp-block-list">
<li>Tubing type: Choose between soft or hard tubing. Hard tubing is suitable for experienced users, offering a longer lifespan and a more aesthetic appearance. Soft tubing is easier for assembly, making it suitable for beginners.</li>



<li>All-in-one (AIO) or custom loop: Decide whether to go for a pre-assembled AIO liquid cooling system or build a custom loop system.</li>
</ul>



<p>Since the initial focus was on researching liquid cooling, the combination chosen was a custom loop with soft tubing. Building a custom loop may encounter some issues, with one of the main challenges being the uncertainty about specifications.</p>



<p>The first crucial aspect is determining the size of the liquid cooling tubing, as additional components will depend on this size, limiting the options for procurement. Currently, the mainstream sizes are two-eighths (2/8’), three-eighths (3/8’), and four-eighths (4/8’) liquid cooling tubing. </p>



<p>Another parameter is the thickness of the tubing, thick tubing and thin tubing. <br />* thick tubing refer to 10/16mm or 3/8”-5/8” tubing. <br />* thin thbing refer to 10/13mm or 3/8”-1/2″ tubing. </p>



<p>Most common  the inner diameter specification is G 1/4, when find some liquid colling componens like pressure relief valve needs it. </p>



<p>Once you&#8217;ve confirmed your inner and outer diameter, you can proceed to purchase the necessary liquid cooling components.</p>



<p>At a minimum, you&#8217;ll need:</p>



<ul class="wp-block-list">
<li>CPU water block *1</li>



<li>Water Pump *1</li>



<li>240mm radiator *1</li>



<li>12cm fans *2</li>



<li>Liquid coolant 500cc ~ 1000cc</li>



<li>Tubing 2M</li>



<li>Thermal paste</li>



<li>Pressure relief valve</li>



<li>Fittings: Quick connectors *6, 90-degree rotary fittings *(1~2)</li>



<li>Tools for filling and draining: Filling tool, draining tool (watering can, large syringe, drainage hose)</li>
</ul>



<p>Optional components:</p>



<ul class="wp-block-list">
<li>Flow meter, temperature gauge (note: buying these requires purchasing two additional quick connectors).</li>
</ul>



<p></p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="846" height="863" src="https://blog.richliu.com/wp-content/uploads/2024/01/image-9.png" alt="" class="wp-image-5448" style="aspect-ratio:0.9803012746234068;width:541px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/01/image-9.png 846w, https://blog.richliu.com/wp-content/uploads/2024/01/image-9-588x600.png 588w, https://blog.richliu.com/wp-content/uploads/2024/01/image-9-768x783.png 768w" sizes="(max-width: 846px) 100vw, 846px" /></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="651" height="637" src="https://blog.richliu.com/wp-content/uploads/2024/01/image-10.png" alt="" class="wp-image-5449" srcset="https://blog.richliu.com/wp-content/uploads/2024/01/image-10.png 651w, https://blog.richliu.com/wp-content/uploads/2024/01/image-10-600x587.png 600w" sizes="(max-width: 651px) 100vw, 651px" /></figure>



<p><br />In practical testing, if focusing solely on CPU cooling, it appears that a 240mm radiator is sufficient. The thin three-eighths (3/8”) tubing provides a large enough water flow diameter. Choosing a smaller tube diameter may not be as suitable for this purpose.</p>



<h3 class="wp-block-heading">CPU water block</h3>


<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="514" height="512" src="https://blog.richliu.com/wp-content/uploads/2024/01/image-11.png" alt="" class="wp-image-5450" style="aspect-ratio:1.00390625;width:263px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/01/image-11.png 514w, https://blog.richliu.com/wp-content/uploads/2024/01/image-11-300x300.png 300w" sizes="(max-width: 514px) 100vw, 514px" /></figure></div>


<p>This turned out to be quite troublesome. My original plan was to purchase a 50mmx50mm heatsink and connect it to the heatsink on the right. Then, I intended to secure it to the CPU socket using the fixtures shown in the image. However, as expected, unexpected issues arose – the world isn&#8217;t always that kind.</p>



<ol class="wp-block-list">
<li>There was no water block with a 50mmx50mm connector available. So, I ended up buying a 40mmx40mm connector, one size smaller. This resulted in poorer heat dissipation performance. Fortunately, I never had the chance to test the inferior heat dissipation, so this step failed unnoticed.</li>



<li>Here&#8217;s where I made a mistake. Custom water block connectors, like the one shown, are typically 2/8&#8243; fittings. However, the main liquid cooling system I bought has 3/8&#8243; fittings, making them completely incompatible. The options were either to change the fittings or change the entire system. Changing the fittings was the more cost-effective choice, so I opted for that.</li>
</ol>


<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="787" height="1050" src="https://blog.richliu.com/wp-content/uploads/2024/01/image-12.png" alt="" class="wp-image-5451" style="aspect-ratio:0.7495238095238095;width:237px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/01/image-12.png 787w, https://blog.richliu.com/wp-content/uploads/2024/01/image-12-450x600.png 450w, https://blog.richliu.com/wp-content/uploads/2024/01/image-12-768x1025.png 768w" sizes="(max-width: 787px) 100vw, 787px" /></figure></div>


<p>After connecting , it looked like the image on the right – and just looking at it made me worry that water would leak out.</p>



<p>So, I bought a two-eighths(2/8&#8243;) tubing to connect to this connector. However, while it could connect, it couldn&#8217;t link up with my three-eighths(3/8&#8243;) tubing in the water cooling system. I had to reluctantly abandon the custom water block connector.</p>



<p>The final solution had nothing to do with this connector.</p>



<p></p>



<p></p>



<h3 class="wp-block-heading">Communical CPU water block</h3>



<p>During the installation, I discovered that the Bykski CPU-XPH-T8 CPU water block, along with the provided adapter bracket, could be securely attached to the Ampere Altra&#8217;s socket. This was fantastic news and saved me a great deal of effort.</p>



<p>Although it&#8217;s designed for Intel LGA1700/LGA2066 sockets, the flexibility in its hole configuration allowed for adjustments, providing me with the necessary adaptability. As for whether other CPU brackets might be compatible, it&#8217;s likely that some could work. However, I haven&#8217;t had the chance to try others yet. If you have attempted this and found success, please let me know.</p>



<p>The base of this water block is quite substantial, and my intuition tells me that the cooling performance should be excellent. Therefore, I didn&#8217;t explore other compliant CPU water blocks.</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-1 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="1109" height="976" src="https://blog.richliu.com/wp-content/uploads/2024/01/image-16.png" alt="" class="wp-image-5455" style="aspect-ratio:1.1362704918032787;width:364px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/01/image-16.png 1109w, https://blog.richliu.com/wp-content/uploads/2024/01/image-16-600x528.png 600w, https://blog.richliu.com/wp-content/uploads/2024/01/image-16-768x676.png 768w" sizes="(max-width: 1109px) 100vw, 1109px" /></figure>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1196" height="722" src="https://blog.richliu.com/wp-content/uploads/2024/01/image-14.png" alt="" class="wp-image-5453" srcset="https://blog.richliu.com/wp-content/uploads/2024/01/image-14.png 1196w, https://blog.richliu.com/wp-content/uploads/2024/01/image-14-600x362.png 600w, https://blog.richliu.com/wp-content/uploads/2024/01/image-14-768x464.png 768w" sizes="(max-width: 1196px) 100vw, 1196px" /></figure>
</div>
</div>



<p><br />However, another issue arises. The water block is 56mmx56mm, whereas the width of the Ampere Altra CPU socket is 55mm. The water block does not fit. At this point, there are two possible solutions:</p>



<p>Upon observing the CPU&#8217;s structure, the first solution seemed unfeasible. Cutting down the thickness of this water block would compromise its structural integrity, not to mention finding the tools or a professional service for the task.</p>



<p>Thus, the only viable option is the second solution. The simplest and most intuitive way to implement this is by using a thermal pad made of silicone to transfer heat upwards from the CPU.</p>



<h3 class="wp-block-heading">Silicone Thermal Pad </h3>


<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="1286" height="707" src="https://blog.richliu.com/wp-content/uploads/2024/01/image-17.png" alt="" class="wp-image-5456" style="aspect-ratio:1.818953323903819;width:322px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/01/image-17.png 1286w, https://blog.richliu.com/wp-content/uploads/2024/01/image-17-600x330.png 600w, https://blog.richliu.com/wp-content/uploads/2024/01/image-17-768x422.png 768w" sizes="(max-width: 1286px) 100vw, 1286px" /></figure></div>


<p>But things couldn&#8217;t be as simple as I, a fool, initially thought. In conclusion, regular silicone thermal pads are not suitable for power monsters like the Ampere Altra. This type of thermal pad may be effective for low-power devices such as routers, switches, NVMe disks, etc., but it&#8217;s not useful for high-power CPUs.</p>



<p>In the image, there are 2mm thick silicone thermal pads, and you need two layers because the height is just that much. Essentially, this provides only a slight improvement over having no heat dissipation at all, so it&#8217;s not worth considering.</p>



<p>As for the high-efficiency silicone thermal pads available in the market, I don&#8217;t know if they would work. If you have them on hand, you can give them a try. However, I believe the chances of success are quite low.</p>



<h3 class="wp-block-heading"><br />Purple Copper Thermal Pad</h3>


<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="1468" height="833" src="https://blog.richliu.com/wp-content/uploads/2024/01/image-18.png" alt="" class="wp-image-5457" style="aspect-ratio:1.7623049219687874;width:317px;height:auto" srcset="https://blog.richliu.com/wp-content/uploads/2024/01/image-18.png 1468w, https://blog.richliu.com/wp-content/uploads/2024/01/image-18-600x340.png 600w, https://blog.richliu.com/wp-content/uploads/2024/01/image-18-768x436.png 768w" sizes="(max-width: 1468px) 100vw, 1468px" /></figure></div>


<p><br />Nowadays, a common method for cooling is using purple copper heat pipes. This type of heat dissipation is quite effective, and the 2U passive heatsink included with Newegg utilizes these heat pipes. Therefore, if we can customize the heatsink, wouldn&#8217;t that solve the problem? Luckily, the country right next to my country is the world&#8217;s largest manufacturing factory, capable of customizing just about anything. This made the solution very affordable and instantly resolved my problem.</p>



<p>The dimensions of the purple copper thermal pad are: Length x Width x Height = 64x54x4mm, with a rounded R5 edge.</p>



<p>Alternatively, you can measure the dimensions of the piece under the 2U passive heatsink to get the specifications. Placing it on the original heatsink, I can say the dimensions match perfectly. The craftsmanship is quite impressive, and there are no issues when it&#8217;s actually placed.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240108_235640-scaled.jpg" alt="" class="wp-image-5458" srcset="https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240108_235640-scaled.jpg 2560w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240108_235640-600x450.jpg 600w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240108_235640-768x576.jpg 768w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240108_235640-1536x1152.jpg 1536w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240108_235640-2048x1536.jpg 2048w" sizes="(max-width: 2560px) 100vw, 2560px" /></figure>



<h2 class="wp-block-heading">Assembly</h2>



<p><br />First, place the purple copper thermal pad, and remember to apply thermal paste before doing so.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240105_184648-scaled.jpg" alt="" class="wp-image-5459" srcset="https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240105_184648-scaled.jpg 2560w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240105_184648-600x450.jpg 600w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240105_184648-768x576.jpg 768w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240105_184648-1536x1152.jpg 1536w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240105_184648-2048x1536.jpg 2048w" sizes="(max-width: 2560px) 100vw, 2560px" /></figure>



<p>Apply thermal paste before placing CPU water cooling block. </p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240105_184740-scaled.jpg" alt="" class="wp-image-5460" srcset="https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240105_184740-scaled.jpg 2560w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240105_184740-600x450.jpg 600w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240105_184740-768x576.jpg 768w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240105_184740-1536x1152.jpg 1536w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240105_184740-2048x1536.jpg 2048w" sizes="(max-width: 2560px) 100vw, 2560px" /></figure>



<p><br />Assemble the components.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240105_184300-scaled.jpg" alt="" class="wp-image-5461" srcset="https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240105_184300-scaled.jpg 2560w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240105_184300-600x450.jpg 600w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240105_184300-768x576.jpg 768w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240105_184300-1536x1152.jpg 1536w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20240105_184300-2048x1536.jpg 2048w" sizes="(max-width: 2560px) 100vw, 2560px" /></figure>



<p>Actually, I assembled the tubing on the left side incorrectly. I&#8217;ll need to purchase materials and quick connectors to replace it when I have the time. But for now, let&#8217;s leave it as is and make do.</p>



<p>Overall view.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-scaled.jpg" alt="" class="wp-image-5462" srcset="https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-scaled.jpg 2560w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-600x450.jpg 600w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-768x576.jpg 768w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-1536x1152.jpg 1536w, https://blog.richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-2048x1536.jpg 2048w" sizes="(max-width: 2560px) 100vw, 2560px" /></figure>



<p> <br />This way, it&#8217;s evident that the case isn&#8217;t ideal. It&#8217;s too cramped, affecting airflow, and it cannot accommodate the components properly.</p>



<h2 class="wp-block-heading">Shopping</h2>



<p>If you are interested in replicating my setup, all the components were purchased from Taobao. I spent extra for testing and experimenting, but in reality, you should be able to set up the entire cooling system for around US$100 or NTD$3,000. This is comparable to the cost of an efficient dual-fan tower cooler.</p>



<p>Since this is a Chinese website, I&#8217;ll keep the text in Chinese and provide English translations afterward.</p>



<h3 class="wp-block-heading">Liquid Cooling System</h3>



<p><a href="https://item.taobao.com/item.htm?spm=a1z09.2.0.0.17af2e8dIZLPG3&amp;id=689355457926&amp;_u=81mce81r4a19" target="_blank" rel="noopener">watertiger定制台式机电脑分体式CPU显卡水冷软管套装冷散热器</a> (&#8220;WaterTiger Custom Desktop Computer Split-Type CPU GPU Liquid Cooling Soft Tube Kit Radiator&#8221;)<br />Enter the URL choice &#8220;單 CPU 水冷 240 冷排&#8221; (&#8220;Single CPU Liquid Cooling 240 Radiator&#8221;)</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1146" height="780" src="https://blog.richliu.com/wp-content/uploads/2024/01/image-19.png" alt="" class="wp-image-5463" srcset="https://blog.richliu.com/wp-content/uploads/2024/01/image-19.png 1146w, https://blog.richliu.com/wp-content/uploads/2024/01/image-19-600x408.png 600w, https://blog.richliu.com/wp-content/uploads/2024/01/image-19-768x523.png 768w" sizes="(max-width: 1146px) 100vw, 1146px" /></figure>



<p>At first, I chose this brand because the photos looked appealing, but it turned out to be a fortunate coincidence that saved me a lot of exploration time. This brand integrates various components into a set for sale, and the components they use are of decent quality. For example, they use the Enermax NEOChanger as the water pump, which is also a good pump. If you are familiar enough, you might not need these kits.</p>



<p>This kit does not include a pressure relief valve. You&#8217;ll need to purchase a pressure relief valve separately, and depending on your needs, you might want to buy additional quick connectors</p>



<h3 class="wp-block-heading">Clamping Fittings</h3>



<p>All the components can be purchased from the same place, saving the hassle of searching everywhere. It&#8217;s a good idea to buy a few extra parts to avoid trouble later on. The time cost is much higher than the cost of the components.</p>



<p><a href="https://item.taobao.com/item.htm?_u=81mce81r8034&amp;id=38513060164&amp;spm=a1z09.2.0.0.17af2e8dIZLPG3" target="_blank" rel="noopener">电脑水冷头扣具卡具CPU显卡南北桥固定笔记本散热器压条五金夹具</a> (&#8220;Computer Water Cooling Head Fastening Fixture, CPU GPU North-South Bridge Fixing, Laptop Heatsink Clamp, Hardware Clamp&#8221;)</p>



<p>Choice 台式机CPU冷头扣具(&#8220;Desktop CPU Cooling Head Fastening Fixture&#8221;) *2 </p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="543" height="358" src="https://blog.richliu.com/wp-content/uploads/2024/01/image-20.png" alt="" class="wp-image-5464"/></figure>



<p><br /><a href="https://item.taobao.com/item.htm?_u=81mce81rb354&amp;id=39519155251&amp;spm=a1z09.2.0.0.17af2e8dIZLPG3" target="_blank" rel="noopener">M2 M3 M4不锈钢平头盘头螺丝钉水冷头水冷排机箱风扇安装长螺丝</a> (&#8220;M2 M3 M4 Stainless Steel Flat Head Countersunk Screws for Water Cooling Head, Radiator, Case Fan Installation &#8211; Long Screws&#8221;)</p>



<p>Fastening fixtures for securing CPU coolers and water blocks. The components can be increased based on requirements. The minimum required quantity includes<br />M3手拧螺母 (M3 thumb nuts)*4，M3*30 (M3 screws) *4 ，M3垫片(M3 washers) *4  ，M3六角螺母(M3 hex nuts) *4<br /></p>



<p><a href="https://item.taobao.com/item.htm?spm=a1z09.2.0.0.17af2e8dIZLPG3&amp;id=538187007087&amp;_u=81mce81r8677" target="_blank" rel="noopener">电脑水冷水流计 液冷散热器流量器 流体温度观测器透明水流指示计</a> (&#8220;Computer Liquid Cooling Flow Meter, Liquid Cooler Flow Indicator, Fluid Temperature Monitor Transparent Flow Meter&#8221;) (option)</p>



<p>Choice: 3孔水流观测器 + 温度计 (&#8220;3-Port Flow Meter + Thermometer for Water Flow Observation&#8221;)</p>



<p>Nice to have items, but it can make me feel better. </p>



<h2 class="wp-block-heading">Test Result</h2>



<p>This system feels relatively quiet and not noisy.</p>



<p>The following tests are only for verifying the liquid cooling setup and are not formal performance tests. The results are provided for liquid cooling reference and do not include testing power consumption, etc.</p>



<p>Room temperature: 25 degrees Celsius<br />CPU : Ampere AltraMax 128-30<br />Run command :  stress-ng &#8211;cpu 128 &#8211;iomix 128 &#8211;vm 128</p>



<p>Gentoo Linux kernel 6.6 ，CPU temperature is approximately，Power consumption CPU 150W/ IO 19W<br />Ubuntu 22.04 kernel 6.2(?)，CPU temperature is approximately 72 degrees，Power consumption CPU 178W/ IO 20W</p>



<p>In conclusion, I hope this article has been helpful for those eager to try it out.</p>



<h2 class="wp-block-heading">Afterword</h2>



<p>Newegg has also listed another model, which is only the motherboard version, only US$849.-<br /><a href="https://www.newegg.com/p/N82E16813140130" target="_blank" rel="noopener">ASRock Rack ALTRAD8UD-1L2T Deep Micro-ATX Server Motherboard Singel Socket (LGA 4926) Ampere Altra Max/Ampere Altra processors Dual 10G &amp; 1G</a></p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2024/01/09/5471/ampere-altra-altramax-asrock-altrad8ud-1l2t-liquid-cooling-system/">Ampere Altra/AltraMax AsRock ALTRAD8UD-1L2T Liquid Cooling System</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2024/01/09/5471/ampere-altra-altramax-asrock-altrad8ud-1l2t-liquid-cooling-system/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>ARM64 Kubernetes Qemu Metallb Linkerd Numa</title>
		<link>https://blog.richliu.com/2023/09/17/5329/arm64-kubernetes-qemu-metallb-linkerd-numa/</link>
					<comments>https://blog.richliu.com/2023/09/17/5329/arm64-kubernetes-qemu-metallb-linkerd-numa/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sat, 16 Sep 2023 16:46:48 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[aarch64]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[kubernetes]]></category>
		<category><![CDATA[libvirt]]></category>
		<category><![CDATA[linkerd]]></category>
		<category><![CDATA[metallb]]></category>
		<category><![CDATA[numa]]></category>
		<category><![CDATA[qemu]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=5329</guid>

					<description><![CDATA[<p>Sometime I feelt hat k8s make me frustrated, Latest tim [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2023/09/17/5329/arm64-kubernetes-qemu-metallb-linkerd-numa/">ARM64 Kubernetes Qemu Metallb Linkerd Numa</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Sometime I feelt hat k8s make me frustrated,  Latest time I wrote this document is 4 years ago, that&#8217;s old version, but when I want to use k8s as container manager again, seems that something different and network won&#8217;t work, original document cannot work anymore, it needs to have new document to record that. </p>



<p>My hardware also different, if you don&#8217;t have such powerful machine, it can skip numa part, that&#8217;s only for high end ARM64 machine. <br />The hardware is <a href="https://amperecomputing.com/systems/altra/2u-mt-collins-2s-sas-3.5" target="_blank" rel="noreferrer noopener">Ampere Mt. Collins</a> which has 2*Ampere Altra 80 Cores CPU and 8*32G Memory, my experiment is run different VM on different CPU, to seperate them and lock it on different numa node. </p>



<span id="more-5329"></span>



<p>There are two CPUs, so, it can create 3 nodes, so, I have plan to allocate resource like that. <br />1. k8s master on socket 0: 10 CPUs, 16G memory <br />2. k8s node1 on socket 0 : 70 CPUs, 100G memory <br />3. k8s node2 on socket 1:  80 CPUs, 120G memory </p>



<p>Kubernetes version v1.28.2<br />Ubuntu 22.04</p>



<p><strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color">Notice: Before reading this document, this document is personal experiment, not Ampere official document, take your own risk. </mark></strong></p>



<h2 class="wp-block-heading">Prepare VM from libvirt </h2>



<p>The server has remote control system which problem sufficent resolution to use GUI on server, so, I install ubuntu 22.04 on host system, than use virt-manager to create k8s master node, for qemu image, I create the disk image alone, seems create image when run install will allocate all disk space, seems that&#8217;s a virt-manager bug. <br />And the host network is configured to be a bridge interface, in my case, that&#8217;s br0. </p>



<p>So, when uses virt-manager to create VM, it can bridge network interface to br0. </p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2125" height="1179" src="https://blog.richliu.com/wp-content/uploads/2023/09/image-1.png" alt="" class="wp-image-5330" srcset="https://blog.richliu.com/wp-content/uploads/2023/09/image-1.png 2125w, https://blog.richliu.com/wp-content/uploads/2023/09/image-1-600x333.png 600w, https://blog.richliu.com/wp-content/uploads/2023/09/image-1-768x426.png 768w, https://blog.richliu.com/wp-content/uploads/2023/09/image-1-1536x852.png 1536w, https://blog.richliu.com/wp-content/uploads/2023/09/image-1-2048x1136.png 2048w" sizes="(max-width: 2125px) 100vw, 2125px" /><figcaption class="wp-element-caption">After installed first VM, it can copy the master image to another VMs images and named it as k8s-node1 and k8s-node2. <br />need to modify the /etc/hostname, /etc/hosts and /etc/netplan/00-installer-config.yaml in the guest. <br />Remeber to change the CPU number and memory size on virt-manager GUI, different VM needs to use different VM image. it can keep other options by default. </figcaption></figure>



<h2 class="wp-block-heading">Configure the VM with Numa </h2>



<p>It can use numastat to check currnet numa status, this system has two numa nodes. it can use numastat and numactl to get more numa information.</p>



<pre class="wp-block-preformatted"># numastat -n

Per-node numastat info (in MBs):
                          Node 0          Node 1           Total
                 --------------- --------------- ---------------
Numa_Hit               591239.17       791075.41      1382314.58
Numa_Miss                   0.00            0.00            0.00
Numa_Foreign                0.00            0.00            0.00
Interleave_Hit              8.63            7.13           15.77
Local_Node             519434.17       777974.99      1297409.16
Other_Node              71805.00        13100.42        84905.42

# numactl --hardware
available: 2 nodes (0-1)
node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
node 0 size: 128377 MB
node 0 free: 80224 MB
node 1 cpus: 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
node 1 size: 126426 MB
node 1 free: 93888 MB
node distances:
node   0   1
  0:  10  20
  1:  20  10</pre>



<p>virt-manager doesn&#8217;t have advance command to assign CPU, probably modify xml can get that purpose, but it more converince to use the &#8220;virsh&#8221; cli command to adjust VM parameters. &#8220;virsh list&#8221; show current VMs, &#8220;virsh vcpupin list current VM CPU scheduling&#8221;, &#8220;virsh vcpupin <em>domain-id vcpu cpulist</em>&#8221; to modify the VCPU run on which one CPU. </p>



<p>For memory, it needs to use &#8220;virsh numatune&#8221; to lock the memory on different node. <br />&#8220;virsh numatune domain [&#8211;mode mode] [&#8211;nodeset nodeset] [[&#8211;config] [&#8211;live] | [&#8211;current]]&#8221;, &#8211;current can update current running VM machine. </p>



<pre class="wp-block-preformatted">$ virsh list
 Id   Name          State
-----------------------------
 9    k8s-master   running
 10   k8s-node1     running

$ virsh vcpupin k8s-master
 VCPU   CPU Affinity
----------------------
 0      0-159
 1      0-159
 2      0-159
 3      0-159
 4      0-159
 5      0-159
 6      0-159
 7      0-159
 8      0-159
 9      0-159

# this command can lock 9 k8s-master's VCPU 0 on physical CPU 0. 
$ virsh vcpupin 9 0 0 

# Show current VM's numatune, for example, following is unset status. 
$ virsh numatune 9
numa_mode      : strict
numa_nodeset   :

$ virsh numatune 9 --nodeset 0

# the numa_nodeset was set to 0
$ virsh numatune 9
numa_mode      : strict
numa_nodeset   : 0

</pre>



<p>The problem is, seems this script need to run everytime, alternativate solution is to modify XML, but Mt. collis has 160 cores, I won&#8217;t to modify the XML file. script is more converience on this situation, following is my sample script to adjust k8s-master, k8s-node1, and k8s-node2&#8217;s parameter, it can easy to modify it if you install other system or AltraMax CPU. </p>



<pre class="wp-block-preformatted">#!/bin/bash

configure_vm(){
        local VM_NAME="$1"
        local VM_VCPU="$2"
        local VM_CPU="$3"
        local VM_NUMA="$4"
        local VM_TYPE="$5" # VM_TYPE for MASTER or NODE0, NODE1 .. self define name

        id=$(virsh list | grep $VM_NAME | awk '{print $1}')
        state=$(virsh list | grep $VM_NAME | awk '{print $3}')

        if [ "$state" != "running" ]; then
          echo "$VM_TYPE is not running"
          exit 1
        else
          echo "configure $VM_TYPE"
        fi
        numa_nodeset=$(virsh numatune $id | grep numa_nodeset | awk '{print $3}')

        start_cpu=$(echo $VM_VCPU | cut -d'-' -f1)
        end_cpu=$(echo $VM_VCPU | cut -d'-' -f2)
        for ((vcpu = start_cpu; vcpu &lt;= end_cpu; vcpu++)); do
          # echo "$id $vcpu $VM_CPU"
          virsh vcpupin $id $vcpu $VM_CPU > /dev/null
        done
        if [ -n "$numa_nodeset" ]; then
          echo "$VM_TYPE numa_nodeset is $numa_nodeset"
        else
          # echo "$id $VM_NUMA"
          virsh numatune $id --nodeset $VM_NUMA
        fi
}

configure_vm "k8s-master" "0-9" "0-9" "0" "Master"
configure_vm "k8s-node1" "0-69" "10-79" "0" "Node0"
configure_vm "k8s-node2" "0-79" "80-159" "1" "Node1"


====

# After run the script, it can run numastat &lt;pid> to see the qemu runs numa status. ex:
$ sudo numastat 206601

Per-node process memory usage (in MBs) for PID 206601 (qemu-system-aar)
                           Node 0          Node 1           Total
                  --------------- --------------- ---------------
Huge                         0.00            0.00            0.00
Heap                        11.51            0.00           11.51
Stack                        0.04            0.00            0.04
Private                   5984.93            0.00         5984.94
----------------  --------------- --------------- ---------------
Total                     5996.48            0.00         5996.48

</pre>



<p>In here, on socket 0 , 0-9 and 0-69 is vcpu, so, all start from 0. After run this script, it can use &#8220;virsh vcpupin&#8221; and &#8220;virsh numatune&#8221; to get current setting. Maybe cpuset parameter in XML can more easy to get this function, but I have not try it. </p>



<p></p>



<h2 class="wp-block-heading">Install K8s </h2>



<p>Here is my script, just reference some later blog and my previous configurtion script, so, it can copy and paste to system and run it directly. </p>



<p>Install basic system and k8s</p>



<pre class="wp-block-preformatted"># setup timezone
sudo apt install ntpdate -y
sudo ntpdate watch.stdtime.gov.tw
sudo timedatectl set-timezone Asia/Taipei

# install and enable docker

sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/docker.gpg
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

sudo apt update
sudo apt install -y containerd.io

containerd config default | sudo tee /etc/containerd/config.toml >/dev/null 2>&amp;1
sudo sed -i 's/SystemdCgroup \= false/SystemdCgroup \= true/g' /etc/containerd/config.toml

sudo systemctl restart containerd
sudo systemctl enable containerd

echo "----------------"
echo "   swapoff"
echo "----------------"
sudo swapoff -a
sudo sed -i '/swap/ s/^\(.*\)$/#\1/g' /etc/fstab

# Install k8s
sudo apt -y install apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add
sudo apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main"
sudo apt update

sudo apt-get -y install kubelet
sudo apt-get -y install kubeadm
sudo apt-get -y install kubectl
sudo apt-mark hold kubelet kubeadm kubectl

# Update kernel parametes
cat &lt;&lt;EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
net.bridge.bridge-nf-call-iptables  = 1
net.ipv4.ip_forward                 = 1
net.bridge.bridge-nf-call-ip6tables = 1
EOF

# update sysctl
sudo sysctl --system

sudo tee /etc/modules-load.d/containerd.conf &lt;&lt;EOF
overlay
br_netfilter
EOF
sudo modprobe overlay
sudo modprobe br_netfilter

echo "if this is work node, it can run kubeadm join now"

echo "alias k=kubectl" >> .bashrc</pre>



<h3 class="wp-block-heading">Setup Master Node</h3>



<p>Run this script on master node. </p>



<pre class="wp-block-preformatted">sudo kubeadm init --pod-network-cidr=10.244.0.0/16
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

# echo "enable master to run pods"
# kubectl taint nodes --all node-role.kubernetes.io/master-
</pre>



<p>It will shows some message below, then run it on k8s-node1 and k8s-node2</p>



<p>kubeadm join 192.168.110.230:6443 &#8211;token e14f7k.35c3jpny81ry70re \</p>



<p>        &#8211;discovery-token-ca-cert-hash sha256:6636a7e4ec3542f19152f308f0789c52287b743b60efa3c13e7c23ce1147c581</p>



<p>If forgot command above, it can create another token to let other k8s node join, ex:</p>



<pre class="wp-block-preformatted">kubeadm token create --print-join-command</pre>



<h3 class="wp-block-heading">Flannel : Network fabric for container</h3>



<p>K8s need a network fabric to provide internal network topology, there are many choices, but we will install matellb later, some other network like calico might have potential issue, so, we choice flannel as network fabric.</p>



<pre class="wp-block-preformatted">kubectl apply -f https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml</pre>



<p>After run this command, the k8s node status will change to Ready, if not install network fabric, the node status will be NotReady. </p>



<pre class="wp-block-preformatted">$ kubectl get nodes
NAME         STATUS   ROLES           AGE   VERSION
k8s-master   Ready    control-plane   26h   v1.28.2
k8s-node1    Ready    &lt;none>          26h   v1.28.2
k8s-node2    Ready    &lt;none>          26h   v1.28.2</pre>



<h3 class="wp-block-heading">Helm: Kubbernetes Applications Manager</h3>



<p>Install helm to further install metallb purpose, on previous article, helm2 needs another application to connect to k8s, but helm3 doesn&#8217;t need it, more easy to use on k8s. </p>



<pre class="wp-block-preformatted">curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 -o /tmp/get_helm.sh
chmod 700 /tmp/get_helm.sh
sudo /tmp/get_helm.sh</pre>



<h3 class="wp-block-heading">Metallb: Bere metal load-balancer for K8s</h3>



<p>Install k8s on private side, it needs load-balancer to provide external IP to communication with internet or intranet. If you install Metallb, the &#8220;kubectl get svc&#8221;, the EXTERNAL-IP shows &#8220;Pending&#8221;, and k8s doesn&#8217;t response the arp on host, probably it doesn&#8217;t configure kube-proxy, it you have experience on previous metallb installtion, it might miss this part. </p>



<pre class="wp-block-preformatted">PATH=$PATH:/usr/local/bin/

helm repo add metallb https://metallb.github.io/metallb
helm --namespace metallb-system install --create-namespace metallb metallb/metallb -f metallb-values.yaml

# https://metallb.universe.tf/installation/
# see what changes would be made, returns nonzero returncode if different
kubectl get configmap kube-proxy -n kube-system -o yaml | \
        sed -e "s/strictARP: false/strictARP: true/" | \
        kubectl diff -f - -n kube-system

# actually apply the changes, returns nonzero returncode on errors only
kubectl get configmap kube-proxy -n kube-system -o yaml | \
        sed -e "s/strictARP: false/strictARP: true/" | \
        kubectl apply -f - -n kube-system
</pre>



<p>metallb-values.yaml is also different like previous setting, it needs to configure L2Advertisement on metallb, without it, your metallb won&#8217;t work. Follwing is metallb-values.yaml  file. </p>



<pre class="wp-block-preformatted">apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
  name: primary-pool
  namespace: metallb-system
spec:
  addresses:
  - 192.168.110.200-192.168.110.219

---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
  name: l2adv
  namespace: metallb-system
spec:
  ipAddressPools:
  - primary-pool
</pre>



<h3 class="wp-block-heading">Traefik: TBD</h3>



<h3 class="wp-block-heading">Linkerd</h3>



<p>Just show the install script here</p>



<pre class="wp-block-preformatted">curl --proto '=https' --tlsv1.2 -sSfL https://run.linkerd.io/install | sh

echo "export PATH=$PATH:/home/$USER/.linkerd2/bin" >> ~/.bashrc

linkerd install --crds | kubectl apply -f -
linkerd install | kubectl apply -f -
linkerd viz install | kubectl apply -f -</pre>



<h3 class="wp-block-heading">Other</h3>



<p>it can insert isolinux to host linux kernel parameter to isolate the Linux scheduling to k8s nodes. (TBD)</p>



<pre class="wp-block-preformatted">isolcpus=10-159 nohz=on nohz_full=10-159</pre>



<h2 class="wp-block-heading">Test with Nginx </h2>



<p>It can deploy nginx to test this system </p>



<pre class="wp-block-preformatted">kubectl create deploy nginx --image=nginx
kubectl expose deploy nginx --port=80 --target-port=80 --type=LoadBalancer
kubectl get svc nginx
NAME    TYPE           CLUSTER-IP      EXTERNAL-IP       PORT(S)        AGE
nginx   LoadBalancer   10.99.211.255   192.168.110.200   80:31011/TCP   25h</pre>



<p>Now, it can try to access http://192.168.110.200. <br />if want to Delete nginx deploy, run following command. </p>



<pre class="wp-block-preformatted">kubectl delete deploy nginx
kubectl delete svc nginx</pre>



<h2 class="wp-block-heading">Test Numa</h2>



<p>It can run emojivoto to test the system only runs on socket1, use it because it can general a lot of traffic between pods. </p>



<pre class="wp-block-preformatted">curl --proto '=https' --tlsv1.2 -sSfL https://run.linkerd.io/emojivoto.yml \
  | kubectl apply -f -</pre>



<p>Now it can use htop to show all CPUs, and we can see most traffic on CPU 1~10 and 81~160. There are a little CPU usage on CPU 78 and 80, but it should be Linux regular scheduling(I have not add isocpu to host CPU this time)</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1982" height="857" src="https://blog.richliu.com/wp-content/uploads/2023/09/image-2.png" alt="" class="wp-image-5338" srcset="https://blog.richliu.com/wp-content/uploads/2023/09/image-2.png 1982w, https://blog.richliu.com/wp-content/uploads/2023/09/image-2-600x259.png 600w, https://blog.richliu.com/wp-content/uploads/2023/09/image-2-768x332.png 768w, https://blog.richliu.com/wp-content/uploads/2023/09/image-2-1536x664.png 1536w" sizes="(max-width: 1982px) 100vw, 1982px" /><figcaption class="wp-element-caption">ref.<br /><a href="https://blog.richliu.com/2019/11/01/4197/arm64-kubernetes-nginx-traefik-ingress-load-balance/" target="_blank" rel="noreferrer noopener">ARM64 Kubernetes Nginx Traefik Ingress Load Balance</a><br /><a href="https://blog.richliu.com/2019/09/25/4160/install-kubernetes-on-arm64-ubuntu-18-04/" target="_blank" rel="noreferrer noopener">Install Kubernetes on ARM64 Ubuntu 18.04 (with QEMU)</a><br /><a href="https://blog.richliu.com/2020/01/14/4256/kubernetes-install-nginx-ingress-on-arm64/" target="_blank" rel="noreferrer noopener">Kubernetes install nginx-ingress on ARM64</a><br /><a href="https://metallb.universe.tf/troubleshooting/" target="_blank" rel="noreferrer noopener">TROUBLESHOOTING METALLB</a><br /><a href="https://github.com/metallb/metallb/issues/1591" target="_blank" rel="noreferrer noopener">Reassignment Duplicate IP after deleting IP pool #1591</a><br /><a href="https://access.redhat.com/documentation/zh-tw/red_hat_enterprise_linux/7/html/virtualization_tuning_and_optimization_guide/sect-virtualization_tuning_optimization_guide-numa-numa_and_libvirt" target="_blank" rel="noreferrer noopener">9.3. libvirt NUMA Tuning</a><br /></figcaption></figure>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2023/09/17/5329/arm64-kubernetes-qemu-metallb-linkerd-numa/">ARM64 Kubernetes Qemu Metallb Linkerd Numa</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2023/09/17/5329/arm64-kubernetes-qemu-metallb-linkerd-numa/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>multichase on Centos 8 Compile Issue</title>
		<link>https://blog.richliu.com/2022/11/08/4934/multichase-on-centos-8-compile-issue/</link>
					<comments>https://blog.richliu.com/2022/11/08/4934/multichase-on-centos-8-compile-issue/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Tue, 08 Nov 2022 07:25:53 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[static]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=4934</guid>

					<description><![CDATA[<p>muttichase is a google open source tool which can run l [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2022/11/08/4934/multichase-on-centos-8-compile-issue/">multichase on Centos 8 Compile Issue</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>muttichase is a google open source tool which can run latency, bandwidth and loader-latency tool,<br />it can support both x86 and ARM64 platforms. <br />but it will have compile error on CentOS 8 </p>



<p>root cause is this package needs static lib support, but regular CentOS doesn&#8217;t have it. </p>



<pre class="wp-block-preformatted"># make                                                                             cc -g -O3 -static -pthread  multichase.o permutation.o arena.o util.o  -lrt -lm -o multichase
/usr/bin/ld: cannot find -lrt                                                                                 /usr/bin/ld: cannot find -lm                                                                                  /usr/bin/ld: cannot find -lpthread
/usr/bin/ld: cannot find -lc                                                                                  collect2: error: ld returned 1 exit status                                                                    make: *** [&lt;builtin>: multichase] Error 1</pre>



<span id="more-4934"></span>



<p>Install necessary package and download the source code </p>



<pre class="wp-block-preformatted"># Install necessary package
yum install git
yum groupinstall "Development Tools"

# Download source code
git clone https://github.com/google/multichase

# Install epel
dnf config-manager --set-enabled powertools
dnf install epel-release epel-next-release

# Install static library 
yum install glibc-static</pre>



<p>ref.<br /><a href="https://docs.fedoraproject.org/en-US/epel/#_el8" target="_blank" rel="noreferrer noopener">Extra Packages for Enterprise Linux (EPEL)</a></p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2022/11/08/4934/multichase-on-centos-8-compile-issue/">multichase on Centos 8 Compile Issue</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2022/11/08/4934/multichase-on-centos-8-compile-issue/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Linux Kernel Install Fail Because Broadcom NetXtreme 100G DKMS Driver Build Failed.</title>
		<link>https://blog.richliu.com/2022/09/27/4830/linux-kernel-install-fail-because-broadcom-netxtreme-100g-dkms-driver-build-failed/</link>
					<comments>https://blog.richliu.com/2022/09/27/4830/linux-kernel-install-fail-because-broadcom-netxtreme-100g-dkms-driver-build-failed/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Tue, 27 Sep 2022 08:14:23 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[aarch64]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[broadcom]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Driver]]></category>
		<category><![CDATA[kernel]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=4830</guid>

					<description><![CDATA[<p>Environment is CentOS 8, broadcom 100G NetXtreme-E seri [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2022/09/27/4830/linux-kernel-install-fail-because-broadcom-netxtreme-100g-dkms-driver-build-failed/">Linux Kernel Install Fail Because Broadcom NetXtreme 100G DKMS Driver Build Failed.</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Environment is CentOS 8, broadcom 100G NetXtreme-E series driver . <br />Host : Ampere Altra Platform <br /><br />if rebuild the CentOS kernel and there was previous Broadcom nic driver alredy installed, it will trigger dkms to rebuild the driver on current kernel. <br /><br />make install error as following</p>



<span id="more-4830"></span>



<pre class="wp-block-preformatted">[root@localhost linux-4.18.0-80.11.2.el8_0]# make install                                            [55/2101]
/bin/sh ./arch/arm64/boot/install.sh 4.18.0 \
arch/arm64/boot/Image System.map "/boot"
dkms: running auto installation service for kernel 4.18.0
Deprecated feature: REMAKE_INITRD
Deprecated feature: REMAKE_INITRD
Deprecated feature: REMAKE_INITRD
Sign command: /lib/modules/4.18.0/build/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub                                                               Deprecated feature: REMAKE_INITRD                                                                             
Building module:
Cleaning build area...(bad exit status: 2)
make -j160 KERNELRELEASE=4.18.0 -C /lib/modules/4.18.0/build M=/var/lib/dkms/bnxt_en/1.10.2.221.0.114.0/build
KVER=4.18.0...(bad exit status: 2)
Error! Bad return status for module build on kernel: 4.18.0 (aarch64)
Consult /var/lib/dkms/bnxt_en/1.10.2.221.0.114.0/build/make.log for more information.
Sign command: /lib/modules/4.18.0/build/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub
Deprecated feature: REMAKE_INITRD

Building module:
Cleaning build area...(bad exit status: 2)
make -j160 KERNELRELEASE=4.18.0 -C /lib/modules/4.18.0/build M=/var/lib/dkms/bnxt_re/221.0.114.0/build KVER=4$
18.0 BNXT_EN_INC=/var/lib/dkms/bnxt_re/221.0.114.0/source BNXT_QPLIB_INC=/var/lib/dkms/bnxt_re/221.0.114.0/so$
rce...(bad exit status: 2)
Error! Bad return status for module build on kernel: 4.18.0 (aarch64)
Consult /var/lib/dkms/bnxt_re/221.0.114.0/build/make.log for more information.
 Done.
</pre>



<p>And check the log file &#8220;/var/lib/dkms/bnxt_re/221.0.114.0/build/make.log&#8221;<br /><br />It shows </p>



<pre class="wp-block-preformatted">DKMS make.log for bnxt_en-1.10.2.221.0.114.0 for kernel 4.18.0 (aarch64)
Tue Sep 27 15:41:04 CST 2022
Makefile:603: arch/aarch64/Makefile: No such file or directory
make[2]: *** No rule to make target 'arch/aarch64/Makefile'.  Stop.
</pre>



<p>Seems cannot find the Makefile, that because the drvier cannot locate right Makefile, because the include architecture is arm64, not aarch64 in Linux kernel . <br /><br />By the way, basicly arm64 and aarch64 are the same thing, I don&#8217;t know why it shows aarch64 on kernel architecture and use arm64 as fold name. probably some traditional history. <br /><br />solution is easy, go to the include folder and link arm64 to aarch, DONE! ex:</p>



<pre class="wp-block-preformatted">cd /lib/modules/4.18.0/build/arch
ln -sf arm64 aarch64
</pre>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2022/09/27/4830/linux-kernel-install-fail-because-broadcom-netxtreme-100g-dkms-driver-build-failed/">Linux Kernel Install Fail Because Broadcom NetXtreme 100G DKMS Driver Build Failed.</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2022/09/27/4830/linux-kernel-install-fail-because-broadcom-netxtreme-100g-dkms-driver-build-failed/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ampere Altra Mt. Jade OpenBMC and EDKII build guide on ARM64 platform</title>
		<link>https://blog.richliu.com/2022/06/23/4601/ampere-altra-mt-jade-openbmc-build-guide-on-arm64-platform/</link>
					<comments>https://blog.richliu.com/2022/06/23/4601/ampere-altra-mt-jade-openbmc-build-guide-on-arm64-platform/#comments</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Thu, 23 Jun 2022 05:31:55 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[Computer/Technical]]></category>
		<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[Ampere Computing]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[EDKII]]></category>
		<category><![CDATA[OpenBMC]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=4601</guid>

					<description><![CDATA[<p>Ampere announce Altra CPU, it&#8217;s a 80 cores ARM64v [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2022/06/23/4601/ampere-altra-mt-jade-openbmc-build-guide-on-arm64-platform/">Ampere Altra Mt. Jade OpenBMC and EDKII build guide on ARM64 platform</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Ampere announce Altra CPU, it&#8217;s a 80 cores ARM64v8 CPU for cloud native workloads. Altra Max CPU is 128 cores. Follow the CPU, Ampere also has a CRB (customer reference board) named Mt. Jade, and Ampere also open source OpenBMC and EDKII source code for Mt. Jade platform. <br /><br />This article is personal note, all information can be found from internet. And open source project keeps going, it might be some minor differences when you find this article. </p>



<div class="wp-block-rank-math-toc-block" id="rank-math-toc"><h2>Table of Contents</h2><nav><ul><li><a href="#before-build-source-code">Before Build Source Code</a></li><li><a href="#prepare-build-environment">Prepare Build Environment</a><ul><li><a href="#get-the-ubuntu-18-04-cloud-image">Get the Ubuntu 18.04 cloud image</a></li><li><a href="#prepare-hostname-and-userdata-for-vm">Prepare hostname and userdata for VM</a></li></ul></li><li><a href="#build-mt-jade-edkii">Build Mt. Jade EDKII</a><ul><li><a href="#prepare-vm-environment">Prepare VM environment</a></li><li><a href="#get-build-environment">Get build environment</a></li><li><a href="#build-and-sign-the-image">Build and Sign the image</a></li><li><a href="#manual-build-edkii">Manual Build EDKII</a></li></ul></li><li><a href="#build-mt-jade-open-bmc">Build Mt. Jade OpenBMC</a></li><li><a href="#prepare-build-environment-1">Prepare build environment</a></li><li><a href="#build-open-bmc">Build OpenBMC</a></li><li><a href="#upgrade-firmware">Upgrade Firmware</a><ul><li><a href="#update-open-bmc-firmware">Update OpenBMC firmware</a><ul><li><a href="#update-via-url">Update via URL</a></li><li><a href="#update-via-ssh">Update via SSH</a></li></ul></li><li><a href="#update-uefi-firmware">Update UEFI firmware</a></li><li><a href="#update-scp-firmware">Update SCP firmware</a></li></ul></li><li><a href="#serial-console">Serial Console</a></li><li><a href="#reference">Reference</a></li><li><a href="#error-message">Error Message</a><ul><li><a href="#error-templateconf-value-which-is-nvme-openbmc-meta-ampere-meta-mitchell-must-point-to-meta-some-layer-conf-templates-template-name">Error: TEMPLATECONF value (which is /nvme/openbmc/meta-ampere/meta-mitchell) must point to meta-some-layer/conf/templates/template-name</a></li><li><a href="#initializing-oe-build-env">Initializing OE build env</a></li><li><a href="#">
</a></li></ul></li></ul></nav></div>



<span id="more-4601"></span>



<h2 class="wp-block-heading" id="before-build-source-code">Before Build Source Code</h2>



<p>This procedure runs on ARM64 platform, it should be also run on x86 platform, but I have not try it. <br /><br />Build environment : Ampere eMAG CPU (32 cores) with 256G DRAM and uses 64G/128G RAM to build code, sometime if it cannot finsih compile tasks, probably your DRAM is not sufficient to build the code, I tried 16G and it doesn;t work.<br /><br />Because host is running Ubuntu 22.04, and OpenBMC and EDKII only can be built on Ubuntu 18.04, so, it needs to use either virtual machine or contianer technologies to have Ubuntu 18.04 environment. <br /><br />This note uses qemu to prepare build environment, tried docker but it doesn&#8217;t work, probably I will re-try it someday. </p>



<p>If use NFS or qemu overlayers filesystem to bridge folders ourside into VM, it might cause build problem, so, please increase disk size for you virtual machine virtual disk size, use nfs or share folder for copy images or source code only. <br /><br />If want to build a workable EDKII code and run it on Ampere Mt. Jade platform, it needs to have Ampere fimware ATF and SCP binary, it might register Ampere customer connect to download those image files, without it, it only can build OpenBMC binary. </p>



<h2 class="wp-block-heading" id="prepare-build-environment">Prepare Build Environment </h2>



<h3 class="wp-block-heading" id="get-the-ubuntu-18-04-cloud-image">Get the Ubuntu 18.04 cloud image</h3>



<pre class="wp-block-preformatted">$ wget https://cloud-images.ubuntu.com/releases/bionic/release/ubuntu-18.04-server-cloudimg-arm64.img
$ sudo apt install qemu-efi</pre>



<h3 class="wp-block-heading" id="prepare-hostname-and-userdata-for-vm">Prepare hostname and userdata for VM</h3>



<p>it needs to prepare two files, meta-file and user-data, following is example for meta-file </p>



<pre class="wp-block-preformatted">instance-id: Image-openbmc
local-hostname: openbmc
</pre>



<p>user-data file, this example username is ubuntu, password is ubuntu</p>



<pre class="wp-block-preformatted">#cloud-config
password: ubuntu
chpasswd: { expire: False }
ssh_pwauth: True
ssh_authorized_keys:
  - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+Y/6m4XFeEGKqR2H7wbsUQUVWvB0gC/+CeJqfyvOX++SETKapFtI5CiidkyW/B1GQM4XUlmE9zPlCAcolPfMpXB0CNQQ5l0F5Z+FW6b4RVjFV/KEcQ7R3XkKRa0XhC6hKkNc5P95fNhXr8Do1bSEmd9mPIiOrFaUEZ9EReO+ZTsGsytFIuQV8rOZfQjClktXrqk3F6jJ+TV3THcVNpKvnLfps56Hc/j9jdiadLv91yuifz4lCMbv/D/0hMtf4KhN5tV//QRgUxEUeC7aPW6sKD2GMYMxc9UsSyRRQ9IFWjJMkgzKyuxgNKe7u4WjERFoxEUrmFK01UsrX+lRw9e9n user@hostname
</pre>



<p>Than, it can create a configure file for QEMU</p>



<pre class="wp-block-preformatted">$ cloud-localds -v cloudinit.img user-data meta-file</pre>



<p>Increase Ubuntu cloud image disk size, bigger is better, suggest more than 200G, minimal should be around 100G.</p>



<pre class="wp-block-preformatted">$ qemu-img resize ubuntu-18.04-server-cloudimg-arm64.img +200G</pre>



<p>Prepare UEFI BIOS and storage for booting</p>



<pre class="wp-block-preformatted">dd if=/dev/zero of=flash0.img bs=1M count=64
dd if=/usr/share/qemu-efi/QEMU_EFI.fd of=flash0.img conv=notrunc
dd if=/dev/zero of=flash1.img bs=1M count=64</pre>



<p>Running the VM script, it will also create a QEMU virtfs for file sharing, but do not use that folder to build code. How to access share folder, it can reference this article <a href="https://blog.richliu.com/2017/09/25/2173/qemu-share-directory-with-host-without-networking/" target="_blank" rel="noreferrer noopener">QEMU Share Directory with Host Without Networking</a></p>



<p></p>



<pre class="wp-block-preformatted">IMAGE1=ubuntu-18.04-server-cloudimg-arm64.img
sudo qemu-system-aarch64 -name vm1 \
         -machine virt,gic_version=3,accel=kvm,usb=off \
         -cpu host -m 128G \
         -smp 32,sockets=1,cores=32,threads=1 \
         -nographic -nodefaults \
         -pflash flash0.img -pflash flash1.img \
         -drive file=$IMAGE1,if=none,id=disk1 \
         -device virtio-blk-device,drive=disk1 \
         -drive file=cloudinit.img,if=virtio,format=raw \
         -virtfs local,path=/nvme/obmc,mount_tag=host0,security_model=passthrough,id=host0 \
         -netdev tap,id=net0,ifname=tap0 \
         -device virtio-net-device,netdev=net0,mac=52:54:00:11:11:12 \
         -serial telnet::9001,server,nowait &gt; guest_log-1.txt 2&gt;&gt; guest_log-1.txt
</pre>



<h2 class="wp-block-heading" id="build-mt-jade-edkii">Build Mt. Jade EDKII</h2>



<h3 class="wp-block-heading" id="prepare-vm-environment">Prepare VM environment</h3>



<p>After login into VM, it needs to install software to compile EDKII. <br />Command to install basic packages. </p>



<pre class="wp-block-preformatted">sudo apt update 
sudo apt install -y git vim tmux lftp net-tools ethtool bc
sudo apt install -y \
  build-essential uuid-dev acpica-tools nasm \
  python3 python3-distutils python3-pip \
  gawk
sudo apt install -y libssl-dev gnu-efi
sudo apt install bison flex
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1</pre>



<p>Next step is follow this document to download Ampere EDKII source code  and setup enviroment. <br />https://github.com/AmpereComputing/edk2.git<br /><br />First, prepare build environment parameters, if VM reboot, it needs to re-run it. </p>



<pre class="wp-block-preformatted">export WORKSPACE=/nvme/tianocore<br />mkdir -p $WORKSPACE<br />cd $WORKSPACE<br /><s>export PACKAGES_PATH=$PWD/edk2:$PWD/edk2-platforms</s><br /># PACKAGES_PATH is default include path, sometimes miss package can include more directories here. <br /># if still cannot find some files, try to run submodules command on next step again. <br />export PACKAGES_PATH=$PWD/edk2:$PWD/edk2-platforms:$PWD/edk2-non-osi/:$PWD/edk2-platforms/Features/</pre>



<p>Chang into that folder, clone Ampere Computiner edk2 source code. </p>



<pre class="wp-block-preformatted">cd $WORKSPACE
git clone https://github.com/AmpereComputing/edk2.git
cd edk2
git submodule init &amp;&amp; git submodule update
cd ..
git clone https://github.com/AmpereComputing/edk2-platforms.git</pre>



<h3 class="wp-block-heading" id="get-build-environment">Get build environment</h3>



<p>This step is to build the basic tools.</p>



<pre class="wp-block-preformatted">cd $WORKSPACE
. edk2/edksetup.sh

# Build BaseTool, only need to run once 
make -C edk2/BaseTools </pre>



<p>After compiled the EDK2 basic tool, next step is to prepare edk2-platforms and edk2-ampere-tools <br /><br />edk2-ampere-tools has a very good build script, <br />it can help to build the EDK2 and also package ATF into together. <br />we will introduct it on following steps. </p>



<pre class="wp-block-preformatted">cd edk2-platforms
git checkout -b test remotes/origin/ampere

# make a link to library to fix some problem
ln -sf /nvme/tianocore/edk2-platforms/Features/Intel/OutOfBandManagement .
cd ..
git clone https://github.com/AmpereComputing/edk2-ampere-tools
</pre>



<h3 class="wp-block-heading" id="build-and-sign-the-image">Build and Sign the image</h3>



<p>Because current tree Atftool migrate to OpenSSL 3.0, and Ubuntu 18.04 still use OpenSSL 1.0x, <br />I choice to roll back to old version to support OpenSSL 1.0x, support it can build Atftool on Ubuntu 22.04 or compile OpenSSL 3.0 manually, I might try it later. </p>



<pre class="wp-block-preformatted">cd /nvme/tianocore 
mkdir -p AtfTools
cd AtfTools
git init
git remote add origin -f https://github.com/ARM-software/arm-trusted-firmware.git
git config core.sparseCheckout true

echo -ne "include/tools_share\nmake_helpers\ntools/cert_create\ntools/fiptool" &gt; .git/info/sparse-checkout

git -C . checkout --track origin/master
# Due to current AtfTool only support OpenSSL 3.0 , switch to previous version 
git checkout -b test b94bf967e62b23a376a5026de69d06a0e8d6bf78
make -C tools/cert_create CRTTOOL=cert_create
$ make -C tools/fiptool FIPTOOL=fiptool</pre>



<p>configure PATH to  fiptool and cert_create</p>



<pre class="wp-block-preformatted">cd /nvme/tianocore
export PATH=$PATH:$PWD/AtfTools/tools/cert_create:$PWD/AtfTools/tools/fiptool
</pre>



<p>This step is parepare Mt. Jade ATF and SCP binary for compile, it needs to get both binary file from <a href="https://connect.amperecomputing.com/" target="_blank" rel="noreferrer noopener">Ampere customer connect</a>. and also suggest to use the same version as OpenBMC/EDKII</p>



<pre class="wp-block-preformatted">cd $WORKSPACE
mv &lt;path to&gt;/altra_atf_signed_2.06.20220426.slim .
mv &lt;path to&gt;/altra_scp_signed_2.06.20220426.slim .
cd edk2-ampere-tools
./edk2-build.sh -b RELEASE Jade --atf-image $WORKSPACE/altra_atf_signed_2.06.20220426.slim --scp-image $WORKSPACE/altra_scp_signed_2.06.20220426.slim</pre>



<p>If everything is perfect, the binary code would be looks like below. </p>



<pre class="wp-block-preformatted">Results: /nvme/tianocore/edk2-ampere-tools/BUILDS/jade_tianocore_atf_2.06.100
total 45888
-rw------- 1 root   root       3343 Jun 15 12:40 dbukey.auth
-rw------- 1 root   root       2002 Jun 15 12:40 del_dbukey.auth
-rw-r--r-- 1 root   root       2008 Jun 15 12:38 jade_board_setting.bin
-rw-rw-r-- 1 ubuntu ubuntu    14532 Jun 15 04:08 jade_board_setting.txt
-rw-r--r-- 1 root   root     670845 Jun 15 12:40 jade_scp_2.06.100.cap
-rw-r--r-- 1 root   root     262144 Jun 15 12:40 jade_scp_2.06.100.dbu.sig.img
-rw-r--r-- 1 root   root    8126464 Jun 15 12:38 jade_tianocore_2.06.100.fd
-rw-r--r-- 1 root   root   14040229 Jun 15 12:40 jade_tianocore_atf_2.06.100.cap
-rw-r--r-- 1 root   root   13631488 Jun 15 12:40 jade_tianocore_atf_2.06.100.dbu.sig.img
-rw-r--r-- 1 root   root   10225352 Jun 15 12:38 jade_tianocore_atf_2.06.100.img
------------------------------------------------------------
                          Ampere Jade (AARCH64) RELEASE pass
------------------------------------------------------------
pass    1
fail    0</pre>



<p id="block-c791d1c4-9fd3-4983-bb20-21d321ee9683">It can use the jade_tianocore_atf_2.06.100.img for firmware update. </p>



<p>Note:  When latest time I compile the edkII binary, latest version will fail to build, it need to roll back to previous version. </p>



<h3 class="wp-block-heading" id="manual-build-edkii">Manual Build EDKII</h3>



<p>If still want to build EDKII manually, here is some command can help you. </p>



<pre class="wp-block-preformatted">cd edk2-platform
build -a AARCH64 -t GCC5 -b RELEASE -D SECURE_BOOT_ENABLE -p Platform/Ampere/JadePkg/Jade.dsc
or to use all CPU to compile the EDKII.
build -n `nproc` -a AARCH64 -t GCC5 -b RELEASE -D SECURE_BOOT_ENABLE -p Platform/Ampere/JadePkg/Jade.dsc</pre>



<p>the generated image on $WORKSPACE/Build/Jade/RELEASE_GCC5/FV/BL33_JADE_UEFI.fd,<br />for this case, on the /nvme/tianocore/Build/Jade/RELEASE_GCC5/FV/BL33_JADE_UEFI.fd</p>



<p>then, it needs to use ampere special tool to generate EDKII image with Ampere ATF image.</p>



<h2 class="wp-block-heading" id="build-mt-jade-open-bmc">Build Mt. Jade OpenBMC</h2>



<h2 class="wp-block-heading" id="prepare-build-environment-1">Prepare build environment</h2>



<p>Before build OpenBMC, it needs to install necessary packages, <br />it can build both OpenBMC and EDKII on the same VM, or it can build it on different VM. <br /><br />Following is necessary packages for OpenBMC.</p>



<pre class="wp-block-preformatted">$ sudo apt-get install -yy \
     build-essential \
     chrpath \
     cpio \
     debianutils \
     diffstat \
     gawk \
     git \
     iputils-ping \
     libdata-dumper-simple-perl \
     liblz4-tool \
     libsdl1.2-dev \
     libthread-queue-any-perl \
     locales \
     python \
     python3 \
     socat \
     subversion \
     texinfo \
     wget \
     zstd</pre>



<p>Download Open BMC source code and OpenBMC build script. </p>



<pre class="wp-block-preformatted">$ cd /nvme
$ git clone https://github.com/ampere-openbmc/openbmc.git
$ git clone https://github.com/openbmc/openbmc-build-scripts.git
</pre>



<p>modify openbmc-build-scripts/build-setup.sh around line #140, <br />replace &#8220;Clone in openbmc master to ${obmc_dir}&#8221; to https://github.com/ampere-openbmc/openbmc.git<br /><br />it can download right source code. </p>



<pre class="wp-block-preformatted">git clone ${branch} https://github.com/ampere-openbmc/openbmc.git</pre>



<p>If you use more than 32 cores to build the source code, it might cause compile fail because some compile tool might have problem on build code on ARM64 massive code. A easy way to check that is run dmesg to check whether Linux kernel has OOM killer on some package compile fail message like nodejs.<br /><br />Limited CPU number to 32 , modify openbmc-build-scripts/build-setup.sh, on line 84. </p>



<pre class="wp-block-preformatted"> 84 # num_cpu=${num_cpu:-$(nproc)}
 85 num_cpu=32
</pre>



<h2 class="wp-block-heading" id="build-open-bmc">Build OpenBMC</h2>



<p>This step is to prepare test build environment </p>



<pre class="wp-block-preformatted">$ cd /nvme
$ target=mtjade WORKSPACE=/nvme/openbmc branch="--branch ampere --single-branch" ./openbmc-build-scripts/build-setup.sh</pre>



<p>Setup openbmc machine type to mt. Jade and compile OpenBMC. </p>



<pre class="wp-block-preformatted">$ <s>export TEMPLATECONF=meta-ampere/meta-jade</s>
$ export TEMPLATECONF=meta-ampere/meta-jade/conf/templates/default/
$ export TMPDIR=/nvme/temp
$ export LC_ALL=en_US.UTF-8

$ cd /nvme/openbmc
$ . openbmc-env
$ cd ..
$ source ./setup mtjade
$ bitbake obmc-phosphor-image
</pre>



<p>if system it mt.mitchell</p>



<pre class="wp-block-preformatted">$ export TEMPLATECONF=meta-ampere/meta-mitchell/conf/templates/default/
$ export TMPDIR=/nvme/temp
$ export LC_ALL=en_US.UTF-8

$ cd /nvme/openbmc
$ . openbmc-env
$ cd ..
$ source ./setup mtmitchell-dcscm
$ bitbake obmc-phosphor-image</pre>



<p>When compile, there is an openocd compile error, it cannot access to original website probably caused by the website was down. Temperory solutoin is to remove the package. <br />modify file meta-ampere/meta-common/recipes-ac01/packagegroups/packagegroup-ampere-apps.bb, find openocd and delete it, down. </p>



<p>When finish compile, the binary will locate on tmp/deploy/images/mtjade/, absoult path is /nvme/openbmc/build/mtjade/tmp/deploy/images/mtjade/<br /><br />ex: (only list partical files)</p>



<pre class="wp-block-preformatted">obmc-phosphor-image-mtjade-20220616040212.rootfs.manifest
obmc-phosphor-image-mtjade-20220616040212.rootfs.squashfs-xz
obmc-phosphor-image-mtjade-20220616040212.static.mtd
obmc-phosphor-image-mtjade-20220616040212.static.mtd.all.tar
obmc-phosphor-image-mtjade-20220616040212.static.mtd.tar
obmc-phosphor-image-mtjade-20220616040212.testdata.json
obmc-phosphor-image-mtjade.jffs2
obmc-phosphor-initramfs-mtjade-20220616004506.rootfs.cpio.xz
obmc-phosphor-initramfs-mtjade-20220616004506.rootfs.manifest
obmc-phosphor-initramfs-mtjade-20220616004506.testdata.json
</pre>



<p>obmc-phosphor-image-mtjade-20220616040212.static.mtd.tar is firmware file, it contain both obmc-phosphor-image-mtjade-20220616040212.static.mtd and obmc-phosphor-image-mtjade-20220616040212.rootfs.manifest files, and can be used for next step : firmware update.</p>



<h2 class="wp-block-heading" id="upgrade-firmware">Upgrade Firmware</h2>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">*Notice: Update flash will take your own risk, especially physical damage your hardware.. </span></strong> <br /><br />If Mt. Jade is using AMI bios, suggest to use flash burner to update the OpenBMC firmware. <br />What I am using is GZU EZP XPro , it&#8217;s very cheap, only needs around US$30.- (please also purchase the SPI flash socket). <br /><br />This step need to un-plug BMC flash from Mt. Jade motherboard, please remeber the flash pin 1 location, it needs to follow the original position and put it back to socket. If you miss you will broken it. <br /></p>



<h3 class="wp-block-heading" id="update-open-bmc-firmware">Update OpenBMC firmware</h3>



<p>ref. <a href="https://github.com/openbmc/docs/blob/master/architecture/code-update/code-update.md" target="_blank" rel="noopener">OpenBMC Code Update</a></p>



<h4 class="wp-block-heading" id="update-via-url">Update via URL</h4>



<p>Suppose that it already has OpenBMC firmware, it can use software to upgrade firmware ,<br />first step is to get web token, then use this token on next step to upgrade firmware. <br /><br />Following is a simple script to upgrade flash, it can be integrated into your script. </p>



<pre class="wp-block-preformatted">export BMC_IP=192.168.1.190
export FWFILE=obmc-phosphor-image-mtjade-20220616040212.static.mtd.tar

export token=`curl -k -H "Content-Type: application/json" -X POST https://${BMC_IP}/login -d '{"username" :  "root", "password" :  "0penBmc"}' | grep token | awk '{print $2;}' | tr -d '"'`

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    84  100    37  100    47    116    147 --:--:-- --:--:-- --:--:--   264


curl -k -H "X-Auth-Token: $token" \
       -H "Content-Type: application/octet-stream" \
       -X POST -T ${FWFILE} \
        https://${BMC_IP}/redfish/v1/UpdateService

{
  "@odata.id": "/redfish/v1/TaskService/Tasks/1",
  "@odata.type": "#Task.v1_4_3.Task",
  "Id": "1",
  "TaskState": "Running",
  "TaskStatus": "OK"
}</pre>



<p>If  conosle doesn&#8217;t not update and reboot, please use console login the OpenBMC and run &#8220;reboot&#8221; manually. <br />It will show message like below on OpenBMC console. </p>



<pre class="wp-block-preformatted">Updating kernel...
Erasing block: 69/69 (100%)
Writing kb: 4397/4397 (100%)
Verifying kb: 4397/4397 (100%)
Updating rofs...
Erasing block: 366/366 (100%)
Writing kb: 11580/23376 (49%)
</pre>



<h4 class="wp-block-heading" id="update-via-ssh">Update via SSH</h4>



<p>Just update firmware (ex: obmc-phosphor-image-mtjade-20220616040212.static.mtd.tar) to BMC&#8217;s directory /tmp/images , it will shows a hash number like /tmp/images/d6718c8f, then run the following command</p>



<pre class="wp-block-preformatted">busctl set-property xyz.openbmc_project.Software.BMC.Updater \<br />  /xyz/openbmc_project/software/d6718c8f \<br />  xyz.openbmc_project.Software.Activation RequestedActivation s \<br />  xyz.openbmc_project.Software.Activation.RequestedActivations.Active</pre>



<h3 class="wp-block-heading" id="update-uefi-firmware">Update UEFI firmware </h3>



<p>Upgrade UEFI firmware<br />it needs to pack the UEFI image first , and it need to create MANIFEST file, looks like this </p>



<pre class="wp-block-preformatted">VER_purpose=xyz.openbmc_project.Software.Version.VersionPurpose.Host
version=jade_tianocore_atf_2.06.100
KeyType=OpenBMC
HashType=RSA-SHA256
MachineName=mtjade
</pre>



<p>make image file and MINIFEST file into the same file</p>



<pre class="wp-block-preformatted">$ tar -cvf jade_tianocore_atf_2.06.100.tar jade_tianocore_atf_2.06.100.img MANIFEST </pre>



<p>Run command below to upgrade UEFI firmware</p>



<pre class="wp-block-preformatted">export BMC_IP=192.168.1.190

export FWFILE=jade_tianocore_atf_2.06.100.tar

export token=`curl -k -H "Content-Type: application/json" -X POST https://${BMC_IP}/login -d '{"username" :  "root", "password" :  "0penBmc"}' | grep token | awk '{print $2;}' | tr -d '"'`

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    84  100    37  100    47    116    147 --:--:-- --:--:-- --:--:--   264


curl -k -H "X-Auth-Token: $token" \
       -H "Content-Type: application/octet-stream" \
       -X POST -T ${FWFILE} \
        https://${BMC_IP}/redfish/v1/UpdateService

</pre>



<p>Like OpenBMC, if it doesn&#8217;t update, just reboot to update it. <br />if stiall not work, try to upgrade it manually, yes, when I wrote this article, update via redfish doesn&#8217;t work, so, just copy it from github.</p>



<pre class="wp-block-preformatted"># on HOST
$ scp jade_tianocore_atf_2.06.100.tar root@192.168.1.190:/tmp

# on Target 
$ cd /tmp/images
$ mkdir fw
$ cd fw
$ tar xvf /tmp/jade_tianocore_atf_2.06.100.tar
$ firmware_update.sh /tmp/images/fw
--- Current Chassis State: On
--- Turning the Chassis off
--- Switch the host SPI bus to BMC.
Run update Primary Host SPI-NOR
--- Bind the ASpeed SMC driver
--- Locking power control
--- Flashing firmware to @/dev/mtd13
Erasing block: 157/157 (100%)
Writing kb: 9985/9985 (100%)
Verifying kb: 9985/9985 (100%)
--- Unlocking power control
--- Switch back to the primary Host SPI-NOR.
Turn on the Host
</pre>



<h3 class="wp-block-heading" id="update-scp-firmware">Update SCP firmware</h3>



<p>It needs to use sftp to transfer SCP firmware to target. <br />Following is example to upgrade SCP firmware.</p>



<pre class="wp-block-preformatted">On host
$ scp altra_scp_signed_2.06.20220426.slim root@192.168.1.190:/tmp

On OpenBMC side
$ ampere_firmware_upgrade.sh smpmpro /tmp/altra_scp_signed_2.06.20220426.slim</pre>



<p>After upgrade BIOS and SCP, if got any problem, suggest to reset bmc </p>



<pre class="wp-block-preformatted">$ ipmitool -U root -P 0penBmc -I lanplus -C 17 -H 192.168.2.18 mc reset cold</pre>



<h2 class="wp-block-heading" id="serial-console">Serial Console</h2>



<p>it can use command to get system CPU console.</p>



<pre class="wp-block-preformatted"># CPU console 
$ ssh root@192.168.190 -p 2200 
</pre>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1124" height="739" src="https://blog.richliu.com/wp-content/uploads/2022/06/image.png" alt="" class="wp-image-4631" srcset="https://blog.richliu.com/wp-content/uploads/2022/06/image.png 1124w, https://blog.richliu.com/wp-content/uploads/2022/06/image-600x394.png 600w, https://blog.richliu.com/wp-content/uploads/2022/06/image-768x505.png 768w" sizes="(max-width: 1124px) 100vw, 1124px" /></figure>



<h2 class="wp-block-heading" id="reference">Reference</h2>



<p><a href="https://github.com/ampere-openbmc/openbmc" target="_blank" rel="noreferrer noopener">Ampere OpenBMC github</a><br /><a href="https://github.com/AmpereComputing/edk2-ampere-tools" target="_blank" rel="noreferrer noopener">EDK2 Ampere Tool</a><br /><a href="https://github.com/AmpereComputing/edk2" target="_blank" rel="noreferrer noopener">Ampere EDK2</a><br /><a href="https://github.com/AmpereComputing" target="_blank" rel="noreferrer noopener">Ampere Computing Github</a></p>



<h2 class="wp-block-heading" id="error-message">Error Message </h2>



<h3 class="wp-block-heading" id="error-templateconf-value-which-is-nvme-openbmc-meta-ampere-meta-mitchell-must-point-to-meta-some-layer-conf-templates-template-name">Error: TEMPLATECONF value (which is /nvme/openbmc/meta-ampere/meta-mitchell) must point to meta-some-layer/conf/templates/template-name</h3>



<p>Error message </p>



<h3 class="wp-block-heading" id="initializing-oe-build-env">Initializing OE build env</h3>



<pre class="wp-block-preformatted">Error: TEMPLATECONF value (which is /nvme/openbmc/meta-ampere/meta-mitchell) must point to meta-some-layer/conf/templates/template-name</pre>



<p>This is because followed the old configuration, it needs to point to right folder like</p>



<pre class="wp-block-preformatted">export TEMPLATECONF=meta-ampere/meta-jade/conf/templates/default/
. openbmc-env</pre>



<p>.</p>



<h3 class="wp-block-heading"><br /></h3>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2022/06/23/4601/ampere-altra-mt-jade-openbmc-build-guide-on-arm64-platform/">Ampere Altra Mt. Jade OpenBMC and EDKII build guide on ARM64 platform</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2022/06/23/4601/ampere-altra-mt-jade-openbmc-build-guide-on-arm64-platform/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Build Ampere CentOS Kernel</title>
		<link>https://blog.richliu.com/2022/03/17/4555/build-ampere-centos-kernel/</link>
					<comments>https://blog.richliu.com/2022/03/17/4555/build-ampere-centos-kernel/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Thu, 17 Mar 2022 07:44:25 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[aarch64]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[kernel]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=4555</guid>

					<description><![CDATA[<p>Personal Note Install Necessary Packages Install packag [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2022/03/17/4555/build-ampere-centos-kernel/">Build Ampere CentOS Kernel</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Personal Note</p>



<span id="more-4555"></span>



<h2 class="wp-block-heading">Install Necessary Packages</h2>



<p>Install packages, it should have to install other packages like openssl-dev.<br /><br />get  package <a href="https://www.gitdetail.com/repositories/AmpereComputing/developer/646825" target="_blank" rel="noreferrer noopener">ampere-8.3.0-20191025-dynamic-nosysroot-nativetools.tar.xz</a> from Ampere customer connect or <a href="https://www.gitdetail.com/repositories/AmpereComputing/developer/646825" target="_blank" rel="noreferrer noopener">ampere development source web</a>. </p>



<pre class="wp-block-code"><code>yum groupinstall "Development Tools"

yum -y install ncurses-devel
yum -y install hmaccalc zlib-devel binutils-devel elfutils-devel libelf-devel newt-devel python-devel
yum -y install audit-libs-devel numactl-devel pciutils-devel openssl-devel
yum -y install bc bison perl-ExtUtils-Embed.noarch xmlto asciidoc
rpm –ivh kernel-4.18.0-80.11.2.el8.&lt;version>.src.rpm


mkdir -p /opt/amp
tar -xf ampere-8.3.0-20191025-dynamic-nosysroot-nativetools.tar.xz -C /opt/amp
export PATH=/opt/amp/ampere-8.3.0-20191025-dynamic-nosysroot/bin:$PATH;
which gcc
/opt/amp/ampere-8.3.0-20191025/bin/gcc
</code></pre>



<p>if gcc is not in /opt/amp, please check your directory in /opt/amy </p>



<h2 class="wp-block-heading">Build Kernel</h2>



<p>command to build kernel</p>



<pre class="wp-block-preformatted">cd /root/rpmbuild/SOURCES/
tar xvf linux-4.18.0-80.11.2.el8_0.tar.xz
cd linux-4.18.0-80.11.2.el8_0
cp ../kernel-aarch64-emag.config .config
make olddefconfig</pre>



<p>Try build once and make sure everything is ok</p>



<pre class="wp-block-preformatted">make -j `nproc`</pre>



<p>If buiild OK, generate RPM files. </p>



<pre class="wp-block-preformatted">make -j `nproc` rpm-pkg</pre>



<p>if everything is ok, the RPM files will be on /root/rpmbuild/RPMS/aarch64/</p>



<h2 class="wp-block-heading">Install RPM packages</h2>



<pre class="wp-block-preformatted">/root/rpmbuild/RPMS/aarch64
yum localinstall kernel-4.18.0-1.aarch64.rpm kernel-headers-4.18.0-1.aarch64.rpm</pre>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2022/03/17/4555/build-ampere-centos-kernel/">Build Ampere CentOS Kernel</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2022/03/17/4555/build-ampere-centos-kernel/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>ARM64 Linux Performance Tuning</title>
		<link>https://blog.richliu.com/2021/05/19/4477/arm64-linux-performance-tuning/</link>
					<comments>https://blog.richliu.com/2021/05/19/4477/arm64-linux-performance-tuning/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 19 May 2021 01:54:33 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[aarch64]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[performance]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=4477</guid>

					<description><![CDATA[<p>This is personal notebook for ARM64 performance tuning. [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2021/05/19/4477/arm64-linux-performance-tuning/">ARM64 Linux Performance Tuning</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>This is personal notebook for ARM64 performance tuning.</p>



<span id="more-4477"></span>



<h2 class="wp-block-heading">NVME 4K Write Performance</h2>



<p>Situation: <br />Run fio 4K write on 24 NVME drivers, but some drivers might not get higher IOPS performance</p>



<p>Solution:<br />It should be caused by enable SMMU, so, if doesn&#8217;t use VM, just disable iommu to get better performance<br />Add iommu.passthrough=1</p>



<h2 class="wp-block-heading">General IO performance Tuning </h2>



<p>For high bandwidth card, most time it needs to disable irq_balancing <br />$ systemctl stop irqbalance.service</p>



<h2 class="wp-block-heading">Some Performance Tuning Parameters</h2>



<pre class="wp-block-preformatted">ulimit -s unlimited 
ulimit -l 2097152 
echo 8 | sudo tee /proc/sys/vm/dirty_ratio 
echo 1 | sudo tee /proc/sys/vm/swappiness 
echo 1 | sudo tee /proc/sys/vm/zone_reclaim_mode 
echo 3 | sudo tee /proc/sys/vm/drop_caches 
echo 0 | sudo tee /proc/sys/kernel/randomize_va_space 
echo 0 | sudo tee /proc/sys/kernel/numa_balancing 
echo never > /sys/kernel/mm/transparent_hugepage/enabled 
cpupower frequency-set -g performance 
export MALLOC_CONF=thp:always
 
</pre>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2021/05/19/4477/arm64-linux-performance-tuning/">ARM64 Linux Performance Tuning</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2021/05/19/4477/arm64-linux-performance-tuning/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Gentoo ARM64 UEFI Install Guide</title>
		<link>https://blog.richliu.com/2020/07/09/4295/gentoo-arm64-uefi-install-guide/</link>
					<comments>https://blog.richliu.com/2020/07/09/4295/gentoo-arm64-uefi-install-guide/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Thu, 09 Jul 2020 04:43:38 +0000</pubDate>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[uefi]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=4295</guid>

					<description><![CDATA[<p>This is not a detail guide to describe how to full inst [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2020/07/09/4295/gentoo-arm64-uefi-install-guide/">Gentoo ARM64 UEFI Install Guide</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>This is not a detail guide to describe how to full install system, just figure out some important point. Even not for Gentoo newbie. <br /><br />Most important handbook is<a rel="noreferrer noopener" aria-label=" Gentoo AMD64 installation guide. (opens in a new tab)" href="https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation#Manual_network_configuration" target="_blank"> Gentoo AMD64 installation guide.</a> <br />There is some different between ARM64 and AMD64<br /></p>



<p>2021/08/31 Updated : No more need Ubuntu ISO image, ARM64 EFI minimal ISO can be download from official website: https://www.gentoo.org/downloads/</p>



<span id="more-4295"></span>



<p>Some ARM64 platform support UEFI bios system, like Ampere Computing Altea or Marvell ThunderX. <br />Recently Linux like CentOS or Ubuntu can support both system, but not for Gentoo ARM64 project, <br />if you want to install Gentoo on ARM64 bare system, it needs some trick skill. </p>



<h3 class="wp-block-heading">Install System</h3>



<p>Gentoo ARM64 install, it needs to relay on other OS&#8217;s installation software. <br />I were using Ubuntu/Debain net-inst to install system, below is my nvme driver partition table.<br /><br />/dev/nvme0n1p1  (bootloader/efi)    500MB    for EFI only <br />/dev/nvme0n1p2  /                                800G       for Gentoo system <br />/dev/nvme0n1p3  /                                 90G        for Ubuntu system <br /><br />Suggest to keep a ubuntu system for booting, it can be rescue system when fail to boot Gentoo system. <br /><br />After Ubuntu/Debian installed system, it can go back to installation menu, there is a execute shell on menu, run it. </p>



<h3 class="wp-block-heading">Decompress Gentoo Stage3 File. </h3>



<p>Most challenge thing is, Ubuntu/Debian installation rootfs, there is no unbzip function, that&#8217;s means it needs to use installed disk and used the Ubuntu system&#8217;s bzip2. below is my command to untar it. </p>



<pre class="wp-block-code"><code># use gentoo iso cdrom boot
# mount /dev/nvme0n1p3 /mnt/gentoo
# cd /mnt/gentoo
# wget https://bouncer.gentoo.org/fetch/root/all/releases/arm64/autobuilds/20210829T233646Z/stage3-arm64-systemd-20210829T233646Z.tar.xz
# tar xvf stage3-arm64-systemd-20210829T233646Z.tar.xz
# mount --bind /proc proc
# mount --bind /dev dev
# mount --bind /sys sys
# mount --bind /sys/firmware/efi/efivars/ ./sys/firmware/efi/efivars/
# cp /etc/resolv.conf /mnt/gentoo/etc/
# cd ..
# chroot gentoo 

&gt;&gt;&gt;&gt; chroot to ubuntu 
# mkdir  -p /mnt/gentoo
# mount /dev/nvme0n1p2 /mnt/gentoo 
# cd /mnt/gentoo 
# wget http://distfiles.gentoo.org/experimental/arm64/stage3-arm64-systemd-20190925.tar.bz2
# tar xvzf stage3-arm64-systemd-20190925.tar.bz2
# mount --bind /proc proc
# mount --bind /dev dev
# mount --bind /sys sys
# cp /etc/resolv.conf /mnt/gentoo/etc/
# cd ..
# chroot gentoo</code></pre>



<p>Yaa.. We got Gentoo file system . </p>



<h3 class="wp-block-heading">Gentoo Kernel</h3>



<p>Suppose that reader know how to configure hostname , fstab, emerge &#8211;sync &#8230; etc.<br /><br />Next step is to install Gentoo kernel, I will show how to use genkernel to generate workable kernel for ARM64 system <br /><br />*Note: Some install command might need to unmask or add accept keyword, will ignore that, please try add &#8220;&#8211;autounmask-write&#8221; and run command &#8220;etc-update&#8221; to update it.</p>



<pre class="wp-block-code"><code># mkdir -p /boot/efi
# mount /dev/nvme0n1p1 /boot/efi
# echo 'GRUB_PLATFORMS="efi-64"' &gt;&gt; /etc/portage/make.conf
# emerge --ask sys-boot/grub:2
# emerge efibootmgr
# grub-install --target=arm64-efi --efi-directory=/boot/efi --bootloader-id=Gentoo</code></pre>



<p>If have problem on the stage, and it shows cannot find /dev/md0, it needs to emerge mdadm package.</p>



<p>Compile Linux Kernel</p>



<pre class="wp-block-code"><code># emerge gentoo-sources 
# emerge genkernel
# genkernel --menuconfig all</code></pre>



<p>genkernel will let you choice kernel configure before compile it. Please enable those options, Gentoo kernel didn&#8217;t enable ARM&#8217;s serial port by default. </p>



<pre class="wp-block-code"><code>Device Drivers  ---&gt;
	Character devices  ---&gt;
		Serial drivers  ---&gt;
			 &lt;*&gt; ARM AMBA PL010 serial port support
			&#91;*]   Support for console on AMBA serial port
			 &lt;*&gt; ARM AMBA PL011 serial port support
			&#91;*]   Support for console on AMBA serial port
                        &#91;*] Early console using ARM semihosting
</code></pre>



<p>Save it and quit. <br /><br />Next step is edit /etc/default/grub and add &#8220;console==ttyAMA0&#8221; to /etc/default/grub</p>



<pre class="wp-block-preformatted">GRUB_CMDLINE_LINUX_DEFAULT="console=ttyAMA0"</pre>



<p>Update grub.conf </p>



<p> grub-mkconfig -o /boot/grub/grub.cfg </p>



<h3 class="wp-block-heading"> Check UEFI Boot Priority </h3>



<p>Run efibootmgr and get boot priority </p>



<pre class="wp-block-code"><code># efibootmgr
BootCurrent: 0003
Timeout: 5 seconds
BootOrder: 0003,0001,0002,0004
Boot0001* ubuntu
Boot0002* UEFI: PXE IP4 Intel(R) Ethernet Server Adapter I210-T1
Boot0003* Gentoo
Boot0004* UEFI: Built-in EFI Shell</code></pre>



<p>It can see current boot and boot order here , if Gentoo is not first priority, it can use option &#8220;-o&#8221; to update it. </p>



<p></p>



<h3 class="wp-block-heading">Other</h3>



<p>if you choice systemd as your service manager, after install openssh, please run command below to activate it and as default service. </p>



<pre class="wp-block-code"><code># systemctl enable sshd.service
# systemctl start sshd.service
# systemctl status sshd.service</code></pre>



<h3 class="wp-block-heading">Conclusion</h3>



<p>I have write down my note here, good luck to you if you have the same question then get this webpage. </p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2020/07/09/4295/gentoo-arm64-uefi-install-guide/">Gentoo ARM64 UEFI Install Guide</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2020/07/09/4295/gentoo-arm64-uefi-install-guide/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>CentOS8 ARM64/AARCH64 Install Docker</title>
		<link>https://blog.richliu.com/2020/05/18/4273/centos8-arm64-aarch64-install-docker/</link>
					<comments>https://blog.richliu.com/2020/05/18/4273/centos8-arm64-aarch64-install-docker/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Mon, 18 May 2020 15:11:17 +0000</pubDate>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[aarch64]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[centos8]]></category>
		<category><![CDATA[docker]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=4273</guid>

					<description><![CDATA[<p>It&#8217;s not complex to install docker on ARM64 platf [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2020/05/18/4273/centos8-arm64-aarch64-install-docker/">CentOS8 ARM64/AARCH64 Install Docker</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>It&#8217;s not complex to install docker on ARM64 platform and make it work, but it needs a trick</p>



<span id="more-4273"></span>



<h2 class="wp-block-heading">Remove Packages </h2>



<p>$  sudo yum remove docker-ce docker-ce-cli containerd.io </p>



<h2 class="wp-block-heading">Install Containterd First</h2>



<p>This is most important step, without this, docker&#8217;s install script will fail. </p>



<p>$ sudo dnf install <a href="https://download.docker.com/linux/centos/7/aarch64/stable/Packages/containerd.io-1.2.6-3.3.el7.aarch64.rpm" target="_blank" rel="noopener">https://download.docker.com/linux/centos/7/aarch64/stable/Packages/containerd.io-1.2.6-3.3.el7.aarch64.rpm</a></p>



<h2 class="wp-block-heading">Docker Script</h2>



<p>Get docker script and run it <br />$ curl -fsSL https://get.docker.com -o get-docker.sh <br />$ sudo sh get-docker.sh <br />Add your current username to docker group if not run on root account. <br />$ sudo usermod -aG docker your-user </p>



<h2 class="wp-block-heading">Restart Docker And Enable Firewall </h2>



<p>$  sudo systemctl start docker <br />$  firewall-cmd &#8211;zone=public &#8211;add-masquerade &#8211;permanent <br />$  firewall-cmd &#8211;reload </p>



<p>ref. <br />[1]  https://linuxconfig.org/how-to-install-docker-in-rhel-8 <br />[2]  https://docs.docker.com/engine/install/centos/ <br />[3]  https://serverfault.com/questions/987686/no-network-connectivity-to-from-docker-ce-container-on-centos-8 </p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2020/05/18/4273/centos8-arm64-aarch64-install-docker/">CentOS8 ARM64/AARCH64 Install Docker</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2020/05/18/4273/centos8-arm64-aarch64-install-docker/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>ARM64 Centos8/Ubuntu PXE Boot Install on Ubuntu Server</title>
		<link>https://blog.richliu.com/2020/04/08/4263/arm64-centos8-pxe-boot/</link>
					<comments>https://blog.richliu.com/2020/04/08/4263/arm64-centos8-pxe-boot/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 08 Apr 2020 08:21:38 +0000</pubDate>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[aarch64]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[centos8]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[pxe]]></category>
		<category><![CDATA[pxeboot]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=4263</guid>

					<description><![CDATA[<p>This document will introduce how to setup a centos PXE  [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2020/04/08/4263/arm64-centos8-pxe-boot/">ARM64 Centos8/Ubuntu PXE Boot Install on Ubuntu Server</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>This document will introduce how to setup a centos PXE boot environment on ubuntu 18.04 for install centos8 to your ARM64 machine. <br /><br />In this document, it uses CentOS 8 version is 8.1.1911, it might also work on later version if you change file name accordingly .&nbsp;<br /><br />all command in this document we assume you already run with root permission.&nbsp;<br /></p>



<span id="more-4263"></span>



<h2 class="wp-block-heading">Hardware topology&nbsp;</h2>



<p>[ARM64 CLIENT] &lt;&#8212;&#8212;-&gt; [Server]&nbsp; &lt;&#8212;&#8212;-&gt; Internet&nbsp;</p>



<p>SERVER ethernet ip is 10.0.0.1 , another interface connect to internet.&nbsp;</p>



<p></p>



<h2 class="wp-block-heading">Install necessary packages&nbsp;<br /></h2>



<p>Install TFTP, HTTP and DHCPD Server and rpm2cpio&nbsp;<br /></p>



<p>$ apt install tftpd-hpa apache2 isc-dhcp-server rpm2cpio<br /></p>



<h2 class="wp-block-heading">Modify dhcpd server configuration&nbsp;<br /></h2>



<p>$ vim /etc/dhcp/dhcpd.conf<br /></p>



<p>following is example configuration,it can be changed to fit your environment&nbsp;</p>



<pre class="wp-block-verse">authoritative;
default-lease-time&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 259200;
max-lease-time&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 518400;
option routers&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 10.0.0.1;
option subnet-mask&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 255.255.255.0;
option domain-name-servers&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 168.95.1.1,8.8.8.8;
ddns-update-style &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; interim;
ignore client-updates;
allow booting;
allow bootp;
allow unknown-clients;
server-name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pxis;

subnet 10.0.0.0 netmask 255.255.255.0 {
&nbsp;&nbsp;&nbsp;&nbsp;range 10.0.0.100 10.0.0.200;
&nbsp;&nbsp;&nbsp;&nbsp;option ip-forwarding off;
&nbsp;&nbsp;&nbsp;&nbsp;option subnet-mask&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 255.255.255.0;
&nbsp;&nbsp;&nbsp;&nbsp;next-server 10.0.0.1;
&nbsp;&nbsp;&nbsp;&nbsp;filename "shim.efi";

}</pre>



<h2 class="wp-block-heading">Modify tftpd setting&nbsp;<br /></h2>



<p>$ vim /etc/default/tftpd-hpa<br /></p>



<p>Add &#8211;create to TFTP_OPTIONS and change tftp directory to /tftpboot&nbsp;<br /></p>



<p>following is example configuration file&nbsp;</p>



<pre class="wp-block-preformatted">TFTP_USERNAME="tftp"<br />TFTP_DIRECTORY="/tftpboot"<br />TFTP_ADDRESS=":69"<br />TFTP_OPTIONS="--secure&nbsp; --create"</pre>



<h2 class="wp-block-heading">Restart Service&nbsp;<br /></h2>



<pre class="wp-block-preformatted">mkdir /tftpboot&nbsp;
/etc/init.d/tftpd-hpa restart
/etc/init.d/apache2 restart
/etc/init.d/isc-dhcp-server restart
</pre>



<h2 class="wp-block-heading">Get ARM64 pxeboot file&nbsp;</h2>



<p>some times the shim and grub2-efi would be erase, just visit mirror.centos.org and find new one than download it. </p>



<pre class="wp-block-preformatted">cd /tftpboot&nbsp;
wget http://mirror.centos.org/centos/8-stream/BaseOS/aarch64/os/Packages/shim-aa64-15-15.el8_2.aarch64.rpm
wget http://mirror.centos.org/centos/8-stream/BaseOS/aarch64/os/Packages/grub2-efi-aa64-2.02-106.el8.aarch64.rpm
rpm2cpio shim-aa64-15-15.el8_2.aarch64.rpm | cpio -dimv
rpm2cpio grub2-efi-aa64-2.02-106.el8.aarch64.rpm | cpio -dimv
cp ./boot/efi/EFI/centos/shim.efi .
cp ./boot/efi/EFI/centos/grubaa64.efi .
chmod +rx *.efi</pre>



<h2 class="wp-block-heading">Configure grub.conf&nbsp;<br /></h2>



<p>$ vim /tftpboot/grub.cfg<br /></p>



<p>Following is grub.conf example&nbsp;</p>



<pre class="wp-block-verse">set timeout=60<br />menuentry 'CentOS' {<br /> &nbsp;linux images/pxeboot/vmlinuz ip=dhcp inst.repo=http://10.0.0.1/centos8/<br />&nbsp;&nbsp;initrd images/pxeboot/initrd.img<br />}</pre>



<p>If your system support secure boot and you want to do it, please replace linux with linuxefi and replace initrd with initrdefi.&nbsp;</p>



<h2 class="wp-block-heading">Get CentOS 8 stream image and copy it to web server&nbsp;</h2>



<pre class="wp-block-preformatted">cd /var/www/html&nbsp;
wget <a href="https://mirror01.idc.hinet.net/centos/8-stream/isos/aarch64/CentOS-Stream-8-aarch64-20211202-dvd1.iso" target="_blank" rel="noopener">http://ftp.twaren.net/Linux/CentOS/8-stream/isos/x86_64/CentOS-Stream-8-x86_64-20220215-dvd1.iso</a>
mkdir disk&nbsp;
mount -o loop CentOS-Stream-8-x86_64-20220215-dvd1.iso disk
cp -a disk centos8&nbsp;
umount disk&nbsp;
rmdir disk

# copy boot file into tftp directory </pre>



<p>cd /tftpboot<br />cp /var/www/html/centos8/images/ . -a<br /></p>



<p>After copy all file into http file directory, it can visit via browser on server with URL <a href="http://10.0.0.1/centos8/">http://10.0.0.1/centos8/</a> to check whether file exist or not.&nbsp;<br /></p>



<h2 class="wp-block-heading">NAT<br /></h2>



<p>Server should support NAT function to forward packet.&nbsp;<br /><br />assume interface connect to internet is wls3 <br />Following is a sample command to enable Linux NAT function which can make client to access internet or intranet .&nbsp;</p>



<p>$ echo 1 &gt; /proc/sys/net/ipv4/ip_forward ==&gt; enable it immediately&nbsp;<br />$ iptables -t nat -A POSTROUTING -o wls3 -j MASQUERADE</p>



<p></p>



<p>Now, you can choose pxeboot on your ARM64 machine. if everything successful, you can see CentOS on your console if everything is ok .&nbsp;<br /></p>



<h2 class="wp-block-heading">Known Issue</h2>



<h3 class="wp-block-heading">Stdin: Invalid argument</h3>



<p>My system cannot boot into the Ubuntu install program for an unknown reason. After checking the system, it seems that the issue may be caused by an inability to access internet resources for some reason, even though the DNS and network appear to be fine. An alternative solution is to put the ISO on a website and assign the argument to the parameter. Here is an example using Ubuntu 22.04.</p>



<pre class="wp-block-preformatted">menuentry 'Ubuntu22.04 Net Install' {<br />linux ubuntu2204/vmlinuz ip=dhcp url=http://10.0.0.1/ubuntu-22.04.1-live-server-arm64.iso only-ubiquity<br />initrd ubuntu2204/initrd<br />}</pre>



<h2 class="wp-block-heading">Debug&nbsp;<br /></h2>



<p>Wireshark is your good friend, use it.&nbsp;<br /></p>



<h2 class="wp-block-heading">Ubuntu PXE Environment</h2>



<p>It can download Ubuntu Netboot images from this url. <br /> <a href="http://cdimage.ubuntu.com/netboot/" target="_blank" rel="noopener">http://cdimage.ubuntu.com/netboot/</a> <br /><br />Choice what you want, for example, url below is Ubuntu 18.04 for ARM64 image<br /> <a href="http://ports.ubuntu.com/ubuntu-ports/dists/bionic-updates/main/installer-arm64/current/images/netboot/" target="_blank" rel="noopener">http://ports.ubuntu.com/ubuntu-ports/dists/bionic-updates/main/installer-arm64/current/images/netboot/</a> <br />Ubuntu 20.04 Netboot file <br />http://ports.ubuntu.com/ubuntu-ports/dists/focal-updates/main/installer-arm64/current/legacy-images/netboot/netboot.tar.gz</p>



<p><br />Download netboot image to tftp directory, I prefer to put different version to different directory. </p>



<pre class="wp-block-code"><code>$ cd /tftpboot
$ wget http://ports.ubuntu.com/ubuntu-ports/dists/bionic-updates/main/installer-arm64/current/images/netboot/netboot.tar.gz
$ mkdir ubuntu1804
$ cd ubuntu1804
$ tar xvf ../netboot.tar.gz</code></pre>



<p>Modify grub.cfg and add Ubuntu option to grub.cfg, save it, now, this server can also provide ubuntu net install</p>



<pre class="wp-block-code"><code>set timeout=60
menuentry 'CentOS8 Install' {
  linux images/pxeboot/vmlinuz ip=dhcp inst.repo=http://10.0.0.1/centos8/
  initrd images/pxeboot/initrd.img
}
menuentry 'Ubuntu18.04 Install' {
  linux ubuntu1804/ubuntu-installer/arm64/linux ip=dhcp
  initrd ubuntu1804/ubuntu-installer/arm64/initrd.gz
}
</code></pre>



<h2 class="wp-block-heading">Ubuntu ISO environment </h2>



<p>It can download iso file and use the iso file as install media. <br /><br />in Linux, download Ubuntu 20.04 ARM64 iso file</p>



<pre class="wp-block-preformatted">$ wget https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.3-live-server-arm64.iso
$ mount -o loop ubuntu-20.04.3-live-server-arm64.iso disk
$ mkdir ubuntu2004
$ cp disk/casper ubuntu2004/ -a 
$ umount disk</pre>



<p>Modify grub.cfg as below (not test)</p>



<pre class="wp-block-preformatted">set timeout=60
menuentry 'CentOS8 Install' {
  linux images/pxeboot/vmlinuz ip=dhcp inst.repo=http://10.0.0.1/centos8/
  initrd images/pxeboot/initrd.img
}
menuentry 'Ubuntu20.04 Install' {
  linux ubuntu2004/casper/vmlinuz ip=dhcp
  initrd ubuntu2004/casper/initrd
}
</pre>



<p>It also can use HWE kernel </p>



<pre class="wp-block-preformatted">menuentry 'Ubuntu20.04 Install' {
  linux ubuntu2004/casper/hwe-vmlinux ip=dhcp
  initrd ubuntu2004/casper/hwe-initrd
}

</pre>



<h2 class="wp-block-heading">Note for GRUB Install Command</h2>



<h2 class="wp-block-heading">CentOS</h2>



<pre class="wp-block-preformatted">svr=10.0.0.1; root=boot/centos8/images/pxeboot
linux (http,$svr)/$root/vmlinuz inst.stage2=http://$svr/boot/centos8 text
initrd (http,$svr)/$root/initrd.img
</pre>



<h2 class="wp-block-heading">Ubuntu</h2>



<pre class="wp-block-preformatted">svr=192.168.110.254; root=boot/ubuntu2004/casper
iso=ubuntu-20.04.3-live-server-arm64.iso
linux (http,$svr)/$root/vmlinuz url=http://192.168.110.254/boot/$iso only-ubiquity ip=dhcp ---
initrd (http,$svr)/$root/initrd

linux (http,$svr)/$root/hwe-vmlinuz url=http://192.168.110.254/boot/$iso only-ubiquity ip=dhcp ---
initrd (http,$svr)/$root/hwe-initrd

</pre>



<h2 class="wp-block-heading">Fedora 36</h2>



<p>Fedora&#8217;s setting is more closed to CentOS, due to CentOS might be dropped recently, so, moved to Fedora environment is necessary. </p>



<h3 class="wp-block-heading">Get initrd/vmlinux image</h3>



<p>Other parts like CentOS, <br />Download the PXE initrd and vmlinuz image, free.nchc.org.tw is Taiwan local Fedora server, you can replace it with local server. </p>



<pre class="wp-block-preformatted">mkdir -p /tftpboot/f36

cd /tftpboot/f36
wget http://free.nchc.org.tw/fedora/linux/releases/36/Server/aarch64/os/images/pxeboot/initrd.img
wget http://free.nchc.org.tw/fedora/linux/releases/36/Server/aarch64/os/images/pxeboot/vmlinuz

cd /var/www/html
wget http://free.nchc.org.tw/fedora/linux/releases/36/Server/aarch64/iso/Fedora-Server-dvd-aarch64-36-1.5.iso
mkdir disk 
mount -o loop Fedora-Server-dvd-aarch64-36-1.5.iso disk
cp -a disk f36
umount disk</pre>



<h3 class="wp-block-heading">Grub Fedora Setting</h3>



<p>Add following grub entry text into /tftpboot/grub.cfg, thus, it can insert a &#8220;Fedora36&#8221; menu on pxe boot.</p>



<pre class="wp-block-preformatted">menuentry 'Fedora36' {
  linux f36/vmlinuz ip=dhcp inst.repo=http://10.0.0.1/f36/
  initrd f36/initrd.img
}
</pre>



<p>Ref.&nbsp;</p>



<p><a href="https://docs.centos.org/en-US/centos/install-guide/pxe-server/#sect-network-boot-setup-uefi" target="_blank" rel="noopener">https://docs.centos.org/en-US/centos/install-guide/pxe-server/#sect-network-boot-setup-uefi</a><br /><a href="https://docs.centos.org/en-US/8-docs/advanced-install/assembly_preparing-for-a-network-install/" target="_blank" rel="noopener">https://docs.centos.org/en-US/8-docs/advanced-install/assembly_preparing-for-a-network-install/</a><br /><a href="https://forums.opensuse.org/showthread.php/501075-error-cannot-find-commands-linuxefi-or-initrdefi" target="_blank" rel="noopener">https://forums.opensuse.org/showthread.php/501075-error-cannot-find-commands-linuxefi-or-initrdefi</a></p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2020/04/08/4263/arm64-centos8-pxe-boot/">ARM64 Centos8/Ubuntu PXE Boot Install on Ubuntu Server</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2020/04/08/4263/arm64-centos8-pxe-boot/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>ARM64 mfpu=neon-fp-armv8 and unrecognized command line option</title>
		<link>https://blog.richliu.com/2020/03/20/4260/arm64-mfpuneon-fp-armv8-and-unrecognized-command-line-option/</link>
					<comments>https://blog.richliu.com/2020/03/20/4260/arm64-mfpuneon-fp-armv8-and-unrecognized-command-line-option/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Fri, 20 Mar 2020 09:44:54 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[aarch64]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[GCC]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=4260</guid>

					<description><![CDATA[<p>又學到一個小知識 原因是因為 -mfpu=neon-fp-armv8 是 arm32 compiler opt [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2020/03/20/4260/arm64-mfpuneon-fp-armv8-and-unrecognized-command-line-option/">ARM64 mfpu=neon-fp-armv8 and unrecognized command line option</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>又學到一個小知識<br /><br />原因是因為 -mfpu=neon-fp-armv8 是 arm32 compiler option ARM64 使用 Linux  ABI 那邊就規範要支援 Floatpoint 和 ASIMD(也就是 neon 的 64bit 版 )</p>



<p>不要用 -mfpu 指令就可以了</p>



<p>ref. <br /><a href="https://lists.linaro.org/pipermail/linaro-toolchain/2016-July/005815.html" target="_blank" rel="noopener">-mfpu=neon-fp-armv8 and unrecognized command line option</a></p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2020/03/20/4260/arm64-mfpuneon-fp-armv8-and-unrecognized-command-line-option/">ARM64 mfpu=neon-fp-armv8 and unrecognized command line option</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.richliu.com/2020/03/20/4260/arm64-mfpuneon-fp-armv8-and-unrecognized-command-line-option/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
