Changeset 46 for trunk/TOOLS/INTERNAL/FIXCODE
- Timestamp:
- Apr 12, 2014, 8:23:32 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/TOOLS/INTERNAL/FIXCODE
r43 r46 4 4 # $airboot@ecomstation.com$ 5 5 # 6 # This is a hack until the Linux version of FIXCODE.C is finished.6 # This is a quick-hack until the Linux version of FIXCODE.C is finished. 7 7 # Note that it does not search for the AiR-BOOT Protection Signature, 8 8 # but embeds it at the 'well known' location. 9 # I t the protection image is moved, this script will corrupt AIR-BOOT.COM10 # of which the final AIRBOOT.BIN is derived.9 # If the protection image is moved, this script will produce a corrupted 10 # AIRBOOT.BIN. 11 11 # Also, a code-size of 35h (max size) is always inserted. 12 # Furthermore, it does no sanity checks whatsoever.12 # Furthermore, it does not do any sanity checks whatsoever. 13 13 # 14 14 15 PROT_IMG="MBR-PROT/MBR_PROT.COM" 15 # 16 # This script is now obsolete. 17 # 18 exit 1; 19 20 21 PROT_IMG="MBR-PROT/MBR-PROT.BIN" 16 22 AB_INTERIM_IMG="AIR-BOOT.COM" 23 AB_IMG="AIRBOOT.BIN" 17 24 CODE_SIZE_OFFSET=16 18 25 PROT_IMG_OFFSET=26624 19 26 20 27 28 function echox() { 29 echo -e $@; 30 } 31 32 21 33 function Header() { 22 echo "Header";34 echox "\t## FIXCODE script for Linux ##"; 23 35 } 24 36 25 37 function CheckIfFileExists() { 26 echo "CheckIfFileExists";38 echox "\tCheckIfFileExists"; 27 39 if [ ! -f "${1}" ]; then 28 echo "ERROR: File ${1} could not be found !";29 echo "Aborting...";40 echox "\tERROR: File ${1} could not be found !"; 41 echox "\t Aborting..."; 30 42 exit 1; 31 43 else 32 echo "File ${1} found, OK.";44 echox "\tFile ${1} found, OK."; 33 45 fi; 34 46 } 35 47 48 function CreateImage() { 49 echox "\tCreateImage"; 50 cp -a "${1}" "${2}"; 51 } 52 36 53 function EmbedCodeSize() { 37 echo "EmbedCodeSize"; 38 echo -n "5" | dd of="${1}" bs=1 seek=${CODE_SIZE_OFFSET} conv=notrunc; 54 echox "\tEmbedCodeSize"; 55 echo "${1}" 56 echo -n "5" | dd of="${1}" bs=1 seek=${CODE_SIZE_OFFSET} conv=notrunc 2> /dev/null; 39 57 } 40 58 41 59 function EmbedProtectionImage() { 42 echo "EmbedProtectionImage";43 dd if="${1}" of="${2}" bs=1 seek=${PROT_IMG_OFFSET} conv=notrunc ;60 echox "\tEmbedProtectionImage"; 61 dd if="${1}" of="${2}" bs=1 seek=${PROT_IMG_OFFSET} conv=notrunc 2> /dev/null; 44 62 } 45 63 46 64 function VerifyImage() { 47 echo "VerfyImage";65 echox "\tVerfyImage"; 48 66 } 49 67 50 68 function Footer() { 51 echo "Footer"; 69 echox "\t## AiR-BOOT code fixed ##"; 70 echo ""; 52 71 } 53 72 … … 58 77 # 59 78 function Main() { 60 echo "## Main ##";79 echo ""; 61 80 Header; 62 CheckIfFileExists "${PROT_IMG}" 63 CheckIfFileExists "${AB_INTERIM_IMG}" 64 EmbedCodeSize "${AB_INTERIM_IMG}"; 65 EmbedProtectionImage "${PROT_IMG}" "${AB_INTERIM_IMG}"; 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}"; 66 86 Footer; 67 87 }
Note:
See TracChangeset
for help on using the changeset viewer.