Chameleon

Chameleon Commit Details

Date:2012-10-29 00:51:19 (8 years 1 month ago)
Author:Evan Lojewski
Commit:2106
Parents: 2105
Message:Add kernel patcher module. Default to using the kernel cache. NOTE: You *must* use the kernel patcher module to use both the kernel cache and /Extra/Extensions at the same time.
Changes:
A/trunk/i386/modules/KernelPatcher/Cconfig
A/trunk/i386/modules/KernelPatcher/KernelPatcher.dylib
A/trunk/i386/modules/KernelPatcher/Makefile
A/trunk/i386/modules/KernelPatcher
M/trunk/i386/modules/Makefile
M/trunk/i386/boot2/boot.c
M/trunk/i386/modules/Cconfig

File differences

trunk/i386/boot2/boot.c
331331
332332
333333
334
335
336
337
338
339
334
340335
341336
342337
......
480475
481476
482477
483
478
484479
485480
486481
......
606601
607602
608603
609
610
611
612
613
614
615
616604
617
618605
619606
620607
......
645632
646633
647634
648
635
649636
650637
651638
// Since the kernel cache file exists and is the most recent try to load it
verbose("Loading kernel cache %s\n", kernelCachePath);
if (checkOSVersion("10.7") || checkOSVersion("10.8")) {
ret = LoadThinFatFile(kernelCachePath, binary);
} else {
ret = LoadFile(kernelCachePath);
*binary = (void *)kLoadAddr;
}
ret = LoadThinFatFile(kernelCachePath, binary);
return ret; // ret contain the length of the binary
}
while (1)
{
booltryresume, tryresumedefault, forceresume;
booluseKernelCache = false; // by default don't use prelink kernel cache
booluseKernelCache = true; // by default try to use the prelinked kernel
const char*val;
intlen, ret = -1;
longflags, sleeptime, time;
verbose("Loading Darwin %s\n", gMacOSVersion);
// If boot from boot helper partitions and OS is Lion use prelink kernel.
// We need to find a solution to load extra mkext with a prelink kernel.
if (gBootVolume->flags & kBVFlagBooter && (checkOSVersion("10.7") || checkOSVersion("10.8")))
useKernelCache = true;
else
useKernelCache = false; // by default don't use prelink kernel cache
getBoolForKey(kUseKernelCache, &useKernelCache, &bootInfo->chameleonConfig);
if (useKernelCache) do {
// Determine the name of the Kernel Cache
useKernelCache = false;
} while(0);
do {
if (useKernelCache) {
ret = LoadKernelCache(kernelCacheFile, &binary);
trunk/i386/modules/KernelPatcher/Cconfig
1
2
3
4
5
6
7
8
9
10
#
# Chameleon Modules
#
config KERNELPATCHER_MODULE
bool "KernelPatcher Module"
default y
---help---
Say Y here if you want to enable to use of this module.
trunk/i386/modules/KernelPatcher/Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
MODULE_NAME = KernelPatcher
MODULE_AUTHOR = Evan Lojewski
MODULE_DESCRIPTION = Kernel patcher
MODULE_VERSION = "1.1.0"
MODULE_COMPAT_VERSION = "1.0.0"
MODULE_START = $(MODULE_NAME)_start
MODULE_DEPENDENCIES =
DIR = KernelPatcher
include ../MakeInc.dir
$(SYMROOT)/modules/$(MODULE_NAME).dylib:
@cp $(MODULE_NAME).dylib $@
trunk/i386/modules/Cconfig
1010
1111
1212
13
1314
source "i386/modules/Sata/Cconfig"
source "i386/modules/Keylayout/Cconfig"
source "i386/modules/ACPIcodec/Cconfig"
source "i386/modules/KernelPatcher/Cconfig"
endmenu
trunk/i386/modules/Makefile
1111
1212
1313
14
14
1515
1616
1717
include ${SRCROOT}/Make.rules
# The order of building modules is important.
SUBDIRS =
SUBDIRS = KernelPatcher
ifdef CONFIG_KLIBC_MODULE
SUBDIRS += klibc

Archive Download the corresponding diff file

Revision: 2106