<?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>OpenBMC &#8211; richliu&#039;s blog</title>
	<atom:link href="https://blog.richliu.com/tag/openbmc/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.richliu.com</link>
	<description>Linux, 工作, 生活, 家人</description>
	<lastBuildDate>Thu, 06 Feb 2025 08:48:17 +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 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 fetchpriority="high" 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>
	</channel>
</rss>
