Motherboard Porting Guide

The wiki is being retired!

Documentation is now handled by the same processes we use for code: Add something to the Documentation/ directory in the coreboot repo, and it will be rendered to https://doc.coreboot.org/. Contributions welcome!

Motherboard Porting Guide

Please note that this is WIP work.

HOWTO to find a way

 superiotool: cd coreboot/util/superiotool; make; sudo make install
 inteltool:cd coreboot/util/inteltool; make; sudo make install
 ectool: cd coreboot/util/ectool; make; sudo make install
 dmidecode: git clone https://git.savannah.nongnu.org/git/dmidecode.git
 msrtool: cd coreboot/util/msrtool; ./configure; make; sudo make install
 nvramtool: cd coreboot/util/nvramtool; make; sudo make install
 flashrom: git clone https://review.coreboot.org/flashrom.git
 # lspci
 # dmesg
 # acpitool
 # lsusb
 # acpidump
 # modprobe msr
 lspci -nnvvvxxxx > lspci.log 2> lspci.err.log
 lsusb -vvv > lsusb.log 2> lsusb.err.log
 superiotool -deV > superiotool.log 2> superiotool.err.log
 inteltool -a > inteltool.log 2> inteltool.err.log
 ectool -i > ectool.log 2> ectool.err.log
 msrtool > msrtool.log 2> msrtool.err.log
 dmidecode > dmidecode.log 2> dmidecode.err.log
 biosdecode > biosdecode.log 2> biosdecode.err.log
 nvramtool -x > nvramtool.log 2> nvramtool.err.log
 dmesg > dmesg.log 2> dmesg.err.log
 acpidump > acpidump.log 2> acpidump.err.log
 for x in /sys/class/sound/card0/hw*; do cat "$x/init_pin_configs" > pin_"$(basename "$x")"; done
 for x in /proc/asound/card0/codec#*; do cat "$x" > "$(basename "$x")"; done
 cat /proc/cpuinfo > cpuinfo.log 2> cpuinfo.err.log
 cat /proc/ioports > ioports.log 2> ioports.err.log
 cat /sys/class/input/input*/id/bustype > input_bustypes.log
 flashrom -V -p internal:laptop=force_I_want_a_brick > flashrom_info.log 2> flashrom_info.err.log
 flashrom -V -p internal:laptop=force_I_want_a_brick -r rom.bin > flashrom_read.log 2> flashrom_read.err.log

Here's the warning you get when running the above commands without the laptop=force_I_want_a_brick parameter on an unsupported laptop:

========================================================================
WARNING! You seem to be running flashrom on an unsupported laptop.
Laptops, notebooks and netbooks are difficult to support and we
recommend to use the vendor flashing utility. The embedded controller
(EC) in these machines often interacts badly with flashing.
See the manpage and https://flashrom.org/Laptops for details.

If flash is shared with the EC, erase is guaranteed to brick your laptop
and write may brick your laptop.
Read and probe may irritate your EC and cause fan failure, backlight
failure and sudden poweroff.
You have been warned.
========================================================================

For laptop, additionally:

Preparing recovery method

Inevitably when you develop coreboot there will be unbootable builds and so you'll need a way to unbrick your machine after installing a failed image. There are several ways to do so. Main ones are:

In any case you have to locate the flash chip. Note the chipname from flashrom output. Teardown your system and find that chip. For how it usually looks like, consult this page. If you have a scanner, take a high-resolution scan of your motherboard since it may be useful later.

Selecting a Similar Board

The most important criteria for finding a similar board is the chipset. Look at northbridge (device 0:0.0) and southbridge (LPC controller) in the lspci output. Use grep on the coreboot tree to find how those chipsets are named, and then grep for the chipset name (case-insensitive) to find a board which uses it. If there are several of them, try to match (in order of decreasing importance) the system type (desktop/laptop), Super I/O and manufacturer.


Adding a new board

This is a two step process. If your mainboard already exists in the coreboot source tree, skip to next section.

Adding a new vendor to the tree

Create a directory in src/mainboard with the same name as the vendor name. Add to src/mainboard/Kconfig a new vendor entry. The rest of this example uses "foo" vendor.

config VENDOR_FOO
      bool "Foo"

Add also an include for the new Kconfig file which holds the vendor motherboards in the vendor directory:

source "src/mainboard/foo/Kconfig"

Create a src/mainboard/foo/Kconfig file, copying it from some other vendor, and then change the vendor name. Delete all mainboards.

Adding a new motherboard to the tree

Assume in these examples that the vendor name is foo and the board type is bar. Add a new configuration item in src/mainboard/foo/Kconfig:

config BOARD_FOO_BAR
       bool "BAR"

Add include a board specific config:

source "src/mainboard/foo/bar/Kconfig"

Adjusting the contents of the new board directory

Now copy the files of your similar board and start adjusting them. Your first stop is the Kconfig file.

-if BOARD_VENDOR_BAR
+if BOARD_VENDOR_BAZ

Look through the options and adjust.

Adjust Kconfig to fit the new vendor/model name and don't forget to change MAINBOARD_DIR and MAINBOARD_PART_NUMBER.