====== Information ======
* ASUS KCMA-D8 Motherboard
====== Resources ======
* [[https://www.asus.com/Commercial-Servers-Workstations/KCMAD8/overview/|Overview]]
* [[https://www.asus.com/Commercial-Servers-Workstations/KCMAD8/specifications/|Specifications]]
* [[https://www.asus.com/Commercial-Servers-Workstations/KCMAD8/HelpDesk/|Drivers]]
* [[https://dlcdnets.asus.com/pub/ASUS/mb/SocketC(1027)/KCMA-D8/Manual&QVL/e6016_kcma-d8.pdf|Manual]]
===== Manual =====
* [[https://dlcdnets.asus.com/pub/ASUS/mb/SocketC(1027)/KCMA-D8/Manual&QVL/e6016_kcma-d8.pdf#p36|Memory Configuration]]
* [[https://dlcdnets.asus.com/pub/ASUS/mb/SocketC(1027)/KCMA-D8/Manual&QVL/e6016_kcma-d8.pdf#p40|PCI Slot Speeds]]
* [[https://dlcdnets.asus.com/pub/ASUS/mb/SocketC(1027)/KCMA-D8/Manual&QVL/e6016_kcma-d8.pdf#p44|Jumpers]]
====== Coreboot ======
===== Issues =====
* :!: Apparently Coreboot dropped support for this motherboard in ''master'' after 2019
* When booting Ubuntu 18.10+, there's a gfx error; type ''help'' and press ''Enter'' to boot ((this can be avoided by using an external GPU and disabling the generated VBIOS option for SeaBIOS, but otherwise this isn't a big issue))
* Jumpers seem to act slightly different with Coreboot ((can't disable individual Ethernet ports and it's all or nothing; ASpeed GPU only needs top jumper moved to enable while the second jumper can stay on disabled))
* Windows 10's installer can't start ((''ACPI_BIOS_ERROR'' BSoD; requires disabling the generated VBIOS option for SeaBIOS to get to that point or otherwise the installer hangs after loading files))
* For unknown reasons, some builds of Coreboot from ''master'' have unreliable POST; using the release tar of 4.9 works fine though, and from ''master'', 2019/07/06 is the last known-good version too
* TianoCore payload compiles, but didn't boot as of 2019/07/17 ((I think because of it needing onboard/native graphics? SeaBIOS with the same build of CB works fine))
===== RAM =====
==== Incompatible ====
* [[https://www.samsung.com/semiconductor/dram/module/M393B5270CH0-CH9/|Samsung M393B5270CH0-CH9]] ((incompatible with Coreboot 2019/01/16, untested with Libreboot, untested with ASUS Vendor BIOS))
* [[https://www.skhynix.com/eolproducts.view.do?pronm=DDR3+SDRAM&srnm=HMT151R7BFR4C&rk=20&rc=module|SK Hynix HMT151R7BFR4C-H9]] ((incompatible with Coreboot 2019/01/16, compatible with Libreboot 20160907, compatible with ASUS Vendor BIOS 3303)) (([[https://ticket.coreboot.org/issues/190|Ticket]]))
==== Compatible ====
* Nanya NT2GC64B88B0NF-CG ((compatible with Coreboot 2019/01/17, incompatible with Libreboot 20160907, compatible with ASUS Vendor BIOS 3303))
* Micron 16JTF25664AZ-1G4F1 ((compatible with Coreboot 2019/01/17, incompatible with Libreboot 20160907, compatible with ASUS Vendor BIOS 3303))
* Samsung M378B5273CH0-CK0 ((compatible with Coreboot 2019/01/19, untested with Libreboot, compatible with ASUS Vendor BIOS 3303))
===== Dependencies =====
* :!: Coreboot cannot currently be compiled on distros with GNAT 9.0 or higher, including openSUSE TW and Fedora 30
* Creating a quick Ubuntu 18.04 server install in a VM works fine
==== Ubuntu Server ====
****
sudo apt-get install -y bison build-essential curl flex git gnat libncurses5-dev m4 zlib1g-dev python-minimal
=== TianoCore ===
****
uuid-dev nasm
===== Download Source =====
****
cd ~ && mkdir -p ~/'Projects' && rm -Rf ~/'Projects/coreboot/src' && sync && git clone --branch 'master' --depth '1' --recurse-submodules 'https://review.coreboot.org/coreboot.git' ~/'Projects/coreboot/src' && sync
===== Build Toolchain =====
****
cd ~/'Projects/coreboot/src' && make 'crossgcc-clean' && make 'crossgcc-i386' CPUS='16'
===== Settings =====
* :!: ''Use CMOS for configuration values'' speeds up boot significantly
* :!: Including CPU microcode caused Linux to kernel panic on 2019/04/16
* :!: For some unknown reason, POST randomly fails at times depending on when Coreboot is built, regardless of what config settings are used
* Last updated: 2019/05/22
* Mainboard vendor: ASUS
* Mainboard model: KCMA-D8
* ROM chip size: 2048 KB (2MB)
* System Power State after Failure: S5 Soft Off
* Local version string: Nightwane
* [*] Use CMOS for configuration values
* [*] Load default configuration values into CMOS on each boot
* [ ] Compress ramstage with LZMA
* [ ] Include the coreboot .config file into the ROM image
* [ ] Create a table of timestamps collected during boot
* Include CPU microcode in CBFS: Do not include microcode updates
* [*] Enable high speed SPI clock
* [ ] Serial port on SuperIO
* [ ] Support Intel PCI-e WiFi adapters
* [ ] Send console output to a CBMEM buffer
* Default console log level: 0: EMERG
* [*] Don't show any POST codes
* SeaBIOS version: master
* [*] Hardware init during option ROM execution
* SeaBIOS debug level (verbosity): 0
cd ~/'Projects/coreboot/src' && make 'distclean' && make 'nconfig' && sync
==== Query ====
* Presents config options that are changed from defaults
* [[https://coreboot.org/status/kconfig-options.html|Reference]]
* Last updated: 2019/05/22
cd ~/'Projects/coreboot/src' && make 'savedefconfig' && gio open ~/'Projects/coreboot/src/defconfig'
CONFIG_LOCALVERSION="Nightwane"
CONFIG_USE_OPTION_TABLE=y
CONFIG_STATIC_OPTION_TABLE=y
# CONFIG_COMPRESS_RAMSTAGE is not set
# CONFIG_INCLUDE_CONFIG_FILE is not set
# CONFIG_COLLECT_TIMESTAMPS is not set
CONFIG_VENDOR_ASUS=y
CONFIG_BOARD_ASUS_KCMA_D8=y
# CONFIG_DRIVERS_UART_8250IO is not set
CONFIG_POWER_STATE_OFF_AFTER_FAILURE=y
# CONFIG_CONSOLE_CBMEM is not set
CONFIG_CPU_MICROCODE_CBFS_NONE=y
CONFIG_SOUTHBRIDGE_AMD_SB700_33MHZ_SPI=y
# CONFIG_DRIVERS_INTEL_WIFI is not set
CONFIG_DEFAULT_CONSOLE_LOGLEVEL_0=y
CONFIG_NO_POST=y
CONFIG_SEABIOS_MASTER=y
CONFIG_SEABIOS_THREAD_OPTIONROMS=y
CONFIG_SEABIOS_DEBUG_LEVEL=0
===== CMOS Settings =====
* Last updated: 2019/05/23
nano ~/'Projects/coreboot/src/src/mainboard/asus/kcma-d8/cmos.default'
l3_cache_partitioning=Enable
experimental_memory_speed_boost=Enable
===== Make =====
****
cd ~/'Projects/coreboot/src' && make clean && make && sync
===== Finalize =====
****
mkdir -p ~/'coreboot-bin' && mv ~/'Projects/coreboot/src/build/coreboot.rom' ~/'coreboot-bin/KCMAD8-coreboot-'$(date +%Y-%m-%d)'.rom' && sync
==== Virtual Machine ====
* :!: Change ''X'' to the VM instance's IP address
scp 192.168.122.X:~/coreboot-bin/*.rom ~/Downloads
===== Flash =====
* :!: Add ''internal:amd_imc_force=yes'' after the ''--programmer'' flag if flashing from ASUS proprietary BIOS ((expect to see an IMC-related error after the flash; this prevents verifying the flash chip contents, but as long as it flashes correctly this isn't an issue)) ((this IMC flag isn't necessary once Coreboot or Libreboot is flashed and booted from)) ((there's more prerequisites to use that flag; may need ''iomem=relaxed'' and a kernel older than 5.0))
sync && sudo flashrom --programmer 'internal' --write ~/'Downloads/KCMAD8-coreboot-'*'.rom'
===== Fan Control =====
* If OpenBMC is figured out, this may be superseded
* :!: Answer ''yes'' to all ''sensors-detect'' prompts and reboot for ''fancontrol'' to run
sudo dnf install 'lm_sensors' && sudo sensors-detect && sudo -e '/etc/fancontrol' && sudo systemctl enable 'fancontrol'
INTERVAL=10
DEVNAME=/sys/class/hwmon/hwmon6=w83795g
FCTEMPS=/sys/class/hwmon/hwmon6/device/pwm2=/sys/class/hwmon/hwmon6/device/temp8_input
FCFANS=/sys/class/hwmon/hwmon6/device/fan1_input+/sys/class/hwmon/hwmon6/device/fan2_input
MINTEMP=/sys/class/hwmon/hwmon6/device/pwm2=50
MAXTEMP=/sys/class/hwmon/hwmon6/device/pwm2=60
MINSTART=/sys/class/hwmon/hwmon6/device/pwm2=4000
MINSTOP=/sys/class/hwmon/hwmon6/device/pwm2=0