aboutsummaryrefslogtreecommitdiff
path: root/resources/scripts/helpers/download/coreboot
blob: e166fba8c62c7620e1d4c0b78820a0ce8a368cb2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#!/bin/bash

#  helper script: downloads coreboot and patches/deblobs it
#
#	Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
#
#    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/>.
#

# This script assumes that the working directory is the
# root of libreboot_src or libreboot git.

[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e

printf "Downloading coreboot, patching coreboot and deblobbing coreboot\n"

# This grabs current base used, and applies patches
# This is also used to run the deblob scripts.

# Remove the old version that may exist
# ------------------------------------------------------------------------------

rm -Rf "coreboot/"

# Get latest coreboot:
# ------------------------------------------------------------------------------

# download it using git
git clone http://review.coreboot.org/coreboot

# there are modifications required
cd "coreboot/"

# reset to previously tested revision
git reset --hard a2bed346a1a45c822bc255e90a0bf6a6ae1d1d50

# vboot submodule is needed
git submodule update --init --checkout -- 3rdparty/vboot/

# there are modifications required
cd "3rdparty/vboot/"

git reset --hard 82db93d5fc924860e4f1fb4cf24f29b5b335a480

# Patch vboot
# ------------------------------------------------------------------------------

printf "firmware: Developer mode timeout delay shortening (down to 3 seconds)\n"
git am "../../../resources/libreboot/patch/vboot/0001-firmware-Developer-mode-timeout-delay-shortening-dow.patch"

printf "firmware: Text-based screen display in priority\n"
git am "../../../resources/libreboot/patch/vboot/0002-firmware-Text-based-screen-display-in-priority.patch"

printf "firmware: NV context pointer handoff to VbExDisplayScreen\n"
git am "../../../resources/libreboot/patch/vboot/0003-firmware-NV-context-pointer-handoff-to-VbExDisplaySc.patch"

printf "firmware: Hold key combination in developer mode\n"
git am "../../../resources/libreboot/patch/vboot/0004-firmware-Hold-key-combination-in-developer-mode.patch"

printf "firmware: Screen blank and wait at disabled USB boot warning\n"
git am "../../../resources/libreboot/patch/vboot/0005-firmware-Screen-blank-and-wait-at-disabled-USB-boot-.patch"

printf "firmware: Separate screen and wait at device information screen\n"
git am "../../../resources/libreboot/patch/vboot/0006-firmware-Separate-screen-and-wait-at-device-informat.patch"

printf "firmware: Localization keys removal\n"
git am "../../../resources/libreboot/patch/vboot/0007-firmware-Localization-keys-removal.patch"

# leave the vboot tree
cd "../../"


# Get patches from review.coreboot.org
# ------------------------------------------------------------------------------

# ----

# check on coreboot mailing list (see "favourites" in mail client):
# [coreboot] macbook21: broken by 10385 (Make DSDT a file in CBFS rather than embedding it into ramstage.)
# -- probably affects the X60 and T60 as well, if this is not already fixed.
# seems to be related to normal/fallback payload mechanism

# KEEP ON EYE ON:
# http://review.coreboot.org/#/c/7549

# ----

# Had issues building with. This patch isn't even used, anyway.
# printf "southbridge/intel/common/spi: Add Flash lockdown option\n"
# git fetch http://review.coreboot.org/coreboot refs/changes/70/9370/4 && git cherry-pick FETCH_HEAD
# git am "../resources/libreboot/patch/0001-southbridge-intel-common-spi-Add-Flash-lockdown-opti.patch"

# This patch doesn't actually work...
# printf "mainboards/lenovo/t400: Enable serial debug option for use with dock\n"
# printf "NOTE: doesn't actually work at the moment. see docs/tasks.html\n"
# printf "Only including so that .config doesn't have to change\n"
# git fetch http://review.coreboot.org/coreboot refs/changes/17/9317/13 && git cherry-pick FETCH_HEAD
# git am "../resources/libreboot/patch/0002-mainboards-lenovo-t400-Enable-serial-debug-option-fo.patch"

printf "mainboard/lenovo/t400: Add initial hybrid graphics support\n"
# git fetch http://review.coreboot.org/coreboot refs/changes/19/9319/18 && git cherry-pick FETCH_HEAD
git am "../resources/libreboot/patch/0002-mainboard-lenovo-t400-Add-initial-hybrid-graphics-su.patch"

# not included, but keep an eye on it:
# printf "mainboard/lenovo/t400: Increase backlight frequency to reduce flicker\n"
# git fetch http://review.coreboot.org/coreboot refs/changes/31/9331/14 && git cherry-pick FETCH_HEAD

printf "NOTFORMERGE: lenovo/t400: hard-code enable integrated-only video\n"
# git fetch http://review.coreboot.org/coreboot refs/changes/50/10550/1 && git cherry-pick FETCH_HEAD
git am "../resources/libreboot/patch/0003-NOTFORMERGE-lenovo-t400-hard-code-enable-integrated-.patch"

# ----

printf "lenovo/x60: use correct BLC_PWM_CTL value\n"
# git fetch http://review.coreboot.org/coreboot refs/changes/24/10624/1 && git cherry-pick FETCH_HEAD
git am "../resources/libreboot/patch/0004-lenovo-x60-use-correct-BLC_PWM_CTL-value.patch"

printf "Enable T60 native graphics\n"
# git fetch http://review.coreboot.org/coreboot refs/changes/45/5345/10 && git cherry-pick FETCH_HEAD
git am "../resources/libreboot/patch/0005-lenovo-t60-Enable-native-intel-gfx-init.patch"

printf "lenovo/t60: Enable VESA framebuffer mode (native graphics)\n"
# git fetch http://review.coreboot.org/coreboot refs/changes/51/10551/1 && git cherry-pick FETCH_HEAD
git am "../resources/libreboot/patch/0006-lenovo-t60-Enable-VESA-framebuffer-mode-native-graph.patch"

printf "lenovo/t60: Enable brightness controls (native graphics)\n"
# git fetch http://review.coreboot.org/coreboot refs/changes/52/10552/1 && git cherry-pick FETCH_HEAD
git am "../resources/libreboot/patch/0007-lenovo-t60-Enable-brightness-controls-native-graphic.patch"

printf "ec/lenovo/h8: permanently enable wifi/trackpoint/touchpad/bluetooth/wwan\n"
# git fetch http://review.coreboot.org/coreboot refs/changes/58/7058/9 && git cherry-pick FETCH_HEAD
git am "../resources/libreboot/patch/0008-NOTFORMERGE-ec-lenovo-h8-wlan-trackpoint-touchpad-bl.patch"

# printf "i945: permanently set tft_brightness to 0xff. this fixes the issue with X60 and 'scrolling' backlight\n"
# git fetch http://review.coreboot.org/coreboot refs/changes/61/7561/2 && git cherry-pick FETCH_HEAD
# The patch was accidentally merged in coreboot. See 
# http://review.coreboot.org/#/c/8697/ for the revert commit. rebase 7561 and re-include it in
# libreboot, once 8697 is merged in coreboot.

printf "northbridge/gm45/raminit.c: enable GS45 high-perf (i.e. add X200S support to libreboot)\n"
# git fetch http://review.coreboot.org/coreboot refs/changes/86/7786/11 && git cherry-pick FETCH_HEAD
git am "../resources/libreboot/patch/0009-northbridge-gm45-raminit.c-enable-GS45-high-performa.patch"
# NOTE: 7786 is abandoned. See: http://review.coreboot.org/#/c/11135/ <-- that's the new one

printf "fix uneven backlight on X200 (when setting brightness low)\n"
# git fetch http://review.coreboot.org/coreboot refs/changes/79/7979/2 && git cherry-pick FETCH_HEAD
git am "../resources/libreboot/patch/0010-gm45-fix-uneven-backlight-native-gfx-init.patch"

printf "ThinkPad R400 support (clone of the T400)\n"
# git fetch http://review.coreboot.org/coreboot refs/changes/93/8393/5 && git cherry-pick FETCH_HEAD
git am "../resources/libreboot/patch/0011-lenovo-r400-Add-clone-of-Lenovo-T400.patch"

printf "ThinkPad T500 (depends on T400 patch)\n"
# git fetch http://review.coreboot.org/coreboot refs/changes/45/10545/1 && git cherry-pick FETCH_HEAD
git am "../resources/libreboot/patch/0012-lenovo-t500-Add-clone-of-Lenovo-T400.patch"

# Misc:

printf "ec/lenovo/h8: re-factor handling of power_management_beeps\n"
# git fetch http://review.coreboot.org/coreboot refs/changes/31/10531/8 && git cherry-pick FETCH_HEAD
git am "../resources/libreboot/patch/0013-ec-lenovo-h8-re-factor-handling-of-power_management_.patch"

# Chromebook:

printf "armv7: Word-sized/half-word-sized memory operations for 32/16 bit read/write\n"
# git fetch http://review.coreboot.org/coreboot refs/changes/98/11698/6 && git cherry-pick FETCH_HEAD
git am "../resources/libreboot/patch/chromebook/0001-armv7-Word-sized-half-word-sized-memory-operations-f.patch"

printf "chromeos: Allow disabling vboot firmware verification when ChromeOS is enabled\n"
git am "../resources/libreboot/patch/chromebook/0002-chromeos-Allow-disabling-vboot-firmware-verification.patch"

# Run coreboot-libre deblob scripts
# ------------------------------------------------------------------------------

printf "Deleting .git* in coreboot/ (history inside .git contains the blobs that were deleted)\n"
rm -Rf ".git/"
rm -f ".gitreview"
rm -f ".gitmodules"
rm -f ".gitignore"

rm -Rf 3rdparty/*/.git*

cd "../"

printf "Deblobbing coreboot\n"
./resources/utilities/coreboot-libre/deblob

if [ -f "version" ]; then
	# _src release archive is being used
	version="libreboot-$(cat version)"
else
	# git repo is being used
	version="libreboot-$(git describe --tags HEAD)"
fi
printf '%s\n' "${version}" >"coreboot/.coreboot-version"

printf "\n\n"