~jderose/ubuntu/raring/qemu/vde-again

« back to all changes in this revision

Viewing changes to pc-bios/optionrom/signrom.sh

  • Committer: Bazaar Package Importer
  • Author(s): Riku Voipio, Josh Triplett, Riku Voipio
  • Date: 2009-07-29 13:28:05 UTC
  • mfrom: (1.4.1 upstream)
  • mto: (12.1.1 sid) (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20090729132805-cau7rfexh7dawyb8
Tags: 0.10.50+git20090729-1
[ Josh Triplett ]
* Remove myself from Uploaders.

[ Riku Voipio ]
* new upstream RC version
* nuke all linux-user patches (applied upstream)
  06_exit_segfault
  12_signal_powerpc_support
  21_net_soopts
  30_syscall_ipc
  32_syscall_sysctl
  35_syscall_sockaddr
  48_signal_terminate
  55_unmux_socketcall
* nuke all other applied-upstream patches
  01_nostrip (better version upstream)
  07_i386_exec_name (can be reintroduced in debian/rules)
  50_linuxbios_isa_bios_ram (shouldn't be needed anymore)
  51_linuxbios_piix_ram_size (applied)
  56_dhcp (crap)
  60_ppc_ld (reintroduce if needed)
  64_ppc_asm_constraints (ditto)
  66_tls_ld.patch (ditto)
  81_compile_dtb.patch (applied upstream)
  82_qemu-img_decimal (ditto)
* move to git
* simplify build rules
* Correct my email address

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
# Option ROM Signing utility
 
4
#
 
5
# This program is free software; you can redistribute it and/or modify
 
6
# it under the terms of the GNU General Public License as published by
 
7
# the Free Software Foundation; either version 2 of the License, or
 
8
# (at your option) any later version.
 
9
#
 
10
# This program is distributed in the hope that it will be useful,
 
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
13
# GNU General Public License for more details.
 
14
#
 
15
# You should have received a copy of the GNU General Public License
 
16
# along with this program; if not, see <http://www.gnu.org/licenses/>.
 
17
#
 
18
# Copyright Novell Inc, 2009
 
19
#   Authors: Alexander Graf <agraf@suse.de>
 
20
#
 
21
# Syntax: signrom.sh <input> <output>
 
22
 
 
23
# did we get proper arguments?
 
24
test "$1" -a "$2" || exit 1
 
25
 
 
26
sum=0
 
27
 
 
28
# find out the file size
 
29
x=`dd if="$1" bs=1 count=1 skip=2 2>/dev/null | od -t u1 -A n`
 
30
#size=`expr $x \* 512 - 1`
 
31
size=$(( $x * 512 - 1 ))
 
32
 
 
33
# now get the checksum
 
34
nums=`od -A n -t u1 -v "$1"`
 
35
for i in ${nums}; do
 
36
    # add each byte's value to sum
 
37
    sum=`expr $sum + $i`
 
38
done
 
39
 
 
40
sum=$(( $sum % 256 ))
 
41
sum=$(( 256 - $sum ))
 
42
 
 
43
# and write the output file
 
44
cp "$1" "$2"
 
45
printf "\\$sum" | dd of="$2" bs=1 count=1 seek=$size conv=notrunc 2>/dev/null