code:
SHELL   = /bin/bash
LIBRARY = ../../../archive.dokk.org/library

# Convert PDF to TXT using LibreOffice
# pdf filename: "$<"
# txt filename: "$@"
pdf2txt : $(subst :,\:,$(patsubst %.pdf,%.txt,$(shell find "${LIBRARY}" -type f -name "*.pdf")))
%.txt : %.pdf
	@echo "Processing $<"
	@pdftotext -layout "$<"

# Convert PDF to HTML using pdf2htmlEX
# pdf filename: "$<"
# html filename: "$@"
pdf2html : $(subst :,\:,$(patsubst %.pdf,%.html,$(shell find "${LIBRARY}" -type f -name "*.pdf")))
%.html : %.pdf
	@echo "Processing $<"
	@pdf2htmlEX --dest-dir "${LIBRARY}" --embed cFIJO "$<"
	./extract-background.py "$@"

clean:
	rm -f ${LIBRARY}/*.{css,html,js,txt}

.ONESHELL:
.SUFFIXES:
.PHONY:
.DELETE_ON_ERROR:

repo_name: DOKK/legacy

license: unknown


code:
#!/usr/bin/env python3

# pdf2htmlEX creates images inline the HTML as
# This script:
#     - removes the src="" attribute
#     - creates a new bg-N class for the img tag
#     - copies the images into the CSS

import bleach
import glob
import os
import re
import sys
from pyquery import PyQuery as pq

# Must be given a HTML file (output of pdf2htmlEX)
if len (sys.argv) == 1:
    exit ()

# Which item to process
html_file = sys.argv[1]
# The CSS file of the document
css_file = html_file[:-5] + '.images.css'

if not os.path.isfile (html_file):
    print ("Input file doesn't exist in the library.")
    exit ()

# Store all the base64 images here
images = {}

# Remove base64 image from
def background_to_css (index, element):
    new_css_class = 'bg-' + str (index)

    images['.' + new_css_class] = element.attr.src

    element.remove_attr ('alt')
    element.remove_attr ('src')
    element.add_class (new_css_class)

# Read HTML file
with open (html_file, 'rt', encoding='utf-8') as f:
    dom = pq (f.read ())

# Open sidebar
if len (dom ('#outline > ul > li')) > 0:
    dom ('#sidebar').addClass ('opened')

# Loop all images
dom ('#page-container img.bi').each (lambda index, item: background_to_css (index, dom (item)))

# Overwrite HTML file with removed images
with open (html_file, 'wt', encoding='utf-8') as f:
    # f.write (dom ('#sidebar').outer_html ())
    f.write (dom ('#page-container').outer_html ())

# Append new CSS classes (with the images) to the document CSS file
with open (css_file, 'at', encoding='utf-8') as f:
    for image, base64 in images.items ():
        f.write (image + '{')
        f.write ('background-image: url(' + base64 + ');')
        f.write ('background-position: center;')
        f.write ('background-repeat: no-repeat;')
        f.write ('background-size: cover;')
        f.write ('}')


code:
#!/usr/bin/env python3

import rdflib
import yaml

from rdflib import BNode, Graph, Literal, Namespace, URIRef
from rdflib.namespace import RDF

yaml_file = 'library.yaml'

turtle = Graph ()
LIBRARY = Namespace ('dokk:library:')
SCHEMA  = Namespace ('http://schema.org/')
SPDX    = Namespace ('http://spdx.org/rdf/terms#')
turtle.bind ('schema', SCHEMA)
turtle.bind ('spdx', SPDX)

with open (yaml_file, 'r') as stream:
    try:
        library = yaml.load (stream)
    except yaml.YAMLError as exc:
        print (exc)

for id in library:
    turtle.add ((LIBRARY[id],
                 RDF.type,
                 URIRef (SCHEMA.CreativeWork)))

    turtle.add ((LIBRARY[id],
                 SCHEMA.title,
                 Literal (library[id]['title'])))

    turtle.add ((LIBRARY[id],
                 SCHEMA.identifier,
                 Literal (id)))

    if isinstance (library[id]['copyrightYear'], list):
        for year in library[id]['copyrightYear']:
            turtle.add ((LIBRARY[id],
                         SCHEMA.copyrightYear,
                         Literal (year)))
    else:
        turtle.add ((LIBRARY[id],
                     SCHEMA.copyrightYear,
                     Literal (library[id]['copyrightYear'])))

    if isinstance (library[id]['inLanguage'], list):
        for language in library[id]['inLanguage']:
            turtle.add ((LIBRARY[id],
                         SCHEMA.inLanguage,
                         Literal (language)))
    else:
        turtle.add ((LIBRARY[id],
                     SCHEMA.inLanguage,
                     Literal (library[id]['inLanguage'])))

    if isinstance (library[id]['keywords'], list):
        for keywords in library[id]['keywords']:
            turtle.add ((LIBRARY[id],
                         SCHEMA.keywords,
                         Literal (keywords)))
    else:
        turtle.add ((LIBRARY[id],
                     SCHEMA.keywords,
                     Literal (library[id]['keywords'])))

    if isinstance (library[id]['license'], list):
        for license in library[id]['license']:
            turtle.add ((LIBRARY[id],
                         SCHEMA.license,
                         URIRef (SPDX[license])))
    else:
        turtle.add ((LIBRARY[id],
                     SCHEMA.license,
                     URIRef (SPDX[library[id]['license']])))

turtle.serialize ('library.ttl', 'turtle')


code:
SHELL  = /bin/bash
MIRROR = "http://mi.mirror.garr.it/mirrors/debian/"
DIST   = "testing"
ARCH   = "amd64"

# Download the list of files in Debian
deb_indexes :
	mkdir -p "${DIST}/${ARCH}"
	wget --directory-prefix "${DIST}/${ARCH}" "${MIRROR}dists/${DIST}/main/Contents-amd64.gz"
	wget --directory-prefix "${DIST}/${ARCH}" "${MIRROR}dists/${DIST}/main/binary-amd64/Packages.gz"
	gunzip "${DIST}/${ARCH}/"*.gz

# Find the list of (binary) packages that contain manpages
find_packages :
	./find_packages.py

# Download all the binaries containing the manpages
download_binaries :
	mkdir -p binaries
	wget --mirror --no-host --no-parent --no-directories \
	     --directory-prefix binaries --execute robots=off \
	     --input-file packages.url

# Find all the manpages within the binaries and extract them
extract_pages :
	for deb in binaries/*.deb ; do
		7z x -so "$${deb}" \
			| tar --extract --strip-components 3 --file - ./usr/share/man/
	done

# Decompress all pages into .roff files
manpages2roff : $(subst :,\:,$(patsubst %.gz,%.roff,$(shell find ./man -type f -name "*.gz")))
%.roff : %.gz
	@gunzip --stdout "$<" > "$@"

# Convert pages to TEXT
# Mandoc doesn't look for include manpages ".so" outside of the current working directory
# or /usr/share/man for security reasons, so we need to cd into ./man in order to set
# it as the working directory.
manpages2txt : $(subst :,\:,$(patsubst %.roff,%.txt,$(shell find ./man -type f -name "*.roff")))
%.txt : %.roff
	@ROFF="$<"
	@TEXT="$@"
	@ROFF="$${ROFF:4}"    # Remove "man/" prefix
	@TEXT="$${TEXT:4}"    # Remove "man/" prefix

	@cd ./man
	@mandoc -T utf8 -O width=80 "$$ROFF" | col -b > "$$TEXT"

# Convert pages to HTML
# Mandoc doesn't look for include manpages ".so" outside of the current working directory
# or /usr/share/man for security reasons, so we need to cd into ./man in order to set
# it as the working directory.
manpages2html : $(subst :,\:,$(patsubst %.roff,%.html,$(shell find ./man -type f -name "*.roff")))
%.html : %.roff
	@ROFF="$<"
	@HTML="$@"
	@ROFF="$${ROFF:4}"    # Remove "man/" prefix
	@HTML="$${HTML:4}"    # Remove "man/" prefix

	@cd ./man
	@mandoc -T html -O fragment "$$ROFF" > "$$HTML"
	@tidy	--clean yes --vertical-space auto --wrap 0 --indent 0 --hide-comments yes \
		--drop-empty-elements no --doctype html5 --logical-emphasis yes \
		--show-body-only yes --quiet yes --write-back yes "$$HTML"

# make page links to other manpages.
# mandoc has the option "-O man="%N.%S"" to convert .Xr macros to links across manpages.
# Unfortunately this seems to work only for .Xr and not for free text such as ls(1).
# So, we try to create the links ourselves.
manpages2html_postprocessing :
	./html_postprocess.py

# Convert pages to pdf
manpages2pdf : $(subst :,\:,$(patsubst %.roff,%.pdf,$(shell find ./man -type f -name "*.roff")))
%.pdf : %.roff
	# Make PDF
	# There is also roff2pdf but DVI seems to produce a nicer output
	@roff2dvi "$${filename}" > "$${manpage}.dvi"
	dvipdf "$${manpage}.dvi" "$${manpage}.pdf"

# Convert pages to docbook
manpages2docbook : $(subst :,\:,$(patsubst %.roff,%.docbook,$(shell find ./man -type f -name "*.roff")))
%.docbook : %.roff
	@timeout 60s doclifter -I "$$PWD/man" < "$<" > "$@"

# Build RDF graph
manpages2rdf:
	./rdf_dump.py

.ONESHELL:
.SUFFIXES:
.PHONY:
.DELETE_ON_ERROR:

path: manpages/debian/Makefile


code:
# Requirements

- doclifter

        $ git clone https://gitlab.com/esr/doclifter.git
        $ make
        $ make install

make
wget
7z
tar
gzip
man
mandoc 0.14.13+
tidy
roff2dvi
dvipdf
python3-bleach
- pdf2htmlex


code:
#!/usr/bin/env python3

# Find the list of (binary) packages containing at least a manpage

import gzip
import json
import os

DIST = "testing"
ARCH = "amd64"

manpages = {}

# Find all manpages from the list of files in Contents-*.gz
with open (DIST + '/' + ARCH + '/' + 'Contents-' + ARCH, 'rt', encoding='UTF-8') as f:

    # Search man files in the list of files
    # Example line: "usr/share/man/man8/useradd.8.gz admin/passwd"
    # Example line: "usr/share/man/it/man8/useradd.8.gz admin/passwd"
    for line in f:
        line = line.strip (' \t\n')

        if line.startswith ('usr/share/man/'):
            # Split line at ' ' and return only non-empty strings
            line = list (filter (None, line.split (' ')))

            if len (line) != 2:
                print ('Bad line!')
                exit()

            """
            usr/share/man/<lang>/man8/useradd.8.gz admin/passwd
            |                       | |       | |  |     |_____ distro_package
            |                       | |       | |  |___________ distro_section
            |                       | |       | |______________ page_compression
            |                       | |       |________________ page_section_variant
            |                       | |________________________ page_name
            |                       |__________________________ page_section
            |__________________________________________________ page_path
            """

            page_path, page_full_name = line[0].rsplit ('/', 1)

            # Skip pages in /usr/share/man
            # They should not be here, they should be in /usr/share/man/man*
            if page_path.lower () == 'usr/share/man':
                continue

            page_section = page_path[-1]
            distro_section, distro_package = line[1].rsplit ('/', 1)
            page_name, page_section_variant, page_compression = page_full_name.rsplit ('.', 2)

            # Detect language
            page_language = 'en' if page_path.startswith ('usr/share/man/man') \
                                 else page_path.split ('/', 4)[3]

            # Check if this is a link to another manpage
            # For example pyrogenesis.6 is a link to 0ad.6
            # TODO this doesn't take into account languages!!!
            file_location = 'man/man' + page_section + '/' + page_full_name

            # Extract package name
            # /home/user/man/man6/0ad.6.gz => 0ad.6
            page_link = os.path.realpath (file_location).rsplit ('.', 1)[0].rsplit ('/', 1)[-1] \
                        if os.path.islink (file_location) else None

            # Store our manpages. A package can have multiple pages
            if distro_package not in manpages.keys ():
                manpages[distro_package] = []

            manpages[distro_package].append ({
                'file':            line[0],
                'link_to':         page_link,
                'path':            page_path,
                'identifier':      page_name + '.' + page_section_variant,
                'full_name':       page_full_name,
                'name':            page_name,
                'section':         page_section,
                'section_varinat': page_section_variant,
                'compression':     page_compression,
                'language':        page_language
            })

packages = []

# Extract list of packages that contain at least one manpage
with open (DIST + '/' + ARCH + '/' + 'Packages', 'rt', encoding='UTF-8') as f:

    package = {
        'name':         None,
        'version':      None,
        'architecture': None,
        'section':      None,
        'filename':     None,
        'deb':          None
    }

    for line in f:
        line = line.strip (' \t\n')

        if line.startswith ('Package:'):
            package['name'] = line.split (' ', 2)[1].strip ()

        if line.startswith ('Version:'):
            package['version'] = line.split (' ', 2)[1].strip ()

        if line.startswith ('Architecture:'):
            package['architecture'] = line.split (' ', 2)[1].strip ()

        if line.startswith ('Section:'):
            package['section'] = line.split (' ', 2)[1].strip ()

        if line.startswith ('Filename:'):
            package['filename'] = line.split (' ', 2)[1].strip ()
            package['deb'] = os.path.basename (package['filename'])

        # Empty line defines the end of a package metadata
        if line == "":
            # Does this package have manpages?
            if package['name'] in manpages.keys ():
                # Make sure package has all properties
                if None not in package.keys ():
                    # Add manpages belonging to this package
                    package['manpages'] = manpages[package['name']]

                    packages.append (package.copy ())

            # Reset package dictionary
            for key in package.keys ():
                package[key] = None

# The packages to download from the mirror
with open ('packages.url', 'wt') as fp:
    for package in packages:
        fp.write ("http://mi.mirror.garr.it/mirrors/debian/" + package['filename'] + "\n")

# Dump list of packages with their manpages
with open ('manpages.json', 'wt') as fp:
    fp.write (json.dumps (packages, sort_keys=True, indent=4))


code:
#!/usr/bin/env python3

# The point of this module is to apply some transformation to the output of
# mandoc, in order to improve the HTML

import bleach
import glob
import os
import re
import sys
from pyquery import PyQuery as pq

# Loop HTML files (mandoc output)
for file in glob.iglob ('man/**/*.html', recursive=True):

    print (file)

    with open (file, 'rt') as f:
        html = f.read ()

    # Replace references to other manpages with links.
    # Example: ls(1)    ->    ls(1)
    # regex:
    #    - some manpages use a bold or italic name, so we match an optional
    #      or  tag
    #    - lazy match valid characters for a manpage, assign name <page>
    #    - match optional closing  or  tags
    #    - match '('
    #    - match number, then lazy match anything except a space, assign name

    #    - match ')'
    html = re.sub (
        '(?:|)?(?P<page>[a-zA-Z0-9._]+?)(?:|)?\((?P
[0-9][^\s]*?)\)',

        lambda match:
            '' +
                '' +
                    '' +
                        match.group ('page') +
                    '' +
                '' +
                '(' + match.group ('section') + ')' +
            ''

            # Only make link if the targeted html manpage exist
            if os.path.isfile (
                './man/man' + match.group ('section') + '/' + match.group ('page') + '.' +
                match.group ('section') + '.html')
            else ' ' + match.group ('page') + '(' + match.group ('section') + ')',

        html)

    # Unfortunately mandoc outputs all <tags> one below the other, so there is no way
    # to separate a section title to its content. This is bad because it makes it
    # impossible to add margin-left to the content of a section from CSS.
    # So, this hack is to try to fix the issue. Since all section titles have the form
    #
NAME
    # and since apparently only section titles use
 tags, we try to wrap all
    # content between a
 and the next
 into a
.
    # regex:
    #     - look for a
 tag (and of section title)
    #     - match everything next
    #     - look for the next
 (start of new section title)
    #
 is used to match the end of the last section
    """
    html = re.sub (
        '(?<=
)(?P<content>.*?)(?=<h1|
)',

        lambda match: '
' + match.group ('content') + '
',

        html, flags=re.DOTALL)
    """

    with open (file, 'wt') as f:
        f.write (html)


code:
#!/usr/bin/env python3

# This script is used to generate a RDF graph from the list of packages and manpages

import gzip
import json
import os

from rdflib import BNode, Graph, Literal, Namespace, URIRef
from rdflib.namespace import RDF

DIST = 'testing'

mangraph = Graph ()
MANPAGE = Namespace ('undefined:')
MANPAGE_TERMS = Namespace ('undefined:')
SCHEMA = Namespace ('http://schema.org/')
mangraph.bind ('manpage', MANPAGE)
mangraph.bind ('manpage-terms', MANPAGE_TERMS)
mangraph.bind ('schema', SCHEMA)

# Add sections to the graph
def add_section_info (number, description):
    section_n = 'section' + number

    mangraph.add ((MANPAGE[section_n],
                   RDF.type,
                   MANPAGE_TERMS.Section))
    mangraph.add ((MANPAGE[section_n],
                   SCHEMA.name,
                   Literal ('Section ' + number)))
    mangraph.add ((MANPAGE[section_n],
                   MANPAGE_TERMS.section_number,
                   Literal (number)))
    mangraph.add ((MANPAGE[section_n],
                   SCHEMA.disambiguatingDescription,
                   Literal (description, lang='en')))

add_section_info ('1', 'Executable programs or shell commands')
add_section_info ('2', 'System calls (functions provided by the kernel)')
add_section_info ('3', 'Library calls (functions within program libraries)')
add_section_info ('4', 'Special files')
add_section_info ('5', 'File formats and conventions')
add_section_info ('6', 'Games')
add_section_info ('7', 'Miscellaneous')
add_section_info ('8', 'System administration commands')

with open ('manpages.json', 'rt') as fp:
    packages = json.load (fp)

# Loop packages
for package in packages:

    rdfpackage = URIRef (MANPAGE + 'debian-testing/amd64/' + package['name'])
    mangraph.add ((rdfpackage,
                   RDF.type,
                   MANPAGE_TERMS.Package))
    mangraph.add ((rdfpackage,
                   SCHEMA.name,
                   Literal (package['name'])))
    mangraph.add ((rdfpackage,
                   SCHEMA.version,
                   Literal (package['version'])))
    mangraph.add ((rdfpackage,
                   MANPAGE_TERMS.architecture,
                   Literal (package['architecture'])))
    mangraph.add ((rdfpackage,
                   MANPAGE_TERMS.filename,
                   Literal (package['deb'])))

    # Loop manpages for this package
    for page in package['manpages']:

        subject = URIRef (MANPAGE + page['identifier'])

        # Is this page just a link to another page or not?
        if page['link_to'] is None:
            mangraph.add ((subject,
                           RDF.type,
                           SCHEMA.TextDigitalDocument))
            mangraph.add ((subject,
                           SCHEMA.name,
                           Literal (page['name'])))
            mangraph.add ((subject,
                           SCHEMA.identifier,
                           Literal (page['identifier'])))
            # Sections are 1..8 but can have variants such as "1p"
            mangraph.add ((subject,
                           MANPAGE_TERMS.section,
                           URIRef (MANPAGE.section + page['section'])))
            mangraph.add ((subject,
                           MANPAGE_TERMS.section_variant,
                           Literal (page['section_varinat'])))

            # Link to package
            mangraph.add ((subject, SCHEMA.isPartOf, rdfpackage))

            # Extract description from manpage
            # Example: ls - list directory contents
            page_txt = 'man/man' + page['section'] + '/' + page['identifier'] + '.txt'

            # Read TXT version, find NAME section, then read next line
            if os.path.isfile (page_txt):
                name_section_found = False
                description = ''

                with open (page_txt, 'rt') as f:
                    for line in f:
                        if name_section_found:
                            # Multiline NAME section
                            if line.startswith (' '):
                                description += line

                            # NAME section terminated
                            else:
                                # There can be different kind of separators
                                # Usually it's '—' to split name/description, but others
                                # possibilities are '--', '-', ',', others?
                                if ' — ' in description:
                                    description = description.split (' — ', 1)[1].strip ()
                                elif ' -- ' in description:
                                    description = description.split (' -- ', 1)[1].strip ()
                                elif ' - ' in description:
                                    description = description.split (' - ', 1)[1].strip ()
                                elif ',' in description:
                                    description = description.split (',', 1)[1].strip ()
                                else:
                                    # Tough luck! No description for this page :(
                                    description = ''

                                break

                        if line == 'NAME\n':
                            name_section_found = True

                mangraph.add ((subject,
                            SCHEMA.disambiguatingDescription,
                            Literal (description)))
            else:
                print ('Warning: file not found ', page_txt)

        else:

            mangraph.add ((URIRef (MANPAGE + page['link_to']),
                           SCHEMA.alternateName,
                           Literal (page['identifier'])))

mangraph.serialize ('manpages.ttl', 'turtle')


code:
/build/
/install/
/release/
/sources/
/libreboot.conf
.version
.revision
.tarfiles
.epoch
push
*.vim
/TODO/
/docs/version
/bucts/
/coreboot/
/crossgcc/
/flashrom/
/grub/
/memtest86plus/
/seabios/
/bin/
/resources/utilities/ich9deblob/*.rom
/resources/utilities/ich9deblob/*.bin
/resources/utilities/ich9deblob/ich9deblob
/resources/utilities/ich9deblob/ich9gen
/resources/utilities/ich9deblob/demefactory
/resources/utilities/ich9deblob/obj/*.o
/resources/utilities/ich9deblob/obj/*/*.o
/resources/utilities/ich9deblob/mkdescriptor*.[ch]
/resources/utilities/ich9deblob/mkgbe*.[ch]
/resources/utilities/grub-assemble/grub_*.elf
/mkgbe.[ch]
/*.bin
/resources/utilities/i945-pwm/i945-pwm
/push
/ChangeLog
/NEWS
/version
/versiondate
/gm45macaddress
tocheck*
*.html
!www/template.html
/www/temp.md

repo_name: ctag/libreboot

path: .gitignore

license: mit


code:
Paper Build System
==================

Entry Point
-----------

The entry point for using the paper build system is the main script in the root
directory, named after the build system (paper, libreboot, etc).
Running the main script with no argument will show its general usage.

Configuration
-------------

The paper build system can be configured with a script named after the build
system (paper, libreboot, etc) with a ".conf" suffix. It is automatically loaded
by the build system when running the main script.

It contains environment variables assigned to the desired values. The list of
environment variables is shown in the main script's general usage.

Project and Tool Targets
------------------------

The build system works around the concepts of projects and tools, that define
specific components that can be used to produce either:
* sources
* systems
* images
* tools

Various actions are available for each project and tool targets, many of which
are shown in the main script's general usage. Each project and tool may provide
a usage action that allows to see the specific usage for it. Actions are
executed recursively when no targets are specified.

Each project and tool target has its own directory (either in projects or tools)
that contain a script named after the target and possible a helper script, named
after the script with a "-helper" suffix. The helper script is automatically
included by the build system. Functions in helper scripts are usually prefixed
with the name of the target, where "-" symbols are replaced with "_" symbols.

Each project and tool target's actions are functions defined in the target's
specific script, with names matching the target's actions.

Meta-Targets
------------

Meta targets are project and tool targets that apply the requested action to
individual targets, allowing to execute an action to many targets at once.
For instance, a meta-target named after the build system with a "-all" suffix
would call other meta-targets, prefixed with "-images", "-tools", etc that would
then perform the requested action to all underlying targets.

Projects Actions
----------------

Various generic actions allow preparing projects through a series of steps:
* downloading, extracting or updating the project's sources
* building the project to a build directory
* installing the project to an install directory
* releasing the project to a release directory
* cleaning the build, install and release directories

Actions can be checked by a matching project-specific function, named after the
function to check with a "_check" suffix, to determine whether it is necessary
to run them again to follow the steps. An environment variable can force actions
to be executed, by specifying a space-separated list of projects:
PROJECTS_FORCE.

Projects Configuration and Patches
----------------------------------

Configuration for each project is stored in each project's own directory.
Targets for each project are defined with a "targets" file in each directory
of the "configs" directory. Targets are read recursively, following
sub-directory names for project targets.

Each project's configuration directory can be used to hold target-specific
information and configuration.

An "install" file in each sub-directory indicated which files to grab from the
build files and where to install them in the install directory.

Projects Sources
----------------

Each project can either download specific sources or use another project's
sources, possibly providing its own revision and patches.

Sources are downloaded with the "download" action or can be extracted from
released sources (after placing the sources in the sources directory) with the
"extract" action.

Projects may also keep their sources in a "sources" directory in their
project-specific directory.

Projects Build
--------------

Each project is built to a build directory, named after the project, with the
list of targets separated by a "-" symbol.

An environment variable allows controlling the number of tasks to run at the
same time: TASKS.

Projects Install
----------------

Projects are installed from "install" files in the project directory, that
copies the selected built files to the install directory, named after the
project, with the list of targets separated by a "-" symbol. These install files
are read recursively, following sub-directory names for project targets.

Additional files to install can be specified in the "install" directory and
described in an "install" file. These install files are read recursively,
following sub-directory names for project targets.

Projects Release
----------------

Projects are released to a release directory, named after the project, with the
list of targets separated by a "-" symbol. Each project's install files are
packed into a tarball to the corresponding release directory. A checksum and a
GPG detached signature (if the RELEASE_KEY environment variable is set) are also
generated.

Tarballs are generated reproducibly, from a list of files stored in the
".tarfiles" file. They may also contain the ".epoch", git ".revision" and
".version" files.

Tools Actions
-------------

Tools are used for maintaining the build system, for performing routine tasks
that can be automated. They may have specific actions and not implement any of
the generic actions.

Actions can be checked by a matching tool-specific function, named after the
function to check with a "_check" suffix, to determine whether it is necessary
to run them again to follow the steps. An environment variable can force actions
to be executed, by specifying a space-separated list of tasks: TASKS_FORCE.

Tools Sources
-------------

Tools may keep their sources in a "sources" directory in their tool-specific
directory. These sources may be updated with the "update" action.


code:
Libreboot project

Libreboot documentation is under docs/
The website is https://libreboot.org/
License can be found in COPYING and through parts of the source tree.

Libreboot is a free BIOS or UEFI replacement (free as in freedom); libre boot
firmware that initializes the hardware and starts a bootloader for your
operating system. It's also an open source BIOS, but open source fails to
promote freedom; please call libreboot free software.

Why use libreboot?

Many people use non-free boot firmware, even if they use GNU+Linux. Non-free
BIOS/UEFI firmware often contains backdoors, can be slow and have severe bugs,
where you are left helpless at the mercy of the developers; you have no freedom
over your computing. By contrast, libreboot is building a world where
everyone can use, study, adapt and share software, with true control and
ownership over their technology. In other words, you should use Libreboot for
your freedom's sake!

Libreboot is faster, more secure and more reliable than most non-free firmware,
and can provide many advanced features (such as encrypted /boot/, GPG signature
checking before booting your kernel, ability to load an OS from the flash chip,
and more).

Libreboot's main upstream providers are coreboot (which we deblob, for hardware
initialization), depthcharge (bootloader, and default libreboot payload on ARM),
and GRUB (bootloader, and default libreboot payload on x86). We also
integrate flashrom (for installing libreboot), and several of our own utilities,
scripts and configuration files. All of this is integrated into a single,
coherent package that is easy to use. We add our own patches to the various
upstreams used, and where feasible try to merge upstream as much as possible.

Libreboot provides a fully automated build system and installation process, with
documentation written for non-technical users, in an attempt to make the
software as easy to use as possible. ROM images are provided, along with
utilities, all built from the publicly distributed source code.

This README is licensed under Creative Commons Zero 1.0:
https://creativecommons.org/publicdomain/zero/1.0/

path: README


code:
Libreboot 20160907

For existing boards, there are no new board specific changes.

This release adds one new mainboard to libreboot:
* Intel D945GCLF desktop motherboard (thanks to Arthur Heymans)

Other bugfixes:
* Various improvements to the documentation
* re-added "unset superusers" to the grub.cfg, which was needed for some users
  depending on the distros that they used

Libreboot 20160902

This is a bugfix release, based on 20160818. It contains no new board changes.
The previous 20160818 release had build errors in the _src archive, and the
_util archive was only source code.

Changes compared to 20160818:
* Fixed bug where ./build module coreboot always returned non-zero status
* Fixed missing symlink of crossgcc when building from _src (thanks Arthur
Heymans)
* Fixed building with the depthcharge payload (ASUS C201)
* Proper ChangeLog now, instead of pasted git log
* Util archive is now binaries again (source code is in the _src archive)
* Documentation is now in HTML format

Libreboot 20160818

NEW BOARDS ADDED:
* ASUS Chromebook C201 (ARM laptop) (thanks to Paul Kocialkowski)
* Gigabyte GA-G41M-ES2L motherboard (desktop) (thanks to Damien Zammit)
* Intel D510MO motherboard (desktop) (thanks to Damien Zammit)
* ASUS KCMA-D8 motherboard (desktop) (thanks to Timothy Pearson)
* ASUS KFSN4-DRE motherboard (server) (thanks to Timothy Pearson)
* ASUS KGPE-D16 motherboard (server) (thanks to Timothy Pearson)

For boards previously supported, many fixes from upstream have been merged.

Other changes (compared to libreboot 20150518):
(this is a summary. For more detailed change list, refer to the git log)

256MiB VRAM allocated on GM45 (X200, T400, T500, R400) instead of 32MiB.
This is an improvement over both Lenovo BIOS and Libreboot 20150518, allowing
video decoding at 1080p to be smoother. (thanks Arthur Heymans)
To clarify, GM45 video performance in libreboot 20160818 is better than on
the original BIOS and the previous libreboot release.

64MiB VRAM on i945 (X60, T60, MacBook2,1) now supported in coreboot-libre, and
used by default (in the previous release, it was 8MiB allocated). Thanks to
Arthur Heymans.

Higher battery life on GM45 (X200, T400, T500, R400) due to higher cstates now
being supported (thanks Arthur Heymans). C4 power states also supported.

Text mode on GM45 (X200, T400, T500, R400) now works, making it possible to
use MemTest86+ comfortably. (thanks to Nick High from coreboot)

Dual channel LVDS displays on GM45 (T400, T500) are now automatically
detected in coreboot-libre. (thanks Vladimir Serbinenko from coreboot)

Partial fix in coreboot-libre for GRUB display on GM45, for dual channel
LVDS higher resolution LCD panels (T400, T500). (thanks Arthur Heymans)

Massively improved GRUB configuration, making it easier to boot more
encrypted systems automatically, and generally a more useful menu for booting
the system (thanks go to Klemens Nanni of the autoboot project).
Libreboot now uses the grub.cfg provided by the installed GNU+Linux distribution
automatically, if present, switching to that configuration. This is done across
many partitions, where libreboot actively searches for a configuration file
(also on LVM volumes and encrypted volumes). This should make libreboot more
easy to use for non-technical users, without having to modify the GRUB
configuration used in libreboot.

Utilities archives is now source only. You will need to compile the packages
in there (build scripts included, and a script for installing build
dependencies. (binary utility archives are planned again in the next
release, when the new build system is merged)

SeaGRUB is now the default payload on all x86 boards. (SeaBIOS configured to
load a compressed GRUB payload from CBFS immediately, without providing an
interface in SeaBIOS. This way, GRUB is still used but now BIOS services are
available, so you get the best of both worlds). Thanks go to Timothy Pearson
of coreboot for this idea.

crossgcc is now downloaded and built as a separate module to coreboot-libre,
with a universal revision used to build all boards.

Individual boards now have their own coreboot revision and patches, independently
of each other board. This makes maintenance easier.

Updated all utilities, and modules (coreboot, GRUB, etc) to newer versions,
with various bugfixes and improvements upstream.

RTC century byte issue now fixed on GM45 in coreboot-libre, so the date
should now be correctly displayed when running the latest linux kernel, instead
of seeing 1970-01-01 when you boot (thanks to Alexander Couzens from coreboot)

Build system now uses multiple CPU cores when building, speeding up building
for some people. Manually specifying how many cores are needed is also possible,
for those using the build system in a chroot environment. (thanks go to
Timothy Pearson from coreboot)

In the build system (git repository), https:// is now used when cloning coreboot.
http:// is used as a fallback for GRUB, if git:// fails.

New payload, the depthcharge bootloader (free bootloader maintained by Google)
for use on the ASUS Chromebook C201. (thanks go to Paul Kocialkowski)

Various fixes to the ich9gen utility (e.g. flash component density is now
set correctly in the descriptor, gbe-less descriptors now supported)

path: RELEASE


code:
% How to install FreeBSD on a libreboot system

This section relates to preparing, booting and installing FreeBSD on
your libreboot system, using nothing more than a USB flash drive (and
*dd*). They've only been tested on a Lenovo ThinkPad x200.

It is expected that you use text mode in libreboot (txtmode images), for
the early boot process in FreeBSD. **Booting the installer results in a
red flickering text display, and doesn't boot.**

Thanks go to ioxcide in [this Reddit
post](https://www.reddit.com/r/BSD/comments/53jt70/libreboot_and_bsds/)
for the initial instructions.

TODO: test FreeBSD more extensively, and make sure it works (and fix it
if it does not). Instructions are provided here, to boot and install
FreeBSD but we're not sure whether it is currently fully compatible
with libreboot.

-   [Prepare the USB drive (in FreeBSD)](#prepare)
-   [Installing FreeBSD without full disk encryption](#noencryption)
-   [Installing FreeBSD with full disk encryption](#encryption)
-   [Booting](#booting)
-   [Configuring Grub](#configuring_grub)
-   [Troubleshooting](#troubleshooting)

**This section is only for the GRUB payload. For depthcharge (used on
CrOS devices in libreboot), instructions have yet to be written in the
libreboot documentation.**

freebsd.img is the installation image for FreeBSD. Adapt the filename
accordingly, for whatever FreeBSD version you use.

Prepare the USB drive (in FreeBSD)
----------------------------------

[This page](https://www.freebsd.org/doc/handbook/bsdinstall-pre.html) on
the FreeBSD website shows how to create a bootable USB drive for
installing FreeBSD. Use the *dd* on that page.

Prepare the USB drive (in NetBSD)
---------------------------------

[This
page](https://wiki.netbsd.org/tutorials/how_to_install_netbsd_from_an_usb_memory_stick/)
on the NetBSD website shows how to create a NetBSD bootable USB drive
from within NetBSD itself. You should use the *dd* method documented
there; you can use this with any ISO, including FreeBSD.

Prepare the USB drive (in LibertyBSD or OpenBSD)
------------------------------------------------

If you downloaded your ISO on a LibertyBSD or OpenBSD system, here is
how to create the bootable FreeBSD USB drive:

Connect the USB drive. Check dmesg:

    $ dmesg | tail

Check to confirm which drive it is, for example, if you think its sd3:

    $ disklabel sd3

Check that it wasn't automatically mounted. If it was, unmount it. For
example:

    $ doas umount /dev/sd3i

dmesg told you what device it is. Overwrite the drive, writing the
FreeBSD installer to it with dd. For example:

    $ doas dd if=freebsd.img of=/dev/rsdXc bs=1M; sync

You should now be able to boot the installer from your USB drive.
Continue reading, for information about how to do that.

Prepare the USB drive (in GNU+Linux)
------------------------------------

If you downloaded your ISO on a GNU+Linux system, here is how to create
the bootable FreeBSD USB drive:

Connect the USB drive. Check dmesg:

    $ dmesg
Check lsblk to confirm which drive it is:

    $ lsblk

Check that it wasn't automatically mounted. If it was, unmount it. For
example:

    $ sudo umount /dev/sdX\*
    # umount /dev/sdX\*

dmesg told you what device it is. Overwrite the drive, writing your
distro ISO to it with dd. For example:

    $ sudo dd if=freebsd.img of=/dev/sdX bs=8M; sync
    # dd if=freebsd.img of=/dev/sdX bs=8M; sync

You should now be able to boot the installer from your USB drive.
Continue reading, for information about how to do that.

Installing FreeBSD without full disk encryption
-----------------------------------------------

Press C in GRUB to access the command line:

    grub> kfreebsd (usb0,gpt3)/boot/kernel/kernel
    grub> set FreeBSD.vfs.mountfrom=ufs:/dev/da1p3\
    grub> boot

It will start booting into the FreeBSD installer. Follow the normal
process for installing FreeBSD.

Installing FreeBSD with full disk encryption
--------------------------------------------

TODO

Booting
-------

TODO

Configuring Grub
----------------

TODO

Troubleshooting
===============

Most of these issues occur when using libreboot with coreboot's 'text
mode' instead of the coreboot framebuffer. This mode is useful for
booting payloads like memtest86+ which expect text-mode, but for FreeBSD
it can be problematic when they are trying to switch to a framebuffer
because it doesn't exist.

In most cases, you should use the vesafb ROM images. Example filename:
libreboot\_ukdvorak\_vesafb.rom.

won't boot\...something about file not found
---------------------------------------------

Your device names (i.e. usb0, usb1, sd0, sd1, wd0, ahci0, hd0, etc) and
numbers may differ. Use TAB completion.

Copyright © 2016 Leah Rowe <info@minifree.org>\
Copyright © 2016 Scott Bonds <scott@ggr.com>\
This page is available under the [CC BY SA 4.0](../cc-by-sa-4.0.txt)


code:
% BSD projects

This section relates to dealing with BSD projects: preparing bootable
USB drives, changing the default GRUB menu and so on.

**This section is only for the \*GRUB\* payload. For depthcharge,
instructions have yet to be written.**

-   [How to install NetBSD on a libreboot system](netbsd.html)
-   [How to install LibertyBSD or OpenBSD on a libreboot
    system](openbsd.html)

-   [How to install FreeBSD on a libreboot system](freebsd.html)

Copyright © 2016 Scott Bonds <scott@ggr.com>\
This page is available under the [CC BY SA 4.0](../cc-by-sa-4.0.txt)


code:
% How to install NetBSD on a libreboot system

This section relates to preparing, booting and installing NetBSD on your
libreboot system, using nothing more than a USB flash drive (and *dd*).
They've only been tested on a librebooted ThinkPad X60.

It is expected that you use text mode in libreboot (txtmode images), for
the early boot process in NetBSD. **Suspend/hibernate is broken,
according to at least 1 user.**

Thanks go to ioxcide in [this Reddit
post](https://www.reddit.com/r/BSD/comments/53jt70/libreboot_and_bsds/)
for the initial instructions.

-   [Prepare the USB drive (in NetBSD)](#prepare)
-   [Installing NetBSD without full disk encryption](#noencryption)
-   [Installing NetBSD with full disk encryption](#encryption)
-   [Booting](#booting)
-   [Configuring Grub](#configuring_grub)
-   [Troubleshooting](#troubleshooting)

**This section is only for the GRUB payload. For depthcharge (used on
CrOS devices in libreboot), instructions have yet to be written in the
libreboot documentation.**

netbsd.iso is the installation image for NetBSD. Adapt the filename
accordingly, for your version of NetBSD.

Prepare the USB drive (in NetBSD)
---------------------------------

[This
page](https://wiki.netbsd.org/tutorials/how_to_install_netbsd_from_an_usb_memory_stick/)
on the NetBSD website shows how to create a NetBSD bootable USB drive
from within NetBSD itself. You should use the *dd* method documented
there.

Prepare the USB drive (in FreeBSD)
----------------------------------

[This page](https://www.freebsd.org/doc/handbook/bsdinstall-pre.html) on
the FreeBSD website shows how to create a bootable USB drive for
installing FreeBSD. Use the *dd* on that page. You can also use the same
instructions with a NetBSD ISO image.

Prepare the USB drive (in LibertyBSD or NetBSD)
-----------------------------------------------

If you downloaded your ISO on a LibertyBSD or NetBSD system, here is how
to create the bootable NetBSD USB drive:

Connect the USB drive. Check dmesg:

    $ dmesg | tail

Check to confirm which drive it is, for example, if you think its sd3:

    $ disklabel sd3

Check that it wasn't automatically mounted. If it was, unmount it. For
example:

    $ doas umount /dev/sd3i

dmesg told you what device it is. Overwrite the drive, writing the
NetBSD installer to it with dd. For example:

    $ doas netbsd.iso of=/dev/rsdXc bs=1M; sync

You should now be able to boot the installer from your USB drive.
Continue reading, for information about how to do that.

Prepare the USB drive (in GNU+Linux)
------------------------------------

If you downloaded your ISO on a GNU+Linux system, here is how to create
the bootable NetBSD USB drive:

Connect the USB drive. Check dmesg:

    $ dmesg
Check lsblk to confirm which drive it is:

    $ lsblk

Check that it wasn't automatically mounted. If it was, unmount it. For
example:

    $ sudo umount /dev/sdX\*
    # umount /dev/sdX\*

dmesg told you what device it is. Overwrite the drive, writing your
distro ISO to it with dd. For example:

    $ sudo dd if=install60.fs of=/dev/sdX bs=8M; sync
    # dd if=netbsd.iso of=/dev/sdX bs=8M; sync

You should now be able to boot the installer from your USB drive.
Continue reading, for information about how to do that.

Installing NetBSD without full disk encryption
----------------------------------------------

You might have to use an external USB keyboard during the installation.
Press C to access the GRUB terminal.

    grub> knetbsd -r sd0a (usb0,netbsd1)/netbsd
    grub> boot

It will start booting into the NetBSD installer. Follow the normal
process for installing NetBSD.

Installing NetBSD with full disk encryption
-------------------------------------------

TODO

Booting
-------

Press C in GRUB to access the command line:

    grub> knetbsd -r wd0a (ahci0,netbsd1)/netbsd
    grub> boot

NetBSD will start booting. Yay!

Configuring Grub
----------------

If you don't want to drop to the GRUB command line and type in a
command to boot NetBSD every time, you can create a GRUB configuration
that's aware of your NetBSD installation and that will automatically be
used by libreboot.

On your NetBSD root partition, create the **/grub** directory and add
the file **libreboot\_grub.cfg** to it. Inside the
**libreboot\_grub.cfg** add these lines:

**default=0 timeout=3 menuentry "NetBSD" {\
    knetbsd -r wd0a (ahci0,netbsd1)/netbsd\
}\
**

The next time you boot, you'll see the old Grub menu for a few seconds,
then you'll see the a new menu with only NetBSD on the list. After 3
seconds NetBSD will boot, or you can hit enter to boot.

Troubleshooting
===============

Most of these issues occur when using libreboot with coreboot's 'text
mode' instead of the coreboot framebuffer. This mode is useful for
booting payloads like memtest86+ which expect text-mode, but for NetBSD
it can be problematic when they are trying to switch to a framebuffer
because it doesn't exist.

In most cases, you should use the vesafb ROM images. Example filename:
libreboot\_ukdvorak\_vesafb.rom.

won't boot\...something about file not found
---------------------------------------------

Your device names (i.e. usb0, usb1, sd0, sd1, wd0, ahci0, hd0, etc) and
numbers may differ. Use TAB completion.

Copyright © 2016 Leah Rowe <info@minifree.org>\
Copyright © 2016 Scott Bonds <scott@ggr.com>\
This page is available under the [CC BY SA 4.0](../cc-by-sa-4.0.txt)


code:
% How to install LibertyBSD or OpenBSD on a libreboot system

NOTE: This guide was written for OpenBSD by the person who contributed
it, but the libreboot project recommends LibertyBSD. LibertyBSD is a
version of OpenBSD without proprietary software in the repositories
(OpenBSD distributes firmware blobs for devices inside its kernel). Go
to the [LibertyBSD website](http://libertybsd.net/) -- TODO: test on
LibertyBSD and prioritise that in this guide.

This section relates to preparing, booting and installing OpenBSD on
your libreboot system, using nothing more than a USB flash drive (and
*dd*). They've only been tested on a Lenovo ThinkPad x200.

-   [Prepare the USB drive (in OpenBSD)](#prepare)
-   [Installing OpenBSD without full disk encryption](#noencryption)
-   [Installing OpenBSD with full disk encryption](#encryption)
-   [Booting](#booting)
-   [Configuring Grub](#configuring_grub)
-   [Troubleshooting](#troubleshooting)

**This section is only for the GRUB payload. For depthcharge (used on
CrOS devices in libreboot), instructions have yet to be written in the
libreboot documentation.**

install60.fs is the installation image for OpenBSD 6.0. Adapt the
filename accordingly, for a different OpenBSD version or LibertyBSD.

Prepare the USB drive (in LibertyBSD or OpenBSD)
------------------------------------------------

If you downloaded your ISO on a LibertyBSD or OpenBSD system, here is
how to create the bootable LibertyBSD/OpenBSD USB drive:

Connect the USB drive. Check dmesg:

    $ dmesg | tail

Check to confirm which drive it is, for example, if you think its sd3:

    $ disklabel sd3

Check that it wasn't automatically mounted. If it was, unmount it. For
example:

    $ doas umount /dev/sd3i

dmesg told you what device it is. Overwrite the drive, writing the
OpenBSD installer to it with dd. For example:

    $ doas dd if=install60.fs of=/dev/rsdXc bs=1M; sync

You should now be able to boot the installer from your USB drive.
Continue reading, for information about how to do that.

Prepare the USB drive (in NetBSD)
---------------------------------

[This
page](https://wiki.netbsd.org/tutorials/how_to_install_netbsd_from_an_usb_memory_stick/)
on the NetBSD website shows how to create a NetBSD bootable USB drive
from within NetBSD itself. You should use the *dd* method documented
there. This will also work with the OpenBSD image.

Prepare the USB drive (in FreeBSD)
----------------------------------

[This page](https://www.freebsd.org/doc/handbook/bsdinstall-pre.html) on
the FreeBSD website shows how to create a bootable USB drive for
installing FreeBSD. Use the *dd* on that page. You can also use the same
instructions with a OpenBSD ISO image.

Prepare the USB drive (in GNU+Linux)
------------------------------------

If you downloaded your ISO on a GNU+Linux system, here is how to create
the bootable OpenBSD USB drive:

Connect the USB drive. Check dmesg:

    $ dmesg
Check lsblk to confirm which drive it is:

    $ lsblk

Check that it wasn't automatically mounted. If it was, unmount it. For
example:

    $ sudo umount /dev/sdX\*
    # umount /dev/sdX\*

dmesg told you what device it is. Overwrite the drive, writing your
distro ISO to it with dd. For example:

    $ sudo dd if=install60.fs of=/dev/sdX bs=8M; sync
    # dd if=install60.fs of=/dev/sdX bs=8M; sync

You should now be able to boot the installer from your USB drive.
Continue reading, for information about how to do that.

Installing OpenBSD without full disk encryption
-----------------------------------------------

Press C in GRUB to access the command line:

    grub> kopenbsd (usb0,openbsd1)/6.0/amd64/bsd.rd
    grub> boot

It will start booting into the OpenBSD installer. Follow the normal
process for installing OpenBSD.

Installing OpenBSD with full disk encryption
--------------------------------------------

Not working. You can modify the above procedure (installation w/o
encryption) to install OpenBSD using full disk encryption, and it
appears to work, except that its not yet clear how to actually *boot* an
OpenBSD+FDE installation using libreboot+Grub2. If you get it working,
please let us know.

If booting in text mode (framebuffer mode might also work), it might be
possible to chainload the OpenBSD or LibertyBSD bootloader from the MBR
section on the internal storage device. This way, it would be possible
to boot with an encrypted OpenBSD or LibertyBSD installation. Please let
us know (contact details are on the libreboot homepage) if you get it
working this way.

Alternatively, it would be good to port OpenBSD either natively as a
coreboot payload, or port it to libpayload (payload library in coreboot;
it has a basic C library and a few functions for certain operations e.g.
text/bitmap). **This would be ideal, because then it would be possible
to boot a truly fully encrypted OpenBSD or LibertyBSD installation, by
putting everything in the flash chip.**

Alternatively, modifying GRUB to support booting fully encrypted OpenBSD
installations would be possible, but probably not feasible; it's an
alien codebase to the OpenBSD project, not tightly integrated and the
OpenBSD bootloader already works.

Booting
-------

Press C in GRUB to access the command line:

    grub> kopenbsd -r sd0a (ahci0,openbsd1)/bsd
    grub> boot

OpenBSD will start booting. Yay!

Configuring Grub
----------------

If you don't want to drop to the GRUB command line and type in a
command to boot OpenBSD every time, you can create a GRUB configuration
that's aware of your OpenBSD installation and that will automatically
be used by libreboot.

On your OpenBSD root partition, create the **/grub** directory and add
the file **libreboot\_grub.cfg** to it. Inside the
**libreboot\_grub.cfg** add these lines:

**default=0 timeout=3 menuentry "OpenBSD" {\
    kopenbsd -r sd0a (ahci0,openbsd1)/bsd\
}\
**

The next time you boot, you'll see the old Grub menu for a few seconds,
then you'll see the a new menu with only OpenBSD on the list. After 3
seconds OpenBSD will boot, or you can hit enter to boot.

Troubleshooting
===============

Most of these issues occur when using libreboot with coreboot's 'text
mode' instead of the coreboot framebuffer. This mode is useful for
booting payloads like memtest86+ which expect text-mode, but for OpenBSD
it can be problematic when they are trying to switch to a framebuffer
because it doesn't exist.

In most cases, you should use the vesafb ROM images. Example filename:
libreboot\_ukdvorak\_vesafb.rom.

won't boot\...something about file not found
---------------------------------------------

Your device names (i.e. usb0, usb1, sd0, sd1, wd0, ahci0, hd0, etc) and
numbers may differ. Use TAB completion.

Copyright © 2016 Scott Bonds <scott@ggr.com>\
Copyright © 2016 Leah Rowe <info@minifree.org>\
This page is available under the [CC BY SA 4.0](../cc-by-sa-4.0.txt)


code:
Attribution-ShareAlike 4.0 International

=======================================================================

Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.

Using Creative Commons Public Licenses

Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.

     Considerations for licensors: Our public licenses are
     intended for use by those authorized to give the public
     permission to use material in ways otherwise restricted by
     copyright and certain other rights. Our licenses are
     irrevocable. Licensors should read and understand the terms
     and conditions of the license they choose before applying it.
     Licensors should also secure all rights necessary before
     applying our licenses so that the public can reuse the
     material as expected. Licensors should clearly mark any
     material not subject to the license. This includes other CC-
     licensed material, or material used under an exception or
     limitation to copyright. More considerations for licensors:
	wiki.creativecommons.org/Considerations_for_licensors

     Considerations for the public: By using one of our public
     licenses, a licensor grants the public permission to use the
     licensed material under specified terms and conditions. If
     the licensor's permission is not necessary for any reason--for
     example, because of any applicable exception or limitation to
     copyright--then that use is not regulated by the license. Our
     licenses grant only permissions under copyright and certain
     other rights that a licensor has authority to grant. Use of
     the licensed material may still be restricted for other
     reasons, including because others have copyright or other
     rights in the material. A licensor may make special requests,
     such as asking that all changes be marked or described.
     Although not required by our licenses, you are encouraged to
     respect those requests where reasonable. More_considerations
     for the public:
	wiki.creativecommons.org/Considerations_for_licensees

=======================================================================

Creative Commons Attribution-ShareAlike 4.0 International Public
License

By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution-ShareAlike 4.0 International Public License ("Public
License"). To the extent this Public License may be interpreted as a
contract, You are granted the Licensed Rights in consideration of Your
acceptance of these terms and conditions, and the Licensor grants You
such rights in consideration of benefits the Licensor receives from
making the Licensed Material available under these terms and
conditions.

Section 1 -- Definitions.

  a. Adapted Material means material subject to Copyright and Similar
     Rights that is derived from or based upon the Licensed Material
     and in which the Licensed Material is translated, altered,
     arranged, transformed, or otherwise modified in a manner requiring
     permission under the Copyright and Similar Rights held by the
     Licensor. For purposes of this Public License, where the Licensed
     Material is a musical work, performance, or sound recording,
     Adapted Material is always produced where the Licensed Material is
     synched in timed relation with a moving image.

  b. Adapter's License means the license You apply to Your Copyright
     and Similar Rights in Your contributions to Adapted Material in
     accordance with the terms and conditions of this Public License.

  c. BY-SA Compatible License means a license listed at
     creativecommons.org/compatiblelicenses, approved by Creative
     Commons as essentially the equivalent of this Public License.

  d. Copyright and Similar Rights means copyright and/or similar rights
     closely related to copyright including, without limitation,
     performance, broadcast, sound recording, and Sui Generis Database
     Rights, without regard to how the rights are labeled or
     categorized. For purposes of this Public License, the rights
     specified in Section 2(b)(1)-(2) are not Copyright and Similar
     Rights.

  e. Effective Technological Measures means those measures that, in the
     absence of proper authority, may not be circumvented under laws
     fulfilling obligations under Article 11 of the WIPO Copyright
     Treaty adopted on December 20, 1996, and/or similar international
     agreements.

  f. Exceptions and Limitations means fair use, fair dealing, and/or
     any other exception or limitation to Copyright and Similar Rights
     that applies to Your use of the Licensed Material.

  g. License Elements means the license attributes listed in the name
     of a Creative Commons Public License. The License Elements of this
     Public License are Attribution and ShareAlike.

  h. Licensed Material means the artistic or literary work, database,
     or other material to which the Licensor applied this Public
     License.

  i. Licensed Rights means the rights granted to You subject to the
     terms and conditions of this Public License, which are limited to
     all Copyright and Similar Rights that apply to Your use of the
     Licensed Material and that the Licensor has authority to license.

  j. Licensor means the individual(s) or entity(ies) granting rights
     under this Public License.

  k. Share means to provide material to the public by any means or
     process that requires permission under the Licensed Rights, such
     as reproduction, public display, public performance, distribution,
     dissemination, communication, or importation, and to make material
     available to the public including in ways that members of the
     public may access the material from a place and at a time
     individually chosen by them.

  l. Sui Generis Database Rights means rights other than copyright
     resulting from Directive 96/9/EC of the European Parliament and of
     the Council of 11 March 1996 on the legal protection of databases,
     as amended and/or succeeded, as well as other essentially
     equivalent rights anywhere in the world.

  m. You means the individual or entity exercising the Licensed Rights
     under this Public License. Your has a corresponding meaning.

Section 2 -- Scope.

  a. License grant.

       1. Subject to the terms and conditions of this Public License,
          the Licensor hereby grants You a worldwide, royalty-free,
          non-sublicensable, non-exclusive, irrevocable license to
          exercise the Licensed Rights in the Licensed Material to:

            a. reproduce and Share the Licensed Material, in whole or
               in part; and

            b. produce, reproduce, and Share Adapted Material.

       2. Exceptions and Limitations. For the avoidance of doubt, where
          Exceptions and Limitations apply to Your use, this Public
          License does not apply, and You do not need to comply with
          its terms and conditions.

       3. Term. The term of this Public License is specified in Section
          6(a).

       4. Media and formats; technical modifications allowed. The
          Licensor authorizes You to exercise the Licensed Rights in
          all media and formats whether now known or hereafter created,
          and to make technical modifications necessary to do so. The
          Licensor waives and/or agrees not to assert any right or
          authority to forbid You from making technical modifications
          necessary to exercise the Licensed Rights, including
          technical modifications necessary to circumvent Effective
          Technological Measures. For purposes of this Public License,
          simply making modifications authorized by this Section 2(a)
          (4) never produces Adapted Material.

       5. Downstream recipients.

            a. Offer from the Licensor -- Licensed Material. Every
               recipient of the Licensed Material automatically
               receives an offer from the Licensor to exercise the
               Licensed Rights under the terms and conditions of this
               Public License.

            b. Additional offer from the Licensor -- Adapted Material.
               Every recipient of Adapted Material from You
               automatically receives an offer from the Licensor to
               exercise the Licensed Rights in the Adapted Material
               under the conditions of the Adapter's License You apply.

            c. No downstream restrictions. You may not offer or impose
               any additional or different terms or conditions on, or
               apply any Effective Technological Measures to, the
               Licensed Material if doing so restricts exercise of the
               Licensed Rights by any recipient of the Licensed
               Material.

       6. No endorsement. Nothing in this Public License constitutes or
          may be construed as permission to assert or imply that You
          are, or that Your use of the Licensed Material is, connected
          with, or sponsored, endorsed, or granted official status by,
          the Licensor or others designated to receive attribution as
          provided in Section 3(a)(1)(A)(i).

  b. Other rights.

       1. Moral rights, such as the right of integrity, are not
          licensed under this Public License, nor are publicity,
          privacy, and/or other similar personality rights; however, to
          the extent possible, the Licensor waives and/or agrees not to
          assert any such rights held by the Licensor to the limited
          extent necessary to allow You to exercise the Licensed
          Rights, but not otherwise.

       2. Patent and trademark rights are not licensed under this
          Public License.

       3. To the extent possible, the Licensor waives any right to
          collect royalties from You for the exercise of the Licensed
          Rights, whether directly or through a collecting society
          under any voluntary or waivable statutory or compulsory
          licensing scheme. In all other cases the Licensor expressly
          reserves any right to collect such royalties.

Section 3 -- License Conditions.

Your exercise of the Licensed Rights is expressly made subject to the
following conditions.

  a. Attribution.

       1. If You Share the Licensed Material (including in modified
          form), You must:

            a. retain the following if it is supplied by the Licensor
               with the Licensed Material:

                 i. identification of the creator(s) of the Licensed
                    Material and any others designated to receive
                    attribution, in any reasonable manner requested by
                    the Licensor (including by pseudonym if
                    designated);

                ii. a copyright notice;

               iii. a notice that refers to this Public License;

                iv. a notice that refers to the disclaimer of
                    warranties;

                 v. a URI or hyperlink to the Licensed Material to the
                    extent reasonably practicable;

            b. indicate if You modified the Licensed Material and
               retain an indication of any previous modifications; and

            c. indicate the Licensed Material is licensed under this
               Public License, and include the text of, or the URI or
               hyperlink to, this Public License.

       2. You may satisfy the conditions in Section 3(a)(1) in any
          reasonable manner based on the medium, means, and context in
          which You Share the Licensed Material. For example, it may be
          reasonable to satisfy the conditions by providing a URI or
          hyperlink to a resource that includes the required
          information.

       3. If requested by the Licensor, You must remove any of the
          information required by Section 3(a)(1)(A) to the extent
          reasonably practicable.

  b. ShareAlike.

     In addition to the conditions in Section 3(a), if You Share
     Adapted Material You produce, the following conditions also apply.

       1. The Adapter's License You apply must be a Creative Commons
          license with the same License Elements, this version or
          later, or a BY-SA Compatible License.

       2. You must include the text of, or the URI or hyperlink to, the
          Adapter's License You apply. You may satisfy this condition
          in any reasonable manner based on the medium, means, and
          context in which You Share Adapted Material.

       3. You may not offer or impose any additional or different terms
          or conditions on, or apply any Effective Technological
          Measures to, Adapted Material that restrict exercise of the
          rights granted under the Adapter's License You apply.

Section 4 -- Sui Generis Database Rights.

Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:

  a. for the avoidance of doubt, Section 2(a)(1) grants You the right
     to extract, reuse, reproduce, and Share all or a substantial
     portion of the contents of the database;

  b. if You include all or a substantial portion of the database
     contents in a database in which You have Sui Generis Database
     Rights, then the database in which You have Sui Generis Database
     Rights (but not its individual contents) is Adapted Material,

     including for purposes of Section 3(b); and
  c. You must comply with the conditions in Section 3(a) if You Share
     all or a substantial portion of the contents of the database.

For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.

Section 5 -- Disclaimer of Warranties and Limitation of Liability.

  a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
     EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
     AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
     ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
     IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
     WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
     PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
     ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
     KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
     ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.

  b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
     TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
     NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
     INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
     COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
     USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
     ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
     DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
     IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.

  c. The disclaimer of warranties and limitation of liability provided
     above shall be interpreted in a manner that, to the extent
     possible, most closely approximates an absolute disclaimer and
     waiver of all liability.

Section 6 -- Term and Termination.

  a. This Public License applies for the term of the Copyright and
     Similar Rights licensed here. However, if You fail to comply with
     this Public License, then Your rights under this Public License
     terminate automatically.

  b. Where Your right to use the Licensed Material has terminated under
     Section 6(a), it reinstates:

       1. automatically as of the date the violation is cured, provided
          it is cured within 30 days of Your discovery of the
          violation; or

       2. upon express reinstatement by the Licensor.

     For the avoidance of doubt, this Section 6(b) does not affect any
     right the Licensor may have to seek remedies for Your violations
     of this Public License.

  c. For the avoidance of doubt, the Licensor may also offer the
     Licensed Material under separate terms or conditions or stop
     distributing the Licensed Material at any time; however, doing so
     will not terminate this Public License.

  d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
     License.

Section 7 -- Other Terms and Conditions.

  a. The Licensor shall not be bound by any additional or different
     terms or conditions communicated by You unless expressly agreed.

  b. Any arrangements, understandings, or agreements regarding the
     Licensed Material not stated herein are separate from and
     independent of the terms and conditions of this Public License.

Section 8 -- Interpretation.

  a. For the avoidance of doubt, this Public License does not, and
     shall not be interpreted to, reduce, limit, restrict, or impose
     conditions on any use of the Licensed Material that could lawfully
     be made without permission under this Public License.

  b. To the extent possible, if any provision of this Public License is
     deemed unenforceable, it shall be automatically reformed to the
     minimum extent necessary to make it enforceable. If the provision
     cannot be reformed, it shall be severed from this Public License
     without affecting the enforceability of the remaining terms and
     conditions.

  c. No term or condition of this Public License will be waived and no
     failure to comply consented to unless expressly agreed to by the
     Licensor.

  d. Nothing in this Public License constitutes or may be interpreted
     as a limitation upon, or waiver of, any privileges and immunities
     that apply to the Licensor or You, including from the legal
     processes of any jurisdiction or authority.

=======================================================================

Creative Commons is not a party to its public
licenses. Notwithstanding, Creative Commons may elect to apply one of
its public licenses to material it publishes and in those instances
will be considered the “Licensor.” The text of the Creative Commons
public licenses is dedicated to the public domain under the CC0 Public
Domain Dedication. Except for the limited purpose of indicating that
material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the
public licenses.

Creative Commons may be contacted at creativecommons.org.


code:
@set docsdir ../resources/
@set useinstall


code:
/*

  Main CSS stylesheet for libreboot.org (documentation section)

	Copyright (C) 2014, 2015 Leah Rowe <info@minifree.org>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

body {
	background:#dfdfdf;
	color:#2B2B2B;
	font-family:Lato,sans-serif;
	font-size:1em;
	font-weight:400;
	padding:0px;
	margin:0px;
}
div.section {
	background:#FFF;
	border-radius:0.5em;
	box-shadow:         0px 0px 5px 0px rgba(50, 50, 50, 0.75);
	padding:1em;
	margin:1em;
}
p, aside, li {
    margin: 0.33em 0px 0.6em;
    text-align:justify;
}
a {
	color:#2B2BAA;
	font-size:1.1em;
}
a:hover {
	text-decoration:none;
}
h1,h2,h3 {
	margin-bottom:0.2em;
	margin-top:0.2em;
}
img {
	max-width:100%;
	height:auto;
	border:solid 0.5em #fff;
	border-radius:0.25em;
	box-shadow:         0px 0px 5px 0px rgba(50, 50, 50, 0.75);
	margin:0px;
	padding:0px;
	margin-right:1em;
	margin-bottom:1em;
}

p.lenovobios {
	font-weight:bold; color:#f00; font-style:italic; font-size:1.2em;
}
p.lenovobios:hover {
	color: #000;
}
div.important, pre, div.subsection {
	padding:1em;
	margin-bottom:1em;
	background-color:#ece0e2;
	border-radius:0.25em;
	box-shadow:         0px 0px 5px 0px rgba(50, 50, 50, 0.75);
}

.photos p {
	text-align:left;
}


code:
% Depthcharge payload

This section relates to the depthcharge payload used in libreboot.

-   [CrOS security model](#cros_security_model)
-   [Developer mode screen](#developer_mode_screen)
    -   Holding the developer mode screen
    -   Booting normally
    -   Booting from different mediums
    -   Showing device information
    -   Warnings

-   [Recovery mode screen](#recovery_mode_screen)
    -   [Recovering from a bad state](#recovering_bad_state)
    -   [Enabling developer mode](#enabling_developer_mode)
-   [Configuring verified boot
    parameters](#configuring_verified_boot_parameters)

CrOS security model {#cros_security_model}
===================

CrOS (Chromium OS/Chrome OS) devices such as Chromebooks implement a
strict security model to ensure that these devices do not become
compromised, that is implemented as the verified boot (vboot) reference,
most of which is executed within depthcharge. A detailed overview of the
CrOS security model is available on the dedicated page.

In spite of the CrOS security model, depthcharge won't allow booting
kernels without verifying their signature and booting from external
media or legacy payload unless explicitly allowed: see [configuring
verified boot parameters](#configuring_verified_boot_parameters).

Developer mode screen {#developer_mode_screen}
=====================

The developer mode screen can be accessed in depthcharge when developer
mode is enabled.\
Developer mode can be enabled from the [recovery mode
screen](#recovery_mode_screen).

It allows booting normally, booting from internal storage, booting from
external media (when enabled), booting from legacy payload (when
enabled), showing information about the device and disabling developer
mode.

Holding the developer mode screen {#holding_developer_mode_screen}
---------------------------------

As instructed on the developer mode screen, the screen can be held by
pressing **Ctrl + H** in the first 3 seconds after the screen is shown.
After that delay, depthcharge will resume booting normally.

Booting normally {#booting_normally}
----------------

As instructed on the developer mode screen, a regular boot will happen
after **3 seconds** (if developer mode screen is not held).\
The default boot medium (internal storage, external media, legacy
payload) is shown on screen.

Booting from different mediums {#booting_different_mediums}
------------------------------

Depthcharge allows booting from different mediums, when they are allowed
(see [configuring verified boot
parameters](#configuring_verified_boot_parameters) to enable or disable
boot mediums).\
As instructed on the developer mode screen, booting from various mediums
can be triggered by pressing various key combinations:

-   Internal storage: **Ctrl + D**
-   External media: **Ctrl + U** (when enabled)
-   Legacy payload: **Ctrl + L** (when enabled)

Showing device information {#showing_device_information}
--------------------------

As instructed on the developer mode screen, showing device information
can be triggered by pressing **Ctrl + I** or **Tab**.\
Various information is shown, including vboot non-volatile data, TPM
status, GBB flags and key hashes.\

Warnings
--------

The developer mode screen will show warnings when:

-   Booting kernels without verifying their signature is enabled
-   Booting from external media is enabled
-   Booting legacy payloads is enabled

Recovery mode screen {#recovery_mode_screen}
====================

The recovery mode screen can be accessed in depthcharge, by pressing
**Escape + Refresh + Power** when the device is off.

It allows recovering the device from a bad state by booting from a
trusted recovery media. When accessed with the device in a good state,
it also allows enabling developer mode.

Recovering from a bad state {#recovering_bad_state}
---------------------------

When the device fails to verify the signature of a piece of the boot
software or when an error occurs, it is considered to be in a bad state
and will instruct the user to reboot to recovery mode.\
Recovery mode boots using only software located in write-protected
memory, that is considered to be trusted and safe.

Recovery mode then allows recovering the device by booting from a
trusted recovery media, that is automatically detected when recovery
mode starts. When no external media is found or when the recovery media
is invalid, instructions are shown on screen.\
Trusted recovery media are external media (USB drives, SD cards, etc)
that hold a kernel signed with the recovery key.

Google provides images of such recovery media for Chrome OS (which are
not advised to users as they contain proprietary software).\
They are signed with Google's recovery keys, that are pre-installed on
the device when it ships.

When replacing the full flash of the device, the pre-installed keys are
replaced. When the recovery private key is available (e.g. when using
self-generated keys), it can be used to sign a kernel for recovery
purposes.

Enabling developer mode {#enabling_developer_mode}
-----------------------

As instructed on the recovery mode screen, developer mode can be enabled
by pressing **Ctrl + D**.\
Instructions to confirm enabling developer mode are then shown on
screen.

Configuring verified boot parameters {#configuring_verified_boot_parameters}
====================================

Depthcharge's behavior relies on the verified boot (vboot) reference
implementation, that can be configured with parameters stored in the
verified boot non-volatile storage.\
These parameters can be modified with the **crossystem** tool, that
requires sufficient privileges to access the verified boot non-volatile
storage.

**crossystem** relies on **mosys**, that is used to access the verified
boot non-volatile storage on some devices. **crossystem** and **mosys**
are both free software and their source code is made available by
Google:
[crossystem](https://chromium.googlesource.com/chromiumos/platform/vboot_reference/).
[mosys](https://chromium.googlesource.com/chromiumos/platform/mosys/).\
These tools are not distributed along with Libreboot yet. However, they
are preinstalled on the device, with ChromeOS.

Some of these parameters have the potential of **weakening the security
of the device**. In particular, disabling kernels signature
verification, external media boot and legacy payload boot can weaken the
security of the device.

The following parameters can be configured:

-   Kernels signature verification:
    -   Enabled with:

        \# **crossystem dev\_boot\_signed\_only=1**
    -   Disabled with:

        \# **crossystem dev\_boot\_signed\_only=0**
-   External media boot:
    -   Enabled with:

        \# **crossystem dev\_boot\_usb=1**
    -   Disabled with:

        \# **crossystem dev\_boot\_usb=0**
-   Legacy payload boot:
    -   Enabled with:

        \# **crossystem dev\_boot\_legacy=1**
    -   Disabled with:

        \# **crossystem dev\_boot\_legacy=0**
-   Default boot medium:
    -   Internal storage:

        \# **crossystem dev\_default\_boot=disk**
    -   External media:

        \# **crossystem dev\_default\_boot=usb**
    -   Legacy payload:

        \# **crossystem dev\_default\_boot=legacy**

Copyright © 2015 Paul Kocialkowski <contact@paulk.fr>\
This page is available under the [CC BY SA 4.0](../cc-by-sa-4.0.txt)


code:
diff --git a/src/mainboard/apple/macbook21/mainboard.c b/src/mainboard/apple/macbook21/mainboard.c
index 9a025dd..a2adb76 100644
--- a/src/mainboard/apple/macbook21/mainboard.c
+++ b/src/mainboard/apple/macbook21/mainboard.c
@@ -40,6 +40,12 @@
 extern const u32 *cim_verb_data;
 extern u32 cim_verb_data_size;

+static acpi_cstate_t cst_entries[] = {
+        { 1,  1, 1000, { 0x7f, 1, 2, { 0 }, 1, 0 } },
+        { 2,  1,  500, { 0x01, 8, 0, { 0 }, DEFAULT_PMBASE + LV2, 0 } },
+        { 2, 17,  250, { 0x01, 8, 0, { 0 }, DEFAULT_PMBASE + LV3, 0 } },
+};
+
 #if CONFIG_PCI_OPTION_ROM_RUN_YABEL || CONFIG_PCI_OPTION_ROM_RUN_REALMODE
 static int int15_handler(void)
 {
@@ -73,7 +79,8 @@ static int int15_handler(void)

 int get_cst_entries(acpi_cstate_t **entries)
 {
-       return 0;
+        *entries = cst_entries;
+        return ARRAY_SIZE(cst_entries);
 }

 static void mainboard_init(device_t dev)