Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove dependencies on system inlcudes. Mkaefile system reworked. Mak…

…efile system now uses the kconfig utility from linux to configure thing such a debug support, modules, embeded theme, etc. NOTE: selecting modules in the configuration currently does nothing, however it will soon alow you to compile modules directly into chameleon is so desired

git-svn-id: http://forge.voodooprojects.org/svn/chameleon/trunk@881 b5af796a-00a8-11df-919b-ffff7a100b7d
  • Loading branch information...
commit 2b46b340f26e3921e86217d6e08605625ba6dceb 1 parent b6a755d
meklort authored
Showing with 30,291 additions and 221 deletions.
  1. +6 −0 Cconfig
  2. +125 −0 Make.rules
  3. +35 −68 Makefile
  4. +21 −0 i386/Cconfig
  5. +31 −22 i386/Makefile
  6. +30 −0 i386/boot0/Cconfig
  7. +15 −20 i386/boot0/Makefile
  8. +4 −4 i386/boot0/boot0.s
  9. +1 −1  i386/boot0/chain0.s
  10. +47 −0 i386/boot1/Cconfig
  11. +30 −24 i386/boot1/Makefile
  12. +2 −2 i386/boot1/{boot1.s → boot1h.s}
  13. +4 −4 i386/boot1/boot1he.s
  14. +29 −0 i386/boot2/Cconfig
  15. +48 −43 i386/boot2/Makefile
  16. +0 −5 i386/boot2/bmdecompress.c
  17. +5 −0 i386/boot2/drivers.c
  18. +7 −7 i386/boot2/gui.c
  19. +26 −7 i386/boot2/modules.c
  20. +4 −1 i386/boot2/modules_support.s
  21. +1 −0  i386/boot2/picopng.c
  22. +1 −1  i386/boot2/prompt.c
  23. +12 −12 i386/cdboot/Makefile
  24. +54 −0 i386/config/Makefile
  25. +866 −0 i386/config/cconfig.c
  26. +332 −0 i386/config/checklist.c
  27. +1,078 −0 i386/config/confdata.c
  28. +230 −0 i386/config/dialog.h
  29. +1,173 −0 i386/config/expr.c
  30. +231 −0 i386/config/expr.h
  31. +238 −0 i386/config/inputbox.c
  32. +2,430 −0 i386/config/lex.zconf.c
  33. +196 −0 i386/config/lkc.h
  34. +53 −0 i386/config/lkc_proto.h
  35. +4 −0 i386/config/lxdialog/.gitignore
  36. +4 −0 i386/config/lxdialog/BIG.FAT.WARNING
  37. +84 −0 i386/config/lxdialog/check-lxdialog.sh
  38. +332 −0 i386/config/lxdialog/checklist.c
  39. +230 −0 i386/config/lxdialog/dialog.h
  40. +238 −0 i386/config/lxdialog/inputbox.c
  41. +434 −0 i386/config/lxdialog/menubox.c
  42. +391 −0 i386/config/lxdialog/textbox.c
  43. +657 −0 i386/config/lxdialog/util.c
  44. +114 −0 i386/config/lxdialog/yesno.c
  45. +608 −0 i386/config/menu.c
  46. +434 −0 i386/config/menubox.c
  47. +96 −0 i386/config/nconf.h
  48. +1,231 −0 i386/config/symbol.c
  49. +391 −0 i386/config/textbox.c
  50. +796 −0 i386/config/util.c
  51. +114 −0 i386/config/yesno.c
  52. +245 −0 i386/config/zconf.hash.c
  53. +2,506 −0 i386/config/zconf.tab.c
  54. +41 −0 i386/include/IOKit/IOBSD.h
  55. +261 −0 i386/include/IOKit/IOBufferMemoryDescriptor.h
  56. +272 −0 i386/include/IOKit/IOCatalogue.h
  57. +83 −0 i386/include/IOKit/IOCommand.h
  58. +241 −0 i386/include/IOKit/IOCommandGate.h
  59. +230 −0 i386/include/IOKit/IOCommandPool.h
  60. +71 −0 i386/include/IOKit/IOConditionLock.h
  61. +557 −0 i386/include/IOKit/IODMACommand.h
  62. +67 −0 i386/include/IOKit/IODMAController.h
  63. +84 −0 i386/include/IOKit/IODMAEventSource.h
  64. +141 −0 i386/include/IOKit/IODataQueue.h
  65. +92 −0 i386/include/IOKit/IODataQueueShared.h
  66. +98 −0 i386/include/IOKit/IODeviceMemory.h
  67. +127 −0 i386/include/IOKit/IODeviceTreeSupport.h
  68. +244 −0 i386/include/IOKit/IOEventSource.h
  69. +156 −0 i386/include/IOKit/IOFilterInterruptEventSource.h
  70. +122 −0 i386/include/IOKit/IOInterleavedMemoryDescriptor.h
  71. +155 −0 i386/include/IOKit/IOInterruptController.h
  72. +200 −0 i386/include/IOKit/IOInterruptEventSource.h
  73. +58 −0 i386/include/IOKit/IOInterrupts.h
  74. +111 −0 i386/include/IOKit/IOKitDebug.h
  75. +164 −0 i386/include/IOKit/IOKitKeys.h
  76. +123 −0 i386/include/IOKit/IOKitServer.h
  77. +398 −0 i386/include/IOKit/IOLib.h
  78. +409 −0 i386/include/IOKit/IOLocks.h
  79. +154 −0 i386/include/IOKit/IOMapper.h
  80. +462 −0 i386/include/IOKit/IOMemoryCursor.h
  81. +898 −0 i386/include/IOKit/IOMemoryDescriptor.h
  82. +75 −0 i386/include/IOKit/IOMessage.h
  83. +110 −0 i386/include/IOKit/IOMultiMemoryDescriptor.h
  84. +167 −0 i386/include/IOKit/IONVRAM.h
  85. +72 −0 i386/include/IOKit/IONotifier.h
  86. +318 −0 i386/include/IOKit/IOPlatformExpert.h
  87. +171 −0 i386/include/IOKit/IORangeAllocator.h
  88. +947 −0 i386/include/IOKit/IORegistryEntry.h
  89. +137 −0 i386/include/IOKit/IOReturn.h
  90. +1,690 −0 i386/include/IOKit/IOService.h
  91. +42 −0 i386/include/IOKit/IOServicePM.h
  92. +129 −0 i386/include/IOKit/IOSharedDataQueue.h
  93. +86 −0 i386/include/IOKit/IOSharedLock.h
  94. +109 −0 i386/include/IOKit/IOSubMemoryDescriptor.h
  95. +64 −0 i386/include/IOKit/IOSyncer.h
  96. +189 −0 i386/include/IOKit/IOTimeStamp.h
  97. +230 −0 i386/include/IOKit/IOTimerEventSource.h
  98. +238 −0 i386/include/IOKit/IOTypes.h
  99. +333 −0 i386/include/IOKit/IOUserClient.h
  100. +321 −0 i386/include/IOKit/IOWorkLoop.h
  101. +158 −0 i386/include/IOKit/OSMessageNotification.h
  102. +254 −0 i386/include/IOKit/acpi/IOACPIPlatformDevice.h
  103. +178 −0 i386/include/IOKit/acpi/IOACPIPlatformExpert.h
  104. +136 −0 i386/include/IOKit/acpi/IOACPITypes.h
  105. +54 −0 i386/include/IOKit/assert.h
  106. +164 −0 i386/include/IOKit/ata/ATADeviceNub.h
  107. +126 −0 i386/include/IOKit/ata/ATATimerEventSource.h
  108. +250 −0 i386/include/IOKit/ata/IOATABusCommand.h
  109. +219 −0 i386/include/IOKit/ata/IOATABusInfo.h
  110. +478 −0 i386/include/IOKit/ata/IOATACommand.h
  111. +314 −0 i386/include/IOKit/ata/IOATAController.h
  112. +239 −0 i386/include/IOKit/ata/IOATADevConfig.h
Sorry, we could not display the entire diff because too many files (704) changed.
View
6 Cconfig
@@ -0,0 +1,6 @@
+#
+# Chameleon Configuration
+#
+mainmenu "Chameleon Configuration"
+
+source "i386/Cconfig"
View
125 Make.rules
@@ -0,0 +1,125 @@
+-include $(SRCROOT)/auto.conf
+
+export USE_APPLE_PB_SUPPORT = all
+
+
+ifneq "" "$(wildcard /bin/mkdirs)"
+ MKDIRS = /bin/mkdirs
+else
+ MKDIRS = /bin/mkdir -p
+endif
+AS = as
+LD = ld
+CC = cc
+CPP = g++
+PAX = /bin/pax
+NASM = $(shell which nasm) -p $(SRCROOT)/autoconf.inc
+
+
+# CFLAGS = -O $(MORECPP) -arch i386 -g
+CFLAGS = $(CONFIG_OPTIMIZATION_LEVEL) $(MORECPP) -g -Wmost -Werror
+CPPFLAGS = -fno-exceptions -fno-rtti
+DEFINES=
+
+CONFIG = hd
+#LIBDIR = libsa
+#INC = -I. -I$(LIBDIR)
+
+
+
+
+#
+# Common makefile targets.
+#
+# Define these variables (if desired) in directory makefiles:
+# DIRS_NEEDED
+# INSTALLDIR
+# SRCROOT
+#
+
+# Toggle this as to whether you want a frame pointer (%ebp) to be used. It is
+# invaluable for debugging the booter. For example using GDB attached to VMware.
+# In fact, it's so invaluable that it's now the default. Not only that but the
+# compiler seems to generate slightly smaller code and the real<->prot code
+# clearly handles it appropriately so I have no idea why Apple omitted it.
+#OMIT_FRAME_POINTER_CFLAG=-fomit-frame-pointer
+OMIT_FRAME_POINTER_CFLAG=
+
+
+$(OBJROOT)/%.o: %.c
+ @echo "\t[CC] $<"
+ @$(CC) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $@ \
+ -MD -dependency-file $(OBJROOT)/$*.d
+ @md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
+
+$(OBJROOT)/%.o32: %.c
+ @echo "\t[CC32] $<"
+ @$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch i386 $< -o $@ \
+ -MD -dependency-file $(OBJROOT)/$*.d
+ @md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
+
+$(OBJROOT)/%.o64: %.c
+ @echo "\t[CC64] $<"
+ @$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch x86_64 $< -o $@ \
+ -MD -dependency-file $(OBJROOT)/$*.d
+ @md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
+
+$(OBJROOT)/%.o: %.m
+ @echo "\t[M] $<"
+ @$(CC) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $@ \
+ -MD -dependency-file $(OBJROOT)/$*.d
+ @md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
+
+$(OBJROOT)/%.o: %.cpp
+ @echo "\t[CPP] $<"
+ @$(CPP) $(CPPFLAGS) $(CFLAGS) -c "$<" $(INC) -o $@ \
+ -MD -dependency-file $(OBJROOT)/$*.d
+ @md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
+
+
+#$(OBJROOT)/.s.o:
+# @echo "\t[AS] $<"
+# @cc $(CPPFLAGS) -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) $<
+
+# This breaks make, must use make all (FIXME)
+$(OBJROOT)/boot2.o:
+ @echo "\t[AS] boot2.s"
+ @cc $(CPPFLAGS) -Wa,-n -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) boot2.s \
+ -MD -dependency-file $*.d
+ @md -u $(OBJROOT)/Makedep -f -d $*.d
+
+
+$(OBJROOT)/%.o: %.s
+ @echo "\t[AS] $<"
+ @$(CC) $(CPPFLAGS) -c $(INC) -arch i386 -o $@ $< \
+ -MD -dependency-file $*.d
+ @md -u $(OBJROOT)/Makedep -f -d $*.d
+
+
+
+# This breaks make, must use make all (FIXME)
+$(DIRS_NEEDED) $(INSTALLDIR) $(OBJROOT) $(SYMROOT):
+ @echo "\t[MKDIR] $@"
+ @$(MKDIRS) $@
+
+$(SRCROOT)/auto.conf $(SRCROOT)/autoconf.h $(SRCROOT)/.config:
+ @echo "\t[MAKE] config"
+ @cd $(SRCROOT) && make config
+
+.PHONY: clean
+clean:
+ @echo "\t[RM] $(OBJROOT)"
+ @echo "\t[RM] $(SYMROOT)"
+ @echo "\t[RM] $(DSTROOT)"
+ @echo "\t[RM] $(SRCROOT)/revision"
+ @echo "\t[RM] $(SRCROOT)/i386/modules/module_includes"
+ @echo "\t[RM] $(SRCROOT)/auto.conf"
+ @echo "\t[RM] $(SRCROOT)/autoconf.h"
+ @echo "\t[RM] $(SRCROOT)/autoconf.inc"
+
+ @rm -rf $(OBJROOT) $(SYMROOT) $(DSTROOT) $(SRCROOT)/revision \
+ $(SRCROOT)/i386/modules/module_includes \
+ $(SRCROOT)/auto.conf \
+ $(SRCROOT)/autoconf.h \
+ $(SRCROOT)/autoconf.inc
+
View
103 Makefile
@@ -1,29 +1,16 @@
-export USE_APPLE_PB_SUPPORT = all
-
# Makefile for kernel booter
+SRCROOT = $(shell pwd)
+OBJROOT = $(SRCROOT)/obj
+SYMROOT = $(SRCROOT)/sym
+DSTROOT = $(SRCROOT)/dst
+DOCROOT = $(SRCROOT)/doc
+IMGROOT = $(SRCROOT)/sym/cache
+IMGSKELROOT = $(SRCROOT)/imgskel
+CDBOOT = ${IMGROOT}/usr/standalone/i386/cdboot
-# 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
-DOCROOT = `pwd`/doc
-IMGROOT = `pwd`/sym/cache
-IMGSKELROOT = `pwd`/imgskel
-CDBOOT = ${IMGROOT}/usr/standalone/i386/cdboot
+include Make.rules
+
THEME = default
@@ -38,15 +25,32 @@ EXCLUDE = --exclude=.svn --exclude=.DS_Store --exclude=sym --exclude=obj \
ARCHLESS_RC_CFLAGS=`echo $(RC_CFLAGS) | sed 's/-arch [a-z0-9]*//g'`
-VPATH = $(OBJROOT):$(SYMROOT)
-
GENERIC_SUBDIRS =
#
# Currently builds for i386
#
-
-all embedtheme tags debug install installhdrs: $(SYMROOT) $(OBJROOT)
+clean config:
+ @if [ -e ".svn" ]; then svnversion -n | tr -d [:alpha:] > revision; fi
+ @echo ================= make config for i386 =================;
+ @( OBJROOT=$(OBJROOT)/i386; \
+ SYMROOT=$(SYMROOT)/i386; \
+ DSTROOT=$(DSTROOT); \
+ SRCROOT=$(SRCROOT); \
+ cd i386; ${MAKE} \
+ "OBJROOT=$$OBJROOT" \
+ "SYMROOT=$$SYMROOT" \
+ "DSTROOT=$$DSTROOT" \
+ "SRCROOT=$$SRCROOT" \
+ "RC_ARCHS=$$RC_ARCHS" \
+ "TARGET=$$i" \
+ "RC_KANJI=$(RC_KANJI)" \
+ "JAPANESE=$(JAPANESE)" \
+ "RC_CFLAGS=$$XCFLAGS" $@ \
+ ) || exit $$?; \
+
+
+all: $(SYMROOT) $(OBJROOT) $(SRCROOT)/auto.conf $(SRCROOT)/autoconf.h $(SRCROOT)/autoconf.inc $(SRCROOT)/.config
@if [ -e ".svn" ]; then svnversion -n | tr -d [:alpha:] > revision; fi
@if [ -z "$(RC_ARCHS)" ]; then \
RC_ARCHS="i386"; \
@@ -59,6 +63,7 @@ all embedtheme tags debug install installhdrs: $(SYMROOT) $(OBJROOT)
( OBJROOT=$(OBJROOT)/$${i}; \
SYMROOT=$(SYMROOT)/$${i}; \
DSTROOT=$(DSTROOT); \
+ SRCROOT=$(SRCROOT); \
XCFLAGS=$(ARCHLESS_RC_CFLAGS); \
GENSUBDIRS="$(GENERIC_SUBDIRS)"; \
for x in $$GENSUBDIRS; \
@@ -68,7 +73,6 @@ all embedtheme tags debug install installhdrs: $(SYMROOT) $(OBJROOT)
break; \
fi \
done; \
- echo "$$OBJROOT $$SYMROOT $$DSTROOT"; \
cd $$i; ${MAKE} \
"OBJROOT=$$OBJROOT" \
"SYMROOT=$$SYMROOT" \
@@ -85,45 +89,8 @@ all embedtheme tags debug install installhdrs: $(SYMROOT) $(OBJROOT)
fi; \
done
-image:
- @if [ -e "$(SYMROOT)" ]; then \
- rm -r -f ${IMGROOT}; \
- mkdir -p ${IMGROOT}/usr/standalone/i386; \
- if [ -e "$(IMGSKELROOT)" ]; then \
- cp -R -f "${IMGSKELROOT}"/* "${IMGROOT}"; \
- fi; \
- cp -f ${SYMROOT}/i386/cdboot ${CDBOOT}; \
- cp -f ${SYMROOT}/i386/boot ${IMGROOT}/usr/standalone/i386; \
- cp -f ${SYMROOT}/i386/boot0 ${IMGROOT}/usr/standalone/i386; \
- cp -f ${SYMROOT}/i386/boot1h ${IMGROOT}/usr/standalone/i386; \
- cp -f ${SYMROOT}/i386/boot1f32 ${IMGROOT}/usr/standalone/i386;\
- $(shell hdiutil makehybrid -iso -joliet -hfs -hfs-volume-name \
- ${CDLABEL} -eltorito-boot ${CDBOOT} -no-emul-boot -ov -o \
- "${ISOIMAGE}" ${IMGROOT} -quiet) \
- fi;
-
-pkg installer: embedtheme
- @if [ -e "$(SYMROOT)" ]; then \
- sudo `pwd`/package/buildpkg `pwd`/sym/package; \
- fi;
-
-release: $(SYMROOT)
- @if [ -e ".svn" ]; then svnversion -n | tr -d [:alpha:] > revision; fi
- @if [ -e "$(SYMROOT)" ]; then \
- sudo `pwd`/package/buildpkg `pwd`/sym/package; \
- fi;
- @tar -czf $(SYMROOT)/$(PRODUCT)-src.tar.gz ${EXCLUDE} .
- @tar -cjf $(SYMROOT)/$(PRODUCT)-src.tar.bz2 ${EXCLUDE} .
-
-clean:
- rm -rf sym obj dst revision i386/modules/module_includes
-
-#distclean: clean
-# @rm -f $(SYMROOT)/$(PRODUCT)-src.*
-# @rm -f $(SYMROOT)/$(PRODUCT).pkg
-installsrc:
- gnutar cf - . | (cd ${SRCROOT}; gnutar xpf -)
-$(SYMROOT) $(OBJROOT) $(DSTROOT):
- @$(MKDIRS) $@
+.PHONY: config
+.PHONY: clean
+.DEFAULT_GOAL := all
View
21 i386/Cconfig
@@ -0,0 +1,21 @@
+#
+# Chameleon Utilities
+#
+
+config OPTIMIZATION_LEVEL
+ string "Optimization Level"
+ default "-Oz"
+ ---help---
+ Specify the level to compile chameleon with.
+
+source "i386/util/Cconfig"
+
+source "i386/boot0/Cconfig"
+
+source "i386/boot1/Cconfig"
+
+source "i386/boot2/Cconfig"
+
+source "i386/libsa/Cconfig"
+
+source "i386/libsaio/Cconfig"
View
53 i386/Makefile
@@ -1,34 +1,27 @@
-
# Makefile for i386 boot program
# define FLOPPY and SMALL using DEFINES macro as necessary
-CFLAGS = -O $(MORECPP) -arch i386 -g -static
-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
-
#
# these paths are only valid in subdirectories of this directory
#
-OBJROOT=`pwd`/../../obj/i386
-SYMROOT=`pwd`/../../sym/i386
-DSTROOT=`pwd`/../../dst/i386
-SRCROOT=/tmp
+SRCROOT = $(shell pwd)/../
+OBJROOT = $(SRCROOT)/obj/i386
+SYMROOT = $(SRCROOT)/sym/i386
+DSTROOT = $(SRCROOT)/dst/i386
+DOCROOT = $(SRCROOT)/doc
+IMGROOT = $(SRCROOT)/sym/cache
+IMGSKELROOT = $(SRCROOT)/imgskel
+CDBOOT = ${IMGROOT}/usr/standalone/i386/cdboot
+
+include ${SRCROOT}/Make.rules
+
VPATH = $(OBJROOT):$(SYMROOT)
# The order of building is important.
-SUBDIRS = util libsa libsaio boot2 boot1 boot0 cdboot modules
+SUBDIRS = util libsa libsaio boot0 boot1 boot2 cdboot modules
-all embedtheme tags debug install installhdrs:
+all:
@for i in ${SUBDIRS}; \
do \
echo ================= make $@ for $$i =================; \
@@ -43,6 +36,22 @@ all embedtheme tags debug install installhdrs:
"RC_CFLAGS=$(RC_CFLAGS)" $@ \
) || exit $$?; \
done
+
+config:
+ @for i in config; \
+ do \
+ echo ================= make $@ for $$i =================; \
+ ( cd $$i; ${MAKE} \
+ "OBJROOT=$(OBJROOT)/$$i" \
+ "SYMROOT=$(SYMROOT)" \
+ "DSTROOT=$(DSTROOT)" \
+ "SRCROOT=$(SRCROOT)" \
+ "RC_ARCHS=$(RC_ARCHS)" \
+ "RC_KANJI=$(RC_KANJI)" \
+ "JAPANESE=$(JAPANESE)" \
+ "RC_CFLAGS=$(RC_CFLAGS)" $@ \
+ ) || exit $$?; \
+ done
+
-installsrc:
- tar cf - . | (cd ${SRCROOT}; tar xfBp -)
+.PHONY: config
View
30 i386/boot0/Cconfig
@@ -0,0 +1,30 @@
+config BOOT0_HFSFIRST
+ bool "boot0 HFS prefered"
+ default y
+ help
+ Say Y here if you want boot0 to attempt to boot the first
+ hfs partition found, instead of the active partition.
+
+config BOOT0_DEBUG
+ bool "boot0 debug support"
+ default n
+ help
+ Say Y here if you want to compile in boot0
+ debug messages. On an error, boot0 will print
+ one of thefollowing:
+ > start_reloc was called
+ * Boot partition found
+ J Jumping to partition booter
+ < read_lba
+ R INT13/F42 error
+
+
+
+config BOOT0_VERBOSE
+ bool "boot0 verbose support"
+ default y
+ help
+ Say Y here if you want to enable boot0 verbose messages.
+ boot0 will pronto out status updates as it executes to
+ notify the user of progress in the initial boot sequence.
+ When in doubt, say "Y".
View
35 i386/boot0/Makefile
@@ -1,31 +1,26 @@
+SRCROOT = $(shell pwd)/../../
+OBJROOT = $(SRCROOT)/obj/i386/boot0
+SYMROOT = $(SRCROOT)/sym/i386
+DSTROOT = $(SRCROOT)/dst/i386
+DOCROOT = $(SRCROOT)/doc
+IMGROOT = $(SRCROOT)/sym/cache
+IMGSKELROOT = $(SRCROOT)/imgskel
+CDBOOT = ${IMGROOT}/usr/standalone/i386/cdboot
DIR = boot0
-include ../MakePaths.dir
+include ${SRCROOT}/Make.rules
-#NASM = /Developer/usr/bin/nasm
-NASM = $(shell which nasm)
-INSTALLDIR = $(DSTROOT)/usr/standalone/i386
DIRS_NEEDED = $(SYMROOT)
-all embedtheme: $(DIRS_NEEDED) boot0 boot0hfs chain0
-boot0: boot0.s
- @echo "\t[NASM] $@"
- @$(NASM) boot0.s -o $(SYMROOT)/$@
+OBJECTS = boot0 chain0
+OBJECTS := $(addprefix $(SYMROOT)/, $(OBJECTS))
-boot0hfs: boot0.s Makefile $(NASM)
- @echo "\t[NASM] $@"
- @$(NASM) boot0.s -DHFSFIRST -o $(SYMROOT)/$@
+all: $(DIRS_NEEDED) $(OBJECTS)
-chain0: chain0.s Makefile $(NASM)
- @echo "\t[NASM] $@"
- @$(NASM) chain0.s -o $(SYMROOT)/$@
-
-install_i386:: all $(INSTALLDIR)
- cp $(SYMROOT)/boot0 $(SYMROOT)/chain0 $(INSTALLDIR)
- cd $(INSTALLDIR); chmod u+w boot0
-
-include ../MakeInc.dir
+$(OBJECTS): $(SRCROOT)/autoconf.inc
+ @echo "\t[NASM] $(@F)"
+ @$(NASM) $(@F).s -o $@
#dependencies
View
8 i386/boot0/boot0.s
@@ -52,12 +52,12 @@
;
; Set to 1 to enable obscure debug messages.
;
-DEBUG EQU 0
+DEBUG EQU CONFIG_BOOT0_DEBUG
;
; Set to 1 to enable verbose mode
;
-VERBOSE EQU 1
+VERBOSE EQU CONFIG_BOOT0_VERBOSE
;
; Various constants.
@@ -315,7 +315,7 @@ find_boot:
jne .Pass2
.Pass1:
-%ifdef HFSFIRST
+%if CONFIG_BOOT0_HFSFIRST
cmp BYTE [si + part.type], kPartTypeHFS ; In pass 1 we're going to find a HFS+ partition
; equipped with boot1h in its boot record
; regardless if it's active or not.
@@ -332,7 +332,7 @@ find_boot:
jmp .tryToBoot
.Pass2:
-%ifdef HFSFIRST
+%if CONFIG_BOOT0_HFSFIRST
cmp BYTE [si + part.bootid], kPartActive ; In pass 2 we are walking on the standard path
; by trying to hop on the active partition.
jne .continue
View
2  i386/boot0/chain0.s
@@ -43,7 +43,7 @@
;
; Set to 1 to enable obscure debug messages.
;
-DEBUG EQU 0
+DEBUG EQU CONFIG_BOOT0_DEBUG
;
; Set to 1 to support loading the partition booter (boot1) from a
View
47 i386/boot1/Cconfig
@@ -0,0 +1,47 @@
+#
+# boot1
+#
+config BOOT1_HFS
+ bool "boot1 second stage booter"
+ default y
+ help
+ Say Y here if you want to compile the default boot1
+ bootloader stage.
+
+config BOOT1_HFS_DEBUG
+ bool "debug support"
+ default n
+ depends on BOOT1_HFS
+ help
+ Say Y here if you want to compile in debug support.
+
+config BOOT1_HFS_VERBOSE
+ bool "verbose support"
+ default y
+ depends on BOOT1_HFS
+ help
+ Say Y here if you want to compile in verbose support.
+
+#
+# boot1h
+#
+config BOOT1_HFS_ACTIVE
+ bool "boot1h second stage boater"
+ default y
+ help
+ Say Y here if you want to compile the default boot1
+ bootloader stage.
+
+config BOOT1_HFS_ACTIVE_DEBUG
+ bool "debug support"
+ default n
+ depends on BOOT1_HFS_ACTIVE
+ help
+ Say Y here if you want to compile in debug support.
+
+config BOOT1_HFS_ACTIVE_VERBOSE
+ bool "verbose support"
+ default y
+ depends on BOOT1_HFS_ACTIVE
+ help
+ Say Y here if you want to compile in debug support.
View
54 i386/boot1/Makefile
@@ -1,37 +1,43 @@
+SRCROOT = $(shell pwd)/../../
+OBJROOT = $(SRCROOT)/obj/i386/boot1
+SYMROOT = $(SRCROOT)/sym/i386
+DSTROOT = $(SRCROOT)/dst/i386
+DOCROOT = $(SRCROOT)/doc
+IMGROOT = $(SRCROOT)/sym/cache
+IMGSKELROOT = $(SRCROOT)/imgskel
+CDBOOT = ${IMGROOT}/usr/standalone/i386/cdboot
-DIR = boot1
-include ../MakePaths.dir
-
-INSTALLDIR = $(DSTROOT)/usr/standalone/i386
-DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
+include ${SRCROOT}/Make.rules
-#NASM = /Developer/usr/bin/nasm
-NASM = $(shell which nasm)
+DIR = boot1
-VERSIONED_FILES = boot1h
+DIRS_NEEDED = $(SYMROOT)
VERS = `vers_string -f 5.0 | tr - .`
NEW_VERS = Darwin boot1h v$(VERS)
-ifneq "" "$(wildcard /bin/mkdirs)"
- MKDIRS = /bin/mkdirs
-else
- MKDIRS = /bin/mkdir -p
+
+
+
+PROGRAMS = boot1hp boot1f32
+
+ifeq (${CONFIG_BOOT1_HFS}, y)
+PROGRAMS += boot1h
endif
-all embedtheme: $(DIRS_NEEDED) $(VERSIONED_FILES)
+ifeq (${CONFIG_BOOT1_HFS_ACTIVE}, y)
+PROGRAMS += boot1he
+endif
+
+
+PROGRAMS := $(addprefix $(SYMROOT)/, $(PROGRAMS))
-boot1h: boot1.s Makefile
- @echo "\t[NASM] boot1.s"
- @$(NASM) boot1.s -o $(SYMROOT)/boot1h
- @echo "\t[NASM] boot1hp.s"
- @$(NASM) boot1hp.s -o $(SYMROOT)/boot1hp
- @echo "\t[NASM] boot1he.s"
- @$(NASM) boot1he.s -o $(SYMROOT)/boot1he
- @echo "\t[NASM] boot1f32.s"
- @$(NASM) boot1f32.s -o $(SYMROOT)/boot1f32
+all: $(DIRS_NEEDED) $(PROGRAMS)
+
+
+$(PROGRAMS): $(SRCROOT)/autoconf.inc
+ @echo "\t[NASM] $(@F)"
+ @$(NASM) $(@F).s -o $@
install_i386:: all $(INSTALLDIR)
cp $(SYMROOT)/boot1h $(INSTALLDIR)/
cd $(INSTALLDIR); chmod u+w $(VERSIONED_FILES)
-
-include ../MakeInc.dir
View
4 i386/boot1/boot1.s → i386/boot1/boot1h.s
@@ -42,7 +42,7 @@
;
; Set to 1 to enable obscure debug messages.
;
-DEBUG EQU 0
+DEBUG EQU CONFIG_BOOT1_HFS_DEBUG
;
; Set to 1 to enable unused code.
@@ -52,7 +52,7 @@ UNUSED EQU 0
;
; Set to 1 to enable verbose mode.
;
-VERBOSE EQU 1
+VERBOSE EQU CONFIG_BOOT1_HFS_VERBOSE
;
; Various constants.
View
8 i386/boot1/boot1he.s
@@ -45,7 +45,7 @@
;
; Set to 1 to enable obscure debug messages.
;
-DEBUG EQU 1
+DEBUG EQU CONFIG_BOOT1_HFS_ACTIVE_DEBUG
;
; Set to 1 to enable unused code.
@@ -55,7 +55,7 @@ UNUSED EQU 0
;
; Set to 1 to enable verbose mode.
;
-VERBOSE EQU 1
+VERBOSE EQU CONFIG_BOOT1_HFS_ACTIVE_VERBOSE
;
; Various constants.
@@ -1280,7 +1280,7 @@ getBTreeRecord:
.exit:
pop di ; restore address of trialKey
-;%if UNUSED
+%if DEBUG
;
; Print catalog trial key
;
@@ -1302,7 +1302,7 @@ getBTreeRecord:
;
;
;
-;%endif ; UNUSED
+%endif ; DEBUG
%if UNUSED
;
View
29 i386/boot2/Cconfig
@@ -0,0 +1,29 @@
+config MODULES
+ bool "Module System"
+ default y
+ ---help---
+ Say Y here if you want to enable to use of modules.
+
+config MODULE_DEBUG
+ bool "debug support"
+ default n
+ depends on MODULES
+ ---help---
+ Say Y here if you want to enable debug mode for the
+ module system.
+
+source "i386/modules/Cconfig"
+
+config EMBED_THEME
+ bool "Embed Theme"
+ default n
+ ---help---
+ Say Y here if you want compile in a default theme.
+
+config EMBEDED_THEME
+ string "Theme name"
+ default "embed"
+ depends on EMBED_THEME
+ ---help---
+ Specify the name of the theme to compile in.
+
View
91 i386/boot2/Makefile
@@ -1,3 +1,11 @@
+SRCROOT = $(shell pwd)/../../
+OBJROOT = $(SRCROOT)/obj/i386/boot2
+SYMROOT = $(SRCROOT)/sym/i386
+DSTROOT = $(SRCROOT)/dst/i386
+DOCROOT = $(SRCROOT)/doc
+IMGROOT = $(SRCROOT)/sym/cache
+IMGSKELROOT = $(SRCROOT)/imgskel
+CDBOOT = ${IMGROOT}/usr/standalone/i386/cdboot
# Makefile for i386 boot program
# define FLOPPY and SMALL using DEFINES macro as necessary
@@ -6,39 +14,30 @@ PNGCRUSH = `which pngcrush`
PNGOPTIONS = -rem cHRM -rem gAMA -rem iCCP -rem sRGB
DIR = boot2
-include ../MakePaths.dir
+include ${SRCROOT}/Make.rules
OPTIM = -Os -Oz
CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror \
-fno-builtin -DSAIO_INTERNAL_USER -static $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
- -march=pentium4 -msse2 -mfpmath=sse -msoft-float
+ -march=pentium4 -msse2 -mfpmath=sse -msoft-float -nostdinc -include $(SRCROOT)/autoconf.h
+
+CPPFLAGS := $(CPPFLAGS) -nostdinc++ -include $(SRCROOT)/autoconf.h
DEFINES=
CONFIG = hd
SYMDIR = $(SYMROOT)
LIBSADIR = ../libsa
LIBSAIODIR = ../libsaio
-UTILDIR = ../util
-THEME = embed
+THEME = $(CONFIG_EMBEDED_THEME)
THEMEDIR = ../../artwork/themes/$(THEME)
-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
-# LIBS= -lc_static
+INC = -I. -I$(SYMDIR) -I$(LIBSADIR) -I$(LIBSAIODIR) -I${SRCROOT}/i386/include
+
LIBS= -L$(SYMDIR) -lsaio -lsa
-LIBDEP= $(SYMDIR)/libsaio.a $(SYMDIR)/libsa.a
+LIBDEP= libsaio.a libsa.a
OTHER_FILES =
-INSTALLDIR = $(DSTROOT)/usr/standalone/i386
-VPATH = $(OBJROOT):$(SYMROOT)
-
# The ordering is important;
# boot2.o must be first.
OBJS = boot2.o boot.o graphics.o drivers.o prompt.o options.o lzss.o mboot.o \
@@ -46,12 +45,6 @@ OBJS = boot2.o boot.o graphics.o drivers.o prompt.o options.o lzss.o mboot.o \
# button.o browser.o scrollbar.o == NOTYET
UTILDIR = ../util
-SFILES = boot2.s
-CFILES = boot.c graphics.c drivers.c prompt.c options.c mboot.c picopng.c modules.c
-HFILES = boot.h appleClut8.h appleboot.h mboot.h multiboot.h picopng.h modules.h
-OTHERFILES = Makefile
-ALLSRC = $(FOREIGNSRC) $(FOREIGNBIN) $(SFILES) $(CFILES) \
- $(HFILES) $(OTHERFILES)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
BOOT2ADDR = 20200
MAXBOOTSIZE = 458240
@@ -68,17 +61,27 @@ DATA_ADDR = $(shell printf "%d" `otool -l $(SYMROOT)/boot.sys | grep __data -A
PATCH_ADDR = $(shell echo ${SYMBOL_ADDR}-${DATA_ADDR}+${DATA_OFFSET} | bc)
-all: $(DIRS_NEEDED) boot
-embedtheme: CFLAGS += -DEMBED_THEME
-embedtheme: art.h all
+all: $(DIRS_NEEDED) boot
+
+ifeq (${CONFIG_EMBED_THEME}, y)
+
+boot: $(SYMROOT)/art.h $(SYMROOT)/vers.h $(SYMROOT)/embedded.h $(addprefix $(OBJROOT)/, $(OBJS)) $(addprefix $(SYMROOT)/, $(LIBDEP))
+
+else
+
+boot: $(SYMROOT)/vers.h $(SYMROOT)/embedded.h $(addprefix $(OBJROOT)/, $(OBJS)) $(addprefix $(SYMROOT)/, $(LIBDEP))
+
+
+endif
-boot: machOconv embedded.h $(OBJS) $(LIBDEP)
@echo "\t[LD] boot.sys"
- @$(LD) -static -Wl,-preload -Wl,-segaddr,__INIT,$(BOOT2ADDR) \
+ @$(CC) -static -Wl,-preload -Wl,-segaddr,__INIT,$(BOOT2ADDR) \
-nostdlib -arch i386 -Wl,-segalign,20 \
-o $(SYMROOT)/boot.sys $(filter %.o,$^) $(LIBS) -lcc_kext
+ifeq (${CONFIG_MODULES}, y)
+
@cp $(SYMROOT)/boot.sys $(SYMROOT)/boot2.sys
@# Generate the Symbols.dylib file
@@ -86,7 +89,7 @@ boot: machOconv embedded.h $(OBJS) $(LIBDEP)
@$(SYMROOT)/dyldsymboltool $(SYMROOT)/boot.sys $(SYMROOT)/${SYMBOLS_MODULE}
@echo "\t[LD] boot.sys"
- @$(LD) -static -Wl,-preload -Wl,-segaddr,__INIT,$(BOOT2ADDR) \
+ @$(CC) -static -Wl,-preload -Wl,-segaddr,__INIT,$(BOOT2ADDR) \
-nostdlib -arch i386 -Wl,-segalign,20 \
-Wl,-sectcreate,__DATA,__Symbols,$(SYMROOT)/Symbols.dylib \
-o $(SYMROOT)/boot.sys $(filter %.o,$^) $(LIBS) -lcc_kext
@@ -100,26 +103,31 @@ boot: machOconv embedded.h $(OBJS) $(LIBDEP)
@${RM} $(SYMROOT)/boot.sys
@echo "\t[LD] boot.sys"
- @$(LD) -static -Wl,-preload -Wl,-segaddr,__INIT,$(BOOT2ADDR) \
+ @$(CC) -static -Wl,-preload -Wl,-segaddr,__INIT,$(BOOT2ADDR) \
-nostdlib -arch i386 -Wl,-segalign,20 \
-Wl,-sectcreate,__DATA,__Symbols,$(SYMROOT)/Symbols.dylib \
-o $(SYMROOT)/boot.sys $(filter %.o,$^) $(LIBS) -lcc_kext
- @ld -arch i386 \
+ @$(LD) -arch i386 \
-undefined dynamic_lookup \
-dylib -read_only_relocs suppress \
-S -x -Z -dead_strip_dylibs \
-no_uuid \
- -final_output Symbols \
$(filter %.o,$^) $(LIBS) \
+ -final_output Symbols \
+ -macosx_version_min 10.6 \
-o $(OBJROOT)/Symbols_LINKER_ONLY.dylib
+
+
+endif
+
@make embed_symbols # this is done in a sub process after boot.sys exists so the strings are populated correctly
@${RM} $(SYMROOT)/boot2.sys
-
+
@##size $(SYMROOT)/boot.sys
@ls -l $(SYMROOT)/boot
@@ -132,26 +140,26 @@ boot: machOconv embedded.h $(OBJS) $(LIBDEP)
fi)
-embed_symbols: machOconv
+embed_symbols:
+ifeq (${CONFIG_MODULES}, y)
@echo ================= Embedding Symbols.dylib =================
@echo "\t[MACHOCONV] boot"
@$(SYMROOT)/machOconv $(SYMROOT)/boot2.sys $(SYMROOT)/boot &> /dev/null
@echo "\t******* Patching at $(PATCH_ADDR) ******"
@stat -f%z $(SYMROOT)/boot | perl -ane "print pack('V',@F[0]);" | dd conv=notrunc of=${SYMROOT}/boot.sys bs=1 count=4 seek=$(PATCH_ADDR) &> /dev/null
+endif
@echo "\t[MACHOCONV] boot"
@$(SYMROOT)/machOconv $(SYMROOT)/boot.sys $(SYMROOT)/boot
-
-prompt.o: vers.h
-vers.h:
+$(SYMROOT)/vers.h:
@echo "#define I386BOOT_VERSION \"5.0.132\"" > $(SYMROOT)/vers.h
@echo "#define I386BOOT_BUILDDATE \"`date \"+%Y-%m-%d %H:%M:%S\"`\"" >> $(SYMROOT)/vers.h
@echo "#define I386BOOT_CHAMELEONVERSION \"`cat ../../version`\"" >> $(SYMROOT)/vers.h
@echo "#define I386BOOT_CHAMELEONREVISION \"`svnversion -n | tr -d [:alpha:]`\"" >> $(SYMROOT)/vers.h
-art.h:
+$(SYMROOT)/art.h:
@if [ "$(PNGCRUSH)" ]; then \
echo "optimizing art files ...\n$(PNGCRUSH) $(PNGOPTIONS) artwork/$(THEME)"; \
cd $(THEMEDIR) && find . -name '*.png' -exec $(PNGCRUSH) -q $(PNGOPTIONS) -d $(SYMROOT)/embed {} \;; \
@@ -177,14 +185,11 @@ art.h:
@echo "#endif /* !__BOOT2_ART_H */" >> $(SYMROOT)/art.h ;\
-embedded.h:
+$(SYMROOT)/embedded.h:
@cd $(SYMROOT)/../../doc && xxd -i BootHelp.txt > $(SYMROOT)/embedded.h
-install_i386:: all $(INSTALLDIR)
- cp $(SYMROOT)/boot $(OTHER_FILES) $(INSTALLDIR)
- cd $(INSTALLDIR); chmod u+w boot $(OTHER_FILES)
-include ../MakeInc.dir
+.PHONY: $(SYMROOT)/vers.h
#dependencies
-include $(OBJROOT)/Makedep
View
5 i386/boot2/bmdecompress.c
@@ -21,11 +21,6 @@
*/
#include "boot.h"
-typedef uint8_t UInt8;
-typedef uint16_t UInt16;
-typedef int8_t SInt8;
-typedef int16_t SInt16;
-
static void
PreviewDecompress16(uint32_t * compressBuffer,
uint32_t width, uint32_t height, uint32_t row,
View
5 i386/boot2/drivers.c
@@ -38,6 +38,7 @@
#include "bootstruct.h"
#include "xml.h"
#include "ramdisk.h"
+#include "modules.h"
//extern char gMacOSVersion[8];
@@ -393,6 +394,10 @@ LoadDriverMKext( char * fileSpec )
length = LoadThinFatFile(fileSpec, (void **)&package);
if (length < sizeof (DriversPackage)) return -1;
+ // call hook to notify modules that the mkext has been loaded
+ execute_hook("LoadDriverMKext", (void*)fileSpec, (void*)package, (void*) &length, NULL);
+
+
// Verify the MKext.
if (( GetPackageElement(signature1) != kDriverPackageSignature1) ||
( GetPackageElement(signature2) != kDriverPackageSignature2) ||
View
14 i386/boot2/gui.c
@@ -16,7 +16,7 @@
#define THEME_NAME_DEFAULT "Default"
static const char *theme_name = THEME_NAME_DEFAULT;
-#ifdef EMBED_THEME
+#ifdef CONFIG_EMBED_THEME
#include "art.h"
#endif
@@ -181,7 +181,7 @@ static int getImageIndexByName(const char *name)
return -1;
}
-#ifdef EMBED_THEME
+#ifdef CONFIG_EMBED_THEME
static int getEmbeddedImageIndexByName(const char *name)
{
int upperLimit = sizeof(embeddedImages) / sizeof(embeddedImages[0]) - 1;
@@ -227,7 +227,7 @@ static int loadThemeImage(const char *image, int alt_image)
{
char dirspec[256];
int i;
-#ifdef EMBED_THEME
+#ifdef CONFIG_EMBED_THEME
int e;
#endif
uint16_t width;
@@ -255,7 +255,7 @@ static int loadThemeImage(const char *image, int alt_image)
flipRB(images[i].image);
return 0;
}
-#ifdef EMBED_THEME
+#ifdef CONFIG_EMBED_THEME
else if ((e = getEmbeddedImageIndexByName(image)) >= 0)
{
unsigned char *embed_data;
@@ -286,7 +286,7 @@ static int loadThemeImage(const char *image, int alt_image)
}
else
{
-#ifndef EMBED_THEME
+#ifndef CONFIG_EMBED_THEME
printf("ERROR: GUI: could not open '%s/%s.png'!\n", theme_name, image);
sleep(2);
#endif
@@ -689,7 +689,7 @@ int initGUI(void)
}
sprintf(dirspec, "/Extra/Themes/%s/theme.plist", theme_name);
if (loadConfigFile(dirspec, &bootInfo->themeConfig) != 0) {
-#ifdef EMBED_THEME
+#ifdef CONFIG_EMBED_THEME
config_file_t *config;
config = &bootInfo->themeConfig;
@@ -1804,7 +1804,7 @@ static void loadBootGraphics(void)
}
sprintf(dirspec, "/Extra/Themes/%s/boot.png", theme_name);
if (loadPngImage(dirspec, &bootImageWidth, &bootImageHeight, &bootImageData) != 0) {
-#ifdef EMBED_THEME
+#ifdef CONFIG_EMBED_THEME
if ((loadEmbeddedPngImage(__boot_png, __boot_png_len, &bootImageWidth, &bootImageHeight, &bootImageData)) != 0)
#endif
usePngImage = false;
View
33 i386/boot2/modules.c
@@ -2,8 +2,9 @@
* Copyright 2010 Evan Lojewski. All rights reserved.
*
*/
-#ifndef DEBUG_MODULES
-#define DEBUG_MODULES 0
+#ifdef CONFIG_MODULES
+#ifndef CONFIG_MODULE_DEBUG
+#define CONFIG_MODULE_DEBUG 0
#endif
#include "boot.h"
@@ -11,7 +12,7 @@
#include "modules.h"
-#if DEBUG_MODULES
+#if CONFIG_MODULE_DEBUG
#define DBG(x...) printf(x);
#define DBGPAUSE() getc()
#else
@@ -162,7 +163,7 @@ int load_module(char* module)
(*module_start)(); // Start the module
DBG("Module %s Loaded.\n", module); DBGPAUSE();
}
-#if DEBUG_MODULES
+#if CONFIG_MODULE_DEBUG
else // The module does not have a valid start function. This may be a library.
{
printf("WARNING: Unable to start %s\n", module);
@@ -272,7 +273,7 @@ unsigned int lookup_all_symbols(const char* name)
}
}
-#if DEBUG_MODULES
+#if CONFIG_MODULE_DEBUG
verbose("Unable to locate symbol %s\n", name);
getc();
#endif
@@ -1087,7 +1088,7 @@ void register_hook_callback(const char* name, void(*callback)(void*, void*, void
}
-#if DEBUG_MODULES
+#if CONFIG_MODULE_DEBUG
//print_hook_list();
//getc();
#endif
@@ -1115,7 +1116,7 @@ moduleHook_t* hook_exists(const char* name)
}
-#if DEBUG_MODULES
+#if CONFIG_MODULE_DEBUG
void print_hook_list()
{
printf("---Hook Table---\n");
@@ -1138,3 +1139,21 @@ void dyld_stub_binder()
printf("ERROR: dyld_stub_binder was called, should have been take care of by the linker.\n");
getc();
}
+
+#else /* CONFIG_MODULES */
+
+int init_module_system()
+{
+ return 0;
+}
+
+void load_all_modules()
+{
+
+}
+
+int execute_hook(const char* name, void* arg1, void* arg2, void* arg3, void* arg4)
+{
+ return 0;
+}
+#endif
View
5 i386/boot2/modules_support.s
@@ -1,7 +1,10 @@
+#ifdef CONFIG_MODULES
#include <architecture/i386/asm_help.h>
LABEL(dyld_stub_binder)
jmp _dyld_stub_binder
LABEL(dyld_void_start)
- ret
+ ret
+
+#endif
View
1  i386/boot2/picopng.c
@@ -17,6 +17,7 @@
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
+#include <sys/types.h>
#include "libsa.h"
#include "picopng.h"
View
2  i386/boot2/prompt.c
@@ -26,7 +26,7 @@
* All rights reserved.
*/
-#include "vers.h"
+#include <vers.h>
char bootBanner[] = "\nDarwin/x86 boot v" I386BOOT_VERSION " - Chameleon v" I386BOOT_CHAMELEONVERSION " r" I386BOOT_CHAMELEONREVISION "\n"
"Build date: " I386BOOT_BUILDDATE "\n"
View
24 i386/cdboot/Makefile
@@ -1,15 +1,21 @@
-
+SRCROOT = $(shell pwd)/../../
+OBJROOT = $(SRCROOT)/obj/i386/cdboot
+SYMROOT = $(SRCROOT)/sym/i386
+DSTROOT = $(SRCROOT)/dst/i386
+DOCROOT = $(SRCROOT)/doc
+IMGROOT = $(SRCROOT)/sym/cache
+IMGSKELROOT = $(SRCROOT)/imgskel
+CDBOOT = ${IMGROOT}/usr/standalone/i386/cdboot
+
DIR = cdboot
-include ../MakePaths.dir
+include ${SRCROOT}/Make.rules
-NASM = $(shell which nasm)
-#/Developer/usr/bin/nasm
INSTALLDIR = $(DSTROOT)/usr/standalone/i386
DIRS_NEEDED = $(SYMROOT)
-all embedtheme optionrom: $(DIRS_NEEDED) cdboot
+all embedtheme optionrom: $(DIRS_NEEDED) $(SYMROOT)/cdboot
-cdboot: cdboot.s $(SYMROOT)/boot Makefile $(NASM)
+$(SYMROOT)/cdboot:
@echo "\t[NASM] cdboot.s"
@$(NASM) cdboot.s -o $(SYMROOT)/cdboot
@dd if=$(SYMROOT)/boot of=$(SYMROOT)/cdboot conv=sync bs=2k seek=1 &> /dev/null
@@ -19,10 +25,4 @@ cdboot: cdboot.s $(SYMROOT)/boot Makefile $(NASM)
| perl -ane "print pack('V',@F[0]);" \
| dd of=$(SYMROOT)/cdboot bs=1 count=4 seek=2044 conv=notrunc &> /dev/null
-install_i386:: all $(INSTALLDIR)
- cp $(SYMROOT)/cdboot $(INSTALLDIR)
- cd $(INSTALLDIR); chmod u+w cdboot
-
-include ../MakeInc.dir
-
#dependencies
View
54 i386/config/Makefile
@@ -0,0 +1,54 @@
+#
+# 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.
+#
+SRCROOT = $(shell pwd)/../../
+OBJROOT = $(SRCROOT)/obj/i386/config
+SYMROOT = $(SRCROOT)/sym/i386
+DSTROOT = $(SRCROOT)/dst/i386
+DOCROOT = $(SRCROOT)/doc
+IMGROOT = $(SRCROOT)/sym/cache
+IMGSKELROOT = $(SRCROOT)/imgskel
+CDBOOT = ${IMGROOT}/usr/standalone/i386/cdboot
+
+DIR = util
+include ${SRCROOT}/Make.rules
+
+
+
+OBJECTS = cconfig.o32 cconfig.o64 zconf.tab.o32 zconf.tab.o64 yesno.o32 yesno.o64 textbox.o32 textbox.o64 menubox.o32 menubox.o64 checklist.o32 checklist.o64 inputbox.o32 inputbox.o64
+
+DEFINES = -DKBUILD_NO_NLS -DCURSES_LOC=\<ncurses.h\> -DPATH_MAX=256 -DPACKAGE=\"chameleon\"
+LDFLAGS = -lncurses -lmenu
+
+
+PROGRAMS = cconfig
+
+
+
+SYMPROG = $(addprefix $(SYMROOT)/, $(PROGRAMS))
+
+DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
+
+all: $(DIRS_NEEDED) $(SYMPROG)
+
+
+
+
+$(SYMPROG): $(addprefix $(OBJROOT)/, $(OBJECTS))
+ @echo "\t[LD32] $(@F)_32"
+ @$(CC) $(CFLAGS) $(LDFLAGS) $(DEFINES) -arch i386 -o $(SYMROOT)/$(@F)_32 $(OBJROOT)/*.o32
+ @echo "\t[LD64] $(@F)_64"
+ @$(CC) $(CFLAGS) $(LDFLAGS) $(DEFINES) -arch x86_64 -o $(SYMROOT)/$(@F)_64 $(OBJROOT)/*.o64
+ @echo "\t[LIPO] $(@F)"
+ @lipo -create -arch i386 $(SYMROOT)/$(@F)_32 -arch x86_64 $(SYMROOT)/$(@F)_64 -output $(SYMROOT)/$(@F)
+ @$(RM) $(SYMROOT)/$(@F)_32 $(SYMROOT)/$(@F)_64
+
+config: $(DIRS_NEEDED) $(SYMPROG)
+ @cd ${SRCROOT} && $(SYMPROG) $(SRCROOT)/Cconfig
+
+.PHONY: config
+
+#dependencies
+-include $(OBJROOT)/Makedep
View
866 i386/config/cconfig.c
@@ -0,0 +1,866 @@
+/*
+ * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
+ * Released under the terms of the GNU GPL v2.0.
+ *
+ * Introduced single menu mode (show all sub-menus in one large tree).
+ * 2002-11-06 Petr Baudis <pasky@ucw.cz>
+ *
+ * i18n, 2005, Arnaldo Carvalho de Melo <acme@conectiva.com.br>
+ */
+
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <locale.h>
+
+#define LKC_DIRECT_LINK
+#include "lkc.h"
+#include "lxdialog/dialog.h"
+
+static const char mconf_readme[] = N_(
+ "Overview\n"
+ "--------\n"
+ "This interface let you select features and parameters for the build.\n"
+ "Features can either be built-in, modularized, or ignored. Parameters\n"
+ "must be entered in as decimal or hexadecimal numbers or text.\n"
+ "\n"
+ "Menu items beginning with following braces represent features that\n"
+ " [ ] can be built in or removed\n"
+ " < > can be built in, modularized or removed\n"
+ " { } can be built in or modularized (selected by other feature)\n"
+ " - - are selected by other feature,\n"
+ "while *, M or whitespace inside braces means to build in, build as\n"
+ "a module or to exclude the feature respectively.\n"
+ "\n"
+ "To change any of these features, highlight it with the cursor\n"
+ "keys and press <Y> to build it in, <M> to make it a module or\n"
+ "<N> to removed it. You may also press the <Space Bar> to cycle\n"
+ "through the available options (ie. Y->N->M->Y).\n"
+ "\n"
+ "Some additional keyboard hints:\n"
+ "\n"
+ "Menus\n"
+ "----------\n"
+ "o Use the Up/Down arrow keys (cursor keys) to highlight the item\n"
+ " you wish to change or submenu wish to select and press <Enter>.\n"
+ " Submenus are designated by \"--->\".\n"
+ "\n"
+ " Shortcut: Press the option's highlighted letter (hotkey).\n"
+ " Pressing a hotkey more than once will sequence\n"
+ " through all visible items which use that hotkey.\n"
+ "\n"
+ " You may also use the <PAGE UP> and <PAGE DOWN> keys to scroll\n"
+ " unseen options into view.\n"
+ "\n"
+ "o To exit a menu use the cursor keys to highlight the <Exit> button\n"
+ " and press <ENTER>.\n"
+ "\n"
+ " Shortcut: Press <ESC><ESC> or <E> or <X> if there is no hotkey\n"
+ " using those letters. You may press a single <ESC>, but\n"
+ " there is a delayed response which you may find annoying.\n"
+ "\n"
+ " Also, the <TAB> and cursor keys will cycle between <Select>,\n"
+ " <Exit> and <Help>.\n"
+ "\n"
+ "o To get help with an item, use the cursor keys to highlight <Help>\n"
+ " and press <ENTER>.\n"
+ "\n"
+ " Shortcut: Press <H> or <?>.\n"
+ "\n"
+ "o To toggle the display of hidden options, press <Z>.\n"
+ "\n"
+ "\n"
+ "Radiolists (Choice lists)\n"
+ "-----------\n"
+ "o Use the cursor keys to select the option you wish to set and press\n"
+ " <S> or the <SPACE BAR>.\n"
+ "\n"
+ " Shortcut: Press the first letter of the option you wish to set then\n"
+ " press <S> or <SPACE BAR>.\n"
+ "\n"
+ "o To see available help for the item, use the cursor keys to highlight\n"
+ " <Help> and Press <ENTER>.\n"
+ "\n"
+ " Shortcut: Press <H> or <?>.\n"
+ "\n"
+ " Also, the <TAB> and cursor keys will cycle between <Select> and\n"
+ " <Help>\n"
+ "\n"
+ "\n"
+ "Data Entry\n"
+ "-----------\n"
+ "o Enter the requested information and press <ENTER>\n"
+ " If you are entering hexadecimal values, it is not necessary to\n"
+ " add the '0x' prefix to the entry.\n"
+ "\n"
+ "o For help, use the <TAB> or cursor keys to highlight the help option\n"
+ " and press <ENTER>. You can try <TAB><H> as well.\n"
+ "\n"
+ "\n"
+ "Text Box (Help Window)\n"
+ "--------\n"
+ "o Use the cursor keys to scroll up/down/left/right. The VI editor\n"
+ " keys h,j,k,l function here as do <SPACE BAR> and <B> for those\n"
+ " who are familiar with less and lynx.\n"
+ "\n"
+ "o Press <E>, <X>, <Enter> or <Esc><Esc> to exit.\n"
+ "\n"
+ "\n"
+ "Alternate Configuration Files\n"
+ "-----------------------------\n"
+ "Menuconfig supports the use of alternate configuration files for\n"
+ "those who, for various reasons, find it necessary to switch\n"
+ "between different configurations.\n"
+ "\n"
+ "At the end of the main menu you will find two options. One is\n"
+ "for saving the current configuration to a file of your choosing.\n"
+ "The other option is for loading a previously saved alternate\n"
+ "configuration.\n"
+ "\n"
+ "Even if you don't use alternate configuration files, but you\n"
+ "find during a Menuconfig session that you have completely messed\n"
+ "up your settings, you may use the \"Load Alternate...\" option to\n"
+ "restore your previously saved settings from \".config\" without\n"
+ "restarting Menuconfig.\n"
+ "\n"
+ "Other information\n"
+ "-----------------\n"
+ "If you use Menuconfig in an XTERM window make sure you have your\n"
+ "$TERM variable set to point to a xterm definition which supports color.\n"
+ "Otherwise, Menuconfig will look rather bad. Menuconfig will not\n"
+ "display correctly in a RXVT window because rxvt displays only one\n"
+ "intensity of color, bright.\n"
+ "\n"
+ "Menuconfig will display larger menus on screens or xterms which are\n"
+ "set to display more than the standard 25 row by 80 column geometry.\n"
+ "In order for this to work, the \"stty size\" command must be able to\n"
+ "display the screen's current row and column geometry. I STRONGLY\n"
+ "RECOMMEND that you make sure you do NOT have the shell variables\n"
+ "LINES and COLUMNS exported into your environment. Some distributions\n"
+ "export those variables via /etc/profile. Some ncurses programs can\n"
+ "become confused when those variables (LINES & COLUMNS) don't reflect\n"
+ "the true screen size.\n"
+ "\n"
+ "Optional personality available\n"
+ "------------------------------\n"
+ "If you prefer to have all of the options listed in a single menu, rather\n"
+ "than the default multimenu hierarchy, run the menuconfig with\n"
+ "MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
+ "\n"
+ "make MENUCONFIG_MODE=single_menu menuconfig\n"
+ "\n"
+ "<Enter> will then unroll the appropriate category, or enfold it if it\n"
+ "is already unrolled.\n"
+ "\n"
+ "Note that this mode can eventually be a little more CPU expensive\n"
+ "(especially with a larger number of unrolled categories) than the\n"
+ "default mode.\n"
+ "\n"
+ "Different color themes available\n"
+ "--------------------------------\n"
+ "It is possible to select different color themes using the variable\n"
+ "MENUCONFIG_COLOR. To select a theme use:\n"
+ "\n"
+ "make MENUCONFIG_COLOR=<theme> menuconfig\n"
+ "\n"
+ "Available themes are\n"
+ " mono => selects colors suitable for monochrome displays\n"
+ " blackbg => selects a color scheme with black background\n"
+ " classic => theme with blue background. The classic look\n"
+ " bluetitle => a LCD friendly version of classic. (default)\n"
+ "\n"),
+menu_instructions[] = N_(
+ "Arrow keys navigate the menu. "
+ "<Enter> selects submenus --->. "
+ "Highlighted letters are hotkeys. "
+ "Pressing <Y> includes, <N> excludes, <M> modularizes features. "
+ "Press <Esc><Esc> to exit, <?> for Help, </> for Search. "
+ "Legend: [*] built-in [ ] excluded <M> module < > module capable"),
+radiolist_instructions[] = N_(
+ "Use the arrow keys to navigate this window or "
+ "press the hotkey of the item you wish to select "
+ "followed by the <SPACE BAR>. "
+ "Press <?> for additional information about this option."),
+inputbox_instructions_int[] = N_(
+ "Please enter a decimal value. "
+ "Fractions will not be accepted. "
+ "Use the <TAB> key to move from the input field to the buttons below it."),
+inputbox_instructions_hex[] = N_(
+ "Please enter a hexadecimal value. "
+ "Use the <TAB> key to move from the input field to the buttons below it."),
+inputbox_instructions_string[] = N_(
+ "Please enter a string value. "
+ "Use the <TAB> key to move from the input field to the buttons below it."),
+setmod_text[] = N_(
+ "This feature depends on another which has been configured as a module.\n"
+ "As a result, this feature will be built as a module."),
+load_config_text[] = N_(
+ "Enter the name of the configuration file you wish to load. "
+ "Accept the name shown to restore the configuration you "
+ "last retrieved. Leave blank to abort."),
+load_config_help[] = N_(
+ "\n"
+ "For various reasons, one may wish to keep several different\n"
+ "configurations available on a single machine.\n"
+ "\n"
+ "If you have saved a previous configuration in a file other than the\n"
+ "default one, entering its name here will allow you to modify that\n"
+ "configuration.\n"
+ "\n"
+ "If you are uncertain, then you have probably never used alternate\n"
+ "configuration files. You should therefore leave this blank to abort.\n"),
+save_config_text[] = N_(
+ "Enter a filename to which this configuration should be saved "
+ "as an alternate. Leave blank to abort."),
+save_config_help[] = N_(
+ "\n"
+ "For various reasons, one may wish to keep different configurations\n"
+ "available on a single machine.\n"
+ "\n"
+ "Entering a file name here will allow you to later retrieve, modify\n"
+ "and use the current configuration as an alternate to whatever\n"
+ "configuration options you have selected at that time.\n"
+ "\n"
+ "If you are uncertain what all this means then you should probably\n"
+ "leave this blank.\n"),
+search_help[] = N_(
+ "\n"
+ "Search for symbols and display their relations.\n"
+ "Regular expressions are allowed.\n"
+ "Example: search for \"^FOO\"\n"
+ "Result:\n"
+ "-----------------------------------------------------------------\n"
+ "Symbol: FOO [=m]\n"
+ "Prompt: Foo bus is used to drive the bar HW\n"
+ "Defined at drivers/pci/Kconfig:47\n"
+ "Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n"
+ "Location:\n"
+ " -> Bus options (PCI, PCMCIA, EISA, MCA, ISA)\n"
+ " -> PCI support (PCI [=y])\n"
+ " -> PCI access mode (<choice> [=y])\n"
+ "Selects: LIBCRC32\n"
+ "Selected by: BAR\n"
+ "-----------------------------------------------------------------\n"
+ "o The line 'Prompt:' shows the text used in the menu structure for\n"
+ " this symbol\n"
+ "o The 'Defined at' line tell at what file / line number the symbol\n"
+ " is defined\n"
+ "o The 'Depends on:' line tell what symbols needs to be defined for\n"
+ " this symbol to be visible in the menu (selectable)\n"
+ "o The 'Location:' lines tell where in the menu structure this symbol\n"
+ " is located\n"
+ " A location followed by a [=y] indicate that this is a selectable\n"
+ " menu item - and current value is displayed inside brackets.\n"
+ "o The 'Selects:' line tell what symbol will be automatically\n"
+ " selected if this symbol is selected (y or m)\n"
+ "o The 'Selected by' line tell what symbol has selected this symbol\n"
+ "\n"
+ "Only relevant lines are shown.\n"
+ "\n\n"
+ "Search examples:\n"
+ "Examples: USB => find all symbols containing USB\n"
+ " ^USB => find all symbols starting with USB\n"
+ " USB$ => find all symbols ending with USB\n"
+ "\n");
+
+static int indent;
+static struct menu *current_menu;
+static int child_count;
+static int single_menu_mode;
+static int show_all_options;
+
+static void conf(struct menu *menu);
+static void conf_choice(struct menu *menu);
+static void conf_string(struct menu *menu);
+static void conf_load(void);
+static void conf_save(void);
+static void show_textbox(const char *title, const char *text, int r, int c);
+static void show_helptext(const char *title, const char *text);
+static void show_help(struct menu *menu);
+
+static char filename[PATH_MAX+1];
+static void set_config_filename(const char *config_filename)
+{
+ static char menu_backtitle[PATH_MAX+128];
+ int size;
+
+ size = snprintf(menu_backtitle, sizeof(menu_backtitle),
+ "%s - %s", config_filename, rootmenu.prompt->text);
+ if (size >= sizeof(menu_backtitle))
+ menu_backtitle[sizeof(menu_backtitle)-1] = '\0';
+ set_dialog_backtitle(menu_backtitle);
+
+ size = snprintf(filename, sizeof(filename), "%s", config_filename);
+ if (size >= sizeof(filename))
+ filename[sizeof(filename)-1] = '\0';
+}
+
+
+static void search_conf(void)
+{
+ struct symbol **sym_arr;
+ struct gstr res;
+ char *dialog_input;
+ int dres;
+again:
+ dialog_clear();
+ dres = dialog_inputbox(_("Search Configuration Parameter"),
+ _("Enter " CONFIG_ " (sub)string to search for "
+ "(with or without \"" CONFIG_ "\")"),
+ 10, 75, "");
+ switch (dres) {
+ case 0:
+ break;
+ case 1:
+ show_helptext(_("Search Configuration"), search_help);
+ goto again;
+ default:
+ return;
+ }
+
+ /* strip the prefix if necessary */
+ dialog_input = dialog_input_result;
+ if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
+ dialog_input += strlen(CONFIG_);
+
+ sym_arr = sym_re_search(dialog_input);
+ res = get_relations_str(sym_arr);
+ free(sym_arr);
+ show_textbox(_("Search Results"), str_get(&res), 0, 0);
+ str_free(&res);
+}
+
+static void build_conf(struct menu *menu)
+{
+ struct symbol *sym;
+ struct property *prop;
+ struct menu *child;
+ int type, tmp, doint = 2;
+ tristate val;
+ char ch;
+ bool visible;
+
+ /*
+ * note: menu_is_visible() has side effect that it will
+ * recalc the value of the symbol.
+ */
+ visible = menu_is_visible(menu);
+ if (show_all_options && !menu_has_prompt(menu))
+ return;
+ else if (!show_all_options && !visible)
+ return;
+
+ sym = menu->sym;
+ prop = menu->prompt;
+ if (!sym) {
+ if (prop && menu != current_menu) {
+ const char *prompt = menu_get_prompt(menu);
+ switch (prop->type) {
+ case P_MENU:
+ child_count++;
+ prompt = _(prompt);
+ if (single_menu_mode) {
+ item_make("%s%*c%s",
+ menu->data ? "-->" : "++>",
+ indent + 1, ' ', prompt);
+ } else
+ item_make(" %*c%s --->", indent + 1, ' ', prompt);
+
+ item_set_tag('m');
+ item_set_data(menu);
+ if (single_menu_mode && menu->data)
+ goto conf_childs;
+ return;
+ case P_COMMENT:
+ if (prompt) {
+ child_count++;
+ item_make(" %*c*** %s ***", indent + 1, ' ', _(prompt));
+ item_set_tag(':');
+ item_set_data(menu);
+ }
+ break;
+ default:
+ if (prompt) {
+ child_count++;
+ item_make("---%*c%s", indent + 1, ' ', _(prompt));
+ item_set_tag(':');
+ item_set_data(menu);
+ }
+ }
+ } else
+ doint = 0;
+ goto conf_childs;
+ }
+
+ type = sym_get_type(sym);
+ if (sym_is_choice(sym)) {
+ struct symbol *def_sym = sym_get_choice_value(sym);
+ struct menu *def_menu = NULL;
+
+ child_count++;
+ for (child = menu->list; child; child = child->next) {
+ if (menu_is_visible(child) && child->sym == def_sym)
+ def_menu = child;
+ }
+
+ val = sym_get_tristate_value(sym);
+ if (sym_is_changable(sym)) {
+ switch (type) {
+ case S_BOOLEAN:
+ item_make("[%c]", val == no ? ' ' : '*');
+ break;
+ case S_TRISTATE:
+ switch (val) {
+ case yes: ch = '*'; break;
+ case mod: ch = 'M'; break;
+ default: ch = ' '; break;
+ }
+ item_make("<%c>", ch);
+ break;
+ }
+ item_set_tag('t');
+ item_set_data(menu);
+ } else {
+ item_make(" ");
+ item_set_tag(def_menu ? 't' : ':');
+ item_set_data(menu);
+ }
+
+ item_add_str("%*c%s", indent + 1, ' ', _(menu_get_prompt(menu)));
+ if (val == yes) {
+ if (def_menu) {
+ item_add_str(" (%s)", _(menu_get_prompt(def_menu)));
+ item_add_str(" --->");
+ if (def_menu->list) {
+ indent += 2;
+ build_conf(def_menu);
+ indent -= 2;
+ }
+ }
+ return;
+ }
+ } else {
+ if (menu == current_menu) {
+ item_make("---%*c%s", indent + 1, ' ', _(menu_get_prompt(menu)));
+ item_set_tag(':');
+ item_set_data(menu);
+ goto conf_childs;
+ }
+ child_count++;
+ val = sym_get_tristate_value(sym);
+ if (sym_is_choice_value(sym) && val == yes) {
+ item_make(" ");
+ item_set_tag(':');
+ item_set_data(menu);
+ } else {
+ switch (type) {
+ case S_BOOLEAN:
+ if (sym_is_changable(sym))
+ item_make("[%c]", val == no ? ' ' : '*');
+ else
+ item_make("-%c-", val == no ? ' ' : '*');
+ item_set_tag('t');
+ item_set_data(menu);
+ break;
+ case S_TRISTATE:
+ switch (val) {
+ case yes: ch = '*'; break;
+ case mod: ch = 'M'; break;
+ default: ch = ' '; break;
+ }
+ if (sym_is_changable(sym)) {
+ if (sym->rev_dep.tri == mod)
+ item_make("{%c}", ch);
+ else
+ item_make("<%c>", ch);
+ } else
+ item_make("-%c-", ch);
+ item_set_tag('t');
+ item_set_data(menu);
+ break;
+ default:
+ tmp = 2 + strlen(sym_get_string_value(sym)); /* () = 2 */
+ item_make("(%s)", sym_get_string_value(sym));
+ tmp = indent - tmp + 4;
+ if (tmp < 0)
+ tmp = 0;
+ item_add_str("%*c%s%s", tmp, ' ', _(menu_get_prompt(menu)),
+ (sym_has_value(sym) || !sym_is_changable(sym)) ?
+ "" : _(" (NEW)"));
+ item_set_tag('s');
+ item_set_data(menu);
+ goto conf_childs;
+ }
+ }
+ item_add_str("%*c%s%s", indent + 1, ' ', _(menu_get_prompt(menu)),
+ (sym_has_value(sym) || !sym_is_changable(sym)) ?
+ "" : _(" (NEW)"));
+ if (menu->prompt->type == P_MENU) {
+ item_add_str(" --->");
+ return;
+ }
+ }
+
+conf_childs:
+ indent += doint;
+ for (child = menu->list; child; child = child->next)
+ build_conf(child);
+ indent -= doint;
+}
+
+static void conf(struct menu *menu)
+{
+ struct menu *submenu;
+ const char *prompt = menu_get_prompt(menu);
+ struct symbol *sym;
+ struct menu *active_menu = NULL;
+ int res;
+ int s_scroll = 0;
+
+ while (1) {
+ item_reset();
+ current_menu = menu;
+ build_conf(menu);
+ if (!child_count)
+ break;
+ if (menu == &rootmenu) {
+ item_make("--- ");
+ item_set_tag(':');
+ item_make(_(" Load an Alternate Configuration File"));
+ item_set_tag('L');
+ item_make(_(" Save an Alternate Configuration File"));
+ item_set_tag('S');
+ }
+ dialog_clear();
+ res = dialog_menu(prompt ? _(prompt) : _("Main Menu"),
+ _(menu_instructions),
+ active_menu, &s_scroll);
+ if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL)
+ break;
+ if (!item_activate_selected())
+ continue;
+ if (!item_tag())
+ continue;
+
+ submenu = item_data();
+ active_menu = item_data();
+ if (submenu)
+ sym = submenu->sym;
+ else
+ sym = NULL;
+
+ switch (res) {
+ case 0:
+ switch (item_tag()) {
+ case 'm':
+ if (single_menu_mode)
+ submenu->data = (void *) (long) !submenu->data;
+ else
+ conf(submenu);
+ break;
+ case 't':
+ if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)
+ conf_choice(submenu);
+ else if (submenu->prompt->type == P_MENU)
+ conf(submenu);
+ break;
+ case 's':
+ conf_string(submenu);
+ break;
+ case 'L':
+ conf_load();
+ break;
+ case 'S':
+ conf_save();
+ break;
+ }
+ break;
+ case 2:
+ if (sym)
+ show_help(submenu);
+ else
+ show_helptext(_("README"), _(mconf_readme));
+ break;
+ case 3:
+ if (item_is_tag('t')) {
+ if (sym_set_tristate_value(sym, yes))
+ break;
+ if (sym_set_tristate_value(sym, mod))
+ show_textbox(NULL, setmod_text, 6, 74);
+ }
+ break;
+ case 4:
+ if (item_is_tag('t'))
+ sym_set_tristate_value(sym, no);
+ break;
+ case 5:
+ if (item_is_tag('t'))
+ sym_set_tristate_value(sym, mod);
+ break;
+ case 6:
+ if (item_is_tag('t'))
+ sym_toggle_tristate_value(sym);
+ else if (item_is_tag('m'))
+ conf(submenu);
+ break;
+ case 7:
+ search_conf();
+ break;
+ case 8:
+ show_all_options = !show_all_options;
+ break;
+ }
+ }
+}
+
+static void show_textbox(const char *title, const char *text, int r, int c)
+{
+ dialog_clear();
+ dialog_textbox(title, text, r, c);
+}
+
+static void show_helptext(const char *title, const char *text)
+{
+ show_textbox(title, text, 0, 0);
+}
+
+static void show_help(struct menu *menu)
+{
+ struct gstr help = str_new();
+
+ help.max_width = getmaxx(stdscr) - 10;
+ menu_get_ext_help(menu, &help);
+
+ show_helptext(_(menu_get_prompt(menu)), str_get(&help));
+ str_free(&help);
+}
+
+static void conf_choice(struct menu *menu)
+{
+ const char *prompt = _(menu_get_prompt(menu));
+ struct menu *child;
+ struct symbol *active;
+
+ active = sym_get_choice_value(menu->sym);
+ while (1) {
+ int res;
+ int selected;
+ item_reset();
+
+ current_menu = menu;
+ for (child = menu->list; child; child = child->next) {
+ if (!menu_is_visible(child))
+ continue;
+ if (child->sym)
+ item_make("%s", _(menu_get_prompt(child)));
+ else {
+ item_make("*** %s ***", _(menu_get_prompt(child)));
+ item_set_tag(':');
+ }
+ item_set_data(child);
+ if (child->sym == active)
+ item_set_selected(1);
+ if (child->sym == sym_get_choice_value(menu->sym))
+ item_set_tag('X');
+ }
+ dialog_clear();
+ res = dialog_checklist(prompt ? _(prompt) : _("Main Menu"),
+ _(radiolist_instructions),
+ 15, 70, 6);
+ selected = item_activate_selected();
+ switch (res) {
+ case 0:
+ if (selected) {
+ child = item_data();
+ if (!child->sym)
+ break;
+
+ sym_set_tristate_value(child->sym, yes);
+ }
+ return;
+ case 1:
+ if (selected) {
+ child = item_data();
+ show_help(child);
+ active = child->sym;
+ } else
+ show_help(menu);
+ break;
+ case KEY_ESC:
+ return;
+ case -ERRDISPLAYTOOSMALL:
+ return;
+ }
+ }
+}
+
+static void conf_string(struct menu *menu)
+{
+ const char *prompt = menu_get_prompt(menu);
+
+ while (1) {
+ int res;
+ const char *heading;
+
+ switch (sym_get_type(menu->sym)) {
+ case S_INT:
+ heading = _(inputbox_instructions_int);
+ break;
+ case S_HEX:
+ heading = _(inputbox_instructions_hex);
+ break;
+ case S_STRING:
+ heading = _(inputbox_instructions_string);
+ break;
+ default:
+ heading = _("Internal mconf error!");
+ }
+ dialog_clear();
+ res = dialog_inputbox(prompt ? _(prompt) : _("Main Menu"),
+ heading, 10, 75,
+ sym_get_string_value(menu->sym));
+ switch (res) {
+ case 0:
+ if (sym_set_string_value(menu->sym, dialog_input_result))
+ return;
+ show_textbox(NULL, _("You have made an invalid entry."), 5, 43);
+ break;
+ case 1:
+ show_help(menu);
+ break;
+ case KEY_ESC:
+ return;
+ }
+ }
+}
+
+static void conf_load(void)
+{
+
+ while (1) {
+ int res;
+ dialog_clear();
+ res = dialog_inputbox(NULL, load_config_text,
+ 11, 55, filename);
+ switch(res) {
+ case 0:
+ if (!dialog_input_result[0])
+ return;
+ if (!conf_read(dialog_input_result)) {
+ set_config_filename(dialog_input_result);
+ sym_set_change_count(1);
+ return;
+ }
+ show_textbox(NULL, _("File does not exist!"), 5, 38);
+ break;
+ case 1:
+ show_helptext(_("Load Alternate Configuration"), load_config_help);
+ break;
+ case KEY_ESC:
+ return;
+ }
+ }
+}
+
+static void conf_save(void)
+{
+ while (1) {
+ int res;
+ dialog_clear();
+ res = dialog_inputbox(NULL, save_config_text,
+ 11, 55, filename);
+ switch(res) {
+ case 0:
+ if (!dialog_input_result[0])
+ return;
+ if (!conf_write(dialog_input_result)) {
+ set_config_filename(dialog_input_result);
+ return;
+ }
+ show_textbox(NULL, _("Can't create file! Probably a nonexistent directory."), 5, 60);
+ break;
+ case 1:
+ show_helptext(_("Save Alternate Configuration"), save_config_help);
+ break;
+ case KEY_ESC:
+ return;
+ }
+ }
+
+}
+
+int main(int ac, char **av)
+{
+ int saved_x, saved_y;
+ char *mode;
+ int res;
+
+ setlocale(LC_ALL, "");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+
+ conf_parse(av[1]);
+ conf_read(NULL);
+
+ mode = getenv("MENUCONFIG_MODE");
+ if (mode) {
+ if (!strcasecmp(mode, "single_menu"))
+ single_menu_mode = 1;
+ }
+
+ initscr();
+
+ getyx(stdscr, saved_y, saved_x);
+ if (init_dialog(NULL)) {
+ fprintf(stderr, N_("Your display is too small to run Menuconfig!\n"));
+ fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n"));
+ return 1;
+ }
+
+ set_config_filename(conf_get_configname());
+ do {
+ conf(&rootmenu);