2 % This document is released under the GPL
3 % Initially written by Stefan Reinauer, <stepan@coresystems.de>
6 \documentclass[titlepage,
12pt
]{article
}
13 % \usepackage{geometry}
14 \usepackage[pdftex
]{hyperref
}
15 % \usepackage{makeidx}
17 % \geometry{left=2cm,right=2cm,top=2cm,bottom=2cm}
20 urlbordercolor=
{1 1 1},
21 menubordercolor=
{1 1 1},
22 linkbordercolor=
{1 1 1},
24 % pdfpagemode=None, % PDF-Viewer starts without TOC
26 pdftitle=
{coreboot Porting Guide
},
27 pdfauthor=
{Zheng Bao
},
28 pdfsubject=
{coreboot configuration and build process
},
29 pdfkeywords=
{coreboot, AMD, configuration, Build
}
32 \setlength{\parindent}{0pt
}
33 \setlength{\hoffset}{0pt
}
35 \title{coreboot from Scratch
}
36 \author{Stefan Reinauer $<$stepan@coresystems.de$>$
\and Zheng Bao $<$zheng.bao@amd.com$>$
}
49 \section{What is coreboot
}
50 coreboot aims to replace the normal BIOS found on x86, AMD64, PPC,
51 Alpha, and other machines with a Linux kernel that can boot Linux from a cold
52 start. The startup code of an average coreboot port is about
500 lines of
53 assembly and
5000 lines of C. It executes
16 instructions to get into
32bit
54 protected mode and then performs DRAM and other hardware initializations
55 required before Linux can take over.
57 The projects primary motivation initially was maintenance of large
58 clusters. Not surprisingly interest and contributions have come from
59 people with varying backgrounds. Nowadays a large and growing number of
60 Systems can be booted with coreboot, including embedded systems,
61 Desktop PCs and Servers.
63 This
document is used to build, modify, and port the coreboot code
64 base on the AMD platform.
70 \item 2013/
12/
20 Add Git, Gerrit, toolchains building.
71 \item 2009/
04/
19 replace LinuxBIOS with coreboot
72 \item 2004/
06/
02 url and language fixes from Ken Fuchs $<$kfuchs@winternet.com$>$
73 \item 2004/
02/
10 ACPI and option ROM updates
74 \item 2003/
11/
18 initial release
81 \section{Build Requirements
}
82 To build coreboot for AMD64 from the sources you need a recent Linux.
83 SUSE Linux
11.2, CentOS release
6.3, Fedora Core
16, Cygwin, FreeBSD,
84 NetBSD are known to work fine.
86 To build the toolchain, you need following host compilers:
100 Besides the tools above, after the toolchains are built, you also need the following
101 tools to build the source.
104 \item git: Get the source code from repository
105 \item libncurses-dev (or ncursesw, ncurses, curses, pdcursesw, pdcurses): for menuconfig
106 \item python: Optional for gdb.
107 \item perl: Optional for gdb.
114 \section{Getting coreboot
}
115 The latest coreboot sources are available via GIT.
116 For users who doesn't need to change and commit the code:
119 $ git clone https://review.coreboot.org/coreboot
122 For developers, you need to get a gerrit account which you can register
123 at
\url{https://review.coreboot.org
}. Please refer section ~
\ref{sec:gerrit
}
126 $ git clone ssh://<username>@review.coreboot.org:
29418/coreboot
127 $ git clone https://
[<username>:<password>@
]review.coreboot.org/coreboot.git
131 Checks out a sub-repository in the
3rdparty directory.
134 $ git submodule update --init --checkout
139 % Building the toolchain
142 \section{Building the toolchain
}
143 coreboot recommends and guarantees the toolchain integrated with coreboot.
144 Linux distributions usually modify their compilers in ways incompatible with coreboot.
162 The buildgcc will try to get packages from website. You need to make sure you can
163 get access the internet. Or you can get the source.tar.gz and put it in util/crossgcc/tarballs.
166 \textcolor{blue
} {Welcome to the
} \textcolor{red
} {coreboot
} \textcolor{blue
} {cross toolchain builder v1.23 (September
20th,
2013)
}
168 Target arch is now i386-elf
172 Downloading tar balls ...
174 * gmp-
5.1.2.tar.bz2 (cached)
176 * mpfr-
3.1.2.tar.bz2 (cached)
178 * mpc-
1.0.1.tar.gz (cached)
180 * libelf-
0.8.13.tar.gz (cached)
182 * gcc-
4.7.3.tar.bz2 (cached)
184 * binutils-
2.23.2.tar.bz2 (cached)
186 * acpica-unix-
20130626.tar.gz (cached)
188 Downloaded tar balls ...
\textcolor {green
}{ok
}
190 Unpacking and patching ...
198 * libelf-
0.8.13.tar.gz
202 * binutils-
2.23.2.tar.bz2
204 o binutils-
2.23.2\_arv7a.patch
206 o binutils-
2.23.2\_no-bfd-doc.patch
208 * acpica-unix-
20130626.tar.gz
210 Unpacked and patched ...
\textcolor {green
}{ok
}
212 Building GMP
5.1.2 ...
\textcolor {green
}{ok
}
214 Building MPFR
3.1.2 ...
\textcolor {green
}{ok
}
216 Building MPC
1.0.1 ...
\textcolor {green
}{ok
}
218 Building libelf
0.8.13 ...
\textcolor {green
}{ok
}
220 Building binutils
2.23.2 ...
\textcolor {green
}{ok
}
222 Building GCC
4.7.3 ... ok
224 Skipping Expat (Python scripting not enabled)
226 Skipping Python (Python scripting not enabled)
228 Skipping GDB (GDB support not enabled)
230 Building IASL
20130626 ...
\textcolor {green
}{ok
}
232 Cleaning up...
\textcolor {green
}{ok
}
234 \textcolor {green
}{You can now run your i386-elf cross toolchain from /home/baozheng/x86/coreboot-gerrit/util/crossgcc/xgcc.
}
236 If you are lucky, you can get toolchains located in util/crossgcc/xgcc.
242 \section{Building coreboot
}
243 \subsection{Build main module of coreboot
}
248 .config - coreboot v4.0-
4895-gc5025a4-dirty Configuration
249 +------------------------ coreboot Configuration -------------------------+
250 | Arrow keys navigate the menu. <Enter> selects submenus --->. |
251 | Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, |
252 | <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> |
253 | for Search. Legend:
[*
] built-in
[ ] excluded <M> module < > |
254 | +---------------------------------------------------------------------+ |
255 | | General setup ---> | |
256 | | Mainboard ---> | |
257 | | Architecture (x86) ---> | |
260 | | VGA BIOS ---> | |
263 | | Generic Drivers ---> | |
265 | |
[ ] Relocatable Modules | |
266 | | System tables ---> | |
268 | | Debugging ---> | |
270 | +----v(+)-------------------------------------------------------------+ |
271 +-------------------------------------------------------------------------+
272 | <Select> < Exit > < Help > |
273 +-------------------------------------------------------------------------
276 Select Mainboard -$>$ Mainboard Vendor -$>$ AMD
277 -$>$ Mainboard Model -$>$ Olive Hill
279 Then save, exit and run make.
286 The built image, coreboot.rom, is located at folder build.
288 \section{Programming coreboot to flash memory
}
289 The image resulting from a coreboot build can be directly programmed to
290 a flash device, either using an external flash programmers, e.g., Dediprog SF100, or by using the
291 Linux flash utility, flashrom.
294 \subsection{Add modules and payload
}
296 \subsubsection{VGA BIOS
}
297 There is a big Chance that you need to get a VGA BIOS.
300 .config - coreboot v4.0 Configuration
301 ------------------------------------------------------------------------------
302 +-------------------------------- VGA BIOS --------------------------------+
303 | Arrow keys navigate the menu. <Enter> selects submenus --->. |
304 | Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, |
305 | <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> |
306 | for Search. Legend:
[*
] built-in
[ ] excluded <M> module < > module |
307 | +----------------------------------------------------------------------+ |
308 | |
[*
] Add a VGA BIOS image | |
309 | | (vgabios.bin) VGA BIOS path and filename | |
310 | | (
1002,
1306) VGA device PCI IDs | |
317 | +----------------------------------------------------------------------+ |
318 +--------------------------------------------------------------------------+
319 | <Select> < Exit > < Help > |
320 +--------------------------------------------------------------------------+
323 Select VGA BIOS. ``The VGA device PCI IDs'' should be the same as your device. Get the
324 Option ROM from Vendor's website.
326 \subsubsection{Payload
}
327 coreboot in itself is "only" minimal code for initializing a mainboard
328 with peripherals. After the initialization, it jumps to a payload.
330 Currently, SeaBIOS is the most widely used payload. The best way to integrate SeaBIOS
331 is setting it in menuconfig.
334 +------------------------------- Payload ---------------------------------+
335 | Arrow keys navigate the menu. <Enter> selects submenus --->. |
336 | Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, |
337 | <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> |
338 | for Search. Legend:
[*
] built-in
[ ] excluded <M> module < > module |
339 | +----------------------------------------------------------------------+ |
340 | | Add a payload (SeaBIOS) ---> | |
341 | | SeaBIOS version (
1.7.2.1) ---> | |
342 | |
[*
] Use LZMA compression for payloads (NEW) | |
349 | +----------------------------------------------------------------------+ |
350 +--------------------------------------------------------------------------+
351 | <Select> < Exit > < Help > |
352 +--------------------------------------------------------------------------+
354 The script in Makefile will automatically checkout, config, build the SeaBIOS source,
355 and integrat the binary into the final image.
361 \section{Working with Git
}
362 \subsection{Configuration of Git
}
363 Inside the checkout you should install a commit-msg hook that adds a
364 Change-Id into commit messages, which uniquely identifies the logical
365 change in Gerrit even across multiple iterations of the commit. The
366 hook only needs to be installed once per clone, and installation can
371 $ cp ./util/gitconfig/* .git/hooks
374 configure your name and email in git.
377 $ git config --global user.name "Your Name Comes Here"
378 $ git config --global user.email your.email@example.com'
381 The name~
\ref{user name
} and email~
\ref{Contact Information
} should be the same the settings in gerrit.
382 Otherwise you can not push you code to community.
384 Then run the following command once, to tell git that by default you
385 want to submit all commits in the currently checked-out branch for
389 $ git config remote.origin.push HEAD:refs/for/master
393 The above configurations for git has been integrated into Makefile. You can run
400 \subsection{Work flow
}
402 It is recommended that you make a new branch when you start to work, not pushing changes to master.
405 $ git checkout master -b mybranch
408 After you have done your changes, run:
411 $ git add file_need_to_submit.c
412 $ git commit -m "my first change."
416 % Does anyone have a better word to describe the philosophy of splitting changes to patches?
417 You need to realize that the changes you have made should be well divided into
418 several commits. Each of them has one and only one meaning. You could use git rebase -i to
419 split, squash, remove, rewrite you comment.
421 Here is an example of a well-formatted commit message:
425 examplecomponent: Refactor duplicated setup into a function
427 Setting up the demo device correctly requires the exact same register
428 values to be written into each of the PCI device functions. Moving the
429 writes into a function allows also otherexamplecomponent to use them.
431 Signed-off-by: Joe Hacker <joe@hacker.email>
435 Then you can push the code.
442 You can go to the ~
\ref{sec:gerrit
} gerrit to see if your changes is successfully pushed.
444 Often it might happen that the patch you sent for approval is not good
445 enough from the first attempt. Gerrit and git make it easy to track
446 patch evolution during the review process until patches meet our
447 quality standards and are ready for approval.
449 You can easily modify a patch sent to gerrit by you or even by someone
450 else. Just apply it locally using one of the possible ways to do it,
451 make a new local commit that fixes the issues reported by the
452 reviewers, then rebase the change by preserving the same Change-ID. We
453 recommend you to use the git rebase command in interactive mode,
455 Once your patch gets a +
2 comment, your patch can be merged (cherry-pick, actually) to origin/master.
458 % Working with Gerrit
461 \section{Working with Gerrit
}
463 If you are a coreboot user, not planning to contribute, you can skip this section.
464 \subsection{Get gerrit account
}
465 You need to get an OpenID first. Currently Google account give you an OpenID. It means, if you have a gmail account, you have an OpenID. You can try to signed in.
466 click
\url{https://review.coreboot.org
}
468 %\includegraphics[width=6.00in,height=1.00in]{gerrit_signin.png}
471 +-----------------------------------------------------------+
472 |All Projects Documentation Register Sign In |
473 |Open Merged Abandoned |
474 |Search for status:open |
475 +-----------------------------------------------------------+
476 |Subject Status Owner Project Branch Updated CR V |
477 |cpu: Rename.. Alexandru coreboot master
1:
20 PM +
1 |
478 |cpu: Only a.. Alexandru coreboot master
1:
17 PM X |
479 |arch/x86: D.. Alexandru coreboot master
1:
09 PM |
482 |Press '?' to view keyboard shortcuts | Powered by Gerrit |
483 +-----------------------------------------------------------+
486 Click ``Sign In'', You will get
488 %\includegraphics[width=6.00in,height=4.00in]{openid.png}
490 You will be redirected to Google to get logging in.
492 % \includegraphics[width=6.00in,height=1.50in]{login.png}
495 Sign In to Gerrit Code Review at review.coreboot.org
496 +--------------------------------------------------+
497 +--------------------------------------------------+
500 Sign in with a Google Account
501 Sign in with a Yahoo! ID
504 OpenID provides secure single-sign-on, without revealing your passwords to this website.
506 There are many OpenID providers available. You may already be member of one!
512 \subsection{Configure account
}
513 Click the dropdown button near the user name and click ``Settings''
515 % \includegraphics[width=6.00in,height=4.00in]{settings}
516 % \epsfig{figure=keystroke_left}
517 % \epstopdf {file=settings.eps}
518 % \epsfig{file=settings.eps}
520 \label{user name
} In ``profile'' section, type the user name for git. This probably can be changed only once.
523 Profile Username zbao
524 Preferences Full Name Zheng Bao
525 Watched Projects Email Address zheng.bao@amd.com
526 Contact Information Registered Jun
28,
2011 4:
33 PM
527 SSH Public Keys Account ID
1000034
534 \label{Contact Information
} In ``Contact Information'', enter you full name and your Email, which should be configured in your .gitconfig
537 Full Name __________________________________
538 Preferred Email ______________ Registered Email
544 In ``SSH Public Keys'' section, upload your public key.
547 Status Algorithm Key Comment
551 > How to Generate an SSH Key
552 +--------------------------+
562 +--------------------------+
567 Click ``Add Key ...''
568 Go back to you linux command line and type:
572 Generating public/private rsa key pair.
573 Enter file in which to save the key (/home/zhengbao/.ssh/id_rsa):
574 Enter passphrase (empty for no passphrase):
575 Enter same passphrase again:
576 Your identification has been saved in /home/zhengbao/.ssh/id_rsa.
577 Your public key has been saved in /home/zhengbao/.ssh/id_rsa.pub.
578 The key fingerprint is:
579 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx zhengb@host.domain
580 The key's randomart image is:
594 The data in ~/.ssh/id
\_rsa.pub is your public key. Copy them to the box in the page of ``SSH Public Keys'' and click add.
596 In ``HTTP Password'' section, click button ``Generate Password''. You will get the password for http checkout.
600 Password XXXXXXXXXXXX
602 Generate Password Clear Password
607 \subsection{Reviewing Changes
}
608 For each listed changes in Gerrit, you can review, comment, evaluate,
609 cherry-pick, and even re-submit them. For you own patches, only you can
610 abandon them. Click in the file and commit message, you can add in-line comment.
620 coreboot only cares about low level machine initialization, but also has
621 very simple mechanisms to boot a file either from FLASHROM or IDE. That
622 file, possibly a Linux Kernel, a boot loader or Etherboot, are called
623 payload, since it is the first software executed that does not cope with
628 Flash devices are commonly used in all different computers since unlike
629 ROMs they can be electronically erased and reprogrammed.
633 Gerrit is a web based code review system, facilitating online code
634 reviews for projects using the Git version control system.
636 Gerrit makes reviews easier by showing changes in a side-by-side
637 display, and allowing inline comments to be added by any reviewer.
639 Gerrit simplifies Git based project maintainership by permitting any
640 authorized user to submit changes to the master Git repository, rather
641 than requiring all approved changes to be merged in by hand by the
642 project maintainer. This functionality enables a more centralized
653 \section{Bibliography
}
654 \subsection{Additional Papers on coreboot
}
658 \textit{\url{https://www.coreboot.org/Documentation
}}
664 \item Etherboot:
\textit{\url{http://www.etherboot.org/
}}
665 \item OpenBIOS:
\textit{\url{http://www.openbios.org/
}}
666 \item Flashrom:
\textit{\url{http://www.flashrom.org/
}}
667 \item Seabios:
\textit{\url{http://www.seabios.org/
}}