diff options
| -rw-r--r-- | .gitignore | 5 | ||||
| -rw-r--r-- | Documentation/dev-tools/coccinelle.rst | 3 | ||||
| -rwxr-xr-x | scripts/coccicheck | 26 | ||||
| -rw-r--r-- | scripts/coccinelle/api/check_bq27xxx_data.cocci | 161 | ||||
| -rw-r--r-- | scripts/coccinelle/api/setup_timer.cocci | 144 | ||||
| -rw-r--r-- | scripts/coccinelle/iterators/list_entry_update.cocci | 2 | ||||
| -rw-r--r-- | scripts/coccinelle/misc/ifcol.cocci | 8 | ||||
| -rw-r--r-- | scripts/coccinelle/misc/orplus.cocci | 43 | ||||
| -rw-r--r-- | scripts/coccinelle/null/badzero.cocci | 2 | ||||
| -rw-r--r-- | scripts/package/Makefile | 9 | ||||
| -rwxr-xr-x | scripts/package/builddeb | 4 | ||||
| -rwxr-xr-x | scripts/package/mkspec | 269 |
12 files changed, 457 insertions, 219 deletions
diff --git a/.gitignore b/.gitignore index 6c119eab5d46..f6050b88e95b 100644 --- a/.gitignore +++ b/.gitignore | |||
| @@ -56,6 +56,11 @@ modules.builtin | |||
| 56 | /Module.markers | 56 | /Module.markers |
| 57 | 57 | ||
| 58 | # | 58 | # |
| 59 | # RPM spec file (make rpm-pkg) | ||
| 60 | # | ||
| 61 | /*.spec | ||
| 62 | |||
| 63 | # | ||
| 59 | # Debian directory (make deb-pkg) | 64 | # Debian directory (make deb-pkg) |
| 60 | # | 65 | # |
| 61 | /debian/ | 66 | /debian/ |
diff --git a/Documentation/dev-tools/coccinelle.rst b/Documentation/dev-tools/coccinelle.rst index 37e474ff6911..94f41c290bfc 100644 --- a/Documentation/dev-tools/coccinelle.rst +++ b/Documentation/dev-tools/coccinelle.rst | |||
| @@ -33,9 +33,6 @@ of many distributions, e.g. : | |||
| 33 | You can get the latest version released from the Coccinelle homepage at | 33 | You can get the latest version released from the Coccinelle homepage at |
| 34 | http://coccinelle.lip6.fr/ | 34 | http://coccinelle.lip6.fr/ |
| 35 | 35 | ||
| 36 | Information and tips about Coccinelle are also provided on the wiki | ||
| 37 | pages at http://cocci.ekstranet.diku.dk/wiki/doku.php | ||
| 38 | |||
| 39 | Once you have it, run the following command:: | 36 | Once you have it, run the following command:: |
| 40 | 37 | ||
| 41 | ./configure | 38 | ./configure |
diff --git a/scripts/coccicheck b/scripts/coccicheck index 28ad1feff9e1..d5f28d5044e7 100755 --- a/scripts/coccicheck +++ b/scripts/coccicheck | |||
| @@ -123,15 +123,8 @@ run_cmd_parmap() { | |||
| 123 | if [ $VERBOSE -ne 0 ] ; then | 123 | if [ $VERBOSE -ne 0 ] ; then |
| 124 | echo "Running ($NPROC in parallel): $@" | 124 | echo "Running ($NPROC in parallel): $@" |
| 125 | fi | 125 | fi |
| 126 | if [ "$DEBUG_FILE" != "/dev/null" -a "$DEBUG_FILE" != "" ]; then | 126 | echo $@ >>$DEBUG_FILE |
| 127 | if [ -f $DEBUG_FILE ]; then | 127 | $@ 2>>$DEBUG_FILE |
| 128 | echo "Debug file $DEBUG_FILE exists, bailing" | ||
| 129 | exit | ||
| 130 | fi | ||
| 131 | else | ||
| 132 | DEBUG_FILE="/dev/null" | ||
| 133 | fi | ||
| 134 | $@ 2>$DEBUG_FILE | ||
| 135 | if [[ $? -ne 0 ]]; then | 128 | if [[ $? -ne 0 ]]; then |
| 136 | echo "coccicheck failed" | 129 | echo "coccicheck failed" |
| 137 | exit $? | 130 | exit $? |
| @@ -176,8 +169,8 @@ OPTIONS="$OPTIONS $SPFLAGS" | |||
| 176 | coccinelle () { | 169 | coccinelle () { |
| 177 | COCCI="$1" | 170 | COCCI="$1" |
| 178 | 171 | ||
| 179 | OPT=`grep "Option" $COCCI | cut -d':' -f2` | 172 | OPT=`grep "Options:" $COCCI | cut -d':' -f2` |
| 180 | REQ=`grep "Requires" $COCCI | cut -d':' -f2 | sed "s| ||"` | 173 | REQ=`grep "Requires:" $COCCI | cut -d':' -f2 | sed "s| ||"` |
| 181 | REQ_NUM=$(echo $REQ | ${DIR}/scripts/ld-version.sh) | 174 | REQ_NUM=$(echo $REQ | ${DIR}/scripts/ld-version.sh) |
| 182 | if [ "$REQ_NUM" != "0" ] ; then | 175 | if [ "$REQ_NUM" != "0" ] ; then |
| 183 | if [ "$SPATCH_VERSION_NUM" -lt "$REQ_NUM" ] ; then | 176 | if [ "$SPATCH_VERSION_NUM" -lt "$REQ_NUM" ] ; then |
| @@ -194,7 +187,7 @@ coccinelle () { | |||
| 194 | 187 | ||
| 195 | if [ $VERBOSE -ne 0 -a $ONLINE -eq 0 ] ; then | 188 | if [ $VERBOSE -ne 0 -a $ONLINE -eq 0 ] ; then |
| 196 | 189 | ||
| 197 | FILE=`echo $COCCI | sed "s|$srctree/||"` | 190 | FILE=${COCCI#$srctree/} |
| 198 | 191 | ||
| 199 | echo "Processing `basename $COCCI`" | 192 | echo "Processing `basename $COCCI`" |
| 200 | echo "with option(s) \"$OPT\"" | 193 | echo "with option(s) \"$OPT\"" |
| @@ -247,6 +240,15 @@ coccinelle () { | |||
| 247 | 240 | ||
| 248 | } | 241 | } |
| 249 | 242 | ||
| 243 | if [ "$DEBUG_FILE" != "/dev/null" -a "$DEBUG_FILE" != "" ]; then | ||
| 244 | if [ -f $DEBUG_FILE ]; then | ||
| 245 | echo "Debug file $DEBUG_FILE exists, bailing" | ||
| 246 | exit | ||
| 247 | fi | ||
| 248 | else | ||
| 249 | DEBUG_FILE="/dev/null" | ||
| 250 | fi | ||
| 251 | |||
| 250 | if [ "$COCCI" = "" ] ; then | 252 | if [ "$COCCI" = "" ] ; then |
| 251 | for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | sort`; do | 253 | for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | sort`; do |
| 252 | coccinelle $f | 254 | coccinelle $f |
diff --git a/scripts/coccinelle/api/check_bq27xxx_data.cocci b/scripts/coccinelle/api/check_bq27xxx_data.cocci new file mode 100644 index 000000000000..9212b85169d2 --- /dev/null +++ b/scripts/coccinelle/api/check_bq27xxx_data.cocci | |||
| @@ -0,0 +1,161 @@ | |||
| 1 | /// Detect BQ27XXX_DATA structures with identical registers, dm registers or | ||
| 2 | /// properties. | ||
| 3 | //# Doesn't unfold macros used in register or property fields. | ||
| 4 | //# Requires OCaml scripting | ||
| 5 | /// | ||
| 6 | // Confidence: High | ||
| 7 | // Copyright: (C) 2017 Julia Lawall, Inria/LIP6, GPLv2. | ||
| 8 | // URL: http://coccinelle.lip6.fr/ | ||
| 9 | // Requires: 1.0.7 | ||
| 10 | // Keywords: BQ27XXX_DATA | ||
| 11 | |||
| 12 | virtual report | ||
| 13 | |||
| 14 | @initialize:ocaml@ | ||
| 15 | @@ | ||
| 16 | |||
| 17 | let print_report p msg = | ||
| 18 | let p = List.hd p in | ||
| 19 | Printf.printf "%s:%d:%d-%d: %s" p.file p.line p.col p.col_end msg | ||
| 20 | |||
| 21 | @str depends on report@ | ||
| 22 | type t; | ||
| 23 | identifier i,i1,i2; | ||
| 24 | expression e1,e2; | ||
| 25 | @@ | ||
| 26 | |||
| 27 | t i[] = { | ||
| 28 | ..., | ||
| 29 | [e1] = BQ27XXX_DATA(i1,...), | ||
| 30 | ..., | ||
| 31 | [e2] = BQ27XXX_DATA(i2,...), | ||
| 32 | ..., | ||
| 33 | }; | ||
| 34 | |||
| 35 | @script:ocaml tocheck@ | ||
| 36 | i1 << str.i1; | ||
| 37 | i2 << str.i2; | ||
| 38 | i1regs; i2regs; | ||
| 39 | i1dmregs; i2dmregs; | ||
| 40 | i1props; i2props; | ||
| 41 | @@ | ||
| 42 | |||
| 43 | if not(i1 = i2) | ||
| 44 | then | ||
| 45 | begin | ||
| 46 | i1regs := make_ident (i1 ^ "_regs"); | ||
| 47 | i2regs := make_ident (i2 ^ "_regs"); | ||
| 48 | i1dmregs := make_ident (i1 ^ "_dm_regs"); | ||
| 49 | i2dmregs := make_ident (i2 ^ "_dm_regs"); | ||
| 50 | i1props := make_ident (i1 ^ "_props"); | ||
| 51 | i2props := make_ident (i2 ^ "_props") | ||
| 52 | end | ||
| 53 | |||
| 54 | (* ---------------------------------------------------------------- *) | ||
| 55 | |||
| 56 | @getregs1@ | ||
| 57 | typedef u8; | ||
| 58 | identifier tocheck.i1regs; | ||
| 59 | initializer list i1regs_vals; | ||
| 60 | position p1; | ||
| 61 | @@ | ||
| 62 | |||
| 63 | u8 i1regs@p1[...] = { i1regs_vals, }; | ||
| 64 | |||
| 65 | @getregs2@ | ||
| 66 | identifier tocheck.i2regs; | ||
| 67 | initializer list i2regs_vals; | ||
| 68 | position p2; | ||
| 69 | @@ | ||
| 70 | |||
| 71 | u8 i2regs@p2[...] = { i2regs_vals, }; | ||
| 72 | |||
| 73 | @script:ocaml@ | ||
| 74 | (_,i1regs_vals) << getregs1.i1regs_vals; | ||
| 75 | (_,i2regs_vals) << getregs2.i2regs_vals; | ||
| 76 | i1regs << tocheck.i1regs; | ||
| 77 | i2regs << tocheck.i2regs; | ||
| 78 | p1 << getregs1.p1; | ||
| 79 | p2 << getregs2.p2; | ||
| 80 | @@ | ||
| 81 | |||
| 82 | if i1regs < i2regs && | ||
| 83 | List.sort compare i1regs_vals = List.sort compare i2regs_vals | ||
| 84 | then | ||
| 85 | let msg = | ||
| 86 | Printf.sprintf | ||
| 87 | "WARNING %s and %s (line %d) are identical\n" | ||
| 88 | i1regs i2regs (List.hd p2).line in | ||
| 89 | print_report p1 msg | ||
| 90 | |||
| 91 | (* ---------------------------------------------------------------- *) | ||
| 92 | |||
| 93 | @getdmregs1@ | ||
| 94 | identifier tocheck.i1dmregs; | ||
| 95 | initializer list i1dmregs_vals; | ||
| 96 | position p1; | ||
| 97 | @@ | ||
| 98 | |||
| 99 | struct bq27xxx_dm_reg i1dmregs@p1[] = { i1dmregs_vals, }; | ||
| 100 | |||
| 101 | @getdmregs2@ | ||
| 102 | identifier tocheck.i2dmregs; | ||
| 103 | initializer list i2dmregs_vals; | ||
| 104 | position p2; | ||
| 105 | @@ | ||
| 106 | |||
| 107 | struct bq27xxx_dm_reg i2dmregs@p2[] = { i2dmregs_vals, }; | ||
| 108 | |||
| 109 | @script:ocaml@ | ||
| 110 | (_,i1dmregs_vals) << getdmregs1.i1dmregs_vals; | ||
| 111 | (_,i2dmregs_vals) << getdmregs2.i2dmregs_vals; | ||
| 112 | i1dmregs << tocheck.i1dmregs; | ||
| 113 | i2dmregs << tocheck.i2dmregs; | ||
| 114 | p1 << getdmregs1.p1; | ||
| 115 | p2 << getdmregs2.p2; | ||
| 116 | @@ | ||
| 117 | |||
| 118 | if i1dmregs < i2dmregs && | ||
| 119 | List.sort compare i1dmregs_vals = List.sort compare i2dmregs_vals | ||
| 120 | then | ||
| 121 | let msg = | ||
| 122 | Printf.sprintf | ||
| 123 | "WARNING %s and %s (line %d) are identical\n" | ||
| 124 | i1dmregs i2dmregs (List.hd p2).line in | ||
| 125 | print_report p1 msg | ||
| 126 | |||
| 127 | (* ---------------------------------------------------------------- *) | ||
| 128 | |||
| 129 | @getprops1@ | ||
| 130 | identifier tocheck.i1props; | ||
| 131 | initializer list[n1] i1props_vals; | ||
| 132 | position p1; | ||
| 133 | @@ | ||
| 134 | |||
| 135 | enum power_supply_property i1props@p1[] = { i1props_vals, }; | ||
| 136 | |||
| 137 | @getprops2@ | ||
| 138 | identifier tocheck.i2props; | ||
| 139 | initializer list[n2] i2props_vals; | ||
| 140 | position p2; | ||
| 141 | @@ | ||
| 142 | |||
| 143 | enum power_supply_property i2props@p2[] = { i2props_vals, }; | ||
| 144 | |||
| 145 | @script:ocaml@ | ||
| 146 | (_,i1props_vals) << getprops1.i1props_vals; | ||
| 147 | (_,i2props_vals) << getprops2.i2props_vals; | ||
| 148 | i1props << tocheck.i1props; | ||
| 149 | i2props << tocheck.i2props; | ||
| 150 | p1 << getprops1.p1; | ||
| 151 | p2 << getprops2.p2; | ||
| 152 | @@ | ||
| 153 | |||
| 154 | if i1props < i2props && | ||
| 155 | List.sort compare i1props_vals = List.sort compare i2props_vals | ||
| 156 | then | ||
| 157 | let msg = | ||
| 158 | Printf.sprintf | ||
| 159 | "WARNING %s and %s (line %d) are identical\n" | ||
| 160 | i1props i2props (List.hd p2).line in | ||
| 161 | print_report p1 msg | ||
diff --git a/scripts/coccinelle/api/setup_timer.cocci b/scripts/coccinelle/api/setup_timer.cocci index eb6bd9e4ab1a..e4577089dcb9 100644 --- a/scripts/coccinelle/api/setup_timer.cocci +++ b/scripts/coccinelle/api/setup_timer.cocci | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | /// and data fields | 2 | /// and data fields |
| 3 | // Confidence: High | 3 | // Confidence: High |
| 4 | // Copyright: (C) 2016 Vaishali Thakkar, Oracle. GPLv2 | 4 | // Copyright: (C) 2016 Vaishali Thakkar, Oracle. GPLv2 |
| 5 | // Copyright: (C) 2017 Kees Cook, Google. GPLv2 | ||
| 5 | // Options: --no-includes --include-headers | 6 | // Options: --no-includes --include-headers |
| 6 | // Keywords: init_timer, setup_timer | 7 | // Keywords: init_timer, setup_timer |
| 7 | 8 | ||
| @@ -10,60 +11,123 @@ virtual context | |||
| 10 | virtual org | 11 | virtual org |
| 11 | virtual report | 12 | virtual report |
| 12 | 13 | ||
| 14 | // Match the common cases first to avoid Coccinelle parsing loops with | ||
| 15 | // "... when" clauses. | ||
| 16 | |||
| 13 | @match_immediate_function_data_after_init_timer | 17 | @match_immediate_function_data_after_init_timer |
| 14 | depends on patch && !context && !org && !report@ | 18 | depends on patch && !context && !org && !report@ |
| 15 | expression e, func, da; | 19 | expression e, func, da; |
| 16 | @@ | 20 | @@ |
| 17 | 21 | ||
| 18 | -init_timer (&e); | 22 | -init_timer |
| 19 | +setup_timer (&e, func, da); | 23 | +setup_timer |
| 24 | ( \(&e\|e\) | ||
| 25 | +, func, da | ||
| 26 | ); | ||
| 27 | ( | ||
| 28 | -\(e.function\|e->function\) = func; | ||
| 29 | -\(e.data\|e->data\) = da; | ||
| 30 | | | ||
| 31 | -\(e.data\|e->data\) = da; | ||
| 32 | -\(e.function\|e->function\) = func; | ||
| 33 | ) | ||
| 34 | |||
| 35 | @match_immediate_function_data_before_init_timer | ||
| 36 | depends on patch && !context && !org && !report@ | ||
| 37 | expression e, func, da; | ||
| 38 | @@ | ||
| 39 | |||
| 40 | ( | ||
| 41 | -\(e.function\|e->function\) = func; | ||
| 42 | -\(e.data\|e->data\) = da; | ||
| 43 | | | ||
| 44 | -\(e.data\|e->data\) = da; | ||
| 45 | -\(e.function\|e->function\) = func; | ||
| 46 | ) | ||
| 47 | -init_timer | ||
| 48 | +setup_timer | ||
| 49 | ( \(&e\|e\) | ||
| 50 | +, func, da | ||
| 51 | ); | ||
| 52 | |||
| 53 | @match_function_and_data_after_init_timer | ||
| 54 | depends on patch && !context && !org && !report@ | ||
| 55 | expression e, e2, e3, e4, e5, func, da; | ||
| 56 | @@ | ||
| 20 | 57 | ||
| 58 | -init_timer | ||
| 59 | +setup_timer | ||
| 60 | ( \(&e\|e\) | ||
| 61 | +, func, da | ||
| 62 | ); | ||
| 63 | ... when != func = e2 | ||
| 64 | when != da = e3 | ||
| 21 | ( | 65 | ( |
| 22 | -e.function = func; | 66 | -e.function = func; |
| 67 | ... when != da = e4 | ||
| 23 | -e.data = da; | 68 | -e.data = da; |
| 24 | | | 69 | | |
| 70 | -e->function = func; | ||
| 71 | ... when != da = e4 | ||
| 72 | -e->data = da; | ||
| 73 | | | ||
| 25 | -e.data = da; | 74 | -e.data = da; |
| 75 | ... when != func = e5 | ||
| 26 | -e.function = func; | 76 | -e.function = func; |
| 77 | | | ||
| 78 | -e->data = da; | ||
| 79 | ... when != func = e5 | ||
| 80 | -e->function = func; | ||
| 27 | ) | 81 | ) |
| 28 | 82 | ||
| 29 | @match_function_and_data_after_init_timer | 83 | @match_function_and_data_before_init_timer |
| 30 | depends on patch && !context && !org && !report@ | 84 | depends on patch && !context && !org && !report@ |
| 31 | expression e1, e2, e3, e4, e5, a, b; | 85 | expression e, e2, e3, e4, e5, func, da; |
| 32 | @@ | 86 | @@ |
| 33 | |||
| 34 | -init_timer (&e1); | ||
| 35 | +setup_timer (&e1, a, b); | ||
| 36 | |||
| 37 | ... when != a = e2 | ||
| 38 | when != b = e3 | ||
| 39 | ( | 87 | ( |
| 40 | -e1.function = a; | 88 | -e.function = func; |
| 41 | ... when != b = e4 | 89 | ... when != da = e4 |
| 42 | -e1.data = b; | 90 | -e.data = da; |
| 43 | | | 91 | | |
| 44 | -e1.data = b; | 92 | -e->function = func; |
| 45 | ... when != a = e5 | 93 | ... when != da = e4 |
| 46 | -e1.function = a; | 94 | -e->data = da; |
| 95 | | | ||
| 96 | -e.data = da; | ||
| 97 | ... when != func = e5 | ||
| 98 | -e.function = func; | ||
| 99 | | | ||
| 100 | -e->data = da; | ||
| 101 | ... when != func = e5 | ||
| 102 | -e->function = func; | ||
| 47 | ) | 103 | ) |
| 104 | ... when != func = e2 | ||
| 105 | when != da = e3 | ||
| 106 | -init_timer | ||
| 107 | +setup_timer | ||
| 108 | ( \(&e\|e\) | ||
| 109 | +, func, da | ||
| 110 | ); | ||
| 48 | 111 | ||
| 49 | @r1 exists@ | 112 | @r1 exists@ |
| 113 | expression t; | ||
| 50 | identifier f; | 114 | identifier f; |
| 51 | position p; | 115 | position p; |
| 52 | @@ | 116 | @@ |
| 53 | 117 | ||
| 54 | f(...) { ... when any | 118 | f(...) { ... when any |
| 55 | init_timer@p(...) | 119 | init_timer@p(\(&t\|t\)) |
| 56 | ... when any | 120 | ... when any |
| 57 | } | 121 | } |
| 58 | 122 | ||
| 59 | @r2 exists@ | 123 | @r2 exists@ |
| 124 | expression r1.t; | ||
| 60 | identifier g != r1.f; | 125 | identifier g != r1.f; |
| 61 | struct timer_list t; | ||
| 62 | expression e8; | 126 | expression e8; |
| 63 | @@ | 127 | @@ |
| 64 | 128 | ||
| 65 | g(...) { ... when any | 129 | g(...) { ... when any |
| 66 | t.data = e8 | 130 | \(t.data\|t->data\) = e8 |
| 67 | ... when any | 131 | ... when any |
| 68 | } | 132 | } |
| 69 | 133 | ||
| @@ -77,14 +141,31 @@ p << r1.p; | |||
| 77 | cocci.include_match(False) | 141 | cocci.include_match(False) |
| 78 | 142 | ||
| 79 | @r3 depends on patch && !context && !org && !report@ | 143 | @r3 depends on patch && !context && !org && !report@ |
| 80 | expression e6, e7, c; | 144 | expression r1.t, func, e7; |
| 81 | position r1.p; | 145 | position r1.p; |
| 82 | @@ | 146 | @@ |
| 83 | 147 | ||
| 84 | -init_timer@p (&e6); | 148 | ( |
| 85 | +setup_timer (&e6, c, 0UL); | 149 | -init_timer@p(&t); |
| 86 | ... when != c = e7 | 150 | +setup_timer(&t, func, 0UL); |
| 87 | -e6.function = c; | 151 | ... when != func = e7 |
| 152 | -t.function = func; | ||
| 153 | | | ||
| 154 | -t.function = func; | ||
| 155 | ... when != func = e7 | ||
| 156 | -init_timer@p(&t); | ||
| 157 | +setup_timer(&t, func, 0UL); | ||
| 158 | | | ||
| 159 | -init_timer@p(t); | ||
| 160 | +setup_timer(t, func, 0UL); | ||
| 161 | ... when != func = e7 | ||
| 162 | -t->function = func; | ||
| 163 | | | ||
| 164 | -t->function = func; | ||
| 165 | ... when != func = e7 | ||
| 166 | -init_timer@p(t); | ||
| 167 | +setup_timer(t, func, 0UL); | ||
| 168 | ) | ||
| 88 | 169 | ||
| 89 | // ---------------------------------------------------------------------------- | 170 | // ---------------------------------------------------------------------------- |
| 90 | 171 | ||
| @@ -104,11 +185,9 @@ position j0, j1, j2; | |||
| 104 | ) | 185 | ) |
| 105 | 186 | ||
| 106 | @match_function_and_data_after_init_timer_context | 187 | @match_function_and_data_after_init_timer_context |
| 107 | depends on !patch && | 188 | depends on !patch && (context || org || report)@ |
| 108 | !match_immediate_function_data_after_init_timer_context && | ||
| 109 | (context || org || report)@ | ||
| 110 | expression a, b, e1, e2, e3, e4, e5; | 189 | expression a, b, e1, e2, e3, e4, e5; |
| 111 | position j0, j1, j2; | 190 | position j0 != match_immediate_function_data_after_init_timer_context.j0,j1,j2; |
| 112 | @@ | 191 | @@ |
| 113 | 192 | ||
| 114 | * init_timer@j0 (&e1); | 193 | * init_timer@j0 (&e1); |
| @@ -124,13 +203,12 @@ position j0, j1, j2; | |||
| 124 | * e1@j2.function = a; | 203 | * e1@j2.function = a; |
| 125 | ) | 204 | ) |
| 126 | 205 | ||
| 127 | @r3_context depends on !patch && | 206 | @r3_context depends on !patch && (context || org || report)@ |
| 128 | !match_immediate_function_data_after_init_timer_context && | ||
| 129 | !match_function_and_data_after_init_timer_context && | ||
| 130 | (context || org || report)@ | ||
| 131 | expression c, e6, e7; | 207 | expression c, e6, e7; |
| 132 | position r1.p; | 208 | position r1.p; |
| 133 | position j0, j1; | 209 | position j0 != |
| 210 | {match_immediate_function_data_after_init_timer_context.j0, | ||
| 211 | match_function_and_data_after_init_timer_context.j0}, j1; | ||
| 134 | @@ | 212 | @@ |
| 135 | 213 | ||
| 136 | * init_timer@j0@p (&e6); | 214 | * init_timer@j0@p (&e6); |
diff --git a/scripts/coccinelle/iterators/list_entry_update.cocci b/scripts/coccinelle/iterators/list_entry_update.cocci index 873f444e7137..be6f9f1abb34 100644 --- a/scripts/coccinelle/iterators/list_entry_update.cocci +++ b/scripts/coccinelle/iterators/list_entry_update.cocci | |||
| @@ -15,7 +15,7 @@ virtual context | |||
| 15 | virtual org | 15 | virtual org |
| 16 | virtual report | 16 | virtual report |
| 17 | 17 | ||
| 18 | @r@ | 18 | @r exists@ |
| 19 | iterator name list_for_each_entry; | 19 | iterator name list_for_each_entry; |
| 20 | expression x,E; | 20 | expression x,E; |
| 21 | position p1,p2; | 21 | position p1,p2; |
diff --git a/scripts/coccinelle/misc/ifcol.cocci b/scripts/coccinelle/misc/ifcol.cocci index d0d00ef1f12a..ffe75407c5d2 100644 --- a/scripts/coccinelle/misc/ifcol.cocci +++ b/scripts/coccinelle/misc/ifcol.cocci | |||
| @@ -3,10 +3,10 @@ | |||
| 3 | /// Sometimes, code after an if that is indented is actually intended to be | 3 | /// Sometimes, code after an if that is indented is actually intended to be |
| 4 | /// part of the if branch. | 4 | /// part of the if branch. |
| 5 | /// | 5 | /// |
| 6 | /// This has a high rate of false positives, because Coccinelle's column | 6 | //# This has a high rate of false positives, because Coccinelle's column |
| 7 | /// calculation does not distinguish between spaces and tabs, so code that | 7 | //# calculation does not distinguish between spaces and tabs, so code that |
| 8 | /// is not visually aligned may be considered to be in the same column. | 8 | //# is not visually aligned may be considered to be in the same column. |
| 9 | /// | 9 | // |
| 10 | // Confidence: Low | 10 | // Confidence: Low |
| 11 | // Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. | 11 | // Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. |
| 12 | // Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2. | 12 | // Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2. |
diff --git a/scripts/coccinelle/misc/orplus.cocci b/scripts/coccinelle/misc/orplus.cocci index 81fabf379390..08de5be73693 100644 --- a/scripts/coccinelle/misc/orplus.cocci +++ b/scripts/coccinelle/misc/orplus.cocci | |||
| @@ -14,7 +14,19 @@ virtual report | |||
| 14 | virtual context | 14 | virtual context |
| 15 | 15 | ||
| 16 | @r@ | 16 | @r@ |
| 17 | constant c; | 17 | constant c,c1; |
| 18 | identifier i,i1; | ||
| 19 | position p; | ||
| 20 | @@ | ||
| 21 | |||
| 22 | ( | ||
| 23 | c1 + c - 1 | ||
| 24 | | | ||
| 25 | c1@i1 +@p c@i | ||
| 26 | ) | ||
| 27 | |||
| 28 | @s@ | ||
| 29 | constant r.c, r.c1; | ||
| 18 | identifier i; | 30 | identifier i; |
| 19 | expression e; | 31 | expression e; |
| 20 | @@ | 32 | @@ |
| @@ -27,28 +39,31 @@ e & c@i | |||
| 27 | e |= c@i | 39 | e |= c@i |
| 28 | | | 40 | | |
| 29 | e &= c@i | 41 | e &= c@i |
| 42 | | | ||
| 43 | e | c1@i | ||
| 44 | | | ||
| 45 | e & c1@i | ||
| 46 | | | ||
| 47 | e |= c1@i | ||
| 48 | | | ||
| 49 | e &= c1@i | ||
| 30 | ) | 50 | ) |
| 31 | 51 | ||
| 32 | @s@ | 52 | @depends on s@ |
| 33 | constant r.c,c1; | 53 | position r.p; |
| 34 | identifier i1; | 54 | constant c1,c2; |
| 35 | position p; | ||
| 36 | @@ | 55 | @@ |
| 37 | 56 | ||
| 38 | ( | 57 | * c1 +@p c2 |
| 39 | c1 + c - 1 | ||
| 40 | | | ||
| 41 | *c1@i1 +@p c | ||
| 42 | ) | ||
| 43 | 58 | ||
| 44 | @script:python depends on org@ | 59 | @script:python depends on s && org@ |
| 45 | p << s.p; | 60 | p << r.p; |
| 46 | @@ | 61 | @@ |
| 47 | 62 | ||
| 48 | cocci.print_main("sum of probable bitmasks, consider |",p) | 63 | cocci.print_main("sum of probable bitmasks, consider |",p) |
| 49 | 64 | ||
| 50 | @script:python depends on report@ | 65 | @script:python depends on s && report@ |
| 51 | p << s.p; | 66 | p << r.p; |
| 52 | @@ | 67 | @@ |
| 53 | 68 | ||
| 54 | msg = "WARNING: sum of probable bitmasks, consider |" | 69 | msg = "WARNING: sum of probable bitmasks, consider |" |
diff --git a/scripts/coccinelle/null/badzero.cocci b/scripts/coccinelle/null/badzero.cocci index 5551da2b4fe3..f597c8007b76 100644 --- a/scripts/coccinelle/null/badzero.cocci +++ b/scripts/coccinelle/null/badzero.cocci | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. | 10 | // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. |
| 11 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | 11 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. |
| 12 | // URL: http://coccinelle.lip6.fr/ | 12 | // URL: http://coccinelle.lip6.fr/ |
| 13 | // Comments: Requires Coccinelle version 1.0.0-rc20 or later | 13 | // Requires: 1.0.0 |
| 14 | // Options: | 14 | // Options: |
| 15 | 15 | ||
| 16 | virtual patch | 16 | virtual patch |
diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 73f9f3192b9f..9ed96aefc72d 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile | |||
| @@ -50,17 +50,18 @@ rpm-pkg rpm: FORCE | |||
| 50 | $(MAKE) clean | 50 | $(MAKE) clean |
| 51 | $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec | 51 | $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec |
| 52 | $(call cmd,src_tar,$(KERNELPATH),kernel.spec) | 52 | $(call cmd,src_tar,$(KERNELPATH),kernel.spec) |
| 53 | rpmbuild $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz | 53 | +rpmbuild $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz \ |
| 54 | rm $(KERNELPATH).tar.gz kernel.spec | 54 | --define='_smp_mflags %{nil}' |
| 55 | 55 | ||
| 56 | # binrpm-pkg | 56 | # binrpm-pkg |
| 57 | # --------------------------------------------------------------------------- | 57 | # --------------------------------------------------------------------------- |
| 58 | binrpm-pkg: FORCE | 58 | binrpm-pkg: FORCE |
| 59 | $(MAKE) KBUILD_SRC= | 59 | $(MAKE) KBUILD_SRC= |
| 60 | $(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec | 60 | $(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec |
| 61 | rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \ | 61 | +rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \ |
| 62 | $(UTS_MACHINE) -bb $(objtree)/binkernel.spec | 62 | $(UTS_MACHINE) -bb $(objtree)/binkernel.spec |
| 63 | rm binkernel.spec | 63 | |
| 64 | clean-files += $(objtree)/*.spec | ||
| 64 | 65 | ||
| 65 | # Deb target | 66 | # Deb target |
| 66 | # --------------------------------------------------------------------------- | 67 | # --------------------------------------------------------------------------- |
diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 0bc87473f68f..b4f0f2b3f8d2 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb | |||
| @@ -408,9 +408,9 @@ EOF | |||
| 408 | dpkg-source -cdebian/control -ldebian/changelog --format="3.0 (custom)" --target-format="3.0 (quilt)" \ | 408 | dpkg-source -cdebian/control -ldebian/changelog --format="3.0 (custom)" --target-format="3.0 (quilt)" \ |
| 409 | -b / ../${sourcename}_${version}.orig.tar.gz ../${sourcename}_${packageversion}.debian.tar.gz | 409 | -b / ../${sourcename}_${version}.orig.tar.gz ../${sourcename}_${packageversion}.debian.tar.gz |
| 410 | mv ${sourcename}_${packageversion}*dsc .. | 410 | mv ${sourcename}_${packageversion}*dsc .. |
| 411 | dpkg-genchanges > ../${sourcename}_${packageversion}_${debarch}.changes | 411 | dpkg-genchanges -Vkernel:debarch="${debarch}" > ../${sourcename}_${packageversion}_${debarch}.changes |
| 412 | else | 412 | else |
| 413 | dpkg-genchanges -b > ../${sourcename}_${packageversion}_${debarch}.changes | 413 | dpkg-genchanges -b -Vkernel:debarch="${debarch}" > ../${sourcename}_${packageversion}_${debarch}.changes |
| 414 | fi | 414 | fi |
| 415 | 415 | ||
| 416 | exit 0 | 416 | exit 0 |
diff --git a/scripts/package/mkspec b/scripts/package/mkspec index f47f17aae135..280027fad991 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec | |||
| @@ -10,156 +10,135 @@ | |||
| 10 | # | 10 | # |
| 11 | 11 | ||
| 12 | # how we were called determines which rpms we build and how we build them | 12 | # how we were called determines which rpms we build and how we build them |
| 13 | if [ "$1" = "prebuilt" ]; then | 13 | if [ "$1" = prebuilt ]; then |
| 14 | PREBUILT=true | 14 | S=DEL |
| 15 | else | 15 | else |
| 16 | PREBUILT=false | 16 | S= |
| 17 | fi | 17 | fi |
| 18 | 18 | ||
| 19 | # starting to output the spec | 19 | if grep -q CONFIG_MODULES=y .config; then |
| 20 | if [ "`grep CONFIG_DRM=y .config | cut -f2 -d\=`" = "y" ]; then | 20 | M= |
| 21 | PROVIDES=kernel-drm | 21 | else |
| 22 | fi | 22 | M=DEL |
| 23 | |||
| 24 | PROVIDES="$PROVIDES kernel-$KERNELRELEASE" | ||
| 25 | __KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-/_/g"` | ||
| 26 | |||
| 27 | echo "Name: kernel" | ||
| 28 | echo "Summary: The Linux Kernel" | ||
| 29 | echo "Version: $__KERNELRELEASE" | ||
| 30 | echo "Release: $(cat .version 2>/dev/null || echo 1)" | ||
| 31 | echo "License: GPL" | ||
| 32 | echo "Group: System Environment/Kernel" | ||
| 33 | echo "Vendor: The Linux Community" | ||
| 34 | echo "URL: http://www.kernel.org" | ||
| 35 | |||
| 36 | if ! $PREBUILT; then | ||
| 37 | echo "Source: kernel-$__KERNELRELEASE.tar.gz" | ||
| 38 | fi | ||
| 39 | |||
| 40 | echo "BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root" | ||
| 41 | echo "Provides: $PROVIDES" | ||
| 42 | echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :" | ||
| 43 | echo "%define debug_package %{nil}" | ||
| 44 | echo "" | ||
| 45 | echo "%description" | ||
| 46 | echo "The Linux Kernel, the operating system core itself" | ||
| 47 | echo "" | ||
| 48 | echo "%package headers" | ||
| 49 | echo "Summary: Header files for the Linux kernel for use by glibc" | ||
| 50 | echo "Group: Development/System" | ||
| 51 | echo "Obsoletes: kernel-headers" | ||
| 52 | echo "Provides: kernel-headers = %{version}" | ||
| 53 | echo "%description headers" | ||
| 54 | echo "Kernel-headers includes the C header files that specify the interface" | ||
| 55 | echo "between the Linux kernel and userspace libraries and programs. The" | ||
| 56 | echo "header files define structures and constants that are needed for" | ||
| 57 | echo "building most standard programs and are also needed for rebuilding the" | ||
| 58 | echo "glibc package." | ||
| 59 | echo "" | ||
| 60 | echo "%package devel" | ||
| 61 | echo "Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel" | ||
| 62 | echo "Group: System Environment/Kernel" | ||
| 63 | echo "AutoReqProv: no" | ||
| 64 | echo "%description -n kernel-devel" | ||
| 65 | echo "This package provides kernel headers and makefiles sufficient to build modules" | ||
| 66 | echo "against the $__KERNELRELEASE kernel package." | ||
| 67 | echo "" | ||
| 68 | |||
| 69 | if ! $PREBUILT; then | ||
| 70 | echo "%prep" | ||
| 71 | echo "%setup -q" | ||
| 72 | echo "" | ||
| 73 | fi | 23 | fi |
| 74 | 24 | ||
| 75 | echo "%build" | 25 | if grep -q CONFIG_DRM=y .config; then |
| 76 | 26 | PROVIDES=kernel-drm | |
| 77 | if ! $PREBUILT; then | ||
| 78 | echo "make clean && make %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}" | ||
| 79 | echo "" | ||
| 80 | fi | 27 | fi |
| 81 | 28 | ||
| 82 | echo "%install" | 29 | PROVIDES="$PROVIDES kernel-$KERNELRELEASE" |
| 83 | echo 'KBUILD_IMAGE=$(make image_name)' | 30 | __KERNELRELEASE=$(echo $KERNELRELEASE | sed -e "s/-/_/g") |
| 84 | echo "%ifarch ia64" | 31 | EXCLUDES="$RCS_TAR_IGNORE --exclude=.tmp_versions --exclude=*vmlinux* \ |
| 85 | echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules' | 32 | --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation \ |
| 86 | echo "%else" | 33 | --exclude=.config.old --exclude=.missing-syscalls.d" |
| 87 | echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules' | ||
| 88 | echo "%endif" | ||
| 89 | |||
| 90 | echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{?_smp_mflags} KBUILD_SRC= modules_install' | ||
| 91 | echo "%ifarch ia64" | ||
| 92 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" | ||
| 93 | echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" | ||
| 94 | echo "%else" | ||
| 95 | echo "%ifarch ppc64" | ||
| 96 | echo "cp vmlinux arch/powerpc/boot" | ||
| 97 | echo "cp arch/powerpc/boot/"'$KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE" | ||
| 98 | echo "%else" | ||
| 99 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE" | ||
| 100 | echo "%endif" | ||
| 101 | echo "%endif" | ||
| 102 | |||
| 103 | echo 'make %{?_smp_mflags} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr KBUILD_SRC= headers_install' | ||
| 104 | echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" | ||
| 105 | |||
| 106 | echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" | ||
| 107 | |||
| 108 | echo "%ifnarch ppc64" | ||
| 109 | echo 'bzip2 -9 --keep vmlinux' | ||
| 110 | echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2" | ||
| 111 | echo "%endif" | ||
| 112 | |||
| 113 | if ! $PREBUILT; then | ||
| 114 | echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/build" | ||
| 115 | echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/source" | ||
| 116 | echo "mkdir -p "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE" | ||
| 117 | echo "EXCLUDES=\"$RCS_TAR_IGNORE --exclude .tmp_versions --exclude=*vmlinux* --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation --exclude .config.old --exclude .missing-syscalls.d\"" | ||
| 118 | echo "tar "'$EXCLUDES'" -cf- . | (cd "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE;tar xvf -)" | ||
| 119 | echo 'cd $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE" | ||
| 120 | echo "ln -sf /usr/src/kernels/$KERNELRELEASE build" | ||
| 121 | echo "ln -sf /usr/src/kernels/$KERNELRELEASE source" | ||
| 122 | fi | ||
| 123 | 34 | ||
| 124 | echo "" | 35 | # We can label the here-doc lines for conditional output to the spec file |
| 125 | echo "%clean" | 36 | # |
| 126 | echo 'rm -rf $RPM_BUILD_ROOT' | 37 | # Labels: |
| 127 | echo "" | 38 | # $S: this line is enabled only when building source package |
| 128 | echo "%post" | 39 | # $M: this line is enabled only when CONFIG_MODULES is enabled |
| 129 | echo "if [ -x /sbin/installkernel -a -r /boot/vmlinuz-$KERNELRELEASE -a -r /boot/System.map-$KERNELRELEASE ]; then" | 40 | sed -e '/^DEL/d' -e 's/^\t*//' <<EOF |
| 130 | echo "cp /boot/vmlinuz-$KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm" | 41 | Name: kernel |
| 131 | echo "cp /boot/System.map-$KERNELRELEASE /boot/.System.map-$KERNELRELEASE-rpm" | 42 | Summary: The Linux Kernel |
| 132 | echo "rm -f /boot/vmlinuz-$KERNELRELEASE /boot/System.map-$KERNELRELEASE" | 43 | Version: $__KERNELRELEASE |
| 133 | echo "/sbin/installkernel $KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm" | 44 | Release: $(cat .version 2>/dev/null || echo 1) |
| 134 | echo "rm -f /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm" | 45 | License: GPL |
| 135 | echo "fi" | 46 | Group: System Environment/Kernel |
| 136 | echo "" | 47 | Vendor: The Linux Community |
| 137 | echo "%preun" | 48 | URL: http://www.kernel.org |
| 138 | echo "if [ -x /sbin/new-kernel-pkg ]; then" | 49 | $S Source: kernel-$__KERNELRELEASE.tar.gz |
| 139 | echo "new-kernel-pkg --remove $KERNELRELEASE --rminitrd --initrdfile=/boot/initramfs-$KERNELRELEASE.img" | 50 | Provides: $PROVIDES |
| 140 | echo "fi" | 51 | %define __spec_install_post /usr/lib/rpm/brp-compress || : |
| 141 | echo "" | 52 | %define debug_package %{nil} |
| 142 | echo "%postun" | 53 | |
| 143 | echo "if [ -x /sbin/update-bootloader ]; then" | 54 | %description |
| 144 | echo "/sbin/update-bootloader --remove $KERNELRELEASE" | 55 | The Linux Kernel, the operating system core itself |
| 145 | echo "fi" | 56 | |
| 146 | echo "" | 57 | %package headers |
| 147 | echo "%files" | 58 | Summary: Header files for the Linux kernel for use by glibc |
| 148 | echo '%defattr (-, root, root)' | 59 | Group: Development/System |
| 149 | echo "/lib/modules/$KERNELRELEASE" | 60 | Obsoletes: kernel-headers |
| 150 | echo "%exclude /lib/modules/$KERNELRELEASE/build" | 61 | Provides: kernel-headers = %{version} |
| 151 | echo "%exclude /lib/modules/$KERNELRELEASE/source" | 62 | %description headers |
| 152 | echo "/boot/*" | 63 | Kernel-headers includes the C header files that specify the interface |
| 153 | echo "" | 64 | between the Linux kernel and userspace libraries and programs. The |
| 154 | echo "%files headers" | 65 | header files define structures and constants that are needed for |
| 155 | echo '%defattr (-, root, root)' | 66 | building most standard programs and are also needed for rebuilding the |
| 156 | echo "/usr/include" | 67 | glibc package. |
| 157 | echo "" | 68 | |
| 158 | if ! $PREBUILT; then | 69 | $S$M %package devel |
| 159 | echo "%files devel" | 70 | $S$M Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel |
| 160 | echo '%defattr (-, root, root)' | 71 | $S$M Group: System Environment/Kernel |
| 161 | echo "/usr/src/kernels/$KERNELRELEASE" | 72 | $S$M AutoReqProv: no |
| 162 | echo "/lib/modules/$KERNELRELEASE/build" | 73 | $S$M %description -n kernel-devel |
| 163 | echo "/lib/modules/$KERNELRELEASE/source" | 74 | $S$M This package provides kernel headers and makefiles sufficient to build modules |
| 164 | echo "" | 75 | $S$M against the $__KERNELRELEASE kernel package. |
| 165 | fi | 76 | $S$M |
| 77 | $S %prep | ||
| 78 | $S %setup -q | ||
| 79 | $S | ||
| 80 | $S %build | ||
| 81 | $S make %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release} | ||
| 82 | $S | ||
| 83 | %install | ||
| 84 | mkdir -p %{buildroot}/boot | ||
| 85 | %ifarch ia64 | ||
| 86 | mkdir -p %{buildroot}/boot/efi | ||
| 87 | cp \$(make image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE | ||
| 88 | ln -s efi/vmlinuz-$KERNELRELEASE %{buildroot}/boot/ | ||
| 89 | %else | ||
| 90 | cp \$(make image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE | ||
| 91 | %endif | ||
| 92 | $M make %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} KBUILD_SRC= modules_install | ||
| 93 | make %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr KBUILD_SRC= headers_install | ||
| 94 | cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE | ||
| 95 | cp .config %{buildroot}/boot/config-$KERNELRELEASE | ||
| 96 | bzip2 -9 --keep vmlinux | ||
| 97 | mv vmlinux.bz2 %{buildroot}/boot/vmlinux-$KERNELRELEASE.bz2 | ||
| 98 | $S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/build | ||
| 99 | $S$M rm -f %{buildroot}/lib/modules/$KERNELRELEASE/source | ||
| 100 | $S$M mkdir -p %{buildroot}/usr/src/kernels/$KERNELRELEASE | ||
| 101 | $S$M tar cf - . $EXCLUDES | tar xf - -C %{buildroot}/usr/src/kernels/$KERNELRELEASE | ||
| 102 | $S$M cd %{buildroot}/lib/modules/$KERNELRELEASE | ||
| 103 | $S$M ln -sf /usr/src/kernels/$KERNELRELEASE build | ||
| 104 | $S$M ln -sf /usr/src/kernels/$KERNELRELEASE source | ||
| 105 | |||
| 106 | %clean | ||
| 107 | rm -rf %{buildroot} | ||
| 108 | |||
| 109 | %post | ||
| 110 | if [ -x /sbin/installkernel -a -r /boot/vmlinuz-$KERNELRELEASE -a -r /boot/System.map-$KERNELRELEASE ]; then | ||
| 111 | cp /boot/vmlinuz-$KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm | ||
| 112 | cp /boot/System.map-$KERNELRELEASE /boot/.System.map-$KERNELRELEASE-rpm | ||
| 113 | rm -f /boot/vmlinuz-$KERNELRELEASE /boot/System.map-$KERNELRELEASE | ||
| 114 | /sbin/installkernel $KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm | ||
| 115 | rm -f /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm | ||
| 116 | fi | ||
| 117 | |||
| 118 | %preun | ||
| 119 | if [ -x /sbin/new-kernel-pkg ]; then | ||
| 120 | new-kernel-pkg --remove $KERNELRELEASE --rminitrd --initrdfile=/boot/initramfs-$KERNELRELEASE.img | ||
| 121 | fi | ||
| 122 | |||
| 123 | %postun | ||
| 124 | if [ -x /sbin/update-bootloader ]; then | ||
| 125 | /sbin/update-bootloader --remove $KERNELRELEASE | ||
| 126 | fi | ||
| 127 | |||
| 128 | %files | ||
| 129 | %defattr (-, root, root) | ||
| 130 | $M /lib/modules/$KERNELRELEASE | ||
| 131 | $M %exclude /lib/modules/$KERNELRELEASE/build | ||
| 132 | $M %exclude /lib/modules/$KERNELRELEASE/source | ||
| 133 | /boot/* | ||
| 134 | |||
| 135 | %files headers | ||
| 136 | %defattr (-, root, root) | ||
| 137 | /usr/include | ||
| 138 | $S$M | ||
| 139 | $S$M %files devel | ||
| 140 | $S$M %defattr (-, root, root) | ||
| 141 | $S$M /usr/src/kernels/$KERNELRELEASE | ||
| 142 | $S$M /lib/modules/$KERNELRELEASE/build | ||
| 143 | $S$M /lib/modules/$KERNELRELEASE/source | ||
| 144 | EOF | ||
