Coreboot Setup

From Sage Wiki

Jump to: navigation, search

Contents


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

  1. 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\coreboot in remainder of this document). Note - This is a large 210MB+ download..
  2. 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.
    1. Start Cygwin or MinGW rxvt-native or mintty shell
    2. $ cd /path/to/.../coreboot/utils/crossgcc/
      • Optional: Edit the file "buildgcc" to change revision of the tools built (such as GDB)
    3. $ ./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
  3. IASL is included in the Sage EDK. Skip to the next section if it is installed.
    1. Build IASL for Cygwin
      1. Get the ACPI source here: http://www.acpica.org/downloads/unix_source_code.php
      2. Decompress and build iasl (acpi compiler):
        1. Open a Cygwin shell (e.g. rxvt-native or mintty)
        2. $ cd /cygdrive/path/to/acpica/compiler
        3. $ make
    2. Build IASL for MinGW
      1. Get the ACPI Windows source here: http://www.acpica.org/downloads/source_code.php
      2. Decompress and patch
      3. Build iasl (acpi compiler):
        1. Open a Mingw shell (e.g. rxvt-native or mintty)
        2. $ cd /c/path/to/acpica/source/compiler
        3. $ make
  4. Add IASL to Cygwin's or MinGW's local tools.
    1. copy iasl.exe to /usr/local/bin
      1. $ 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)


Setup Sage EDK coreboot Project

  1. Start the Sage EDK
  2. File -> New -> C Project
    1. Set "Project name:" to coreboot
    2. Set the default location to the coreboot source directory - C:\path\to\coreboot by unchecking "Use default location" and browsing to the coreboot directory then selecting "OK"
    3. Under Project Type: expand "Makefile Project" then select "Empty Project"
    4. Under Toolchains: select --Other Toolchain-- (Note: coreboot has its own toolchain included)
    5. Hit Finish
      C Project

  3. Right click the "coreboot" project in the left project window. Select Properties at the bottom.
    1. Select C/C++ Build on the left side.
    2. Select Builder Settings tab if not already active
    3. Under Builder uncheck "Use default build command"
    4. 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
    5. Under Build location set Build Directory: C:\path\to\coreboot by using the appropriate tab to browse to the directory
    6. Do NOT click Apply - this will attempt a build, which will fail at this point.
      C Project make

    7. Expand C/C++ Build, and select Environment:
    8. Delete the PATH variable if it is there. (The path was set previously).
    9. 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.
    10. Click "Apply" and then "OK"
      C Project PWD

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. )

  1. 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

  1. Download the Sage waiter payload: http://download.se-eng.com/coreboot
  2. Unzip waiter to c:\path\to\coreboot\payloads\waiter
  3. File -> New -> C Project
    1. Name the project waiter
    2. Set default location to the 'waiter' payload source directory - C:\path\to\coreboot\payloads\waiter
    3. Select Project Type: "Empty Project" under "Makefile Project"
    4. Select Toolchains: Other Toolchain
    5. Hit Finish
      Toolchain

  4. Right click the "waiter" project in the left project window. Select Properties at the bottom.
    1. Select C/C++ Build on the left side.
    2. Set Build Command: make -C /cygdrive/c/path/to/coreboot/payloads/waiter/ (Cygwin) or make -C /c/path/to/coreboot/payloads/waiter/ (MinGW)
    3. Set Build Directory: C:\path\to\coreboot\payloads
      Payload Directory
    4. Under C/C++ Build, select Environment:
    5. Delete the PATH variable if it is there. (The path was set previously).
    6. 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.
      Payload Path


Create tint Payload Project

  1. Download the pre-patched tint payload: http://download.se-eng.com/coreboot
  2. Unzip tint to c:\path\to\coreboot\payloads\tint
  3. File -> New -> C Project
    1. Name the project tint
    2. Set the default location to the 'tint' payload source directory - C:\path\to\coreboot\payloads\tint-0.03b (or other payload directory location)
    3. Select Project Type: "Empty Project" under "Makefile Project"
    4. Select Toolchains: Other Toolchain
    5. Hit Finish
      Toolchain

  4. Right click the "payloadname" (tint) project in the left project window. Select Properties at the bottom.
    1. Select C/C++ Build on the left side.
    2. Set Build Command: make -C /cygdrive/c/path/to/coreboot/payloads/tint-0.03b/ (Cygwin) or make -C /c/path/to/coreboot/payloads/tint-0.03b/ (MinGW)
    3. Set Build Directory: C:\path\to\coreboot\payloads
      Payload Directory
    4. Under C/C++ Build, select Environment:
    5. Delete the PATH variable if it is there. (The path was set previously).
    6. 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.
      Payload Path


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.

  1. Right-click the coreboot project -> Properties
  2. Project References
    1. 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.

  1. Start Cygwin/MinGW mintty shell (rxvt-native in older EDKs or normal shell in Linux)
    1. $ 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
    2. $ make distclean
    3. $ make menuconfig
      • rxvt doesn't have ncurses support, so use make config
    4. Setup the following options
      1. Mainboard
        • Choose the Vendor and the Mainboard to build
      2. Console log level
        • Lower log levels will speed up the boot, but provide less debug information
      3. 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
      4. VGA BIOS

Build Payloads

The payload embedded in the coreboot image must be built before coreboot.

  1. In the Sage EDK project explorer:
    1. Highlight the waiter payload project.
    2. Click the hammer icon to build.
    3. Highlight the tint payload project.
    4. Click the hammer icon to build.
    5. 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

  1. In the Sage EDK, highlight the coreboot project.
  2. Click the hammer icon to build.
  3. 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) or C:\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)
  • 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 .xcompile file hanging around from a previous failed build. Delete the .xcompile file 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 PWD uses CYGWIN/MINGW path syntax. PWD can be found on the Environment tab under C/C++ Build properties 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.




Copyright 2010-2012 Sage Electronic Engineering, LLC
Personal tools
Create a book