aboutsummaryrefslogtreecommitdiffstats
path: root/main/linux-rpi/markdt
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2015-04-20 10:32:47 +0000
committerTimo Teräs <timo.teras@iki.fi>2015-04-20 10:32:47 +0000
commitb97562ef0960333e5fd0cabfd2e9715ad21bf34d (patch)
treeec8bca6ed885358cc95fc17c76496583b9b76f9c /main/linux-rpi/markdt
parent4a57461cac5e4a17a4bd1f09ae30cbae2ab0fd18 (diff)
downloadaports-b97562ef0960333e5fd0cabfd2e9715ad21bf34d.tar.bz2
aports-b97562ef0960333e5fd0cabfd2e9715ad21bf34d.tar.xz
main/linux-rpi: update patch snapshot, and device tree fixes
- rpi bootloader needs specially marked binaries for device tree so use trimmed down markdt script to do it - move overlay dtbs to overlays subdirectory - make af_packet a module
Diffstat (limited to 'main/linux-rpi/markdt')
-rwxr-xr-xmain/linux-rpi/markdt55
1 files changed, 55 insertions, 0 deletions
diff --git a/main/linux-rpi/markdt b/main/linux-rpi/markdt
new file mode 100755
index 0000000000..36b1ca6bc7
--- /dev/null
+++ b/main/linux-rpi/markdt
@@ -0,0 +1,55 @@
+#!/usr/bin/env perl
+
+# ----------------------------------------------------------------------
+# markdt by Timo Teräs
+# based on mkknlimg by Phil Elwell for Raspberry Pi
+# based on extract-ikconfig Dick Streefland
+#
+# (c) 2009,2010 Dick Streefland <dick@streefland.net>
+# (c) 2014,2015 Raspberry Pi (Trading) Limited <info@raspberrypi.org>
+# (c) 2015 Timo Teräs <timo.teras@iki.fi>
+#
+# Licensed under the terms of the GNU General Public License.
+# ----------------------------------------------------------------------
+
+use strict;
+use integer;
+
+usage() if (@ARGV != 1);
+
+my $out_file = $ARGV[0];
+my $trailer_magic = 'RPTL';
+my $trailer;
+my $dtok = 1;
+my $ofh;
+my $total_len = 0;
+
+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;
+}
+
+# Construct the trailer
+my @atoms;
+push @atoms, [ $trailer_magic, pack('V', 0) ];
+push @atoms, [ 'DTOK', pack('V', $dtok) ];
+
+$trailer = pack_trailer(\@atoms);
+$atoms[0]->[1] = pack('V', length($trailer));
+$trailer = pack_trailer(\@atoms);
+
+# Write the trailer aligned to 4-byte boundary
+die "* Failed to open '$out_file' for append\n" if (!open($ofh, '>>', $out_file));
+$total_len = tell($ofh);
+syswrite($ofh, "\x000\x000\x000", (-$total_len & 0x3));
+syswrite($ofh, $trailer);
+close($ofh);
+exit(0);
+