APM X-C1 (Mustang)

From Leo's Notes
Revision as of 17:02, 19 June 2015 by Leo (talk | contribs)
This page was last edited on 19 June 2015, at 17:02.

The APM X-C1 (code name Mustang) is a server chip under their X-GENE family of products.

First Look

U-Boot

The board came with U-Boot loaded. When the system is first turned on, you will see the following in the console:

U-Boot 2013.04-mustang_sw_1.12.09-beta (Jun 12 2014 - 10:48:45)

CPU0: APM ARM 64-bit Potenza Rev A3 2400MHz PCP 2400MHz
     32 KB ICACHE, 32 KB DCACHE
     SOC 2000MHz IOBAXI 400MHz AXI 250MHz AHB 200MHz GFC 125MHz
Boot from SPI-NOR
Board: Mustang - AppliedMicro APM883208-xNA24SPT Reference Board
I2C:   ready
DRAM:  ECC 16 GiB @ 1600MHz
SF: Detected N25Q256 with page size 256 Bytes, total 32 MiB
MMC:   X-Gene SD/SDIO/eMMC: 0
PCIE0: (RC) link down
In:    serial
Out:   serial
Err:   serial
CPUs:  11111111
Net:   eth0

Here are the environment variables that are set in the U-Boot shell out of the box:

Mustang# printenv
addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off panic=1
addmisc=setenv bootargs ${bootargs} earlyprintk=uart8250-32bit,0x1c020000 debug maxcpus=${num_cores} swiotlb=65536
addtty=setenv bootargs ${bootargs} console=ttyS0,${baudrate}
baudrate=115200
bootcmd=run sata_self
bootdelay=5
bootfile=uImage
dnsip=10.66.18.10
enet=8
enet_mode=x:n
eth1addr=00:01:73:02:21:35
eth2addr=00:01:73:02:21:36
eth3addr=00:01:73:02:21:37
ethact=eth0
ethaddr=00:01:73:02:21:34
fdt_addr_f=0x1000000
fdt_addr_r=0x4003000000
fdt_file=apm-mustang.dtb
fdt_size=7285
flash_nfs=run nfsargs addip addtty addmisc; bootm ${kern_addr_f}
flash_self=run ramargs addip addtty addmisc; bootm ${kern_addr_f} ${ramdisk_addr_f} ${fdt_addr_f}
fw_addr_r=0x4003800000
gatewayip=10.66.19.1
hostname=dhcp-10-66-19-173
initrd_high=0x43e0000000
ipaddr=10.66.19.173
kern_addr_f=0x100000
kern_addr_r=0x4002000000
kern_size=a9a050
kernel_addr_r=0x4002000000
load=tftp ${uboot_addr_r} ${user_dir}/${u-boot}
load_fdt=tftp ${fdt_addr_r} ${user_dir}/${fdt_file}
load_kern=tftp ${kern_addr_r} ${user_dir}/${bootfile}
load_ramdisk=tftp ${ramdisk_addr_r} ${user_dir}/${ramdisk_file}
loadaddr=0x100000000
media_addr_r=0x4001000000
media_img=mustang_media.img
mgmt_enet=e
mslim_bootfile=uImage-mslim
mslim_fdt_addr_r=0x43f0600000
mslim_fdt_file=mslim-mustang.dtb
mslim_kern_addr_r=0x43f1000000
mslim_net_self=run net_load_mslim; startmslim
mslim_ramdisk_addr_r=0x43f2000000
mslim_ramdisk_file=uRamdisk-mslim
mslim_sd_self=run sd_load_mslim; startmslim
mslim_uboot_addr_r=0x43f0000000
mslim_uboot_file=u-boot-mslim.bin
mslim_user_dir=mslim
net_load_mslim=run nload_mslim_uboot nload_mslim_kern nload_mslim_ramdisk nload_mslim_fdt
net_nfs=run load_kern load_fdt; run nfsargs addip addtty addmisc; bootm ${kern_addr_r} - ${fdt_addr_r}
net_sata=run load_kern load_fdt; run sataargs addip addtty addmisc; bootm ${kern_addr_r} - ${fdt_addr_r}
net_self=run net_self_load; run ramargs addip addtty addmisc; bootm ${kern_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
net_self_load=run load_kern load_ramdisk load_fdt
netdev=eth0
netmask=255.255.255.0
nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath}
nload_mslim_fdt=tftp ${mslim_fdt_addr_r} ${mslim_user_dir}/${mslim_fdt_file}
nload_mslim_kern=tftp ${mslim_kern_addr_r} ${mslim_user_dir}/${mslim_bootfile}
nload_mslim_ramdisk=tftp ${mslim_ramdisk_addr_r} ${mslim_user_dir}/${mslim_ramdisk_file}
nload_mslim_uboot=tftp ${mslim_uboot_addr_r} ${mslim_user_dir}/${mslim_uboot_file}
num_cores=8
pcie_gen=3:3:3:3:3
pcie_mode=RP:NA:NA:NA:NA
pcie_reset=y:n:n:n:n
pxefile_addr_r=0x4001000000
ram_nfs=run nfsargs addip addtty addmisc; bootm ${kern_addr_r} - ${fdt_addr_r}
ram_self=run ramargs addip addtty addmisc; bootm ${kern_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
ramargs=setenv bootargs root=/dev/ram rw
ramdisk_addr_f=0x1100000
ramdisk_addr_r=0x4004000000
ramdisk_file=uRamdisk_basic
ramdisk_size=344abe
rgmii_phyid=3
rootpath=/opt/nfsrootfs/arm64/release
sata=0x3c
sata_enet=e:e:n:n
sata_load_fdt=ext4load scsi 0:1 0x4003000000 apm-mustang.dtb
sata_load_kern=ext4load scsi 0:1 0x4002000000 uImage
sata_self=scsi init; run sata_load_kern sata_load_fdt; run sataargs addip addtty addmisc; bootm 0x4002000000 - 0x4003000000
sataargs=setenv bootargs root=/dev/sda1 rw
script_addr_r=0x4004000000
sd_load_mslim=mmc dev 0; run sdload_mslim_uboot sdload_mslim_kern sdload_mslim_ramdisk sdload_mslim_fdt
sd_self=mmc dev 0; ext2load mmc 0  ${kern_addr_r} ${bootfile}; ext2load mmc 0  ${fdt_addr_r} ${fdt_file}; ext2load mmc 0  ${ramdisk_addr_r} ${ramdisk_file}; run ram_self
sdload_mslim_fdt=ext2load mmc 0 ${mslim_fdt_addr_r} ${mslim_fdt_file}
sdload_mslim_kern=ext2load mmc 0 ${mslim_kern_addr_r} ${mslim_bootfile}
sdload_mslim_ramdisk=ext2load mmc 0 ${mslim_ramdisk_addr_r} ${mslim_ramdisk_file}
sdload_mslim_uboot=ext2load mmc 0 ${mslim_uboot_addr_r} ${mslim_uboot_file}
sdphy=1
serverip=10.66.19.133
sgmii_phyid=4:5::
spi_fdt_upd=run load_fdt; setenv fdt_size ${filesize}; save; run update_fdt
spi_fw_img=mustang_slimpro_ext_spi.bin
spi_fw_load=tftp ${fw_addr_r} ${user_dir}/${spi_fw_img}
spi_fw_upd=run spi_fw_load;run spi_fw_update
spi_fw_update=bmc stop; i2c dev 1; eeprom write ${fw_addr_r} 0x0 ${filesize}
spi_kern_upd=run load_kern; setenv kern_size ${filesize}; save; run update_kern
spi_load=tftp ${media_addr_r} ${user_dir}/${media_img}
spi_ramdisk_upd=run load_ramdisk; setenv ramdisk_size ${filesize}; save; run update_ramdisk
spi_self=sf probe 0; sf read ${kern_addr_r} ${kern_addr_f} ${kern_size}; sf read ${fdt_addr_r} ${fdt_addr_f} ${fdt_size}; sf read ${ramdisk_addr_r} ${ramdisk_addr_f} ${ramdisk_size}; run ram_self
spi_upd=run spi_load;run spi_update
spi_update=sf probe 0; sf erase 0x0 ${filesize}; sf write ${media_addr_r} 0x0 ${filesize}
stderr=serial
stdin=serial
stdout=serial
u-boot=u-boot.bin
uboot_addr_f=0x8100000000
uboot_addr_r=0x4001000000
uboot_size=0x80000
upd=run load; setenv uboot_size ${filesize};run update
updall=run spi_kern_upd; run spi_ramdisk_upd; run spi_fdt_upd
update=protect off ${uboot_addr_f} +${uboot_size}; erase ${uboot_addr_f} +${uboot_size}; cp.b ${uboot_addr_r} ${uboot_addr_f} ${uboot_size}
update_fdt=sf probe 0; sf erase ${fdt_addr_f} ${filesize}; sf write ${fdt_addr_r} ${fdt_addr_f} ${filesize}
update_kern=sf probe 0; sf erase ${kern_addr_f} ${filesize}; sf write ${kern_addr_r} ${kern_addr_f} ${filesize}
update_ramdisk=sf probe 0; sf erase ${ramdisk_addr_f} ${filesize}; sf write ${ramdisk_addr_r} ${ramdisk_addr_f} ${filesize}
user_dir=/1.12.09-Beta/BUILDS/potenza
xgmii_phyid=:

Environment size: 5832/32764 bytes

The system comes with their version of Linux installed. It's using a custom version of the 3.12 Linux Kernel. Interestingly, the hostname does not reflect the actual IP address, so most likely it's the IP from a network install from the factory.

     POWERED BY:

     X     X             GGGG
      X   X             G    G
       X X             G         EEEEE   N NNNN    EEEEE
        X     #######  G   GGG  E     E  NN    N  E     E
       X X             G     G  EEEEEEE  N     N  EEEEEEE
      X   X             G    G  E        N     N  E
     X     X             GGGGG   EEEEE   N     N   EEEEE   (TM)

     Welcome to Applied Micro X-Gene 64-bit ARM Server Platform

Applied Micro Linux 3.12.0-mustang_sw_1.12.09-beta (aarch64) (ttyS0)
dhcp-10-66-19-173 login: root
Password:
[root@dhcp-10-66-19-173 ~]# cat /proc/cpuinfo
Processor       : AArch64 Processor rev 0 (aarch64)
processor       : 0
model name      : APM X-Gene Mustang board @ 2.40GHz
cpu MHz         : 2400.00
fpu             : yes

processor       : 1
model name      : APM X-Gene Mustang board @ 2.40GHz
cpu MHz         : 2400.00
fpu             : yes

processor       : 2
model name      : APM X-Gene Mustang board @ 2.40GHz
cpu MHz         : 2400.00
fpu             : yes

processor       : 3
model name      : APM X-Gene Mustang board @ 2.40GHz
cpu MHz         : 2400.00
fpu             : yes

processor       : 4
model name      : APM X-Gene Mustang board @ 2.40GHz
cpu MHz         : 2400.00
fpu             : yes

processor       : 5
model name      : APM X-Gene Mustang board @ 2.40GHz
cpu MHz         : 2400.00
fpu             : yes

processor       : 6
model name      : APM X-Gene Mustang board @ 2.40GHz
cpu MHz         : 2400.00
fpu             : yes

processor       : 7
model name      : APM X-Gene Mustang board @ 2.40GHz
cpu MHz         : 2400.00
fpu             : yes

Features        : fp asimd
CPU implementer : 0x50
CPU architecture: AArch64
CPU variant     : 0x0
CPU part        : 0x000
CPU revision    : 0

Hardware        : APM X-Gene Mustang board

Installing Fedora

To install Fedora on the system, we need to get the UEFI loader running first. You can either chainload this from U-Boot by having U-Boot run the UEFI loader from the SD card on start-up, or flash it directly to the system and replace the U-Boot loader altogether.

Chain-Loading UEFI

Since I don't want to replace U-Boot, I will chainload it during startup.

Before you begin, read through the guide on the FedoraProject wiki: https://fedoraproject.org/wiki/Architectures/AArch64/Hardware/Mustang?rd=Architectures/ARM/AArch64/Mustang

Download mustang_uefi_upgrade.tar.gz and dump the contents onto a 2GB FAT16 formatted SD card partition. U-Boot doesn't appear to see the partition if it is any larger than 2GB. Insert the SD card into the X-C1 board and turn it on. Enter the U-Boot shell and run the following:

U-Boot 2013.04-mustang_sw_1.12.09-beta (Jun 12 2014 - 10:48:45)

CPU0: APM ARM 64-bit Potenza Rev A3 2400MHz PCP 2400MHz
     32 KB ICACHE, 32 KB DCACHE
     SOC 2000MHz IOBAXI 400MHz AXI 250MHz AHB 200MHz GFC 125MHz
Boot from SPI-NOR
Board: Mustang - AppliedMicro APM883208-xNA24SPT Reference Board
I2C:   ready
DRAM:  ECC 16 GiB @ 1600MHz
SF: Detected N25Q256 with page size 256 Bytes, total 32 MiB
MMC:   X-Gene SD/SDIO/eMMC: 0
PCIE0: (RC) link down
In:    serial
Out:   serial
Err:   serial
CPUs:  11111111
Net:   eth0
Hit any key to stop autoboot:  0
Mustang# '''setenv rh_sd_tiano_sec_ubt fatload mmc 0:1 0x1d000000''' /mustang/mustang_tianocore_sec_ubt.fd
Mustang# '''setenv rh_sd_tiano_ubt fatload mmc 0:1 0x4002000000''' /mustang/mustang_tianocore_ubt.fd
Mustang# '''setenv rh_run_tiano_ubt go 0x1d000000'''
Mustang# '''setenv bootcmd run rh_sd_tiano_ubt rh_sd_tiano_sec_ubt rh_run_tiano_ubt'''
Mustang# '''saveenv'''
Saving Environment to SPI Flash...
SF: Detected N25Q256 with page size 256 Bytes, total 32 MiB
.Erasing SPI flash.....SF: STMicro: Successfully erased 262144 bytes @ 0xc0000
Writing to SPI flash.......done
Mustang# reset
resetting ...
cold reset ...▒

When the system starts again, let U-Boot boot from the SD card (or run the command manually). Stop the UEFI loader from autobooting and enter the shell.

Mustang# '''run rh_sd_tiano_ubt rh_sd_tiano_sec_ubt rh_run_tiano_ubt'''
reading /mustang/mustang_tianocore_ubt.fd
1835008 bytes read in 1426 ms (1.2 MiB/s)
reading /mustang/mustang_tianocore_sec_ubt.fd
262144 bytes read in 1295 ms (197.3 KiB/s)
## Starting application at 0x1D000000 ...
X-Gene Mustang Board
Boot firmware (version 1.1.0 built at 12:03:43 on Mar 23 2015)
PROGRESS CODE: V3020003 I0
PROGRESS CODE: V3020002 I0
PROGRESS CODE: V3020003 I0
PROGRESS CODE: V3020002 I0
PROGRESS CODE: V3020003 I0
PROGRESS CODE: V3020002 I0
PROGRESS CODE: V3020003 I0
PROGRESS CODE: V3021001 I0
TianoCore 1.1.0 UEFI 2.4.0 Mar 23 2015 12:03:18
CPU: APM ARM 64-bit Potenza Rev A3 2400MHz PCP 2400MHz
     32 KB ICACHE, 32 KB DCACHE
     SOC 2000MHz IOBAXI 400MHz AXI 250MHz AHB 200MHz GFC 125MHz
Board: X-Gene Mustang Board
Slimpro FW:
        Ver: 2.1
The default boot selection will start in   4 seconds
[1] Shell
[2] Boot Manager
[3] Reboot
[4] Shutdown
Start: '''1'''


UEFI Interactive Shell v2.0
EDK II
UEFI v2.40 (X-Gene Mustang Board EFI Mar 23 2015 12:04:07, 0x00000000)
Mapping table
      FS0: Alias(s):HD13b:;BLK5:
          VenHw(B225ED30-6DFD-43A9-BF6B-5753358F2F70)/HD(1,MBR,0x000F06A6,0x800,0x400000)
     BLK3: Alias(s):
          VenHw(6C9CEEF0-A406-11E3-A5E2-0800200C9A66)
     BLK2: Alias(s):
          VenHw(02118005-9DA7-443A-92D5-781F022AEDBB)
     BLK6: Alias(s):
          VenHw(F40A3869-92C4-4275-8501-4491A1A20C19)
     BLK4: Alias(s):
          VenHw(B225ED30-6DFD-43A9-BF6B-5753358F2F70)
     BLK0: Alias(s):
          PciRoot(0x6)/Pci(0x0,0x0)/Sata(0x0,0x0,0x0)
     BLK1: Alias(s):
          PciRoot(0x6)/Pci(0x0,0x0)/Sata(0x0,0x0,0x0)/HD(1,MBR,0xC63EB28B,0x800,0x3A385830)