From ebfbb2ba9b5e78c8e658132435432c5118979f5c Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Mon, 4 Apr 2016 09:00:16 +0200 Subject: new bcm28xx-bootloader does not work with mknlimg, fix 4.1.20 rpi2 bootup --- scripts/mkknlimg | 275 ----------------------------- target/arm/Makefile | 5 - target/arm/kernel/raspberry-pi2 | 1 - target/config/Config.in.kernelversion | 1 - target/linux/config/Config.in.graphics | 5 + target/linux/config/Config.in.serial | 2 + target/linux/patches/4.1.20/realtime.patch | 5 - target/linux/patches/4.1.20/use-gawk.patch | 24 +++ 8 files changed, 31 insertions(+), 287 deletions(-) delete mode 100755 scripts/mkknlimg create mode 100644 target/linux/patches/4.1.20/use-gawk.patch diff --git a/scripts/mkknlimg b/scripts/mkknlimg deleted file mode 100755 index 3dff94899..000000000 --- a/scripts/mkknlimg +++ /dev/null @@ -1,275 +0,0 @@ -#!/usr/bin/env perl -# ---------------------------------------------------------------------- -# mkknlimg by Phil Elwell for Raspberry Pi -# based on extract-ikconfig by Dick Streefland -# -# (c) 2009,2010 Dick Streefland -# (c) 2014,2015 Raspberry Pi (Trading) Limited -# -# Licensed under the terms of the GNU General Public License. -# ---------------------------------------------------------------------- - -use strict; -use warnings; -use integer; - -my $trailer_magic = 'RPTL'; - -my $tmpfile1 = "/tmp/mkknlimg_$$.1"; -my $tmpfile2 = "/tmp/mkknlimg_$$.2"; - -my $dtok = 0; -my $is_283x = 0; - -while (@ARGV && ($ARGV[0] =~ /^-/)) -{ - my $arg = shift(@ARGV); - if ($arg eq '--dtok') - { - $dtok = 1; - } - elsif ($arg eq '--283x') - { - $is_283x = 1; - } - else - { - print ("* Unknown option '$arg'\n"); - usage(); - } -} - -usage() if (@ARGV != 2); - -my $kernel_file = $ARGV[0]; -my $out_file = $ARGV[1]; - -if (! -r $kernel_file) -{ - print ("* File '$kernel_file' not found\n"); - usage(); -} - -my @wanted_config_lines = -( - 'CONFIG_BCM2708_DT', - 'CONFIG_ARCH_BCM2835' -); - -my @wanted_strings = -( - 'bcm2708_fb', - 'brcm,bcm2835-mmc', - 'brcm,bcm2835-sdhost', - 'brcm,bcm2708-pinctrl', - 'brcm,bcm2835-gpio', - 'brcm,bcm2835-pm-wdt' -); - -my $res = try_extract($kernel_file, $tmpfile1); -$res = try_decompress('\037\213\010', 'xy', 'gunzip', 0, - $kernel_file, $tmpfile1, $tmpfile2) if (!$res); -$res = try_decompress('\3757zXZ\000', 'abcde', 'unxz --single-stream', -1, - $kernel_file, $tmpfile1, $tmpfile2) if (!$res); -$res = try_decompress('BZh', 'xy', 'bunzip2', 0, - $kernel_file, $tmpfile1, $tmpfile2) if (!$res); -$res = try_decompress('\135\0\0\0', 'xxx', 'unlzma', 0, - $kernel_file, $tmpfile1, $tmpfile2) if (!$res); -$res = try_decompress('\211\114\132', 'xy', 'lzop -d', 0, - $kernel_file, $tmpfile1, $tmpfile2) if (!$res); -$res = try_decompress('\002\041\114\030', 'xy', 'lz4 -d', 1, - $kernel_file, $tmpfile1, $tmpfile2) if (!$res); - -my $append_trailer; -my $trailer; -my $kver = '?'; - -$append_trailer = $dtok; - -if ($res) -{ - $kver = $res->{''} || '?'; - print("Version: $kver\n"); - - $append_trailer = $dtok; - if (!$dtok) - { - if (config_bool($res, 'bcm2708_fb') || - config_bool($res, 'brcm,bcm2835-mmc') || - config_bool($res, 'brcm,bcm2835-sdhost')) - { - $dtok ||= config_bool($res, 'CONFIG_BCM2708_DT'); - $dtok ||= config_bool($res, 'CONFIG_ARCH_BCM2835'); - $dtok ||= config_bool($res, 'brcm,bcm2708-pinctrl'); - $dtok ||= config_bool($res, 'brcm,bcm2835-gpio'); - $is_283x ||= config_bool($res, 'CONFIG_ARCH_BCM2835'); - $is_283x ||= config_bool($res, 'brcm,bcm2835-pm-wdt'); - $append_trailer = 1; - } - else - { - print ("* This doesn't look like a Raspberry Pi kernel. In pass-through mode.\n"); - } - } -} -elsif (!$dtok) -{ - print ("* Is this a valid kernel? In pass-through mode.\n"); -} - -if ($append_trailer) -{ - printf("DT: %s\n", $dtok ? "y" : "n"); - printf("283x: %s\n", $is_283x ? "y" : "n"); - - my @atoms; - - push @atoms, [ $trailer_magic, pack('V', 0) ]; - push @atoms, [ 'KVer', $kver ]; - push @atoms, [ 'DTOK', pack('V', $dtok) ]; - push @atoms, [ '283x', pack('V', $is_283x) ]; - - $trailer = pack_trailer(\@atoms); - $atoms[0]->[1] = pack('V', length($trailer)); - - $trailer = pack_trailer(\@atoms); -} - -my $ofh; -my $total_len = 0; - -if ($out_file eq $kernel_file) -{ - die "* Failed to open '$out_file' for append\n" - if (!open($ofh, '>>', $out_file)); - $total_len = tell($ofh); -} -else -{ - die "* Failed to open '$kernel_file'\n" - if (!open(my $ifh, '<', $kernel_file)); - die "* Failed to create '$out_file'\n" - if (!open($ofh, '>', $out_file)); - - my $copybuf; - while (1) - { - my $bytes = sysread($ifh, $copybuf, 64*1024); - last if (!$bytes); - syswrite($ofh, $copybuf, $bytes); - $total_len += $bytes; - } - close($ifh); -} - -if ($trailer) -{ - # Pad to word-alignment - syswrite($ofh, "\x000\x000\x000", (-$total_len & 0x3)); - syswrite($ofh, $trailer); -} - -close($ofh); - -exit($trailer ? 0 : 1); - -END { - unlink($tmpfile1) if ($tmpfile1); - unlink($tmpfile2) if ($tmpfile2); -} - - -sub usage -{ - print ("Usage: mkknlimg [--dtok] [--283x] \n"); - exit(1); -} - -sub try_extract -{ - my ($knl, $tmp) = @_; - - my $ver = `strings "$knl" | grep -a -E "^Linux version [1-9]"`; - - return undef if (!$ver); - - chomp($ver); - - my $res = { ''=>$ver }; - my $string_pattern = '^('.join('|', @wanted_strings).')$'; - - my @matches = `strings \"$knl\" | grep -E \"$string_pattern\"`; - foreach my $match (@matches) - { - chomp($match); - $res->{$match} = 1; - } - - my $config_pattern = '^('.join('|', @wanted_config_lines).')=(.*)$'; - my $cf1 = 'IKCFG_ST\037\213\010'; - my $cf2 = '0123456789'; - - my $pos = `tr "$cf1\n$cf2" "\n$cf2=" < "$knl" | grep -abo "^$cf2"`; - if ($pos) - { - $pos =~ s/:.*[\r\n]*$//s; - $pos += 8; - my $err = (system("tail -c+$pos \"$knl\" | zcat > $tmp 2> /dev/null") >> 8); - if (($err == 0) || ($err == 2)) - { - if (open(my $fh, '<', $tmp)) - { - while (my $line = <$fh>) - { - chomp($line); - $res->{$1} = $2 if ($line =~ /$config_pattern/); - } - - close($fh); - } - } - } - - return $res; -} - - -sub try_decompress -{ - my ($magic, $subst, $zcat, $idx, $knl, $tmp1, $tmp2) = @_; - - my $pos = `tr "$magic\n$subst" "\n$subst=" < "$knl" | grep -abo "^$subst"`; - if ($pos) - { - chomp($pos); - $pos = (split(/[\r\n]+/, $pos))[$idx]; - return undef if (!defined($pos)); - $pos =~ s/:.*[\r\n]*$//s; - my $cmd = "tail -c+$pos \"$knl\" | $zcat > $tmp2 2> /dev/null"; - my $err = (system($cmd) >> 8); - return undef if (($err != 0) && ($err != 2)); - - return try_extract($tmp2, $tmp1); - } - - return undef; -} - -sub pack_trailer -{ - my ($atoms) = @_; - my $trailer = pack('VV', 0, 0); - for (my $i = $#$atoms; $i>=0; $i--) - { - my $atom = $atoms->[$i]; - $trailer .= pack('a*x!4Va4', $atom->[1], length($atom->[1]), $atom->[0]); - } - return $trailer; -} - -sub config_bool -{ - my ($configs, $wanted) = @_; - my $val = $configs->{$wanted} || 'n'; - return (($val eq 'y') || ($val eq '1')); -} diff --git a/target/arm/Makefile b/target/arm/Makefile index 57f4fcd66..3184351e1 100644 --- a/target/arm/Makefile +++ b/target/arm/Makefile @@ -143,11 +143,6 @@ endif kernel-strip: @cp $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL) -ifeq ($(ADK_TARGET_BOARD_BCM28XX),y) - @echo adding DT trailer to kernel $(MAKE_TRACE) - -rm $(BUILD_DIR)/$(TARGET_KERNEL) - PATH='$(HOST_PATH)' $(ADK_TOPDIR)/scripts/mkknlimg --dtok $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL) $(MAKE_TRACE) -endif kernel-install: kernel-strip @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL) diff --git a/target/arm/kernel/raspberry-pi2 b/target/arm/kernel/raspberry-pi2 index b13819e32..dd55d7ddf 100644 --- a/target/arm/kernel/raspberry-pi2 +++ b/target/arm/kernel/raspberry-pi2 @@ -15,5 +15,4 @@ CONFIG_BCM2708_VCMEM=y CONFIG_MAILBOX=y CONFIG_BCM2835_MBOX=y CONFIG_OF=y -CONFIG_OF_OVERLAY=y CONFIG_CMDLINE_FROM_BOOTLOADER=y diff --git a/target/config/Config.in.kernelversion b/target/config/Config.in.kernelversion index fc8613df8..5297d51c9 100644 --- a/target/config/Config.in.kernelversion +++ b/target/config/Config.in.kernelversion @@ -12,7 +12,6 @@ config ADK_TARGET_KERNEL_VERSION_GIT config ADK_TARGET_KERNEL_VERSION_4_4_6 bool "4.4.6" - depends on !ADK_TARGET_BOARD_BCM28XX select ADK_TARGET_KERNEL_VERSION_4_4 config ADK_TARGET_KERNEL_VERSION_4_1_20 diff --git a/target/linux/config/Config.in.graphics b/target/linux/config/Config.in.graphics index f467bd165..969134a2c 100644 --- a/target/linux/config/Config.in.graphics +++ b/target/linux/config/Config.in.graphics @@ -127,6 +127,9 @@ config ADK_KERNEL_FB_SM501 config ADK_KERNEL_DRM bool +config ADK_KERNEL_DRM_VC4 + bool + config ADK_KERNEL_DRM_I915 bool @@ -240,6 +243,8 @@ config ADK_KERNEL_FB_SM7XX config ADK_KERNEL_FB_BCM2708 bool "Framebuffer support for BCM2835 boards" + select ADK_KERNEL_DRM if ADK_TARGET_KERNEL_VERSION_4_4 + select ADK_KERNEL_DRM_VC4 if ADK_TARGET_KERNEL_VERSION_4_4 select ADK_KERNEL_FB select ADK_KERNEL_FRAMEBUFFER_CONSOLE select ADK_KERNEL_FONT_8x16 diff --git a/target/linux/config/Config.in.serial b/target/linux/config/Config.in.serial index d274a2d6d..7e74e3bc8 100644 --- a/target/linux/config/Config.in.serial +++ b/target/linux/config/Config.in.serial @@ -163,6 +163,8 @@ config ADK_KERNEL_SERIAL_AMBA_PL011 bool "AMBA PL011 serial driver" select ADK_KERNEL_SERIAL_AMBA_PL011_CONSOLE select ADK_KERNEL_SERIAL_OF_PLATFORM + select ADK_KERNEL_SERIAL_8250 + select ADK_KERNEL_SERIAL_8250_CONSOLE depends on ADK_TARGET_BOARD_BCM28XX \ || ADK_TARGET_SYSTEM_QEMU_ARM_REALVIEW_EB_MPCORE \ || ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB \ diff --git a/target/linux/patches/4.1.20/realtime.patch b/target/linux/patches/4.1.20/realtime.patch index 9ea8309aa..6d8c2ac68 100644 --- a/target/linux/patches/4.1.20/realtime.patch +++ b/target/linux/patches/4.1.20/realtime.patch @@ -26274,11 +26274,6 @@ diff -Nur linux-4.1.20.orig/lib/strnlen_user.c linux-4.1.20/lib/strnlen_user.c * * Get the size of a NUL-terminated string in user space. * -diff -Nur linux-4.1.20.orig/localversion-rt linux-4.1.20/localversion-rt ---- linux-4.1.20.orig/localversion-rt 1970-01-01 01:00:00.000000000 +0100 -+++ linux-4.1.20/localversion-rt 2016-03-21 20:18:34.000000000 +0100 -@@ -0,0 +1 @@ -+-rt22 diff -Nur linux-4.1.20.orig/mm/Kconfig linux-4.1.20/mm/Kconfig --- linux-4.1.20.orig/mm/Kconfig 2016-03-17 19:11:03.000000000 +0100 +++ linux-4.1.20/mm/Kconfig 2016-03-21 20:18:34.000000000 +0100 diff --git a/target/linux/patches/4.1.20/use-gawk.patch b/target/linux/patches/4.1.20/use-gawk.patch new file mode 100644 index 000000000..5b312589d --- /dev/null +++ b/target/linux/patches/4.1.20/use-gawk.patch @@ -0,0 +1,24 @@ +diff -Nur linux-4.1.20.orig/Makefile linux-4.1.20/Makefile +--- linux-4.1.20.orig/Makefile 2016-03-17 19:11:03.000000000 +0100 ++++ linux-4.1.20/Makefile 2016-04-02 13:24:23.000000000 +0200 +@@ -359,7 +359,7 @@ + STRIP = $(CROSS_COMPILE)strip + OBJCOPY = $(CROSS_COMPILE)objcopy + OBJDUMP = $(CROSS_COMPILE)objdump +-AWK = awk ++AWK = gawk + GENKSYMS = scripts/genksyms/genksyms + INSTALLKERNEL := installkernel + DEPMOD = /sbin/depmod +diff -Nur linux-4.1.20.orig/lib/raid6/test/Makefile linux-4.1.20/lib/raid6/test/Makefile +--- linux-4.1.20.orig/lib/raid6/test/Makefile 2016-03-17 19:11:03.000000000 +0100 ++++ linux-4.1.20/lib/raid6/test/Makefile 2016-04-02 09:45:15.000000000 +0200 +@@ -7,7 +7,7 @@ + OPTFLAGS = -O2 # Adjust as desired + CFLAGS = -I.. -I ../../../include -g $(OPTFLAGS) + LD = ld +-AWK = awk -f ++AWK = gawk -f + AR = ar + RANLIB = ranlib + OBJS = int1.o int2.o int4.o int8.o int16.o int32.o recov.o algos.o tables.o -- cgit v1.2.3