Skip to content

Commit c5db9ed

Browse files
authored
Merge pull request #14 from StaticRocket/readme
Readme: Updates for grammar and markdown styling etc.
2 parents 5df9db2 + 8083a1c commit c5db9ed

File tree

2 files changed

+128
-112
lines changed

2 files changed

+128
-112
lines changed

Dockerbuild.md

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,61 @@
11
Introduction
22
============
33

4-
Many times we need to build quite a bunch of applications to get the very latest
5-
tools and environment. So, instead of hand holding every developer to get
6-
the latest environment, provide a Docker environment to build things up
7-
from scratch for the environment setup.
4+
Quite often we need to build quite a bunch of applications to get the very
5+
latest tools and environment. Instead of hand holding every developer to get the
6+
latest environment, let's use Docker to bootstrap a common build environment.
87

9-
Proxy Setup Step
10-
================
8+
Proxy setup
9+
===========
1110

12-
If you are working in an environment, where http proxy is necessary,
13-
update the files in proxy-configuration to match up with what your
14-
environment needs are With out this, ofocourse, you cannot install the
15-
various packages needed to build up the docker image
11+
If you are working in an environment where an http proxy is necessary, update
12+
the files in `proxy-configuration` as required. With out this, you cannot
13+
install the various packages needed to build the Docker image.
1614

1715
Versions of packages
1816
====================
1917

20-
Update the script build-env.sh to pick up the various latest tags and
21-
versions of the apps needed
18+
Update the script `build-env.sh` to pick up the various latest tags and versions
19+
of the app as needed.
2220

23-
Choose if you are going to local toolchain
24-
==========================================
21+
Using a local toolchain
22+
=======================
2523

26-
ARM Toolchain installs can be big.. 2.8G or so.., I do provide an
27-
option to build with docker image having the tool chain installed
28-
(downloaded from ARM's site), I would recommend doing it locally and
29-
pointing kpv to that folder (I have assumed you have all compilers
30-
available in /opt/cross-gcc-linux-9/bin - customize as desired).
24+
I do provide an option to build a Docker image with tool chain installed
25+
(downloaded from ARM's site), but ARM Toolchain installs can be big (2.8G or
26+
so). Because of this, I would recommend installing them on the host, mounting
27+
the install as a volume, and pointing kpv to that folder. I have assumed you
28+
have all compilers available in `/opt/cross-gcc-linux-9/bin` - customize as
29+
desired.
3130

3231
Building the docker image
3332
=========================
3433

35-
Dependency to build docker is:
36-
* docker.io
37-
* proxy settings for docker to pull in required images
34+
The dependencies to build docker are:
35+
* `docker` or `docker.io` on Debian/Ubuntu
36+
* Proxy settings for docker to pull in required images (if you are behind a
37+
proxy)
3838

39-
make takes the following override variables:
40-
* INSTALL_GCC (0 is default - aka, wont install gcc, you can pick 1, where it downloads gcc)
41-
* USER_ID (takes the current user's uid for the docker environment, you can override this if desired)
42-
* REPO (if you have your own Docker registry, you can use this along with the make deploy rule)
39+
The image Makefile takes the following override variables:
40+
* `INSTALL_GCC` : 0 is default - aka, wont install gcc, you can pick 1, where it
41+
downloads gcc
42+
* `USER_ID` : takes the current user's uid for the docker environment, you can
43+
override this if desired
44+
* `REPO` : if you have your own Docker registry, you can use this along with the
45+
make deploy rule
4346

4447
Build commands:
45-
* make : build image arm-kernel-dev
46-
* make clean : I strongly recommend NOT to use my version if you have other docker images running in your system.
47-
* make deploy REPO=xyz : Deploy image to an docker registry
48+
* `make` : build image arm-kernel-dev
49+
* `make clean` : I strongly recommend NOT to use my version if you have other
50+
docker images running in your system.
51+
* `make deploy REPO=xyz` : Deploy image to an docker registry
4852

49-
Using the Docker image with kernel_patch_verify
50-
===============================================
53+
Using the Docker image with `kernel_patch_verify`
54+
=================================================
5155

52-
Use the script `kpv` packaged here just like you would use kernel_patch_verify on your local PC
53-
kpv provides a wrapper through docker to execute the script
56+
Use the script `kpv` packaged here just like you would use `kernel_patch_verify`
57+
on your local PC. The `kpv` script is just a wrapper around Docker to run the
58+
container and execute `kernel_patch_verify`.
5459

55-
though you could, in theory start up a shell with the same set of script steps documented in kpv
60+
You can also start up a shell with the same set of script steps documented in
61+
`kpv` manually.

README.md

Lines changed: 88 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
kernel_patch_verify
2-
===================
1+
`kernel_patch_verify`
2+
=====================
33

44
Linux kernel patch static verification helper tool
55

66
[![Kernel Patch Verify Intro video](https://img.youtube.com/vi/HzW4DrDj32w/0.jpg)](https://www.youtube.com/watch?v=HzW4DrDj32w "Kernel Patch Verify Intro video")
77

88
Background and Motivation:
9-
=========================
9+
==========================
1010

1111
This script came about as a result of various beatings I recieved and saw others
12-
recieve in upstream kernel discussions over the last several years.
13-
Did you run 'checkpatch.pl --strict', did you run sparse, is your patch series
14-
bisectable, or the newer ones - coccinelle, smatch. I mean, why debug or even
15-
catch these in mailing lists, if you can programmatically try to catch them up
16-
at developer's end?
12+
recieve in upstream kernel discussions over the last several years. Did you run
13+
`checkpatch.pl --strict`, did you run `sparse`, is your patch series bisectable,
14+
or the newer ones - `coccinelle` and `smatch`. I mean, why debug or even catch
15+
these in mailing lists, if you can programmatically try to catch them up at
16+
developer's end?
1717

1818
Many of these were due to:
1919
+ Too many tools constantly evolving in linux kernel - too many goodies, and
@@ -25,28 +25,29 @@ and almost everyone would like to have something quick and handy.. and if
2525
possible, automated..
2626

2727
As a result, while working on "evil vendor" Android kernel as a domain
28-
maintainer, I had originally written a dumb application called Kmake
29-
(http://www.omappedia.com/wiki/Kmake). This was my first attempt at automating
30-
this entire process.. and was pretty crap code and was meant for me to test 1
31-
single patch and was born out of pure desperation getting a hell lot of crap
28+
maintainer, I had originally written a dumb application called Kmake (unrelated
29+
to the current meta build systems). This was my first attempt at automating this
30+
entire process... and was pretty crap code and was meant for me to test 1 single
31+
patch. It was born out of pure desperation from getting a hell lot of crap
3232
patches from too many internal developers.
3333

3434
As I shared around this original code over the years, I got feedback from
3535
various folks on varied angles:
3636
- Dan Murphy: why cant it report required applications for it to run?
3737
- Tero Kristo: rewrote the entire script and got me thinking along the lines of a
3838
'patch set that needs to be applied'
39-
- And, others who suggested tiny little things..
39+
- And, others who suggested tiny little things...
4040

4141
It was obvious, this original script needed a respin and update to newer kernel
4242
world. So, here is another attempt with enough error handling that I could
43-
reasonably think of in the few hours I spend rewriting.. And I do not think it
44-
is good enough yet.. there are few things I dropped - storing dtbs+zImage per
43+
reasonably think of in the few hours I spend rewriting... And I do not think it
44+
is good enough yet... there are few things I dropped - storing dtbs+zImage per
4545
patch to to allow for seperate verification by boot per patch and similar tiny
46-
little thingies.. Maybe later.. I guess..
46+
little thingies... Maybe later... I guess...
4747

4848
CONTRIBUTIONS:
49-
=============
49+
==============
50+
5051
Just lets keep this on github and send pull requests to merge things up? As a
5152
script developer, we all know that various developers have widely varying tastes.
5253
if you feel an bug fixed or other improvements to share, send me a pull request
@@ -58,29 +59,32 @@ bash.
5859

5960
INSTALL NOTES:
6061
==============
62+
6163
Almost nothing - I hope you are already using bash and building kernel -
6264
The script should crib and provide recommendations for missing packages (or is
63-
supposed to ;) )..
65+
supposed to ;) )
6466

65-
For -C 'complete tests', the following are needed:
67+
For `-C` or "complete tests", the following are needed:
6668
- smatch: (sudo apt-get install sqlite3 libsqlite3-dev llvm)
6769

68-
http://linuxplumbersconf.com/2011/ocw//system/presentations/165/original/transcript.txt
70+
https://blog.linuxplumbersconf.org/2011/ocw/system/presentations/165/original/transcript.txt
6971

70-
http://smatch.sf.net
72+
https://smatch.sourceforge.net/
7173

72-
NOTE for older ubuntu installs, use: https://launchpad.net/ubuntu/+source/coccinelle
74+
NOTE for older Ubuntu installs, use: https://launchpad.net/ubuntu/+source/coccinelle
7375

7476
- spatch: is provided by the coccinelle package in ubuntu
7577

76-
:warning: **If your changes include dtb changes, then please optimize your .config, since dtbscheck will take significant time!**
78+
:warning: **If your changes include dtb changes, then please optimize your
79+
`.config`, since dtbscheck will take significant time!**
7780

7881
```
79-
for i in `cat arch/arm64/Kconfig.platforms |grep ARCH|grep "^config"|grep -v K3|cut -d ' ' -f2`; do echo "CONFIG_"$i"=n">>.config; done
82+
sed -n 's/^config \(ARCH.*\)/CONFIG_\1=n/p' arch/arm64/Kconfig.platforms | grep -v K3 >> .config
8083
```
8184

8285
Usage:
83-
=====
86+
======
87+
8488
```
8589
./kernel_patch_verify [-d] [-j CPUs] [-B build_target] [-T tmp_dir_base] [-l logfile] [-C] [-c defconfig_name] [-1]|[-p patch_dir]|[-b base_branch [-t head_branch]]
8690
-d: if not already defined, use CROSS_COMPILE=arm-linux-gnueabi-, ARCH=arm, and builds for ' zImage dtbs' build targets
@@ -99,97 +103,103 @@ Usage:
99103

100104
NOTE:
101105
* Only one of -1, -p or (-b,-t) should be used - but at least one of these should be used
102-
* Cannot have a diff pending OR be on a dangling branch base_branch should exist as well
103-
* The default tests are selected with view of as minimal time as possible, while the '-C' tests
106+
* Cannot have a diff pending OR be on a dangling branch `base_branch` should exist as well
107+
* The default tests are selected with view of as minimal time as possible, while the `-C` tests
104108
are the comprehensive tests which are strongly recommended before showing your patches to any other
105109
human being.
106110

107111
Example usages:
108112
===============
109113

110-
* Verify last commmitted patch
114+
* Verify last commmitted patch:
111115

112-
```
113-
./kernel_patch_verify -1
114-
```
115-
* Verify on top of current branch patches from location ~/tmp/test-patches
116+
```
117+
./kernel_patch_verify -1
118+
```
116119
117-
```
118-
./kernel_patch_verify -p ~/tmp/test-patches
119-
```
120-
* Verify *from* branch 'base_branch' till current branch
120+
* Verify on top of current branch patches from location `~/tmp/test-patches`:
121121
122-
```
123-
./kernel_patch_verify -b base_branch
124-
```
125-
* Verify from current branch, all patches *until* 'test_branch'
122+
```
123+
./kernel_patch_verify -p ~/tmp/test-patches
124+
```
126125
127-
```
128-
./kernel_patch_verify -t test_branch
129-
```
130-
* Verify, all patches from 'base_branch' until 'test_branch'
126+
* Verify *from* branch `base_branch` till current branch:
131127
132-
```
133-
./kernel_patch_verify -b base_branch -t test_branch
134-
```
135-
* Verify with complete tests, all patches from 'base_branch' until 'test_branch'
128+
```
129+
./kernel_patch_verify -b base_branch
130+
```
136131
137-
```
138-
./kernel_patch_verify -b base_branch -t test_branch -C
139-
```
132+
* Verify all patches *from* current branch *until* `test_branch`:
140133
141-
* Verify last committed patch on a native x86 build using make, gcc and bzImage
134+
```
135+
./kernel_patch_verify -t test_branch
136+
```
142137
143-
```
144-
./kernel_patch_verify -B bzImage -1
145-
```
138+
* Verify all patches *from* `base_branch` *until* `test_branch`:
146139
147-
* Verify last committed patch on a cross_compiled ARM build using defaults
140+
```
141+
./kernel_patch_verify -b base_branch -t test_branch
142+
```
148143
149-
```
150-
./kernel_patch_verify -d -1
151-
```
144+
* Verify, with complete tests, all patches *from* `base_branch` *until*
145+
`test_branch`:
146+
147+
```
148+
./kernel_patch_verify -b base_branch -t test_branch -C
149+
```
150+
151+
* Verify last committed patch on a native x86 build using `make`, `gcc`, and the
152+
`bzImage` target:
153+
154+
```
155+
./kernel_patch_verify -B bzImage -1
156+
```
157+
158+
* Verify last committed patch on a cross-compiled ARM build using defaults:
159+
160+
```
161+
./kernel_patch_verify -d -1
162+
```
152163
153164
Some script design stuff:
154-
========================
155-
Alright, the shell script should be readable in it's own I hope.. anyways,
165+
=========================
166+
167+
Alright, the shell script should be readable in it's own I hope... anyways,
156168
tests are organized as:
157-
* ptest_xyz -> these tests take the patch as the argument
158-
* ftest_xyz -> these tests take c file (impacted by the patch) as the argument
159-
* btest_xyz -> there are of two types: the ones that take .o files as arguments
169+
* `ptest_xyz` -> these tests take the patch as the argument
170+
* `ftest_xyz` -> these tests take c file (impacted by the patch) as the argument
171+
* `btest_xyz` -> there are of two types: the ones that take .o files as arguments
160172
and those that build the entire kernel
161173
162174
Tests are organized per patch OR overall (basically run before the patch series
163175
and after the patch series). Reports are generated after all the tests are run,
164176
I have not tried to standardize the reports in any way, except that if there is
165177
a 'change' in log, for example:
166-
* build warning was created with a patch.
167-
* build warning was removed with a patch in the series.
178+
* A build warning was created with a patch.
179+
* A build warning was removed with a patch in the series.
168180
169181
This will appear as a a diff (both build warning was removed or added is
170182
considered similar) and that diff is provided in the report log. the final report
171183
log is a consolidation of every single patch, over all results and also provides
172184
information about the tools and versions used.
173185
174-
'-C' tests are reserved for ones that take time. I would like to encourage
175-
developers to constantly use the test script to keep their code clean,
176-
so without the '-C', it tries to run tests that take a short amount of time.
177-
For patches that take significant time, I'd list them under '-C'. I recommend
178-
reading the code to see the list of tests executed - This will also be printed
179-
as you execute the tests. just remember that false positives are irritable to
186+
Without the `-C` switch, only tests that take a short amount of time will be
187+
ran. Tests that take significant time should be listed under `-C`. I recommend
188+
reading the code to see the list of tests executed. This will also be printed as
189+
you execute the tests. Just remember that false positives are irritable to
180190
developers, so be careful of the results.
181191
182192
The generic strategy for the test is that everything in stderr is logged, a test
183193
should never throw anything on stdout as it just craps up the developer's screen.
184194
If a test provides result on stdout, redirect it to stderr. Pass/fail criteria is
185195
as follows:
186-
* for ftest_, btest_, the before and after logs should show 0 diff. if there are
187-
it assumes new fail introduction
188-
* for ptest, no output is a pass, any output tends to be a fail.
196+
* For `ftest_`, `btest_`, the before and after logs should show 0 diff. If there
197+
are, it assumes new fail introduction
198+
* For `ptest`, no output is a pass, any output tends to be a fail.
189199
190200
191201
Author and versioning highlights (chronological):
192-
--------------------------------
202+
-------------------------------------------------
193203
* Nishanth Menon Dec 2013, Dallas, TX, while lying in bed with a slight migraine
194-
staring at a cloudy sky and spewing nonsense into vim.. and guessing that no one
195-
might even care about this..
204+
staring at a cloudy sky and spewing nonsense into vim... and guessing that no one
205+
might even care about this...

0 commit comments

Comments
 (0)