source: trunk/TOOLS/INTERNAL/FIXCODE@ 46

Last change on this file since 46 was 46, checked in by Ben Rietbroek, 11 years ago

Various Changes [2012-04-14]

WARNING!!

All commits upto and including the commit of [2012-05-13] contain
a severe bug!! Building from these sources and then disabling
the 'force LBA' feature while also using the drive-letter feature or
editing the label can DESTROY THE MBR on ALL ATTACHED DISKS!!
DO NOT DISABLE 'FORCE LBA USAGE' WHEN BUILT FROM THE THESE COMMITS!!

Changes

o Added BLDLEVEL support
o Enhanced Master Make
o Sanitized sources
o Support for Wasm and Masm6 (experimental)
o Renamed MBR_PROT.ASM to MBR-PROT.ASM
o Merged bitfield code Into Installer
o First steps for cross platform Installer
o More...

  • 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#
18exit 1;
19
20
21PROT_IMG="MBR-PROT/MBR-PROT.BIN"
22AB_INTERIM_IMG="AIR-BOOT.COM"
23AB_IMG="AIRBOOT.BIN"
24CODE_SIZE_OFFSET=16
25PROT_IMG_OFFSET=26624
26
27
28function echox() {
29 echo -e $@;
30}
31
32
33function Header() {
34 echox "\t## FIXCODE script for Linux ##";
35}
36
37function CheckIfFileExists() {
38 echox "\tCheckIfFileExists";
39 if [ ! -f "${1}" ]; then
40 echox "\tERROR: File ${1} could not be found !";
41 echox "\t Aborting...";
42 exit 1;
43 else
44 echox "\tFile ${1} found, OK.";
45 fi;
46}
47
48function CreateImage() {
49 echox "\tCreateImage";
50 cp -a "${1}" "${2}";
51}
52
53function EmbedCodeSize() {
54 echox "\tEmbedCodeSize";
55 echo "${1}"
56 echo -n "5" | dd of="${1}" bs=1 seek=${CODE_SIZE_OFFSET} conv=notrunc 2> /dev/null;
57}
58
59function EmbedProtectionImage() {
60 echox "\tEmbedProtectionImage";
61 dd if="${1}" of="${2}" bs=1 seek=${PROT_IMG_OFFSET} conv=notrunc 2> /dev/null;
62}
63
64function VerifyImage() {
65 echox "\tVerfyImage";
66}
67
68function Footer() {
69 echox "\t## AiR-BOOT code fixed ##";
70 echo "";
71}
72
73
74
75#
76# Main program logic.
77#
78function Main() {
79 echo "";
80 Header;
81 CheckIfFileExists "${PROT_IMG}";
82 CheckIfFileExists "${AB_INTERIM_IMG}";
83 CreateImage "${AB_INTERIM_IMG}" "${AB_IMG}";
84 EmbedProtectionImage "${PROT_IMG}" "${AB_IMG}";
85 EmbedCodeSize "${AB_IMG}";
86 Footer;
87}
88
89
90
91
92#
93# Invoke the main function.
94#
95Main;
Note: See TracBrowser for help on using the repository browser.