brcm2708: switch to linux 4.4 and update patches
[openwrt.git] / target / linux / brcm2708 / patches-4.1 / 0199-scripts-mkknlimg-Improve-ARCH_BCM2835-detection.patch
1 From c4642b0df4db2191ee02094fab7044976778a531 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Thu, 8 Oct 2015 13:33:28 +0100
4 Subject: [PATCH 199/222] scripts/mkknlimg: Improve ARCH_BCM2835 detection
5
6 The board support code contains sufficient strings to be able to
7 distinguish 2708 vs. 2835 builds, so remove the check for
8 bcm2835-pm-wdt which could exist in either.
9
10 Also, since the canned configuration is no longer built in (it's
11 a module), remove the config string checking.
12
13 See: https://github.com/raspberrypi/linux/issues/1157
14 ---
15  scripts/mkknlimg | 41 +++++------------------------------------
16  1 file changed, 5 insertions(+), 36 deletions(-)
17
18 --- a/scripts/mkknlimg
19 +++ b/scripts/mkknlimg
20 @@ -50,12 +50,6 @@ if (! -r $kernel_file)
21      usage();
22  }
23  
24 -my @wanted_config_lines =
25 -(
26 -       'CONFIG_BCM2708_DT',
27 -       'CONFIG_ARCH_BCM2835'
28 -);
29 -
30  my @wanted_strings =
31  (
32         'bcm2708_fb',
33 @@ -63,7 +57,8 @@ my @wanted_strings =
34         'brcm,bcm2835-sdhost',
35         'brcm,bcm2708-pinctrl',
36         'brcm,bcm2835-gpio',
37 -       'brcm,bcm2835-pm-wdt'
38 +       'brcm,bcm2835',
39 +       'brcm,bcm2836'
40  );
41  
42  my $res = try_extract($kernel_file, $tmpfile1);
43 @@ -98,12 +93,11 @@ if ($res)
44             config_bool($res, 'brcm,bcm2835-mmc') ||
45             config_bool($res, 'brcm,bcm2835-sdhost'))
46         {
47 -           $dtok ||= config_bool($res, 'CONFIG_BCM2708_DT');
48 -           $dtok ||= config_bool($res, 'CONFIG_ARCH_BCM2835');
49             $dtok ||= config_bool($res, 'brcm,bcm2708-pinctrl');
50             $dtok ||= config_bool($res, 'brcm,bcm2835-gpio');
51 -           $is_283x ||= config_bool($res, 'CONFIG_ARCH_BCM2835');
52 -           $is_283x ||= config_bool($res, 'brcm,bcm2835-pm-wdt');
53 +           $is_283x ||= config_bool($res, 'brcm,bcm2835');
54 +           $is_283x ||= config_bool($res, 'brcm,bcm2836');
55 +           $dtok ||= $is_283x;
56             $append_trailer = 1;
57         }
58         else
59 @@ -205,31 +199,6 @@ sub try_extract
60             $res->{$match} = 1;
61         }
62  
63 -       my $config_pattern = '^('.join('|', @wanted_config_lines).')=(.*)$';
64 -       my $cf1 = 'IKCFG_ST\037\213\010';
65 -       my $cf2 = '0123456789';
66 -
67 -       my $pos = `tr "$cf1\n$cf2" "\n$cf2=" < "$knl" | grep -abo "^$cf2"`;
68 -       if ($pos)
69 -       {
70 -               $pos =~ s/:.*[\r\n]*$//s;
71 -               $pos += 8;
72 -               my $err = (system("tail -c+$pos \"$knl\" | zcat > $tmp 2> /dev/null") >> 8);
73 -               if (($err == 0) || ($err == 2))
74 -               {
75 -                       if (open(my $fh, '<', $tmp))
76 -                       {
77 -                               while (my $line = <$fh>)
78 -                               {
79 -                                       chomp($line);
80 -                                       $res->{$1} = $2 if ($line =~ /$config_pattern/);
81 -                               }
82 -
83 -                               close($fh);
84 -                       }
85 -               }
86 -       }
87 -
88         return $res;
89  }
90