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 | How To Bisect Upstream Kernel on Ubuntu
---------------------------------------
1. Start by using pre-built upstream kernels from kernel-ppa.
2. Get the build tools repo:
git clone git://kernel.ubuntu.com/ubuntu/kteam-tools.git
3. Determine which chroots you need.
After you found two consecutive kernels which you want to bisect between, look at the last part of the name. It will be a Ubuntu release codename, for example:
v3.17-utopic
v3.18-rc1-utopic
This means you want to build the kernel with the utopic toolchain, but for that you do not use a utopic chroot. You have to look at the source of the build tool to find out what you actually need:
cd ~/kteam-tools/mainline-build
less mainline-build-one
You will see something like this:
# We cannot use the previous LTS as we are tied somewhat to compiler
# versions and features in later releases.
case "$series" in
hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy)
build_release="precise" ;;
trusty|utopic)
build_release="trusty" ;;
unstable)
build_release="yakkety" ;;
*)
build_release="$series" ;;
esac
This basically says:
For hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy use a precise chroot.
For trusty|utopic use a trusty chroot.
For unstable use yakkety.
For anything else use whatever the user specified.
So in my case I want to build for utopic so I need trusty chroots.
4. Hack build script to prevent building of kernels that we don't care about.
cd ~/kteam-tools/mainline-build
nano -w mainline-build-one
Find the section similar to this:
# Arches to build
case "$series" in
hardy|lucid) arches="amd64 i386" ;;
maverick|natty|oneiric) arches="amd64 i386 armel" ;;
precise|quantal) arches="amd64 i386 armel armhf" ;;
raring|saucy) arches="amd64 i386 armhf" ;;
trusty|utopic|vivid|wily) arches="amd64" ;;
*) arches="amd64 i386 armhf ppc64el s390x" ;;
esac
Delete all references to arches that you don't want. For example, I have changed the line above for utopic to contain only "amd64" because I only want a 64 bit kernel.
5. Install schroot and create required chroots.
You need a chroot of the arch you are building for, plus also a chroot for i386 regardless. This step takes very long, because you are essentially downloading and installing Ubuntu twice. If the release you need a chroot for is no longer supported you must change the URL to http://old-releases.ubuntu.com/ubuntu
sudo apt-get install schroot
sudo gpasswd -a <your user> sbuild
sudo mkdir -p /usr3/chroots
cd ~/kteam-tools/chroot-setup
./make_chroot trusty amd64 http://archive.ubuntu.com/ubuntu
./make_chroot trusty i386 http://archive.ubuntu.com/ubuntu
After this step you need to log out and log in again so that your user is correctly added to the new group.
6. Clone Linux kernel source:
First, upstream source:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
cd linux-stable
Now add Ubuntu specific source for your release. This is the ACTUAL release, not the build chroot release, so in my case Utopic.
git remote add utopic git://kernel.ubuntu.com/ubuntu-archive/ubuntu-utopic.git
git fetch utopic
NOTE: As above, the URL is different for unsupported releases. Utopic is no longer supported so the URL contains "ubuntu-archive" instead of "ubuntu". For a supported release the URL would be like this:
git remote add utopic git://kernel.ubuntu.com/ubuntu/ubuntu-<RELEASE>.git
7. Begin bisect:
git bisect start
git bisect good v3.17
git bisect bad v3.18-rc1
8. Build a kernel
The above commands will print out a commit ID like this:
[35a9ad8af0bb0fa3525e6d0d20e32551d226f38e] Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Build that commit. First add the tools to your path:
export PATH=~/kteam-tools/mainline-build:$PATH
Now build the kernel:
mainline-build-one 35a9ad8af0bb0fa3525e6d0d20e32551d226f38e utopic 031701+35a9ad
The final parameter here is optional and you can set it to pretty much anything you want. It is the abinum of the resulting kernel. If you don't specify this it will be based on the kernel version. When bisecting between two consecutive kernel releases it won't change. For example, for 3.17 to 3.18-rc1 it will always be 031700. This means each kernel you build will install over the previous one. This isnt very useful, it's easy to mix them up. So I increment the abinum by 1 and then append the first 6 chars of the commit ID.
9. Test the kernel and then tell git if it's good or bad.
git bisect <good|bad> <commit>
If you look at the commit log after building you will see that head was moved from the commit you were bisecting by the build scripts. They add three commits on top of the tree each time you build. This can confuse git bisect if you try to do "git bisect <good|bad>" without specifying a commit. So instead tell it directly by specifying the commit ID you built from originally.
|