Commit e3f782c6 authored by Ryan Jackson's avatar Ryan Jackson

Modified tbbootconfig to support booting from another partition on the boot...

Modified tbbootconfig to support booting from another partition on the boot device as well as any disk the bios recognizes, in addition to the current behavior.
parent 14f27a8d
......@@ -28,6 +28,7 @@ static char *usagestr =
" -d Turn on debugging.\n"
" -v Verify and exit with status; Do not print anything\n"
" -p Purge the header block (write zeros)\n"
" -b biosdev Specify the BIOS device to boot from\n"
" -w filename Write system config to header block from file\n"
" -r filename Read system config from header block and write to file\n"
" -k 0,# Set the bootfromdisk flag to either 0 or a DOS part#\n"
......@@ -55,6 +56,7 @@ main(argc, argv)
int rval, ch, devfd;
tbboot_t tbboot_hdr;
int bootfromcdrom = -1, bootfromdisk = -1, validimage = -1;
int bootdisk = 0xff;
char *configfile = NULL, *emulabkey = NULL;
int readconfig = 0, writeconfig = 0;
......@@ -70,7 +72,7 @@ main(argc, argv)
exit(-1);
}
while ((ch = getopt(argc, argv, "fidk:c:vm:r:w:pe:")) != -1)
while ((ch = getopt(argc, argv, "fidk:c:vm:r:w:pe:b:")) != -1)
switch(ch) {
case 'i':
info++;
......@@ -87,6 +89,11 @@ main(argc, argv)
case 'p':
purge++;
break;
case 'b':
bootdisk = strtoul(optarg, NULL, 16);
if (bootdisk < 0 || bootdisk > 255)
usage();
break;
case 'k':
bootfromdisk = atoi(optarg);
if (bootfromdisk < 0 || bootfromdisk > 255)
......@@ -162,6 +169,8 @@ main(argc, argv)
if (validimage != -1)
tbboot_hdr.validimage = validimage;
tbboot_hdr.bootdisk = bootdisk;
if (emulabkey) {
if (strlen(emulabkey) > TBBOOT_MAXKEYLEN - 1) {
warnx("Key is longer that %d chars!",
......
......@@ -43,6 +43,13 @@ typedef struct tbboot_header
unsigned long magic1;
short version;
/*
* BIOS device number to boot from, with two magic values:
* - 0xfe means the boot device (CD or USB dongle)
* - 0xff means the disk on which this sector is found
*/
unsigned char bootdisk;
/*
* Set bootfromdisk to 1 to force loader to boot from disk.
*/
......@@ -99,7 +106,7 @@ typedef struct tbboot_header
#define TBBOOT_MAGIC2 0x69ceafd8
/* Current Version */
#define TBBOOT_VERSION 100
#define TBBOOT_VERSION 101
/*
* Offset from start of the disk. Hardwired to sector 60 which should be
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment