summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile74
-rw-r--r--Makefile.d/.gitignore1
-rw-r--r--Makefile.d/addseabios.mk (renamed from addseabios.mk)10
-rw-r--r--Makefile.d/build-release.mk53
-rw-r--r--Makefile.d/build.mk (renamed from build.mk)12
-rw-r--r--Makefile.d/buildrom-withgrub.mk38
-rwxr-xr-xMakefile.d/downloader498
-rw-r--r--Makefile.d/grub-mkstandalone.mk31
-rw-r--r--Makefile.d/modules.mk44
-rw-r--r--Makefile.d/modules/bucts.mk1
-rw-r--r--Makefile.d/modules/coreboot.mk61
-rw-r--r--Makefile.d/modules/dejavu.mk5
-rw-r--r--Makefile.d/modules/flashrom.mk20
-rw-r--r--Makefile.d/modules/grub.mk8
-rw-r--r--Makefile.d/modules/grubinvaders.mk16
-rw-r--r--Makefile.d/modules/i945pwm.mk3
-rw-r--r--Makefile.d/modules/memtest86.mk7
-rw-r--r--Makefile.d/modules/powertop.mk1
-rw-r--r--Makefile.d/modules/seabios.mk8
-rw-r--r--buildrom-withgrub.mk37
-rw-r--r--configure.ac17
-rwxr-xr-xflash_lenovobios_stage12
-rwxr-xr-xflash_lenovobios_stage22
-rwxr-xr-xflash_libreboot62
-rwxr-xr-xflash_macbook21applebios2
-rwxr-xr-xflash_x60_libreboot52
-rwxr-xr-xget46
-rw-r--r--grub-mkstandalone.mk27
-rw-r--r--modules.mk110
-rw-r--r--roms/.gitignore (renamed from bin/.gitignore)0
-rw-r--r--source-locations.sh83
31 files changed, 862 insertions, 359 deletions
diff --git a/Makefile b/Makefile
index 4b7e546..4cdcae6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,21 @@
+VERSION := $(shell if test -f version.txt; then cat version.txt; else git describe; fi)
+host_arch := $(shell uname -m)
+#export CC := $(CC) -static
+
# Just for convenience
keymapdir = resources/utilities/grub-assemble/keymap
-GRUB_MKFONT = src/grub/grub-mkfont
-GRUB_MKLAYOUT = src/grub/grub-mklayout
-GRUB_MKIMAGE = src/grub/grub-mkimage
-GRUB_MKSTANDALONE = src/grub/grub-mkstandalone --grub-mkimage=$(GRUB_MKIMAGE) -d src/grub/grub-core/
-CBFSTOOL = src/coreboot/util/cbfstool/cbfstool
+GRUB_MKFONT = src/$(host_arch)/grub/grub-mkfont
+GRUB_MKLAYOUT = src/$(host_arch)/grub/grub-mklayout
+GRUB_MKIMAGE = src/$(host_arch)/grub/grub-mkimage
+GRUB_MKSTANDALONE = src/$(host_arch)/grub/grub-mkstandalone --grub-mkimage=$(GRUB_MKIMAGE) -d src/$(host_arch)/grub/grub-core/
+CBFSTOOL = src/$(host_arch)/coreboot/util/cbfstool/cbfstool
+arches = i686 x86_64
+archs = $(arches)
boards = x60 t60 x60t macbook21
romtypes = txtmode vesafb
--include $(keymapdir)/list.mk # sets "keymaps=..."
+-include Makefile.d/keymap-list.mk # sets "keymaps=..."
i945boards = x60 x60t t60
@@ -19,46 +25,52 @@ roms = $(foreach board,$(boards),\
$(board)_$(keymap)_$(romtype))))
build: PHONY \
- $(foreach rom,$(roms),bin/$(rom).rom bin/$(rom)_with_seabios.rom) \
- src/flashrom/flashrom_normal \
- src/flashrom/flashrom_lenovobios_macronix \
- src/flashrom/flashrom_lenovobios_sst \
+ $(foreach rom,$(roms),roms/$(rom).rom roms/$(rom)_with_seabios.rom) \
+ src/$(host_arch)/flashrom/flashrom_normal \
+ src/$(host_arch)/flashrom/flashrom_lenovobios_macronix \
+ src/$(host_arch)/flashrom/flashrom_lenovobios_sst \
+ src/$(host_arch)/bucts/bucts
+
+
define _nl
endef
-
-# I wrote this between 3AM and 5AM. I have lost my sanity.
-define _loop_rule
-_loop_str := $$$$(_nl)$$$$(rule_$1)$$$$(_nl)
-_loop_str := $$$$(foreach @,$$$$$$$$@,$$(_loop_str))
-_loop_str := $$$$(foreach <,$$$$$$$$<,$$(_loop_str))
-$(foreach var,$2,_loop_str := $$$$(foreach $(var),$$$$($(var)s),$$(_loop_str))$(_nl))
-endef
-define loop_rule
-$(eval $(call _loop_rule,$1,$2))
-$(eval _loop = $(_loop_str))
-$(_loop)
-endef
+multiglob = $(if $(strip $2),\
+ $(foreach item,$($(firstword $2)s),\
+ $(subst %($(firstword $2)),$(item),\
+ $(call multiglob,$1,$(wordlist 2,$(words $2),$2)))),\
+ $(_nl)$(value rule_$1)$(_nl))
-$(keymapdir)/list.mk: $(keymapdir)/original/
- echo keymaps = $$(ls $<) > $@
+configure: configure.ac
+ autoconf
+
+Makefile.d/keymap-list.mk: $(keymapdir)/original/ Makefile
+ echo keymaps = $(notdir $(wildcard $</*)) > $@
+Makefile.d/modules-list.mk: Makefile.d/modules/ Makefile
+ echo modules = $(patsubst %.mk,%,$(notdir $(wildcard $</*.mk))) > $@
-resources/grub/font/dejavusansmono.pf2: src/dejavu/ttf/DejaVuSansMono.ttf $(firstword $(GRUB_MKFONT))
+resources/grub/font/dejavusansmono.pf2: src/$(host_arch)/dejavu/ttf/DejaVuSansMono.ttf $(firstword $(GRUB_MKFONT))
$(GRUB_MKFONT) -o $@ $<
# % = $(keymap)
$(keymapdir)/%.gkb: $(keymapdir)/original/% $(firstword $(GRUB_MKLAYOUT))
$(GRUB_MKLAYOUT) -o $@ < $<
-include modules.mk
-include build.mk
-include grub-mkstandalone.mk
-include buildrom-withgrub.mk
-include addseabios.mk
+-include Makefile.d/modules-list.mk # sets "modules=..."
+include $(patsubst %,Makefile.d/modules/%.mk,$(modules))
+include Makefile.d/modules.mk
+include Makefile.d/build.mk
+include Makefile.d/grub-mkstandalone.mk
+include Makefile.d/buildrom-withgrub.mk
+include Makefile.d/addseabios.mk
+
+# It is important that build-release.mk is LAST, as it uses
+# MAKEFILE_LIST to know which files to copy.
+include Makefile.d/build-release.mk
diff --git a/Makefile.d/.gitignore b/Makefile.d/.gitignore
new file mode 100644
index 0000000..7b1b05b
--- /dev/null
+++ b/Makefile.d/.gitignore
@@ -0,0 +1 @@
+*-list.mk
diff --git a/addseabios.mk b/Makefile.d/addseabios.mk
index 8bc6ef2..50c4af6 100644
--- a/addseabios.mk
+++ b/Makefile.d/addseabios.mk
@@ -1,11 +1,11 @@
-bin/%_with_seabios.rom: bin/%.rom \
- src/seabios/out/vgabios.bin \
- src/seabios/out/bios.bin.elf \
+roms/%_with_seabios.rom: roms/%.rom \
+ src/$(host_arch)/seabios/out/vgabios.bin \
+ src/$(host_arch)/seabios/out/bios.bin.elf \
resources/grub/config/seabios.cfg \
$(CBFSTOOL)
cp $< $@.tmp
- $(CBFSTOOL) $@.tmp add -f src/seabios/out/vgabios.bin -n vgaroms/vgabios.bin -t raw
- $(CBFSTOOL) $@.tmp add -f src/seabios/out/bios.bin.elf -n bios.bin.elf -t raw
+ $(CBFSTOOL) $@.tmp add -f src/$(host_arch)/seabios/out/vgabios.bin -n vgaroms/vgabios.bin -t raw
+ $(CBFSTOOL) $@.tmp add -f src/$(host_arch)/seabios/out/bios.bin.elf -n bios.bin.elf -t raw
$(CBFSTOOL) $@.tmp extract -n grub.cfg -f $@.tmp.grub.cfg
$(CBFSTOOL) $@.tmp extract -n grubtest.cfg -f $@.tmp.grubtest.cfg
$(CBFSTOOL) $@.tmp remove -n grub.cfg
diff --git a/Makefile.d/build-release.mk b/Makefile.d/build-release.mk
new file mode 100644
index 0000000..09c0808
--- /dev/null
+++ b/Makefile.d/build-release.mk
@@ -0,0 +1,53 @@
+
+dist_utils = \
+ bucts \
+ flashrom_normal \
+ flashrom_lenovobios_macronix \
+ flashrom_lenovobios_sst \
+ cbfstool \
+ nvramtool
+dist_files = \
+ $(MAKEFILE_LIST) \
+ configure configure.ac \
+ tmp/.gitignore \
+ powertop.trisquel6 \
+ powertop.trisquel6.init \
+ powertop.trisquel7 \
+ powertop.trisquel7.init \
+ deps-trisquel \
+ flash_lenovobios_stage1 \
+ flash_lenovobios_stage2 \
+ flash_libreboot6 \
+ flash_macbook21applebios \
+ flash_x60_libreboot5
+dist_dirs = docs bin resources
+
+distdir: PHONY \
+ libreboot-$(VERSION)/version.txt \
+ $(addprefix libreboot-$(VERSION)/utils/$(arch)/,$(dist_utils)) \
+ $(addprefix libreboot-$(VERSION)/,$(dist_files) $(dist_dirs))
+
+libreboot-$(VERSION)/utils/$(arch)/bucts: src/bucts/bucts
+ mkdir -p $(@D)
+ cp $< $@
+libreboot-$(VERSION)/utils/$(arch)/flashrom_%: src/flashrom/flashrom_%
+ mkdir -p $(@D)
+ cp $< $@
+libreboot-$(VERSION)/utils/$(arch)/cbfstool: src/coreboot/util/cbfstool/cbfstool
+ mkdir -p $(@D)
+ cp $< $@
+libreboot-$(VERSION)/utils/$(arch)/nvramtool: src/coreboot/util/nvramtool/nvramtool
+ mkdir -p $(@D)
+ cp $< $@
+$(addprefix libreboot-$(VERSION)/,$(dist_files)): \
+libreboot-$(VERSION)/%: %
+ mkdir -p $(@D)
+ cp $< $@
+$(addprefix libreboot-$(VERSION)/,$(dist_dirs)): \
+libreboot-$(VERSION)/%: %
+ mkdir -p $(@D)
+ cp -r $< $@
+
+libreboot-$(VERSION)/version.txt: PHONY
+ mkdir -p $(@D)
+ echo $(VERSION) > $@
diff --git a/build.mk b/Makefile.d/build.mk
index b80143f..478fdc5 100644
--- a/build.mk
+++ b/Makefile.d/build.mk
@@ -1,16 +1,16 @@
define rule_grub_cfg
-tmp/grub_$(keymap)_$(romtype).cfg: \
+tmp/grub_%(keymap)_%(romtype).cfg: \
resources/grub/config/extra/common.cfg resources/grub/config/menuentries/common.cfg \
- resources/grub/config/extra/$(romtype).cfg resources/grub/config/menuentries/$(romtype).cfg ;
- echo 'keymap $(keymap)' | cat \
+ resources/grub/config/extra/%(romtype).cfg resources/grub/config/menuentries/%(romtype).cfg ;
+ echo 'keymap %(keymap)' | cat \
resources/grub/config/extra/common.cfg \
- resources/grub/config/extra/$(romtype).cfg \
+ resources/grub/config/extra/%(romtype).cfg \
- \
resources/grub/config/menuentries/common.cfg \
- resources/grub/config/menuentries/$(romtype).cfg \
+ resources/grub/config/menuentries/%(romtype).cfg \
> $@
endef
-$(eval $(call loop_rule,grub_cfg,keymap romtype))
+$(eval $(call multiglob,grub_cfg,keymap romtype))
# % = $(keymap)_$(romtype)
tmp/grub_%_test.cfg: tmp/grub_%.cfg
diff --git a/Makefile.d/buildrom-withgrub.mk b/Makefile.d/buildrom-withgrub.mk
new file mode 100644
index 0000000..11b223e
--- /dev/null
+++ b/Makefile.d/buildrom-withgrub.mk
@@ -0,0 +1,38 @@
+# % = $(board)
+resources/libreboot/config/%_vesafb_config: resources/libreboot/config/%_txtmode_config
+ sed 's/# CONFIG_FRAMEBUFFER_KEEP_VESA_MODE is not set/CONFIG_FRAMEBUFFER_KEEP_VESA_MODE=y/' < $< > $@
+
+# Unfortunately, this rule requires exclusive use of the src/coreboot directory
+.NOTPARALLEL:
+define rule_rom_nokeyboard
+tmp/%(board)_nokeyboard_%(romtype).rom: tmp/builddeps-stamps/$(host_arch)/coreboot \
+ tmp/grub_%(romtype).elf \
+ resources/libreboot/config/%(board)_%(romtype)_config
+ rm -f src/$(host_arch)/coreboot/.config src/$(host_arch)/coreboot/grub.elf
+ $(MAKE) -C src/$(host_arch)/coreboot clean
+ ln resources/libreboot/config/%(board)_%(romtype)_config src/$(host_arch)/coreboot/.config
+ ln tmp/grub_%(romtype).elf src/$(host_arch)/coreboot/grub.elf
+ $(MAKE) -C src/$(host_arch)/coreboot
+ rm -f src/$(host_arch)/coreboot/.config src/$(host_arch)/coreboot/grub.elf
+ mv src/$(host_arch)/coreboot/build/coreboot.rom $@
+endef
+$(eval $(call multiglob,rom_nokeyboard,board romtype))
+
+define rule_rom
+roms/%(board)_%(keymap)_%(romtype).rom: \
+ tmp/%(board)_nokeyboard_%(romtype).rom \
+ tmp/grub_%(keymap)_%(romtype).cfg \
+ tmp/grub_%(keymap)_%(romtype)_test.cfg \
+ $(firstword $(CBFSTOOL))
+ cp $< $@.tmp
+ $(CBFSTOOL) $@.tmp add -f tmp/grub_%(keymap)_%(romtype).cfg -n grub.cfg -t raw
+ $(CBFSTOOL) $@.tmp add -f tmp/grub_%(keymap)_%(romtype)_test.cfg -n grubtest.cfg -t raw
+ $(if $(filter %(board),$(i945boards)),\
+ # Needed on i945 systems for the bucts/dd trick (documented)
+ # This enables the ROM to be flashed over the lenovo bios firmware
+ dd if='$@.tmp' of='$@.tmp.top64k' bs=1 skip=$$[$$(stat -c %s '$@.tmp') - 0x10000] count=64k && \
+ dd if='$@.tmp.top64k' of='$@.tmp' bs=1 seek=$$[$$(stat -c %s '$@.tmp') - 0x20000] count=64k conv=notrunc && \
+ rm -f '$@.tmp.top64k')
+ mv $@.tmp $@
+endef
+$(eval $(call multiglob,rom,board keymap romtype))
diff --git a/Makefile.d/downloader b/Makefile.d/downloader
new file mode 100755
index 0000000..ffb2388
--- /dev/null
+++ b/Makefile.d/downloader
@@ -0,0 +1,498 @@
+#!/bin/bash
+# Makefile.d/downloader: A downloader script that handles all kinds of
+# funny VCS URLs.
+# Very heavily based on Pacman's 'makepkg' script.
+
+# Usage: Makefile.d/downloader ARCH DEPNAME::URL [DEPNAME::URL...]
+
+# Copyright (c) 2014 Luke Shumaker <lukeshu@sbcglobal.net>
+# Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
+# Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
+# Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
+# Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
+# Copyright (c) 2006 by Alex Smith <alex@alex-smith.me.uk>
+# Copyright (c) 2006 by Andras Voroskoi <voroskoi@frugalware.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 2 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/>.
+
+export TEXTDOMAIN='pacman-scripts'
+export TEXTDOMAINDIR='/usr/share/locale'
+
+shopt -s extglob
+set -u -e -E
+
+# check if messages are to be printed using color
+declare ALL_OFF= BOLD= BLUE= GREEN= RED= YELLOW=
+if [[ -t 2 ]]; then
+ # prefer terminal safe colored and bold text when tput is supported
+ if tput setaf 0 &>/dev/null; then
+ ALL_OFF="$(tput sgr0)"
+ BOLD="$(tput bold)"
+ BLUE="${BOLD}$(tput setaf 4)"
+ GREEN="${BOLD}$(tput setaf 2)"
+ RED="${BOLD}$(tput setaf 1)"
+ YELLOW="${BOLD}$(tput setaf 3)"
+ else
+ ALL_OFF="\e[1;0m"
+ BOLD="\e[1;1m"
+ BLUE="${BOLD}\e[1;34m"
+ GREEN="${BOLD}\e[1;32m"
+ RED="${BOLD}\e[1;31m"
+ YELLOW="${BOLD}\e[1;33m"
+ fi
+fi
+readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
+
+### SUBROUTINES ###
+
+plain() {
+ local mesg=$1; shift
+ printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
+}
+
+msg() {
+ local mesg=$1; shift
+ printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
+}
+
+msg2() {
+ local mesg=$1; shift
+ printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
+}
+
+warning() {
+ local mesg=$1; shift
+ printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
+}
+
+error() {
+ local mesg=$1; shift
+ printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
+}
+
+dir_is_empty() {
+ (
+ shopt -s dotglob nullglob
+ files=("$1"/*)
+ (( ${#files} == 0 ))
+ )
+}
+
+# a "netfile" has the form:
+# "depname::url"
+get_url() { printf -- "%s\n" "${1#*::}"; }
+get_depname() { printf -- "%s\n" "${1%%::*}"; }
+
+get_protocol() {
+ local url="$(get_url "$1")"
+ local proto="${url%%://*}"
+ proto=${proto%%+*}
+ printf -- "%s\n" "$proto"
+}
+
+get_urlname() {
+ local netfile=$1
+ local url="$(get_url "$netfile")"
+ local proto=$(get_protocol "$netfile")
+ urlname=${netfile%%#*} # Strip a fragment
+ urlname=${urlname%/} # Strip a trailing slash
+ urlname=${urlname##*/} # Strip leading components
+ urlname=${urlname%.$proto} # Strip .git
+ printf -- "%s\n" "${urlname}"
+}
+
+get_downloadname() {
+ local netfile=$1
+ local depname="$(get_depname "$netfile")"
+ local urlname="$(get_urlname "$netfile")"
+ local proto="$(get_protocol "$netfile")"
+
+ local name
+ case $proto in
+ git|hg|svn) name="$depname.$proto";;
+ http|https) name="$urlname";;
+ *) return 1;;
+ esac
+
+ printf -- "%s\n" "$name"
+}
+
+####
+
+get_downloadclient() {
+ local proto=$1
+
+ # loop through DOWNLOAD_AGENTS variable looking for protocol
+ local i
+ for i in "${DLAGENTS[@]}"; do
+ local handler="${i%%::*}"
+ if [[ $proto = "$handler" ]]; then
+ local agent="${i##*::}"
+ break
+ fi
+ done
+
+ # if we didn't find an agent, return an error
+ if [[ -z $agent ]]; then
+ error "$(gettext "Unknown download protocol: %s")" "$proto"
+ plain "$(gettext "Aborting...")"
+ exit 1 # $E_CONFIG_ERROR
+ fi
+
+ # ensure specified program is installed
+ local program="${agent%% *}"
+ if [[ ! -x $program ]]; then
+ local baseprog="${program##*/}"
+ error "$(gettext "The download program %s is not installed.")" "$baseprog"
+ plain "$(gettext "Aborting...")"
+ exit 1 # $E_MISSING_PROGRAM
+ fi
+
+ printf "%s\n" "$agent"
+}
+
+download_file() {
+ local netfile=$1
+ local filename="$(get_downloadname "$netfile")"
+
+ pushd "$SRCDEST" &>/dev/null
+
+ if [[ -f "$filename" ]]; then
+ msg2 "$(gettext "Found %s")" "${filename}"
+ return
+ fi
+
+ local proto=$(get_protocol "$netfile")
+
+ # find the client we should use for this URL
+ local dlcmd
+ dlcmd=$(get_downloadclient "$proto") || exit $?
+
+ local url=$(get_url "$netfile")
+
+ msg2 "$(gettext "Downloading %s...")" "$filename"
+
+ # temporary download file, default to last component of the URL
+ local dlfile=$filename
+
+ # replace %o by the temporary dlfile if it exists
+ if [[ $dlcmd = *%o* ]]; then
+ dlcmd=${dlcmd//\%o/\"$filename.part\"}
+ dlfile="$filename.part"
+ fi
+ # add the URL, either in place of %u or at the end
+ if [[ $dlcmd = *%u* ]]; then
+ dlcmd=${dlcmd//\%u/\"$url\"}
+ else
+ dlcmd="$dlcmd \"$url\""
+ fi
+
+ local ret=0
+ eval "$dlcmd || ret=\$?"
+ if (( ret )); then
+ [[ ! -s $dlfile ]] && rm -f -- "$dlfile"
+ error "$(gettext "Failure while downloading %s")" "$filename"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ fi
+
+ # rename the temporary download file to the final destination
+ if [[ $dlfile != "$filename" ]]; then
+ mv -f "$dlfile" "$filename"
+ fi
+}
+
+extract_file() {
+ local netfile=$1
+ local depname="$(get_depname "$netfile")"
+ local filename="$(get_downloadname "$netfile")"
+ local filepath="$SRCDEST/$filename"
+ local filetype=$(file -bizL "$filepath") # fix Arch flyspray #6246
+ local ext=${filename##*.}
+ local cmd=bsdtar
+
+ local ret=0
+ msg2 "$(gettext "Extracting %s with %s")" "$filename" "$cmd"
+ rm -rf "$srcdir/$depname"
+ mkdir "$srcdir/$depname" && $cmd -xf "$filepath" -C "$srcdir/$depname" --strip-components 1 || ret=$?
+ if (( ret )); then
+ error "$(gettext "Failed to extract %s")" "$file"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ fi
+}
+
+download_git() {
+ local netfile=$1
+
+ local repo="$(get_downloadname "$netfile")"
+ local dir="$SRCDEST/$repo"
+
+ local url="$(get_url "$netfile")"
+ url=${url##git+}
+ url=${url%%#*}
+
+ if [[ ! -d "$dir" ]] || dir_is_empty "$dir" ; then
+ msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "git"
+ if ! git clone --mirror "$url" "$dir"; then
+ error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "git"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ fi
+ elif (( ! HOLDVER )); then
+ pushd "$dir" &>/dev/null
+ # Make sure we are fetching the right repo
+ if [[ "$url" != "$(git config --get remote.origin.url)" ]] ; then
+ error "$(gettext "%s is not a clone of %s")" "$dir" "$url"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ fi
+ msg2 "$(gettext "Updating %s %s repo...")" "${repo}" "git"
+ if ! git fetch --all -p; then
+ # only warn on failure to allow offline builds
+ warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "git"
+ fi
+ popd &>/dev/null
+ fi
+}
+
+extract_git() {
+ local netfile=$1
+
+ local url="$(get_url "$netfile")"
+ local fragment=
+ if [[ $url = *#* ]]; then
+ fragment=${url#*#}
+ fi
+
+ local repo="$(get_downloadname "$netfile")"
+ local src="$SRCDEST/$repo"
+ local dst="$srcdir/$(get_depname "$netfile")"
+
+ msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "git"
+ rm -rf "${dst}"
+
+ if ! git clone "$src" "$dst"; then
+ error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ fi
+
+ local ref=
+ if [[ -n $fragment ]]; then
+ case ${fragment%%=*} in
+ commit|tag)
+ ref=${fragment##*=}
+ ;;
+ branch)
+ ref=origin/${fragment##*=}
+ ;;
+ *)
+ error "$(gettext "Unrecognized reference: %s")" "${fragment}"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ esac
+ fi
+
+ if [[ -n $ref ]]; then
+ pushd "${dst}" &>/dev/null
+ if ! git checkout -b makepkg $ref; then
+ error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ fi
+ popd &>/dev/null
+ fi
+}
+
+download_hg() {
+ local netfile=$1
+
+ local repo=$(get_downloadname "$netfile")
+ local dir="$SRCDEST/$repo"
+
+ local url=$(get_url "$netfile")
+ url=${url##hg+}
+ url=${url%%#*}
+
+ if [[ ! -d "$dir" ]] || dir_is_empty "$dir" ; then
+ msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "hg"
+ if ! hg clone -U "$url" "$dir"; then
+ error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "hg"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ fi
+ elif (( ! HOLDVER )); then
+ msg2 "$(gettext "Updating %s %s repo...")" "${repo}" "hg"
+ pushd "$dir" &>/dev/null
+ if ! hg pull; then
+ # only warn on failure to allow offline builds
+ warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "hg"
+ fi
+ popd &>/dev/null
+ fi
+}
+
+extract_hg() {
+ local netfile=$1
+
+ local url="$(get_url "$netfile")"
+ local fragment=
+ if [[ $url = *#* ]]; then
+ fragment=${url#*#}
+ fi
+
+ local repo="$(get_downloadname "$netfile")"
+ local src="$SRCDEST/$repo"
+ local dst="$srcdir/$(get_depname "$netfile")"
+
+ msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "hg"
+ rm -rf "${dst}"
+
+ local ref=
+ if [[ -n $fragment ]]; then
+ case ${fragment%%=*} in
+ branch|revision|tag)
+ ref=('-u' "${fragment##*=}")
+ ;;
+ *)
+ error "$(gettext "Unrecognized reference: %s")" "${fragment}"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ esac
+ fi
+
+ if ! hg clone "${ref[@]}" "$src" "$dst"; then
+ error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "hg"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ fi
+
+}
+
+download_svn() {
+ local netfile=$1
+
+ local url="$(get_url "$netfile")"
+ url=${url##svn+}
+ local fragment=
+ if [[ $url = *#* ]]; then
+ fragment=${url#*#}
+ fi
+ url=${url%%#*}
+
+ local repo=$(get_downloadname "$netfile")
+ local dir="$SRCDEST/$repo"
+
+ if [[ ! -d "$dir" ]] || dir_is_empty "$dir" ; then
+ msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "svn"
+ mkdir -p "$dir/.makepkg"
+ if ! svn checkout --config-dir "$dir/.makepkg" "$url" "$dir"; then
+ error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "svn"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ fi
+ elif (( ! HOLDVER )); then
+ msg2 "$(gettext "Updating %s %s repo...")" "${repo}" "svn"
+ pushd "$dir" &>/dev/null
+ if ! svn update; then
+ # only warn on failure to allow offline builds
+ warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "svn"
+ fi
+ popd &>/dev/null
+ fi
+}
+
+extract_svn() {
+ local netfile=$1
+
+ local url="$(get_url "$netfile")"
+ url=${url##svn+}
+ local fragment=
+ if [[ $url = *#* ]]; then
+ fragment=${url#*#}
+ fi
+
+ local repo="$(get_downloadname "$netfile")"
+ local src="$SRCDEST/$repo"
+ local dst="$srcdir/$(get_depname "$netfile")"
+
+ msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "svn"
+ rm -rf "${dst}"
+
+ local ref=
+ if [[ -n $fragment ]]; then
+ case ${fragment%%=*} in
+ revision)
+ ref="${fragment##*=}"
+ ;;
+ *)
+ error "$(gettext "Unrecognized reference: %s")" "${fragment}"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ esac
+ fi
+
+ cp -a "$src" "$dst"
+
+ if [[ -n ${ref} ]]; then
+ pushd "$dst" &>/dev/null
+ if ! svn update -r ${ref}; then
+ error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "svn"
+ plain "$(gettext "Aborting...")"
+ fi
+ popd &>/dev/null
+ fi
+}
+
+download_sources() {
+ msg "$(gettext "Retrieving sources...")"
+
+ local netfile
+ for netfile in "$@"; do
+ local proto=$(get_protocol "$netfile")
+ case "$proto" in
+ git)
+ download_git "$netfile"
+ extract_git "$netfile"
+ ;;
+ hg)
+ download_hg "$netfile"
+ extract_hg "$netfile"
+ ;;
+ svn)
+ download_svn "$netfile"
+ extract_svn "$netfile"
+ ;;
+ http|https)
+ download_file "$netfile"
+ extract_file "$netfile"
+ ;;
+ *)
+ error "$(gettext "Unrecognized protocol: %s")" "$proto"
+ return 1
+ ;;
+ esac
+ done
+}
+
+declare -r HOLDVER=0
+declare -r srcdir="$PWD/src/$1"; shift
+declare -r SRCDEST="$PWD/src/downloads"
+declare -r DLAGENTS=('http::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'
+ 'https::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u')
+
+mkdir -p "$srcdir" "$SRCDEST"
+download_sources "$@"
diff --git a/Makefile.d/grub-mkstandalone.mk b/Makefile.d/grub-mkstandalone.mk
new file mode 100644
index 0000000..6eac0a1
--- /dev/null
+++ b/Makefile.d/grub-mkstandalone.mk
@@ -0,0 +1,31 @@
+include resources/utilities/grub-assemble/modules.conf
+
+grub_txtmode_memdisk_grafts = \
+ /memtest=src/$(host_arch)/memtest86/memtest \
+ /invaders.exec=src/$(host_arch)/grubinvaders/invaders.exec
+grub_vesafb_memdisk_grafts = \
+ /background.jpg=resources/grub/background/background.jpg \
+ /dejavusansmono.pf2=resources/grub/font/dejavusansmono.pf2
+
+grub_txtmode_memdisk_deps = $(foreach graft,$(grub_txtmode_memdisk_grafts),$(lastword $(subst =, ,$(graft))))
+grub_vesafb_memdisk_deps = $(foreach graft,$(grub_vesafb_memdisk_grafts) ,$(lastword $(subst =, ,$(graft))))
+
+# A rule-variable is used here to avoid needing .SECONDEXPANSION
+define rule_grub_elf
+tmp/grub_%(romtype).elf: \
+ tmp/builddeps-stamps/$(host_arch)/grub \
+ $(keymapdir)/list.mk resources/utilities/grub-assemble/modules.conf \
+ resources/grub/config/grub_memdisk.cfg \
+ $(grub_%(romtype)_memdisk_deps) \
+ $(firstword $(GRUB_MKSTANDALONE)) \
+ $(foreach k,$(keymaps),$(keymapdir)/$k.gkb)
+ $(GRUB_MKSTANDALONE) -o $@ -O i386-coreboot \
+ --fonts= --themes= --locales= \
+ --modules='$(grub_modules)' \
+ --install-modules='$(grub_install_modules)' \
+ /boot/grub/grub.cfg="resources/grub/config/grub_memdisk.cfg" \
+ $(grub_%(romtype)_memdisk_grafts) \
+ $(foreach k,$(keymaps),/boot/grub/layouts/$k.gkb=$(keymapdir)/$k.gkb)
+ test -e $@
+endef
+$(eval $(call multiglob,grub_elf,romtype))
diff --git a/Makefile.d/modules.mk b/Makefile.d/modules.mk
new file mode 100644
index 0000000..cbd92ed
--- /dev/null
+++ b/Makefile.d/modules.mk
@@ -0,0 +1,44 @@
+# Easy names for tmp/builddeps-stamps/%
+$(foreach arch,$(arches),$(foreach module,$(modules), builddeps-$(arch)/$(module) )): builddeps-%: PHONY tmp/builddeps-stamps/%
+
+# The "all" rules
+getdeps: $(foreach arch,$(arches),$(foreach module,$(modules), src/$(arch)/$(module) ))
+builddeps: $(foreach arch,$(arches),$(foreach module,$(modules), builddeps-$(arch)/$(module) ))
+cleandeps: $(foreach arch,$(arches),$(foreach module,$(modules), cleandeps-$(arch)/$(module) ))
+ rm -rf roms/* tmp/*
+
+# If we depend on a file in src/$(arch)/$(module)/, tell Make that we
+# should generate it by calling the builddep rule.
+define rule_module_files
+src/%(arch)/%(module)/%: | tmp/builddeps-stamps/%(arch)/%(module)
+ test -e $@
+endef
+$(eval $(call multiglob,modules_files,arch module))
+
+# The generic rules
+
+# "get" rules
+define rule_download
+src/%(arch)/%(module): Makefile.d/downloader Makefile.d/modules/%(module).mk $(%(module)_patches)
+ Makefile.d/downloader %(arch) %(module)::$(%(module)_source)
+ $(%(module)_patch)
+ test -d $@
+ touch $@
+endef
+$(eval $(call multiglob,download,arch module))
+
+# "builddeps" and "cleandeps" rules
+# % = arch/module
+tmp/builddeps-stamps/%: src/%
+ cd $< && { test -f ./Makefile || test -x ./configure || ./autogen.sh; }
+ cd $< && { test -f ./Makefile || ./configure $($*_configure); }
+ $(MAKE) -C $<
+ mkdir -p $(@D)
+ touch $@
+
+# "cleandeps" rules
+$(foreach arch,$(arches),$(foreach module,$(modules), cleandeps-$(arch)/$(module) )): \
+cleandeps-%: PHONY cleandeps-%-custom
+ rm -f tmp/builddeps-stamps/%
+cleandeps-%-custom: PHONY
+ test ! -f src/$*/Makefile || $(MAKE) -C src/$* clean
diff --git a/Makefile.d/modules/bucts.mk b/Makefile.d/modules/bucts.mk
new file mode 100644
index 0000000..280dcb9
--- /dev/null
+++ b/Makefile.d/modules/bucts.mk
@@ -0,0 +1 @@
+bucts_source = git://git.stuge.se/bucts.git\#commit=dc27919d7a66a6e8685ce07c71aefa4f03ef7c07
diff --git a/Makefile.d/modules/coreboot.mk b/Makefile.d/modules/coreboot.mk
new file mode 100644
index 0000000..1cf2309
--- /dev/null
+++ b/Makefile.d/modules/coreboot.mk
@@ -0,0 +1,61 @@
+coreboot_source = git+http://review.coreboot.org/coreboot\#commit=c637a887dde1c63bf3863e70cbe19dedf5f6ca02
+
+coreboot_patches = resources/coreboot/patch/DEBLOB
+define coreboot_patch
+ # Get patches from review.coreboot.org
+ # Text mode patch for X60 native graphics (main patch already merged in coreboot. See 6723 on coreboot gerrit)
+ cd $@ && git fetch http://review.coreboot.org/coreboot refs/changes/25/6725/3 && git cherry-pick FETCH_HEAD
+ # lenovo/x60: Enable legacy brightness controls (native graphics)
+ cd $@ && git fetch http://review.coreboot.org/coreboot refs/changes/48/7048/4 && git cherry-pick FETCH_HEAD
+ # Enable T60 native graphics
+ cd $@ && git fetch http://review.coreboot.org/coreboot refs/changes/45/5345/9 && git cherry-pick FETCH_HEAD
+ # Enable text-mode graphics for T60
+ cd $@ && git fetch http://review.coreboot.org/coreboot refs/changes/50/7050/2 && git cherry-pick FETCH_HEAD
+ # lenovo/t60: Enable legacy brightness controls (native graphics)
+ cd $@ && git fetch http://review.coreboot.org/coreboot refs/changes/51/7051/1 && git cherry-pick FETCH_HEAD
+ # ec/lenovo/h8: permanently enable wifi/trackpoint/touchpad/bluetooth/wwan
+ cd $@ && git fetch http://review.coreboot.org/coreboot refs/changes/58/7058/7 && git cherry-pick FETCH_HEAD
+ # i945: permanently set tft_brightness to 0xff. this fixes the issue with X60 and "scrolling" backlight
+ cd $@ && git fetch http://review.coreboot.org/coreboot refs/changes/61/7561/2 && git cherry-pick FETCH_HEAD
+ # Note: macbook21 already has backlight control.
+ # Deblob coreboot
+ cd $@ && $(abspath resources/coreboot/patch/DEBLOB)
+endef
+
+
+# Generate sub-source directories by generating the parent source directory
+coreboot_utils = cbfstool nvramtool crossgcc
+define rule_coreboot_utils
+src/%(arch)/coreboot/util/%(coreboot_util): | src/%(arch)/coreboot
+ test -d $@
+endef
+$(eval $(call multiglob,coreboot_utils,arch coreboot_utils))
+
+# The builddeps stamp needs to depend on 3 "utility" builddeps
+$(foreach arch,$(arches),tmp/builddeps-stamps/$(arch)/coreboot): \
+tmp/builddeps-stamps/%/coreboot: \
+ tmp/builddeps-stamps/%/coreboot-cbfstool \
+ tmp/builddeps-stamps/%/coreboot-nvramtool \
+ tmp/builddeps-stamps/%/coreboot-crossgcc
+ touch $@
+
+# The 3 actual utility builddeps:
+tmp/builddeps-stamps/%/coreboot-cbfstool: src/%/coreboot/util/cbfstool
+ $(MAKE) -C $<
+ mkdir -p $(@D)
+ touch $@
+tmp/builddeps-stamps/%/coreboot-nvramtool: src/%/coreboot/util/nvramtool
+ $(MAKE) -C $<
+ mkdir -p $(@D)
+ touch $@
+tmp/builddeps-stamps/%/coreboot-crossgcc: src/%/coreboot/util/crossgcc
+ $(MAKE) -C src/$*/coreboot crossgcc-i386
+ mkdir -p $(@D)
+ touch $@
+
+cleandeps-%/coreboot-custom: PHONY
+ test ! -f src/%/coreboot/Makefile || $(MAKE) -C src/%/coreboot clean
+ test ! -f src/%/coreboot/Makefile || $(MAKE) -C src/%/coreboot/util/cbfstool clean
+ test ! -f src/%/coreboot/Makefile || $(MAKE) -C src/%/coreboot/util/nvramtool clean
+ test ! -f src/%/coreboot/Makefile || $(MAKE) -C src/%/coreboot crossgcc-clean
+ rm -f tmp/builddeps-stamps/%/coreboot-*
diff --git a/Makefile.d/modules/dejavu.mk b/Makefile.d/modules/dejavu.mk
new file mode 100644
index 0000000..ae72876
--- /dev/null
+++ b/Makefile.d/modules/dejavu.mk
@@ -0,0 +1,5 @@
+dejavu_source = http://sourceforge.net/projects/dejavu/files/dejavu/2.34/dejavu-fonts-ttf-2.34.tar.bz2
+
+$(foreach arch,$(arches),tmp/builddeps-stamps/$(arch)/dejavu): \
+tmp/builddeps-stamps/%/dejavu: src/%/dejavu ; mkdir -p $(@D) && touch $@
+cleandeps-%/dejavu-custom: PHONY ;
diff --git a/Makefile.d/modules/flashrom.mk b/Makefile.d/modules/flashrom.mk
new file mode 100644
index 0000000..c70e6e2
--- /dev/null
+++ b/Makefile.d/modules/flashrom.mk
@@ -0,0 +1,20 @@
+flashrom_source = svn://flashrom.org/flashrom/trunk\#revision=1854
+
+flashrom_patches = $(wildcard resources/flashrom/patch/flashchips_*.c)
+define flashrom_patch
+ cp resources/flashrom/patch/flashchips_*.c $@
+ sed -i \
+ -e 's/\$$(PROGRAM)\$$(EXEC_SUFFIX)/$$(PROGRAM)$$(patchname)$$(EXEC_SUFFIX)/g' \
+ -e 's/flashchips\.o/flashchips$$(patchname).o/g' \
+ -e 's/libflashrom\.a/libflashrom$$(patchname).a/g' \
+ -e 's/\(rm .*libflashrom\)\S*\.a/\1*.a $$(PROGRAM)_*/' \
+ $@/Makefile
+endef
+
+$(foreach arch,$(arches),tmp/builddeps-stamps/$(arch)/flashrom): \
+tmp/builddeps-stamps/%/flashrom: src/%/flashrom
+ $(MAKE) -C $< patchname=_normal
+ $(MAKE) -C $< patchname=_lenovobios_macronix
+ $(MAKE) -C $< patchname=_lenovobios_sst
+ mkdir -p $(@D)
+ touch $@
diff --git a/Makefile.d/modules/grub.mk b/Makefile.d/modules/grub.mk
new file mode 100644
index 0000000..3f392aa
--- /dev/null
+++ b/Makefile.d/modules/grub.mk
@@ -0,0 +1,8 @@
+grub_source = git://git.savannah.gnu.org/grub.git\#commit=e2dd6daa8c33e3e7641e442dc269fcca479c6fda
+
+grub_patches = resources/grub/patch/gitdiff
+define grub_patch
+ cd $@ && git apply $(abspath resources/grub/patch/gitdiff)
+endef
+
+grub_configure = --with-platform=coreboot
diff --git a/Makefile.d/modules/grubinvaders.mk b/Makefile.d/modules/grubinvaders.mk
new file mode 100644
index 0000000..01d1c0c
--- /dev/null
+++ b/Makefile.d/modules/grubinvaders.mk
@@ -0,0 +1,16 @@
+grubinvaders_source = http://www.erikyyy.de/invaders/invaders-1.0.0.tar.gz
+
+grubinvaders_patches = resources/grubinvaders/patch/diff.patch resources/grubinvaders/patch/compile.sh.patch
+define grubinvaders_patch
+ # Apply patch mentioned on http://www.coreboot.org/GRUB_invaders
+ cd $@ && patch < $(abspath resources/grubinvaders/patch/diff.patch)
+ cd $@ && patch compile.sh < $(abspath resources/grubinvaders/patch/compile.sh.patch)
+endef
+
+$(foreach arch,$(arches),tmp/builddeps-stamps/$(arch)/grubinvaders): \
+tmp/builddeps-stamps/%/grubinvaders: src/%/grubinvaders
+ cd $< && ./compile.sh
+ mkdir -p $(@D)
+ touch $@
+cleandeps-%/grubinvaders-custom: PHONY
+ test ! -d src/%/grubinvaders || { cd src/%/grubinvaders && ./clean.sh; }
diff --git a/Makefile.d/modules/i945pwm.mk b/Makefile.d/modules/i945pwm.mk
new file mode 100644
index 0000000..b8f2a12
--- /dev/null
+++ b/Makefile.d/modules/i945pwm.mk
@@ -0,0 +1,3 @@
+i945pwm_source = git://git.mtjm.eu/i945-pwm.git\#commit=d88c8b290b9473e071d24cd3b97f4a091ee398cf
+cleandeps-%/i945pwm-custom: PHONY
+ rm -f src/%/i945pwm/i945-pwm
diff --git a/Makefile.d/modules/memtest86.mk b/Makefile.d/modules/memtest86.mk
new file mode 100644
index 0000000..97a644d
--- /dev/null
+++ b/Makefile.d/modules/memtest86.mk
@@ -0,0 +1,7 @@
+memtest86_source = http://www.memtest.org/download/5.01/memtest86+-5.01.tar.gz
+
+memtest86_patches = resources/memtest86/patch/config.h resources/memtest86/patch/Makefile
+define memtest86_patch
+ cp -f resources/memtest86/patch/config.h $@/config.h
+ cp -f resources/memtest86/patch/Makefile $@/Makefile
+endef
diff --git a/Makefile.d/modules/powertop.mk b/Makefile.d/modules/powertop.mk
new file mode 100644
index 0000000..7491588
--- /dev/null
+++ b/Makefile.d/modules/powertop.mk
@@ -0,0 +1 @@
+powertop_source = git+https://github.com/fenrus75/powertop.git\#e70c89eb5d7b6b8f898bb126adefcbf3202d5acf
diff --git a/Makefile.d/modules/seabios.mk b/Makefile.d/modules/seabios.mk
new file mode 100644
index 0000000..17abece
--- /dev/null
+++ b/Makefile.d/modules/seabios.mk
@@ -0,0 +1,8 @@
+seabios_source = git://git.seabios.org/seabios.git\#commit=9f505f715793d99235bd6b4afb2ca7b96ba5729b
+
+$(foreach arch,$(arches),tmp/builddeps-stamps/$(arch)/seabios): \
+tmp/builddeps-stamps/%/seabios: src/%/seabios resources/seabios/config/config
+ cp resources/seabios/config/config $</.config
+ $(MAKE) -C $<
+ mkdir -p $(@D)
+ touch $@
diff --git a/buildrom-withgrub.mk b/buildrom-withgrub.mk
deleted file mode 100644
index 3a054be..0000000
--- a/buildrom-withgrub.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# % = $(board)
-resources/libreboot/config/%_vesafb_config: resources/libreboot/config/%_txtmode_config
- sed 's/# CONFIG_FRAMEBUFFER_KEEP_VESA_MODE is not set/CONFIG_FRAMEBUFFER_KEEP_VESA_MODE=y/' < $< > $@
-
-define rule_rom_nokeyboard
-tmp/$(board)_nokeyboard_$(romtype).rom: tmp/builddeps-coreboot.stamp \
- tmp/grub_$(romtype).elf \
- resources/libreboot/config/$(board)_$(romtype)_config
- rm -f src/coreboot/.config src/coreboot/grub.elf
- $(MAKE) -C src/coreboot clean
- ln resources/libreboot/config/$(board)_$(romtype)_config src/coreboot/.config
- ln tmp/grub_$(romtype).elf src/coreboot/grub.elf
- $(MAKE) -C src/coreboot
- rm -f src/coreboot/.config src/coreboot/grub.elf
- mv src/coreboot/build/coreboot.rom $@
-endef
-$(eval $(call loop_rule,rom_nokeyboard,board romtype))
-
-# Unfortunately, any $$ in the rule must become $$$$
-define rule_rom
-bin/$(board)_$(keymap)_$(romtype).rom: \
- tmp/$(board)_nokeyboard_$(romtype).rom \
- tmp/grub_$(keymap)_$(romtype).cfg \
- tmp/grub_$(keymap)_$(romtype)_test.cfg \
- $(firstword $(CBFSTOOL))
- cp $< $@.tmp
- $(CBFSTOOL) $@.tmp add -f tmp/grub_$(keymap)_$(romtype).cfg -n grub.cfg -t raw
- $(CBFSTOOL) $@.tmp add -f tmp/grub_$(keymap)_$(romtype)_test.cfg -n grubtest.cfg -t raw
- $(if $(filter $(board),$(i945boards)),\
- # Needed on i945 systems for the bucts/dd trick (documented)
- # This enables the ROM to be flashed over the lenovo bios firmware
- dd if='$@.tmp' of='$@.tmp.top64k' bs=1 skip=$$$$[$$$$(stat -c %s '$@.tmp') - 0x10000] count=64k && \
- dd if='$@.tmp.top64k' of='$@.tmp' bs=1 seek=$$$$[$$$$(stat -c %s '$@.tmp') - 0x20000] count=64k conv=notrunc && \
- rm -f '$@.tmp.top64k')
- mv $@.tmp $@
-endef
-$(eval $(call loop_rule,rom,board keymap romtype))
diff --git a/configure.ac b/configure.ac
index 66747ef..9c67699 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,18 +29,17 @@ if test "x$HAVE_WGET" = x ; then
AC_MSG_ERROR([Please install the 'wget' utility])
fi
+AC_CHECK_PROG(HAVE_BSDTAR,bsdtar,yes)
+if test "x$HAVE_BSDTAR" = x ; then
+ AC_MSG_ERROR([Please install the 'bsdtar' utility])
+fi
+
dnl 'sh' does not nescessarily imply 'bash'
AC_CHECK_PROG(HAVE_BASH,bash,yes)
if test "x$HAVE_BASH" = x ; then
AC_MSG_ERROR([Please install the 'bash' utility])
fi
-dnl This is a weird Parabola one
-AC_CHECK_PROG(HAVE_MAKEPKG,makepkg,yes)
-if test "x$HAVE_MAKEPKG" = x ; then
- AC_MSG_ERROR([Please install the 'makepkg' utility])
-fi
-
dnl I know that /bin/python => Python 3 works,
dnl I haven't verified that /bin/python => Python 2 works.
AC_CHECK_PROG(HAVE_PYTHON,python,yes)
@@ -76,9 +75,9 @@ AC_MSG_RESULT([yes])
dnl This is at least needed by memtest
AC_LANG_PUSH([C])
-AC_MSG_NOTICE([----------------------------------------------------------------------------])
-AC_MSG_NOTICE([The next few tests are for 32-bit C, NOT necessarily the native architecture])
-AC_MSG_NOTICE([----------------------------------------------------------------------------])
+AC_MSG_NOTICE([-----------------------------------------------------------------------------])
+AC_MSG_NOTICE([The remaining tests are for 32-bit C, NOT necessarily the native architecture])
+AC_MSG_NOTICE([-----------------------------------------------------------------------------])
AC_MSG_NOTICE([If you have GCC, but these fail, look for a 'gcc-multilib' package])
CFLAGS='-march=i486 -m32'
AC_CHECK_HEADERS([stdint.h sys/io.h],,[AC_MSG_ERROR([Could not find libc headers])])
diff --git a/flash_lenovobios_stage1 b/flash_lenovobios_stage1
index 0a7a575..adc471b 100755
--- a/flash_lenovobios_stage1
+++ b/flash_lenovobios_stage1
@@ -33,7 +33,7 @@ else
echo "This script must be run on an i686 or x86_64 host. x86_64 is recommended."
exit 1
fi
-if [ -f "DEBLOB" ]; then
+if [ ! -f ".binarchive" ]; then
# In a src archive or git
arch=.
fi
diff --git a/flash_lenovobios_stage2 b/flash_lenovobios_stage2
index 9b17da1..e2be7e4 100755
--- a/flash_lenovobios_stage2
+++ b/flash_lenovobios_stage2
@@ -33,7 +33,7 @@ else
echo "This script must be run on an i686 or x86_64 host. x86_64 is recommended."
exit 1
fi
-if [ -f "DEBLOB" ]; then
+if [ ! -f ".binarchive" ]; then
# In a src archive or git
arch=.
fi
diff --git a/flash_libreboot6 b/flash_libreboot6
index 29da4f5..8e371e8 100755
--- a/flash_libreboot6
+++ b/flash_libreboot6
@@ -33,7 +33,7 @@ else
echo "This script must be run on an i686 or x86_64 host. x86_64 is recommended."
exit 1
fi
-if [ -f "DEBLOB" ]; then
+if [ ! -f ".binarchive" ]; then
# In a src archive or git
arch=.
fi
diff --git a/flash_macbook21applebios b/flash_macbook21applebios
index 21fdaa2..7b55ce4 100755
--- a/flash_macbook21applebios
+++ b/flash_macbook21applebios
@@ -33,7 +33,7 @@ else
echo "This script must be run on an i686 or x86_64 host. x86_64 is recommended."
exit 1
fi
-if [ -f "DEBLOB" ]; then
+if [ ! -f ".binarchive" ]; then
# In a src archive or git
arch=.
fi
diff --git a/flash_x60_libreboot5 b/flash_x60_libreboot5
index 85616ae..86096c3 100755
--- a/flash_x60_libreboot5
+++ b/flash_x60_libreboot5
@@ -33,7 +33,7 @@ else
echo "This script must be run on an i686 or x86_64 host. x86_64 is recommended."
exit 1
fi
-if [ -f "DEBLOB" ]; then
+if [ ! -f ".binarchive" ]; then
# In a src archive or git
arch=.
fi
diff --git a/get b/get
deleted file mode 100755
index c8cdd77..0000000
--- a/get
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/bash
-
-pkg=$1
-
-pkgbuild="$(mktemp --tmpdir libreboot.XXXXXXXXXX)"
-makepkg_conf="$(mktemp --tmpdir libreboot.XXXXXXXXXX)"
-trap "rm -f -- $(printf -- '%q ' "$pkgbuild" "$makepkg_conf")" EXIT
-
-get() {
- pkg="$1"
- {
- # Bogus stuff to keep makepkg happy
- printf 'pkgname=%q\n' "$pkg"
- printf 'pkgver=libreboot\n'
- printf 'pkgrel=1\n'
- printf 'arch=(any)\n'
- printf 'package() { :; }\n'
- printf 'md5sums=(SKIP)\n'
- # Actual stuff we care about
- printf 'source=("${%s_source}")\n' "$pkg"
- printf 'if type %s_mksource &>/dev/null; then\n' "$pkg"
- printf 'prepare() { resources=%q; %s_mksource; }\n' "$PWD/resources" "$pkg"
- printf 'fi\n'
- } | cat source-locations.sh - > "$pkgbuild"
-
- makepkg -o -p "$pkgbuild" --config "$makepkg_conf"
-}
-
-main() {
- {
- printf -- '%s\n' \
- "DLAGENTS=('ftp::/usr/bin/curl -fC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'" \
- " 'http::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'" \
- " 'https::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'" \
- " 'rsync::/usr/bin/rsync --no-motd -z %u %o'" \
- " 'scp::/usr/bin/scp -C %u %o')"
- printf 'BUILDENV=(fakeroot color)\n'
- printf 'SRCDEST=%q\n' "$PWD/src/downloads"
- } > "$makepkg_conf"
- mkdir -p -- "$PWD/src/downloads"
- for pkg in "$@"; do
- get "$pkg"
- done
-}
-
-main "$@"
diff --git a/grub-mkstandalone.mk b/grub-mkstandalone.mk
deleted file mode 100644
index ef03eb1..0000000
--- a/grub-mkstandalone.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-include resources/utilities/grub-assemble/modules.conf
-
-grub_txtmode_memdisk_grafts = /memtest=src/memtest86/memtest /invaders.exec=src/grubinvaders/invaders.exec
-grub_txtmode_memdisk_deps = src/memtest86/memtest src/grubinvaders/invaders.exec
-
-grub_vesafb_memdisk_grafts = /background.jpg=resources/grub/background/background.jpg /dejavusansmono.pf2=resources/grub/font/dejavusansmono.pf2
-grub_vesafb_memdisk_deps = resources/grub/background/background.jpg resources/grub/font/dejavusansmono.pf2
-
-# A rule-variable is used here to avoid needing .SECONDEXPANSION
-define rule_grub_elf
-tmp/grub_$(romtype).elf: \
- tmp/builddeps-grub.stamp \
- $(keymapdir)/list.mk resources/utilities/grub-assemble/modules.conf \
- resources/grub/config/grub_memdisk.cfg \
- $(grub_$(romtype)_memdisk_deps) \
- $(firstword $(GRUB_MKSTANDALONE)) \
- $(foreach k,$(keymaps),$(keymapdir)/$k.gkb)
- $(GRUB_MKSTANDALONE) -o $@ -O i386-coreboot \
- --fonts= --themes= --locales= \
- --modules='$(grub_modules)' \
- --install-modules='$(grub_install_modules)' \
- /boot/grub/grub.cfg="resources/grub/config/grub_memdisk.cfg" \
- $(grub_$(romtype)_memdisk_grafts) \
- $(foreach k,$(keymaps),/boot/grub/layouts/$k.gkb=$(keymapdir)/$k.gkb)
- test -e $@
-endef
-$(eval $(call loop_rule,grub_elf,romtype))
diff --git a/modules.mk b/modules.mk
deleted file mode 100644
index 6dc2686..0000000
--- a/modules.mk
+++ /dev/null
@@ -1,110 +0,0 @@
-modules = \
- coreboot \
- grub \
- memtest86 \
- bucts \
- flashrom \
- seabios \
- grubinvaders \
- dejavu \
- i945pwm
-# powertop only needs to be used when running './powertop.trisquel6'
-all_modules = $(modules) powertop
-
-# Easy names for src/% and tmp/builddeps-%.stamp
-$(addprefix get,$(all_modules)): get%: PHONY src/%
-$(addprefix builddeps-,$(all_modules)): builddeps-%: PHONY tmp/builddeps-%.stamp
-
-# The "all" rules
-getall: $(addprefix src/,$(modules))
-builddeps: $(addprefix builddeps-,$(modules))
-cleandeps: $(addprefix cleandeps-,$(all_modules))
- rm -rf bin/* tmp/*
-
-# If we depend on a file in src/*/*, we should generate it by calling
-# the builddep rule.
-$(foreach module,$(all_modules),$(eval src/$(module)/%: | tmp/builddeps-$(module).stamp; test -e $$@))
-
-
-# The generic rules
-
-# "get" rules
-$(addprefix src/,$(all_modules)): \
-src/%: get source-locations.sh
- ./get $*
- test -e $@
- touch $@
-
-# "builddeps" rules
-tmp/builddeps-%.stamp: src/%
- $(MAKE) -C $<
- touch $@
-
-# "cleandeps" rules
-$(addprefix cleandeps-,$(all_modules)): \
-cleandeps-%: PHONY cleandeps-%-custom
- rm -f tmp/builddeps-%.stamp
-cleandeps-%-custom: PHONY
- test ! -f src/$*/Makefile || $(MAKE) -C src/$* clean
-
-
-# The overrides
-
-$(addprefix src/coreboot/util/,cbfstool nvramtool crossgcc): \
-src/coreboot/util/%: | src/coreboot
- test -d $@
-tmp/builddeps-coreboot.stamp:: \
- tmp/builddeps-coreboot-cbfstool.stamp \
- tmp/builddeps-coreboot-nvramtool.stamp \
- tmp/builddeps-coreboot-crossgcc.stamp
- touch $@
-tmp/builddeps-coreboot-cbfstool.stamp:: src/coreboot/util/cbfstool
- $(MAKE) -C $<
- touch $@
-tmp/builddeps-coreboot-nvramtool.stamp:: src/coreboot/util/nvramtool
- $(MAKE) -C $<
- touch $@
-tmp/builddeps-coreboot-crossgcc.stamp:: src/coreboot/util/crossgcc
- $(MAKE) -C src/coreboot crossgcc-i386
- touch $@
-cleandeps-coreboot-custom:: PHONY
- test ! -f src/coreboot/Makefile || $(MAKE) -C src/coreboot clean
- test ! -f src/coreboot/Makefile || $(MAKE) -C src/coreboot/util/cbfstool clean
- test ! -f src/coreboot/Makefile || $(MAKE) -C src/coreboot/util/nvramtool clean
- test ! -f src/coreboot/Makefile || $(MAKE) -C src/coreboot crossgcc-clean
- rm -f tmp/builddeps-coreboot-*.stamp
-
-tmp/builddeps-flashrom.stamp:: src/flashrom
- $(MAKE) -C $< patchname=_normal
- $(MAKE) -C $< patchname=_lenovobios_macronix
- $(MAKE) -C $< patchname=_lenovobios_sst
- touch $@
-
-tmp/builddeps-grub.stamp:: src/grub
- cd $< && { test -x ./configure || ./autogen.sh; }
- cd $< && { test -f ./Makefile || ./configure --with-platform=coreboot; }
- $(MAKE) -C $<
- touch $@
-
-tmp/builddeps-powertop.stamp:: src/powertop
- cd $< && { text -x ./configure || ./autogen.sh; }
- cd $< && { test -f ./Makefile || ./configure; }
- $(MAKE) -C $<
- touch $@
-
-tmp/builddeps-grubinvaders.stamp:: src/grubinvaders
- cd $< && ./compile.sh
- touch $@
-cleandeps-grubinvaders-custom:: PHONY
- test ! -d src/grubinvaders || { cd src/grubinvaders && ./clean.sh; }
-
-tmp/builddeps-seabios.stamp:: src/seabios resources/seabios/config/config
- cp resources/seabios/config/config $</.config
- $(MAKE) -C $<
- touch $@
-
-tmp/builddeps-dejavu.stamp:: src/dejavu ; touch $@
-cleandeps-dejavu-custom:: PHONY ;
-
-cleandeps-i945pwm-custom:: PHONY
- rm -f src/i945pwm/i945-pwm
diff --git a/bin/.gitignore b/roms/.gitignore
index 78d9101..78d9101 100644
--- a/bin/.gitignore
+++ b/roms/.gitignore
diff --git a/source-locations.sh b/source-locations.sh
deleted file mode 100644
index e4bbb20..0000000
--- a/source-locations.sh
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/bash # not executable, but as a hint to text editors
-
-bucts_source='git://git.stuge.se/bucts.git#commit=dc27919d7a66a6e8685ce07c71aefa4f03ef7c07'
-
-coreboot_source='git+http://review.coreboot.org/coreboot#commit=c637a887dde1c63bf3863e70cbe19dedf5f6ca02'
-coreboot_mksource() {
- cd "$srcdir"/coreboot
- # Get patches from review.coreboot.org
- patches=(
- # Text mode patch for X60 native graphics (main patch already merged in coreboot. See 6723 on coreboot gerrit)
- refs/changes/25/6725/3
- # lenovo/x60: Enable legacy brightness controls (native graphics)
- refs/changes/48/7048/4
- # Enable T60 native graphics
- refs/changes/45/5345/9
- # Enable text-mode graphics for T60
- refs/changes/50/7050/2
- # lenovo/t60: Enable legacy brightness controls (native graphics)
- refs/changes/51/7051/1
- # ec/lenovo/h8: permanently enable wifi/trackpoint/touchpad/bluetooth/wwan
- refs/changes/58/7058/7
- # i945: permanently set tft_brightness to 0xff. this fixes the issue with X60 and "scrolling" backlight
- refs/changes/61/7561/2
- # Note: macbook21 already has backlight control.
- )
- for patch in "${patches[@]}"; do
- git fetch http://review.coreboot.org/coreboot "$patch"
- git cherry-pick FETCH_HEAD
- done
- # Deblob coreboot
- "$resources"/coreboot/patch/DEBLOB
-}
-
-flashrom_source='flashrom::svn://flashrom.org/flashrom/trunk#revision=1854'
-flashrom_mksource() {
- cd "$srcdir"/flashrom
- cp "$resources"/flashrom/patch/flashchips_*.c .
- sed -i \
- -e 's/^CFLAGS\s*?=.*/& -static/' \
- -e 's/\$(PROGRAM)\$(EXEC_SUFFIX)/$(PROGRAM)$(patchname)$(EXEC_SUFFIX)/g' \
- -e 's/flashchips\.o/flashchips$(patchname).o/g' \
- -e 's/libflashrom\.a/libflashrom$(patchname).a/g' \
- -e 's/\(rm .*libflashrom\)\S*\.a/\1*.a $(PROGRAM)_*/' \
- Makefile
-}
-
-grub_source='git://git.savannah.gnu.org/grub.git#commit=e2dd6daa8c33e3e7641e442dc269fcca479c6fda'
-grub_mksource() {
- cd "$srcdir"/grub
- git apply "$resources"/grub/patch/gitdiff
-}
-
-memtest86_source='http://www.memtest.org/download/5.01/memtest86+-5.01.tar.gz'
-memtest86_mksource() {
- rm -rf "$srcdir"/memtest86
- mv "$srcdir"/memtest86{+-5.01,}
- cd "$srcdir"/memtest86
- cp -f "$resources"/memtest86/patch/config.h ./config.h
- cp -f "$resources"/memtest86/patch/Makefile ./Makefile
-}
-
-seabios_source='git://git.seabios.org/seabios.git#commit=9f505f715793d99235bd6b4afb2ca7b96ba5729b'
-
-grubinvaders_source='http://www.erikyyy.de/invaders/invaders-1.0.0.tar.gz'
-grubinvaders_mksource() {
- rm -rf "$srcdir"/grubinvaders
- mv "$srcdir"/{,grub}invaders
- cd "$srcdir"/grubinvaders
- # Apply patch mentioned on http://www.coreboot.org/GRUB_invaders
- patch < "$resources"/grubinvaders/patch/diff.patch
- patch compile.sh < "$resources"/grubinvaders/patch/compile.sh.patch
-}
-
-i945pwm_source='i945pwm::git://git.mtjm.eu/i945-pwm.git#commit=d88c8b290b9473e071d24cd3b97f4a091ee398cf'
-
-dejavu_source='http://sourceforge.net/projects/dejavu/files/dejavu/2.34/dejavu-fonts-ttf-2.34.tar.bz2'
-dejavu_mksource() {
- rm -rf "$srcdir"/dejavu
- mv "$srcdir"/dejavu{-fonts-ttf-2.34,}
-}
-
-# this version of powertop is just for Trisquel 6 users
-powertop_source='git+https://github.com/fenrus75/powertop.git#e70c89eb5d7b6b8f898bb126adefcbf3202d5acf'