Gentoo On X-Gene 1 Mudan

Overview
The Mudan is an AARCH64 (arm64) server board based on the APM X-Gene 1 CPU. It has an a Board Management Controller (BMC) based on the ASPEED-2400 chipset.

The BMC provides remote power on/off, JavaSOL for a remote serial link and for a remote (graphical?) console viewer jviewer. These are both Java Webstart applications and offer low or zero functionality with current javaws.

Plan to do the install without a console. Mine doesn't work yet.

The idea is to prepare the boot disk, install it in the Mudan, boot, then ssh in from a safe distance.

Preparation
Its an EFI based system. Follow the AMD64 handbook for partitioning and so on. Do remember to use the [//distfiles.gentoo.org/experimental/arm64/ arm64 stage3]!!

Use grub as your boot-loader.

A bootable arm64 Linux is required. There are a few steps that must be carried out on the Mudan itself. The Debian one was used after discovering that the Fedora offering would not drive the console.

To use VNC with Fedora, follow this guide. TL;DR you will need to add the following to the boot options: inst.vnc inst.vncpassword=fedora99

Ethernet Ports
The Mudan has two 1GBit Ethernet ports. The one on top of the two USB ports is dedicated to the BMC. The one on its own, or by the two 10Gbit ports is for the server itself. Connect both of them.

Framebuffer Console
After some hints that the framebuffer console is broken sometime after the 4.14 kernel, its confirmed that gentoo-sources:4.14.188 provides a working framebuffer console. Further work shows that EFI framebuffer is broken but astdrmfb, free with the AST DRM driver, works.

The JavaSOL serial console also works in gentoo-sources:4.14.188.

The Install - Off the Mudan
Do as much as possible away from the Mudan. This author chrooted in to the Mudan install on a Raspberry Pi4 to do the rc-config setup and build grub then cross compiled the kernel.

Partition The Drive Untar the Stage3 Untar the portage snapshot

The Kernel
Installing crossdev and the kernel build process is covered by Raspberry_Pi_3_64_bit_Install.

The key differences are: The kernel options required As the Mudan is an EFI system, the EFI firmware provides the Device Tree Binary (*.dtb)

The manual kernel configuration and install process is assumed to create a kernel that can boot without the aid of an initrd.

Kernel Options
This author used the Raspberry Pi kernel tree and added APM-X-Gene and AST options. This provides a system that can boot on both a Raspberry Pi and the Mudan. That's a very good thing for user space testing and configuration and is an excellent excuse to invest in a Pi 4 too.

Be aware that the kernel can be compiled to run on X-Gene, which in the main processor or on the AST-2400 BMC. The options for building the kernel to run on the BMC are hidden behind ARCH_ASPEED, which should be off.

Under Platform selection [*] Broadcom BCM2835 family [*] AppliedMicro X-Gene SOC Family will do nicely.

Use the make menuconfig search to find all the symbols with XGENE in their names and enable them as <*>.

<*> AST server chips

Should be the DRM driver for AST GPU but I don't get anything on the VGA output once the kernel loads.

Install the kernel to suit both the Pi and Mundan under the stage3 and boot it on the Pi. Unless your Pi does USB booting, the kernel binary will need to be installed into both the Mudan and Pis /boot.

Grub
On the Pi, install Grub2 following Handbook:AMD64/Installation/Bootloader.

/etc/default/grub requires the following additions LANG=C GRUB_DISABLE_LINUX_UUID=true GRUB_DISABLE_LINUX_PARTUUID=false
 * 1) fix boot error    error: file /boot/grub/locale/C.gmo not found
 * 1)  Do not use UUID do use PARTUUID

Grub can be installed but as the Pi is not an EFI system, it will fail trying to to update the efivars. Repeating this step is the only thing that must be done on the Mudan.

Userspace
Adding the following is a good start.

app-admin/sudo app-misc/screen app-portage/eix app-portage/gentoolkit app-text/wgetpaste net-misc/dhcpcd net-misc/ntp sys-apps/pciutils sys-apps/usbutils sys-boot/grub sys-process/htop

Access will be via ssh. You will need a way to obtain root over ssh. Be sure that you have a way to do that before the HDD is moved to the Mudan.

Move to the Mudan
Boot the Debian arm64 install from a USB stick and use its Rescue Mode to get a shell from the Gentoo install. That will take a bit of coaxing from JavaSOL.

Mount /boot if its not already mounted and rerun grub-install. This time it will update the efivars.

Shutdown the system.

The First Boot
Go into the setup and choose the gentoo entry as the first boot option. Save and Reset then wait while it does its thing. You may or may not see the grub menu. I see it on the VGA console but not in JavaSOL.

Discover the IP address that the Mudan is on and log in over ssh.

A Bootable USB
Since I want to try root in LVM without an initrd, I've made a bootable USB stick. Its a arm64 stage3, with gentoo-sources:4.14.188, so the console works, with a few other packages to make logging in over ssh 'just' work.

Its provided as two tarballs, one for /boot and one for root. There is no ::gentoo repo, distfiles or packages.

The root password is root and the normal user, named demouser has demouser for a password. Root password based logins over ssh are not permitted but demouser is in the wheel group.

How to use it
A 4G USB stick or larger is required.

Filesystem     Size  Used Avail Use% Mounted on /dev/sdb2        13G  1.9G   11G  16% /mnt/gentoo /dev/sdb1      122M   22M  100M  19% /mnt/gentoo/boot

Make a vfat filesystem for /boot and an ext4 filesystem for root. Add swap to taste but its intended as an install tool, not a working system.

Fetch the tarball and untar it.

May Be Useful, Possibly Only Vaguely Related Things
Information on the Mudan Server is very thin on the ground. Links to things that might be useful go here.

Gigabyte MP30-AR0
Gigabyte marketed a server based on the X-Gene 1 and AST2400 BMC. The bits are scattered around on the motherboard differently to the Mudan https://www.gigabyte.com/uk/Server-Motherboard/MP30-AR0-rev-11/support#support-manual but its the same major components.

WikiChip
WikiChip has a page or two https://en.wikichip.org/wiki/apm/x-gene

There are product briefs for a 1U and 2U server too.

Fitting RAM
From trial and error the Mudan is very picky about where RAM is fitted and which order RAM is fitted.

The Blue sockets must be populated first.