OpenWrt – Diff between revs 2 and 3
?pathlinks?
Rev 2 | Rev 3 | |||
---|---|---|---|---|
Line 38... | Line 38... | |||
38 | |
38 | |
|
39 | use strict; |
39 | use strict; |
|
Line 40... | Line 40... | |||
40 | use warnings; |
40 | use warnings; |
|
41 | |
41 | |
|
Line 42... | Line 42... | |||
42 | use Getopt::Long qw(:config no_ignore_case); |
42 | use Getopt::Long qw(:config no_ignore_case); |
|
43 | use File::Temp qw(tempfile); |
43 | use POSIX qw(tmpnam); |
|
44 | |
44 | |
|
45 | my($debug) = 0; |
45 | my($debug) = 0; |
|
Line 991... | Line 991... | |||
991 | # If we're creating an image and no RedBoot, SysConf partition is |
991 | # If we're creating an image and no RedBoot, SysConf partition is |
|
992 | # explicitly specified, simply write an empty one as the upgrade tools |
992 | # explicitly specified, simply write an empty one as the upgrade tools |
|
993 | # don't touch RedBoot and SysConf anyway. If no Trailer is specified, |
993 | # don't touch RedBoot and SysConf anyway. If no Trailer is specified, |
|
994 | # put in one. |
994 | # put in one. |
|
995 | if (not defined $redboot and not -e "RedBoot") { |
995 | if (not defined $redboot and not -e "RedBoot") { |
|
996 | $redboot = tempfile(); |
996 | $redboot = tmpnam(); |
|
997 | open TMP, ">$redboot" or die "Cannot open file $redboot: $!"; |
997 | open TMP, ">$redboot" or die "Cannot open file $redboot: $!"; |
|
998 | push @cleanup, $redboot; |
998 | push @cleanup, $redboot; |
|
999 | # The RedBoot partition is 256 * 1024 = 262144; the trailer we add |
999 | # The RedBoot partition is 256 * 1024 = 262144; the trailer we add |
|
1000 | # is 70 bytes. |
1000 | # is 70 bytes. |
|
1001 | print TMP "\0"x(262144-70); |
1001 | print TMP "\0"x(262144-70); |
|
Line 1004... | Line 1004... | |||
1004 | print TMP pack "S", $i; |
1004 | print TMP pack "S", $i; |
|
1005 | } |
1005 | } |
|
1006 | close TMP; |
1006 | close TMP; |
|
1007 | } |
1007 | } |
|
1008 | if (not defined $sysconf and not -e "SysConf") { |
1008 | if (not defined $sysconf and not -e "SysConf") { |
|
1009 | $sysconf = tempfile(); |
1009 | $sysconf = tmpnam(); |
|
1010 | open TMP, ">$sysconf" or die "Cannot open file $sysconf: $!"; |
1010 | open TMP, ">$sysconf" or die "Cannot open file $sysconf: $!"; |
|
1011 | push @cleanup, $sysconf; |
1011 | push @cleanup, $sysconf; |
|
1012 | # The SysConf partition is 128 * 1024 = 131072 |
1012 | # The SysConf partition is 128 * 1024 = 131072 |
|
1013 | print TMP "\0"x131072; |
1013 | print TMP "\0"x131072; |
|
1014 | close TMP; |
1014 | close TMP; |
|
1015 | } |
1015 | } |
|
1016 | if (not defined $trailer and not -e "Trailer") { |
1016 | if (not defined $trailer and not -e "Trailer") { |
|
1017 | $trailer = tempfile(); |
1017 | $trailer = tmpnam(); |
|
1018 | open TMP, ">$trailer" or die "Cannot open file $trailer: $!"; |
1018 | open TMP, ">$trailer" or die "Cannot open file $trailer: $!"; |
|
1019 | push @cleanup, $trailer; |
1019 | push @cleanup, $trailer; |
|
1020 | for my $i (@sercomm_flash_trailer) { |
1020 | for my $i (@sercomm_flash_trailer) { |
|
1021 | print TMP pack "S", $i; |
1021 | print TMP pack "S", $i; |
|
1022 | } |
1022 | } |