source: trunk/tools/internal/fixcode@ 57

Last change on this file since 57 was 57, checked in by Ben Rietbroek, 10 years ago

All source-files lowercased [v1.1.1-testing]

Some standard files like 'COPYING', 'LICENSE', etc. have not been
converted to lower case because they are usually distributed uppercased.

  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#!/bin/bash
2
3#
4# $airboot@ecomstation.com$
5#
6# This is a quick-hack until the Linux version of FIXCODE.C is finished.
7# Note that it does not search for the AiR-BOOT Protection Signature,
8# but embeds it at the 'well known' location.
9# If the protection image is moved, this script will produce a corrupted
10# AIRBOOT.BIN.
11# Also, a code-size of 35h (max size) is always inserted.
12# Furthermore, it does not do any sanity checks whatsoever.
13#
14
15#
16# This script is now obsolete.
17# Don't use since the MBR Protaction Image has moved !!
18#
19exit 1;
20
21
22PROT_IMG="MBR-PROT/MBR-PROT.BIN"
23AB_INTERIM_IMG="AIR-BOOT.COM"
24AB_IMG="AIRBOOT.BIN"
25CODE_SIZE_OFFSET=16
26PROT_IMG_OFFSET=26624
27
28
29function echox() {
30 echo -e $@;
31}
32
33
34function Header() {
35 echox "\t## FIXCODE script for Linux ##";
36}
37
38function CheckIfFileExists() {
39 echox "\tCheckIfFileExists";
40 if [ ! -f "${1}" ]; then
41 echox "\tERROR: File ${1} could not be found !";
42 echox "\t Aborting...";
43 exit 1;
44 else
45 echox "\tFile ${1} found, OK.";
46 fi;
47}
48
49function CreateImage() {
50 echox "\tCreateImage";
51 cp -a "${1}" "${2}";
52}
53
54function EmbedCodeSize() {
55 echox "\tEmbedCodeSize";
56 echo "${1}"
57 echo -n "5" | dd of="${1}" bs=1 seek=${CODE_SIZE_OFFSET} conv=notrunc 2> /dev/null;
58}
59
60function EmbedProtectionImage() {
61 echox "\tEmbedProtectionImage";
62 dd if="${1}" of="${2}" bs=1 seek=${PROT_IMG_OFFSET} conv=notrunc 2> /dev/null;
63}
64
65function VerifyImage() {
66 echox "\tVerfyImage";
67}
68
69function Footer() {
70 echox "\t## AiR-BOOT code fixed ##";
71 echo "";
72}
73
74
75
76#
77# Main program logic.
78#
79function Main() {
80 echo "";
81 Header;
82 CheckIfFileExists "${PROT_IMG}";
83 CheckIfFileExists "${AB_INTERIM_IMG}";
84 CreateImage "${AB_INTERIM_IMG}" "${AB_IMG}";
85 EmbedProtectionImage "${PROT_IMG}" "${AB_IMG}";
86 EmbedCodeSize "${AB_IMG}";
87 Footer;
88}
89
90
91
92
93#
94# Invoke the main function.
95#
96Main;
Note: See TracBrowser for help on using the repository browser.