Coreboot Setup
From Sage Wiki
Manual Coreboot Setup and Install
Please Read through all the steps once before starting. This will help you understand all of the instructions.
Jump to the coreboot setup if you are using the EDK samples projects.
Get coreboot and Build the Toolchain
- Get coreboot: http://www.coreboot.org/Download_coreboot and put the coreboot source in a convenient location, for example:
c:\sage\coreboot(c:\path\to\corebootin remainder of this document). Note - This is a large 210MB+ download.. - Build the cross compile tools in Cygwin or MinGW. Warning: This takes 2+ hours to build. Only build it the first time or if the crossgcc tools are updated.
- Start Cygwin or MinGW rxvt-native or mintty shell
-
$ cd /path/to/.../coreboot/utils/crossgcc/- Optional: Edit the file "buildgcc" to change revision of the tools built (such as GDB)
-
$ ./buildgcc- Optional: use the -j # option to set the number of cores available on your system. This will improve build time.
- Wait several hours and the build will result in a xgcc/ directory
- IASL is included in the Sage EDK. Skip to the next section if it is installed.
- Build IASL for Cygwin
- Get the ACPI source here: http://www.acpica.org/downloads/unix_source_code.php
- Decompress and build iasl (acpi compiler):
- Open a Cygwin shell (e.g. rxvt-native or mintty)
-
$ cd /cygdrive/path/to/acpica/compiler -
$ make
- Build IASL for MinGW
- Get the ACPI Windows source here: http://www.acpica.org/downloads/source_code.php
- Decompress and patch
- There is no GNU Makefile included in the Windows source package.
- Copy http://code/svn/tools/toolchain/mingw32/patches/acpica-win-20100702/source/compiler/Makefile into the acpica source tree.
- Build iasl (acpi compiler):
- Open a Mingw shell (e.g. rxvt-native or mintty)
-
$ cd /c/path/to/acpica/source/compiler -
$ make
- Build IASL for Cygwin
- Add IASL to Cygwin's or MinGW's local tools.
- copy iasl.exe to /usr/local/bin
-
$ cp iasl.exe /usr/local/bin
-
- Alternative for Cygwin: Get the pre-build iasl_cygwin.exe for Cygwin from Sage: http://download.se-eng.com/coreboot, rename it to iasl.exe and put it in your
/usr/local/bin(c:\cygwin\usr\local\bin). Note: the iasl compiler from 03/2010 had a bug and was not building coreboot correctly. - Alternative for MinGW: Get the pre-build iasl_mingw.exe for MinGW from Sage: http://download.se-eng.com/coreboot, rename it to iasl.exe and put it in your
/usr/local/bin(c:\mingw32\local\bin)
- copy iasl.exe to /usr/local/bin
Setup Sage EDK coreboot Project
- Start the Sage EDK
- File -> New -> C Project
- Set "Project name:" to coreboot
- Set the default location to the coreboot source directory -
C:\path\to\corebootby unchecking "Use default location" and browsing to the coreboot directory then selecting "OK" - Under Project Type: expand "Makefile Project" then select "Empty Project"
- Under Toolchains: select --Other Toolchain-- (Note: coreboot has its own toolchain included)
- Hit Finish

- Right click the "coreboot" project in the left project window. Select Properties at the bottom.
- Select C/C++ Build on the left side.
- Select Builder Settings tab if not already active
- Under Builder uncheck "Use default build command"
- Set Build Command: make
- TIP: speed up the build by using the -j# option. # is the number of cores in your system. ex: make -j4
- Under Build location set Build Directory:
C:\path\to\corebootby using the appropriate tab to browse to the directory - Do NOT click Apply - this will attempt a build, which will fail at this point.

- Expand C/C++ Build, and select Environment:
- Delete the PATH variable if it is there. (The path was set previously).
- Change the PWD and CWD from
C:\....to/cygdrive/c/path/to/coreboot(Cygwin) or/c/path/to/coreboot(MinGW). This fixes the Cygwin/MinGW path for make. - Click "Apply" and then "OK"

Setup the Sage EDK coreboot Payload Projects
( These examples require the Sage waiter and tint payloads available at http://download.se-eng.com/coreboot. Use similar process if using other payloads by adding them to the coreboot payloads directory. )
- Start the Sage EDK and open C/C++ Perspective, top right corner (open "other" if you don't see the button)
Create waiter Payload Project
- Download the Sage waiter payload: http://download.se-eng.com/coreboot
- Unzip waiter to
c:\path\to\coreboot\payloads\waiter - File -> New -> C Project
- Right click the "waiter" project in the left project window. Select Properties at the bottom.
- Select C/C++ Build on the left side.
- Set Build Command:
make -C /cygdrive/c/path/to/coreboot/payloads/waiter/(Cygwin) ormake -C /c/path/to/coreboot/payloads/waiter/(MinGW) - Set Build Directory:
C:\path\to\coreboot\payloads
- Under C/C++ Build, select Environment:
- Delete the PATH variable if it is there. (The path was set previously).
- Change the PWD and CWD from
C:\....to/cygdrive/c/path/to/coreboot/payloads(Cygwin) or/c/path/to/coreboot/payloads(MinGW). This fixes the Cygwin/MinGW path for make.
Create tint Payload Project
- Download the pre-patched tint payload: http://download.se-eng.com/coreboot
- Unzip tint to
c:\path\to\coreboot\payloads\tint - File -> New -> C Project
- Right click the "payloadname" (tint) project in the left project window. Select Properties at the bottom.
- Select C/C++ Build on the left side.
- Set Build Command:
make -C /cygdrive/c/path/to/coreboot/payloads/tint-0.03b/(Cygwin) ormake -C /c/path/to/coreboot/payloads/tint-0.03b/(MinGW) - Set Build Directory:
C:\path\to\coreboot\payloads
- Under C/C++ Build, select Environment:
- Delete the PATH variable if it is there. (The path was set previously).
- Change the PWD and CWD from
C:\....to/cygdrive/c/path/to/coreboot/payloads(Cygwin) or/c/path/to/coreboot/payloads(MinGW). This fixes the Cygwin/MinGW path for make.
More coreboot Payloads
Find more payloads for coreboot here: http://www.coreboot.org/Payloads Key payloads are SeaBIOS and FILO. You may need other tools in Cygwin to build payloads.
- Adding a compiled elf payload to coreboot is done by the kconfig make process.
Payload Debug Symbols
You may need to add debug symbols to your payload build. Add the following to the makefile.
Either add the -g to the CFLAGS line or add the following line:
CFLAGS += -g
In the elf target, strip the debug symbols with objcopy and save them in a .debug file.
$(TARGET).elf: $(OBJS)
$(Q)printf " LPCC $(subst $(shell pwd)/,,$(@))\n"
$(Q)$(LPCC) -o $@ $(OBJS)
$(Q)$(OBJCOPY) --only-keep-debug $@ $(TARGET).debug
$(Q)$(OBJCOPY) --strip-debug $@
$(Q)$(OBJCOPY) --add-gnu-debuglink=$(TARGET).debug $@
Make Payloads a coreboot Project Reference
Setting the Project reference ensures that the payload will be built before coreboot.
- Right-click the coreboot project -> Properties
- Project References
- check the payload projects (tint and waiter) and click OK
Build coreboot and Payloads
Configure coreboot
Coreboot uses kconfig to configure the platform makefile and build options. This must be done outside the EDK at this time.
- Start Cygwin/MinGW mintty shell (rxvt-native in older EDKs or normal shell in Linux)
-
$ cd /path/to/coreboot- Windows default location: /cygdrive/c/sage_edk/samples_workspace/coreboot or /cygdrive/c/sage_edk/sagebios_workspace/coreboot
- Linux default location: ~/sage_edk/samples_workspace/coreboot or ~/sage_edk/sagebios_workspace/coreboot
-
$ make distclean -
$ make menuconfig- rxvt doesn't have ncurses support, so use
make config
- rxvt doesn't have ncurses support, so use
- Setup the following options
- Mainboard
- Choose the Vendor and the Mainboard to build
- Console log level
- Lower log levels will speed up the boot, but provide less debug information
- Payload
- Default selection is SeaBIOS, which will be downloaded and built automatically. It can be changed to an elf and use a sample payload like waiter or tint. For waiter,
./payloads/waiter/waiter.elf, and for tint,./payloads/tint-0.03b/tint.elf
- Default selection is SeaBIOS, which will be downloaded and built automatically. It can be changed to an elf and use a sample payload like waiter or tint. For waiter,
- VGA BIOS
- You will need to acquire a video BIOS. AMD vBIOS examples are available here: http://wwwd.amd.com/support/vbioslic.nsf/useracceptance?openform
- Check that the PCI ID is correct and the VBIOS ROM matches.
- Mainboard
-
Build Payloads
The payload embedded in the coreboot image must be built before coreboot.
- In the Sage EDK project explorer:
- Highlight the waiter payload project.
- Click the hammer icon to build.
- Highlight the tint payload project.
- Click the hammer icon to build.
- Repeat the previous two steps for any other desired payload
- If you only want to build a payload, rightclick on the coreboot project and close it.
Build coreboot
- In the Sage EDK, highlight the coreboot project.
- Click the hammer icon to build.
- Build project should result in a new coreboot.rom file in the coreboot/build directory.
Debug coreboot
Visit the Coreboot Debug page for debug configuration setup instructions.
Troubleshooting
Does it build in Cygwin/MinGW?
- Open Cygwin/MinGW rxtv and go to your coreboot directory. Attempt to make coreboot or the payload as you would in Linux.
Do you have Cygwin/MinGW tools in your Windows path?
- Open a DOS window and type path at the prompt. You should have something like
C:\cygwin\usr\local\bin;C:\cygwin\usr\bin;C:\cygwin\bin(Cygwin) orC:\mingw32\bin;C:\mingw32\local\bin(MinGW). - Try "make" at the dos prompt.
- If you get
make: *** No targets specified and no makefile found. Stop.you have the Cygwin/MinGW tools in your path. (good) - If you get
'make' is not recognized as an internal or external command, operable program or batch file.you have a tools path problem.(bad)
- If you get
- Restart the Sage EDK if you make a change to your Windows path.
You receive a message .xcompile:1: no suitable gcc found
- You may have a
.xcompilefile hanging around from a previous failed build. Delete the.xcompilefile from the c:\path\to\coreboot directory and try again.
You receive a message src/arch/i386/Makefile.inc:71: *** multiple target patterns. Stop.
- Check that
PWDuses CYGWIN/MINGW path syntax.PWDcan be found on theEnvironmenttab underC/C++ Buildproperties for each Sage EDK project.
Your coreboot build fails and you would like more information output to the console.
- Right click the "coreboot" project in the left project window. Select Properties at the bottom.
- Select C/C++ Build on the left side.
- Set Build Command:
make V=1 - clean and build coreboot
DOS/UNIX line ending problems
- In Cygwin/MinGW, run dos2unix on the problematic file or folders.
- See next section on uninstalling old versions of Cygwin
You had an old version of Cygwin and can't build with the current version
- Delete the Cygwin and Cygwin install directories.
- Clean the windows registry of cygwin information - Old version of cygwin used the Windows registry heavily.
