ipq40xx: add support for the ZyXEL NBG6617
[openwrt/staging/wigyori.git] / scripts / slugimage.pl
index 3d2735d0f13049b62f169bf6526bb206af656cc1..8c0654d4f6f5e373646589e33fa438f0454bccf6 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 # 
 # SlugImage : Manipulate NSLU2 firmware images
 #             Dwayne Fontenot (jacques)
@@ -40,7 +40,7 @@ use strict;
 use warnings;
 
 use Getopt::Long qw(:config no_ignore_case);
-use POSIX qw(tmpnam);
+use File::Temp qw(tempfile);
 
 my($debug) = 0;
 my($quiet) = 0;
@@ -920,7 +920,7 @@ sub defaultPartitions {
             'offset'=>0x007f8000,        'size'=>0x00004000,
             'variable'=>0, 'header'=>0,  'pseudo'=>1, 'data'=>undef, 'byteswap'=>0},
            {'name'=>'Microcode',         'file'=>'NPE-B',
-            'offset'=>0x007fc000,        'size'=>0x00003000,
+            'offset'=>0x007fc000,        'size'=>0x00003fe0,
             'variable'=>0, 'header'=>16, 'pseudo'=>1, 'data'=>undef, 'byteswap'=>0},
            {'name'=>'Trailer',           'file'=>'Trailer',
             'offset'=>0x007ffff0,        'size'=>0x00000010,
@@ -993,7 +993,7 @@ if ($pack) {
     # don't touch RedBoot and SysConf anyway.  If no Trailer is specified,
     # put in one.
     if (not defined $redboot and not -e "RedBoot") {
-       $redboot = tmpnam();
+       $redboot = tempfile();
        open TMP, ">$redboot" or die "Cannot open file $redboot: $!";
        push @cleanup, $redboot;
        # The RedBoot partition is 256 * 1024 = 262144; the trailer we add
@@ -1006,7 +1006,7 @@ if ($pack) {
        close TMP;
     }
     if (not defined $sysconf and not -e "SysConf") {
-       $sysconf = tmpnam();
+       $sysconf = tempfile();
        open TMP, ">$sysconf" or die "Cannot open file $sysconf: $!";
        push @cleanup, $sysconf;
        # The SysConf partition is 128 * 1024 = 131072
@@ -1014,7 +1014,7 @@ if ($pack) {
        close TMP;
     }
     if (not defined $trailer and not -e "Trailer") {
-       $trailer = tmpnam();
+       $trailer = tempfile();
        open TMP, ">$trailer" or die "Cannot open file $trailer: $!";
        push @cleanup, $trailer;
        for my $i (@sercomm_flash_trailer) {