Chameleon

Chameleon Commit Details

Date:2014-12-31 03:37:55 (9 years 3 months ago)
Author:ErmaC
Commit:2525
Parents: 2524
Message:sync with trunk (r.2524)
Changes:
M/branches/ErmaC/Enoch/CHANGES
M/branches/ErmaC/Enoch/i386/boot2/options.c
M/branches/ErmaC/Enoch/i386/libsaio/sys.c
M/branches/ErmaC/Enoch/i386/libsaio/biosfn.c
M/branches/ErmaC/Enoch/i386/libsaio/saio_types.h
M/branches/ErmaC/Enoch/package/Changes.txt
M/branches/ErmaC/Enoch/i386/libsaio/fake_efi.c
M/branches/ErmaC/Enoch/i386/libsaio/disk.c
M/branches/ErmaC/Enoch/i386/boot2/modules.c
M/branches/ErmaC/Enoch/i386/util/boot1-install/boot1-install.c

File differences

branches/ErmaC/Enoch/i386/libsaio/sys.c
4444
4545
4646
47
48
49
5047
5148
5249
5350
5451
52
53
54
5555
5656
57
58
59
60
61
6257
6358
6459
......
8883
8984
9085
91
86
87
9288
9389
9490
......
121117
122118
123119
120
121
122
123
124
124125
125126
126127
......
130131
131132
132133
133
134
135
134
135
136
136137
137138
138139
139
140
140141
141
142
142
143
143144
144
145
145146
146
147
147148
148
149
149150
150
151
151152
152153
153154
154155
155
156
156
157
157158
158159
159160
......
194195
195196
196197
197
198
198199
199200
200
201
202
201203
202204
203205
......
207209
208210
209211
210
212
211213
212214
213215
214216
215217
216218
217
219
218220
219221
220222
......
275277
276278
277279
278
280
281
279282
280283
281284
......
283286
284287
285288
289
290
286291
287292
288293
289294
290
291
292
293
294
295
296
297
298
299
295300
296
301
297302
298
299
300
301
302
303
304
305
306
307
303308
304
305
306
307
309
310
311
312
308313
309314
310
315
311316
312317
313318
314
319
315320
316321
317322
......
355360
356361
357362
358
363
359364
360
361
365
362366
363
364
367
368
365369
366370
367371
......
380384
381385
382386
383
387
384388
385389
386390
387
388
391
389392
390393
391394
......
395398
396399
397400
398
399
400
401
402
403
404
401405
402406
403407
404
405
408
409
410
411
412
413
414
406415
407416
408417
409
418
419
420
410421
411422
412423
......
436447
437448
438449
439
450
451
440452
441453
442454
......
515527
516528
517529
518
530
531
519532
520533
521534
......
528541
529542
530543
531
532
544
545
546
547
533548
534549
550
535551
536552
537553
538554
539555
540556
541
557
558
542559
543560
544561
......
558575
559576
560577
578
561579
562580
563581
564
565
566
567
568
569
582
583
584
585
586
587
570588
571589
572590
......
578596
579597
580598
599
600
601
602
603
604
605
606
607
608
609
581610
582611
583612
......
630659
631660
632661
633
662
634663
635664
636665
......
663692
664693
665694
666
695
667696
668697
669698
670699
671700
672
701
702
673703
674704
675705
676
706
707
677708
678709
679710
680
711
712
681713
682714
683715
......
695727
696728
697729
698
730
699731
700732
701
733
702734
703735
704
736
705737
706738
707
739
708740
709
741
710742
711
743
712744
713745
714746
747
748
715749
716750
717
718
719
751
752
753
720754
721
755
722756
723757
724
758
725759
726
760
727761
728762
729763
764
765
730766
731767
732768
733
769
734770
735771
736
772
737773
738774
739
775
740776
741
777
742778
743
779
744780
745781
746782
......
752788
753789
754790
755
791
792
756793
757794
758795
......
792829
793830
794831
795
796
832
833
797834
798
799
800
835
836
837
801838
802
803
804
839
840
841
805842
806
843
807844
808845
809846
810847
811
812
848
849
850
813851
814852
815853
816854
817855
818856
819
820
857
858
859
860
821861
822862
823863
824864
825865
826866
827
867
828868
829869
830870
831871
832
833
872
834873
835874
836875
......
840879
841880
842881
843
844
882
845883
846884
847885
......
921959
922960
923961
924
962
925963
926964
927965
......
9721010
9731011
9741012
1013
9751014
9761015
9771016
......
9791018
9801019
9811020
1021
9821022
9831023
9841024
......
10251065
10261066
10271067
1028
1068
10291069
10301070
1031
1071
10321072
10331073
10341074
10351075
10361076
1037
1038
1039
10401077
10411078
10421079
......
10451082
10461083
10471084
1085
1086
10481087
10491088
10501089
......
10561095
10571096
10581097
1098
1099
10591100
10601101
10611102
......
10701111
10711112
10721113
1114
10731115
10741116
10751117
......
10801122
10811123
10821124
1083
1084
1085
1125
1126
1127
10861128
1087
1129
10881130
1089
1131
1132
10901133
10911134
10921135
10931136
10941137
10951138
1096
1139
1140
10971141
10981142
10991143
......
11011145
11021146
11031147
1104
1148
1149
1150
11051151
11061152
11071153
......
11261172
11271173
11281174
1129
1175
11301176
11311177
11321178
......
12301276
12311277
12321278
1233
1279
12341280
1281
12351282
12361283
12371284
......
12441291
12451292
12461293
1294
12471295
12481296
12491297
......
12641312
12651313
12661314
1267
1315
12681316
12691317
12701318
......
12801328
12811329
12821330
1283
1331
12841332
12851333
1334
1335
* 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.c7.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"
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;
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;
//==========================================================================
// 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)
{
long LoadThinFatFile(const char *fileSpec, void **binary)
{
const char*filePath;
const char*filePath = "";
FSReadFilereadFile;
BVRefbvr;
unsigned long length, length2;
unsigned longlength;
unsigned longlength2;
// Resolve the boot volume from the file spec.
}
*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)
return -1;
}
if(bvr->fs_getuuid) {
if(bvr->fs_getuuid)
{
rval = bvr->fs_getuuid(bvr, uuidStr);
}
}
#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];
unsignedfmtbase, fmtidx, i;
uint8_tuuidfmt[] = { 4, 2, 2, 2, 6 };
char*p = uuidStr;
MD5_CTXmd5c;
uint8_tmdresult[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++)
{
//==========================================================================
// 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;
BVRefbvr;
// Resolve the boot volume from the dir spec.
//==========================================================================
// 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;
gMakeDirSpec = (char *)malloc(1024);
}
if (!dirSpec) {
long idx, len;
if (!dirSpec)
{
longidx;
longlen;
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/
// 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;
}
intfdesc;
inti;
if (bvr == NULL) {
if (bvr == NULL)
{
return -1;
}
// 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;
}
return -1;
}
//==========================================================================
int open_bvdev(const char *bvd, const char *path, int flags)
{
const struct devsw*dp;
const char*cp;
BVRefbvr;
inti;
intlen;
intunit;
intpartition;
const char*cp;
BVRefbvr;
inti;
intlen;
intunit;
intpartition;
if ((i = open(path, flags)) >= 0)
{
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])
//==========================================================================
// 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)
{
//==========================================================================
// 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
}
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;
}
{
struct iob * io;
if ((io = iob_from_fdesc(fdesc)) == 0) {
if ((io = iob_from_fdesc(fdesc)) == 0)
{
return 0;
}
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,
//==========================================================================
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,
{
filteredChain = true;
}
if (multiboot_partition_set)
{
for ( bvr = chain; bvr; bvr = bvr->next )
{
break;
}
if (multiboot_skip_partition_set)
{
if (bvr->part_no == multiboot_skip_partition)
continue;
}
}
if ( bvr->flags & kBVFlagPrimary && bvr->biosdev == gBIOSDev )
{
foundPrimary = true;
}
}
}
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
*/
static BVRef gRootVolume;
//==========================================================================
void setRootVolume(BVRef volume)
{
gRootVolume = volume;
}
}
//==========================================================================
void setBootGlobals(BVRef chain)
{
// Record default boot device.
setRootVolume(gBootVolume);
}
//==========================================================================
/*!
Extracts the volume selector from the pathname, returns the selected
BVRef, and sets *outPath to the remainder of the path.
*/
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.
{
return NULL;
}
} else if ((cp - path) == 2) { // found "xx("
}
else if ((cp - path) == 2) // found "xx("
{
const struct devsw * dp;
const char * xp = path;
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).
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.
}
bvr1 = bvr;
if ( bvr->part_no == partno )
{
break;
{
return 0;
}
*str = '\0';
if (bvr)
return sprintf(str, "%s(%d,%d)", dp->name, bvr->biosdev - dp->biosdev, bvr->part_no);
}
}
return 0;
}
//==========================================================================
branches/ErmaC/Enoch/i386/libsaio/disk.c
16321632
16331633
16341634
1635
1636
1637
1638
1639
1640
1641
1642
16351643
16361644
16371645
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);
branches/ErmaC/Enoch/i386/libsaio/biosfn.c
597597
598598
599599
600
600
601601
602602
603603
//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);
branches/ErmaC/Enoch/i386/libsaio/saio_types.h
100100
101101
102102
103
103
104104
105105
106106
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;
branches/ErmaC/Enoch/i386/libsaio/fake_efi.c
818818
819819
820820
821
822
823
824
825
826
821
827822
828823
829824
{
// 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)
branches/ErmaC/Enoch/i386/boot2/modules.c
6060
6161
6262
63
64
63
64
6565
6666
6767
......
9393
9494
9595
96
96
9797
9898
9999
......
119119
120120
121121
122
122
123123
124124
125125
......
178178
179179
180180
181
181
182
182183
183184
184185
......
269270
270271
271272
272
273
273274
274275
275276
......
299300
300301
301302
302
303
304
303
304
305
305306
306307
307308
......
309310
310311
311312
312
313
314
315
316
313
314
315
316
317
317318
318319
319320
......
482483
483484
484485
485
486
486487
487488
488489
*/
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;
}
// 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)
{
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);
char* tmp = malloc(strlen(name) + 1);
strcpy(tmp, name);
if(!load_module(tmp)) {
if(!load_module(tmp))
{
// failed to load
// free(tmp);
}
{
// 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;
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;
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)
}
}
break;
case LC_SEGMENT_64:// 64bit macho's
case LC_SEGMENT_64:// 64bit macho's
{
segCommand64 = binary + binaryIndex;
UInt32 sectionIndex;
branches/ErmaC/Enoch/i386/boot2/options.c
108108
109109
110110
111
112
113
114
115
111
112
113
116114
115
116
117117
118118
119119
......
122122
123123
124124
125
125
126126
127127
128128
129129
130
130
131131
132132
133
133
134134
135135
136136
137
137
138138
139
139
140140
141
142
141
142
143143
144144
145145
146146
147147
148148
149
150
149
150
151151
152
153
154
152
153
154
155155
156
157
158
156
157
158
159159
160
161
162
163
160
161
162
163
164164
165165
166166
167167
168168
169169
170
171
170
171
172172
173173
174174
......
176176
177177
178178
179
179
180180
181
181
182182
183
183
184184
185185
186186
......
196196
197197
198198
199
199
200
200201
201202
202203
......
219220
220221
221222
222
223
223
224
225
224226
225227
226228
227229
228230
229
230
231
231
232
233
234
235
236
232237
233
238
239
240
234241
235242
236243
237244
238
239
245
246
247
248
249
240250
241
251
252
253
242254
243255
244256
......
267279
268280
269281
270
271
272
273
274
282
283
284
285
286
275287
276
277
278
279
288
289
290
291
280292
281293
282294
283
284
285
295
296
297
286298
287
288
289
290
291
292
299
300
301
302
303
304
305
306
293307
294308
295309
......
361375
362376
363377
364
378
365379
366380
367381
368
382
369383
370384
371385
......
374388
375389
376390
377
391
378392
379393
380394
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 );
} 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 ) );
updateVRAM();
}
}
}
flushKeyboardBuffer();
flushKeyboardBuffer();
return ch;
return ch;
}
//==========================================================================
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);
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. ");
}
}
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;
}
}
//==========================================================================
// 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++ )
}
restoreCursor( &cursorState );
}
}
}
//==========================================================================
branches/ErmaC/Enoch/i386/util/boot1-install/boot1-install.c
3535
3636
3737
38
39
3840
3941
4042
......
544546
545547
546548
549
550
551
547552
548553
549554
......
598603
599604
600605
606
607
601608
602609
603610
......
736743
737744
738745
746
739747
740748
741749
......
776784
777785
778786
787
779788
780789
790
781791
782792
783793
_exfat = 1,
_hfs = 2,
_msdos = 3,
_ntfs = 4,
_ext4 = 5,
_other = 255
};
else
*pKind = _other;
break;
case _ntfs:
rc = 0;
break;
default:
break;
}
daVolumeKind = _hfs;
else if (!strcmp(cstr, "msdos"))
daVolumeKind = _msdos;
else if (!strcmp(cstr, "ntfs"))
daVolumeKind = _ntfs;
else
daVolumeKind = _other;
}
case _exfat:
case _hfs:
case _msdos:
case _ntfs:
break;
default:
unsupported();
}
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)
branches/ErmaC/Enoch/package/Changes.txt
1
2
13
24
35
- JrCs - boot1-install can show ntfs volume.
- ErmaC - Auto increase year for pkg resource.
- JrCs - Add translation to the project.
branches/ErmaC/Enoch/CHANGES
1
2
3
4
5
6
7
18
29
310
- 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 )

Archive Download the corresponding diff file

Revision: 2525