Chameleon

Chameleon Commit Details

Date:2011-08-19 21:03:50 (7 years 10 months ago)
Author:Evan Lojewski
Commit:1440
Parents: 1439
Message:Add FS detection code - patch from iFaboi, anval for FreeBSD and OpenBSD from navcomm and scorpius
Changes:
A/trunk/artwork/themes/default/device_openbsd.png
A/trunk/artwork/themes/default/device_befs_o.png
A/trunk/i386/libsaio/freebsd.c
A/trunk/i386/libsaio/befs.c
A/trunk/i386/libsaio/freebsd.h
A/trunk/artwork/themes/default/device_openbsd_o.png
A/trunk/artwork/themes/default/device_freebsd.png
A/trunk/i386/libsaio/befs.h
A/trunk/artwork/themes/default/device_befs.png
A/trunk/i386/libsaio/openbsd.c
A/trunk/i386/libsaio/openbsd.h
A/trunk/artwork/themes/default/device_freebsd_o.png
M/trunk/CREDITS
M/trunk/i386/libsaio/fdisk.h
M/trunk/i386/libsaio/saio_types.h
M/trunk/i386/boot2/gui.c
M/trunk/i386/libsaio/disk.c
M/trunk/i386/libsaio/Makefile

File differences

trunk/i386/libsaio/Makefile
3131
3232
3333
34
3435
3536
3637
SAIO_OBJS = table.o asm.o bios.o biosfn.o \
disk.o sys.o cache.o bootstruct.o \
stringTable.o load.o pci.o allocate.o misc.o \
befs.o freebsd.o openbsd.o \
vbe.o nbp.o hfs.o hfs_compare.o \
xml.o ntfs.o msdos.o md5c.o device_tree.o \
cpu.o platform.o acpi_patcher.o \
trunk/i386/libsaio/befs.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* befs.c
*
*
* Created by scorpius
* Copyright 2010
*
*/
#include "libsaio.h"
#include "sl.h"
#include "befs.h"
#define BeFSProbeSize2048
#define SUPER_BLOCK_MAGIC1 0x42465331 /* BFS1 */
#define SUPER_BLOCK_MAGIC2 0xdd121031
#define SUPER_BLOCK_MAGIC3 0x15b6830e
/* Find BeFS signature */
bool BeFSProbe (const void *buf)
{
return (OSReadLittleInt32(buf+0x220,0)==SUPER_BLOCK_MAGIC1);
}
/* Find BeFS volume label */
void BeFSGetDescription(CICell ih, char *str, long strMaxLen)
{
char * buf=malloc (BeFSProbeSize);
str[0]=0;
if (!buf)
return;
Seek(ih, 0);
Read(ih, (long)buf, BeFSProbeSize);
if (!BeFSProbe (buf))
{
free (buf);
return;
}
str[strMaxLen]=0;
strncpy (str, buf+0x200, MIN (strMaxLen, 32));
free (buf);
}
trunk/i386/libsaio/befs.h
1
2
3
4
5
6
7
8
9
10
11
/*
* befs.h
*
*
* Created by scorpius
* Copyright 2010
*
*/
extern bool BeFSProbe (const void *buf);
extern void BeFSGetDescription(CICell ih, char *str, long strMaxLen);
trunk/i386/libsaio/fdisk.h
5151
5252
5353
54
55
56
5457
5558
5659
#define FDISK_FAT320x0c/* FAT32 partition */
#define FDISK_DOS16SLBA 0x0e
#define FDISK_LINUX0x83
#define FDISK_OPENBSD0xa6 /* OpenBSD FFS partition */
#define FDISK_FREEBSD0xa5 /* FreeBSD UFS2 partition */
#define FDISK_BEFS0xeb /* Haiku BeFS partition */
#define FDISK_UFS0xa8/* Apple UFS partition */
#define FDISK_HFS0xaf/* Apple HFS partition */
#define FDISK_BOOTER0xab/* Apple booter partition */
trunk/i386/libsaio/disk.c
7373
7474
7575
76
77
78
7679
7780
7881
......
899902
900903
901904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
902938
903939
904940
......
10991135
11001136
11011137
1138
1139
1140
1141
11021142
11031143
1144
1145
11041146
11051147
11061148
......
16921734
16931735
16941736
1737
1738
16951739
16961740
16971741
16981742
1699
1700
1743
1744
1745
17011746
17021747
17031748
#include "ntfs.h"
#include "msdos.h"
#include "ext2fs.h"
#include "befs.h"
#include "freebsd.h"
#include "openbsd.h"
#include "xml.h"
#include "disk.h"
// For EFI_GUID
0, kBIOSDevTypeHardDrive, 0);
break;
case FDISK_BEFS:
bvr = newFDiskBVRef(
biosdev, partno,
part->relsect,
part,
0, 0, 0, 0, 0, 0,
BeFSGetDescription,
(BVFree)free,
0, kBIOSDevTypeHardDrive, 0);
break;
case FDISK_FREEBSD:
bvr = newFDiskBVRef(
biosdev, partno,
part->relsect,
part,
0, 0, 0, 0, 0, 0,
FreeBSDGetDescription,
(BVFree)free,
0, kBIOSDevTypeHardDrive, 0);
break;
case FDISK_OPENBSD:
bvr = newFDiskBVRef(
biosdev, partno,
part->relsect,
part,
0, 0, 0, 0, 0, 0,
OpenBSDGetDescription,
(BVFree)free,
0, kBIOSDevTypeHardDrive, 0);
break;
default:
bvr = newFDiskBVRef(
biosdev, partno,
result = FDISK_HFS;
else if (EX2Probe(probeBuffer))
result = FDISK_LINUX;
else if (FreeBSDProbe(probeBuffer))
result = FDISK_FREEBSD;
else if (OpenBSDProbe(probeBuffer))
result = FDISK_OPENBSD;
else if (NTFSProbe(probeBuffer))
result = FDISK_NTFS;
else if (BeFSProbe(probeBuffer))
result = FDISK_BEFS;
else if (fatbits=MSDOSProbe(probeBuffer))
{
switch (fatbits)
{ FDISK_DOS16SLBA,"Windows FAT16" },
{ FDISK_SMALLFAT32,"Windows FAT32" },
{ FDISK_FAT32,"Windows FAT32" },
{ FDISK_FREEBSD,"FreeBSD" },
{ FDISK_OPENBSD,"OpenBSD" },
{ FDISK_LINUX,"Linux" },
{ FDISK_UFS,"Apple UFS" },
{ FDISK_HFS,"Apple HFS" },
{ FDISK_BOOTER,"Apple Boot/UFS" },
{ 0xCD,"CD-ROM" },
{ 0x00,0 } /* must be last */
{ FDISK_BEFS,"Haiku" },
{ 0xCD,"CD-ROM" },
{ 0x00,0 } /* must be last */
};
//==========================================================================
trunk/i386/libsaio/openbsd.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "libsaio.h"
#include "sl.h"
#include "openbsd.h"
#define OpenBSDProbeSize2048
bool OpenBSDProbe (const void *buf)
{
return (OSReadLittleInt32(buf+0x200,0)==0x82564557);
}
void OpenBSDGetDescription(CICell ih, char *str, long strMaxLen)
{
char * buf=malloc(OpenBSDProbeSize);
str[0]=0;
if (!buf)
return;
Seek(ih, 0);
Read(ih, (long)buf, OpenBSDProbeSize);
if (!OpenBSDProbe (buf))
{
free (buf);
return;
}
if (OSReadLittleInt32 (buf+0x44c,0)<1)
{
free (buf);
return;
}
str[strMaxLen]=0;
strncpy (str, buf+0x478, MIN (strMaxLen, 32));
free (buf);
}
trunk/i386/libsaio/openbsd.h
1
2
extern bool OpenBSDProbe (const void *buf);
extern void OpenBSDGetDescription(CICell ih, char *str, long strMaxLen);
trunk/i386/libsaio/freebsd.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "libsaio.h"
#include "sl.h"
#include "freebsd.h"
#define FreeBSDProbeSize2048
bool FreeBSDProbe (const void *buf)
{
return (OSReadLittleInt32(buf+0xA55C,0)==0x19540119);
}
void FreeBSDGetDescription(CICell ih, char *str, long strMaxLen)
{
char * buf=malloc(FreeBSDProbeSize);
str[0]=0;
if (!buf)
return;
Seek(ih, 0);
Read(ih, (long)buf, FreeBSDProbeSize);
if (!FreeBSDProbe (buf))
{
free (buf);
return;
}
if (OSReadLittleInt32 (buf+0x44c,0)<1)
{
free (buf);
return;
}
str[strMaxLen]=0;
strncpy (str, buf+0x478, MIN (strMaxLen, 32));
free (buf);
}
trunk/i386/libsaio/freebsd.h
1
2
extern bool FreeBSDProbe (const void *buf);
extern void FreeBSDGetDescription(CICell ih, char *str, long strMaxLen);
trunk/i386/libsaio/saio_types.h
217217
218218
219219
220
220
221
222
223
221224
222225
223226
kPartitionTypeHPFS= 0x07,
kPartitionTypeFAT16= 0x06,
kPartitionTypeFAT32= 0x0c,
kPartitionTypeEXT3= 0x83
kPartitionTypeEXT3= 0x83,
kPartitionTypeBEFS= 0xEB,
kPartitionTypeFreeBSD= 0xa5,
kPartitionTypeOpenBSD= 0xa6
};
//#define BIOS_DEV_TYPE(d)((d) & kBIOSDevTypeMask)
trunk/i386/boot2/gui.c
4444
4545
4646
47
48
49
50
51
52
4753
4854
4955
......
9399
94100
95101
102
103
104
105
106
107
96108
97109
98110
......
304316
305317
306318
319
320
321
322
323
324
307325
308326
309327
......
763781
764782
765783
784
785
786
787
788
789
790
791
792
793
794
795
766796
767797
768798
iDeviceHFSRAID_o,
iDeviceEXT3,
iDeviceEXT3_o,
iDeviceFreeBSD, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
iDeviceFreeBSD_o, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
iDeviceOpenBSD, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
iDeviceOpenBSD_o, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
iDeviceBEFS, /* Haiku detection and Icon credits to scorpius */
iDeviceBEFS_o, /* Haiku detection and Icon credits to scorpius */
iDeviceFAT,
iDeviceFAT_o,
iDeviceFAT16,
{.name = "device_hfsraid_o", .image = NULL},
{.name = "device_ext3", .image = NULL},
{.name = "device_ext3_o", .image = NULL},
{.name = "device_freebsd", .image = NULL}, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
{.name = "device_freebsd_o", .image = NULL}, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
{.name = "device_openbsd", .image = NULL}, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
{.name = "device_openbsd_o", .image = NULL}, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
{.name = "device_befs", .image = NULL}, /* Haiku detection and Icon credits to scorpius */
{.name = "device_befs_o", .image = NULL}, /* Haiku detection and Icon credits to scorpius */
{.name = "device_fat", .image = NULL},
{.name = "device_fat_o", .image = NULL},
{.name = "device_fat16", .image = NULL},
LOADPNG(device_hfsraid_o, iDeviceHFSRAID);
LOADPNG(device_ext3, iDeviceGeneric);
LOADPNG(device_ext3_o, iDeviceEXT3);
LOADPNG(device_freebsd, iDeviceGeneric); /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
LOADPNG(device_freebsd_o, iDeviceFreeBSD); /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
LOADPNG(device_openbsd, iDeviceGeneric); /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
LOADPNG(device_openbsd_o, iDeviceOpenBSD); /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
LOADPNG(device_befs, iDeviceGeneric); /* Haiku detection and Icon credits to scorpius */
LOADPNG(device_befs_o, iDeviceBEFS); /* Haiku detection and Icon credits to scorpius */
LOADPNG(device_fat, iDeviceGeneric);
LOADPNG(device_fat_o, iDeviceFAT);
LOADPNG(device_fat16, iDeviceFAT);
devicetype = iDeviceNTFS;// Use HPFS / NTFS icon
break;
case kPartitionTypeBEFS: /* Haiku detection and Icon credits to scorpius */
devicetype = iDeviceBEFS;// Use BEFS / Haiku icon
break;
case kPartitionTypeFreeBSD: /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
devicetype = iDeviceFreeBSD; // Use FreeBSD icon
break;
case kPartitionTypeOpenBSD: /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
devicetype = iDeviceOpenBSD; // Use OpenBSD icon
break;
case kPartitionTypeFAT16:
devicetype = iDeviceFAT16;// Use FAT16 icon
break;
trunk/CREDITS
77
88
99
10
10
1111
1212
1313
Thanks to:
---------
JrCs, mercurysquad, munky, rekursor, kalyway, Krazubu, XyZ, blackosx, DHP
JrCs, mercurysquad, munky, rekursor, cosmolt, kalyway, Krazubu, THeKiNG, XyZ, blackosx, DHP, cparm, nawcom, anval, scorpius
Package:
---------

Archive Download the corresponding diff file

Revision: 1440