mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-01-03 07:42:10 +01:00
- 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
56 lines
1.4 KiB
Perl
Executable File
56 lines
1.4 KiB
Perl
Executable File
#!/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);
|
|
|