<?php

chdir(dirname(__FILE__));
$f = file_get_contents("boot0.bin") . file_get_contents("arcfw.bin");
$f = $f . str_repeat("\x00", 0x40000 - 4 - strlen($f));

// calculate checksum
$arr = array_values(unpack("V*", $f));

$i = 0;
foreach ($arr as $elem) $i += $elem;
$i = (0 - $i) & 0xffffffff;

$f = $f . pack("V*", $i);
file_put_contents("ntprom.bin", $f);