diff --git a/.gitignore b/.gitignore
index f491c27..c15d8f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,18 @@
.DS_Store
-data-hp.h
-data-asus.h
-settings-hp.h
-setting-asus.h
+
+out.log
+obj/*
+sym/*
+
+i386/config/SETTINGS/*.h
+
+i386/config/ACPI/default.h
+i386/config/ACPI/*Mac*.h
+
+i386/config/EFI/default.h
+i386/config/EFI/*Mac*.h
+
+i386/config/SMBIOS/default.h
+i386/config/SMBIOS/*Mac*.h
+
+i386/util/libcc_kext.a
\ No newline at end of file
diff --git a/CHANGES b/CHANGES
index e8624a6..c96a333 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,104 @@
+RevoBoot v1.5.35
+================
+- SMBIOS related enhancements for RevoBoot v1.5.35 (PikerAlpha, November 2012).
+- VERSION updated to v1.5.35
+
+
+RevoBoot v1.5.34
+================
+- LOAD_STATIC_EFI_DATA_FROM_EXTRA in settings-template.h renamed to LOAD_MODEL_SPECIFIC_EFI_DATA (PikerAlpha, October 2012).
+- LOAD_STATIC_SMBIOS_DATA_FROM_EXTRA in settings-template.h renamed to LOAD_MODEL_SPECIFIC_SMBIOS_DATA (PikerAlpha, October 2012).
+- New LOAD_MODEL_SPECIFIC_ACPI_DATA setting in settings-template.h (PikerAlpha, October 2012).
+- New LOAD_MODEL_SPECIFIC_STATIC_DATA setting in settings-template.h (PikerAlpha, October 2012).
+- VERSION updated to v1.5.34
+
+Notes:
+
+Static EFI/SMBIOS data will be used when RevoBoot can't find model specific data: /Extra/[EFI/SMBIOS]/MacModelNN.bin
+DSDT.aml will be loaded when RevoBoot can't find: /Extra/ACPI/DSDT-MacModelNN.aml (example).
+You must use the latest version of RevoBoot/i386/config/settings-template.h or things won't work.
+
+
+RevoBoot v1.5.33
+================
+- Restored lost lines in RevoBoot/i386/libsaio/SMBIOS/static_data.h (PikerAlpha, November 2012).
+- VERSION updated to v1.5.33
+
+
+RevoBoot v1.5.32
+================
+- Optionally include Recovery HD support code in boot.c (PikerAlpha, October 2012).
+- Renamed LION_RECOVERY_SUPPORT to CORE_STARAGE_SUPPORT in disk.c (PikerAlpha, October 2012).
+- Renamed LION_FILEVAULT_SUPPORT to CORE_STARAGE_SUPPORT in disk.c (PikerAlpha, November 2012).
+- Renamed encryptedBootPartition to coreStoragePartition in disk.c (PikerAlpha, October 2012).
+- Cleaned up settings-template.h (PikerAlpha, October 2012).
+- VERSION updated to v1.5.32
+
+
+RevoBoot v1.5.31
+================
+- STATIC_SYSTEM_SERIAL_NUMBER renamed to EFI_SYSTEM_SERIAL_NUMBER (PikerAlpha, October 2012).
+- Restored lost STATIC_SMSERIALNUMBER in setings-template.h (PikerAlpha, October 2012).
+- STATIC_SMSERIALNUMBER renamed to SMB_SYSTEM_SERIAL_NUMBER (PikerAlpha, October 2012).
+- VERSION updated to v1.5.31
+
+
+RevoBoot v1.5.30
+================
+- Move/update /Extra/ data reading to RevoBoot/i386/libsaio/load.c (PikerAlpha, October 2012).
+- Option to read /Extra/EFI/[MacModelNN.bin] when static EFI data is used (PikerAlpha, October 2012).
+- Option to read /Extra/SMBIOS/[MacModelNN.bin] when static SMBIOS data is used (PikerAlpha, October 2012).
+- Makefile changes for above features(PikerAlpha, October 2012).
+- VERSION updated to v1.5.30
+
+
+RevoBoot v1.5.25
+================
+- RevoBoot/i386/config/data.h is no longer included with (PikerAlpha, October 2012).
+- New static data paths in RevoBoot/i386/libsaio/Makefile (PikerAlpha, October 2012).
+- Use model identifier as filename for static data (PikerAlpha, October 2012).
+- VERSION updated to v1.5.25
+
+
+RevoBoot v1.5.23
+================
+- Bug fix and cleanups in RevoBoot/i386/libsaio/SMBIOS/dynamic_data.h (PikerAlpha, October 2012).
+- VERSION updated to v1.5.23
+
+
+RevoBoot v1.5.22
+================
+- Bug fix in RevoBoot/Makefile (PikerAlpha, October 2012).
+- VERSION updated to v1.5.22
+
+
+RevoBoot v1.5.21
+================
+- Model data for new Macmini6,N added (PikerAlpha, October 2012).
+- VERSION updated to v1.5.21
+
+
+RevoBoot v1.5.20
+================
+- Automatic data selection for ACPI/EFI and SMBIOS data (PikerAlpha, October 2012)
+- Copies ACPI/EFI/SMBIOS/data-template.h to [your model.h] for new configurations (PikerAlpha, October 2012)
+
+
+RevoBoot v1.5.10
+================
+- Makefiles cleaned up/optimized (PikerAlpha, October 2012).
+- make now defaults to Mountain Lion (PikerAlpha, October 2012).
+- MODEL=[your model] argument added to makefiles (PikerAlpha, October 2012).
+- MODEL=$1 added to RevoBoot/r for optional model identifier (PikerAlpha, October 2012).
+- make now creates RevoBoot/i386/config/SETTINGS when missing (PikerAlpha, October 2012).
+- Makefile now copies settings-template.h to SETTINGS/[your model.h] when missing (PikerAlpha, October 2012).
+
+
+RevoBoot v1.5.01
+================
+- MacPro SMBIOS board serial/type added (dgsga, October 2012).
+
+
RevoBoot v1.5.00
================
- RevoBoot project forked (PikerAlpha, October 2012).
diff --git a/Makefile b/Makefile
index 8216a1e..2a7a5f8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,27 +1,33 @@
#
-# Makefile for RevoBoot
+# File: RevoBoot/Makefile
+#
+# Updates:
+#
+# - Major cleanup (PikerAlpha, October 2012).
+# - Output improvements (PikerAlpha, October 2012).
+# - Default build target is now Mountain Lion (PikerAlpha, October 2012).
+# - PRODUCT_MODEL_TARGET for target build model added (PikerAlpha, October 2012).
+# - Creates RevoBoot/config/SETTINGS when missing (PikerAlpha, October 2012).
+# - Copies settings-template.h to SETTINGS/ModelnameNN.h when missing (PikerAlpha, October 2012).
+# - Automatic ACPI/EFI/SMBIOS data selection (PikerAlpha, October 2012).
+# - Copies ACPI/EFI/SMBIOS/data-template.h for new conigurations (PikerAlpha, October 2012).
+# - Output added for cp/mkdir/rm actions (PikerAlpha, November 2012).
+# - New build target 'help' added (PikerAlpha, November 2012).
+#
+
+#
+# Include Apple makefile definitions.
#
export USE_APPLE_PB_SUPPORT = all
-# CFLAGS = -O $(MORECPP) -arch i386 -g
-DEFINES=
-CONFIG = hd
LIBDIR = libsa
INC = -I. -I$(LIBDIR)
-ifneq "" "$(wildcard /bin/mkdirs)"
- MKDIRS = /bin/mkdirs
-else
- MKDIRS = /bin/mkdir -p
-endif
-AS = as
-LD = ld
+
PAX = /bin/pax
OBJROOT = `pwd`/obj
SYMROOT = `pwd`/sym
-DSTROOT = `pwd`/dst
-SRCROOT = /tmp
#
# Export version number (picked up by i386/libsaio/Makefile)
@@ -31,69 +37,156 @@ export PRODUCT_VERSION_NUMBER = `cat ../../VERSION`
EXCLUDE = --exclude=.DS_Store --exclude=sym --exclude=obj --exclude=*.sh
-ARCHLESS_RC_CFLAGS=`echo $(RC_CFLAGS) | sed 's/-arch [a-z0-9]*//g'`
+#
+# Search paths.
+#
VPATH = $(OBJROOT):$(SYMROOT)
-GENERIC_SUBDIRS =
-
#
-# Export target OS type (picked up by i386/libsaio/Makefile)
+# Check if OS build target is specified (example: make mountain-lion).
#
-ifeq ($(MAKECMDGOALS), mountain-lion)
+ifeq ($(MAKECMDGOALS),)
+ #
+ # No OS build target given. Build for Mountain Lion (default).
+ #
MAKE_TARGET_OS = 6;
+ MAKEGOAL = mountain-lion
else
- ifeq ($(MAKECMDGOALS), lion)
- MAKE_TARGET_OS = 2;
+ #
+ # Setting MAKE_TARGET_OS and MAKEGOAL based on OS build target.
+ #
+ ifeq ($(MAKECMDGOALS), mountain-lion)
+ MAKE_TARGET_OS = 6;
+ MAKEGOAL = mountain-lion
else
- MAKE_TARGET_OS = 1;
+ ifeq ($(MAKECMDGOALS), lion)
+ MAKE_TARGET_OS = 2;
+ MAKEGOAL = lion
+ else ifeq ($(MAKECMDGOALS), legacy)
+ MAKE_TARGET_OS = 1;
+ MAKEGOAL = legacy
+ endif
endif
endif
+#
+# Export our make goal i.e. mountain-lion, lion or legacy (snow-leopard or leopard).
+#
+
+export MAKEGOAL
+
+#
+# Export OS build target (picked up by: i386/libsaio/Makefile).
+#
+
export PRODUCT_OS_TARGET = `echo $(MAKE_TARGET_OS)`
-lion: all
-mountain-lion: all
-
-all: $(SYMROOT) $(OBJROOT)
- @if [ -z "$(RC_ARCHS)" ]; then \
- RC_ARCHS="i386"; \
- fi; \
- SUBDIRS="$(GENERIC_SUBDIRS) $$RC_ARCHS"; \
- for i in $$SUBDIRS; \
- do \
- if [ -d $$i ]; then \
- echo ================= make $@ for $$i =================; \
- ( OBJROOT=$(OBJROOT)/$${i}; \
- SYMROOT=$(SYMROOT)/$${i}; \
- DSTROOT=$(DSTROOT); \
- XCFLAGS=$(ARCHLESS_RC_CFLAGS); \
- GENSUBDIRS="$(GENERIC_SUBDIRS)"; \
- for x in $$GENSUBDIRS; \
- do \
- if [ "$$x" == "$$i" ]; then \
- XCFLAGS="$(RC_CFLAGS)"; \
- break; \
- fi \
- done; \
- echo "$$OBJROOT $$SYMROOT $$DSTROOT"; \
- cd $$i; ${MAKE} \
- "OBJROOT=$$OBJROOT" \
- "SYMROOT=$$SYMROOT" \
- "DSTROOT=$$DSTROOT" \
- "SRCROOT=$$SRCROOT" \
- "RC_ARCHS=$$RC_ARCHS" \
- "TARGET=$$i" \
- "RC_CFLAGS=$$XCFLAGS" $@ \
- ) || exit $$?; \
- else \
- echo "========= Nothing to build for $$i ========="; \
- fi; \
- done
+#
+# Check if a target model was specified (example: make MODEL=16 mountain-lion).
+#
+
+ifdef MODEL
+ #
+ # MODEL=[MacModelNN] specified, export target model as PRODUCT_MODEL_TARGET.
+ #
+ ifneq ($(MODEL),)
+ export MAKE_TARGET_MODEL = $(MODEL)
+ #
+ # Include static ACPI/EFI/SMBIOS data file per model identifier.
+ #
+ DATA_FILE = $(MODEL)
+ else
+ export MAKE_TARGET_MODEL = default
+ #
+ # Include default/empty static data file (no model identifier specified).
+ #
+ DATA_FILE = data-template
+ endif
+else
+ #
+ # Include default settings template (no model identifier specified).
+ #
+ export MAKE_TARGET_MODEL = default
+ #
+ # Include default/empty static data file (no model identifier specified).
+ #
+ DATA_FILE = data-template
+endif
+
+#
+# Export target filenames for static ACPI, EFI and SMBIOS data.
+#
+
+export MAKE_ACPI_DATA_FILE = ACPI/$(DATA_FILE).h
+export MAKE_EFI_DATA_FILE = EFI/$(DATA_FILE).h
+export MAKE_SMBIOS_DATA_FILE = SMBIOS/$(DATA_FILE).h
+
+#
+# Our one and only build target directory.
+#
+
+ARCH_DIR=i386
+
+CONFIG_DIR=$(ARCH_DIR)/config
+
+SETTINGS_DIR=$(CONFIG_DIR)/SETTINGS
+SETTINGS_FILE=$(SETTINGS_DIR)/$(MAKE_TARGET_MODEL).h
+
+$(MAKEGOAL): $(SYMROOT) $(OBJROOT)
+ @if [ ! -f $(CONFIG_DIR)/$(MAKE_ACPI_DATA_FILE) ]; then \
+ echo "\t[CP] $(CONFIG_DIR)/ACPI/data-template.h $(CONFIG_DIR)/$(MAKE_ACPI_DATA_FILE)"; \
+ cp -n $(CONFIG_DIR)/ACPI/data-template.h $(CONFIG_DIR)/$(MAKE_ACPI_DATA_FILE); \
+ fi;
+
+ @if [ ! -f $(CONFIG_DIR)/$(MAKE_EFI_DATA_FILE) ]; then \
+ echo "\t[CP] $(CONFIG_DIR)/EFI/data-template.h $(CONFIG_DIR)/$(MAKE_EFI_DATA_FILE)"; \
+ cp -n $(CONFIG_DIR)/EFI/data-template.h $(CONFIG_DIR)/$(MAKE_EFI_DATA_FILE); \
+ fi;
+
+ @if [ ! -f $(CONFIG_DIR)/$(MAKE_SMBIOS_DATA_FILE) ]; then \
+ echo "\t[CP] $(CONFIG_DIR)/SMBIOS/data-template.h $(CONFIG_DIR)/$(MAKE_SMBIOS_DATA_FILE)"; \
+ cp -n $(CONFIG_DIR)/SMBIOS/data-template.h $(CONFIG_DIR)/$(MAKE_SMBIOS_DATA_FILE); \
+ fi;
+
+ @if [ ! -d $(SETTINGS_DIR) ]; then \
+ echo "\t[MKDIR] $(SETTINGS_DIR)"; \
+ /bin/mkdir -p $(SETTINGS_DIR); \
+ fi;
+
+ @if [ ! -f $(SETTINGS_FILE) ]; then \
+ echo "\t[CP] $(CONFIG_DIR)/settings-template.h $(SETTINGS_FILE)"; \
+ cp -n $(CONFIG_DIR)/settings-template.h $(SETTINGS_FILE); \
+ fi;
+
+ @if [ -d $(ARCH_DIR) ]; then \
+ echo ================= make MODEL=$(MAKE_TARGET_MODEL) $@ for: RevoBoot/$(ARCH_DIR) =================; \
+ ( OBJROOT=$(OBJROOT)/$(ARCH_DIR); \
+ SYMROOT=$(SYMROOT)/$(ARCH_DIR); \
+ XCFLAGS="$(RC_CFLAGS)"; \
+ echo "$$OBJROOT $$SYMROOT"; \
+ cd $(ARCH_DIR); ${MAKE} \
+ "OBJROOT=$$OBJROOT" \
+ "SYMROOT=$$SYMROOT" \
+ "RC_ARCHS=$(ARCH_DIR)" \
+ "TARGET=$(ARCH_DIR)" \
+ "RC_CFLAGS=$$XCFLAGS" $@ \
+ ) || exit $$?; \
+ fi;
clean:
+ @if [ -d "$(OBJROOT)" ];then echo "\t[RMDIR] $(OBJROOT)"; fi
+ @if [ -d "$(SYMROOT)" ];then echo "\t[RMDIR] $(SYMROOT)"; fi
rm -rf sym obj dst out.log
-$(SYMROOT) $(OBJROOT) $(DSTROOT):
- @$(MKDIRS) $@
+help:
+ @echo
+ @echo 'Build targets:'
+ @echo ' - Build all targets [DEFAULT]'
+ @echo
+ @echo 'Cleaning targets:'
+ @echo ' clean - Remove generated files'
+
+$(SYMROOT) $(OBJROOT):
+ @/bin/mkdir -p $@
diff --git a/README b/README
index 00f967b..5ee4a81 100644
--- a/README
+++ b/README
@@ -1,5 +1,35 @@
-RevoBoot can now be build with Xcode 4.5.1 on Mountain Lion. See change log for instructions.
+About this project:
+-------------------
+This Open Source hobby project is maintained by Pike and dgsga. Two long time supporters of the RevoBoot project.
+Note that we do not tolerate/share any (links to) copyrighted material. We only use purchased software and we won't share any of it. Just get your copy of OS X in the Apple store. Should be affordable for everyone.
+
+Mountain Lion Server:
+---------------------
+RevoBoot has been confirmed to work with the Server app for Mountain Lion (12C60).
+
+Fusion Drive Support:
+---------------------
+Apple's new Fusion Drive* is a software implementation to speedup the boot and load process for frequently used applications, without limiting the storage capacity in a bad way. See also: http://support.apple.com/kb/HT5446
+
+The new Mac's that come with a Fusion Drive boot from the third (Recovery HD like) partition on the SSD. This partition is 134.2 MB in size and is called "Boot OS X".
+The Recovery HD partition can be found as third partition on the HDD. Setting up a Fusion Drive on a Mac need to be done with Internet Recovery.
+
+RevoBoot detects CoreStorage partitions and will boot from the boot helper partition on the SDD.
+
+NetBoot/NetInstall:
+-------------------
+People who have Mountain Lion Server setup and like to install their hack from it... sorry that won't work. The source
+code snippets for it have been stripped out (by Master Chief in 2009) but we will fix this in a next update of RevoBoot.
+
+Xcode Support for Mountain Lion:
+--------------------------------
+RevoBoot can be built on Snow Leopard, Lion and Mountain Lion. The latter requires Xcode 4.5.1 (and greater) and libcc_kext.a from an older version of Xcode. See change log for instructions.
+
+Note: The latest release of Xcode (4.5.2) also works with fine with an older copy libcc_kext.a.
+
+Configuration:
+--------------
Please note that RevoBoot must be configured for your hardware so start reading our WiKi. See also:
https://github.com/blackosx/RevoBuilder/wiki/Using-RevoBuilder
@@ -8,6 +38,8 @@ We also have a configuration README available at:
https://github.com/RevoGirl/RevoBoot/blob/master/i386/config/README
-There's also RevoBuilder (a great tool for first starters) over at:
+There is also a tool called RevoBuilder (great tool for first starters) available over at:
https://github.com/blackosx/RevoBuilder/wiki/Using-RevoBuilder
+
+Note: RevoBuilder is most likely broken as of RevoBoot v.1.5.00!
diff --git a/VERSION b/VERSION
index 4ada1d8..ff4e38d 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.5.00
+1.5.35
diff --git a/c b/c
index 892a658..1928ec4 100755
--- a/c
+++ b/c
@@ -1,3 +1,3 @@
-sudo cp sym/i386/boot /Volumes/USBBOOT/
-sudo diskutil unmount /Volumes/USBBOOT
+sudo cp sym/i386/boot /Volumes/$1/
+sudo diskutil unmount /Volumes/$1
diff --git a/i386/MakeInc.dir b/i386/MakeInc.dir
index 77611ac..ddb327c 100755
--- a/i386/MakeInc.dir
+++ b/i386/MakeInc.dir
@@ -1,16 +1,11 @@
#
-# Common makefile targets.
+# File: RevoBoot/i386/MakeInc.dir
#
-# Define these variables (if desired) in directory makefiles:
-# DIRS_NEEDED
-# INSTALLDIR
-# SRCROOT
+# Updates:
#
-ifneq "" "$(wildcard /bin/mkdirs)"
- MKDIRS = /bin/mkdirs
-else
- MKDIRS = /bin/mkdir -p
-endif
+# - Major cleanup (PikerAlpha, October 2012).
+#
+
#
# Use /usr/bin/gcc instead of /usr/bin/cc (symbolic link to clang in Xcode 4.3.2 and greater).
@@ -26,22 +21,6 @@ CC = gcc
#OMIT_FRAME_POINTER_CFLAG=-fomit-frame-pointer
OMIT_FRAME_POINTER_CFLAG=
-installsrc:: $(SRCROOT)
- cp $(ALLSRC) $(SRCROOT)
- cd $(SRCROOT); chmod a-w $(ALLSRC)
-
-install:: installhdrs
- @if [ -z "$(RC_ARCHS)" -o -n "$(RC_i386)" ]; then \
- $(MAKE) install_i386 OBJROOT=${OBJROOT} \
- SYMROOT=${SYMROOT} DSTROOT=${DSTROOT} \
- SRCROOT=${SRCROOT}; \
- else \
- echo i386 not selected - null build.; \
- fi
-
-install_i386:: all
-
-installhdrs::
.SUFFIXES: .s .i .c .o
@@ -69,5 +48,5 @@ boot2.o:
$(OBJROOT)/%.o: %.s
$(CC) $(CPPFLAGS) -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) $<
-$(DIRS_NEEDED) $(INSTALLDIR) $(SRCROOT):
- $(MKDIRS) $@
+$(DIRS_NEEDED): # $(INSTALLDIR) $(SRCROOT):
+ @/bin/mkdir -p $@
diff --git a/i386/MakePaths.dir b/i386/MakePaths.dir
index 978ddf4..b4b04c5 100755
--- a/i386/MakePaths.dir
+++ b/i386/MakePaths.dir
@@ -1,9 +1,15 @@
+#
+# File: RevoBoot/i386/MakePaths.dir
+#
+# Updates:
+#
+# - Major cleanup (PikerAlpha, October 2012).
+#
+
+
#
# Default paths for subdirectories.
#
OBJROOT=../../obj/i386/$(DIR)
SYMROOT=../../sym/i386
-DSTROOT=../../dst/i386
-SRCROOT=/tmp
-
diff --git a/i386/Makefile b/i386/Makefile
index 7d96cf6..9b930a8 100644
--- a/i386/Makefile
+++ b/i386/Makefile
@@ -1,49 +1,38 @@
#
-# Makefile for RevoBoot
+# File: RevoBoot/i386/Makefile
+#
+# Updates:
+#
+# - Major cleanup (PikerAlpha, October 2012).
+# - Output improvements (PikerAlpha, October 2012).
+# - PRODUCT_MODEL_TARGET renamed to MAKE_TARGET_MODEL (PikerAlpha, November 2012).
+# - Cleanup and output changed (PikerAlpha, October 2012).
#
-
-CFLAGS = -O $(MORECPP) -arch i386 -g -static
-CONFIG = hd
-LIBDIR = libsa
-INC = -I. -I$(LIBDIR)
-ifneq "" "$(wildcard /bin/mkdirs)"
- MKDIRS = /bin/mkdirs
-else
- MKDIRS = /bin/mkdir -p
-endif
-AS = as
-LD = ld
#
# These paths are only valid in subdirectories of this directory.
#
-OBJROOT=`pwd`/../../obj/i386
-SYMROOT=`pwd`/../../sym/i386
-DSTROOT=`pwd`/../../dst/i386
-SRCROOT=/tmp
+OBJROOT=../i386/obj/i386
+SYMROOT=../i386/sym/i386
-VPATH = $(OBJROOT):$(SYMROOT)
+# VPATH = $(OBJROOT):$(SYMROOT)
#
-# The build over here is important.
+# The build order here is important.
#
SUBDIRS = util libsa libsaio boot2
-lion: all
-mountain-lion: all
-all:
- @for i in ${SUBDIRS}; \
+$(MAKEGOAL):
+ @for i in $(SUBDIRS); \
do \
- echo ================= make $@ for $$i =================; \
- ( cd $$i; ${MAKE} \
- "OBJROOT=$(OBJROOT)/$$i" \
- "SYMROOT=$(SYMROOT)" \
- "DSTROOT=$(DSTROOT)" \
- "SRCROOT=$(SRCROOT)" \
- "RC_ARCHS=$(RC_ARCHS)" \
- "RC_CFLAGS=$(RC_CFLAGS)" $@ \
- ) || exit $$?; \
+ echo ================= RevoBoot/i386/$$i =================; \
+ ( cd $$i; ${MAKE} \
+ "OBJROOT=$(OBJROOT)/$$i" \
+ "SYMROOT=$(SYMROOT)" \
+ "RC_ARCHS=$(RC_ARCHS)" \
+ "RC_CFLAGS=$(RC_CFLAGS)" $@ \
+ ) || exit $$?; \
done
diff --git a/i386/boot2/Makefile b/i386/boot2/Makefile
index 0c368d7..7c0970d 100644
--- a/i386/boot2/Makefile
+++ b/i386/boot2/Makefile
@@ -1,37 +1,31 @@
-# Makefile for i386 boot program
-# define FLOPPY and SMALL using DEFINES macro as necessary
+#
+# File: RevoBoot/i386/boot2/Makefile
+#
+# Updates:
+#
+# - Support for self compiled libcc_kext.a added (PikerAlpha, October 2012).
+# - Major cleanup (PikerAlpha, October 2012).
+#
-DIR = boot2
include ../MakePaths.dir
OPTIM = -Os -Oz
CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror \
-fno-builtin -DSAIO_INTERNAL_USER -static $(OMIT_FRAME_POINTER_CFLAG) \
-DMAKE_TARGET_OS=$(PRODUCT_OS_TARGET) \
+ -DSETTINGS_FILE=SETTINGS/$(MAKE_TARGET_MODEL).h \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float
-DEFINES=
-CONFIG = hd
-SYMDIR = $(SYMROOT)
LIBSADIR = ../libsa
LIBSAIODIR = ../libsaio
UTILDIR = ../util
-INC = -I. -I.. -I$(SYMDIR) -I$(LIBSADIR) -I$(LIBSAIODIR) -I$(UTILDIR)
-
-ifneq "" "$(wildcard /bin/mkdirs)"
- MKDIRS = /bin/mkdirs
-else
- MKDIRS = /bin/mkdir -p
-endif
-
-AS = as
-LD = gcc
+INC = -I. -I.. -I$(SYMROOT) -I$(LIBSADIR) -I$(LIBSAIODIR) -I$(UTILDIR)
-LIBS= -L$(SYMDIR) -lsaio -lsa
-LIBDEP= $(SYMDIR)/libsaio.a $(SYMDIR)/libsa.a
+LIBS = -L$(SYMROOT) -lsaio -lsa
+LIBDEP = $(SYMROOT)/libsaio.a $(SYMROOT)/libsa.a
#
# build_gcc no longer builds libgcc.a and libcc_kext.a with 'all' target
@@ -51,48 +45,37 @@ ifeq ($(wildcard $(LIBCC)),)
LIBCC= `find /usr/llvm-gcc-*/lib/gcc/*/*/ -name \libcc_kext.a`
endif
-OTHER_FILES =
-INSTALLDIR = $(DSTROOT)/usr/standalone/i386
VPATH = $(OBJROOT):$(SYMROOT)
#
-# The ordering is important;
+# The order of object filenames below is important;
#
OBJS = boot2.o boot.o bootlogo.o graphics.o drivers.o options.o lzss.o
-UTILDIR = ../util
-SFILES = boot2.s
-CFILES = boot.c bootlogo.c graphics.c drivers.c options.c
-HFILES = boot.h bootlogo.h
-
-OTHERFILES = Makefile
-ALLSRC = $(FOREIGNSRC) $(FOREIGNBIN) $(SFILES) $(CFILES) $(HFILES) $(OTHERFILES)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
BOOT2ADDR = 20200
-MAXBOOTSIZE = 392704
-lion: all
-mountain-lion: all
+#
+# Set maximum size of the booter to 128KB (should be more than sufficient).
+#
+MAXBOOTSIZE = 131072
-all: $(DIRS_NEEDED) boot
+$(MAKEGOAL): $(DIRS_NEEDED) boot
boot: machOconv $(OBJS) $(LIBDEP)
$(UTILDIR)/ld_classic -static -preload -segaddr __INIT $(BOOT2ADDR) \
- -arch i386 -segalign 20 \
+ -arch i386 -segalign 20 \
-o $(SYMROOT)/boot.sys $(filter %.o,$^) $(LIBS) $(LIBCC)
machOconv $(SYMROOT)/boot.sys $(SYMROOT)/boot
size $(SYMROOT)/boot.sys
ls -l $(SYMROOT)/boot
@( size=`ls -l $(SYMROOT)/boot | awk '{ print $$5}'` ; \
- if expr "$$size" ">" "$(MAXBOOTSIZE)" > /dev/null ;\
+ if expr "$$size" ">" "$(MAXBOOTSIZE)" > /dev/null ; \
then \
- echo "Booter executable larger than $(MAXBOOTSIZE) bytes" ;\
- rm $(SYMROOT)/boot ;\
- exit 1;\
+ echo "Error: Booter executable larger than $(MAXBOOTSIZE) bytes" ; \
+ rm $(SYMROOT)/boot ; \
+ exit 1 ; \
fi)
include ../MakeInc.dir
-
-#dependencies
--include $(OBJROOT)/Makedep
diff --git a/i386/boot2/boot.c b/i386/boot2/boot.c
index 50f3e56..47d7524 100755
--- a/i386/boot2/boot.c
+++ b/i386/boot2/boot.c
@@ -46,8 +46,10 @@
* Reworked again by Curtis Galloway (galloway@NeXT.com)
*/
-/*
- * Refactorized by DHP in 2010 and 2011.
+/*
+ * Updates:
+ * - Refactorized by DHP in 2010 and 2011.
+ * - Optionally include Recovery HD support code (PikerAlpha, November 2012).
*/
@@ -193,6 +195,7 @@ void boot(int biosdev)
showBootLogo();
#endif
+#if LION_RECOVERY_SUPPORT
// A bit ugly maybe, but this will be changed sometime soon.
while (readKeyboardStatus())
{
@@ -203,8 +206,16 @@ void boot(int biosdev)
gPlatform.BootRecoveryHD = true;
}
}
+#endif
+#if (LOAD_MODEL_SPECIFIC_EFI_DATA == 0)
+ /*
+ * We can only make this call here when static EFI is included from
+ * RevoBoot/i386/config/EFI/[MacModelNN.h] Not when the data is read
+ * from: /Extra/ because then: RevoBoot/i386/libsaio/platform.c calls it.
+ */
initPartitionChain();
+#endif
#define loadCABootPlist() loadSystemConfig(&bootInfo->bootConfig)
diff --git a/i386/config/ACPI/data.h b/i386/config/ACPI/data.h
index 6a80eac..e69de29 100755
--- a/i386/config/ACPI/data.h
+++ b/i386/config/ACPI/data.h
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2009 Master Chief. All rights reserved.
- *
- * Note: This is an essential part of the build process for Revolution v0.6.43 and greater.
- *
- *
- * Latest cleanups and additional directives added by DHP in 2011
- */
-
-
-//--------------------------------------------------------- ESSENTIAL ACPI TABLES -------------------------------------------------------------
-
-
-#if STATIC_APIC_TABLE_INJECTION
- #define STATIC_APIC_TABLE_DATA \
- /* 0x0000 */ // Insert your APIC table replacement here (optional).
-#endif
-
-
-#if STATIC_ECDT_TABLE_INJECTION
- #define STATIC_ECDT_TABLE_DATA \
- /* 0x0000 */ // Insert your ECDT table replacement here (optional).
-#endif
-
-
-#if STATIC_HPET_TABLE_INJECTION
- #define STATIC_HPET_TABLE_DATA \
- /* 0x0000 */ // Insert your HPET table replacement here (optional).
-#endif
-
-
-#if STATIC_MCFG_TABLE_INJECTION
- #define STATIC_MCFG_TABLE_DATA \
- /* 0x0000 */ // Insert your MCFG table replacement here (optional).
-#endif
-
-
-#if STATIC_SBST_TABLE_INJECTION
- #define STATIC_SBST_TABLE_DATA \
- /* 0x0000 */ // Insert your SBST table replacement here (optional).
-#endif
-
-
-#if STATIC_SSDT_TABLE_INJECTION
- #define STATIC_SSDT_TABLE_DATA \
- /* 0x0000 */ // Insert your SSDT table replacement here (optional).
-#endif
-
-
-//--------------------------------------------------------- SECONDARY ACPI TABLES -------------------------------------------------------------
-
-
-#if STATIC_DSDT_TABLE_INJECTION
- #define STATIC_DSDT_TABLE_DATA \
- /* 0x0000 */ // Insert your DSDT table replacement here (optional).
-#endif
-
-
-#if STATIC_FACS_TABLE_INJECTION
- #define STATIC_FACS_TABLE_DATA \
- /* 0x0000 */ // Insert your FACS table replacement here (optional).
-#endif
-
-
-//---------------------------------------------------------- OPTIONAL ACPI TABLES -------------------------------------------------------------
-
-
-#if STATIC_APIC2_TABLE_INJECTION
- #define STATIC_APIC2_TABLE_DATA \
- /* 0x0000 */ // Insert a second APIC table (replacement) here (optional).
-#endif
-
-
-#if STATIC_SSDT_GPU_TABLE_INJECTION
- #define STATIC_SSDT_GPU_TABLE_DATA \
- /* 0x0000 */ // Insert your SSDT_GPU table replacement here (optional).
-#endif
-
-
-#if STATIC_SSDT_PR_TABLE_INJECTION
- #define STATIC_SSDT_PR_TABLE_DATA \
- /* 0x0000 */ // Insert your SSDT_PR table replacement here (optional).
-#endif
-
-
-#if STATIC_SSDT_SATA_TABLE_INJECTION
- #define STATIC_SSDT_SATA_TABLE_DATA \
- /* 0x0000 */ // Insert your SSDT_SATA table replacement here (optional).
-#endif
-
-
-#if STATIC_SSDT_USB_TABLE_INJECTION
- #define STATIC_SSDT_USB_TABLE_DATA \
- /* 0x0000 */ // Insert your SSDT_USB table replacement here (optional).
-#endif
-
-//================================================================= END ====================================================================
diff --git a/i386/config/README b/i386/config/README
index dfacdef..e9dc128 100644
--- a/i386/config/README
+++ b/i386/config/README
@@ -4,8 +4,9 @@ RevoBoot comes with configuration templates of which some you need to change:
ACPI/data-template.h
--------------------
-This file is optional. Only required when you want to inject static ACPI table data.
-Copy/rename the file to data.h and add your (modified) ACPI tables.
+RevoBoot's build process will copy this file for new configurations to the target modelidentifier
+and use it, but only when you didn't already do this yourself. Make all required changes in
+the new file only or it won't be used at all.
Note: We use 'factory tables' for the original ACPI tables in the BIOS and 'modified'
for new/modified ACPI tables.
@@ -14,8 +15,9 @@ Note: We use 'factory tables' for the original ACPI tables in the BIOS and 'modi
EFI/data-template.h
-------------------
-This file is optional. Only required when you want/need to inject EFI device properties.
-Copy/rename the file to data.h and add your EFI device properties.
+RevoBoot's build process will copy this file for new configurations to the target modelidentifier
+and use it, but only when you didn't already do this yourself. Make all required changes in
+the new file only or it won't be used at all.
Note: A simple HOWTO will (hopefully) soon be added to the EFI directory.
@@ -23,36 +25,38 @@ Note: A simple HOWTO will (hopefully) soon be added to the EFI directory.
SMBIOS/data-template.h
----------------------
-This file is optional. Only required when you want to inject static ACPI table data.
-Copy/rename the file to data.h and add your static SMBIOS data.
+RevoBoot's build process will copy this file for new configurations to the target modelidentifier
+and use it, but only when you didn't already do this yourself. Make all required changes in
+the new file only or it won't be used at all.
Note: You can extract the SMBIOS table data with: /smbios/tools/smbios2struct2
Make instruction are included in the source code.
+settings.h
+----------
+
+This file selects the target settings file based on the specified model identifier. Using
+make MODEL=Macmini51 or use ./r Macmini51 (examples) makes it select RevoBoot/i386/config/SETTINGS/Macmini51.h
+All future changes need to be made in this file, or they won't be picked up.
+
+
settings-template.h
-------------------
-This is the default configuration template for RevoBoot. Every possible option can be found in it.
-You have to either copy or rename this file to settings.h and change it so that it matches your
-hardware configuration.
+RevoBoot's build process first checks RevoBoot/i386/config/SETTINGS/*.h per target model identifier
+(example: Macmini51,h) and use it, or copies RevoBoot/i386/config/settings-template.h to the target model
+identifier (when the file is missing) to prevent build errors.
+People with working RevoBoot configurations can simply copy their settings.h to SETTINGS/[your model].h
+This will allow the RevoBoot build process to compile without errors, but make sure to use the latest
+preprocessor options.
-data-template.h
----------------
-RevoBoot has one main include file for static data in the ACPI, EFI and SMBIOS directories.
-This enables you to add files for different target configurations there. Here's an example
-for two setups:
-
-#include "ACPI/data-hp.h"
-#include "EFI/data-hp.h"
-#include "SMBIOS/data-hp.h"
+ACPI/EFI/SMBIOS/data.h
+----------------------
-or (not both):
+These are RevoBoot's main data selector files to support (optional) static data.
-#include "ACPI/data-asus.h"
-#include "EFI/data-asus.h"
-#include "SMBIOS/data-asus.h"
+Note: Do not change this file!
-Note: We plan to add a make option for this. To let it select the files for the target configuration.
diff --git a/i386/config/SMBIOS/data-template.h b/i386/config/SMBIOS/data-template.h
index 0d0cb7a..d388f10 100755
--- a/i386/config/SMBIOS/data-template.h
+++ b/i386/config/SMBIOS/data-template.h
@@ -21,9 +21,9 @@
//--------------------------------------------------------------- SMBIOS -------------------------------------------------------------------
-#define STATIC_SMBIOS_SM_MAX_STRUCTURE_SIZE NNN
+#define STATIC_SMBIOS_SM_MAX_STRUCTURE_SIZE 0
-#define STATIC_SMBIOS_DMI_STRUCTURE_COUNT NN
+#define STATIC_SMBIOS_DMI_STRUCTURE_COUNT 0
#define STATIC_SMBIOS_DATA \
/* 0x0000 */ // Insert your SMBIOS data here.
diff --git a/i386/config/data-template.h b/i386/config/data-template.h
index c3a566c..e69de29 100755
--- a/i386/config/data-template.h
+++ b/i386/config/data-template.h
@@ -1,19 +0,0 @@
-/*
- * Copyright (c) 2009 Master Chief.
- * Refactored by DHP in 2010-2011.
- */
-
-
-#if PATCH_ACPI_TABLE_DATA && INCLUDE_ACPI_DATA
- #undef INCLUDE_ACPI_DATA
- #include "acpi/data.h"
-
-#elif INJECT_EFI_DEVICE_PROPERTIES && INCLUDE_EFI_DATA
- #undef INCLUDE_EFI_DATA
- #include "efi/data.h"
-
-#elif USE_STATIC_SMBIOS_DATA && INCLUDE_SMBIOS_DATA
- #undef INCLUDE_SMBIOS_DATA
- #include "smbios/data.h"
-
-#endif
diff --git a/i386/config/data.h b/i386/config/data.h
index c3a566c..40de3d1 100755
--- a/i386/config/data.h
+++ b/i386/config/data.h
@@ -1,19 +1,36 @@
/*
* Copyright (c) 2009 Master Chief.
- * Refactored by DHP in 2010-2011.
+ *
+ * This file, included by acpi.c, efi.c and smbios.c includes data files
+ * for the target build model (based on MODEL=MacModelNN) or default.h
+ *
+ * Updates:
+ *
+ * - Refactored by DHP in 2010-2011.
+ * - Automatic model data selection (PikerAlpha, October 2012).
+ * - Static ACPI data selector moved to RevoBoot/i386/libsaio/ACPI/static_data.h (PikerAlpha, October 2012).
+ * - Static EFI data selector moved to RevoBoot/i386/libsaio/efi.c (PikerAlpha, October 2012).
+ * - Static SMBIOS data selector moved to RevoBoot/i386/libsaio/SMBIOS/dynamic_data.h (PikerAlpha, October 2012).
+ * - This file is no longer included with RevoBoot v1.5.25 (PikerAlpha, October 2012).
*/
-#if PATCH_ACPI_TABLE_DATA && INCLUDE_ACPI_DATA
+!!__WHEN_YOU_SEE_THIS_STUPID_ERROR_THAN_SOMETHING_IS_WRONG__!!
+
+#if (PATCH_ACPI_TABLE_DATA && INCLUDE_ACPI_DATA)
#undef INCLUDE_ACPI_DATA
- #include "acpi/data.h"
+ // The STRING (macro) is defined in RevoBoot/i386/config/settings.h
+ #include STRING(ACPI_DATA_FILE)
+#endif
-#elif INJECT_EFI_DEVICE_PROPERTIES && INCLUDE_EFI_DATA
+#if (INJECT_EFI_DEVICE_PROPERTIES && INCLUDE_EFI_DATA)
#undef INCLUDE_EFI_DATA
- #include "efi/data.h"
-#elif USE_STATIC_SMBIOS_DATA && INCLUDE_SMBIOS_DATA
+ #include STRING(EFI_DATA_FILE)
+#endif
+
+#if (USE_STATIC_SMBIOS_DATA && INCLUDE_SMBIOS_DATA)
#undef INCLUDE_SMBIOS_DATA
- #include "smbios/data.h"
+ #include STRING(SMBIOS_DATA_FILE)
#endif
diff --git a/i386/config/settings-template.h b/i386/config/settings-template.h
index 263eba5..1136591 100644
--- a/i386/config/settings-template.h
+++ b/i386/config/settings-template.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2009 Master Chief. All rights reserved.
*
- * Note: This is an essential part of the build process for RevoBoot v1.5.00 and greater.
+ * Note: This is an essential part of the build process for RevoBoot v1.5.35 and greater.
*
* Updates:
*
@@ -12,10 +12,21 @@
* - SMBIOS data logic moved to preprocessor code (PikerAlpha, October 2012).
* - STATIC_MODEL_NAME moved to libsaio/i386/SMBIOS/model_data.h (PikerAlpha, October 2012).
* - STATIC_MAC_PRODUCT_NAME moved to libsaio/i386/SMBIOS/model_data.h (PikerAlpha, October 2012).
- * - STATIC_SMBIOS_MODEL_ID rrenamed to TARGET_MODEL (PikerAlpha, October 2012).
+ * - STATIC_SMBIOS_MODEL_ID renamed to TARGET_MODEL (PikerAlpha, October 2012).
* - OVERRIDE_DYNAMIC_PRODUCT_DETECTION removed/no longer supported (PikerAlpha, October 2012).
* - INTEL_CORE_TECHNOLOGY per default set to 1 (PikerAlpha, October 2012).
- *
+ * - INJECT_EFI_DEVICE_PROPERTIES per default set to 1 (PikerAlpha, October 2012).
+ * - SMBIOS base board serial# (SMB_BOARD_SERIAL_NUMBER) feature added (dgsga, October 2012).
+ * - LOAD_STATIC_EFI_DATA_FROM_EXTRA feature added (PikerAlpha, October 2012).
+ * - LOAD_STATIC_SMBIOS_DATA_FROM_EXTRA feature added (PikerAlpha, October 2012).
+ * - STATIC_SYSTEM_SERIAL_NUMBER renamed to EFI_SYSTEM_SERIAL_NUMBER (PikerAlpha, October 2012).
+ * - Restored lost STATIC_SMSERIALNUMBER (PikerAlpha, October 2012).
+ * - STATIC_SMSERIALNUMBER renamed to SMB_SYSTEM_SERIAL_NUMBER (PikerAlpha, October 2012).
+ * - LOAD_STATIC_ACPI_DATA_FROM_EXTRA added (PikerAlpha, October 2012).
+ * - LOAD_STATIC_EFI_DATA_FROM_EXTRA renamed to LOAD_MODEL_SPECIFIC_EFI_DATA (PikerAlpha, October 2012).
+ * - LOAD_STATIC_SMBIOS_DATA_FROM_EXTRA renamed to LOAD_MODEL_SPECIFIC_SMBIOS_DATA (PikerAlpha, October 2012).
+ * - LOAD_MODEL_SPECIFIC_STATIC_DATA added (PikerAlpha, October 2012).
+ * - Option SET_MAX_STRUCTURE_LENGTH added (PikerAlpha, November 2012).
*/
@@ -28,10 +39,10 @@
// and requires you to set PATCH_ACPI_TABLE_DATA to 1.
-#define PATCH_ACPI_TABLE_DATA 1 // Set to 1 by default (enabling patching). Use 0 to keep the original
- // unmodified ACPI tables, but please note (very well) that this is
- // only supported by very few motherboards / BIOS'es. You may also
- // need a kext like OSXRestart.kext to be able to restart your system,
+#define PATCH_ACPI_TABLE_DATA 1 // Set to 1 by default (enabling patching). Use 0 to keep the original
+ // unmodified ACPI tables, but please note (very well) that this is
+ // only supported by very few motherboards / BIOS'es. You may also
+ // need a kext like OSXRestart.kext to be able to restart your system,
// this due to a possibly broken FACP table in your BIOS!
//
// Note: Requires one of the following STATIC_* and/or LOAD_* settings:
@@ -46,13 +57,13 @@
#endif
-#define STATIC_APIC_TABLE_INJECTION 0 // Set to 0 by default. Use 1 when you want to inject a modified copy
+#define STATIC_APIC_TABLE_INJECTION 0 // Set to 0 by default. Use 1 when you want to inject a modified copy
// with say stripped out unused CPU's or other required modifications.
//
// Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
-#define STATIC_APIC2_TABLE_INJECTION 0 // Set to 0 by default. Use 1 when you want to inject a second APIC
+#define STATIC_APIC2_TABLE_INJECTION 0 // Set to 0 by default. Use 1 when you want to inject a second APIC
// (ACPI-1) table data for additional CPU core support.
//
// Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
@@ -71,7 +82,7 @@
// Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
-#define STATIC_HPET_TABLE_INJECTION 0 // Set to 0 by default. Use 1 when you want to inject a static copy
+#define STATIC_HPET_TABLE_INJECTION 0 // Set to 0 by default. Use 1 when you want to inject a static copy
// of a custom HPET table.
//
// Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
@@ -89,7 +100,7 @@
// Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
-#define STATIC_SSDT_PR_TABLE_INJECTION 0 // Set to 0 by default. Use 1 when you want to inject your Intel
+#define STATIC_SSDT_PR_TABLE_INJECTION 0 // Set to 0 by default. Use 1 when you want to inject your Intel
// SpeedStep related modifications (like I do).
//
// Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
@@ -105,15 +116,15 @@
// Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
-#define LOAD_DSDT_TABLE_FROM_EXTRA_ACPI 1 // Set to 0 by default. Use 1 when your setup requires a modified DSDT table
- // and you want to load: /Extra/ACPI/dsdt.aml instead of injecting a static
- // DSDT table from: RevoBoot/i386/config/ACPI/data.h
+#define LOAD_DSDT_TABLE_FROM_EXTRA_ACPI 0 // Set to 0 by default. Use 1 when your setup requires a modified DSDT table
+ // and you want to load: /Extra/ACPI/dsdt.aml instead of injecting a static
+ // DSDT table from: RevoBoot/i386/config/ACPI/data.h
//
// Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
-#define LOAD_SSDT_TABLE_FROM_EXTRA_ACPI 0 // Set to 1 by default. Use 0 only after you've converted your SSDT into
- // STATIC_SSDT_TABLE_INJECTION in: RevoBoot/i386/config/ACPI/data.h
+#define LOAD_SSDT_TABLE_FROM_EXTRA_ACPI 1 // Set to 1 by default. Use 0 only after you've converted your SSDT into
+ // STATIC_SSDT_TABLE_INJECTION in: RevoBoot/i386/config/ACPI/data.h
// or when you don't want/need to load /Extra/ACPI/SSDT.aml
//
// Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
@@ -121,8 +132,12 @@
#define LOAD_EXTRA_ACPI_TABLES (LOAD_DSDT_TABLE_FROM_EXTRA_ACPI || LOAD_SSDT_TABLE_FROM_EXTRA_ACPI)
+#if LOAD_EXTRA_ACPI_TABLES
+ #define LOAD_MODEL_SPECIFIC_ACPI_DATA 0 // Set to 0 by default. Use 1 to read: /Extra/ACPI/[XXXX-MacModelNN].aml and
+ // falls back to: /Extra/ACPI/[XXXX].aml when model specific data is not available.
+#endif
-#define AUTOMATIC_SSDT_PR_CREATION 1 // Set to 0 by default (support for Sandy Bridge only).
+#define AUTOMATIC_SSDT_PR_CREATION 1 // Set to 1 by default (support for Sandy Bridge only).
//
// This injects a custom SSDT (in configure mode) with:
//
@@ -132,7 +147,7 @@
// Use 4 to inject: Device (SBUS) {...} which is required for Power Management.
// Use 5 to inject: P/C-State definition blocks plus the former (Device SBUS).
// Use 7 to inject: All of the above.
- //
+ //
// Notes: Device SBUS can only be injected when it isn't part of other ACPI tables!
// This feature should only be used once, to extract the SSDT_PR from ioreg
// and use it as STATIC_SSDT_PR_TABLE_DATA in RevoBoot/i386/config/ACPI/data.h
@@ -147,16 +162,16 @@
//
// Note: AICPUPM wants a P-State for each 100 MHz bank or it will fail (see note below).
-#define DROP_FACTORY_SSDT_TABLES 1 // Set to 1 by default (this setting is required).
+ #define DROP_FACTORY_SSDT_TABLES 1 // Set to 1 by default (this setting is required).
//
// Note: Do not change this setting (must drop SSDT tables).
-#define NUMBER_OF_TURBO_STATES 4 // Set to 4 by default.
+ #define NUMBER_OF_TURBO_STATES 4 // Set to 4 by default.
//
// Note: Make sure to add a full range, one P-State for each 100 MHz when OC'ing
// or AICPIPM will fail with: "P-State Stepper Error 18 at step N on CPU N"
-#define OVERRIDE_ACPI_METHODS 0 // Set to 0 by default (do nothing).
+ #define OVERRIDE_ACPI_METHODS 0 // Set to 0 by default (do nothing).
// Use 1 to override Method _PTS in a static SSDT or Extra/ACPI/SSDT.aml
// Use 2 to override Method _WAK in a static SSDT or Extra/ACPI/SSDT.aml
// Use 3 to override both _PTS and _WAK.
@@ -175,7 +190,7 @@
#define APPLE_STYLE_ACPI 0 // Set to 0 by default. Use 1 to change the OEMID's to Mac likes.
//
- // Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1 and keep in mind that this can
+ // Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1 and keep in mind that this can
// only change the headers of injected/replaced tables. Not the factory tables.
@@ -185,143 +200,143 @@
//--------------------------------------------------------------- BOOT.C -------------------------------------------------------------------
-#define PRE_LINKED_KERNEL_SUPPORT 1 // Set to 1 by default. Change this to 0 to disable the use of pre-linked kernels.
+#define PRE_LINKED_KERNEL_SUPPORT 1 // Set to 1 by default. Change this to 0 to disable the use of pre-linked kernels.
-#define MUST_ENABLE_A20 0 // Set to 0 by default. Change this to 1 when your hardware requires it.
+#define MUST_ENABLE_A20 0 // Set to 0 by default. Change this to 1 when your hardware requires it.
-#define SAFE_MALLOC 0 // Set to 0 by default. Change this to 1 when booting halts with a memory allocation error.
+#define SAFE_MALLOC 0 // Set to 0 by default. Change this to 1 when booting halts with a memory allocation error.
-#define DEBUG_BOOT 0 // Set to 0 by default. Change this to 1 when things don't seem to work for you.
+#define LION_RECOVERY_SUPPORT 0 // Set to 0 by default. Change this to 1 to make RevoBoot search for the 'Recovery HD'
+ // partition and, when available, boot from it.
+
+#define DEBUG_BOOT 0 // Set to 0 by default. Change this to 1 when things don't seem to work for you.
//---------------------------------------------------------------- CPU.C -------------------------------------------------------------------
-#define USE_STATIC_CPU_DATA 1 // Set to 0 by default (dynamic data collection). Change this to 1 to use static data.
+#define USE_STATIC_CPU_DATA 0 // Set to 0 by default (dynamic data collection). Change this to 1 to use static data.
-#define CPU_VENDOR_ID CPU_VENDOR_INTEL // CPU_VENDOR_AMD is not supported.
+#define CPU_VENDOR_ID CPU_VENDOR_INTEL // CPU_VENDOR_AMD is not supported.
-#define INTEL_CORE_TECHNOLOGY 1 // Set to 1 by default. Use 0 for older non Intel Core CPU's (removes unused code).
- //
- // Warning: Do not use 0 on Core Technology CPU's or sysctl's machdep.tsc.frequency will be
- // initialized with the wrong value (various things, like the spinner will go mad).
+#define INTEL_CORE_TECHNOLOGY 1 // Set to 1 by default. Use 0 for older non Intel Core CPU's (removes unused code).
+ //
+ // Warning: Do not use 0 on Core Technology CPU's or sysctl's machdep.tsc.frequency will be
+ // initialized with the wrong value (various things, like the spinner will go mad).
-#define OC_BUSRATIO_CORRECTION 0 // Set to 0 by default. Change this to busratio-100 (OC'ed systems with a changed busratio).
+#define OC_BUSRATIO_CORRECTION 0 // Set to 0 by default. Change this to busratio-100 (OC'ed systems with a changed busratio).
-#define BOOT_TURBO_RATIO 0 // Set to 0 by default. Change this to the desired (and supported) max turbo multiplier.
- //
- // Example: 0x2800 for 4.0 GHz on a i7-2600.
+#define BOOT_TURBO_RATIO 0 // Set to 0 by default. Change this to the desired (and supported) max turbo multiplier.
+ //
+ // Example: 0x2800 for 4.0 GHz on a i7-2600.
-#define DEBUG_CPU 0 // Set to 0 by default. Change this to 1 when things don't seem to work for you.
- // Note: CPU info data will not be displayed when USE_STATIC_CPU_DATA is set to 1
+#define DEBUG_CPU 0 // Set to 0 by default. Change this to 1 when things don't seem to work for you.
+ // Note: CPU info data will not be displayed when USE_STATIC_CPU_DATA is set to 1
#if DEBUG_CPU
-#define DEBUG_CPU_TURBO_RATIOS 0 // Set to 0 by default. Change this to 1 when you want to check the core ratio.
+ #define DEBUG_CPU_TURBO_RATIOS 0 // Set to 0 by default. Change this to 1 when you want to check the core ratio.
-#define DEBUG_CST_SUPPORT 0 // Set to 0 by default. Change this to 1 to check the in BIOS enabled C-States.
+ #define DEBUG_CST_SUPPORT 0 // Set to 0 by default. Change this to 1 to check the in BIOS enabled C-States.
-#define DEBUG_TSS_SUPPORT 0 // Set to 0 by default. Change this to 1 to check the T-State Clock Modulation.
+ #define DEBUG_TSS_SUPPORT 0 // Set to 0 by default. Change this to 1 to check the T-State Clock Modulation.
-#define DEBUG_CPU_TDP 0 // Set to 0 by default. Change this to 1 when you want to check the TDP.
+ #define DEBUG_CPU_TDP 0 // Set to 0 by default. Change this to 1 when you want to check the TDP.
#endif
//---------------------------------------------------------- CPU/STATIC_DATA.C -------------------------------------------------------------
#if USE_STATIC_CPU_DATA
- #define STATIC_CPU_Type 0x602 // kSMBTypeOemProcessorType - used in: libsaio/SMBIOS/dynamic_data.h
+ #define STATIC_CPU_Type 0x602 // kSMBTypeOemProcessorType - used in: libsaio/SMBIOS/dynamic_data.h
- #define STATIC_CPU_NumThreads 4 // Used in: i386/libsaio/ACPI/ssdt_pr_generator.h
+ #define STATIC_CPU_NumThreads 4 // Used in: i386/libsaio/ACPI/ssdt_pr_generator.h
- #define STATIC_CPU_FSBFrequency 100000000ULL // 9 digits + ULL - used in: i386/libsaio/efi.c
+ #define STATIC_CPU_FSBFrequency 100000000ULL // 9 digits + ULL - used in: i386/libsaio/efi.c
- #define STATIC_CPU_QPISpeed 0 // kSMBTypeOemProcessorBusSpeed (0 for Sandy Bridge / Jaketown).
+ #define STATIC_CPU_QPISpeed 0 // kSMBTypeOemProcessorBusSpeed (0 for Sandy Bridge / Jaketown).
#endif
-#define STATIC_CPU_NumCores 4 // Set to 4 by default. Must be set to the number of cores for your processor!
- //
- // Note: Used in i386/libsaio/ACPI/ssdt_pr_generator.h, cpu.c and platform.c
- // for both static and dynamic CPU data.
+#define STATIC_CPU_NumCores 4 // Set to 4 by default. Must be set to the number of cores for your processor!
+ //
+ // Note: Used in i386/libsaio/ACPI/ssdt_pr_generator.h, cpu.c and platform.c
+ // for both static and dynamic CPU data.
//--------------------------------------------------------------- DISK.C -------------------------------------------------------------------
-#define EFI_SYSTEM_PARTITION_SUPPORT 0 // Set to 0 by default. Set this to 1 when your system boots from the hidden EFI partition.
+#define EFI_SYSTEM_PARTITION_SUPPORT 0 // Set to 0 by default. Set this to 1 when your system boots from the hidden EFI partition.
-#define LEGACY_BIOS_READ_SUPPORT 0 // Set to 0 by default. Change this to 1 for crappy old BIOSes.
+#define LEGACY_BIOS_READ_SUPPORT 0 // Set to 0 by default. Change this to 1 for crappy old BIOSes.
-#define LION_FILEVAULT_SUPPORT 0 // Set to 0 by default. Setting this to 1 will make RevoBoot skip encrypted boot partitions
- // and boot from the Recovery HD partition instead (when available).
+#if LION_RECOVERY_SUPPORT
+ #define CORE_STORAGE_SUPPORT 1 // Set to 1 by default since booting from a 'Recovery HD' partition may requires us to skip
+ // (encrypted) CoreStorage partitions.
+#else
+ #define CORE_STORAGE_SUPPORT 0 // Set to 0 by default. Change this to 1 when you want RevoBoot to boot from the 'Boot OS X'
+ // (usually the third) partition on a Fusion Drive (requires Mountain Lion 10.8.2).
+#endif
-#define APPLE_RAID_SUPPORT 0 // Set to 0 by default. Change this to 1 for Apple Software RAID support.
+#define APPLE_RAID_SUPPORT 0 // Set to 0 by default. Change this to 1 for Apple Software RAID support.
-#define DEBUG_DISK 0 // Set to 0 by default. Change it to 1 when things don't seem to work for you.
+#define DEBUG_DISK 0 // Set to 0 by default. Change it to 1 when things don't seem to work for you.
//------------------------------------------------------------- DRIVERS.C -------------------------------------------------------------------
-#define DEBUG_DRIVERS 0 // Set to 0 by default. Change it to 1 when things don't seem to work for you.
+#define DEBUG_DRIVERS 0 // Set to 0 by default. Change it to 1 when things don't seem to work for you.
//---------------------------------------------------------------- EFI.C -------------------------------------------------------------------
-#define APPLE_STYLE_EFI 1 // Set to 1 by default. Change this to 1 to add additional 'Mac-like' properties.
+#define APPLE_STYLE_EFI 1 // Set to 1 by default. Change this to 1 to add additional 'Mac-like' properties.
-#define INJECT_EFI_DEVICE_PROPERTIES 0 // Set to 0 by default. Change this to 1 when you need to inject 'device-properties'.
- //
- // Note: Required when not setting device-properties from your DSDT/SSDT.
+#define INJECT_EFI_DEVICE_PROPERTIES 0 // Set to 0 by default. Change this to 1 when you need to inject 'device-properties'.
+ //
+ // Note: Required when not setting device-properties from your DSDT/SSDT.
-#define EFI_64_BIT 1 // Set to 1 by default for EFI64 on 64-bit platforms. Supporting both
- // 32 and 64-bit boot modes (using arch=i386/x86_64 under Kernel Flags).
- //
- // Change this to 0 for 32-bit only platforms (think Intel Atom CPU)
- // or when you want to boot with EFI32 (for testing) on a 64-bit
- // platform, but then you must make a small change in platform.c (see comment in file).
- //
- // Note: Do not change this setting, unless you know what you are doing.
+#if INJECT_EFI_DEVICE_PROPERTIES
+ #define LOAD_MODEL_SPECIFIC_EFI_DATA 0 // Set to 0 by default. Use 1 to read: /Extra/EFI/[-MacModelNN].bin
+#endif
-#define STATIC_SMSERIALNUMBER "SOMESRLNUMBR" // Example only!
+#define EFI_64_BIT 1 // Set to 1 by default for EFI64 on 64-bit platforms. Supporting both
+ // 32 and 64-bit boot modes (using arch=i386/x86_64 under Kernel Flags).
+ //
+ // Change this to 0 for 32-bit only platforms (think Intel Atom CPU)
+ // or when you want to boot with EFI32 (for testing) on a 64-bit
+ // platform, but then you must make a small change in platform.c (see comment in file).
+ //
+ // Note: Do not change this setting, unless you know what you are doing.
-#define STATIC_SYSTEM_SERIAL_NUMBER { 'S', 'O', 'M', 'E', 'S', 'R', 'L', 'N', 'U', 'M', 'B', 'R' } // Example only!
+#define EFI_SYSTEM_SERIAL_NUMBER { 'S', 'O', 'M', 'E', 'S', 'R', 'L', 'N', 'U', 'M', 'B', 'R' }
-#define STATIC_SYSTEM_ID { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F } // Example only!
+#define STATIC_SYSTEM_ID { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F } // Example only!
-#define DEBUG_EFI 0 // Set to 0 by default. Change this to 1 when things don't seem to work for you.
+#define DEBUG_EFI 0 // Set to 0 by default. Change this to 1 when things don't seem to work for you.
-#define EFI_DEBUG_MODE 0 // Set to 0 by default (for OS X 10.7 LION only).
+#define EFI_DEBUG_MODE 0 // Set to 0 by default (for OS X 10.7 LION and greater).
//------------------------------------------------------------- GRAPHICS.C -----------------------------------------------------------------
-#define USE_STATIC_DISPLAY_RESOLUTION 1 // Set to 0 by default. Use 1 when you need to override the resolution detection features
- // in RevoBoot, which may not be supported by your BIOS and/or display (monitor).
-
-#define STATIC_SCREEN_WIDTH 1900 // Used (in RevoBoot v1.0.35 and greater) when USE_STATIC_DISPLAY_RESOLUTION is 1 and when
- // USE_STATIC_DISPLAY_RESOLUTION is 0 but getResolutionFromEDID() isn't supported (failed).
-
-#define STATIC_SCREEN_HEIGHT 1200 // Used (in RevoBoot v1.0.35 and greater) when USE_STATIC_DISPLAY_RESOLUTION is 1 and when
- // USE_STATIC_DISPLAY_RESOLUTION is 0 but getResolutionFromEDID() isn't supported (failed).
-
-#define DEBUG_BOOT_GRAPHICS 0 // Set to 0 by default. Use 1 when to see debug info.
+#define USE_STATIC_DISPLAY_RESOLUTION 1 // Set to 0 by default. Use 1 when you need to override the resolution detection features
+ // in RevoBoot, which may not be supported by your BIOS and/or display (monitor).
+#define STATIC_SCREEN_WIDTH 1900 // Used (in RevoBoot v1.0.35 and greater) when USE_STATIC_DISPLAY_RESOLUTION is 1 and when
+ // USE_STATIC_DISPLAY_RESOLUTION is 0 but getResolutionFromEDID() isn't supported (failed).
-//------------------------------------------------------------ STRINGDATA.H ----------------------------------------------------------------
+#define STATIC_SCREEN_HEIGHT 1200 // Used (in RevoBoot v1.0.35 and greater) when USE_STATIC_DISPLAY_RESOLUTION is 1 and when
+ // USE_STATIC_DISPLAY_RESOLUTION is 0 but getResolutionFromEDID() isn't supported (failed).
-#define LION_FILEVAULT_SUPPORT 0 // Set to 0 by default. Setting this to 1 will make RevoBoot skip encrypted boot partitions
- // and boot from the Recovery HD partition instead (when available).
+#define DEBUG_BOOT_GRAPHICS 0 // Set to 0 by default. Use 1 when to see debug info.
-#if LION_FILEVAULT_SUPPORT
- #define LION_RECOVERY_SUPPORT 1 // Make RevoBoot search for the Recovery HD partition and boot from it (when available).
-#else
- #define LION_RECOVERY_SUPPORT 0 // Set to 0 by default. Setting this to 1 will make RevoBoot search for the Recovery HD and
- // try to boot from it, when it is properly setup and modified for RevoBoot.
-#endif
-#define LION_INSTALL_SUPPORT 0 // Set to 0 by default. Setting this to 1 will make RevoBoot search in specific directories
- // for com.apple.Boot.plist – required for Mac like Lion OS X installations.
+//------------------------------------------------------------ STRINGTABLE.H ----------------------------------------------------------------
+#define LION_INSTALL_SUPPORT 0 // Set to 0 by default. Setting this to 1 will make RevoBoot search in specific directories
+ // for com.apple.Boot.plist – required for Mac like Lion OS X installations.
+
//-------------------------------------------------------------- SMBIOS.C ------------------------------------------------------------------
@@ -331,23 +346,37 @@
#undef USE_STATIC_CPU_DATA // Prevent boot failures due to wrong settings (until I figured out what we are missing).
#endif
+#if USE_STATIC_SMBIOS_DATA
+ #define LOAD_MODEL_SPECIFIC_SMBIOS_DATA 0 // Set to 0 by default. Change this to 1 to load: /Extra/SMBIOS/[MacModelNN].bin
+#endif
+
#define OVERRIDE_DYNAMIC_MEMORY_DETECTION 0 // Set to 0 by default. Change this to 0 only when your SMBIOS data (type 17) is correct, or when
// you want/need to override some/all of the SMBIOS data.
//
// Note: Defaults to n MB 1066 DDR3 when set to 0 (to prevent errors in Profile Manager).
-#define TARGET_MODEL MACMINI // Set to MACMINI by default. Supported models are:
- //
- // IMAC and IMAC_131, IMAC_122, IMAC_111, IMAC_121
- // MACBOOK and MACBOOK_41
- // MACBOOKAIR and MACBOOKAIR_42, MACBOOKAIR_41
- // MACBOOKPRO and MACBOOKPRO_101, MACBOOKPRO_91, MACBOOKPRO_83, MACBOOKPRO_82,
- // MACBOOKPRO_81, MACBOOKPRO_61
- // MACMINI and MACMINI_53, MACMINI_52, MACMINI_51
- // MACPRO and MACPRO_51, MACPRO_41, MACPRO_31
- //
- // Note: MACMINI (without _NNN) selects the default model (last one i.e. MACMINI_51).
+#define TARGET_MODEL MACMINI // Set to MACMINI by default. Supported models are:
+ //
+ // IMAC and IMAC_131, IMAC_122, IMAC_111, IMAC_121
+ // MACBOOK and MACBOOK_41
+ // MACBOOKAIR and MACBOOKAIR_42, MACBOOKAIR_41
+ // MACBOOKPRO and MACBOOKPRO_101, MACBOOKPRO_91, MACBOOKPRO_83, MACBOOKPRO_82,
+ // MACBOOKPRO_81, MACBOOKPRO_61
+ // MACMINI and MACMINI_53, MACMINI_52, MACMINI_51
+ // MACPRO and MACPRO_51, MACPRO_41, MACPRO_31
+ //
+ // Note: MACMINI (without _NNN) selects the default model (last one i.e. MACMINI_51).
+
+#define SMB_SYSTEM_SERIAL_NUMBER "SOMESRLNUMBR" // Example only!
+
+#if (TARGET_MODEL & MACPRO)
+ #define SMB_BOARD_SERIAL_NUMBER "SOMESRLNUMBR" // Example only!
+#endif
+
+#define SET_MAX_STRUCTURE_LENGTH 0 // Set to 0 by default. Only change this to 1 when boot hangs without it.
+ //
+ // Note: Safe to keep at 0 since it is only available since RevoBoot v1.5.35
#define DEBUG_SMBIOS 0 // Set to 0 by default. Change this to 1 when things don't seem to work for you.
@@ -356,7 +385,7 @@
#if USE_STATIC_SMBIOS_DATA
- // Do nothing.
+ // Do nothing.
#elif OVERRIDE_DYNAMIC_MEMORY_DETECTION
// Setup RAM module info. Please note that you may have to expand this when you have more RAM modules.
#define STATIC_RAM_SLOTS 4 // Number of RAM slots on mainboard.
@@ -368,20 +397,20 @@
#define DYNAMIC_RAM_OVERRIDE_SIZE 0 // Set to 0 by default. Change this to 1 when you want to use override values (see below).
#if DYNAMIC_RAM_OVERRIDE_SIZE
- #define DYNAMIC_RAM_OVERRIDE_SIZES { SMB_MEM_SIZE_2GB, SMB_MEM_BANK_EMPTY, SMB_MEM_SIZE_2GB, SMB_MEM_BANK_EMPTY, 0 } // See libsaio/platform.h for other values.
+ #define DYNAMIC_RAM_OVERRIDE_SIZES { SMB_MEM_SIZE_2GB, SMB_MEM_BANK_EMPTY, SMB_MEM_SIZE_2GB, SMB_MEM_BANK_EMPTY, 0 } // See libsaio/platform.h for other values.
#endif
#define DYNAMIC_RAM_OVERRIDE_FREQUENCY 0 // Set to 0 by default. Change this to the frequency that you want to use as override value.
- #define STATIC_RAM_PART_NUMBERS { "PartNum#0", "N/A", "PartNum#2", "N/A", 0 } // Use "N/A" for empty RAM banks.
+ #define STATIC_RAM_PART_NUMBERS { "PartNum#0", "N/A", "PartNum#1", "N/A", 0 } // Use "N/A" for empty RAM banks.
- #define STATIC_RAM_SERIAL_NUMBERS { "Serial#0", "N/A", "Serial#2", "N/A", 0 } // Use "N/A" for empty RAM banks.
+ #define STATIC_RAM_SERIAL_NUMBERS { "Serial#0", "N/A", "Serial#2", "N/A", 0 } // Use "N/A" for empty RAM banks.
#endif
#define INCLUDE_MPS_TABLE 0 // Set to 0 by default. Change this to 1 when you want to include the MP table.
-#define DEBUG_PLATFORM 0 // Set to 0 by default. Change this to 1 when things don't seem to work for you.
+#define LOAD_MODEL_SPECIFIC_STATIC_DATA (LOAD_MODEL_SPECIFIC_ACPI_DATA || LOAD_MODEL_SPECIFIC_EFI_DATA || LOAD_MODEL_SPECIFIC_SMBIOS_DATA)
+#define DEBUG_PLATFORM 0 // Set to 0 by default. Change this to 1 when things don't seem to work for you.
//================================================================= END ====================================================================
-
diff --git a/i386/config/settings.h b/i386/config/settings.h
index 263eba5..09da11a 100644
--- a/i386/config/settings.h
+++ b/i386/config/settings.h
@@ -1,387 +1,19 @@
/*
- * Copyright (c) 2009 Master Chief. All rights reserved.
- *
- * Note: This is an essential part of the build process for RevoBoot v1.5.00 and greater.
+ * Copyright (c) 2009 Master Chief.
*
* Updates:
*
- * - Latest cleanups and additional directives added by DHP in 2011.
- * - Static CPU data simplified by DHP in Juni 2011 (thanks to MC and flAked for the idea).
- * - Automatic creation / injection of SSDT_PR.aml added by DHP in June 2011.
- * - New compiler directive (BOOT_TURBO_BOOST_RATIO) added by Jeroen (June 2011).
- * - SMBIOS data logic moved to preprocessor code (PikerAlpha, October 2012).
- * - STATIC_MODEL_NAME moved to libsaio/i386/SMBIOS/model_data.h (PikerAlpha, October 2012).
- * - STATIC_MAC_PRODUCT_NAME moved to libsaio/i386/SMBIOS/model_data.h (PikerAlpha, October 2012).
- * - STATIC_SMBIOS_MODEL_ID rrenamed to TARGET_MODEL (PikerAlpha, October 2012).
- * - OVERRIDE_DYNAMIC_PRODUCT_DETECTION removed/no longer supported (PikerAlpha, October 2012).
- * - INTEL_CORE_TECHNOLOGY per default set to 1 (PikerAlpha, October 2012).
- *
+ * - Read settings file based on given model identifier (PikerAlpha, October 2012).
+ * - COMMA_STRIPPED_MODEL_ID added (PikerAlpha, November 2012).
*/
+#define TO_STRING_DO(a) #a
+#define STRING(a) TO_STRING_DO(a)
-//--------------------------------------------------------------- ACPI.C -------------------------------------------------------------------
-
-
-#define ACPI_10_SUPPORT 0 // Set to 0 by Default. Set to 1 for ACPI 1.0 compliant BIOS versions.
- //
- // Note: Must go first (before acpi/essentials) since it is used there,
- // and requires you to set PATCH_ACPI_TABLE_DATA to 1.
-
-
-#define PATCH_ACPI_TABLE_DATA 1 // Set to 1 by default (enabling patching). Use 0 to keep the original
- // unmodified ACPI tables, but please note (very well) that this is
- // only supported by very few motherboards / BIOS'es. You may also
- // need a kext like OSXRestart.kext to be able to restart your system,
- // this due to a possibly broken FACP table in your BIOS!
- //
- // Note: Requires one of the following STATIC_* and/or LOAD_* settings:
-
-
-#define USE_STATIC_ACPI_BASE_ADDRESS 0 // Set to 0 by default. Use 1 only after gathering the base address!
- // Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
-
-
-#if USE_STATIC_ACPI_BASE_ADDRESS
- #define STATIC_ACPI_BASE_ADDRESS 0x000f0450 // Set DEBUG_ACPI to 1 to get this address.
-#endif
-
-
-#define STATIC_APIC_TABLE_INJECTION 0 // Set to 0 by default. Use 1 when you want to inject a modified copy
- // with say stripped out unused CPU's or other required modifications.
- //
- // Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
-
-
-#define STATIC_APIC2_TABLE_INJECTION 0 // Set to 0 by default. Use 1 when you want to inject a second APIC
- // (ACPI-1) table data for additional CPU core support.
- //
- // Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
-
-
-#define STATIC_DSDT_TABLE_INJECTION 0 // Set to 0 by default. Use 1 when you want to inject static DSDT data.
-
-
-#define STATIC_ECDT_TABLE_INJECTION 0 // Set to 0 by default. Use 1 when want to inject a custom ECDT table.
- //
- // Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
-
-
-#define STATIC_FACS_TABLE_INJECTION 0 // Set to 0 by default. Use 1 when want to inject a custom FACS table.
- //
- // Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
-
-
-#define STATIC_HPET_TABLE_INJECTION 0 // Set to 0 by default. Use 1 when you want to inject a static copy
- // of a custom HPET table.
- //
- // Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
-
-
-#define STATIC_SSDT_TABLE_INJECTION 0 // Set to 0 by default. Use 1 when you want to inject modifications
- // that can / should be done from this ACPI table.
- //
- // Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
-
-
-#define STATIC_SSDT_GPU_TABLE_INJECTION 0 // Set to 0 by default. Use 1 when you want to inject modifications
- // for your graphics card (like I do for my ATI PCI-E card).
- //
- // Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
-
-
-#define STATIC_SSDT_PR_TABLE_INJECTION 0 // Set to 0 by default. Use 1 when you want to inject your Intel
- // SpeedStep related modifications (like I do).
- //
- // Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
-
-
-#define STATIC_SSDT_SATA_TABLE_INJECTION 0 // Set to 0 by default. Use 1 when want to inject SATA related modifications.
- //
- // Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
-
-
-#define STATIC_SSDT_USB_TABLE_INJECTION 0 // Set to 0 by default. Use 1 when want to inject USB related modifications.
- //
- // Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
-
-
-#define LOAD_DSDT_TABLE_FROM_EXTRA_ACPI 1 // Set to 0 by default. Use 1 when your setup requires a modified DSDT table
- // and you want to load: /Extra/ACPI/dsdt.aml instead of injecting a static
- // DSDT table from: RevoBoot/i386/config/ACPI/data.h
- //
- // Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
-
-
-#define LOAD_SSDT_TABLE_FROM_EXTRA_ACPI 0 // Set to 1 by default. Use 0 only after you've converted your SSDT into
- // STATIC_SSDT_TABLE_INJECTION in: RevoBoot/i386/config/ACPI/data.h
- // or when you don't want/need to load /Extra/ACPI/SSDT.aml
- //
- // Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
-
-
-#define LOAD_EXTRA_ACPI_TABLES (LOAD_DSDT_TABLE_FROM_EXTRA_ACPI || LOAD_SSDT_TABLE_FROM_EXTRA_ACPI)
-
-
-#define AUTOMATIC_SSDT_PR_CREATION 1 // Set to 0 by default (support for Sandy Bridge only).
- //
- // This injects a custom SSDT (in configure mode) with:
- //
- // Use 1 to inject: P/C-State definition blocks.
- // Use 2 to inject: Processor (CPUn, 0x0n, 0x00000410, 0x06) {...} declaration blocks.
- // Use 3 to inject: Both of the above.
- // Use 4 to inject: Device (SBUS) {...} which is required for Power Management.
- // Use 5 to inject: P/C-State definition blocks plus the former (Device SBUS).
- // Use 7 to inject: All of the above.
- //
- // Notes: Device SBUS can only be injected when it isn't part of other ACPI tables!
- // This feature should only be used once, to extract the SSDT_PR from ioreg
- // and use it as STATIC_SSDT_PR_TABLE_DATA in RevoBoot/i386/config/ACPI/data.h
-
-
-#if AUTOMATIC_SSDT_PR_CREATION && STATIC_SSDT_PR_TABLE_INJECTION == 0
- #define MAX_NUMBER_OF_P_STATES 22 // The i5-2500K need 18 for the base-range (1600-3300) plus 4 for the Turbo modes.
- // The i7-2600K need 19 for the base-range (1600-3400) plus 4 for the Turbo modes.
- // The i7-2700K need 20 for the base-range (1600-3500) plus 4 for the Turbo modes.
- // The i7-3770K need 20 for the base-range (1600-3500) plus 4 for the Turbo modes.
- // Low power (mobility) processors might need an extended range!
- //
- // Note: AICPUPM wants a P-State for each 100 MHz bank or it will fail (see note below).
-
-#define DROP_FACTORY_SSDT_TABLES 1 // Set to 1 by default (this setting is required).
- //
- // Note: Do not change this setting (must drop SSDT tables).
-
-#define NUMBER_OF_TURBO_STATES 4 // Set to 4 by default.
- //
- // Note: Make sure to add a full range, one P-State for each 100 MHz when OC'ing
- // or AICPIPM will fail with: "P-State Stepper Error 18 at step N on CPU N"
-
-#define OVERRIDE_ACPI_METHODS 0 // Set to 0 by default (do nothing).
- // Use 1 to override Method _PTS in a static SSDT or Extra/ACPI/SSDT.aml
- // Use 2 to override Method _WAK in a static SSDT or Extra/ACPI/SSDT.aml
- // Use 3 to override both _PTS and _WAK.
- //
- // Note: This changes the underscore of _PTS and/or _WAK into a "Z" which
- // allows you to inject a customized copy from /Extra/ACPI/SSDT.aml
-#else
- #define OVERRIDE_ACPI_METHODS 0 // Set to 0 by default (do nothing).
-
- #define DROP_FACTORY_SSDT_TABLES 0 // Set to 0 by default. Use 1 with caution (might disable SpeedStep).
-#endif
-
-#define REPLACE_EXISTING_SSDT_TABLES 0 // Set to 0 by default. Use 1 with caution (might disable SpeedStep).
- //
- // Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1.
-
-#define APPLE_STYLE_ACPI 0 // Set to 0 by default. Use 1 to change the OEMID's to Mac likes.
- //
- // Note: Don't forget to set PATCH_ACPI_TABLE_DATA to 1 and keep in mind that this can
- // only change the headers of injected/replaced tables. Not the factory tables.
-
-
-#define DEBUG_ACPI 0 // Set to 0 by default. Use 1 when things don't seem to work for you.
-
-
-//--------------------------------------------------------------- BOOT.C -------------------------------------------------------------------
-
-
-#define PRE_LINKED_KERNEL_SUPPORT 1 // Set to 1 by default. Change this to 0 to disable the use of pre-linked kernels.
-
-#define MUST_ENABLE_A20 0 // Set to 0 by default. Change this to 1 when your hardware requires it.
-
-#define SAFE_MALLOC 0 // Set to 0 by default. Change this to 1 when booting halts with a memory allocation error.
-
-#define DEBUG_BOOT 0 // Set to 0 by default. Change this to 1 when things don't seem to work for you.
-
-
-//---------------------------------------------------------------- CPU.C -------------------------------------------------------------------
-
-
-#define USE_STATIC_CPU_DATA 1 // Set to 0 by default (dynamic data collection). Change this to 1 to use static data.
-
-#define CPU_VENDOR_ID CPU_VENDOR_INTEL // CPU_VENDOR_AMD is not supported.
-
-#define INTEL_CORE_TECHNOLOGY 1 // Set to 1 by default. Use 0 for older non Intel Core CPU's (removes unused code).
- //
- // Warning: Do not use 0 on Core Technology CPU's or sysctl's machdep.tsc.frequency will be
- // initialized with the wrong value (various things, like the spinner will go mad).
-
-#define OC_BUSRATIO_CORRECTION 0 // Set to 0 by default. Change this to busratio-100 (OC'ed systems with a changed busratio).
-
-#define BOOT_TURBO_RATIO 0 // Set to 0 by default. Change this to the desired (and supported) max turbo multiplier.
- //
- // Example: 0x2800 for 4.0 GHz on a i7-2600.
-
-#define DEBUG_CPU 0 // Set to 0 by default. Change this to 1 when things don't seem to work for you.
- // Note: CPU info data will not be displayed when USE_STATIC_CPU_DATA is set to 1
-
-#if DEBUG_CPU
-#define DEBUG_CPU_TURBO_RATIOS 0 // Set to 0 by default. Change this to 1 when you want to check the core ratio.
-
-#define DEBUG_CST_SUPPORT 0 // Set to 0 by default. Change this to 1 to check the in BIOS enabled C-States.
-
-#define DEBUG_TSS_SUPPORT 0 // Set to 0 by default. Change this to 1 to check the T-State Clock Modulation.
-
-#define DEBUG_CPU_TDP 0 // Set to 0 by default. Change this to 1 when you want to check the TDP.
-#endif
-
-//---------------------------------------------------------- CPU/STATIC_DATA.C -------------------------------------------------------------
-
-
-#if USE_STATIC_CPU_DATA
- #define STATIC_CPU_Type 0x602 // kSMBTypeOemProcessorType - used in: libsaio/SMBIOS/dynamic_data.h
-
- #define STATIC_CPU_NumThreads 4 // Used in: i386/libsaio/ACPI/ssdt_pr_generator.h
-
- #define STATIC_CPU_FSBFrequency 100000000ULL // 9 digits + ULL - used in: i386/libsaio/efi.c
-
- #define STATIC_CPU_QPISpeed 0 // kSMBTypeOemProcessorBusSpeed (0 for Sandy Bridge / Jaketown).
-#endif
-
-#define STATIC_CPU_NumCores 4 // Set to 4 by default. Must be set to the number of cores for your processor!
- //
- // Note: Used in i386/libsaio/ACPI/ssdt_pr_generator.h, cpu.c and platform.c
- // for both static and dynamic CPU data.
-
-//--------------------------------------------------------------- DISK.C -------------------------------------------------------------------
-
-
-#define EFI_SYSTEM_PARTITION_SUPPORT 0 // Set to 0 by default. Set this to 1 when your system boots from the hidden EFI partition.
-
-#define LEGACY_BIOS_READ_SUPPORT 0 // Set to 0 by default. Change this to 1 for crappy old BIOSes.
-
-#define LION_FILEVAULT_SUPPORT 0 // Set to 0 by default. Setting this to 1 will make RevoBoot skip encrypted boot partitions
- // and boot from the Recovery HD partition instead (when available).
-
-#define APPLE_RAID_SUPPORT 0 // Set to 0 by default. Change this to 1 for Apple Software RAID support.
-
-#define DEBUG_DISK 0 // Set to 0 by default. Change it to 1 when things don't seem to work for you.
-
-
-//------------------------------------------------------------- DRIVERS.C -------------------------------------------------------------------
-
-
-#define DEBUG_DRIVERS 0 // Set to 0 by default. Change it to 1 when things don't seem to work for you.
-
-
-//---------------------------------------------------------------- EFI.C -------------------------------------------------------------------
-
-
-#define APPLE_STYLE_EFI 1 // Set to 1 by default. Change this to 1 to add additional 'Mac-like' properties.
-
-#define INJECT_EFI_DEVICE_PROPERTIES 0 // Set to 0 by default. Change this to 1 when you need to inject 'device-properties'.
- //
- // Note: Required when not setting device-properties from your DSDT/SSDT.
-
-#define EFI_64_BIT 1 // Set to 1 by default for EFI64 on 64-bit platforms. Supporting both
- // 32 and 64-bit boot modes (using arch=i386/x86_64 under Kernel Flags).
- //
- // Change this to 0 for 32-bit only platforms (think Intel Atom CPU)
- // or when you want to boot with EFI32 (for testing) on a 64-bit
- // platform, but then you must make a small change in platform.c (see comment in file).
- //
- // Note: Do not change this setting, unless you know what you are doing.
-
-#define STATIC_SMSERIALNUMBER "SOMESRLNUMBR" // Example only!
-
-#define STATIC_SYSTEM_SERIAL_NUMBER { 'S', 'O', 'M', 'E', 'S', 'R', 'L', 'N', 'U', 'M', 'B', 'R' } // Example only!
-
-#define STATIC_SYSTEM_ID { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F } // Example only!
-
-#define DEBUG_EFI 0 // Set to 0 by default. Change this to 1 when things don't seem to work for you.
-
-#define EFI_DEBUG_MODE 0 // Set to 0 by default (for OS X 10.7 LION only).
-
-
-//------------------------------------------------------------- GRAPHICS.C -----------------------------------------------------------------
-
-#define USE_STATIC_DISPLAY_RESOLUTION 1 // Set to 0 by default. Use 1 when you need to override the resolution detection features
- // in RevoBoot, which may not be supported by your BIOS and/or display (monitor).
-
-#define STATIC_SCREEN_WIDTH 1900 // Used (in RevoBoot v1.0.35 and greater) when USE_STATIC_DISPLAY_RESOLUTION is 1 and when
- // USE_STATIC_DISPLAY_RESOLUTION is 0 but getResolutionFromEDID() isn't supported (failed).
-
-#define STATIC_SCREEN_HEIGHT 1200 // Used (in RevoBoot v1.0.35 and greater) when USE_STATIC_DISPLAY_RESOLUTION is 1 and when
- // USE_STATIC_DISPLAY_RESOLUTION is 0 but getResolutionFromEDID() isn't supported (failed).
-
-#define DEBUG_BOOT_GRAPHICS 0 // Set to 0 by default. Use 1 when to see debug info.
-
-
-//------------------------------------------------------------ STRINGDATA.H ----------------------------------------------------------------
-
-#define LION_FILEVAULT_SUPPORT 0 // Set to 0 by default. Setting this to 1 will make RevoBoot skip encrypted boot partitions
- // and boot from the Recovery HD partition instead (when available).
-
-#if LION_FILEVAULT_SUPPORT
- #define LION_RECOVERY_SUPPORT 1 // Make RevoBoot search for the Recovery HD partition and boot from it (when available).
-#else
- #define LION_RECOVERY_SUPPORT 0 // Set to 0 by default. Setting this to 1 will make RevoBoot search for the Recovery HD and
- // try to boot from it, when it is properly setup and modified for RevoBoot.
-#endif
-
-#define LION_INSTALL_SUPPORT 0 // Set to 0 by default. Setting this to 1 will make RevoBoot search in specific directories
- // for com.apple.Boot.plist – required for Mac like Lion OS X installations.
-
-//-------------------------------------------------------------- SMBIOS.C ------------------------------------------------------------------
-
-
-#define USE_STATIC_SMBIOS_DATA 0 // Set to 0 by default (dynamic data collection). Change this to 1 to use static data.
-
-#if (USE_STATIC_SMBIOS_DATA == 0 && USE_STATIC_CPU_DATA == 1)
- #undef USE_STATIC_CPU_DATA // Prevent boot failures due to wrong settings (until I figured out what we are missing).
-#endif
-
-#define OVERRIDE_DYNAMIC_MEMORY_DETECTION 0 // Set to 0 by default. Change this to 0 only when your SMBIOS data (type 17) is correct, or when
- // you want/need to override some/all of the SMBIOS data.
- //
- // Note: Defaults to n MB 1066 DDR3 when set to 0 (to prevent errors in Profile Manager).
-
-
-#define TARGET_MODEL MACMINI // Set to MACMINI by default. Supported models are:
- //
- // IMAC and IMAC_131, IMAC_122, IMAC_111, IMAC_121
- // MACBOOK and MACBOOK_41
- // MACBOOKAIR and MACBOOKAIR_42, MACBOOKAIR_41
- // MACBOOKPRO and MACBOOKPRO_101, MACBOOKPRO_91, MACBOOKPRO_83, MACBOOKPRO_82,
- // MACBOOKPRO_81, MACBOOKPRO_61
- // MACMINI and MACMINI_53, MACMINI_52, MACMINI_51
- // MACPRO and MACPRO_51, MACPRO_41, MACPRO_31
- //
- // Note: MACMINI (without _NNN) selects the default model (last one i.e. MACMINI_51).
-
-#define DEBUG_SMBIOS 0 // Set to 0 by default. Change this to 1 when things don't seem to work for you.
-
-
-//-------------------------------------------------------------- PLATFORM.C ----------------------------------------------------------------
-
-
-#if USE_STATIC_SMBIOS_DATA
- // Do nothing.
-#elif OVERRIDE_DYNAMIC_MEMORY_DETECTION
- // Setup RAM module info. Please note that you may have to expand this when you have more RAM modules.
- #define STATIC_RAM_SLOTS 4 // Number of RAM slots on mainboard.
-
- #define STATIC_RAM_VENDORS { "Corsair", "N/A", "Corsair", "N/A", 0 } // Use "N/A" for empty RAM banks.
-
- #define DYNAMIC_RAM_OVERRIDE_TYPE 0 // Set to 0 by default. See libsaio/platform.h for supported values.
-
- #define DYNAMIC_RAM_OVERRIDE_SIZE 0 // Set to 0 by default. Change this to 1 when you want to use override values (see below).
-
-#if DYNAMIC_RAM_OVERRIDE_SIZE
- #define DYNAMIC_RAM_OVERRIDE_SIZES { SMB_MEM_SIZE_2GB, SMB_MEM_BANK_EMPTY, SMB_MEM_SIZE_2GB, SMB_MEM_BANK_EMPTY, 0 } // See libsaio/platform.h for other values.
-#endif
-
- #define DYNAMIC_RAM_OVERRIDE_FREQUENCY 0 // Set to 0 by default. Change this to the frequency that you want to use as override value.
-
- #define STATIC_RAM_PART_NUMBERS { "PartNum#0", "N/A", "PartNum#2", "N/A", 0 } // Use "N/A" for empty RAM banks.
-
- #define STATIC_RAM_SERIAL_NUMBERS { "Serial#0", "N/A", "Serial#2", "N/A", 0 } // Use "N/A" for empty RAM banks.
-#endif
-
-#define INCLUDE_MPS_TABLE 0 // Set to 0 by default. Change this to 1 when you want to include the MP table.
-
-#define DEBUG_PLATFORM 0 // Set to 0 by default. Change this to 1 when things don't seem to work for you.
-
-
-//================================================================= END ====================================================================
+#include STRING(SETTINGS_FILE)
+/*
+ * gPlatform.ModelID is a char * initialized by a call to strdup(SMB_PRODUCT_NAME) in
+ * platform.c and we use strdup once more here so that gPlatform.ModelID is untouched.
+ */
+#define COMMA_STRIPPED_MODEL_ID removeChar(strdup(gPlatform.ModelID), ',')
diff --git a/i386/libsa/Makefile b/i386/libsa/Makefile
index 633e3b3..ce11708 100644
--- a/i386/libsa/Makefile
+++ b/i386/libsa/Makefile
@@ -1,70 +1,45 @@
-DIR = libsa
+#
+# File: RevoBoot/i386/libsa/Makefile
+#
+# Updates:
+#
+# - Major cleanup (PikerAlpha, October 2012).
+# - Output added for rm/ar/ranlib actions (PikerAlpha, November 2012).
+# - Enabled clang compilation (dgsga, November 2012. Credits to Evan Lojewski for original work).
+# - Output change and now using libtool instead of ar/ranlib (PikerAlpha, November 2012).
+#
+
include ../MakePaths.dir
UTILDIR = ../util
LIBSAIODIR = ../libsaio
-INSTALL_SA_DIR = $(DSTROOT)/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/standalone
-INSTALL_MD_DIR = $(DSTROOT)/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/machdep/i386
OPTIM = -Os -Oz
-CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror \
- -fno-builtin -static $(OMIT_FRAME_POINTER_CFLAG) \
- -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
- -march=pentium4 -msse2 -mfpmath=sse -msoft-float
+CFLAGS = $(RC_CFLAGS) $(OPTIM) -arch i386 -g -Wmost -Werror \
+ -fno-builtin -static $(OMIT_FRAME_POINTER_CFLAG) \
+ -DSETTINGS_FILE=SETTINGS/$(MAKE_TARGET_MODEL).h \
+ -fno-stack-protector \
+ -march=pentium4 -msse2 -msoft-float
INC = -I. -I$(SYMROOT) -I$(UTILDIR) -I$(LIBSAIODIR)
-ifneq "" "$(wildcard /bin/mkdirs)"
- MKDIRS = /bin/mkdirs
-else
- MKDIRS = /bin/mkdir -p
-endif
-AS = as
-LD = ld
-# LIBS= -lc_static
-LIBS=
VPATH = $(OBJROOT):$(SYMROOT)
-#SA_OBJS = prf.o printf.o zalloc.o \
-# string.o strtol.o error.o \
-# setjmp.o qsort.o efi_tables.o
-SA_OBJS = prf.o printf.o zalloc.o \
- string.o strtol.o \
- setjmp.o efi_tables.o
-
-SFILES = setjmp.s
-#CFILES = prf.c printf.c zalloc.c \
-# string.c strtol.c error.c \
-# qsort.c efi_tables.c
-CFILES = prf.c printf.c zalloc.c \
- string.c strtol.c \
- efi_tables.c
+SA_OBJS = prf.o printf.o zalloc.o string.o strtol.o setjmp.o efi_tables.o
-HFILES = allocate.h
-EXPORTED_HFILES = libsa.h allocate.h
-INSTALLED_SA_HFILES = libsa.h
-OTHERFILES = Makefile
-ALLSRC = $(SFILES) $(CFILES) $(HFILES) $(OTHERFILES)
LIBS = libsa.a
-DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
-lion: all
-mountain-lion: all
-
-all: $(DIRS_NEEDED) $(LIBS)
+DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
-libsa.a: $(SA_OBJS)
- rm -f $(SYMROOT)/$(@F)
- ar q $(SYMROOT)/$(@F) $^
- ranlib $(SYMROOT)/$(@F)
+$(MAKEGOAL): $(DIRS_NEEDED) $(LIBS)
-$(INSTALL_SA_DIR) $(INSTALL_MD_DIR):
- $(MKDIRS) $@
+$(LIBS): $(SA_OBJS)
+ @if [ -f $(SYMROOT)/$@ ]; then \
+ echo "\t[RM] $@"; \
+ rm -f $(SYMROOT)/$@; \
+ fi;
-installhdrs:: $(INSTALL_SA_DIR) $(INSTALL_MD_DIR)
- cp $(INSTALLED_SA_HFILES) $(INSTALL_SA_DIR)
+ @echo "\t[LIBTOOL] $@"
+ @libtool -o $(SYMROOT)/$@ $^
include ../MakeInc.dir
-
-# dependencies
--include $(OBJROOT)/Makedep
diff --git a/i386/libsa/libsa.h b/i386/libsa/libsa.h
index 14d3ef8..7cba5a5 100755
--- a/i386/libsa/libsa.h
+++ b/i386/libsa/libsa.h
@@ -73,16 +73,8 @@ extern char * strdup(const char *s1);
extern int strncasecmp(const char * s1, const char * s2, size_t n);
#endif
-extern uint8_t checksum8( void * start, unsigned int length );
-
-#if CHAMELEON
- /*
- * error.c
- */
-
- extern int errno;
- extern char * strerror(int errnum);
-#endif
+extern uint8_t checksum8( void * start, unsigned int length);
+char * removeChar(char *aSourceString, char aTargetChar);
/*
* strtol.c
diff --git a/i386/libsa/string.c b/i386/libsa/string.c
index 6919fe9..2e58d88 100755
--- a/i386/libsa/string.c
+++ b/i386/libsa/string.c
@@ -25,6 +25,9 @@
#include "libsa.h"
+
+//==========================================================================
+
void * memset(void * dst, int val, size_t len)
{
asm volatile ( "rep; stosb"
@@ -36,6 +39,8 @@ void * memset(void * dst, int val, size_t len)
}
#if 0
+//==========================================================================
+
void * memcpy(void * dst, const void * src, size_t len)
{
asm volatile ( "rep; movsb"
@@ -46,17 +51,25 @@ void * memcpy(void * dst, const void * src, size_t len)
return dst;
}
+
+//==========================================================================
+
void bcopy(const void * src, void * dst, size_t len)
{
memcpy(dst, src, len);
}
+
+//==========================================================================
+
void bzero(void * dst, size_t len)
{
memset(dst, 0, len);
}
#else
+//==========================================================================
+
void * memcpy(void * dst, const void * src, size_t len)
{
asm volatile ( "cld \n\t"
@@ -73,6 +86,9 @@ void * memcpy(void * dst, const void * src, size_t len)
return dst;
}
+
+//==========================================================================
+
void bcopy(const void * src, void * dst, size_t len)
{
asm volatile ( "cld \n\t"
@@ -87,6 +103,9 @@ void bcopy(const void * src, void * dst, size_t len)
: "memory", "%edx" );
}
+
+//==========================================================================
+
void bzero(void * dst, size_t len)
{
asm volatile ( "xorl %%eax, %%eax \n\t"
@@ -104,20 +123,23 @@ void bzero(void * dst, size_t len)
#endif
/* #if DONT_USE_GCC_BUILT_IN_STRLEN */
-
#define tolower(c) ((int)((c) & ~0x20))
#define toupper(c) ((int)((c) | 0x20))
+//==========================================================================
+
int strlen(const char * s)
{
int n = 0;
while (*s++) n++;
return(n);
}
-
/*#endif*/
+
+//==========================================================================
/* NOTE: Moved from ntfs.c */
+
int memcmp(const void *p1, const void *p2, int len)
{
while (len--) {
@@ -127,6 +149,9 @@ int memcmp(const void *p1, const void *p2, int len)
return 0;
}
+
+//==========================================================================
+
int strcmp(const char * s1, const char * s2)
{
while (*s1 && (*s1 == *s2)) {
@@ -136,6 +161,9 @@ int strcmp(const char * s1, const char * s2)
return (*s1 - *s2);
}
+
+//==========================================================================
+
int strncmp(const char * s1, const char * s2, size_t len)
{
register int n = len;
@@ -145,6 +173,9 @@ int strncmp(const char * s1, const char * s2, size_t len)
return(n<0 ? 0 : *s1 - *--s2);
}
+
+//==========================================================================
+
char * strcpy(char * s1, const char * s2)
{
register char *ret = s1;
@@ -153,6 +184,9 @@ char * strcpy(char * s1, const char * s2)
return ret;
}
+
+//==========================================================================
+
char * strncpy(char * s1, const char * s2, size_t n)
{
register char *ret = s1;
@@ -161,6 +195,9 @@ char * strncpy(char * s1, const char * s2, size_t n)
return ret;
}
+
+//==========================================================================
+
char * strlcpy(char * s1, const char * s2, size_t n)
{
register char *ret = s1;
@@ -170,6 +207,9 @@ char * strlcpy(char * s1, const char * s2, size_t n)
return ret;
}
+
+//==========================================================================
+
char * strstr(const char *in, const char *str)
{
char c;
@@ -193,6 +233,9 @@ char * strstr(const char *in, const char *str)
return (char *) (in - 1);
}
+
+//==========================================================================
+
int ptol(const char *str)
{
register int c = *str;
@@ -205,6 +248,9 @@ int ptol(const char *str)
return c;
}
+
+//==========================================================================
+
int atoi(const char *str)
{
register int sum = 0;
@@ -217,6 +263,9 @@ int atoi(const char *str)
return sum;
}
+
+//==========================================================================
+
char *strncat(char *s1, const char *s2, size_t n)
{
register char *ret = s1;
@@ -228,17 +277,25 @@ char *strncat(char *s1, const char *s2, size_t n)
return ret;
}
+
+//==========================================================================
+
char *strcat(char *s1, const char *s2)
{
return(strncat(s1, s2, strlen(s2)));
}
+
+//==========================================================================
+
char *strdup(const char *s1)
{
return strcpy(malloc(strlen(s1) + 1), s1);
}
+
#if STRNCASECMP
+//==========================================================================
int strncasecmp(const char *s1, const char *s2, size_t len)
{
register int n = len;
@@ -249,7 +306,10 @@ int strncasecmp(const char *s1, const char *s2, size_t len)
}
#endif
+
+//==========================================================================
/* COPYRIGHT NOTICE: checksum8 from AppleSMBIOS */
+
uint8_t checksum8( void * start, unsigned int length )
{
uint8_t csum = 0;
@@ -262,3 +322,27 @@ uint8_t checksum8( void * start, unsigned int length )
return csum;
}
+
+#if LOAD_MODEL_SPECIFIC_STATIC_DATA
+//==========================================================================
+
+char * removeChar(char *aSourceString, char aTargetChar)
+{
+ char *source = aSourceString;
+ char *destination = aSourceString;
+
+ for (; *source != '\0'; source++)
+ {
+ *destination = *source;
+
+ if (*destination != aTargetChar)
+ {
+ destination++;
+ }
+ }
+
+ *destination = '\0';
+
+ return (aSourceString);
+}
+#endif
diff --git a/i386/libsaio/Makefile b/i386/libsaio/Makefile
index 12e36a9..cc5eccb 100644
--- a/i386/libsaio/Makefile
+++ b/i386/libsaio/Makefile
@@ -1,71 +1,61 @@
-DIR = libsaio
+#
+# File: RevoBoot/i386/libsaio/Makefile
+#
+# Updates:
+#
+# - Major cleanup (PikerAlpha, October 2012).
+# - DMAKE_TARGET_MODEL added (PikerAlpha, October 2012).
+# - Static data selectors added (PikerAlpha, October 2012).
+# - STATIC_DATA_FILENAME added (PikerAlpha, October 2012).
+# - Output added for rm/ar/ranlib actions (PikerAlpha, November 2012).
+# - Enabled clang compilation (dgsga, PikerAlpha, November 2012. Credits to Evan Lojewski for original work).
+# - Output change and now using libtool instead of ar/ranlib (PikerAlpha, November 2012).
+# - SAIO_OBJS changed / base64.o added (PikerAlpha, November 2012).
+
include ../MakePaths.dir
UTILDIR = ../util
LIBSADIR = ../libsa
-INSTALLDIR = $(DSTROOT)/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/standalone
-#SYMROOT=
OPTIM = -Os -Oz
DEBUG = -DNOTHING
-CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
- -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
- -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
- -DREVOBOOT_VERSION_INFO=\"RevoBoot\ v$(PRODUCT_VERSION_NUMBER)\" \
- -DMAKE_TARGET_OS=$(PRODUCT_OS_TARGET) \
- -fno-builtin -static $(OMIT_FRAME_POINTER_CFLAG) \
- -mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
- -march=pentium4 -msse2 -mfpmath=sse -msoft-float
-
+CFLAGS = $(RC_CFLAGS) $(OPTIM) -arch i386 -g -Wmost \
+ -D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
+ -DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
+ -DREVOBOOT_VERSION_INFO=\"RevoBoot\ v$(PRODUCT_VERSION_NUMBER)\" \
+ -DMAKE_TARGET_OS=$(PRODUCT_OS_TARGET) \
+ -DSETTINGS_FILE=SETTINGS/$(MAKE_TARGET_MODEL).h \
+ -DSTATIC_DATA_FILENAME=$(MAKE_TARGET_MODEL).bin \
+ -DACPI_DATA_FILE=../../config/$(MAKE_ACPI_DATA_FILE) \
+ -DEFI_DATA_FILE=../config/$(MAKE_EFI_DATA_FILE) \
+ -DSMBIOS_DATA_FILE=../config/$(MAKE_SMBIOS_DATA_FILE) \
+ -fno-builtin -static $(OMIT_FRAME_POINTER_CFLAG) \
+ -fno-stack-protector \
+ -march=pentium4 -msse2 -msoft-float
-DEFINES=
-CONFIG = hd
INC = -I. -I$(SYMROOT) -I$(UTILDIR) -I$(LIBSADIR)
-ifneq "" "$(wildcard /bin/mkdirs)"
- MKDIRS = /bin/mkdirs
-else
- MKDIRS = /bin/mkdir -p
-endif
-AS = as
-LD = ld
-# LIBS= -lc_static
-LIBS=
VPATH = $(OBJROOT):$(SYMROOT)
-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 \
- vbe.o hfs.o hfs_compare.o \
- xml.o md5c.o device_tree.o \
- cpu.o platform.o acpi.o \
- smbios.o efi.o
-
-SAIO_EXTERN_OBJS = console.o
+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 vbe.o hfs.o \
+ hfs_compare.o xml.o md5c.o device_tree.o cpu.o platform.o \
+ acpi.o smbios.o efi.o console.o
-SFILES =
-CFILES =
-HFILES =
-EXPORTED_HFILES =
-INSTALLED_HFILES =
-OTHERFILES = Makefile
-ALLSRC = $(SFILES) $(CFILES) \
- $(HFILES) $(OTHERFILES)
LIBS = libsaio.a
+
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
-lion: all
-mountain-lion: all
+$(MAKEGOAL): $(DIRS_NEEDED) libsaio.h $(LIBS)
-all: $(DIRS_NEEDED) libsaio.h $(LIBS)
+$(LIBS): $(SAIO_OBJS)
+ @if [ -f $(SYMROOT)/$@ ]; then \
+ echo "\t[RM] $@"; \
+ rm -f $(SYMROOT)/$@; \
+ fi;
-libsaio.a: $(SAIO_EXTERN_OBJS) $(SAIO_OBJS)
- rm -f $(SYMROOT)/$(@F)
- ar q $(SYMROOT)/$(@F) $^
- ranlib $(SYMROOT)/$(@F)
+ @echo "\t[LIBTOOL] $@"
+ @libtool -o $(SYMROOT)/$@ $^
include ../MakeInc.dir
-
-# dependencies
--include $(OBJROOT)/Makedep
diff --git a/i386/libsaio/acpi.c b/i386/libsaio/acpi.c
index 3b97a80..baaa8fd 100755
--- a/i386/libsaio/acpi.c
+++ b/i386/libsaio/acpi.c
@@ -26,6 +26,9 @@
* EFI implementation for Revolution Copyright (c) 2010 by DHP.
* All rights reserved.
*
+ * Updates:
+ *
+ * - Moved #include to end of file, eliminating need of extern in patcher.h (PikerAlpha, October 2012).
*/
@@ -72,29 +75,19 @@ void updateACPITableData(struct acpi_2_rsdp * rsdp, struct acpi_2_xsdt * xsdt, i
#if APPLE_STYLE_ACPI
-
//------------------------- Used in acpi/patcher.h -------------------------
-
#define _ACPI_SET(target, str, len) strncpy(target, str, len)
#define _ACPI_SET_APPLE_OEMID(target) _ACPI_SET((target)->OEMID, "Apple ", 6)
#define _ACPI_SET_APPLE_OEMTargetID(target) _ACPI_SET((target)->OEMTableID, "Apple00", 8)
-
//--------------------------------------------------------------------------
-
#else
-
//--------------------------- Void replacements ----------------------------
-
#define _ACPI_SET(target, str, len)
#define _ACPI_SET_APPLE_OEMID(target)
#define _ACPI_SET_APPLE_OEMTargetID(target)
-
//--------------------------------------------------------------------------
-
#endif
-#include "acpi/patcher.h" // Macro's in this include file must be live now.
-
//==============================================================================
// Original version written by macerintel (?). Rewrite by Master Chief in 2009.
@@ -136,4 +129,4 @@ struct acpi_2_rsdp * getACPIBaseAddress()
#endif
}
-
+#include "acpi/patcher.h" // Macro's in this include file must be live now.
diff --git a/i386/libsaio/acpi/essentials.h b/i386/libsaio/acpi/essentials.h
index 5d1486b..0b66f09 100644
--- a/i386/libsaio/acpi/essentials.h
+++ b/i386/libsaio/acpi/essentials.h
@@ -53,30 +53,55 @@ typedef struct static_acpi_2_table
int tableLength;
bool loaded;
void * tableAddress;
+#if LOAD_MODEL_SPECIFIC_ACPI_DATA
+ char fileName[32];
+#endif
} __attribute__((packed)) ACPITable;
static ACPITable customTables[] =
{
+#if LOAD_MODEL_SPECIFIC_ACPI_DATA
// Essential tables.
- { "APIC", APIC_Table, sizeof(APIC_Table), false, 0 },
- { "ECDT", ECDT_Table, sizeof(ECDT_Table), false, 0 },
- { "HPET", HPET_Table, sizeof(HPET_Table), false, 0 },
- { "MCFG", MCFG_Table, sizeof(MCFG_Table), false, 0 },
- { "SBST", SBST_Table, sizeof(SBST_Table), false, 0 },
- { "SSDT", SSDT_Table, sizeof(SSDT_Table), false, 0 },
+ { "APIC", APIC_Table, sizeof(APIC_Table), false, 0, "" },
+ { "ECDT", ECDT_Table, sizeof(ECDT_Table), false, 0, "" },
+ { "HPET", HPET_Table, sizeof(HPET_Table), false, 0, "" },
+ { "MCFG", MCFG_Table, sizeof(MCFG_Table), false, 0, "" },
+ { "SBST", SBST_Table, sizeof(SBST_Table), false, 0, "" },
+ { "SSDT", SSDT_Table, sizeof(SSDT_Table), false, 0, "" },
// Special essential tables.
- { "DSDT", DSDT_Table, sizeof(DSDT_Table), false, 0 },
- { "FACS", FACS_Table, sizeof(FACS_Table), false, 0 },
+ { "DSDT", DSDT_Table, sizeof(DSDT_Table), false, 0, "" },
+ { "FACS", FACS_Table, sizeof(FACS_Table), false, 0, "" },
// Optional tables.
- { "APIC-1", APIC2_Table, sizeof(APIC2_Table), false, 0 },
- { "SSDT_GPU", SSDT_GPU_Table, sizeof(SSDT_GPU_Table), false, 0 },
- { "SSDT_PR", SSDT_PR_Table, sizeof(SSDT_PR_Table), false, 0 },
- { "SSDT_SATA", SSDT_SATA_Table, sizeof(SSDT_SATA_Table), false, 0 },
- { "SSDT_USB", SSDT_USB_Table, sizeof(SSDT_USB_Table), false, 0 },
- { "", 0, 0, false, 0 }
+ { "APIC-1", APIC2_Table, sizeof(APIC2_Table), false, 0, "" },
+ { "SSDT_GPU", SSDT_GPU_Table, sizeof(SSDT_GPU_Table), false, 0, "" },
+ { "SSDT_PR", SSDT_PR_Table, sizeof(SSDT_PR_Table), false, 0, "" },
+ { "SSDT_SATA", SSDT_SATA_Table, sizeof(SSDT_SATA_Table), false, 0, "" },
+ { "SSDT_USB", SSDT_USB_Table, sizeof(SSDT_USB_Table), false, 0, "" },
+ { "", 0, 0, false, 0, "" }
+#else
+ // Essential tables.
+ { "APIC", APIC_Table, sizeof(APIC_Table), false, 0 },
+ { "ECDT", ECDT_Table, sizeof(ECDT_Table), false, 0 },
+ { "HPET", HPET_Table, sizeof(HPET_Table), false, 0 },
+ { "MCFG", MCFG_Table, sizeof(MCFG_Table), false, 0 },
+ { "SBST", SBST_Table, sizeof(SBST_Table), false, 0 },
+ { "SSDT", SSDT_Table, sizeof(SSDT_Table), false, 0 },
+
+ // Special essential tables.
+ { "DSDT", DSDT_Table, sizeof(DSDT_Table), false, 0 },
+ { "FACS", FACS_Table, sizeof(FACS_Table), false, 0 },
+
+ // Optional tables.
+ { "APIC-1", APIC2_Table, sizeof(APIC2_Table), false, 0 },
+ { "SSDT_GPU", SSDT_GPU_Table, sizeof(SSDT_GPU_Table), false, 0 },
+ { "SSDT_PR", SSDT_PR_Table, sizeof(SSDT_PR_Table), false, 0 },
+ { "SSDT_SATA", SSDT_SATA_Table, sizeof(SSDT_SATA_Table), false, 0 },
+ { "SSDT_USB", SSDT_USB_Table, sizeof(SSDT_USB_Table), false, 0 },
+ { "", 0, 0, false, 0 }
+#endif
};
diff --git a/i386/libsaio/acpi/patcher.h b/i386/libsaio/acpi/patcher.h
index f1617a8..acc9233 100644
--- a/i386/libsaio/acpi/patcher.h
+++ b/i386/libsaio/acpi/patcher.h
@@ -7,52 +7,72 @@
* - Refactorized for Revolution by DHP in 2010.
* - A complete new implementation written for RevoBoot by DHP in 2011.
* - Automatic SSDT_PR creation added by DHP in June 2011.
+ * - Call loadBinaryData from loadACPITable (PikerAlpha, October 2012).
+ * - Moved extern declarations to saio_internal.h (PikerAlpha, October 2012).
+ * - Now using gPlatform.CommaLessModelID instead of gPlatform.ModelID (PikerAlpha, October 2012).
+ * - Fall back to non-model specific file when model specific file is unavailable (PikerAlpha, October 2012).
*/
-extern ACPI_RSDP * getACPIBaseAddress();
-
-
#if PATCH_ACPI_TABLE_DATA
#if AUTOMATIC_SSDT_PR_CREATION
#include "ssdt_pr_generator.h"
#endif
-#if LOAD_EXTRA_ACPI_TABLES && (LOAD_DSDT_TABLE_FROM_EXTRA_ACPI || LOAD_SSDT_TABLE_FROM_EXTRA_ACPI)
+
+#if (LOAD_EXTRA_ACPI_TABLES && (LOAD_DSDT_TABLE_FROM_EXTRA_ACPI || LOAD_SSDT_TABLE_FROM_EXTRA_ACPI))
//==============================================================================
int loadACPITable(int tableIndex)
{
- _ACPI_DEBUG_DUMP("loadACPITable(%s / ", customTables[tableIndex].name);
+ char dirSpec[48] = "";
+ long fileSize = 0;
+ void * tableAddress = (void *)kLoadAddr;
- char dirspec[32];
- sprintf (dirspec, "/Extra/ACPI/%s.aml", customTables[tableIndex].name);
- int fd = open(dirspec, 0);
+#if LOAD_MODEL_SPECIFIC_ACPI_DATA
+ // Example: /Extra/ACPI/DSDT-MacBookPro101.aml
+ // 0123456789 0123456789 0123456789 1
+ sprintf(dirSpec, "/Extra/ACPI/%s-%s.aml", customTables[tableIndex].name, gPlatform.CommaLessModelID);
- if (fd < 0)
- {
- _ACPI_DEBUG_DUMP("Error: File not found.)\n");
+ /*
+ * loadBinaryData calls LoadFile (both in sys.c) to load table data into a
+ * load buffer at kLoadAddr (defined in memory.h) and copies it into a new
+ * allocated memory block (kLoadAddr gets overwritten by the next call).
+ */
+ fileSize = loadBinaryData(dirSpec, &tableAddress);
- return -1;
+ if (fileSize == -1)
+ {
+#endif
+ // File: /Extra/ACPI/DSDT-MacBookPro101.aml not found. Try: /Extra/ACPI/dsdt.aml
+ sprintf(dirSpec, "/Extra/ACPI/%s.aml", customTables[tableIndex].name);
+ fileSize = loadBinaryData(dirSpec, &tableAddress);
+#if LOAD_MODEL_SPECIFIC_ACPI_DATA
}
+#endif
- int fileSize = file_size(fd);
- void * kernelAddress = malloc(fileSize);
-
- if (kernelAddress)
+ if (fileSize > 0)
{
- read(fd, kernelAddress, fileSize);
- }
+ _ACPI_DEBUG_DUMP("Loading: %s (%d bytes).\n", dirSpec, fileSize);
+ _ACPI_DEBUG_SLEEP(1);
- close(fd);
+ // 'tableAddress' is copied into kernel memory later on (see setupACPI).
+ customTables[tableIndex].table = tableAddress;
+ customTables[tableIndex].tableLength = fileSize;
- _ACPI_DEBUG_DUMP("%d bytes).\n", fileSize);
+#if (DEBUG_ACPI && LOAD_MODEL_SPECIFIC_ACPI_DATA)
+ // Update table name from DSDT.aml to DSDT-Macmini51.aml (DSDT example).
+ sprintf(customTables[tableIndex].fileName, gPlatform.CommaLessModelID);
+#endif
- customTables[tableIndex].table = kernelAddress;
- customTables[tableIndex].tableLength = fileSize;
+ return 0;
+ }
+
+ _ACPI_DEBUG_DUMP("Error: File %s not found.)\n", dirSpec);
+ _ACPI_DEBUG_SLEEP(5);
- return 0;
+ return -1;
}
@@ -244,7 +264,7 @@ bool patchFACPTable(ENTRIES * xsdtEntries, int tableIndex, int dropOffset)
#if STATIC_DSDT_TABLE_INJECTION
_ACPI_DEBUG_DUMP("static DSDT data");
#else // STATIC_DSDT_TABLE_INJECTION
- _ACPI_DEBUG_DUMP("loaded DSDT.aml");
+ _ACPI_DEBUG_DUMP("%s", customTables[DSDT].fileName);
#endif // STATIC_DSDT_TABLE_INJECTION
_ACPI_DEBUG_DUMP(" @ 0x%x\n", customTables[DSDT].tableAddress);
diff --git a/i386/libsaio/acpi/static_data.h b/i386/libsaio/acpi/static_data.h
index 8bf28d2..e9bb4e7 100755
--- a/i386/libsaio/acpi/static_data.h
+++ b/i386/libsaio/acpi/static_data.h
@@ -1,19 +1,18 @@
/*
- * Copyright 2009 by Master Chief.
+ * Static data overrides for ACPI tables. Copyright 2009 by Master Chief.
*
- * Refactored (dynamic and static ACPI patching) by DHP in 2010/2011.
+ * Updates:
+ * - Refactored (dynamic and static ACPI patching) by DHP in 2010/2011.
+ * - Data selector moved over from RevoBoot/i386/config/data.h (PikerAlpha, October 2012).
*/
#ifndef __LIBSAIO_ACPI_STATIC_DATA_H
#define __LIBSAIO_ACPI_STATIC_DATA_H
-#define INCLUDE_ACPI_DATA 1
+// The STRING (macro) is defined in RevoBoot/i386/config/settings.h
+#include STRING(ACPI_DATA_FILE)
-#include "../config/data.h"
-
-// The STATIC_xxx_TABLE_DATA's here will get replaced with the data from private_data.h
-
-// Static data overrides for essential tables.
+// The STATIC_xxx_TABLE_DATA's here will get replaced with the data from RevoBoot/i386/config/ACPI/[default/MacmodelNN].h
static uint32_t APIC_Table[] =
{
diff --git a/i386/libsaio/allocate.c b/i386/libsaio/allocate.c
index f986219..fdd5849 100755
--- a/i386/libsaio/allocate.c
+++ b/i386/libsaio/allocate.c
@@ -36,10 +36,7 @@
long AllocateMemoryRange(char * rangeName, long start, long length, long type)
{
- char *nameBuf;
- uint32_t *buffer;
-
- nameBuf = malloc(strlen(rangeName) + 1);
+ char *nameBuf = malloc(strlen(rangeName) + 1);
if (nameBuf == 0)
{
@@ -48,10 +45,12 @@ long AllocateMemoryRange(char * rangeName, long start, long length, long type)
strcpy(nameBuf, rangeName);
- buffer = malloc(2 * sizeof(uint32_t));
+ uint32_t *buffer = malloc(2 * sizeof(uint32_t));
if (buffer == 0)
{
+ free(nameBuf);
+
return -1;
}
diff --git a/i386/libsaio/bios.h b/i386/libsaio/bios.h
index 0a0c927..7391450 100755
--- a/i386/libsaio/bios.h
+++ b/i386/libsaio/bios.h
@@ -32,7 +32,7 @@
typedef union
{
- unsigned int rx;
+ unsigned int rx;
unsigned short rr;
struct
@@ -87,13 +87,13 @@ typedef struct
#define EBIOS_LOCKING_ACCESS 0x02
#define EBIOS_ENHANCED_DRIVE_INFO 0x04
-#define BASE_HD_DRIVE 0x80
+#define BASE_HD_DRIVE 0x80
/*
* Used in saio_types.h and in StringTable.c (function loadSystemConfig).
*/
-#define IO_CONFIG_DATA_SIZE 4096
+#define IO_CONFIG_DATA_SIZE 4096
/*
diff --git a/i386/libsaio/biosfn.c b/i386/libsaio/biosfn.c
index 32a5c82..61f09c5 100755
--- a/i386/libsaio/biosfn.c
+++ b/i386/libsaio/biosfn.c
@@ -51,8 +51,8 @@ static biosBuf_t bb;
int fastEnableA20(void)
{
- bb.intno = 0x15;
- bb.eax.rx = 0x2401;
+ bb.intno = 0x15;
+ bb.eax.rx = 0x2401;
bios(&bb);
// If successful: CF clear, AH = 00h. On error: CF set, AH = status
@@ -72,8 +72,8 @@ int bgetc(void)
*/
while(!readKeyboardStatus());
- bb.intno = 0x16;
- bb.eax.r.h = 0x00;
+ bb.intno = 0x16;
+ bb.eax.r.h = 0x00;
bios(&bb);
return bb.eax.rr;
@@ -150,7 +150,9 @@ unsigned long getMemoryMap(MemoryRange * rangeArray, unsigned long maxRangeCount
// printf("Get memory map 0x%x, %d\n", rangeArray);
// getchar();
if (maxRangeCount > (BIOS_LEN / sizeof(MemoryRange)))
+ {
maxRangeCount = (BIOS_LEN / sizeof(MemoryRange));
+ }
bb.ebx.rx = 0; // Initial continuation value must be zero.
@@ -160,14 +162,13 @@ unsigned long getMemoryMap(MemoryRange * rangeArray, unsigned long maxRangeCount
bb.eax.rx = 0xe820;
bb.ecx.rx = kDescriptorSizeMin;
bb.edx.rx = kMemoryMapSignature;
- bb.edi.rr = NORMALIZED_OFFSET( (unsigned long) range );
- bb.es = NORMALIZED_SEGMENT( (unsigned long) range );
+ bb.edi.rr = NORMALIZED_OFFSET( (unsigned long) range);
+ bb.es = NORMALIZED_SEGMENT( (unsigned long) range);
bios(&bb);
// Check for errors.
- if ( bb.flags.cf || bb.eax.rx != kMemoryMapSignature
- || bb.ecx.rx != kDescriptorSizeMin )
+ if (bb.flags.cf || bb.eax.rx != kMemoryMapSignature || bb.ecx.rx != kDescriptorSizeMin)
{
//printf("Got an error %x %x %x\n", bb.flags.cf,
// bb.eax.rx, bb.ecx.rx);
@@ -176,16 +177,19 @@ unsigned long getMemoryMap(MemoryRange * rangeArray, unsigned long maxRangeCount
// Tally up the conventional/extended memory sizes.
- if (range->type == kMemoryRangeUsable || range->type == kMemoryRangeACPI ||
- range->type == kMemoryRangeNVS )
+ if (range->type == kMemoryRangeUsable || range->type == kMemoryRangeACPI || range->type == kMemoryRangeNVS)
{
// Tally the conventional memory ranges.
if (range->base + range->length <= 0xa0000)
+ {
conMemSize += range->length;
+ }
// Record the top of extended memory.
if (range->base >= EXTENDED_ADDR)
+ {
extMemSize += range->length;
+ }
}
range++;
@@ -193,13 +197,15 @@ unsigned long getMemoryMap(MemoryRange * rangeArray, unsigned long maxRangeCount
// Is this the last address range?
- if ( bb.ebx.rx == 0 ) {
+ if (bb.ebx.rx == 0)
+ {
//printf("last range\n");
break;
}
}
- *conMemSizePtr = conMemSize / 1024; // size in KB
- *extMemSizePtr = extMemSize / 1024; // size in KB
+
+ *conMemSizePtr = (conMemSize / 1024); // size in KB
+ *extMemSizePtr = (extMemSize / 1024); // size in KB
// Copy out data
bcopy((char *)BIOS_ADDR, rangeArray, ((char *)range - (char *)BIOS_ADDR));
@@ -339,7 +345,7 @@ int biosread(int dev, int cyl, int head, int sec, int num)
bb.intno = 0x13;
sec += 1; // sector numbers start at 1.
- for (i=0;;)
+ for (i = 0; ;)
{
bb.ecx.r.h = cyl;
bb.ecx.r.l = ((cyl & 0x300) >> 2) | (sec & 0x3F);
@@ -430,11 +436,11 @@ int ebiosread(int dev, unsigned long long sec, int count)
void putc(int ch)
{
- bb.intno = 0x10;
- bb.ebx.r.h = 0x00; /* background black */
- bb.ebx.r.l = 0x0F; /* foreground white */
- bb.eax.r.h = 0x0e;
- bb.eax.r.l = ch;
+ bb.intno = 0x10;
+ bb.ebx.r.h = 0x00; /* background black */
+ bb.ebx.r.l = 0x0F; /* foreground white */
+ bb.eax.r.h = 0x0e;
+ bb.eax.r.l = ch;
bios(&bb);
}
@@ -516,9 +522,10 @@ int is_no_emulation(int drive)
int get_drive_info(int drive, struct driveInfo *dp)
{
- boot_drive_info_t *di = &dp->di;
int ret = 0;
+ boot_drive_info_t *di = &dp->di;
+
#if UNUSED
if (maxhd == 0)
{
@@ -528,11 +535,15 @@ int get_drive_info(int drive, struct driveInfo *dp)
bios(&bb);
if (bb.flags.cf == 0)
+ {
maxhd = 0x7f + bb.edx.r.l;
+ }
};
if (drive > maxhd)
+ {
return 0;
+ }
#endif
bzero(dp, sizeof(struct driveInfo));
@@ -549,18 +560,21 @@ int get_drive_info(int drive, struct driveInfo *dp)
bios(&bb);
if ((bb.ebx.rr == 0xaa55) && (bb.flags.cf == 0))
+ {
dp->uses_ebios = bb.ecx.r.l; // Get flags for supported operations.
+ }
if (dp->uses_ebios & (EBIOS_ENHANCED_DRIVE_INFO | EBIOS_LOCKING_ACCESS | EBIOS_FIXED_DISK_ACCESS))
{
// Get EBIOS drive info.
static struct drive_params params;
params.buf_size = sizeof(params);
- bb.intno = 0x13;
- bb.eax.r.h = 0x48;
- bb.edx.r.l = drive;
- bb.esi.rr = NORMALIZED_OFFSET((unsigned)¶ms);
- bb.ds = NORMALIZED_SEGMENT((unsigned)¶ms);
+
+ bb.intno = 0x13;
+ bb.eax.r.h = 0x48;
+ bb.edx.r.l = drive;
+ bb.esi.rr = NORMALIZED_OFFSET((unsigned)¶ms);
+ bb.ds = NORMALIZED_SEGMENT((unsigned)¶ms);
bios(&bb);
if (bb.flags.cf != 0 /* || params.phys_sectors < 2097152 */)
@@ -600,7 +614,9 @@ int get_drive_info(int drive, struct driveInfo *dp)
#endif
if (ret == 0)
+ {
dp->valid = 1;
+ }
return ret;
}
@@ -610,8 +626,11 @@ int get_drive_info(int drive, struct driveInfo *dp)
void sleep(int n)
{
- unsigned int endtime = (time18() + 18*n);
- while (time18() < endtime);
+ if (n < 60)
+ {
+ unsigned int endtime = (time18() + (18*n));
+ while (time18() < endtime);
+ }
}
@@ -619,10 +638,9 @@ void sleep(int n)
void delay(int ms)
{
- bb.intno = 0x15;
- bb.eax.r.h = 0x86;
- bb.ecx.rr = ms >> 16;
- bb.edx.rr = ms & 0xFFFF;
+ bb.intno = 0x15;
+ bb.eax.r.h = 0x86;
+ bb.ecx.rr = ms >> 16;
+ bb.edx.rr = ms & 0xFFFF;
bios(&bb);
}
-
diff --git a/i386/libsaio/device_tree.c b/i386/libsaio/device_tree.c
index d80dd3e..9949fc2 100755
--- a/i386/libsaio/device_tree.c
+++ b/i386/libsaio/device_tree.c
@@ -79,14 +79,18 @@ Property * DT__AddProperty(Node *node, const char *name, uint32_t length, void *
{
Property *prop;
- _EFI_DEBUG_DUMP("DT__AddProperty([Node '%s'], '%s', %d, 0x%x)\n", DT__GetName(node), name, length, value);
+#if (DEBUG_EFI & 2)
+ _EFI_DEBUG_DUMP("DT__AddProperty([Node '%s'], '%s', %d, 0x%x)\n", DT__GetName(node), name, length, value);
+#endif
if (freeProperties == NULL)
{
void *buf = malloc(kAllocSize);
int i;
+ #if (DEBUG_EFI & 2)
_EFI_DEBUG_DUMP("Allocating more free properties\n");
+ #endif
if (buf == 0)
{
@@ -129,7 +133,9 @@ Property * DT__AddProperty(Node *node, const char *name, uint32_t length, void *
node->last_prop = prop;
prop->next = 0;
- // _EFI_DEBUG_DUMP("Done [0x%x]\n", prop);
+#if (DEBUG_EFI & 8)
+ _EFI_DEBUG_DUMP("Done [0x%x]\n", prop);
+#endif
DTInfo.numProperties++;
DTInfo.totalPropertySize += RoundToLong(length);
@@ -155,7 +161,9 @@ Node * DT__AddChild(Node *parent, const char *name)
int i;
+#if (DEBUG_EFI & 2)
_EFI_DEBUG_DUMP("Allocating more free nodes\n");
+#endif
bzero(buf, kAllocSize);
node = (Node *)buf;
@@ -174,13 +182,17 @@ Node * DT__AddChild(Node *parent, const char *name)
}
}
+#if (DEBUG_EFI & 2)
_EFI_DEBUG_DUMP("DT__AddChild(0x%x, '%s')\n", parent, name);
+#endif
node = freeNodes;
freeNodes = node->next;
+#if (DEBUG_EFI & 2)
_EFI_DEBUG_DUMP("Got free node 0x%x\n", node);
_EFI_DEBUG_DUMP("prop = 0x%x, children = 0x%x, next = 0x%x\n", node->properties, node->children, node->next);
+#endif
if (parent == NULL)
{
@@ -252,7 +264,9 @@ void DT__Finalize(void)
Node *node;
Property *prop;
- // _EFI_DEBUG_DUMP("DT__Finalize\n");
+#if (DEBUG_EFI & 8)
+ _EFI_DEBUG_DUMP("DT__Finalize\n");
+#endif
for (prop = allocedProperties; prop != NULL; prop = prop->next)
{
@@ -332,7 +346,9 @@ void DT__FlattenDeviceTree(void **buffer_p, uint32_t *length)
uint32_t totalSize;
void * buf;
+#if (DEBUG_EFI & 2)
_EFI_DEBUG_DUMP("DT__FlattenDeviceTree(0x%x, 0x%x)\n", buffer_p, length);
+#endif
#if (DEBUG_EFI & 4)
if (buffer_p)
@@ -345,7 +361,9 @@ void DT__FlattenDeviceTree(void **buffer_p, uint32_t *length)
DTInfo.numProperties * sizeof(DeviceTreeNodeProperty) +
DTInfo.totalPropertySize;
+#if (DEBUG_EFI & 2)
_EFI_DEBUG_DUMP("Total size 0x%x\n", totalSize);
+#endif
if (buffer_p != 0)
{
@@ -385,11 +403,16 @@ char * DT__GetName(Node *node)
{
Property *prop;
- //_EFI_DEBUG_DUMP("DT__GetName(0x%x)\n", node);
- //_EFI_DEBUG_DUMP("Node properties = 0x%x\n", node->properties);
+#if (DEBUG_EFI & 8)
+ _EFI_DEBUG_DUMP("DT__GetName(0x%x)\n", node);
+ _EFI_DEBUG_DUMP("Node properties = 0x%x\n", node->properties);
+#endif
+
for (prop = node->properties; prop; prop = prop->next)
{
- //_EFI_DEBUG_DUMP("Prop '%s'\n", prop->name);
+#if (DEBUG_EFI & 8)
+ _EFI_DEBUG_DUMP("Prop '%s'\n", prop->name);
+#endif
if (strcmp(prop->name, "name") == 0)
{
return prop->value;
@@ -410,8 +433,10 @@ Node * DT__FindNode(const char *path, bool createIfMissing)
char *bp;
int i;
+#if (DEBUG_EFI & 2)
_EFI_DEBUG_DUMP("DT__FindNode('%s', %d)\n", path, createIfMissing);
-
+#endif
+
// Start at root
node = gPlatform.DT.RootNode;
@@ -436,13 +461,15 @@ Node * DT__FindNode(const char *path, bool createIfMissing)
{
break; // last path entry
}
-
+#if (DEBUG_EFI & 2)
_EFI_DEBUG_DUMP("Node '%s'\n", nameBuf);
+#endif
for (child = node->children; child != 0; child = child->next)
{
+#if (DEBUG_EFI & 2)
_EFI_DEBUG_DUMP("Child 0x%x\n", child);
-
+#endif
if (strcmp(DT__GetName(child), nameBuf) == 0)
{
break;
@@ -451,7 +478,9 @@ Node * DT__FindNode(const char *path, bool createIfMissing)
if (child == 0 && createIfMissing)
{
+#if (DEBUG_EFI & 2)
_EFI_DEBUG_DUMP("Creating node\n");
+#endif
char *str = malloc(strlen(nameBuf) + 1);
// XXX this will leak
diff --git a/i386/libsaio/disk.c b/i386/libsaio/disk.c
index 8ba0d5c..6335e14 100644
--- a/i386/libsaio/disk.c
+++ b/i386/libsaio/disk.c
@@ -49,9 +49,13 @@
GPT support added by David Elliott. Based on IOGUIDPartitionScheme.cpp.
*/
-/***
- * Cleanups and refactoring by DHP in 2010 and 2011.
- */
+/*
+ * Updates:
+ * - Cleanups and refactoring by DHP in 2010 and 2011.
+ * - Renamed LION_RECOVERY_SUPPORT to CORE_STARAGE_SUPPORT (PikerAlpha, November 2012).
+ * - Renamed LION_FILEVAULT_SUPPORT to CORE_STARAGE_SUPPORT (PikerAlpha, November 2012).
+ * - Renamed encryptedBootPartition to coreStoragePartition (PikerAlpha, November 2012).
+ */
#include "bootstruct.h"
@@ -117,7 +121,7 @@ static struct disk_blk0 * gBootSector = NULL;
// Apple_HFS
EFI_GUID const GPT_HFS_GUID = { 0x48465300, 0x0000, 0x11AA, { 0xAA, 0x11, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC } };
-#if LION_RECOVERY_SUPPORT || APPLE_RAID_SUPPORT
+#if CORE_STORAGE_SUPPORT || APPLE_RAID_SUPPORT
// Apple_Boot (RAID helper partition and the 650 MB 'Recovery HD' partition).
EFI_GUID const GPT_BOOT_GUID = { 0x426F6F74, 0x0000, 0x11AA, { 0xAA, 0x11, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC } };
#endif
@@ -140,8 +144,8 @@ EFI_GUID const GPT_HFS_GUID = { 0x48465300, 0x0000, 0x11AA, { 0xAA, 0x11, 0x
EFI_GUID const GPT_EFISYS_GUID = { 0xC12A7328, 0xF81F, 0x11D2, { 0xBA, 0x4B, 0x00, 0xA0, 0xC9, 0x3E, 0xC9, 0x3B } };
#endif
-#if LION_FILEVAULT_SUPPORT
- // Apple_CoreStorage (FileVault 2)
+#if CORE_STORAGE_SUPPORT
+ // Apple_CoreStorage (FileVault 2 and Fusion Drive)
EFI_GUID const GPT_CORESTORAGE_GUID = { 0x53746F72, 0x6167, 0x11AA, { 0xAA, 0x11, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC } };
#endif
@@ -560,8 +564,8 @@ BVRef diskScanGPTBootVolumes(int biosdev, int * countPtr)
map->next = gDiskBVMap;
gDiskBVMap = map;
-#if LION_FILEVAULT_SUPPORT
- bool encryptedBootPartition = false;
+#if CORE_STORAGE_SUPPORT
+ bool coreStoragePartition = false;
#endif
for (; gptID <= gptCount; gptID++)
@@ -615,16 +619,16 @@ BVRef diskScanGPTBootVolumes(int biosdev, int * countPtr)
else
#endif
-#if LION_FILEVAULT_SUPPORT // Is this an encrypted boot partition?
+#if CORE_STORAGE_SUPPORT // Is this a CoreStorage partition?
if (efi_guid_compare(&GPT_CORESTORAGE_GUID, (EFI_GUID const *)gptMap->ent_type) == 0)
{
_DISK_DEBUG_DUMP("Matched: CoreStorage GUID\n");
- encryptedBootPartition = true;
+ coreStoragePartition = true;
- continue; // Start searching for the Recovery HD partition.
+ continue; // Start searching for the Recovery HD/Boot OS X partition.
}
- else if (!encryptedBootPartition &&
+ else if (!coreStoragePartition &&
#else
// Check for HFS+ partitions.
if (
@@ -644,7 +648,7 @@ BVRef diskScanGPTBootVolumes(int biosdev, int * countPtr)
}
#endif
-#if LION_RECOVERY_SUPPORT || APPLE_RAID_SUPPORT
+#if CORE_STORAGE_SUPPORT || APPLE_RAID_SUPPORT
else if (efi_guid_compare(&GPT_BOOT_GUID, (EFI_GUID const *)gptMap->ent_type) == 0)
{
_DISK_DEBUG_DUMP("Matched: GPT_BOOT_GUID\n");
diff --git a/i386/libsaio/efi.c b/i386/libsaio/efi.c
index d19557b..4b35f18 100755
--- a/i386/libsaio/efi.c
+++ b/i386/libsaio/efi.c
@@ -31,15 +31,35 @@
* - STATIC_MODEL_NAME moved over from settings.h (PikerAlpha, October 2012).
* - STATIC_MODEL_NAME renamed to EFI_MODEL_NAME (PikerAlpha, October 2012).
* - Now no longer includes platform.h (PikerAlpha, October 2012).
+ * - Data selector moved over from RevoBoot/i386/config/data.h (PikerAlpha, October 2012).
+ * - Get static EFI data (optional) from /Extra/EFI/[MacModelNN].bin (PikerAlpha, October 2012).
+ * - STATIC_SYSTEM_SERIAL_NUMBER renamed to EFI_SYSTEM_SERIAL_NUMBER (PikerAlpha, October 2012).
*
*/
#include "efi/fake_efi.h"
-#define INCLUDE_EFI_DATA 1
-#include "../config/data.h"
+/* #if LOAD_MODEL_SPECIFIC_EFI_DATA
+//==============================================================================
+
+void useStaticEFIProperties(Node * aEFINode)
+{
+ // The STRING (macro) is defined in RevoBoot/i386/config/settings.h
+ #include STRING(EFI_DATA_FILE)
+
+ static EFI_UINT8 const EFI_DEVICE_PROPERTIES[] =
+ {
+ // Replaced with data from: RevoBoot/i386/config/EFI/[data-template/MacModelNN].h
+ STATIC_EFI_DEVICE_PROPERTIES
+ };
+
+ DT__AddProperty(aEFINode, "device-properties", sizeof(EFI_DEVICE_PROPERTIES), (EFI_CHAR8*) &EFI_DEVICE_PROPERTIES);
+
+ // _EFI_DEBUG_DUMP("Using statically linked EFI device-properties\n");
+}
+#endif */
//==============================================================================
@@ -49,9 +69,9 @@ void initEFITree(void)
static char ACPI[] = "ACPI";
- // The required information should be added to private_data.h
+ // The information from RevoBoot/i386/libsaio/SMBIOS/model_data.h is used here.
static EFI_CHAR16 const MODEL_NAME[] = EFI_MODEL_NAME;
- static EFI_CHAR16 const SYSTEM_SERIAL_NUMBER[] = STATIC_SYSTEM_SERIAL_NUMBER;
+ static EFI_CHAR16 const SYSTEM_SERIAL_NUMBER[] = EFI_SYSTEM_SERIAL_NUMBER;
DT__Initialize(); // Add and initialize gPlatform.DT.RootNode
@@ -177,15 +197,48 @@ void initEFITree(void)
gPlatform.EFI.Nodes.Chosen = chosenNode;
#if INJECT_EFI_DEVICE_PROPERTIES
+ _EFI_DEBUG_DUMP("Injecting static EFI device-properties\n");
- static EFI_UINT8 const EFI_DEVICE_PROPERTIES[] =
- {
- STATIC_EFI_DEVICE_PROPERTIES
- };
+ #if LOAD_MODEL_SPECIFIC_EFI_DATA
+ char dirSpec[32] = "";
+ sprintf(dirSpec, "/Extra/EFI/%s.bin", gPlatform.CommaLessModelID);
- _EFI_DEBUG_DUMP("Injecting EFI device-properties\n");
+ _EFI_DEBUG_DUMP("Loading: %s\n", dirSpec);
- DT__AddProperty(efiNode, "device-properties", sizeof(EFI_DEVICE_PROPERTIES), (EFI_CHAR8*) &EFI_DEVICE_PROPERTIES);
+ void * staticEFIData = (void *)kLoadAddr;
+
+ long fileSize = loadBinaryData(dirSpec, &staticEFIData);
+
+ if (fileSize > 0)
+ {
+ DT__AddProperty(efiNode, "device-properties", fileSize, (EFI_CHAR8*) staticEFIData);
+ }
+ else // No model specific data found. Use static EFI data from RevoBoot/i386/config/EFI
+ {
+ // useStaticEFIProperties(efiNode);
+ // The STRING (macro) is defined in RevoBoot/i386/config/settings.h
+ #include STRING(EFI_DATA_FILE)
+
+ static EFI_UINT8 const EFI_DEVICE_PROPERTIES[] =
+ {
+ // Replaced with data from: RevoBoot/i386/config/EFI/[data-template/MacModelNN].h
+ STATIC_EFI_DEVICE_PROPERTIES
+ };
+
+ DT__AddProperty(efiNode, "device-properties", sizeof(EFI_DEVICE_PROPERTIES), (EFI_CHAR8*) &EFI_DEVICE_PROPERTIES);
+ }
+ #else
+ // The STRING (macro) is defined in RevoBoot/i386/config/settings.h
+ #include STRING(EFI_DATA_FILE)
+
+ static EFI_UINT8 const EFI_DEVICE_PROPERTIES[] =
+ {
+ // Replaced with data from: RevoBoot/i386/config/EFI/[data-template/MacModelNN].h
+ STATIC_EFI_DEVICE_PROPERTIES
+ };
+
+ DT__AddProperty(efiNode, "device-properties", sizeof(EFI_DEVICE_PROPERTIES), (EFI_CHAR8*) &EFI_DEVICE_PROPERTIES);
+ #endif
#endif
_EFI_DEBUG_DUMP("Exiting initEFITree()\n");
@@ -200,9 +253,9 @@ void *convertHexStr2Binary(const char *hexStr, int *outLength)
{
int len;
char hexNibble;
- char hexByte[2];
+ char hexByte[2] = "";
uint8_t binChar;
- uint8_t *binStr;
+ uint8_t *binStr = NULL;
int hexStrIdx, binStrIdx, hexNibbleIdx;
len = strlen(hexStr);
@@ -278,22 +331,31 @@ static EFI_UINT32* getUUIDFromString(const char * givenUUID) // Patch by: rekurs
char szUUID[37]; // 0-35 (36) + 1
char *p = szUUID;
- while (*givenUUID) {
+ while (*givenUUID)
+ {
if (*givenUUID != '-')
+ {
*p++ = *givenUUID++;
+ }
else
+ {
givenUUID++;
+ }
}
*p = '\0';
void* binaryString = convertHexStr2Binary(szUUID, &size);
if (binaryString && size == 16)
+ {
return (EFI_UINT32*) binaryString;
+ }
verbose("%swrong format maybe?\n", errStr);
}
else
+ {
verbose("%slength should be 36.\n", errStr);
+ }
}
return (EFI_UINT32*) 0;
}
diff --git a/i386/libsaio/hfs_compare.c b/i386/libsaio/hfs_compare.c
index 405a571..8b86b60 100755
--- a/i386/libsaio/hfs_compare.c
+++ b/i386/libsaio/hfs_compare.c
@@ -31,45 +31,60 @@
#include "hfs_CaseTables.h"
#if ! UNCOMPRESSED
+//==============================================================================
static unsigned short * UncompressStructure(struct compressed_block *bp, int count, int size)
{
- unsigned short *out = malloc(size);
- unsigned short *op = out;
- unsigned short data;
- int i, j;
-
- for (i=0; icount)
- {
- stop("HFS+ Unicode tables are malformed\n");
- }
- data = bp->data;
- for (j=0; jcount; j++) {
- *op++ = data;
- if (bp->type == kTypeAscending) data++;
- else if (bp->type == kTypeAscending256) data += 256;
- }
- }
- return out;
+ int i, j;
+
+ unsigned short *out = malloc(size);
+ unsigned short *op = out;
+ unsigned short data;
+
+ for (i = 0; i < count; i++, bp++)
+ {
+ // If this happens (it shouldn't) please fix size and/or double check that count really is
+ // the number of elements in the array.
+ // This was a very hard bug to find, so please leave this code here.
+ if (out + size <= op + bp->count)
+ {
+ stop("HFS+ Unicode tables are malformed\n");
+ }
+
+ data = bp->data;
+
+ for (j = 0; j count; j++)
+ {
+ *op++ = data;
+
+ if (bp->type == kTypeAscending)
+ {
+ data++;
+ }
+ else if (bp->type == kTypeAscending256)
+ {
+ data += 256;
+ }
+ }
+ }
+
+ return out;
}
+
+//==============================================================================
+
static void InitCompareTables(void)
{
- if (gCompareTable == 0) {
- gCompareTable = UncompressStructure(gCompareTableCompressed,
- kCompareTableNBlocks, kCompareTableDataSize);
- gLowerCaseTable = UncompressStructure(gLowerCaseTableCompressed,
- kLowerCaseTableNBlocks, kLowerCaseTableDataSize);
- }
+ if (gCompareTable == 0)
+ {
+ gCompareTable = UncompressStructure(gCompareTableCompressed, kCompareTableNBlocks, kCompareTableDataSize);
+ gLowerCaseTable = UncompressStructure(gLowerCaseTableCompressed, kLowerCaseTableNBlocks, kLowerCaseTableDataSize);
+ }
}
-
#endif /* ! UNCOMPRESSED */
-//_______________________________________________________________________
+//==============================================================================
//
// Routine: FastRelString
//
@@ -77,7 +92,7 @@ static void InitCompareTables(void)
// returns 1 if str1 > str2
// return 0 if equal
//
-//_______________________________________________________________________
+//==============================================================================
int32_t FastRelString(u_int8_t * str1, u_int8_t * str2)
{
@@ -85,16 +100,20 @@ int32_t FastRelString(u_int8_t * str1, u_int8_t * str2)
u_int8_t length, length2;
#if ! UNCOMPRESED
- InitCompareTables();
+ InitCompareTables();
#endif
length = *(str1++);
length2 = *(str2++);
if (length == length2)
+ {
bestGuess = 0;
+ }
else if (length < length2)
+ {
bestGuess = -1;
+ }
else
{
bestGuess = 1;
@@ -116,12 +135,16 @@ int32_t FastRelString(u_int8_t * str1, u_int8_t * str2)
bSortWord = gCompareTable[bChar];
if (aSortWord > bSortWord)
+ {
return 1;
+ }
if (aSortWord < bSortWord)
+ {
return -1;
+ }
}
-
+
/*
* If characters match exactly, then go on to next character
* immediately without doing any extra work.
@@ -133,6 +156,7 @@ int32_t FastRelString(u_int8_t * str1, u_int8_t * str2)
}
+//==============================================================================
//
// FastUnicodeCompare - Compare two Unicode strings; produce a relative ordering
//
@@ -190,91 +214,125 @@ int32_t FastRelString(u_int8_t * str1, u_int8_t * str2)
// return 1;
//
-int32_t FastUnicodeCompare( u_int16_t * str1, register u_int32_t length1,
- u_int16_t * str2, register u_int32_t length2, int byte_order )
+int32_t FastUnicodeCompare(u_int16_t * str1, register u_int32_t length1,
+ u_int16_t * str2, register u_int32_t length2, int byte_order)
{
- register u_int16_t c1,c2;
+ register u_int16_t c1, c2;
register u_int16_t temp;
#if ! UNCOMPRESSED
- InitCompareTables();
+ InitCompareTables();
#endif
- while (1) {
+ while (1)
+ {
/* Set default values for c1, c2 in case there are no more valid chars */
c1 = 0;
c2 = 0;
/* Find next non-ignorable char from str1, or zero if no more */
- while (length1 && c1 == 0) {
+ while (length1 && c1 == 0)
+ {
if (byte_order == OSBigEndian)
+ {
c1 = SWAP_BE16(*(str1++));
+ }
else
+ {
c1 = SWAP_LE16(*(str1++));
+ }
+
--length1;
+
if ((temp = gLowerCaseTable[c1>>8]) != 0) // is there a subtable for this upper byte?
+ {
c1 = gLowerCaseTable[temp + (c1 & 0x00FF)]; // yes, so fold the char
+ }
}
/* Find next non-ignorable char from str2, or zero if no more */
- while (length2 && c2 == 0) {
+ while (length2 && c2 == 0)
+ {
if (byte_order == OSBigEndian)
+ {
c2 = SWAP_BE16(*(str2++));
+ }
else
+ {
c2 = SWAP_LE16(*(str2++));
+ }
+
--length2;
+
if ((temp = gLowerCaseTable[c2>>8]) != 0) // is there a subtable for this upper byte?
+ {
c2 = gLowerCaseTable[temp + (c2 & 0x00FF)]; // yes, so fold the char
+ }
}
if (c1 != c2) /* found a difference, so stop looping */
+ {
break;
+ }
if (c1 == 0) /* did we reach the end of both strings at the same time? */
+ {
return 0; /* yes, so strings are equal */
+ }
}
if (c1 < c2)
+ {
return -1;
- else
- return 1;
+ }
+
+ return 1;
}
+//==============================================================================
//
// BinaryUnicodeCompare - Compare two Unicode strings; produce a relative ordering
// Compared using a 16-bit binary comparison (no case folding)
-//
-int32_t BinaryUnicodeCompare (u_int16_t * str1, u_int32_t length1,
- u_int16_t * str2, u_int32_t length2)
+
+int32_t BinaryUnicodeCompare(u_int16_t * str1, u_int32_t length1, u_int16_t * str2, u_int32_t length2)
{
- register u_int16_t c1, c2;
- int32_t bestGuess;
- u_int32_t length;
-
- bestGuess = 0;
-
- if (length1 < length2) {
- length = length1;
- --bestGuess;
- } else if (length1 > length2) {
- length = length2;
- ++bestGuess;
- } else {
- length = length1;
- }
-
- while (length--) {
- c1 = *(str1++);
- c2 = *(str2++);
-
- if (c1 > c2)
- return (1);
- if (c1 < c2)
- return (-1);
- }
-
- return (bestGuess);
+ register u_int16_t c1, c2;
+ int32_t bestGuess = 0;
+ u_int32_t length;
+
+ if (length1 < length2)
+ {
+ length = length1;
+ --bestGuess;
+ }
+ else if (length1 > length2)
+ {
+ length = length2;
+ ++bestGuess;
+ }
+ else
+ {
+ length = length1;
+ }
+
+ while (length--)
+ {
+ c1 = *(str1++);
+ c2 = *(str2++);
+
+ if (c1 > c2)
+ {
+ return (1);
+ }
+
+ if (c1 < c2)
+ {
+ return (-1);
+ }
+ }
+
+ return (bestGuess);
}
@@ -304,36 +362,57 @@ int32_t BinaryUnicodeCompare (u_int16_t * str1, u_int32_t length1,
* ucslen is the number of UCS-2 input characters (not bytes)
* bufsize is the size of the output buffer in bytes
*/
-void utf_encodestr( const u_int16_t * ucsp, int ucslen,
- u_int8_t * utf8p, u_int32_t bufsize, int byte_order )
+
+void utf_encodestr(const u_int16_t * ucsp, int ucslen, u_int8_t * utf8p, u_int32_t bufsize, int byte_order)
{
u_int8_t *bufend;
u_int16_t ucs_ch;
bufend = utf8p + bufsize;
- while (ucslen-- > 0) {
- if (byte_order == OSBigEndian)
- ucs_ch = SWAP_BE16(*ucsp++);
- else
- ucs_ch = SWAP_LE16(*ucsp++);
+ while (ucslen-- > 0)
+ {
+ if (byte_order == OSBigEndian)
+ {
+ ucs_ch = SWAP_BE16(*ucsp++);
+ }
+ else
+ {
+ ucs_ch = SWAP_LE16(*ucsp++);
+ }
- if (ucs_ch < 0x0080) {
+ if (ucs_ch < 0x0080)
+ {
if (utf8p >= bufend)
+ {
break;
+ }
+
if (ucs_ch == '\0')
+ {
continue; /* skip over embedded NULLs */
+ }
+
*utf8p++ = ucs_ch;
- } else if (ucs_ch < 0x800) {
+ }
+ else if (ucs_ch < 0x800)
+ {
if ((utf8p + 1) >= bufend)
+ {
break;
+ }
+
*utf8p++ = (ucs_ch >> 6) | 0xc0;
*utf8p++ = (ucs_ch & 0x3f) | 0x80;
-
- } else {
+ }
+ else
+ {
if ((utf8p + 2) >= bufend)
+ {
break;
+ }
+
*utf8p++ = (ucs_ch >> 12) | 0xe0;
*utf8p++ = ((ucs_ch >> 6) & 0x3f) | 0x80;
*utf8p++ = ((ucs_ch) & 0x3f) | 0x80;
@@ -351,6 +430,7 @@ void utf_encodestr( const u_int16_t * ucsp, int ucslen,
* ucslen is the number of UCS-2 output characters (not bytes)
* bufsize is the size of the output buffer in bytes
*/
+
void utf_decodestr(const u_int8_t * utf8p, u_int16_t * ucsp, u_int16_t * ucslen, u_int32_t bufsize, int byte_order)
{
u_int16_t *bufstart;
@@ -361,58 +441,80 @@ void utf_decodestr(const u_int8_t * utf8p, u_int16_t * ucsp, u_int16_t * ucslen,
bufstart = ucsp;
bufend = (u_int16_t *)((u_int8_t *)ucsp + bufsize);
- while ((byte = *utf8p++) != '\0') {
+ while ((byte = *utf8p++) != '\0')
+ {
if (ucsp >= bufend)
+ {
break;
+ }
/* check for ascii */
- if (byte < 0x80) {
+ if (byte < 0x80)
+ {
ucs_ch = byte;
- if (byte_order == OSBigEndian)
- *ucsp++ = SWAP_BE16(ucs_ch);
- else
- *ucsp++ = SWAP_LE16(ucs_ch);
-
+ if (byte_order == OSBigEndian)
+ {
+ *ucsp++ = SWAP_BE16(ucs_ch);
+ }
+ else
+ {
+ *ucsp++ = SWAP_LE16(ucs_ch);
+ }
+
continue;
}
- switch (byte & 0xf0) {
- /* 2 byte sequence*/
- case 0xc0:
- case 0xd0:
- /* extract bits 6 - 10 from first byte */
- ucs_ch = (byte & 0x1F) << 6;
- break;
- /* 3 byte sequence*/
- case 0xe0:
- /* extract bits 12 - 15 from first byte */
- ucs_ch = (byte & 0x0F) << 6;
-
- /* extract bits 6 - 11 from second byte */
- if (((byte = *utf8p++) & 0xc0) != 0x80)
- goto stop;
-
- ucs_ch += (byte & 0x3F);
- ucs_ch <<= 6;
- break;
- default:
- goto stop;
+ switch (byte & 0xf0)
+ {
+ /* 2 byte sequence*/
+ case 0xc0:
+ case 0xd0: /* extract bits 6 - 10 from first byte */
+ ucs_ch = (byte & 0x1F) << 6;
+ break;
+ /* 3 byte sequence*/
+ case 0xe0:
+ /* extract bits 12 - 15 from first byte */
+ ucs_ch = (byte & 0x0F) << 6;
+
+ /* extract bits 6 - 11 from second byte */
+ if (((byte = *utf8p++) & 0xc0) != 0x80)
+ {
+ goto stop;
+ }
+
+ ucs_ch += (byte & 0x3F);
+ ucs_ch <<= 6;
+ break;
+ default:
+ goto stop;
}
/* extract bits 0 - 5 from final byte */
if (((byte = *utf8p++) & 0xc0) != 0x80)
+ {
goto stop;
- ucs_ch += (byte & 0x3F);
+ }
+
+ ucs_ch += (byte & 0x3F);
- if (byte_order == OSBigEndian)
- *ucsp++ = SWAP_BE16(ucs_ch);
- else
- *ucsp++ = SWAP_LE16(ucs_ch);
+ if (byte_order == OSBigEndian)
+ {
+ *ucsp++ = SWAP_BE16(ucs_ch);
+ }
+ else
+ {
+ *ucsp++ = SWAP_LE16(ucs_ch);
+ }
}
+
stop:
- if (byte_order == OSBigEndian)
- *ucslen = SWAP_BE16(ucsp - bufstart);
- else
- *ucslen = SWAP_LE16(ucsp - bufstart);
+ if (byte_order == OSBigEndian)
+ {
+ *ucslen = SWAP_BE16(ucsp - bufstart);
+ }
+ else
+ {
+ *ucslen = SWAP_LE16(ucsp - bufstart);
+ }
}
diff --git a/i386/libsaio/load.c b/i386/libsaio/load.c
index dad895a..2b89f0e 100755
--- a/i386/libsaio/load.c
+++ b/i386/libsaio/load.c
@@ -427,3 +427,29 @@ static long DecodeSymbolTable(long cmdBase)
return 0;
}
+
+
+//==============================================================================
+// Public function (RevoBoot v1.5.30 and greater). Called from our ACPI patcher
+// which looks in /Extra/ACPI/ for [TableName].aml but it is also used in two
+// other places, being libsaio/efi.c and libsaio/SMBIOS/static_data.h This to
+// get static (binary) data from /Extra/[EFI/SMBIOS]/[FileName].bin
+
+long loadBinaryData(char *aFilePath, void **aMemoryAddress)
+{
+ long fileSize = LoadFile(aFilePath);
+
+ if (fileSize > 0)
+ {
+ *aMemoryAddress = (void *)malloc(fileSize);
+
+ if (aMemoryAddress)
+ {
+ memcpy(*aMemoryAddress, (void *)kLoadAddr, fileSize);
+
+ return fileSize;
+ }
+ }
+
+ return 0;
+}
diff --git a/i386/libsaio/platform.c b/i386/libsaio/platform.c
index 11af0fa..5de5caa 100644
--- a/i386/libsaio/platform.c
+++ b/i386/libsaio/platform.c
@@ -177,8 +177,14 @@ void initPlatform(int biosDevice)
gPlatform.MPS.Guid = (EFI_GUID) EFI_MPS_TABLE_GUID;
#endif // INCLUDE_MP_TABLE
- // Used in boot.c to verify the checksum (adler32) of a pre-linked kernel.
- gPlatform.ModelID = SMB_PRODUCT_NAME;
+ // Used in boot.c to verify the checksum (adler32) of pre-linked kernels.
+ gPlatform.ModelID = strdup(SMB_PRODUCT_NAME);
+
+#if LOAD_MODEL_SPECIFIC_STATIC_DATA
+ // Used in RevoBoot/i386/libsaio/ACPI/patcher.h, RevoBoot/i386/libsaio/efi.c
+ // and RevoBoot/i386/libsaio/SMBIOS/static_data.h
+ gPlatform.CommaLessModelID = removeChar(strdup(gPlatform.ModelID), ',');
+#endif
// Determine system type based on product name. Used in
// acpi/patcher.h to update FADT->Preferred_PM_Profile
@@ -276,5 +282,13 @@ void initPlatform(int biosDevice)
initKernelBootConfig();
+#if (LOAD_MODEL_SPECIFIC_EFI_DATA)
+ /*
+ * We need to call this much earlier in the boot process when static EFI data
+ * is read from: /Extra/EFI[MacModelNN.bin]. Otherwise LoadFile (load.c) fails.
+ */
+ initPartitionChain();
+#endif
+
initEFITree();
}
diff --git a/i386/libsaio/platform.h b/i386/libsaio/platform.h
index 9205b14..4a6a675 100644
--- a/i386/libsaio/platform.h
+++ b/i386/libsaio/platform.h
@@ -54,30 +54,38 @@
// Additional model selectors to select a specific target model.
//------------------------------------------------------------------------------
-#define IMAC_131 IMAC | (3 << 15)
-#define IMAC_111 IMAC | (2 << 15)
-#define IMAC_122 IMAC | (1 << 15)
-#define IMAC_121 IMAC // Defaults to iMac12,1
+#define IMAC_131 (IMAC | (4 << 15))
+#define IMAC_122 (IMAC | (3 << 15))
+#define IMAC_121 (IMAC | (2 << 15))
+#define IMAC_111 (IMAC | (1 << 15))
+#define IMAC_132 IMAC // Defaults to iMac13,2
+
+#define MACBOOK_41 MACBOOK // Defaults to MacBook,1
+
+#define MACBOOK_AIR_42 (MACBOOK_AIR | (1 << 15))
+#define MACBOOK_AIR_41 MACBOOK_AIR // Defaults to MacBookAir4,1
+
+#define MACBOOK_PRO_102 (MACBOOK_PRO | (6 << 15))
+#define MACBOOK_PRO_101 (MACBOOK_PRO | (5 << 15))
+#define MACBOOK_PRO_91 (MACBOOK_PRO | (4 << 15))
+#define MACBOOK_PRO_83 (MACBOOK_PRO | (3 << 15))
+#define MACBOOK_PRO_82 (MACBOOK_PRO | (2 << 15))
+#define MACBOOK_PRO_81 (MACBOOK_PRO | (1 << 15))
+#define MACBOOK_PRO_61 MACBOOK_PRO // Defaults to MacBookPro8,1
+
+#define MACMINI_62 (MACMINI | (4 << 15))
+#define MACMINI_61 (MACMINI | (3 << 15))
+#define MACMINI_53 (MACMINI | (2 << 15))
+#define MACMINI_52 (MACMINI | (1 << 15))
+#define MACMINI_51 MACMINI // Defaults to Macmini5,1
+
+#define MACPRO_51 (MACPRO | (2 << 15))
+#define MACPRO_41 (MACPRO | (1 << 15))
+#define MACPRO_31 MACPRO // Defaults to MacPro3,1
-#define MACBOOK_41 MACBOOK // Defaults to MacBook,1
-
-#define MACBOOK_AIR_42 MACBOOK_AIR | (1 << 15)
-#define MACBOOK_AIR_41 MACBOOK_AIR // Defaults to MacBookAir4,1
-
-#define MACBOOK_PRO_101 MACBOOK_PRO | (5 << 15)
-#define MACBOOK_PRO_91 MACBOOK_PRO | (4 << 15)
-#define MACBOOK_PRO_83 MACBOOK_PRO | (3 << 15)
-#define MACBOOK_PRO_82 MACBOOK_PRO | (2 << 15)
-#define MACBOOK_PRO_81 MACBOOK_PRO | (1 << 15)
-#define MACBOOK_PRO_61 MACBOOK_PRO // Defaults to MacBookPro8,1
-
-#define MACMINI_53 (MACMINI | (2 << 15))
-#define MACMINI_52 (MACMINI | (1 << 15))
-#define MACMINI_51 MACMINI // Defaults to Macmini5,1
+//------------------------------------------------------------------------------
-#define MACPRO_51 MACPRO | (2 << 15)
-#define MACPRO_41 MACPRO | (1 << 15)
-#define MACPRO_31 MACPRO // Defaults to MacPro3,1
+// #define LOAD_MODEL_SPECIFIC_STATIC_DATA (LOAD_MODEL_SPECIFIC_ACPI_DATA || LOAD_MODEL_SPECIFIC_EFI_DATA || LOAD_MODEL_SPECIFIC_SMBIOS_DATA)
#include "smbios/model_data.h"
@@ -143,7 +151,10 @@ typedef struct _PlatformInfo_t
// later updated in boot.c with the actual version info.
char * ModelID; // Initialized in platform.c and used in boot.c
-
+#if LOAD_MODEL_SPECIFIC_STATIC_DATA
+ char * CommaLessModelID; // Initialized in platform.c and used in i386/libsaio/ACPI/patcher.h,
+#endif // i386/libsaio/efi.c and i386/libsaio/SMBIOS/static_data.h
+
char * KextFileName; // Initialized and used in drivers.c
char * KextFileSpec; // Initialized and used in drivers.c
char * KextPlistSpec; // Initialized and used in drivers.c
@@ -297,7 +308,6 @@ typedef struct _PlatformInfo_t
} PlatformInfo_t;
-
//------------------------------------------------------------------------------
/* cpu/static_data.h & cpu/dynamic_data.h */
diff --git a/i386/libsaio/saio_internal.h b/i386/libsaio/saio_internal.h
index d4da384..1bc2fa0 100755
--- a/i386/libsaio/saio_internal.h
+++ b/i386/libsaio/saio_internal.h
@@ -20,6 +20,12 @@
* under the License.
*
* @APPLE_LICENSE_HEADER_END@
+ *
+ * Updates:
+ *
+ * - loadBinaryData(load.c) and toLowerCase(string.c) added (PikerAlpha, October 2012).
+ * - Tidied up (spaces -> tabs) (PikerAlpha, October 2012).
+ *
*/
#ifndef __LIBSAIO_SAIO_INTERNAL_H
@@ -28,71 +34,70 @@
#include "saio_types.h"
/* asm.s */
-extern void real_to_prot(void);
-extern void prot_to_real(void);
-extern void halt(void);
-extern void startMachKernel(unsigned int address, void *arg);
+extern void real_to_prot(void);
+extern void prot_to_real(void);
+extern void halt(void);
+extern void startMachKernel(unsigned int address, void *arg);
-// extern void loader(UInt32 code, UInt32 cmdptr);
/* bios.s */
-extern void bios(biosBuf_t *bb);
+extern void bios(biosBuf_t *bb);
-extern int bgetc(void);
-extern int biosread(int dev, int cyl, int head, int sec, int num);
-extern int ebiosread(int dev, unsigned long long sec, int count);
-extern int get_drive_info(int drive, struct driveInfo *dp);
-extern void putc(int ch);
-extern void putca(int ch, int attr, int repeat);
-extern int getc(void);
-extern int readKeyboardStatus(void);
+extern int bgetc(void);
+extern int biosread(int dev, int cyl, int head, int sec, int num);
+extern int ebiosread(int dev, unsigned long long sec, int count);
+extern int get_drive_info(int drive, struct driveInfo *dp);
+extern void putc(int ch);
+extern void putca(int ch, int attr, int repeat);
+extern int getc(void);
+extern int readKeyboardStatus(void);
extern unsigned int time18(void);
-extern void delay(int ms);
+extern void delay(int ms);
extern unsigned int get_diskinfo(int dev);
-extern int memsize(int i);
-extern void video_mode(int mode);
-extern void setCursorPosition(int x, int y, int page);
-extern void setCursorType(int type);
-extern void getCursorPositionAndType(int *x, int *y, int *type);
-extern void scollPage(int x1, int y1, int x2, int y2, int attr, int rows, int dir);
-extern void clearScreenRows(int y1, int y2);
-extern void setActiveDisplayPage( int page );
+extern int memsize(int i);
+extern void video_mode(int mode);
+extern void setCursorPosition(int x, int y, int page);
+extern void setCursorType(int type);
+extern void getCursorPositionAndType(int *x, int *y, int *type);
+extern void scollPage(int x1, int y1, int x2, int y2, int attr, int rows, int dir);
+extern void clearScreenRows(int y1, int y2);
+extern void setActiveDisplayPage(int page);
extern unsigned long getMemoryMap(struct MemoryRange * rangeArray, unsigned long maxRangeCount, unsigned long * conMemSizePtr, unsigned long * extMemSizePtr);
extern unsigned long getExtendedMemorySize();
extern unsigned long getConventionalMemorySize();
-extern void sleep(int n);
+extern void sleep(int n);
/* efi.c */
-extern void initEFITree(void);
-extern void updateEFITree(char *rootUUID);
-extern void finalizeEFITree(void);
+extern void initEFITree(void);
+extern void updateEFITree(char *rootUUID);
+extern void finalizeEFITree(void);
/* bootstruct.c */
-extern void initKernelBootConfig(void);
-extern void finalizeKernelBootConfig(void);
-extern void moveKernelBootArgs(void);
+extern void initKernelBootConfig(void);
+extern void finalizeKernelBootConfig(void);
+extern void moveKernelBootArgs(void);
/* cache.c */
-extern void CacheReset();
-extern void CacheInit(CICell ih, long blockSize);
-extern long CacheRead(CICell ih, char *buffer, long long offset, long length, long cache);
+extern void CacheReset();
+extern void CacheInit(CICell ih, long blockSize);
+extern long CacheRead(CICell ih, char *buffer, long long offset, long length, long cache);
/* console.c */
-extern bool gVerboseMode;
-extern bool gErrors;
-extern void putchar(int ch);
-extern int getchar(void);
-extern int printf(const char *format, ...);
-extern int error(const char *format, ...);
-extern int verbose(const char *format, ...);
-extern void stop(const char *format, ...);
+extern bool gVerboseMode;
+extern bool gErrors;
+extern void putchar(int ch);
+extern int getchar(void);
+extern int printf(const char *format, ...);
+extern int error(const char *format, ...);
+extern int verbose(const char *format, ...);
+extern void stop(const char *format, ...);
/* disk.c */
-extern int testBiosread( int biosdev, unsigned long long secno);
+extern int testBiosread(int biosdev, unsigned long long secno);
extern BVRef diskScanBootVolumes(int biosdev, int *count);
extern BVRef diskScanGPTBootVolumes(int biosdev, int *count);
extern void diskSeek(BVRef bvr, long long position);
@@ -100,94 +105,94 @@ extern int diskRead(BVRef bvr, long addr, long length);
extern bool hasBootEFI(BVRef bvr);
extern void initPartitionChain(void);
-extern BVRef getBVChainForBIOSDev(int biosdev);
-extern BVRef newFilteredBVChain(int minBIOSDev, int maxBIOSDev, unsigned int allowFlags, unsigned int denyFlags, int *count);
-extern int freeFilteredBVChain(const BVRef chain);
-extern int rawDiskRead(BVRef bvr, unsigned int secno, void *buffer, unsigned int len);
-extern int rawDiskWrite(BVRef bvr, unsigned int secno, void *buffer, unsigned int len);
-extern int readBootSector(int biosdev, unsigned int secno, void *buffer);
-extern void turnOffFloppy(void);
-extern int testFAT32EFIBootSector( int biosdev, unsigned int secno, void * buffer );
+extern BVRef getBVChainForBIOSDev(int biosdev);
+extern BVRef newFilteredBVChain(int minBIOSDev, int maxBIOSDev, unsigned int allowFlags, unsigned int denyFlags, int *count);
+extern int freeFilteredBVChain(const BVRef chain);
+extern int rawDiskRead(BVRef bvr, unsigned int secno, void *buffer, unsigned int len);
+extern int rawDiskWrite(BVRef bvr, unsigned int secno, void *buffer, unsigned int len);
+extern int readBootSector(int biosdev, unsigned int secno, void *buffer);
+extern void turnOffFloppy(void);
+extern int testFAT32EFIBootSector(int biosdev, unsigned int secno, void * buffer);
/* hfs_compare.c */
-extern int32_t FastUnicodeCompare(u_int16_t *uniStr1, u_int32_t len1, u_int16_t *uniStr2, u_int32_t len2, int byte_order);
-extern void utf_encodestr( const u_int16_t * ucsp, int ucslen, u_int8_t * utf8p, u_int32_t bufsize, int byte_order );
-extern void utf_decodestr(const u_int8_t *utf8p, u_int16_t *ucsp, u_int16_t *ucslen, u_int32_t bufsize, int byte_order );
+extern int32_t FastUnicodeCompare(u_int16_t *uniStr1, u_int32_t len1, u_int16_t *uniStr2, u_int32_t len2, int byte_order);
+extern void utf_encodestr(const u_int16_t * ucsp, int ucslen, u_int8_t * utf8p, u_int32_t bufsize, int byte_order);
+extern void utf_decodestr(const u_int8_t *utf8p, u_int16_t *ucsp, u_int16_t *ucslen, u_int32_t bufsize, int byte_order);
/* load.c */
-extern bool gLoadKernelDrivers;
-extern long ThinFatFile(void **binary, unsigned long *length);
-extern long DecodeMachO(void *binary, entry_t *rentry, char **raddr, int *rsize);
+extern bool gLoadKernelDrivers;
+extern long ThinFatFile(void **binary, unsigned long *length);
+extern long DecodeMachO(void *binary, entry_t *rentry, char **raddr, int *rsize);
+extern long loadBinaryData(char *aFilePath, void **aMemoryAddress);
/* memory.c */
-long AllocateKernelMemory( long inSize );
-long AllocateMemoryRange(char * rangeName, long start, long length, long type);
+long AllocateKernelMemory(long inSize);
+long AllocateMemoryRange(char * rangeName, long start, long length, long type);
/* platform.c */
-extern void enableA20(void);
+extern void enableA20(void);
/* stringTable.c */
-extern bool getValueForConfigTableKey(config_file_t *config, const char *key, const char **val, int *size);
-extern char * newStringForKey(char *key, config_file_t *configBuff);
-extern bool getValueForBootKey(const char *line, const char *match, const char **matchval, int *len);
-extern bool getValueForKey(const char *key, const char **val, int *size, config_file_t *configBuff);
-extern bool getBoolForKey(const char *key, bool *val, config_file_t *configBuff);
-extern bool getIntForKey(const char *key, int *val, config_file_t *configBuff);
-
-extern int loadConfigFile(const char *configFile, config_file_t *configBuff);
-
-extern int loadSystemConfig(config_file_t *configBuff);
-
-
-extern int loadHelperConfig(config_file_t *configBuff);
-extern int loadOverrideConfig(config_file_t *configBuff);
-
-extern char * newString(const char *oldString);
-extern char * getNextArg(char ** ptr, char * val);
-extern long ParseXMLFile( char * buffer, TagPtr * dict );
+extern bool getValueForConfigTableKey(config_file_t *config, const char *key, const char **val, int *size);
+extern char * newStringForKey(char *key, config_file_t *configBuff);
+extern bool getValueForBootKey(const char *line, const char *match, const char **matchval, int *len);
+extern bool getValueForKey(const char *key, const char **val, int *size, config_file_t *configBuff);
+extern bool getBoolForKey(const char *key, bool *val, config_file_t *configBuff);
+extern bool getIntForKey(const char *key, int *val, config_file_t *configBuff);
+extern int loadConfigFile(const char *configFile, config_file_t *configBuff);
+extern int loadSystemConfig(config_file_t *configBuff);
+extern int loadHelperConfig(config_file_t *configBuff);
+extern int loadOverrideConfig(config_file_t *configBuff);
+extern char * newString(const char *oldString);
+extern char * getNextArg(char ** ptr, char * val);
+extern long ParseXMLFile(char * buffer, TagPtr * dict);
/* sys.c */
-extern BVRef getBootVolumeRef( const char * path, const char ** outPath );
-extern long LoadVolumeFile(BVRef bvr, const char *fileSpec);
-extern long LoadFile(const char *fileSpec);
-extern long ReadFileAtOffset(const char * fileSpec, void *buffer, uint64_t offset, uint64_t length);
-extern long LoadThinFatFile(const char *fileSpec, void **binary);
-extern long GetDirEntry(const char *dirSpec, long *dirIndex, const char **name, long *flags, long *time);
-extern long GetFileInfo(const char *dirSpec, const char *name,long *flags, long *time);
-extern long GetFileBlock(const char *fileSpec, unsigned long long *firstBlock);
-extern long GetFSUUID(char *spec, char *uuidStr);
-extern long CreateUUIDString(uint8_t uubytes[], int nbytes, char *uuidStr);
-extern int openmem(char *buf, int len);
-extern int open(const char *str, int how);
-extern int close(int fdesc);
-extern int file_size(int fdesc);
-extern int read(int fdesc, char *buf, int count);
-extern int b_lseek(int fdesc, int addr, int ptr);
-extern int tell(int fdesc);
+extern BVRef getBootVolumeRef(const char * path, const char ** outPath);
+extern long LoadVolumeFile(BVRef bvr, const char *fileSpec);
+extern long LoadFile(const char *fileSpec);
+extern long ReadFileAtOffset(const char * fileSpec, void *buffer, uint64_t offset, uint64_t length);
+extern long LoadThinFatFile(const char *fileSpec, void **binary);
+extern long GetDirEntry(const char *dirSpec, long *dirIndex, const char **name, long *flags, long *time);
+extern long GetFileInfo(const char *dirSpec, const char *name,long *flags, long *time);
+extern long GetFileBlock(const char *fileSpec, unsigned long long *firstBlock);
+extern long GetFSUUID(char *spec, char *uuidStr);
+extern long CreateUUIDString(uint8_t uubytes[], int nbytes, char *uuidStr);
+extern int openmem(char *buf, int len);
+extern int open(const char *str, int how);
+extern int close(int fdesc);
+extern int file_size(int fdesc);
+extern int read(int fdesc, char *buf, int count);
+extern int b_lseek(int fdesc, int addr, int ptr);
+extern int tell(int fdesc);
extern const char * systemConfigDir(void);
-extern struct dirstuff * opendir(const char *path);
-extern struct dirstuff * vol_opendir(BVRef bvr, const char *path);
-extern int closedir(struct dirstuff *dirp);
-extern int readdir(struct dirstuff *dirp, const char **name, long *flags, long *time);
-extern int readdir_ext(struct dirstuff * dirp, const char ** name, long * flags, long * time, FinderInfo *finderInfo, long *infoValid);
-extern void flushdev(void);
-extern void scanBootVolumes(int biosdev, int *count);
+extern struct dirstuff * opendir(const char *path);
+extern struct dirstuff * vol_opendir(BVRef bvr, const char *path);
+extern int closedir(struct dirstuff *dirp);
+extern int readdir(struct dirstuff *dirp, const char **name, long *flags, long *time);
+extern int readdir_ext(struct dirstuff * dirp, const char ** name, long * flags, long * time, FinderInfo *finderInfo, long *infoValid);
+extern void flushdev(void);
+extern void scanBootVolumes(int biosdev, int *count);
-extern BVRef getBootVolume(BVRef chain, int targetDevice);
-extern BVRef getTargetRootVolume(char *rootUUID);
-extern BVRef selectBootVolume(BVRef chain);
+extern BVRef getBootVolume(BVRef chain, int targetDevice);
+extern BVRef getTargetRootVolume(char *rootUUID);
+extern BVRef selectBootVolume(BVRef chain);
-extern void getBootVolumeDescription(BVRef bvr, char *str, long strMaxLen, bool verbose);
+extern void getBootVolumeDescription(BVRef bvr, char *str, long strMaxLen, bool verbose);
// Function pointer to be filled in if ramdisks are available
-extern int (*p_get_ramdisk_info)(int biosdev, struct driveInfo *dip);
-extern int (*p_ramdiskReadBytes)( int biosdev, unsigned int blkno, unsigned int byteoff, unsigned int byteCount, void * buffer );
+extern int (*p_get_ramdisk_info)(int biosdev, struct driveInfo *dip);
+extern int (*p_ramdiskReadBytes)(int biosdev, unsigned int blkno, unsigned int byteoff, unsigned int byteCount, void * buffer);
+
+
+/* string.h */
+extern char * toLowerCase(char *aSourceString);
#endif /* !__LIBSAIO_SAIO_INTERNAL_H */
diff --git a/i386/libsaio/smbios.c b/i386/libsaio/smbios.c
index 4b9b051..deb8ae0 100755
--- a/i386/libsaio/smbios.c
+++ b/i386/libsaio/smbios.c
@@ -1,16 +1,21 @@
/*
* Copyright (c) 2009 by Master Chief.
- * Dynamic and static SMBIOS data gathering added by DHP in 2010.
- * Refactorized by DHP in 2011.
+ *
+ * Updates:
+ *
+ * - Dynamic and static SMBIOS data gathering added by DHP in 2010.
+ * - Refactorized by DHP in 2011.
+ * - Get static EFI data (optional) from /Extra/EFI/[MacModelNN].bin (PikerAlpha, October 2012).
+ * - Set newEPS->dmi.tableLength to fileSize when model specific data is loaded (PikerAlpha, November 2012).
+ * - Get number of table structures from loaded model specific SMBIOS data (PikerAlpha, November 2012).
+ * - Set newEPS->maxStructureSize when SET_MAX_STRUCTURE_LENGTH is set (PikerAlpha, November 2012).
+ * - Check/correct errors in RevoBoot/i386/config/SMBIOS/[data-template/MacModelNN].h (PikerAlpha, November 2012).
*/
#include "platform.h"
-#if USE_STATIC_SMBIOS_DATA
-
-#include "smbios/static_data.h"
-
+#if USE_STATIC_SMBIOS_DATA
//==============================================================================
void setupSMBIOS(void)
@@ -19,15 +24,13 @@ void setupSMBIOS(void)
// Allocate 1 page of kernel memory (sufficient for a stripped SMBIOS table).
void * kernelMemory = (void *)AllocateKernelMemory(4096);
-
+
// Setup a new Entry Point Structure at the beginning of the newly allocated memory page.
struct SMBEntryPoint * newEPS = (struct SMBEntryPoint *) kernelMemory;
- int tableLength = sizeof(SMBIOS_Table);
+ // Include additional/conditional code snippet.
+ #include "smbios/static_data.h"
- // Copy the static SMBIOS data into the newly allocated memory page. Right after the new EPS.
- memcpy((kernelMemory + sizeof(* newEPS)), SMBIOS_Table, tableLength);
-
newEPS->anchor[0] = 0x5f; // _
newEPS->anchor[1] = 0x53; // S
newEPS->anchor[2] = 0x4d; // M
@@ -36,7 +39,7 @@ void setupSMBIOS(void)
newEPS->entryPointLength = 0x1f; // sizeof(* newEPS)
newEPS->majorVersion = 2;
newEPS->minorVersion = 4;
- newEPS->maxStructureSize = STATIC_SMBIOS_SM_MAX_STRUCTURE_SIZE; // Defined in: config/smbios/data.h
+ newEPS->maxStructureSize = STATIC_SMBIOS_SM_MAX_STRUCTURE_SIZE; // Defined in RevoBoot/i386/config/SMBIOS/data-template.h
newEPS->entryPointRevision = 0;
newEPS->formattedArea[0] = 0;
@@ -51,27 +54,89 @@ void setupSMBIOS(void)
newEPS->dmi.anchor[3] = 0x49; // I
newEPS->dmi.anchor[4] = 0x5f; // _
newEPS->dmi.checksum = 0;
- newEPS->dmi.tableLength = tableLength;
+ newEPS->dmi.tableLength = tableLength;
newEPS->dmi.tableAddress = (uint32_t) (kernelMemory + sizeof(struct SMBEntryPoint));
- newEPS->dmi.structureCount = STATIC_SMBIOS_DMI_STRUCTURE_COUNT; // Defined in: config/smbios/data.h
newEPS->dmi.bcdRevision = 0x24;
-
+ newEPS->dmi.structureCount = STATIC_SMBIOS_DMI_STRUCTURE_COUNT; // Defined in RevoBoot/i386/config/SMBIOS/[data-template/MacModelNN].h
+
+ // Safety measure to protect people from doing something that breaks the boot process.
+ // #define FORCED_CHECK ((STATIC_SMBIOS_DMI_STRUCTURE_COUNT == 0) || (SET_MAX_STRUCTURE_LENGTH && (STATIC_SMBIOS_SM_MAX_STRUCTURE_SIZE == 0)))
+ #define FORCED_CHECK ((STATIC_SMBIOS_DMI_STRUCTURE_COUNT == 0) || SET_MAX_STRUCTURE_LENGTH)
+
+#if (LOAD_MODEL_SPECIFIC_SMBIOS_DATA || FORCED_CHECK)
+ /*
+ * Get number of SMBIOS table structures from the loaded model specific SMBIOS data, or
+ * when we have 0 values in: RevoBoot/i386/config/SMBIOS/[data-template/MacModelNN].bin
+ */
+ if ((fileSize > 0) || FORCED_CHECK)
+ {
+ UInt16 structureCount = 0;
+
+ char * structurePtr = (char *)newEPS->dmi.tableAddress;
+ char * structureEnd = (structurePtr + newEPS->dmi.tableLength);
+
+ while (structureEnd > (structurePtr + sizeof(SMBStructHeader)))
+ {
+ struct SMBStructHeader * header = (struct SMBStructHeader *) structurePtr;
+
+#if SET_MAX_STRUCTURE_LENGTH
+ char * stringsPtr = structurePtr;
+ #if DEBUG_SMBIOS
+ SMBByte currentStructureType = header->type;
+ #endif
+#endif
+ // Skip the formatted area of the structure.
+ structurePtr += header->length;
+
+ /*
+ * Skip the unformatted structure area at the end (strings).
+ * Using word comparison instead of checking two bytes (thanks to Kabyl).
+ */
+ for (; ((uint16_t *)structurePtr)[0] != 0; structurePtr++);
+
+ // Adjust pointer after locating the double 0 terminator.
+ structurePtr += 2;
+
+ // Update structure counter.
+ structureCount++;
+
+ _SMBIOS_DEBUG_DUMP("structureCount: %d\n", structureCount);
+
+#if SET_MAX_STRUCTURE_LENGTH
+ UInt16 maxStructureSize = (structurePtr - stringsPtr);
+
+ if (newEPS->maxStructureSize < maxStructureSize)
+ {
+ newEPS->maxStructureSize = maxStructureSize;
+ }
+
+ _SMBIOS_DEBUG_DUMP("Structure (%d) length: %3d bytes.\n", currentStructureType, maxStructureSize);
+ _SMBIOS_DEBUG_SLEEP(1);
+#endif // #if SET_MAX_STRUCTURE_LENGTH
+ }
+ // Uodate number of structures (boot hang without the correct value).
+ newEPS->dmi.structureCount = structureCount;
+ }
+#endif // #if (LOAD_MODEL_SPECIFIC_SMBIOS_DATA || FORCED_CHECK)
+ /*
+ * newEPS->dmi.tableLength represents the length of the static data, or the size
+ * of the model specific SMBIOS data file from: /Extra/SMBIOS/MacModelNN.bin
+ */
+ _SMBIOS_DEBUG_DUMP("newEPS->dmi.structureCount: %d\nnewEPS.dmi.tableLength: %d\n", newEPS->dmi.structureCount, newEPS->dmi.tableLength);
+
// Take care of possible checksum errors
newEPS->dmi.checksum = 256 - checksum8(&newEPS->dmi, sizeof(newEPS->dmi));
newEPS->checksum = 256 - checksum8(newEPS, sizeof(* newEPS));
- _SMBIOS_DEBUG_DUMP("newEPS->dmi.structureCount: %d - tableLength: %d\n", newEPS->dmi.structureCount, newEPS->dmi.tableLength);
-
- // Used to update the EFI Configuration Table (in efi.c) which is
+ // Used to update the EFI Configuration Table (in efi.c) which is
// what AppleSMBIOS.kext reads to setup the SMBIOS table for OS X.
gPlatform.SMBIOS.BaseAddress = (uint32_t) newEPS;
_SMBIOS_DEBUG_DUMP("New SMBIOS replacement setup.\n");
_SMBIOS_DEBUG_SLEEP(5);
}
-
-#else
+#else // #if USE_STATIC_SMBIOS_DATA
#include "smbios/dynamic_data.h"
-#endif
\ No newline at end of file
+#endif // #if USE_STATIC_SMBIOS_DATA
diff --git a/i386/libsaio/smbios/dynamic_data.h b/i386/libsaio/smbios/dynamic_data.h
index 99f62fe..9f9bff6 100755
--- a/i386/libsaio/smbios/dynamic_data.h
+++ b/i386/libsaio/smbios/dynamic_data.h
@@ -11,6 +11,11 @@
* - SMBIOS data logic moved to preprocessor code (PikerAlpha, October 2012).
* - SMBProperties changed for speed and simplicity (PikerAlpha, October 2012).
* - Calls with SMBProperties.keyString cleaned up (PikerAlpha, October 2012).
+ * - Fixed requiredStructures.start/stop values (PikerAlpha, October 2012).
+ * - STATIC_SMSERIALNUMBER renamed to SMB_SYSTEM_SERIAL_NUMBER (PikerAlpha, October 2012).
+ * - Removed some unused experimental code snippets (PikerAlpha, November 2012).
+ * - Option SET_MAX_STRUCTURE_LENGTH to verify/fix newEPS->maxStructureSize (PikerAlpha, November 2012).
+ * - Allow DEBUG_SMBIOS = 2 to filter out some of the output (PikerAlpha, November 2012).
*
* Credits:
* - Kabyl (see notes in source code)
@@ -19,7 +24,7 @@
* Tip: The idea is to use dynamic SMBIOS generation in RevoBoot only to
* let it strip your factory table, after which you should do this:
*
- * 1.) Extract the new OS X compatible SMBIOS table with: tools/smbios2struct
+ * 1.) Extract the new OS X compatible SMBIOS table with: tools/smbios2struct3
* 2.) Add the data structure to: RevoBoot/i386/config/SMBIOS/data.h
* 3.) Recompile RevoBoot, and be happy with your quicker boot time.
*
@@ -36,6 +41,18 @@
#include "smbios.h"
#include "model_data.h"
+#if (TARGET_MODEL & MACPRO)
+ /*
+ * Number of additional properties for MacPro models.
+ */
+ #define PROBOARD 2
+#else
+ /*
+ * No additional properties for other Mac models.
+ */
+ #define PROBOARD 0
+#endif
+
//------------------------------------------------------------------------------
struct SMBStructure
@@ -52,24 +69,24 @@ struct SMBStructure
struct SMBStructure requiredStructures[] =
{
- { kSMBTypeBIOSInformation /* 0 */ , 0, 5, false, 0 },
- { kSMBTypeSystemInformation /* 1 */ , 6, 10, false, 0 },
- { kSMBTypeBaseBoard /* 2 */ , 11, 12, false, 0 },
- { kSMBUnused /* 3 */ , 0, 0, false, 0 },
- { kSMBTypeProcessorInformation /* 4 */ , 13, 14, true, 0 },
- { kSMBUnused /* 5 */ , 0, 0, false, 0 },
- { kSMBUnused /* 6 */ , 0, 0, false, 0 },
- { kSMBUnused /* 7 */ , 0, 0, false, 0 },
- { kSMBUnused /* 8 */ , 0, 0, false, 0 },
- { kSMBUnused /* 9 */ , 0, 0, false, 0 },
- { kSMBUnused /* 10 */ , 0, 0, false, 0 },
- { kSMBUnused /* 11 */ , 0, 0, false, 0 },
- { kSMBUnused /* 12 */ , 0, 0, false, 0 },
- { kSMBUnused /* 13 */ , 0, 0, false, 0 },
- { kSMBUnused /* 14 */ , 0, 0, false, 0 },
- { kSMBUnused /* 15 */ , 0, 0, false, 0 },
- { kSMBUnused /* 16 */ , 0, 0, false, 0 },
- { kSMBTypeMemoryDevice /* 17 */ , 15, 19, true, 0 }
+ { kSMBTypeBIOSInformation /* 0 */ , 0, 5, false, 0 },
+ { kSMBTypeSystemInformation /* 1 */ , 6, 10, false, 0 },
+ { kSMBTypeBaseBoard /* 2 */ , (11 + PROBOARD), (12 + PROBOARD), false, 0 },
+ { kSMBUnused /* 3 */ , 0, 0, false, 0 },
+ { kSMBTypeProcessorInformation /* 4 */ , (13 + PROBOARD), (14 + PROBOARD), true, 0 },
+ { kSMBUnused /* 5 */ , 0, 0, false, 0 },
+ { kSMBUnused /* 6 */ , 0, 0, false, 0 },
+ { kSMBUnused /* 7 */ , 0, 0, false, 0 },
+ { kSMBUnused /* 8 */ , 0, 0, false, 0 },
+ { kSMBUnused /* 9 */ , 0, 0, false, 0 },
+ { kSMBUnused /* 10 */ , 0, 0, false, 0 },
+ { kSMBUnused /* 11 */ , 0, 0, false, 0 },
+ { kSMBUnused /* 12 */ , 0, 0, false, 0 },
+ { kSMBUnused /* 13 */ , 0, 0, false, 0 },
+ { kSMBUnused /* 14 */ , 0, 0, false, 0 },
+ { kSMBUnused /* 15 */ , 0, 0, false, 0 },
+ { kSMBUnused /* 16 */ , 0, 0, false, 0 },
+ { kSMBTypeMemoryDevice /* 17 */ , (15 + PROBOARD), (19 + PROBOARD), true, 0 }
};
@@ -103,59 +120,63 @@ struct SMBProperty
};
#define APPLE_INC "Apple Inc."
-#define SMB_SYSTEM_VERSION "1.0"
//------------------------------------------------------------------------------
struct SMBProperty SMBProperties[] =
{
- //------------------------------------------------------------------------------------------------
-
- { kSMBTypeBIOSInformation, 0x04, kSMBString, .plainData = APPLE_INC },
- { kSMBTypeBIOSInformation, 0x05, kSMBString, .plainData = SMB_BIOS_VERSION },
- { kSMBTypeBIOSInformation, 0x06, kSMBWord, .getSMBWord = getBIOSLocation },
- { kSMBTypeBIOSInformation, 0x08, kSMBString, .getSMBString = getBIOSDate },
- { kSMBTypeBIOSInformation, 0x0a, kSMBQWord, .getSMBQWord = getBIOSFeatures },
- { kSMBTypeBIOSInformation, 0x12, kSMBDWord, .getSMBDWord = getBIOSFeaturesEX },
-
- //------------------------------------------------------------------------------------------------
+ //----------------------------------------------------------------------------------------------------
- { kSMBTypeSystemInformation, 0x04, kSMBString, .plainData = APPLE_INC },
- { kSMBTypeSystemInformation, 0x05, kSMBString, .plainData = SMB_PRODUCT_NAME },
- { kSMBTypeSystemInformation, 0x06, kSMBString, .plainData = SMB_SYSTEM_VERSION },
- { kSMBTypeSystemInformation, 0x07, kSMBString, .plainData = STATIC_SMSERIALNUMBER },
- { kSMBTypeSystemInformation, 0x1a, kSMBString, .plainData = SMB_FAMILY },
+ { kSMBTypeBIOSInformation, 0x04, kSMBString, .plainData = APPLE_INC },
+ { kSMBTypeBIOSInformation, 0x05, kSMBString, .plainData = SMB_BIOS_VERSION },
+ { kSMBTypeBIOSInformation, 0x06, kSMBWord, .getSMBWord = getBIOSLocation },
+ { kSMBTypeBIOSInformation, 0x08, kSMBString, .getSMBString = getBIOSDate },
+ { kSMBTypeBIOSInformation, 0x0a, kSMBQWord, .getSMBQWord = getBIOSFeatures },
+ { kSMBTypeBIOSInformation, 0x12, kSMBDWord, .getSMBDWord = getBIOSFeaturesEX },
+
+ //----------------------------------------------------------------------------------------------------
- //------------------------------------------------------------------------------------------------
+ { kSMBTypeSystemInformation, 0x04, kSMBString, .plainData = APPLE_INC },
+ { kSMBTypeSystemInformation, 0x05, kSMBString, .plainData = SMB_PRODUCT_NAME },
+ { kSMBTypeSystemInformation, 0x06, kSMBString, .plainData = "1.0" },
+ { kSMBTypeSystemInformation, 0x07, kSMBString, .plainData = SMB_SYSTEM_SERIAL_NUMBER },
+ { kSMBTypeSystemInformation, 0x1a, kSMBString, .plainData = SMB_FAMILY },
- { kSMBTypeBaseBoard, 0x04, kSMBString, .plainData = APPLE_INC },
- { kSMBTypeBaseBoard, 0x05, kSMBString, .plainData = SMB_BOARD_PRODUCT },
+ //----------------------------------------------------------------------------------------------------
- //------------------------------------------------------------------------------------------------
+ { kSMBTypeBaseBoard, 0x04, kSMBString, .plainData = APPLE_INC },
+ { kSMBTypeBaseBoard, 0x05, kSMBString, .plainData = SMB_BOARD_PRODUCT },
+
+#if (TARGET_MODEL & MACPRO)
+ { kSMBTypeBaseBoard, 0x07, kSMBString, .plainData = SMB_BOARD_SERIAL_NUMBER },
+ { kSMBTypeBaseBoard, 0x0d, kSMBByte, .getSMBByte = getBoardType },
+#endif
+
+ //----------------------------------------------------------------------------------------------------
- { kSMBTypeProcessorInformation, 0x12, kSMBWord, .getSMBWord = getFSBFrequency },
- { kSMBTypeProcessorInformation, 0x14, kSMBWord, .getSMBWord = getCPUFrequency },
+ { kSMBTypeProcessorInformation, 0x12, kSMBWord, .getSMBWord = getFSBFrequency },
+ { kSMBTypeProcessorInformation, 0x14, kSMBWord, .getSMBWord = getCPUFrequency },
- //------------------------------------------------------------------------------------------------
+ //----------------------------------------------------------------------------------------------------
#if DYNAMIC_RAM_OVERRIDE_SIZE
- { kSMBTypeMemoryDevice, 0x0c, kSMBWord, .getSMBWord = getRAMSize },
+ { kSMBTypeMemoryDevice, 0x0c, kSMBWord, .getSMBWord = getRAMSize },
#endif
- { kSMBTypeMemoryDevice, 0x10, kSMBString, .getSMBString = NULL },
- { kSMBTypeMemoryDevice, 0x11, kSMBString, .getSMBString = NULL },
+ { kSMBTypeMemoryDevice, 0x10, kSMBString, .getSMBString = NULL },
+ { kSMBTypeMemoryDevice, 0x11, kSMBString, .getSMBString = NULL },
#if DYNAMIC_RAM_OVERRIDE_TYPE
- { kSMBTypeMemoryDevice, 0x12, kSMBByte, .getSMBByte = getRAMType },
+ { kSMBTypeMemoryDevice, 0x12, kSMBByte, .getSMBByte = getRAMType },
#endif
#if DYNAMIC_RAM_OVERRIDE_FREQUENCY
- { kSMBTypeMemoryDevice, 0x15, kSMBWord, .getSMBWord = getRAMFrequency },
+ { kSMBTypeMemoryDevice, 0x15, kSMBWord, .getSMBWord = getRAMFrequency },
#endif
- { kSMBTypeMemoryDevice, 0x17, kSMBString, .getSMBString = getRAMVendor },
- { kSMBTypeMemoryDevice, 0x18, kSMBString, .getSMBString = getRAMSerialNumber },
- { kSMBTypeMemoryDevice, 0x1a, kSMBString, .getSMBString = getRAMPartNumber },
+ { kSMBTypeMemoryDevice, 0x17, kSMBString, .getSMBString = getRAMVendor },
+ { kSMBTypeMemoryDevice, 0x18, kSMBString, .getSMBString = getRAMSerialNumber },
+ { kSMBTypeMemoryDevice, 0x1a, kSMBString, .getSMBString = getRAMPartNumber },
};
@@ -185,15 +206,15 @@ void setupSMBIOS(void)
// Clear the first K bytes (new table will be even shorter).
bzero(kernelMemory, 1024);
- newEPS->anchor[0] = 0x5f; // _
- newEPS->anchor[1] = 0x53; // S
- newEPS->anchor[2] = 0x4d; // M
- newEPS->anchor[3] = 0x5f; // _
- newEPS->checksum = 0; // Updated at the end of this run.
- newEPS->entryPointLength = 0x1f; // sizeof(* newEPS)
- newEPS->majorVersion = 2; // SMBIOS version 2.4
+ newEPS->anchor[0] = 0x5f; // _
+ newEPS->anchor[1] = 0x53; // S
+ newEPS->anchor[2] = 0x4d; // M
+ newEPS->anchor[3] = 0x5f; // _
+ newEPS->checksum = 0; // Updated at the end of this run.
+ newEPS->entryPointLength = 0x1f; // sizeof(* newEPS)
+ newEPS->majorVersion = 2; // SMBIOS version 2.4
newEPS->minorVersion = 4;
- newEPS->maxStructureSize = 0; // Updated during this run.
+ newEPS->maxStructureSize = factoryEPS->maxStructureSize; // Optionally checked and updated later on.
newEPS->entryPointRevision = 0;
newEPS->formattedArea[0] = 0;
@@ -202,25 +223,23 @@ void setupSMBIOS(void)
newEPS->formattedArea[3] = 0;
newEPS->formattedArea[4] = 0;
- newEPS->dmi.anchor[0] = 0x5f; // _
- newEPS->dmi.anchor[1] = 0x44; // D
- newEPS->dmi.anchor[2] = 0x4d; // M
- newEPS->dmi.anchor[3] = 0x49; // I
- newEPS->dmi.anchor[4] = 0x5f; // _
- newEPS->dmi.checksum = 0; // Updated at the end of this run.
- newEPS->dmi.tableLength = 0; // Updated at the end of this run.
+ newEPS->dmi.anchor[0] = 0x5f; // _
+ newEPS->dmi.anchor[1] = 0x44; // D
+ newEPS->dmi.anchor[2] = 0x4d; // M
+ newEPS->dmi.anchor[3] = 0x49; // I
+ newEPS->dmi.anchor[4] = 0x5f; // _
+ newEPS->dmi.checksum = 0; // Updated at the end of this run.
+ newEPS->dmi.tableLength = 0; // Updated at the end of this run.
newEPS->dmi.tableAddress = (uint32_t) (kernelMemory + sizeof(struct SMBEntryPoint));
- newEPS->dmi.structureCount = 0; // Updated during this run.
- newEPS->dmi.bcdRevision = 0x24; // SMBIOS version 2.4
+ newEPS->dmi.structureCount = 0; // Updated during this run.
+ newEPS->dmi.bcdRevision = 0x24; // SMBIOS version 2.4
char * stringsPtr = NULL;
char * newtablesPtr = (char *)newEPS->dmi.tableAddress;
char * structurePtr = (char *)factoryEPS->dmi.tableAddress;
- char * structureStartPtr = NULL;
- int i, j;
- int numberOfStrings = 0;
- int structureCount = factoryEPS->dmi.structureCount;
+ int i, j, numberOfStrings = 0;
+ int structureCount = factoryEPS->dmi.structureCount;
SMBWord handle = 1;
@@ -261,7 +280,7 @@ void setupSMBIOS(void)
newtablesPtr += 8;
}
-#if DYNAMIC_RAM_OVERRIDE_SIZE || DYNAMIC_RAM_OVERRIDE_TYPE || DYNAMIC_RAM_OVERRIDE_FREQUENCY
+#if (DYNAMIC_RAM_OVERRIDE_SIZE || DYNAMIC_RAM_OVERRIDE_TYPE || DYNAMIC_RAM_OVERRIDE_FREQUENCY)
requiredStructures[17].stop = (sizeof(SMBProperties) / sizeof(SMBProperties[0])) -1;
#endif
@@ -287,13 +306,13 @@ void setupSMBIOS(void)
// Adjust pointer after locating the double 0 terminator.
structurePtr += 2;
-#if DEBUG_SMBIOS
- // printf("currentStructureType: %d (length: %d)\n", currentStructureType, factoryHeader->length);
- // sleep(1); // Silent sleep (for debug only).
+#if (DEBUG_SMBIOS & 2)
+ _SMBIOS_DEBUG_DUMP("currentStructureType: %d (length: %d)\n", currentStructureType, factoryHeader->length);
+ _SMBIOS_DEBUG_SLEEP(1);
#endif
continue;
}
-
+
newHeader = (struct SMBStructHeader *) newtablesPtr;
// Copy structure data from factory table to new table (not the strings).
@@ -305,8 +324,6 @@ void setupSMBIOS(void)
// Update structure counter.
newEPS->dmi.structureCount++;
- structureStartPtr = newtablesPtr;
-
// Update pointers (pointing to the end of the formatted area).
structurePtr += factoryHeader->length;
stringsPtr = structurePtr;
@@ -334,7 +351,30 @@ void setupSMBIOS(void)
}
structurePtr += 2;
-
+
+#if SET_MAX_STRUCTURE_LENGTH
+ /*
+ * Size of the longest factory SMBIOS structure, in bytes, encompasses the structure’s formatted area
+ * and text strings. In our case a kSMBTypeProcessorInformation structure, because we strip out all
+ * unwanted data. And safe to check it at this point, because we don't add anything this long ourself.
+ *
+ * Note: The maximum structure length is only checked when SET_MAX_STRUCTURE_LENGTH is set to 1 but
+ * is not required, because it is only available since RevoBoot v1.5.35. Never checked before.
+ */
+
+ UInt16 maxStructureSize = (structurePtr - (stringsPtr - factoryHeader->length));
+
+ if (newEPS->maxStructureSize < maxStructureSize)
+ {
+ newEPS->maxStructureSize = maxStructureSize;
+ }
+
+ #if (DEBUG_SMBIOS & 2)
+ _SMBIOS_DEBUG_DUMP("Structure (%d) length: %3d bytes.\n", currentStructureType, maxStructureSize);
+ _SMBIOS_DEBUG_SLEEP(1);
+ #endif
+#endif // if SET_MAX_STRUCTURE_LENGTH
+
// Do we need to copy the string data?
if (requiredStructures[currentStructureType].copyStrings)
{
@@ -346,23 +386,6 @@ void setupSMBIOS(void)
// Point to the next possible position for a string (deducting the second 0 char at the end).
newtablesPtr += stringDataLength;
-
- /* ----------------------------------------------------------------------
- // Start of experimental code.
-
- if (currentStructureType == kSMBTypeProcessorInformation)
- {
- int c = 0;
-
- for (; c < 3; c++)
- {
- memcpy(newtablesPtr + 1, structureStartPtr, factoryHeader->length + stringDataLength + 2);
- newtablesPtr += factoryHeader->length + stringDataLength + 2;
- }
- }
-
- //----------------------------------------------------------------------
- // End of experimental code. */
}
else
{
@@ -385,7 +408,7 @@ void setupSMBIOS(void)
{
const char * str = "";
-#if DEBUG_SMBIOS
+#if (DEBUG_SMBIOS & 2)
if (SMBProperties[j].type != currentStructureType)
{
printf("SMBIOS Patcher Error: Turbo Index [%d != %d] Mismatch!\n", SMBProperties[j].type, currentStructureType);
@@ -480,4 +503,3 @@ void setupSMBIOS(void)
#endif /* !__LIBSAIO_SMBIOS_PATCHER_H */
-
diff --git a/i386/libsaio/smbios/essentials.h b/i386/libsaio/smbios/essentials.h
index dc2ad54..9b4a970 100755
--- a/i386/libsaio/smbios/essentials.h
+++ b/i386/libsaio/smbios/essentials.h
@@ -58,4 +58,11 @@ struct SMBEntryPoint
struct DMIEntryPoint dmi;
} __attribute__((packed));
-#endif /* !__LIBSAIO_SMBIOS_ESSENTIALS_H */
\ No newline at end of file
+typedef struct SMBStructHeader
+{
+ SMBByte type;
+ SMBByte length;
+ SMBWord handle;
+} __attribute__((packed)) SMBStructHeader;
+
+#endif /* !__LIBSAIO_SMBIOS_ESSENTIALS_H */
diff --git a/i386/libsaio/smbios/getters.h b/i386/libsaio/smbios/getters.h
index 9c9b100..54aade3 100755
--- a/i386/libsaio/smbios/getters.h
+++ b/i386/libsaio/smbios/getters.h
@@ -346,3 +346,12 @@ static SMBDWord getBIOSFeaturesEX(void)
{
return (0x010002c1);
}
+
+//==============================================================================
+
+#if TARGET_MODEL & MACPRO
+static SMBByte getBoardType(void)
+{
+ return 0x0b; // Some logic here or just return 11/0x0b.
+}
+#endif
diff --git a/i386/libsaio/smbios/model_data.h b/i386/libsaio/smbios/model_data.h
index bf1ce85..bd8cc19 100644
--- a/i386/libsaio/smbios/model_data.h
+++ b/i386/libsaio/smbios/model_data.h
@@ -20,6 +20,7 @@
* - EFI/SMBIOS data logic moved to preprocessor code (PikerAlpha, October 2012).
* - SMB_PRODUCT_NAME renamed/moved over from settings.h (PikerAlpha, October 2012).
* - EFI_MODEL_NAME renamed/moved over from settings.h (PikerAlpha, October 2012).
+ * - Data for new MacBookPro and Macmini added (PikerAlpha, October 2012).
*
* Credits:
* - blackosx, DB1, dgsga, FKA, humph, scrax and STLVNUB (testers).
@@ -95,14 +96,20 @@
// -------------------------------------------------------------------------------------
#define SMB_FAMILY "MacBookPro"
- #if (TARGET_MODEL == MACBOOK_PRO_101)
- // Intel Core i7-3720QM @ 2.60 GHz - 4 cores / 8 threads.
+ #if (TARGET_MODEL == MACBOOK_PRO_102)
+ // Intel Core i7-3520QM @ 2.90 GHz - 2 cores / 4 threads.
+ #define SMB_BIOS_VERSION "MBP102.88Z.00FE.B00.1207181057"
+ #define SMB_PRODUCT_NAME "MacBookPro10,2"
+ #define SMB_BOARD_PRODUCT "Mac-AFD8A9D944EA4843"
+ #define EFI_MODEL_NAME { 'M', 'a', 'c', 'B', 'o', 'o', 'k', 'P', 'r', 'o', '1', '0', ',', '2' }
+ #elif (TARGET_MODEL == MACBOOK_PRO_101)
+ // Intel Core i7-3720QM @ 2.60 GHz - 4 cores / 8 threads.
#define SMB_BIOS_VERSION "MBP101.88Z.00EE.B00.1205101839"
#define SMB_PRODUCT_NAME "MacBookPro10,1"
#define SMB_BOARD_PRODUCT "Mac-C3EC7CD22292981F"
#define EFI_MODEL_NAME { 'M', 'a', 'c', 'B', 'o', 'o', 'k', 'P', 'r', 'o', '1', '0', ',', '1' }
#elif (TARGET_MODEL == MACBOOK_PRO_91)
- // Intel Core i7-3820QM @ 2.70 GHz - 4 cores / 8 threads.
+ // Intel Core i7-3820QM @ 2.70 GHz - 4 cores / 8 threads.
#define SMB_BIOS_VERSION "MBP91.88Z.00D3.B00.1203211536"
#define SMB_PRODUCT_NAME "MacBookPro9,1"
#define SMB_BOARD_PRODUCT "Mac-4B7AC7E43945597E"
@@ -136,7 +143,19 @@
// -------------------------------------------------------------------------------------
#define SMB_FAMILY "Macmini"
- #if (TARGET_MODEL == MACMINI_53)
+ #if (TARGET_MODEL == MACMINI_62)
+ // Intel Core i7-3615QM @ 2.30 GHz (4 cores - 8 threads)
+ #define SMB_BIOS_VERSION "MM61.88Z.0106.B00.1208091121"
+ #define SMB_PRODUCT_NAME "Macmini6,2"
+ #define SMB_BOARD_PRODUCT "Mac-F65AE981FFA204ED"
+ #define EFI_MODEL_NAME { 'M', 'a', 'c', 'm', 'i', 'n', 'i', '6', ',', '2' }
+ #elif (TARGET_MODEL == MACMINI_61)
+ // Intel Core i5-3210M @ 2.50 GH (2 cores - 4 theeads)
+ #define SMB_BIOS_VERSION "MM61.88Z.0106.B00.1208091121"
+ #define SMB_PRODUCT_NAME "Macmini6,1"
+ #define SMB_BOARD_PRODUCT "Mac-031AEE4D24BFF0B1"
+ #define EFI_MODEL_NAME { 'M', 'a', 'c', 'm', 'i', 'n', 'i', '6', ',', '1' }
+ #elif (TARGET_MODEL == MACMINI_53)
// Intel Core i7-2635QM @ 2.0GHz (4 cores - 8 threads)
#define SMB_BIOS_VERSION "MM51.88Z.0077.B10.1201241549"
#define SMB_PRODUCT_NAME "Macmini5,3"
diff --git a/i386/libsaio/smbios/static_data.h b/i386/libsaio/smbios/static_data.h
index 5cf2938..dc4f429 100755
--- a/i386/libsaio/smbios/static_data.h
+++ b/i386/libsaio/smbios/static_data.h
@@ -3,6 +3,9 @@
*
* Updates:
* - Dynamic and static SMBIOS data gathering added by DHP in 2010.
+ * - New path for static EFI data (PikerAlpha, October 2012).
+ * - Optionally check /Extra/SMBIOS/[MacModelNN.bin] for static SMBIOS data (PikerAlpha, October 2012).
+ * - Get maxStructureSize/structureCount from factory EPS (PikerAlpha, October 2012).
*
* Credits:
* - blackosx, DB1, dgsga, FKA, humph, scrax and STLVNUB (testers).
@@ -11,14 +14,65 @@
#ifndef __LIBSAIO_SMBIOS_STATIC_DATA_H
#define __LIBSAIO_SMBIOS_STATIC_DATA_H
-#include "essentials.h"
+ #include "essentials.h"
-#define INCLUDE_SMBIOS_DATA 1
-#include "../../config/data.h"
+ int tableLength = 0;
+ long fileSize = 0;
-static uint32_t SMBIOS_Table[] =
-{
- STATIC_SMBIOS_DATA // Will get replaced with the data from: config/smbios/data.h
-};
+ #if LOAD_MODEL_SPECIFIC_SMBIOS_DATA
+ char dirSpec[32] = "";
+ void * staticSMBIOSData = (void *)kLoadAddr;
+
+ sprintf(dirSpec, "/Extra/SMBIOS/%s.bin", COMMA_STRIPPED_MODEL_ID);
+
+ _SMBIOS_DEBUG_DUMP("Loading: %s", dirSpec);
+
+ fileSize = loadBinaryData(dirSpec, &staticSMBIOSData);
+
+ if (fileSize > 0)
+ {
+ memcpy((kernelMemory + sizeof(* newEPS)), staticSMBIOSData, fileSize);
+
+ // factoryEPS = (struct SMBEntryPoint *) baseAddress;
+
+ tableLength = fileSize;
+
+ _SMBIOS_DEBUG_DUMP("\n");
+ }
+ else // File not found. Use static data defined in RevoBoot/i386/config/SMBIOS/
+ {
+ // The STRING (macro) is defined in RevoBoot/i386/config/settings.h
+ #include STRING(SMBIOS_DATA_FILE)
+
+ static uint32_t SMBIOS_Table[] =
+ {
+ // Replaced with data from: RevoBoot/i386/config/SMBIOS/[data-template/MacModelNN].h
+ STATIC_SMBIOS_DATA
+ };
+
+ tableLength = sizeof(SMBIOS_Table);
+
+ _SMBIOS_DEBUG_DUMP("Error: File not found!\nNow trying statically linked SMBIOS data: %d bytes\n", tableLength);
+
+ // Copy the static SMBIOS data into the newly allocated memory page. Right after the new EPS.
+ memcpy((kernelMemory + sizeof(* newEPS)), SMBIOS_Table, tableLength);
+ }
+ #else
+ // The STRING (macro) is defined in RevoBoot/i386/config/settings.h
+ #include STRING(SMBIOS_DATA_FILE)
+
+ static uint32_t SMBIOS_Table[] =
+ {
+ // Replaced with data from: RevoBoot/i386/config/SMBIOS/[data-template/MacModelNN].h
+ STATIC_SMBIOS_DATA
+ };
+
+ _SMBIOS_DEBUG_DUMP("Using statically linked SMBIOS data\n");
+
+ tableLength = sizeof(SMBIOS_Table);
+
+ // Copy the static SMBIOS data into the newly allocated memory page. Right after the new EPS.
+ memcpy((kernelMemory + sizeof(* newEPS)), SMBIOS_Table, tableLength);
+ #endif /* LOAD_MODEL_SPECIFIC_SMBIOS_DATA */
#endif /* !__LIBSAIO_SMBIOS_STATIC_DATA_H */
diff --git a/i386/libsaio/smbios/tools/smbios2struct3.c b/i386/libsaio/smbios/tools/smbios2struct3.c
index 85fc38c..297be55 100755
--- a/i386/libsaio/smbios/tools/smbios2struct3.c
+++ b/i386/libsaio/smbios/tools/smbios2struct3.c
@@ -1,26 +1,35 @@
-/***
- *
- * Name : smbios2struct3 (pipe output to file)
- * Version : 1.0.5
- * Type : Command line tool
- * Description : SMBIOS extractor / converter (resulting in a smaller and more Apple like table).
- *
- * Copyright : DutchHockeyPro (c) 2011
- *
- * Compile with: cc -I . smbios2struct3.c -o smbios2struct3 -Wall -framework IOKit -framework CoreFoundation
- *
- */
+/*
+ *
+ * Name : smbios2struct4
+ * Version : 1.1.1
+ * Type : Command line tool
+ * Copyright : Sam aka RevoGirl (c) 2011
+ * Description : SMBIOS extractor / converter (resulting in a smaller and more Apple like table).
+ *
+ * Usage : sudo ./smbios2struct4 (output to terminal window)
+ * : sudo ./smbios2struct4 > ../../../config/SMBIOS/MacModelNN.h (writes to [path]MacModelNN.h)
+ * : sudo ./smbios2struct4 MacModelNN (writes to: /Extra/SMBIOS/MacModel.bin)
+ *
+ * Compile with : cc smbios2struct4.c -o smbios2struct4 -Wall -framework IOKit -framework CoreFoundation
+ *
+ * Updates : Interim solution for writing stripped SMBIOS table data to MacModelNN.bin (PikerAlpha, November 2012)
+ * : Check root priveledges for writing to: /Extra/SMBIOS/MacModelNN.bin (PikerAlpha, November 2012)
+ * : Now also saves /EFI-device-properties (PikerAlpha, November 2012)
+ *
+ */
#include
#include
+#include
+#include
#include
#include
-#include "SMBIOS.h"
+#include "../smbios.h"
#define DEBUG 0 // Set to 1 for additional (debug) output
-#define VERBOSE 1
+#define VERBOSE 0
#if VERBOSE
#define VERBOSE_DUMP(x...) printf(x)
@@ -102,12 +111,12 @@ void dumpStaticTableData(const UInt8 * tableBuffer, int maxStructureSize, int st
{
int index = 0;
- printf("\n\t#define STATIC_SMBIOS_SM_MAX_STRUCTURE_SIZE\t%d\n", maxStructureSize);
- printf("\n\t#define STATIC_SMBIOS_DMI_STRUCTURE_COUNT\t%d\n", structureCount);
+ printf("\n#define STATIC_SMBIOS_SM_MAX_STRUCTURE_SIZE\t%d\n", maxStructureSize);
+ printf("\n#define STATIC_SMBIOS_DMI_STRUCTURE_COUNT\t%d\n", structureCount);
printf("\n");
- printf("\t#define STATIC_SMBIOS_DATA \\\n");
- printf("\t/* SMBIOS data (0x%04x / %d bytes) converted with smbios2struct2 into little endian format. */ \\\n", tableLength, tableLength);
- printf("\t/* 0x0000 */\t");
+ printf("#define STATIC_SMBIOS_DATA \\\n");
+ printf("/* SMBIOS data (0x%04x / %d bytes) converted with smbios2struct2 into little endian format. */ \\\n", tableLength, tableLength);
+ printf("/* 0x0000 */\t");
UInt16 length = round2(tableLength, 4);
UInt32 * newTableData = malloc(tableLength);
@@ -123,7 +132,7 @@ void dumpStaticTableData(const UInt8 * tableBuffer, int maxStructureSize, int st
if ((index % 8) == 0)
{
- printf("\\\n\t/* 0x%04x */\t", (index * 4));
+ printf("\\\n/* 0x%04x */\t", (index * 4));
}
}
} while((index * 4) <= length);
@@ -138,6 +147,27 @@ void dumpStaticTableData(const UInt8 * tableBuffer, int maxStructureSize, int st
int main(int argc, char * argv[])
{
+ char dirspec[128];
+ int filedesc = 0;
+ struct stat my_sb;
+
+ if (argc == 2)
+ {
+ uid_t real_uid = getuid();
+ uid_t euid = geteuid();
+
+#if DEBUG
+ printf("UID: %u EUID: %u\n", real_uid, euid);
+#endif
+ // Under sudo, getuid and geteuid return 0.
+ if (real_uid != 0 || euid != 0)
+ {
+ printf("Error: Not root. Use sudo ./smbios2struct4 [filename without extension]\n");
+
+ exit (-1);
+ }
+ }
+
mach_port_t masterPort;
io_service_t service = MACH_PORT_NULL;
CFDataRef dataRef;
@@ -146,20 +176,88 @@ int main(int argc, char * argv[])
UInt16 tableLength = 0, droppedTables = 0;
UInt16 newTableLength = 0;
- // UInt32 * shadowTableData = NULL;
-
IOMasterPort(MACH_PORT_NULL, &masterPort);
+
+ //==================================================================================
+
+ io_registry_entry_t efi = IORegistryEntryFromPath(kIOMasterPortDefault, kIODeviceTreePlane ":/efi");
+
+ if (efi == IO_OBJECT_NULL)
+ {
+#if DEBUG
+ printf("FAILURE: Unable to locate EFI registry entry.\n");
+#endif
+ exit(-1);
+ }
+ else
+ {
+#if DEBUG
+ printf("OK\n");
+#endif
+ dataRef = (CFDataRef) IORegistryEntryCreateCFProperty(efi, CFSTR("device-properties"), kCFAllocatorDefault, kNilOptions);
+
+ if (dataRef)
+ {
+ UInt32 * deviceProperties = (UInt32 *) CFDataGetBytePtr(dataRef);
+ UInt16 devicePropertiesBytes = (int) CFDataGetLength(dataRef);
+#if DEBUG
+ printf("Property 'device-properties' %d bytes found.", numBytes);
+#endif
+ if ((argc == 2) && (devicePropertiesBytes)) // Write to file?
+ {
+ // Sanity check for required directory.
+ if (stat("/Extra", &my_sb) != 0)
+ {
+ mkdir("/Extra", (S_IRWXU | S_IRWXG | S_IRWXO));
+ }
+ // Sanity check for required directory.
+ if (stat("/Extra/EFI", &my_sb) != 0)
+ {
+ mkdir("/Extra/EFI", (S_IRWXU | S_IRWXG | S_IRWXO));
+ }
+
+ sprintf (dirspec, "/Extra/EFI/%s.bin", argv[1]);
+ filedesc = open(dirspec, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+
+ if (filedesc == -1)
+ {
+ printf("Error: Unable to open file!\n");
+ }
+ else
+ {
+ int status = write(filedesc, deviceProperties, devicePropertiesBytes);
+
+ if (status != devicePropertiesBytes)
+ {
+ printf("status %d, saved %d bytes\n", status, devicePropertiesBytes);
+ }
+ else
+ {
+ printf("%d bytes written to: %s\n", devicePropertiesBytes, dirspec);
+ }
+ }
+
+ close (filedesc);
+ }
+ }
+#if DEBUG
+ else
+ {
+ printf("FAILURE: Unable to locate ':/efi/device-properties'\n");
+ }
+#endif
+ }
+
+ //==================================================================================
+
service = IOServiceGetMatchingService(masterPort, IOServiceMatching("AppleSMBIOS"));
if (service)
{
#if DEBUG
- printf("\nHave AppleSMBIOS\n");
+ printf("\nAppleSMBIOS found\n");
#endif
- dataRef = (CFDataRef) IORegistryEntryCreateCFProperty(service,
- CFSTR("SMBIOS-EPS"),
- kCFAllocatorDefault,
- kNilOptions);
+ dataRef = (CFDataRef) IORegistryEntryCreateCFProperty(service, CFSTR("SMBIOS-EPS"), kCFAllocatorDefault, kNilOptions);
if (dataRef)
{
@@ -208,10 +306,7 @@ int main(int argc, char * argv[])
printf("\n");
#endif
- dataRef = (CFDataRef) IORegistryEntryCreateCFProperty(service,
- CFSTR("SMBIOS"),
- kCFAllocatorDefault,
- kNilOptions);
+ dataRef = (CFDataRef) IORegistryEntryCreateCFProperty(service, CFSTR("SMBIOS"), kCFAllocatorDefault, kNilOptions);
if (dataRef)
{
@@ -321,7 +416,45 @@ int main(int argc, char * argv[])
VERBOSE_DUMP("\nDropped tables: %2d.\n", droppedTables);
- dumpStaticTableData(tableBuffer, maxStructureSize, newStructureCount, newTableLength);
+ if (argc == 2) // Write to file?
+ {
+ // Sanity check for required directory.
+ if (stat("/Extra/SMBIOS", &my_sb) != 0)
+ {
+ mkdir("/Extra/SMBIOS", (S_IRWXU | S_IRWXG | S_IRWXO));
+ }
+
+ sprintf (dirspec, "/Extra/SMBIOS/%s.bin", argv[1]);
+ filedesc = open(dirspec, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+
+ if (filedesc == -1)
+ {
+ printf("Error: Unable to open file!\n");
+ }
+ else
+ {
+ newTableLength = round2((newTableLength + 2), 4);
+
+ VERBOSE_DUMP("newTableLength: %d\n", newTableLength);
+
+ int status = write(filedesc, tableBuffer, newTableLength);
+
+ if (status != newTableLength)
+ {
+ printf("status %d, saved %d bytes\n", status, newTableLength);
+ }
+ else
+ {
+ printf("%d bytes written to: %s\n", newTableLength, dirspec);
+ }
+ }
+
+ close (filedesc);
+ }
+ else
+ {
+ dumpStaticTableData(tableBuffer, maxStructureSize, newStructureCount, newTableLength);
+ }
free((void *)tableBuffer);
diff --git a/i386/util/Makefile b/i386/util/Makefile
index 87e8d42..e4ccd5f 100644
--- a/i386/util/Makefile
+++ b/i386/util/Makefile
@@ -1,42 +1,31 @@
#
-# Until I can remove the dependency on the appkit,
-# we'll just keep the generated files in this directory
-# and install them directly, rather than generating them again.
+#File: RevoBoot/i386/util/Makefile
#
+# Updates:
+#
+# - Major cleanup (PikerAlpha, October 2012).
+#
+
-DIR = util
include ../MakePaths.dir
VPATH = $(OBJROOT):$(SYMROOT)
-INSTALLDIR = $(DSTROOT)/usr/standalone/i386
-LOCALBIN = $(DSTROOT)/usr/local/bin
-
OPTIM = -Os -Oz
CFLAGS = $(RC_CFLAGS) $(OPTIM) -Wmost -Werror -g
+
LDFLAGS =
-CFILES = md.c machOconv.c
-ALLSRC = $(CFILES) $(MFILES) $(HFILES) $(EXPORT_HFILES)
+DEFINES=
PROGRAMS = md machOconv
-OUTFILES = $(PROGRAMS)
-
DIRS_NEEDED = $(OBJROOT) $(SYMROOT) $(LANGDIR)
-lion: all
-
-mountain-lion: all
-
-all: $(DIRS_NEEDED) $(PROGRAMS)
+$(MAKEGOAL): $(DIRS_NEEDED) $(PROGRAMS)
machOconv: machOconv.o
- $(CC) $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $(SYMROOT)/$(@F) machOconv.o
+ @$(CC) $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $(SYMROOT)/$(@F) machOconv.o
md:
- $(CC) -mdynamic-no-pic -Wall -dead_strip -arch i386 -mmacosx-version-min=10.5 md.c -o $(SYMROOT)/md
+ @$(CC) -mdynamic-no-pic -Wall -dead_strip -arch i386 -mmacosx-version-min=10.5 md.c -o $(SYMROOT)/md
include ../MakeInc.dir
-
-#dependencies
--include $(OBJROOT)/Makedep
-
diff --git a/r b/r
index ce7791e..530f117 100755
--- a/r
+++ b/r
@@ -1,4 +1,28 @@
-make clean
clear
-make mountain-lion > out.log
+make clean
+#
+# Check argument for Mac model.
+#
+if [[ "$1" =~ [iMac|Mac] ]];
+ then
+ #
+ # Use specified MacModelNN from argument.
+ #
+ make MODEL=$1 > out.log
+ else
+ #
+ # Check RevoBoot/MODEL for default model.
+ #
+ if [ -f MODEL ]; then
+ #
+ # Get MacModelNN from MODEL (assuming it to be correct).
+ #
+ make MODEL=`cat MODEL` > out.log
+ else
+ #
+ # No default model found. Use the default (matches settings-template.h)
+ #
+ make MODEL=Macmini > out.log
+ fi;
+fi