summaryrefslogtreecommitdiffstats
path: root/getcb
blob: 57c38c63361333a39302192d78d267981263563f (plain)
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
#!/bin/bash

#  getcb script: downloads coreboot and patches/deblobs it
#
#	Copyright (C) 2014 Francis Rowe
#
#    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 grabs current base used, and applies patches
# This is also used to run deblob scripts.

# (the idea is that this script will reproduce the coreboot directory included with this version of libreboot)

# You need the dependencies from ./builddeb to use this script.

#
# The deblobbing target (coreboot git revision) for coreboot-libre is
# the following commit in the coreboot git repository named "master":
#
# commit 63acd22dc5366c72a7165138f5030df9523824dc
# Author: Vladimir Serbinenko <phcoder@gmail.com>
# Date:   Sun Jun 1 00:26:48 2014 +0200
# 
#     lenovo: Make version look like something thinkpad_acpi would accept
#     
#     thinkpad_acpi checks that BIOS version matches some pattern.
#     Report version in this form.
#     
#     Not cleaned up as the idea of this patch seems to be met with resistance.
#     Can make it Thinkpad-specific if the idea is accepted.
#     
#     Change-Id: I15e33e87e7a7f42d6a06f12fb39b5172153af8a1
#     Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
#     Reviewed-on: http://review.coreboot.org/4650
#     Tested-by: build bot (Jenkins)
#     Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
#

#
# We do not need to do a "git reset --hard 63acd22dc5366c72a7165138f5030df9523824dc" here
# because 5324/9 checkout (see below) eventually goes down to dependency 5320/9
# which is checked out on top of 63acd22dc5366c72a7165138f5030df9523824dc
#

#
# Use "git log" in coreboot after this is done, to see what was done.
# Also use "git diff" to see uncommited changes (after the patch was applied by this script)
#

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

echo "DOWNLOADING AND PATCHING COREBOOT"

rm -rf coreboot

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

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

# there are modifications required
cd coreboot

# Get patches for "native graphics initialization" on X60 and T60
# ----------------------------------------------------------------------------------

# CHECKOUT (the XXXX/Y numbers are gerrit/git):
# Checks out the following from the gerrit site at http://review.coreboot.org/
# 5324/9 review.coreboot.org (not merged in cb master on day 20140630) - apple/macbook21: Fix audio.
# 5323/9 review.coreboot.org (not merged in cb master on day 20140630) - apple/macbook21: EC handline ACPI implementation.
# 5321/14 review.coreboot.org (not merged in cb master on day 20140630) - A new port apple/macbook21. (new macbook21 port + native graphics)
# 5320/9 review.coreboot.org (not merged in cb master on day 20140630) - i945: Replace video gfx init. (X60 native graphics)
# 5320/9 is the end (locically). It's dependency 4650/29 was merged since day 20140601 (and included already in this libreboot tree, even).
# 4650/29 (merged in cb master on 20140601) - lenovo: Make version look like something thinkpad_acpi would accept
git fetch http://review.coreboot.org/coreboot refs/changes/24/5324/9 && git checkout FETCH_HEAD
 
# CHERRY PICK (the XXXX/Y numbers are gerrit/git):
# Cherry picks the following from the gerrit site at http://review.coreboot.org/
# 5345/4 review.coreboot.org (not merged in cb master on day 20140630) - lenovo/t60: Enable native intel gfx init.
# 5345//4 is the end (logically). It's dependency 5344/4, or rather 5344/5 was merged in cb master on 20140601 (and included in this libreboot tree, even)
# Note: 5345/4 is based on the older 5344/4 before the merge so isn't rebased at the time of writing.
git fetch http://review.coreboot.org/coreboot refs/changes/45/5345/4 && git cherry-pick FETCH_HEAD

# Apply necessary patches
# ---------------------------------------------------------------------------------

mkdir src/drivers/lenovo

touch src/drivers/lenovo/Kconfig
touch src/drivers/lenovo/Makefile.inc
touch src/drivers/lenovo/lenovo.h
touch src/drivers/lenovo/wacom.c

git add src/drivers/lenovo

# The above 4 files were all that were added on those changesets (5243/17, 5242/17 and 5239/19 from review.coreboot.org)
# I create empty versions of the files, and add them using "git add"
# Now I add the content to those files and all other changes, they will show up in a "git diff" which 
# was used to create the "gitdiff" file used below. This is also required for applying the gitdiff.

# THE ABOVE IS A HACK. "git add -N" I'm told can do the same thing as above, but that older versions of git do not have this.

# The changes below are in a patch at resources/libreboot/patch/gitdiff
# These were merged manually.
# Reason for manual merge: cherry pick wouldn't work with this branch. Didn't want to rebase just to scrap it later. Manual was easier.
# Also, some of the changes were for different code (eg the 3D fix was previously for the old native graphics code, not the new one).

# apply fix for 3D on kernel 3.12+ for X60/T60 on the new native graphics code (5320/9), 
# based on manually merging 5927/11 and 5932/5 (which fix the 3D on kernel 3.12+ on X60 for the *old* replay code) from review.coreboot.org
# apply fix for backlight controls for T60 and X60, based on docs/i945_backlight.html
# apply fix for IR/digitizer on X60/T60 and X60 Tablet (respectively), based on manually merging 5243/17, 5242/17 and 5239/19 from review.coreboot.org
# (see notes above)

# copy the gitdiff into coreboot directory
cp ../resources/libreboot/patch/gitdiff .

# apply it!
git apply gitdiff

# remove the copy (not needed anymore)
rm -rf gitdiff

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

# Apply coreboot-libre deblob script for coreboot git revision 63acd22dc5366c72a7165138f5030df9523824dc
# TODO: implement this.

# Deblobbing was done manually for this pre-release (will re-tool linux-libre deblob scripts later):
cd ../
echo "deblobbing coreboot"
./DEBLOB
echo "finished deblobbing coreboot"

# we're done
echo "FINISHED DOWNLOADING AND PATCHING COREBOOT"

# ------------------- DONE ----------------------