Index: branches/ErmaC/Enoch/i386/libsaio/sys.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/sys.c (revision 2524) +++ branches/ErmaC/Enoch/i386/libsaio/sys.c (revision 2525) @@ -44,21 +44,16 @@ * where everything is defaulted * Add routine, ptol(), to parse partition letters. * - */ - -/* * Copyright (c) 1982, 1986 Regents of the University of California. * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * * @(#)sys.c 7.1 (Berkeley) 6/5/86 + * + * Copyright 2007 VMware Inc. "Preboot" ramdisk support added by David Elliott + * */ -/* Copyright 2007 VMware Inc. - "Preboot" ramdisk support added by David Elliott - */ - - #include "libsaio.h" #include "boot.h" #include "bootstruct.h" @@ -88,7 +83,8 @@ extern int multiboot_skip_partition; extern int multiboot_skip_partition_set; -struct devsw { +struct devsw +{ const char * name; // size increased from char to short to handle non-BIOS internal devices unsigned short biosdev; @@ -121,6 +117,11 @@ void * gFSLoadAddress = 0; +#define LP '(' +#define RP ')' + +int gBIOSDev; + // Turbo - save what we think is our original BIOS boot volume if we have one 0xab BVRef gBIOSBootVolume = NULL; BVRef gBootVolume; @@ -130,30 +131,30 @@ //========================================================================== // LoadVolumeFile - LOW-LEVEL FILESYSTEM FUNCTION. -// Load the specified file from the specified volume -// to the load buffer at LOAD_ADDR. -// If the file is fat, load only the i386 portion. +// Load the specified file from the specified volume +// to the load buffer at LOAD_ADDR. +// If the file is fat, load only the i386 portion. long LoadVolumeFile(BVRef bvr, const char *filePath) { - long fileSize; + long fileSize; - // Read file into load buffer. The data in the load buffer will be - // overwritten by the next LoadFile() call. + // Read file into load buffer. The data in the load buffer will be + // overwritten by the next LoadFile() call. - gFSLoadAddress = (void *) LOAD_ADDR; + gFSLoadAddress = (void *) LOAD_ADDR; - fileSize = bvr->fs_loadfile(bvr, (char *)filePath); + fileSize = bvr->fs_loadfile(bvr, (char *)filePath); - // Return the size of the file, or -1 if load failed. + // Return the size of the file, or -1 if load failed. - return fileSize; + return fileSize; } //========================================================================== // LoadFile - LOW-LEVEL FILESYSTEM FUNCTION. -// Load the specified file to the load buffer at LOAD_ADDR. -// If the file is fat, load only the i386 portion. +// Load the specified file to the load buffer at LOAD_ADDR. +// If the file is fat, load only the i386 portion. long LoadFile(const char * fileSpec) { @@ -194,10 +195,11 @@ long LoadThinFatFile(const char *fileSpec, void **binary) { - const char *filePath; + const char *filePath = ""; FSReadFile readFile; BVRef bvr; - unsigned long length, length2; + unsigned long length; + unsigned long length2; // Resolve the boot volume from the file spec. @@ -207,14 +209,14 @@ } *binary = (void *)kLoadAddr; - + // Read file into load buffer. The data in the load buffer will be // overwritten by the next LoadFile() call. gFSLoadAddress = (void *) LOAD_ADDR; readFile = bvr->fs_readfile; - + if (readFile != NULL) { // Read the first 4096 bytes (fat header) @@ -275,7 +277,8 @@ return -1; } - if(bvr->fs_getuuid) { + if(bvr->fs_getuuid) + { rval = bvr->fs_getuuid(bvr, uuidStr); } @@ -283,35 +286,37 @@ } #endif +//========================================================================== + // filesystem-specific getUUID functions call this shared string generator long CreateUUIDString(uint8_t uubytes[], int nbytes, char *uuidStr) { - unsigned fmtbase, fmtidx, i; - uint8_t uuidfmt[] = { 4, 2, 2, 2, 6 }; - char *p = uuidStr; - MD5_CTX md5c; - uint8_t mdresult[16]; + unsigned fmtbase, fmtidx, i; + uint8_t uuidfmt[] = { 4, 2, 2, 2, 6 }; + char *p = uuidStr; + MD5_CTX md5c; + uint8_t mdresult[16]; - bzero(mdresult, sizeof(mdresult)); + bzero(mdresult, sizeof(mdresult)); - // just like AppleFileSystemDriver - MD5Init(&md5c); - MD5Update(&md5c, kFSUUIDNamespaceSHA1, sizeof(kFSUUIDNamespaceSHA1)); - MD5Update(&md5c, uubytes, nbytes); - MD5Final(mdresult, &md5c); + // just like AppleFileSystemDriver + MD5Init(&md5c); + MD5Update(&md5c, kFSUUIDNamespaceSHA1, sizeof(kFSUUIDNamespaceSHA1)); + MD5Update(&md5c, uubytes, nbytes); + MD5Final(mdresult, &md5c); - // this UUID has been made version 3 style (i.e. via namespace) - // see "-uuid-urn-" IETF draft (which otherwise copies byte for byte) - mdresult[6] = 0x30 | ( mdresult[6] & 0x0F ); - mdresult[8] = 0x80 | ( mdresult[8] & 0x3F ); + // this UUID has been made version 3 style (i.e. via namespace) + // see "-uuid-urn-" IETF draft (which otherwise copies byte for byte) + mdresult[6] = 0x30 | ( mdresult[6] & 0x0F ); + mdresult[8] = 0x80 | ( mdresult[8] & 0x3F ); - // generate the text: e.g. 5EB1869F-C4FA-3502-BDEB-3B8ED5D87292 + // generate the text: e.g. 5EB1869F-C4FA-3502-BDEB-3B8ED5D87292 i = 0; fmtbase = 0; - for(fmtidx = 0; fmtidx < sizeof(uuidfmt); fmtidx++) + for (fmtidx = 0; fmtidx < sizeof(uuidfmt); fmtidx++) { for (i = 0; i < uuidfmt[fmtidx]; i++) { @@ -355,13 +360,12 @@ //========================================================================== // GetDirEntry - LOW-LEVEL FILESYSTEM FUNCTION. -// Fetch the next directory entry for the given directory. +// Fetch the next directory entry for the given directory. -long GetDirEntry(const char * dirSpec, long long * dirIndex, const char ** name, - long * flags, u_int32_t * time) +long GetDirEntry(const char * dirSpec, long long * dirIndex, const char ** name, long * flags, u_int32_t * time) { - const char * dirPath; - BVRef bvr; + const char *dirPath; + BVRef bvr; // Resolve the boot volume from the dir spec. @@ -380,12 +384,11 @@ //========================================================================== // GetFileInfo - LOW-LEVEL FILESYSTEM FUNCTION. -// Get attributes for the specified file. +// Get attributes for the specified file. static char* gMakeDirSpec; -long GetFileInfo(const char * dirSpec, const char * name, - long * flags, u_int32_t * time) +long GetFileInfo(const char * dirSpec, const char * name, long * flags, u_int32_t * time) { long long index = 0; const char * entryName; @@ -395,18 +398,26 @@ gMakeDirSpec = (char *)malloc(1024); } - if (!dirSpec) { - long idx, len; - + if (!dirSpec) + { + long idx; + long len; len = strlen(name); for (idx = len; idx && (name[idx] != '/' && name[idx] != '\\'); idx--) {} - if (idx == 0) { - if(name[idx] == '/' || name[idx] == '\\') ++name; // todo: ensure other functions handel \ properly + + if (idx == 0) + { + if(name[idx] == '/' || name[idx] == '\\') + { + ++name; // todo: ensure other functions handel \ properly + } gMakeDirSpec[0] = '/'; gMakeDirSpec[1] = '\0'; gMakeDirSpec[idx] = '\0'; - } else { + } + else + { idx++; strncpy(gMakeDirSpec, name, idx); gMakeDirSpec[idx] = '\0'; // ISSUE: http://forge.voodooprojects.org/p/chameleon/issues/270/ @@ -436,7 +447,8 @@ // Resolve the boot volume from the file spec. - if ((bvr = getBootVolumeRef(fileSpec, &filePath)) == NULL) { + if ((bvr = getBootVolumeRef(fileSpec, &filePath)) == NULL) + { // printf("Boot volume for '%s' is bogus\n", fileSpec); return -1; } @@ -515,7 +527,8 @@ int fdesc; int i; - if (bvr == NULL) { + if (bvr == NULL) + { return -1; } @@ -528,17 +541,21 @@ // Find the next available memory block in the download buffer. io->i_buf = (char *) LOAD_ADDR; - for (i = 0; i < NFILES; i++) { - if ((iob[i].i_flgs != F_ALLOC) || (i == fdesc)) { + for (i = 0; i < NFILES; i++) + { + if ((iob[i].i_flgs != F_ALLOC) || (i == fdesc)) + { continue; } + io->i_buf = MAX(iob[i].i_filesize + iob[i].i_buf, io->i_buf); } // Load entire file into memory. Unnecessary open() calls must be avoided. gFSLoadAddress = io->i_buf; io->i_filesize = bvr->fs_loadfile(bvr, (char *)filePath); - if (io->i_filesize < 0) { + if (io->i_filesize < 0) + { close(fdesc); return -1; } @@ -558,15 +575,16 @@ return -1; } +//========================================================================== int open_bvdev(const char *bvd, const char *path, int flags) { const struct devsw *dp; - const char *cp; - BVRef bvr; - int i; - int len; - int unit; - int partition; + const char *cp; + BVRef bvr; + int i; + int len; + int unit; + int partition; if ((i = open(path, flags)) >= 0) { @@ -578,6 +596,17 @@ return -1; } + if (path && path[2] == '(') + { + for (dp = &devsw[0]; dp->name; ++dp) + { + if (path[0] == dp->name[0] && path[1] == dp->name[1]) + { + return -1; + } + } + } + for (dp=devsw; dp->name; dp++) { if (bvd[0] == dp->name[0] && bvd[1] == dp->name[1]) @@ -630,7 +659,7 @@ //========================================================================== // lseek() - Reposition the byte offset of the file descriptor from the -// beginning of the file. Returns the relocated offset. +// beginning of the file. Returns the relocated offset. int b_lseek(int fdesc, int offset, int ptr) { @@ -663,21 +692,24 @@ //========================================================================== // read() - Read up to 'count' bytes of data from the file descriptor -// into the buffer pointed to by buf. +// into the buffer pointed to by buf. int read(int fdesc, char * buf, int count) { struct iob * io; - if ((io = iob_from_fdesc(fdesc)) == NULL) { + if ((io = iob_from_fdesc(fdesc)) == NULL) + { return (-1); } - if ((io->i_offset + count) > (unsigned int)io->i_filesize) { + if ((io->i_offset + count) > (unsigned int)io->i_filesize) + { count = io->i_filesize - io->i_offset; } - if (count <= 0) { + if (count <= 0) + { return 0; // end of file } @@ -695,52 +727,56 @@ int write(int fdesc, const char * buf, int count) { struct iob * io; - + if ((io = iob_from_fdesc(fdesc)) == NULL) return (-1); - + if ((io->i_offset + count) > (unsigned int)io->i_filesize) count = io->i_filesize - io->i_offset; - + if (count <= 0) return 0; // end of file - + bcopy(buf, io->i_buf + io->i_offset, count); - + io->i_offset += count; - + return count; } +//========================================================================== + int writebyte(int fdesc, char value) { - struct iob * io; - - if ((io = iob_from_fdesc(fdesc)) == NULL) + struct iob * io; + + if ((io = iob_from_fdesc(fdesc)) == NULL) return (-1); - + if ((io->i_offset + 1) > (unsigned int)io->i_filesize) return 0; // end of file - + io->i_buf[io->i_offset++] = value; - + return 1; } +//========================================================================== + int writeint(int fdesc, int value) { struct iob * io; - + if ((io = iob_from_fdesc(fdesc)) == NULL) return (-1); - + if ((io->i_offset + 4) > (unsigned int)io->i_filesize) return 0; // end of file - + bcopy(&value, io->i_buf + io->i_offset, 4); - + io->i_offset += 4; - + return 4; } @@ -752,7 +788,8 @@ { struct iob * io; - if ((io = iob_from_fdesc(fdesc)) == 0) { + if ((io = iob_from_fdesc(fdesc)) == 0) + { return 0; } @@ -792,45 +829,47 @@ const char * dirPath; BVRef bvr; - if ((bvr = getBootVolumeRef(path, &dirPath)) == NULL) - goto error; + if ((bvr = getBootVolumeRef(path, &dirPath)) == NULL) + goto error; - dirp = (struct dirstuff *) malloc(sizeof(struct dirstuff)); - if (dirp == NULL) - goto error; + dirp = (struct dirstuff *) malloc(sizeof(struct dirstuff)); + if (dirp == NULL) + goto error; - dirp->dir_path = newString(dirPath); - if (dirp->dir_path == NULL) - goto error; + dirp->dir_path = newString(dirPath); + if (dirp->dir_path == NULL) + goto error; - dirp->dir_bvr = bvr; + dirp->dir_bvr = bvr; return dirp; error: - closedir(dirp); - return NULL; + closedir(dirp); + + return NULL; } //========================================================================== int closedir(struct dirstuff * dirp) { - if (dirp) { - if (dirp->dir_path) { + if (dirp) + { + if (dirp->dir_path) + { free(dirp->dir_path); } free(dirp); } - return 0; + return 0; } //========================================================================== -int readdir(struct dirstuff * dirp, const char ** name, long * flags, - u_int32_t * time) +int readdir(struct dirstuff * dirp, const char ** name, long * flags, u_int32_t * time) { return dirp->dir_bvr->fs_getdirentry(dirp->dir_bvr, /* dirPath */ dirp->dir_path, @@ -840,8 +879,7 @@ //========================================================================== -int readdir_ext(struct dirstuff * dirp, const char ** name, long * flags, - u_int32_t * time, FinderInfo *finderInfo, long *infoValid) +int readdir_ext(struct dirstuff * dirp, const char ** name, long * flags, u_int32_t * time, FinderInfo *finderInfo, long *infoValid) { return dirp->dir_bvr->fs_getdirentry( dirp->dir_bvr, /* dirPath */ dirp->dir_path, @@ -921,7 +959,7 @@ { filteredChain = true; } - + if (multiboot_partition_set) { for ( bvr = chain; bvr; bvr = bvr->next ) @@ -972,6 +1010,7 @@ { break; } + if (multiboot_skip_partition_set) { if (bvr->part_no == multiboot_skip_partition) @@ -979,6 +1018,7 @@ continue; } } + if ( bvr->flags & kBVFlagPrimary && bvr->biosdev == gBIOSDev ) { foundPrimary = true; @@ -1025,18 +1065,15 @@ } } } - + bvr = bvr2 ? bvr2 : bvr1 ? bvr1 : chain; - + return bvr; } //========================================================================== -#define LP '(' -#define RP ')' -int gBIOSDev; /*! This is like boot2's gBootVolume except it is for the internal use of @@ -1045,6 +1082,8 @@ */ static BVRef gRootVolume; +//========================================================================== + void setRootVolume(BVRef volume) { gRootVolume = volume; @@ -1056,6 +1095,8 @@ } } +//========================================================================== + void setBootGlobals(BVRef chain) { // Record default boot device. @@ -1070,6 +1111,7 @@ setRootVolume(gBootVolume); } +//========================================================================== /*! Extracts the volume selector from the pathname, returns the selected BVRef, and sets *outPath to the remainder of the path. @@ -1080,20 +1122,22 @@ */ BVRef getBootVolumeRef( const char * path, const char ** outPath ) { - const char * cp; - BVRef bvr = gRootVolume; - int biosdev = gBIOSDev; + const char *cp; + BVRef bvr = gRootVolume; + int biosdev = gBIOSDev; - // Search for left parenthesis in the path specification. + // Search for left parenthesis in the path specification. - for (cp = path; *cp; cp++) { + for (cp = path; *cp; cp++) + { if (*cp == LP || *cp == '/') { break; } } - if (*cp != LP) { // no left paren found + if (*cp != LP) // no left paren found + { cp = path; // Path is using the implicit current device so if there is // no current device, then we must fail. @@ -1101,7 +1145,9 @@ { return NULL; } - } else if ((cp - path) == 2) { // found "xx(" + } + else if ((cp - path) == 2) // found "xx(" + { const struct devsw * dp; const char * xp = path; @@ -1126,7 +1172,7 @@ error("Unknown device '%c%c'\n", xp[0], xp[1]); return NULL; } - + // Extract the optional unit number from the specification. // hd(unit) or hd(unit, part). @@ -1230,8 +1276,9 @@ else { // Fetch the volume list from the device. - +#if 0 scanBootVolumes( biosdev, NULL ); +#endif bvrChain = getBVChainForBIOSDev(biosdev); // Look for a perfect match based on device and partition number. @@ -1244,6 +1291,7 @@ } bvr1 = bvr; + if ( bvr->part_no == partno ) { break; @@ -1264,7 +1312,7 @@ { return 0; } - + *str = '\0'; if (bvr) @@ -1280,6 +1328,8 @@ return sprintf(str, "%s(%d,%d)", dp->name, bvr->biosdev - dp->biosdev, bvr->part_no); } } - + return 0; } + +//========================================================================== Index: branches/ErmaC/Enoch/i386/libsaio/disk.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/disk.c (revision 2524) +++ branches/ErmaC/Enoch/i386/libsaio/disk.c (revision 2525) @@ -1632,6 +1632,14 @@ config_file_t systemVersion; char dirSpec[512]; + /* + * Only look for OS Version on HFS+ + */ + if (bvr->fs_readfile != HFSReadFile) + { + return valid; + } + // OS X Recovery sprintf(dirSpec, "hd(%d,%d)/com.apple.recovery.boot/SystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no); Index: branches/ErmaC/Enoch/i386/libsaio/biosfn.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/biosfn.c (revision 2524) +++ branches/ErmaC/Enoch/i386/libsaio/biosfn.c (revision 2525) @@ -597,7 +597,7 @@ // printf("bus_type[4] = %x\n", dp->params. bus_type[4]); // printf("interface_type[8] = %x\n", dp->params. interface_type[8]); // printf("interface_path[8] = %x\n", dp->params. interface_path[8]); -// printf("dev_path[8] = %x\n", dp->params. dev_path[8]); +// printf("dev_path[16] = %x\n", dp->params. dev_path[16]); // printf("reserved3 = %x\n", dp->params. reserved3); // printf("checksum = %x\n", dp->params. checksum); printf("io_port_base = %x\n", dp->dpte.io_port_base); Index: branches/ErmaC/Enoch/i386/libsaio/saio_types.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/saio_types.h (revision 2524) +++ branches/ErmaC/Enoch/i386/libsaio/saio_types.h (revision 2525) @@ -100,7 +100,7 @@ unsigned char bus_type[4]; unsigned char interface_type[8]; unsigned char interface_path[8]; - unsigned char dev_path[8]; + unsigned char dev_path[16]; unsigned char reserved3; unsigned char checksum; } params; Index: branches/ErmaC/Enoch/i386/libsaio/fake_efi.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/fake_efi.c (revision 2524) +++ branches/ErmaC/Enoch/i386/libsaio/fake_efi.c (revision 2525) @@ -818,12 +818,7 @@ { // Check selected volume's Extra. sprintf(dirSpecSMBIOS, "/Extra/%s", filename); - if ( (err = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig)) ) - { - // Check booter volume/rdbt Extra. - sprintf(dirSpecSMBIOS, "bt(0,0)/Extra/%s", filename); - err = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig); - } + err = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig); } if (err) Index: branches/ErmaC/Enoch/i386/boot2/modules.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/modules.c (revision 2524) +++ branches/ErmaC/Enoch/i386/boot2/modules.c (revision 2525) @@ -60,8 +60,8 @@ */ int init_module_system() { - // Start any modules that were compiled in first. - start_built_in_modules(); + // Start any modules that were compiled in first. + start_built_in_modules(); int retVal = 0; @@ -93,7 +93,7 @@ } // Look for modules located in the multiboot header. - if(gMI->mi_flags & MULTIBOOT_INFO_HAS_MODS) + if(gMI && (gMI->mi_flags & MULTIBOOT_INFO_HAS_MODS)) { if(gMI->mi_mods_count) { @@ -119,7 +119,7 @@ char* name = strdup(last); name[strlen(last) - sizeof("dylib")] = 0; - DBG("Loading multiboot module %s", name); + DBG("Loading multiboot module %s\n", name); module_start = parse_mach(module_data, &load_module, &add_symbol, NULL); @@ -178,7 +178,8 @@ char* tmp = malloc(strlen(name) + 1); strcpy(tmp, name); - if(!load_module(tmp)) { + if(!load_module(tmp)) + { // failed to load // free(tmp); } @@ -269,7 +270,7 @@ { // This only can handle 32bit symbols symbolList_t* entry; - //DBG("Adding symbol %s at 0x%X\n", symbol, addr); + DBG("Adding symbol %s at 0x%X\n", symbol, addr); entry = malloc(sizeof(symbolList_t)); entry->next = moduleSymbols; @@ -299,9 +300,9 @@ loadedModules = new_entry; - if(!name) name = "Unknown"; - if(!author) author = "Unknown"; - if(!description) description = ""; + if(!name) name = "Unknown"; + if(!author) author = "Unknown"; + if(!description) description = ""; new_entry->name = name; new_entry->author = author; @@ -309,11 +310,11 @@ new_entry->version = version; new_entry->compat = compat; - msglog("Module '%s' by '%s' Loaded.\n", name, author); - msglog("\tInitialization: 0x%X\n", start); - msglog("\tDescription: %s\n", description); - msglog("\tVersion: %d\n", version); // todo: sperate to major.minor.bugfix - msglog("\tCompat: %d\n", compat); // todo: ^^^ major.minor.bugfix + DBG("Module '%s' by '%s' Loaded.\n", name, author); + DBG("\tInitialization: 0x%X\n", start); + DBG("\tDescription: %s\n", description); + DBG("\tVersion: %d\n", version); // todo: sperate to major.minor.bugfix + DBG("\tCompat: %d\n", compat); // todo: ^^^ major.minor.bugfix } int is_module_loaded(const char* name) @@ -482,7 +483,7 @@ } } break; - case LC_SEGMENT_64: // 64bit macho's + case LC_SEGMENT_64: // 64bit macho's { segCommand64 = binary + binaryIndex; UInt32 sectionIndex; Index: branches/ErmaC/Enoch/i386/boot2/options.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/options.c (revision 2524) +++ branches/ErmaC/Enoch/i386/boot2/options.c (revision 2525) @@ -108,12 +108,12 @@ static int countdown( const char * msg, int row, int timeout ) { - unsigned long time; - int ch = 0; - int col = strlen(msg) + 1; - - flushKeyboardBuffer(); + unsigned long time; + int ch = 0; + int col = strlen(msg) + 1; + flushKeyboardBuffer(); + if( bootArgs->Video.v_display == VGA_TEXT_MODE ) { moveCursor( 0, row ); @@ -122,53 +122,53 @@ } else { position_t p = pos( gui.screen.width / 2 + 1 , ( gui.devicelist.pos.y + 3 ) + ( ( gui.devicelist.height - gui.devicelist.iconspacing ) / 2 ) ); - + char dummy[80]; getBootVolumeDescription( gBootVolume, dummy, sizeof(dummy) - 1, true ); drawDeviceIcon( gBootVolume, gui.screen.pixmap, p, true ); drawStrCenteredAt( (char *) msg, &font_small, gui.screen.pixmap, gui.countdown.pos ); - + // make this screen the new background memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 ); - + } int multi_buff = 18 * (timeout); - int multi = ++multi_buff; + int multi = ++multi_buff; - int lasttime=0; + int lasttime=0; - for ( time = time18(), timeout++; timeout > 0; ) - { + for ( time = time18(), timeout++; timeout > 0; ) + { if( time18() > lasttime) { multi--; lasttime=time18(); } - if ( (ch = readKeyboardStatus()) ) - break; + if ( (ch = readKeyboardStatus()) ) + break; - // Count can be interrupted by holding down shift, - // control or alt key - if ( ( readKeyboardShiftFlags() & 0x0F ) != 0 ) + // Count can be interrupted by holding down shift, + // control or alt key + if ( ( readKeyboardShiftFlags() & 0x0F ) != 0 ) { - ch = 1; - break; - } + ch = 1; + break; + } - if ( time18() >= time ) - { - time += 18; - timeout--; + if ( time18() >= time ) + { + time += 18; + timeout--; if( bootArgs->Video.v_display == VGA_TEXT_MODE ) { moveCursor( col, row ); printf("(%d) ", timeout); } - } - + } + if( bootArgs->Video.v_display != VGA_TEXT_MODE ) { drawProgressBar( gui.screen.pixmap, 100, gui.progressbar.pos , ( multi * 100 / multi_buff ) ); @@ -176,11 +176,11 @@ updateVRAM(); } - } + } - flushKeyboardBuffer(); + flushKeyboardBuffer(); - return ch; + return ch; } //========================================================================== @@ -196,7 +196,8 @@ gBootArgsPtr = gBootArgs; memset(gBootArgs, '\0', BOOT_STRING_LEN); - if (bootArgs->Video.v_display != VGA_TEXT_MODE) { + if (bootArgs->Video.v_display != VGA_TEXT_MODE) + { clearGraphicBootPrompt(); } execute_hook("ClearArgs", NULL, NULL, NULL, NULL); @@ -219,26 +220,37 @@ extern char bootPrompt[]; extern char bootRescanPrompt[]; - if( bootArgs->Video.v_display == VGA_TEXT_MODE ) { - changeCursor( 0, row, kCursorTypeUnderline, 0 ); + if( bootArgs->Video.v_display == VGA_TEXT_MODE ) + { + changeCursor( 0, row, kCursorTypeUnderline, 0 ); clearScreenRows( row, kScreenLastRow ); } clearBootArgs(); - if (visible) { - if (bootArgs->Video.v_display == VGA_TEXT_MODE) { - if (gEnableCDROMRescan) { + if (visible) + { + if (bootArgs->Video.v_display == VGA_TEXT_MODE) + { + if (gEnableCDROMRescan) + { printf( bootRescanPrompt ); - } else { + } + else + { printf( bootPrompt ); printf( gBootArgs ); } } - } else { - if (bootArgs->Video.v_display != VGA_TEXT_MODE) { + } + else + { + if (bootArgs->Video.v_display != VGA_TEXT_MODE) + { clearGraphicBootPrompt(); - } else { + } + else + { printf("Press Enter to start up the foreign OS. "); } } @@ -267,29 +279,31 @@ x--; } - if( bootArgs->Video.v_display == VGA_TEXT_MODE ) - { - setCursorPosition( x, y, 0 ); - putca(' ', 0x07, 1); - } + if( bootArgs->Video.v_display == VGA_TEXT_MODE ) + { + setCursorPosition( x, y, 0 ); + putca(' ', 0x07, 1); + } else - { - updateGraphicBootPrompt(); - } - } + { + updateGraphicBootPrompt(); + } + } break; default: - if ( key >= ' ' && gBootArgsPtr < gBootArgsEnd) - { - *gBootArgsPtr++ = key; + if ( key >= ' ' && gBootArgsPtr < gBootArgsEnd) + { + *gBootArgsPtr++ = key; - if( bootArgs->Video.v_display != VGA_TEXT_MODE ) updateGraphicBootPrompt(); - else if ( key >= ' ' && key < 0x7f) putchar(key); - } - - break; - } + if( bootArgs->Video.v_display != VGA_TEXT_MODE ) + updateGraphicBootPrompt(); + else if ( key >= ' ' && key < 0x7f) + putchar(key); + } + + break; + } } //========================================================================== @@ -361,11 +375,11 @@ // Draw the visible items. if( bootArgs->Video.v_display != VGA_TEXT_MODE ) - + drawDeviceList(gMenuStart, gMenuEnd, gMenuSelection); else { - + changeCursor( 0, row, kCursorTypeHidden, &cursorState ); for ( i = gMenuTop; i <= gMenuBottom; i++ ) @@ -374,7 +388,7 @@ } restoreCursor( &cursorState ); - } + } } //========================================================================== Index: branches/ErmaC/Enoch/i386/util/boot1-install/boot1-install.c =================================================================== --- branches/ErmaC/Enoch/i386/util/boot1-install/boot1-install.c (revision 2524) +++ branches/ErmaC/Enoch/i386/util/boot1-install/boot1-install.c (revision 2525) @@ -35,6 +35,8 @@ _exfat = 1, _hfs = 2, _msdos = 3, + _ntfs = 4, + _ext4 = 5, _other = 255 }; @@ -544,6 +546,9 @@ else *pKind = _other; break; + case _ntfs: + rc = 0; + break; default: break; } @@ -598,6 +603,8 @@ daVolumeKind = _hfs; else if (!strcmp(cstr, "msdos")) daVolumeKind = _msdos; + else if (!strcmp(cstr, "ntfs")) + daVolumeKind = _ntfs; else daVolumeKind = _other; } @@ -736,6 +743,7 @@ case _exfat: case _hfs: case _msdos: + case _ntfs: break; default: unsupported(); @@ -776,8 +784,10 @@ } printf("Using %s as default boot template\n", bootFile); } + if (loadChunk(bootFile, 0, 0, &bootBlob) < 0) goto cleanup_and_error; + switch (daVolumeKind) { case _exfat: if (calcSum(&bootBlob, &bpbBlob, &outputBlob, devicePath) < 0) Index: branches/ErmaC/Enoch/package/Changes.txt =================================================================== --- branches/ErmaC/Enoch/package/Changes.txt (revision 2524) +++ branches/ErmaC/Enoch/package/Changes.txt (revision 2525) @@ -1,3 +1,5 @@ +- JrCs - boot1-install can show ntfs volume. + - ErmaC - Auto increase year for pkg resource. - JrCs - Add translation to the project. Index: branches/ErmaC/Enoch/CHANGES =================================================================== --- branches/ErmaC/Enoch/CHANGES (revision 2524) +++ branches/ErmaC/Enoch/CHANGES (revision 2525) @@ -1,3 +1,10 @@ +- Zenith432 : saio_types.h, biosfn.c - minor typo in bios-defined data structure that isn't actually used. +fake_efi.c - eliminate redundant scan of bt(0,0) in setupSmbiosConfigFile. loadConfigFile already does a fall-back scan of bt(0,0), so another scan isn't needed. +sys.c - While scanning a volume, getOSVersion looks for 5 files and switches back-n-forth between hd(X,Y)/....SystemVersion.plist on the newly scanned volume and bt(0,0)/hd(X,Y)/...SystemVersion.plist - which is an invalid path - should always return an error. +- Zenith432 : Change to disk.c - Prevent getOSVersion from looking for SystemVersion.plist on FAT32 or exFAT file systems - since those filesystems never serve as system volumes. +UFS may serve as system volume, but there's no driver to read from it. +Change to sys.c - Eliminate a dubious recursion in diskScanBootVolumes(). It recognises the filesystem, then calls getOSVersion, which attempts to open 5 files in order to find SystemVersion - then when parsing the device name - calls diskScanBootVolumes() - as a form of on-demand scanning. This doesn't result in an infinite recursion - because the volume is already in the map. However, this auto-scan is only useful if user enters an explicit hd(X,Y) device-spec that has never been scanned before - an unlikely occurrence. +- Zenith432 : Patch from Issue 388, init_module_system() in modules.c dereferences NULL pointer - Zenith432 : Full implementation of exfat support for Chameleon's boot2 stage. - Micky1979 : Incorporated force umount option -u (boot1-install.c) - Zenith432 : Replace boot0 with boot0xg. Now boot0xg has all features of previous boot0. ( http://www.insanelymac.com/forum/topic/302938-exfat-volume-boot-record-for-chameleon )