<?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>grub &#8211; richliu&#039;s blog</title>
	<atom:link href="https://blog.richliu.com/tag/grub/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.richliu.com</link>
	<description>Linux, 工作, 生活, 家人</description>
	<lastBuildDate>Wed, 13 Mar 2024 12:29:42 +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>Ampere Altra ARM64 Grub Cannot Output Message To Serial Console</title>
		<link>https://blog.richliu.com/2024/03/08/5866/ampere-altra-arm64-grub-cannot-output-message-to-serial-console/</link>
					<comments>https://blog.richliu.com/2024/03/08/5866/ampere-altra-arm64-grub-cannot-output-message-to-serial-console/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Fri, 08 Mar 2024 11:35:47 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[grub]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=5866</guid>

					<description><![CDATA[<p>This issue is a little bit anomalous. Different boards  [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2024/03/08/5866/ampere-altra-arm64-grub-cannot-output-message-to-serial-console/">Ampere Altra ARM64 Grub Cannot Output Message To Serial Console</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>This issue is a little bit anomalous. Different boards and different combinations have different results.</p>



<p>For current ARM64 systems, most of the time they will use the serial console as the debug console. So, when there is no output from the serial console, it confuses me.</p>



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



<p>CPU: Ampere Altra Family<br />Board: AsRock ALTRAD8UD<br />For example, on my Gentoo system, only need to configure /etc/default/grub to following configuration.</p>



<pre class="wp-block-preformatted">GRUB_TIMEOUT=30
GRUB_TIMEOUT_STYLE=menu
GRUB_CMDLINE_LINUX_DEFAULT="domdadm console=ttyAMA0 pcie_aspm=off"
GRUB_TERMINAL=console</pre>



<p>Output to serial console will be no problem, but on the Ubuntu 22.04, it cannot output to serial console. </p>



<p>So, on Ubuntu, if you only can see grub menu on VGA and cannot see it on serial console, try this configuration, it will output to serial console and VGA console at the same time.</p>



<pre class="wp-block-preformatted">GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=10
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
</pre>



<p>Don&#8217;t forget to update grub.cfg</p>



<pre class="wp-block-preformatted">update-grub2</pre>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="1377" height="808" src="https://blog.richliu.com/wp-content/uploads/2024/03/image-8.png" alt="" class="wp-image-5906" srcset="https://blog.richliu.com/wp-content/uploads/2024/03/image-8.png 1377w, https://blog.richliu.com/wp-content/uploads/2024/03/image-8-600x352.png 600w, https://blog.richliu.com/wp-content/uploads/2024/03/image-8-768x451.png 768w, https://blog.richliu.com/wp-content/uploads/2024/03/image-8-816x479.png 816w" sizes="(max-width: 1377px) 100vw, 1377px" /></figure>



<p>ref.<br />https://help.ubuntu.com/community/SerialConsoleHowto</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2024/03/08/5866/ampere-altra-arm64-grub-cannot-output-message-to-serial-console/">Ampere Altra ARM64 Grub Cannot Output Message To Serial Console</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/08/5866/ampere-altra-arm64-grub-cannot-output-message-to-serial-console/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Build Linux kernel 5.x on CentOS 7</title>
		<link>https://blog.richliu.com/2021/11/15/4515/build-linux-kernel-5-x-on-centos-7/</link>
					<comments>https://blog.richliu.com/2021/11/15/4515/build-linux-kernel-5-x-on-centos-7/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Mon, 15 Nov 2021 04:32:57 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[grub]]></category>
		<category><![CDATA[linux kernel]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=4515</guid>

					<description><![CDATA[<p>This article&#8217;s procedure was tested in Ampere Alt [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2021/11/15/4515/build-linux-kernel-5-x-on-centos-7/">Build Linux kernel 5.x on CentOS 7</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>This article&#8217;s procedure was tested in Ampere Altra CPU platform, but suppose that x86 system also can use this procedure. <br /><br />CentOS 7&#8217;s gcc is too old to compile Linux kernel 5.x, and it can use another package named &#8220;software collections(SCL)&#8221; to install newer gcc to build Linux kernel. </p>



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



<h2 class="wp-block-heading">Install CentOS 7 on Ampere Altra CPU</h2>



<p>Earlier CentOS 7 default OS is too old to support ARM64 CPU and SSIF driver, <br />if you have problem to install on Ampre Altra CPU, it needs to block SSIF and change PCI parameter during booting. Add parameters below on Linux kernel booting parameter when install CentOS7. </p>



<pre class="wp-block-code"><code>modprobe.blacklist=ipmi_si pci=nomsi</code></pre>



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



<p>Before download and build Linux kernel 5.x, it needs to run those command to prepare build environment </p>



<pre class="wp-block-code"><code>yum install -y centos-release-scl-rh
yum install -y devtoolset-9*
yum groupinstall -y "Development Tools"
yum install -y ncurses-devel
yum install -y hmaccalc zlib-devel binutils-devel elfutils-libelf-devel
yum install -y python3</code></pre>



<h2 class="wp-block-heading">Download Linux kernel</h2>



<p>Ampere LTS kernel can be download from github, here is the command to checkout Ampere LTS kernel and switch version to 5.10</p>



<pre class="wp-block-code"><code>cd /root
git clone https://github.com/AmpereComputing/ampere-lts-kernel.git
cd /ampere-lte-kernel
git checkout -b origin/linux-5.10.y 5.10.y
</code></pre>



<p>On later Linux kernel, it needs to use git switch to switch to 5.10.y</p>



<pre class="wp-block-preformatted">git switch 5.10.y</pre>



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



<p>It&#8217;s simple to build Linux kernel</p>



<pre class="wp-block-code"><code>scl enable devtoolset-9 bash
cd /root/ampere-lte-kernel
cp arch/arm64/configs/altra_5.10_defconfig .config
make olddefconfig
make -j `nproc` &amp;&amp; make -j `nproc` modules  &amp;&amp; make modules_install &amp;&amp; make install</code></pre>



<h2 class="wp-block-heading">GRUB Setting</h2>



<p>Suggest to change default GRUB timeout to choice right kernel to boot. </p>



<pre class="wp-block-code"><code>sed -i 's/GRUB_TIMEOUT=5/GRUB_TIMEOUT=30/g' /etc/default/grub
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg</code></pre>



<p>OK, right now it can reboot your system to have try. </p>



<p>Ref: <br />Good mirror site for CentOS7 package.  <br />https://mirrors.bfsu.edu.cn/centos-altarch/7.9.2009/os/aarch64/<br /><br /></p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2021/11/15/4515/build-linux-kernel-5-x-on-centos-7/">Build Linux kernel 5.x on CentOS 7</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/11/15/4515/build-linux-kernel-5-x-on-centos-7/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>GRUB 開機會停在 Load Ramdisk 的問題</title>
		<link>https://blog.richliu.com/2018/02/24/2212/grub-%e9%96%8b%e6%a9%9f%e6%9c%83%e5%81%9c%e5%9c%a8-load-ramdisk-%e7%9a%84%e5%95%8f%e9%a1%8c/</link>
					<comments>https://blog.richliu.com/2018/02/24/2212/grub-%e9%96%8b%e6%a9%9f%e6%9c%83%e5%81%9c%e5%9c%a8-load-ramdisk-%e7%9a%84%e5%95%8f%e9%a1%8c/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sat, 24 Feb 2018 01:09:46 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[5775c]]></category>
		<category><![CDATA[boot]]></category>
		<category><![CDATA[gpu]]></category>
		<category><![CDATA[grub]]></category>
		<category><![CDATA[z97]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=2212</guid>

					<description><![CDATA[<p>背景是換新主機版之後, 偶爾開機的時候可以 Load 到 EFI 的 Loader, 看的到 GURB, 但是 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2018/02/24/2212/grub-%e9%96%8b%e6%a9%9f%e6%9c%83%e5%81%9c%e5%9c%a8-load-ramdisk-%e7%9a%84%e5%95%8f%e9%a1%8c/">GRUB 開機會停在 Load Ramdisk 的問題</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>背景是換新主機版之後, 偶爾開機的時候可以 Load 到 EFI 的 Loader, 看的到 GURB, 但是進去之後會停在 Load Ramdisk &#8230;..</p>
<p>主機版是 Z97-A-USB31<br />
CPU 是 i7-5775C 內建的 GPU<br />
<span id="more-2212"></span></p>
<p>現在看起來在 GRUB 開機時加上參數 nomodeset 就可以了.</p>
<p>網路上找來對 nomodeset 的說明</p>
<pre lang="text">
The newest kernels have moved the video mode setting into the kernel. 
So all the programming of the hardware specific clock rates and 
registers on the video card happen in the kernel rather than in 
the X driver when the X server starts.. This makes it possible 
to have high resolution nice looking splash (boot) screens and 
flicker free transitions from boot splash to login screen. 
Unfortunately, on some cards this doesn't work properly and you 
end up with a black screen. Adding the nomodeset parameter 
instructs the kernel to not load video drivers and use BIOS
 modes instead until X is loaded.
</pre>
<p>也就是說 modeset 已經搬到 kernel 了. 但是有時在 kernel 的 modeset 會有問題, 這就是告訴 kernel 用 grub 的設定, 直到 X 啟動</p>
<p>ref.<br />
https://askubuntu.com/questions/716957/what-do-the-nomodeset-quiet-and-splash-kernel-parameters-mean/716966</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2018/02/24/2212/grub-%e9%96%8b%e6%a9%9f%e6%9c%83%e5%81%9c%e5%9c%a8-load-ramdisk-%e7%9a%84%e5%95%8f%e9%a1%8c/">GRUB 開機會停在 Load Ramdisk 的問題</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/2018/02/24/2212/grub-%e9%96%8b%e6%a9%9f%e6%9c%83%e5%81%9c%e5%9c%a8-load-ramdisk-%e7%9a%84%e5%95%8f%e9%a1%8c/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[Gentoo] UEFI 系統轉移</title>
		<link>https://blog.richliu.com/2017/10/12/2181/gentoo-uefi-%e7%b3%bb%e7%b5%b1%e8%bd%89%e7%a7%bb/</link>
					<comments>https://blog.richliu.com/2017/10/12/2181/gentoo-uefi-%e7%b3%bb%e7%b5%b1%e8%bd%89%e7%a7%bb/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Thu, 12 Oct 2017 08:59:06 +0000</pubDate>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[EFI]]></category>
		<category><![CDATA[grub]]></category>
		<guid isPermaLink="false">https://blog.richliu.com/?p=2181</guid>

					<description><![CDATA[<p>最近 HGST 6T 硬碟大特價(12000/9999 =&#62; 6200), 之前的硬碟也差不多快四年了  [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2017/10/12/2181/gentoo-uefi-%e7%b3%bb%e7%b5%b1%e8%bd%89%e7%a7%bb/">[Gentoo] UEFI 系統轉移</a> appeared first on <a rel="nofollow" href="https://blog.richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>最近 HGST 6T 硬碟大特價(12000/9999 =&gt; 6200), 之前的硬碟也差不多快四年了 (33319 小時)<br />
剛好提早換硬碟. 看到有人提到的時候去搶只有最後兩顆, 果然運氣不錯<br />
<span id="more-2181"></span></p>
<p>不過收到硬碟的時候發現製造日期是 DEC-2016, 生產快一年了, 應該是賣不出去吧 (註: 剛剛查了一下 amazon.com , 才 US$216 , 所以我們買到只是美國的一般價而己)</p>
<p><a href="https://blog.richliu.com/wp-content/uploads/2017/10/擷取.jpg"><img decoding="async" class="aligncenter size-medium wp-image-2182" src="https://blog.richliu.com/wp-content/uploads/2017/10/擷取-300x191.jpg" alt="HGST 6TB HDD" width="300" height="191" srcset="https://blog.richliu.com/wp-content/uploads/2017/10/擷取-300x191.jpg 300w, https://blog.richliu.com/wp-content/uploads/2017/10/擷取-768x488.jpg 768w, https://blog.richliu.com/wp-content/uploads/2017/10/擷取-1024x651.jpg 1024w, https://blog.richliu.com/wp-content/uploads/2017/10/擷取.jpg 1684w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>轉移的文章可以參考這二篇<br />
<a href="https://blog.richliu.com/2010/01/20/839/raid-5raid-6-mdadm-%e6%8c%87%e4%bb%a4" target="_blank" rel="noopener">Raid5/Raid6 指令</a><br />
<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" target="_blank" rel="noopener">Linux Software Raid 系統轉移</a></p>
<p>這次因為下錯指令結果剛好不小心就從 BIOS Mode, 升級到 UEFI mode.</p>
<p>其實也沒有很難, 以前 GPT + BIOS 的 Partition 長這樣</p>
<pre lang="text">Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048            4095   1024.0 KiB  EF02  BIOS boot partition
   2            4096       209719295   100.0 GiB   FD00  Linux RAID
   3       209719296      5830086655   2.6 TiB     FD00  Linux RAID
   4      5830086656      5860533134   14.5 GiB    FD00  Linux RAID
</pre>
<p>請注意第一個 partition Code 是 EF02, size 只有 1MB, 這個保留給 GRUB 放 boot loader</p>
<p>如果要用 UEFI 開機 Partition table 是這樣,</p>
<pre lang="text">Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          616447   300.0 MiB   EF00  EFI System
   2          616448       420046847   200.0 GiB   FD00  Linux RAID
   3       420046848     11700000000   5.3 TiB     FD00  Linux RAID
   4     11700000768     11721045134   10.0 GiB    FD00  Linux RAID
</pre>
<p>第一個 Partition Table code 是 EF00, 這會 format 成 FAT 格式, 放 EFI Binary<br />
我設 300MB 太大了, 一般 100MB 就可以. 硬碟大就是任性!!</p>
<p>mount partition 並且 install EFI binary</p>
<pre lang="bash">$ mkdir -p /boot/efi
$ mkfs.vfat /dev/sda1
$ mount /dev/sda1 /boot/efi
</pre>
<p>Grub install 的時候改用這個參數</p>
<pre lang="bash">$ grub-install --efi=directory=/boot/efi
</pre>
<p>在 /etc/fstab 加上</p>
<pre lang="text">/dev/sda1  /boot/efi   vfat noauto,noatime 1 2
</pre>
<p>其他我到是沒有改什麼,</p>
<p>至於 BIOS 我是用技嘉的主機板, 在選擇開機選項時就會有一項<br />
(gentoo) HGST HDN726060AL<br />
這個設為第一個就可以了.</p>
<p>感覺移到 EFI 意外的簡單.</p>
<p>接近 190MB/s 算傳統硬碟內非常快的.</p>
<pre lang="text">md11 : active raid1 sda2[0] sdb2[2]
      209715136 blocks [2/1] [U_]
      [=======&gt;.............]  recovery = 38.2% (80207808/209715136) finish=11.5min speed=186778K/sec
      bitmap: 2/2 pages [8KB], 65536KB chunk

</pre>
<p>2018/2/23<br />
不知道為什麼, 今天換主機版的時候開不起來, 理論上之前做的步驟內的 EFI 消失了.<br />
兩顆都消失了那我之前是做什麼的呢?</p>
<p>照上面步驟重新執行一次</p>
<p>另外將檔案 copy 成 default EFI 認得到的檔案, 這樣 EFI BIOS 就直接可以認到了</p>
<p>2022/02/10</p>
<p>兩顆 HGST 似乎在存取上都有點問題，第一顆約半年前下線，下線後大概二個月死亡<br />
第二顆今天也讓他下線了，總使用時數約為 4.3 年左右<br />
果然是特價品啊</p>
<p>The post <a rel="nofollow" href="https://blog.richliu.com/2017/10/12/2181/gentoo-uefi-%e7%b3%bb%e7%b5%b1%e8%bd%89%e7%a7%bb/">[Gentoo] UEFI 系統轉移</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/2017/10/12/2181/gentoo-uefi-%e7%b3%bb%e7%b5%b1%e8%bd%89%e7%a7%bb/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
