| 1 | // AiR-BOOT (c) Copyright 1998-2009 M. Kiewitz | 
|---|
| 2 | // | 
|---|
| 3 | // This file is part of AiR-BOOT | 
|---|
| 4 | // | 
|---|
| 5 | // AiR-BOOT is free software: you can redistribute it and/or modify it under | 
|---|
| 6 | //  the terms of the GNU General Public License as published by the Free | 
|---|
| 7 | //  Software Foundation, either version 3 of the License, or (at your option) | 
|---|
| 8 | //  any later version. | 
|---|
| 9 | // | 
|---|
| 10 | // AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY | 
|---|
| 11 | //  WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS | 
|---|
| 12 | //  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | 
|---|
| 13 | //  details. | 
|---|
| 14 | // | 
|---|
| 15 | // You should have received a copy of the GNU General Public License along with | 
|---|
| 16 | //  AiR-BOOT. If not, see <http://www.gnu.org/licenses/>. | 
|---|
| 17 | // | 
|---|
| 18 |  | 
|---|
| 19 |  | 
|---|
| 20 | /* | 
|---|
| 21 | // Include the version information for BLDLEVEL. | 
|---|
| 22 | // This information is common to all built executables. | 
|---|
| 23 | */ | 
|---|
| 24 | #include "../../include/version.h" | 
|---|
| 25 |  | 
|---|
| 26 | //char    bldlevel[] = "@#KIEWITZ:1.0.8#@##1## 2011/01/17 21:10:00      ecs-devbox:ASD123:L:C:8::99@@  Adapter Driver for PATA/SATA DASD"; | 
|---|
| 27 | char    bldlevel[]  =   "@#"\ | 
|---|
| 28 | BLDLVL_VENDOR":"\ | 
|---|
| 29 | BLDLVL_MAJOR_VERSION"."\ | 
|---|
| 30 | BLDLVL_MIDDLE_VERSION"."\ | 
|---|
| 31 | BLDLVL_MINOR_VERSION"#@##1## "\ | 
|---|
| 32 | BLDLVL_YEAR"/"\ | 
|---|
| 33 | BLDLVL_MONTH"/"\ | 
|---|
| 34 | BLDLVL_DAY" "\ | 
|---|
| 35 | BLDLVL_HOURS":"\ | 
|---|
| 36 | BLDLVL_MINUTES":"\ | 
|---|
| 37 | BLDLVL_SECONDS"      "\ | 
|---|
| 38 | BLDLVL_MACHINE"::"\ | 
|---|
| 39 | BLDLVL_LANGUAGE"::"\ | 
|---|
| 40 | BLDLVL_MINOR_VERSION"::@@"\ | 
|---|
| 41 | "Installer for the AiR-BOOT Boot Manager"; | 
|---|
| 42 |  | 
|---|
| 43 |  | 
|---|
| 44 | /* | 
|---|
| 45 | // Platform dependent defines and includes. | 
|---|
| 46 | */ | 
|---|
| 47 | #if defined(__DOS__) | 
|---|
| 48 | // DOS platform | 
|---|
| 49 | #define PLATFORM_DOS | 
|---|
| 50 | #define PLATFORM_NAME   "DOS" | 
|---|
| 51 | // We use the OS/2 v1.x definitions like CHAR etc. | 
|---|
| 52 | #include    <os2def.h> | 
|---|
| 53 | #elif defined(__OS2__) && !defined(OS2) | 
|---|
| 54 | // OS/2 platform | 
|---|
| 55 | #define     PLATFORM_OS2 | 
|---|
| 56 | #define     PLATFORM_NAME   "OS/2" | 
|---|
| 57 | #define     INCL_NOPMAPI | 
|---|
| 58 | #define     INCL_BASE | 
|---|
| 59 | #define     INCL_DOS | 
|---|
| 60 | #define     INCL_DOSDEVIOCTL | 
|---|
| 61 | #include    <os2.h> | 
|---|
| 62 | #include    <malloc.h> | 
|---|
| 63 | #elif defined(__NT__) | 
|---|
| 64 | // Win32 platform | 
|---|
| 65 | #define     PLATFORM_WINNT | 
|---|
| 66 | #define     PLATFORM_NAME   "Windows NT/2K/XP/Vista/7" | 
|---|
| 67 | #include    <windows.h> | 
|---|
| 68 |  | 
|---|
| 69 | #elif defined(__LINUX__) | 
|---|
| 70 | // Linux platform | 
|---|
| 71 | #define     PLATFORM_LINUX | 
|---|
| 72 | #define     PLATFORM_NAME   "Linux" | 
|---|
| 73 | // We use the OS/2 v2.x definitions like CHAR etc. | 
|---|
| 74 | #include    <os2def.h> | 
|---|
| 75 | #else | 
|---|
| 76 | #error Unsupported platform | 
|---|
| 77 | #endif | 
|---|
| 78 |  | 
|---|
| 79 |  | 
|---|
| 80 | /* | 
|---|
| 81 | // Standard header files. | 
|---|
| 82 | */ | 
|---|
| 83 | #include    <stdlib.h> | 
|---|
| 84 | #include    <ctype.h> | 
|---|
| 85 | #include    <stdio.h> | 
|---|
| 86 | #include    <conio.h> | 
|---|
| 87 | #include    <string.h> | 
|---|
| 88 | #include    <i86.h> | 
|---|
| 89 |  | 
|---|
| 90 |  | 
|---|
| 91 | #define     STATUS_NOTINSTALLED     0 // No ID found | 
|---|
| 92 | #define     STATUS_CORRUPT          1 // ID found, Checksum failure | 
|---|
| 93 | #define     STATUS_INSTALLED        2 // ID found, Checksum valid | 
|---|
| 94 | #define     STATUS_INSTALLEDMGU     3 // ID found, Checksum valid, may get updated | 
|---|
| 95 | #define     STATUS_IMPOSSIBLE       4 // Unable/Not willing to install | 
|---|
| 96 |  | 
|---|
| 97 | /* Rousseau: added */ | 
|---|
| 98 | #define     IMAGE_NAME              "airboot.bin" | 
|---|
| 99 | #define     GPT                     0xEE                                // GPT Disk, AiR-BOOT will abort | 
|---|
| 100 | #define     BYTES_PER_SECTOR        512                                 // This could be higher in the future | 
|---|
| 101 | #define     IMAGE_SIZE_60SECS       30720                               // Normal image-size    (max. 30 partitions) | 
|---|
| 102 | #define     IMAGE_SIZE_62SECS       31744                               // Extended image-size  (max. 45 partitions) | 
|---|
| 103 | //#define     IMAGE_SIZE              IMAGE_SIZE_60SECS                   // Use the normal image | 
|---|
| 104 | #define     IMAGE_SIZE              IMAGE_SIZE_62SECS                   // Use the extended image | 
|---|
| 105 | #define     SECTOR_COUNT            IMAGE_SIZE / BYTES_PER_SECTOR       // Size of the image in sectors | 
|---|
| 106 | #define     CONFIG_OFFSET           0x6C00                              // Byte offset of config-sector | 
|---|
| 107 | #define     SECTORS_BEFORE_CONFIG   CONFIG_OFFSET / BYTES_PER_SECTOR    // Nr of sectors before config-sector | 
|---|