NC1000FirmwareGenerator

This script creates firmware suitable for all devices using the W90N740 chipset including the NC1000-W10 and NC1200.

#!/usr/bin/perl

if ($#ARGV != 1) {
        print "Usage: $0 linux.zip romfs.img > output.bin";
        die;
}

my $linux = $ARGV[0];
my $romfs = $ARGV[1];

if ( ! -f $linux or ! -f $romfs ) {
        die "both files must exist";
}

print "BNEG";
print pack('I', 1);
print pack('I', 1);

my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
 $atime,$mtime,$ctime,$blksize,$blocks) = stat($linux);
print pack('I', $size);

($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
 $atime,$mtime,$ctime,$blksize,$blocks) = stat($romfs);
print pack('I', $size);

foreach my $file (($linux, $romfs)) {
        open(FH, "<". $file);
        while(<FH>) {
                print $_;
        }
        close(FH);
}

Category:Embedded

Copyright © Kenny Root. All rights reserved.