patches/linux/3.0/100-headers_install-fix-__packed-in-exported-kernel-head.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon Dec 12 21:41:16 2011 +0200 (2011-12-12)
branch1.13
changeset 2845 0dc9d4931246
permissions -rw-r--r--
scripts: unset CONFIG_SITE

Some distributions (eg. openSUSE 12.1) systematically export
the CONFIG_SITE environment variable to point to a custom
script setting misc paths for ./configure.

This can, and does, break when cross-compiling for architectures
that are not supported by this script.

The simple workaround is to unset this variable.
NB: buildroot has a similar fix:
http://git.buildroot.org/buildroot/commit/?id=12c9f7dd6dee9c6029b4f9a12d6aac1516911ab4

Reported-by: Trevor Woerner <twoerner@gmail.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
(transplanted from 21f4f28e60ec0342133086c9a51e7f0e5b181fb8)
yann@2736
     1
commit f210735fe2f17a6225432ee3d1239bcf23a8659c
yann@2736
     2
Author: Markus Trippelsdorf <markus@trippelsdorf.de>
yann@2736
     3
Date:   Fri Jun 24 15:51:00 2011 +0200
yann@2736
     4
yann@2736
     5
    headers_install: fix __packed in exported kernel headers
yann@2736
     6
    
yann@2736
     7
    checkpatch.pl warns about using __attribute__((packed)) in kernel
yann@2736
     8
    headers: "__packed is preferred over __attribute__((packed))". If one
yann@2736
     9
    follows that advice it could cause problems in the exported header
yann@2736
    10
    files, because the outside world doesn't know about this shortcut.
yann@2736
    11
    
yann@2736
    12
    For example busybox will fail to compile:
yann@2736
    13
     CC      miscutils/ubi_attach_detach.o
yann@2736
    14
     In file included from miscutils/ubi_attach_detach.c:27:0:
yann@2736
    15
     /usr/include/mtd/ubi-user.h:330:3: error: conflicting types for ‘__packed’
yann@2736
    16
     /usr/include/mtd/ubi-user.h:314:3: note: previous declaration of ‘__packed’ was here
yann@2736
    17
    ...
yann@2736
    18
    
yann@2736
    19
    Fix the problem by substituting __packed with __attribute__((packed)) in
yann@2736
    20
    the header_install.pl script.
yann@2736
    21
    
yann@2736
    22
    Cc: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
yann@2736
    23
    CC: Joe Perches <joe@perches.com>
yann@2736
    24
    Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de>
yann@2736
    25
    Signed-off-by: Michal Marek <mmarek@suse.cz>
yann@2736
    26
yann@2736
    27
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
yann@2736
    28
index efb3be1..48462be 100644
yann@2736
    29
--- a/scripts/headers_install.pl
yann@2736
    30
+++ b/scripts/headers_install.pl
yann@2736
    31
@@ -35,6 +35,7 @@ foreach my $file (@files) {
yann@2736
    32
 		$line =~ s/([\s(])__iomem\s/$1/g;
yann@2736
    33
 		$line =~ s/\s__attribute_const__\s/ /g;
yann@2736
    34
 		$line =~ s/\s__attribute_const__$//g;
yann@2736
    35
+		$line =~ s/\b__packed\b/__attribute__((packed))/g;
yann@2736
    36
 		$line =~ s/^#include <linux\/compiler.h>//;
yann@2736
    37
 		$line =~ s/(^|\s)(inline)\b/$1__$2__/g;
yann@2736
    38
 		$line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g;