OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

[/] [eco32/] [trunk/] [disk/] [tools/] [mkmboot/] [stage2/] [mboot.c] - Diff between revs 86 and 87

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 86 Rev 87
Line 7... Line 7...
#include "biolib.h"
#include "biolib.h"
 
 
 
 
#define DEFAULT_PARTITION       ""      /* default boot partition number */
#define DEFAULT_PARTITION       ""      /* default boot partition number */
 
 
 
#define LOAD_ADDR               0xC0010000
 
 
#define LINE_SIZE               80
#define LINE_SIZE               80
#define SECTOR_SIZE             512
#define SECTOR_SIZE             512
#define NPE                     (SECTOR_SIZE / sizeof(PartEntry))
#define NPE                     (SECTOR_SIZE / sizeof(PartEntry))
#define DESCR_SIZE              20
#define DESCR_SIZE              20
 
 
Line 251... Line 253...
    if ((ptr[part].type & 0x80000000) == 0) {
    if ((ptr[part].type & 0x80000000) == 0) {
      printf("partition %d is not bootable\n", part);
      printf("partition %d is not bootable\n", part);
      continue;
      continue;
    }
    }
    /* load boot sector of selected partition */
    /* load boot sector of selected partition */
    readDisk(ptr[part].start, (unsigned char *) 0xC0010000, 1);
    readDisk(ptr[part].start, (unsigned char *) LOAD_ADDR, 1);
    /* check for signature */
    /* check for signature */
    if ((*((unsigned char *) 0xC0010000 + SECTOR_SIZE - 2) != 0x55) ||
    if ((*((unsigned char *) LOAD_ADDR + SECTOR_SIZE - 2) != 0x55) ||
        (*((unsigned char *) 0xC0010000 + SECTOR_SIZE - 1) != 0xAA)) {
        (*((unsigned char *) LOAD_ADDR + SECTOR_SIZE - 1) != 0xAA)) {
      printf("boot sector of partition %d has no signature\n", part);
      printf("boot sector of partition %d has no signature\n", part);
      continue;
      continue;
    }
    }
    /* we have a valid boot sector, leave loop */
    /* we have a valid boot sector, leave loop */
    break;
    break;
  }
  }
  /* boot manager finished, now go executing loaded boot sector */
  /* boot manager finished, now go executing loaded boot sector */
  startSector = ptr[part].start;
  startSector = ptr[part].start;
  numSectors = ptr[part].size;
  numSectors = ptr[part].size;
  entryPoint = 0xC0010000;
  entryPoint = LOAD_ADDR;
  return 0;
  return 0;
}
}
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.