Index: branches/azimutz/Chazi/doc-azi/CHANGES.txt =================================================================== --- branches/azimutz/Chazi/doc-azi/CHANGES.txt (revision 0) +++ branches/azimutz/Chazi/doc-azi/CHANGES.txt (revision 815) @@ -0,0 +1,398 @@ +Note: this text doesn't use the "most recent layout" of the main Chameleon CHANGES file. + Also, not all the changes done on the code will end up here, for obvious reasons. + + Branch copied from /trunk @ rev 264. + + ---------------//---------------//--------------- + +- (rev 299) +Change: added hands-off (without user intervention) setting of EFI32 values, for 32 bit only + processors. Works according to the architecture in use, either chosen by the booter or + forced by user. + + Note: on pre 10.6 systems, the default EFI values used for 64 bit processors while booting i386 + arch (only arch on these systems), will still be EFI64, which causes absolutely no problem. + EFI32 values still can be forced by using the respective booter flag. + Tested only on Leopard. + + Note: there's a typo on the comment of rev 299 commit; + RC3 should read RC4. + +Motif: fixes http://forge.voodooprojects.org/p/chameleon/issues/21/. + + Note: included on the trunk at revs 449 & 450 :) Thanks! + + ---------------//---------------//--------------- + +- (rev 320) +Change: using the original code i suggested to Mozodojo, for memory modules Part Number extraction. + (http://www.projectosx.com/forum/index.php?s=&showtopic=1337&view=findpost&p=8809) + +Motif: If i don't do: + + if (isspace(sPart[i])) + break; + + i get extra characters that don't belong to the Part Number, according to CPU-Z or + Everest. This is consistent on the 2 brands of modules i own, Qimonda & Kingston + and others i saw on some user reports. + If someone wishes to test this, contact me and i'll cook a booter to help debug + this behavior. + + ---------------//---------------//--------------- + +- (rev 321) +Change: a tweak that got hidden on this commit; changed RestartFix from true to false, by default. + +Motif: this goes against at least one of my "Guidelines" for the booter! + (check README.txt). It's absolutely not needed by all users! If someone proves that this is + needed by more than 50% of the motherboards Chameleon needs to handle atm + (recommended OSx86 motherboards don't count), then i'll change it back to true. + + ---------------//---------------//--------------- + +- (rev 335) (REVERTED to trunk way, rev 520) +Change: merged the educational side of arch=i386 + the practical one of -x32, into a simple 32 + booter flag. + + Note: -x32 was removed from trunk on rev 377. + + Note: only useful on 64 bit processors. + 32 bit only processors, will cause i386 arch to be loaded by default. + +Motif: 2 keys to do the same, should never had happen! + I really think that arch=i386 is a more "educational" definition, since what we're really + doing here is select an architecture to boot, but while reading the Chameleon TODO + "Integrate... quick shortcut modified version of 18seven" and knowing that these shortcuts + use the 3 + 2 key combination to select i386 arch, i can't avoid to think, + why not extend it to the boot prompt now!? + + ---------------//---------------//--------------- + +- (rev 335) (REMOVED, rev 520) +Change: added -legacy kernel flag. This flag tells the booter to load i386 arch before is passed to + the kernel. This procedure only needs to be done on Snow Leopard. -legacy tells the kernel + to disable "64 Bit Mode", which allows 64 bit processors to run 64 bit apps under i386 + mach kernel. + + Type -legacy to get you booted into Legacy Mode. + + Note: only useful on 64 bit processors. + + Note: just out of curiosity and for those who don't know, Legacy Mode is in fact the mode used + by 32 bit "only" processors! Since OS X kernel can handle 64 bit apps even on i386 arch, + 64 bit processors need this flag to disable any handling of 64 bit instructions, when + "emulating a full" 32 bit environment. + +Motif: this flag was not being passed on > 10.6; the reason why, is this mode is only available + under i386 arch. So, while testing Meklort's kernel patcher, i felt the need to add this key. + + ---------------//---------------//--------------- + +- (rev 335) (REVERTED to trunk way, rev 520) +Change: added 64 bit booter flag, to keep company to the 32 one :) + +Motif: mainly to override 32 or -legacy if they are flagged on the Boot.plist. + Like -legacy, was born while testing kernel builds and with the need to do the above. + + ---------------//---------------//--------------- + +- (rev 336) +Change: removed 3 keys to handle PCI Root UID, two of them executing the exact same code + (PCIRootUID & PciRoot). Kept just the already existing PciRoot=, plus the new code. + + 0 is still the default value, use the key to set any other. + +Motif: these many keys, should never had happened! + This came along when the Asere code was ported to Chameleon, but even on Asere's booter, + what's the point? Compatibility? None, it's seems! + The only key in use on Asere's booter is PCIRootUID. The others are commented out. + + ---------------//---------------//--------------- + +- (revs 337 --> 360) +Changes: file loading related (search algo). The short story: + + Change: added a key to disable "override" Boot.plist from overriding the values on the "default" + Boot.plist. Only the values overriding is disabled, not the file loading. + + CanOverride=n disables overriding of the default Boot.plist values. + + Note: as far as i know, loading a override Boot.plist is not mandatory! + Please correct me if i'm wrong. + + Motif: just in case ;) + I was totally unaware of this Boot.plist override for a long time; this messed with my mind + a lot of times! too many. So the first thing i did to the booter when i had the chance, + was make sure i had this under control. + The problem: + - first path checked: rd(0,0)/Extra/com.apple.Boot.plist + nice, override Boot.plist can be loaded from a ramdisk. + - second path: /Extra/com.apple.Boot.plist (the plist on Selected volume) + great, if we have the booter installed on a usb stick, that by the way it's the + main device used these days to hold a rescue booter, the Boot.plist on it will be + ignored (unlike one on a ramdisk) and the one on Selected volume loaded. + - and there's no way to override it (config= is not working). + This can cause all sorts of anxiety and panic attacks, if you are unaware of this + like many people are. + + Note: This key it's not mentioned on BootHelp.txt on purpose, since it's not needed + with my actual booter configuration. + + ---------------//---------------//--------------- + + Change: added a key to allow overriding the default paths to load Extra extensions. + kext=/path-to-folder/ loads drivers from an alternate folder. + + e.g. kext=/Extra/test/ + + Note: this key needs to point to a "folder" with either a Extensions sub folder or a + Extensions.mkext kext cache, thus always ends with / (slash). + + Note: there's a typo on the comment of rev 337 commit; + Extensions=/path-to-folder/ should be read like kext=/path-to-folder/. + + Motif: there was no key to do this. (read next) + + ---------------//---------------//--------------- + + Change: added a "new" search algo, to load Extra extensions. + Pros: + - hands-off search of all main files. If you don't want a certain file to be loaded, + just don't place it on a default searched path (as usual) or override it with key. + First file found, is the one loaded. + Check FileLoad.txt for info on searched paths. + - easy to configure with other paths. + - easy add to another file load functions. + - no ambiguous paths!! It's bt(0,0) or nothing! (yeah, i'll explain this else were). + - consistency across all file loading. + + Cons: + - none that i could test, so far. The only booter install configuration that i can't + really test is RAID. + + Motif: after adding the kext= key, i still couldn't override the Extra extensions loaded from + the Selected volume, in case they were messed up and i needed to load another set from + else were. It happens that similarly as with override Boot.plist, /Extra/Extensions + (or /Extra/Extensions.mkext) is the first path to be checked on a HDD and worse, + there's no argument to limit the action; this path is ALWAYS checked and if files are + found they are loaded and will override any other files loaded from another path, like a + ramdisk (only path checked before /Extra/Extensions), making a recovery much more + complicated (not impossible). + So, according to at least one of my guidelines (simplify booter use as much as possible), + changes to the code are/were needed. + This algo was initially a merge between the search algo found on search_and_get_acpi_fd() + (acpi_patcher.c), to load ACPI table and the one on LoadDrivers() (driver.c); also, the + /Extra/* path was still included. I tried a long time playing with the used arguments + (and others) to keep this path, as all i wanted was to give another priority to the file + loading, but there was always problems; a file that kept defaulting to the Booter volume + when i was trying to load it from Selected volume or the other way around. + So, as i always wanted to try taking advantage of Chameleon's ability to load files + from specific OS folders (e.g. /Extra/10.5), i gave it a try and here is the outcome. + + Note: it doesn't make any sense taking advantage of this specific OS folders and still check + the Selected volume. Thus except for the obvious files like kernel, SystemVersion.plist, + system caches, etc..., no other file is loaded from Selected volume (paths started with / ). + To put it simple, as an example, when installed to a usb stick, this booter will not search + for any files on the Extra folder of the volume were the system is installed! + Or in other words, the booter will only check the Extra folder on the booter volume + (paths started with bt(0,0) ), the usb stick in this example. + Anyway, /Extra paths can still be passed with the use of override keys! + + ---------------//---------------//--------------- + + Change: expanded this "new" search algo to dsdt.aml and smbios.plist. + + Note: same override keys used. + + Motif: check Guidelines. + + ---------------//---------------//--------------- + + Change: tweaked the loading of override Boot.plist (loadOverrideConfig(), stringTable.c) according + the new search algo guideline: everything loads from Booter volume. + The search for this file was also extended to specific OS folders, to "emulate" the search + on Selected volume. Also added a verbose message to signal when user doesn't provide a + override plist. + + Note: again, as far as i know, loading a override Boot.plist is not mandatory! + + Motif: payback for all the neurons i burned while i was not aware of override Boot.plist function!! + Not kidding :P + + ---------------//---------------//--------------- + + Change: reactivated config= key, included on loadOverrideConfig changes. + config= loads override plist from specified path. + + e.g. config=/Extra/test.plist + + Note: with the introduction of this key, all main files can now be overrided by the user. + + Motif: the key wasn't working anymore and it's useful. + + ---------------//---------------//--------------- + + Don't forget to check FileLoad.txt/FileLoad-trunk.txt for detailed info on file loading search paths + + ---------------//---------------//--------------- + +- (rev 419) +Change: started adding documentation, with the creation of a dedicated folder, doc-azi. It would get very + messy mixing these with main Chameleon documentation and as i want to keep things as clean as + possible on CleanCut, thought a separate folder would be better idea. + +Motif: do i need to say? :) i thought so. + + ---------------//---------------//--------------- + +- (rev 427) +Change: removed Chameleon.xcodeproj. + +Motif: it's not up to date and i need time to update it properly, at least on Chazi. + Will reintroduce it later in the process. It's also giving me problems with the svn client + when i update it; need to check what i'm doing wrong!? + + ---------------//---------------//--------------- + +- (rev 460) +Change: added a key to display some debug info, that can only be accessed via code edit. + Check http://forge.voodooprojects.org/p/chameleon/issues/12/ for history. + mm & attr, resolution specific info, are borrowed from autoResolution branch. + + DebugInfo=y enables display of debug info. + + Note: Boot Banner(*)=n will override DebugInfo=y , disabling the display of this info. + Disabled by default. + +Motif: just making this info easily accessible. + + ---------------//---------------//--------------- + ---------------//---------------//--------------- + +- (rev 462) +Change: creation of this project, replacing Chazileon as my work folder; + hence, Chazileon is now frozen until archival and deletion. + +Motif: Chazileon (Chazi) has no svn history. + + ---------------//---------------//--------------- + +- (revs 465 --> 467, 469 --> 471) +Change: added AutoResolution patch, by Lebidou (autoResolution branch). The main intention of this + patch, is allowing native resolution after boot, even without graphics acceleration (qe/ci). + The "side effect" is that it also enables native resolution at boot prompt (Gui). + The con: doesn't work for all devices!! + + AutoResolution=y enables the patch. + + Note: Obviously, it only works in Graphics Mode (Gui). + + Note: resolution set on theme.plist is overriding the native one set by AutoResolution. For now the + possible solutions are, remove the boot resolution (boot_width, boot_height) from theme.plist + or add Graphics Mode= to com.appleBoot.plist. reminder: "" + +Motif: ... mentioned above. Check the topic for more details: + http://forum.voodooprojects.org/index.php/topic,1227.0.html + + ---------------//---------------//--------------- + +- (starting at rev 480) +Change: added Meklort's Modules support, plus Kernel Patcher (Kpatcher) module. + + PatchKernel=y enables Kernel Patcher. + + Note: Check Modules.txt for more info. + +Motif: Testing Modules support. + + ---------------//---------------//--------------- + +- (rev 520) +Change: removed -legacy flag interaction with the booter and reverted 32/64 flags to the trunk way. + + Type arch=i386 to load i386 kernel architecture. + arch=x86_64 overrides i386 arch, if flagged on Boot.plist. + On Snow type arch=i386 -legacy to load i386 arch Legacy Mode. + +Motif: don't want to contribute to confusion... and laziness ;) + + ---------------//---------------//--------------- + +- (rev 524) +Change: Added GraphicsEnabler module. Needs no introduction :) + Feedback is welcome. + Working as usual with my ATI Radeon X1300 openGL engine, doing the injection thing. + + Newsflash: looks like it's raining modules over Meklort's branch :D + +Motif: --- + + ---------------//---------------//--------------- + +- (rev 526) +Change: Added Memory detection module. Also needs no intro... + Working properly with my controler: + Intel Corporation 82945G/GZ/P/PL Memory Controller Hub [8086:2770] (rev 02) + +Motif: --- + + ---------------//---------------//--------------- + + Note: latest changes need a call for ATTENTION; the bootloader install procedure is gaining + new steps! So far, we wre just playing with KernelPatcher module, which most people + don't use. Check Modules.txt for info on installing modules. + + ---------------//---------------//--------------- + + Been a while since i last updated this file, as there were no major events to justify + doing so. There was however some activity, which deserves to be mentioned; resuming + the most relevant: + + - changed all the /Extra... paths to bt(0,0)/Extra... according to my approach to file + loading. I also spent time checking the code involved, which already revealed some BS + on this approach; the research isn't complete so, more news later. + + - (rev 592) disabled the limit to hide only foreign partitions. Did this mostly for + testing purposes as i don't have any "foreign" partition/s to hide. I understand the + logic behind this limit, but i just can't avoid to ask my self why? + + - studied and played a lot with AutoResolution code. No new functionality, just tweaked + the way it interacts with the booter, wich fixed some glitches and lost functionality, + mostly due to lack of maintenance to fit the changes on the trunk. Next on the plan it's + converting this code into a module, which i already started lining up. + Will add specific info soon. + + - (rev 614) Doubled the size of memory reserved for booter log, which is more than enough + to hold the full log generated booting with -f argument and turns out to also be a fix + for some problems related with -f arg boot. + Trunk'ed on rev 616. + + ---------------//---------------//--------------- + +- (rev 625) +Change: Added HPET module, another existing patch converted to the modules cause. This carries + some new code to force enable HPET on VIA chipsets, contributed by bogdan-x86 + (http://forum.voodooprojects.org/index.php/topic,1596.0.html). + Also carries any notebook support added by Meklort. + + Note: Changed DEBUG_HPET messages to verbose. Don't feel i's necessary in this case, unless + some user of the patch get's annoyed by seeing them all time, when booting verbose!? + Else, they only print if ForceHPET=y is used. + +Motif: --- + + ---------------//---------------//--------------- + +- (rev ) +Change: template + +Motif: + + ---------------//---------------//--------------- + + + +Azimutz + + Index: branches/azimutz/Chazi/doc-azi/Modules.txt =================================================================== --- branches/azimutz/Chazi/doc-azi/Modules.txt (revision 0) +++ branches/azimutz/Chazi/doc-azi/Modules.txt (revision 815) @@ -0,0 +1,112 @@ + ---------------// Modules Info //--------------- + +Installation: + + - get the source, compile; find modules at /sym/i386, with .dylib file extension. + + - create an /Extra/modules folder on the volume from were the booter is going to load from, + copy Symbols.dylib (mandatory) to modules folder, plus any other module you wish to load. + + - update boot file or reinstall the booter completely, as needed. + + Note: GraphicsEnabler, MemDetect & ForceHPET patches are now converted to modules. + + +How to use? + + - Just check if a key is needed to activate the functionality you pretend to use. Otherwise + all modules are loaded at startup from the default location, before the boot prompt. + + ---------------//---------------//--------------- + +What are modules? + + - Modules can be refered as "plugins", adding and/or replacing booter functionality, without + touching the "core" of the booter. If you are familiar with e.g. browser plugins + (like Firefox's Addons), you know what i'm talking about; they either add completely new + functionality or replace/modify existing one; same thing with modules and Chameleon. + + More info can be found on Meklort's blog and links at the bottom of the page: + http://www.meklort.com/ + + ---------------//---------------//--------------- + +Featured modules: + + - Symbols.dylib: first one to load, contains all the symbols found on the booter. + All other modules depend on it to load. + + ---------------//--------------- + + - KernelPatcher.dylib: + + - needs key to enable patching: + + PatchKernel=y at boot prompt or, + + PatchKernel on Boot.plist. + Yes + + - featured patches: cpuid_set - 32/64 bit ?? + commpage_stuff - 32/64 bit + lapic_init - 32 bit only. + + Note on functionality: as it is, Kpatcher allows my Pentium D 925 to load vanilla(*) + kernel, with the help of -legacy flag; to enter x86_64 world i still need to patch + the kernel sources, as the 925 has no Supplemental SSE3 instructions and there's + no patch to fix this on Kpatcher atm. + I assume that, the great majority of the legacy/unsupported processors with at least + SSE3 instructions, will benefit of the same treatment! + Let's just say that the only patch needed by the 925 on Legacy Mode(**) is cpuid_set! + + Note: Kernel Patcher can stop working due to changes on the kernel code. + + ---------------//--------------- + + - GraphicsEnabler.dylib: GraphicsEnabler converted to module. + + ---------------//--------------- + + - Memory.dylib: MemDetection converted to module. + + ---------------//--------------- + + - HPET.dylib: ForceHPET converted to module. + + ---------------//--------------- + + - HelloWorld.dylib: just a notifier (not mandatory). + + ---------------//---------------//--------------- + + +(*) In this context, "vanilla" means the use of a non pre-patched kernel; what we do here is + patch the kernel on the fly, in memory. + +(**) For those who "missed" the lesson, Legacy Mode is the one 32 bit only cpu's run on OS X. + + + ---------------//---------------//--------------- + +Issues: + + - compiling modules under Leo (Dev tools 3.1 (9M2809)) is not possible at the moment. + + ---------------//---------------//--------------- + + + Some talk here: http://forum.voodooprojects.org/index.php/topic,1556.0.html + here: http://forum.voodooprojects.org/index.php/topic,1153.0.html + and here: http://forum.voodooprojects.org/index.php/topic,1565.0.html + + + ---------------//---------------//--------------- + + +Thanks fly out to Meklort for this precious and huge work! + + + +Azimutz + + Index: branches/azimutz/Chazi/doc-azi/BootArgs-Options.txt =================================================================== --- branches/azimutz/Chazi/doc-azi/BootArgs-Options.txt (revision 0) +++ branches/azimutz/Chazi/doc-azi/BootArgs-Options.txt (revision 815) @@ -0,0 +1,271 @@ +kNVCAP nvidia.c, getValFK - key is declared as a "variable", char kNVCAP[12], on setup_nvidia_devprop(). +Check: http://efixusers.com/showthread.php?t=644, Update Version 1.1.9 (Asere's booter). +"If you want to override the NVCAP value, you must determine the PCI DeviceID of your graphic card. +For instance: my new GTX260 has the DeviceID 0×05e2. Knowing the DeviceID add this to your com.apple.Boot.plist: +NVCAP_05e2 +0000000000000000000000000000000000000000 +The NVCAP value is exactly 20 bytes long. You have to specify it using ASCII-HEX (0-9,a-f)." + + +00000000000000000000000000000000000000000000000000000000000000000000000000000080 + Chameleon Bootloader + boot time help + +The boot prompt waits for you to type advanced startup options. If you don't +type anything, the computer continues starting up normally. It will use the +kernel and configuration files on the selected/default device, which it also +uses as the root device. +Use the following syntax, when typing advanced startup options: + + [device] [arguments] + +Arguments consist of either just a name, e.g. -v or a key=value pair, +e.g. rd=disk0s2. The latest are commonly referred to as "keys" and the first +as "flags". ????????????????? +Use the following syntax when typing arguments (recommended): + + [flags] [Wait=y key] [any other key] + +WARNINGS: (feedback is welcome) +- At least Wait=y is breaking other keys/flags?, when typed after them. This + is the main reason for the "argument" syntax above. If you have any problem + of this nature please try the recommended syntax or play with it. +- Arguments with spaces on their name (marked with (*)) are failing when + wrapped in quotation marks. + + Syntax examples: + + backup_kernel -legacy -v DSDT=/extra/test.aml Wait=y <-- :( DSDT= failed + backup_kernel -legacy -v Wait=y DSDT=/extra/test.aml <-- :) + + rd(0,0)/test_kernel -v debug=0x144 + -v Wait=y UseMemDetect=n SMBIOSDefaults=n SMBIOS=/path/to/smbios.plist + +Argument's names are case sensitive, values are not. Thus: + /Extra/DSDT.aml = /extra/dsdt.aml, etc... + + Thanks ????? + ============================================================================79 + +Special booter hotkeys: + + F5 Rescans optical drive. + F10 Scans and displays all BIOS accessible drives. + +Special booter commands: + + ? Displays this file. + ?memory Displays information about the computer's memory. + ?video Displays VESA video modes supported by the computer's BIOS. + ?norescan Leaves optical drive rescan mode. + ?lspci Displays information about PCI buses and devices in the system. + ?more Displays the text on an extra txt file (needs to be supplied). + Ex: ?more /extra/MoreInfo.txt + + ============================================================================== + +Most used "flags" include: ????????????? + + rd= or rd=* flag + Used to specify the root device (selected volume), from were the booter + will load start the System. ....when using Apple software RAID helper + partitions (apple boot).????????? + Ex: rd=disk0s2 or rd=uuid (used in conjunction with boot-uuid=)?? + Ex: rd=*/PCI0@0/CHN0@0/@0:1 + + + Specify a different kernel to be loaded. Kernel must be in the "/" (root) + of the selected/default volume. + Ex: my_kernel + + boot-uuid= flag + Specify the UUID of the boot volume. + Ex: boot-uuid=12345678-1234-1234-1234-123456789012 + + -v Verbose boot: see what booter and kernel are doing on your back :) + -s Single User Mode: Boot into CLI to perform tasks. + -x Safe Mode: ignore System caches and disable most devices. + -f Ignore caches: ignore System caches and boot normally. + -F Ignore "Kernel Flags" specified in boot configuration file. + 32 Boot i386 architecture. <---revert?? + -legacy Legacy Mode: disable handling 64 bit apps on i386 arch boot. + 64 Boot x86_64 architecture. <---revert?? + + kernel debug flags: e.g. debug=0x144 + IOkit debug flags: e.g. io=0xffffffff (defined in IOKit/IOKitDebug.h) + + ============================================================================== + +Options useful either at the prompt or in com.apple.Boot.plist file: ????? + + "Root UUID"= or y/n?????? (*) ...... man...... :-S key + + "Boot Device"=hd(x,y) ?????????? key + + Wait=Yes + Pause before starting the kernel.?????? + + config= + Use an alternate/backup "override" Boot.plist file. + Ex: config=/extra/testBoot.plist + + kext= (ends with a / (slash)) + Use an alternate/backup folder with drivers, kext or mkext. + Ex: kext=/extra/test/ + + "MKext Cache"= + Use an alternate/backup "System" cache file. + Ex: "MKext Cache"=rd(0,0)/Extensions.mkext + + Kernel= + + "Kernel Cache"= + Use an alternate/backup "Kernel" cache file. + Ex: "Kernel Cache"=bt(0,0)/kernelcache_i386.A701C40B + +- Devices/Other:??? + + UseMemDetect=No + Disable memory modules?? info detection. +0000000000000000000000000000000000000000000000000000000000000000000000000000079 + + EthernetBuiltIn=Yes + Automatic device-properties generation, that sets "built-in" property + for ethernet interfaces. + + USBBusFix=Yes + Enable all USB fixes below (fixes can be used individually): + EHCIacquire=Yes - Enable the EHCI fix. + UHCIreset=Yes - Enable the UHCI fix. + USBLegacyOff=Yes - Enable the USB Legacy fix. + + ForceHPET=Yes + Force enabling HPET device on the PC's BIOS. + +- Hibernation: + + Wake=No ????????change all to n/y and explain this + b.plist way. + Disable wake up after hibernation. + + ForceWake=Yes + Force using the sleepimage (when desired), if you get the message: + "Hibernate image is too old by n seconds. Use ForceWake=y to override." + + WakeImage= + Use an alternate sleepimage file. + Default path: /private/var/vm/sleepimage + +- ACPI: + + DSDT= or ?????????????? + Override the default dsdt.aml paths/name. + Default name: dsdt.aml + Default paths:????? + Ex: +0000000000000000000000000000000000000000000000000000000000000000000000000000079 + + DropSSDT=Yes + Skip the SSDT tables while relocating the ACPI tables. + + PciRoot= + Use an alternate value for PciRoot UID. Can be retrieved from dsdt.aml + by the booter, if supplied by the user and present on the ACPI table. + Default value: 0 + + RestartFix=yes + Enable restart fix for Intel chipsets. + + GeneratePStates=Yes + Enable automatic generation PStates. ??????? + + GenerateCStates=Yes + Enable automatic generation of CStates. ??????? + + EnableC4State=Yes + Enable automatic generation of C4State. ??????? +- Bios/smbios:??? + + SMBIOS= or + Override the default smbios.plist paths/name. + Default name: smbios.plist + Default paths:????? + Ex: + + SMBIOSdefaults=No + Disable the use of Default values for SMBIOS overriding, when smbios.plist + is not used. + + SystemType= + Set the system type where n is between 0..6 (default value =1 (Desktop). +0000000000000000000000000000000000000000000000000000000000000000000000000000079 + +According to CHANGES file, this should be SystemID, not SystemId! ???????? + SystemId= + Set manually the system UUID. (also known as Platform or Hardware UUID) + SMUUID (reserved field) in smbios.plist config is deprecated. + Ex: SystemId=12345678-1234-1234-1234-123456789012 + +- CD-ROM: (dvd??) + + "Rescan Prompt"=Yes (*) + Prompts for enable CD-ROM rescan mode. + + Rescan=Yes + Enable CD-ROM rescan mode. + + "Scan Single Drive"=Yes (*) + Scan "only" the drive where the booter got loaded from. + Fixes rescan pbs when using a DVD reader in AHCI mode, on some PC's. +- Ramdisk: + + add ramdisk stuff: ?rd, ?rd [m, u, e, d, i] + + md0= + Override the default "name"??? of raw img file, to be loaded into memory + for use as the kernel's md0 ramdisk. + Default name: Postboot.img + Default paths:????? + Ex: + +- Gui/Graphics: + +0000000000000000000000000000000000000000000000000000000000000000000000000000079 + "Legacy Logo"=Yes (*) + Use the legacy grey apple logo on the boot screen. + + GraphicsEnabler=Yes + Automatic device-properties generation for gfx cards. + Note: it doesn't work for all cards and you may have to perform + additional patching to get advantage of + the automatic dev-prop generation. (Leo??) + + UseAtiROM=Yes + Use an alternate Ati ROM image + Default path: /Extra/_.rom + Ex: /Extra/1002_1234.rom + + UseNvidiaROM=Yes + Use an alternate Nvidia ROM image. + Default path: /Extra/_.rom) + Ex: /Extra/10DE_1234.rom + + VBIOS=Yes (nVidia only) + Inject VBIOS to device-properties. + + NVCAP_= (nVidia only) + Specify NVCAP value. This value is a 20 bytes long hex string. + Ex: NVCAP_05e2=0000000000000000000000000000000000000000 + + AutoResolution=Yes + Enable native resolution setting for booter Gui and System, even when + graphics acceleration (qe/ci) is not available. + + Graphics Mode=WIDTHxHEIGHTxDEPTH + F2 (*) (AutoResolution only) + Change or set current resolution while at boot prompt. + Ex: Graphics Mode=1024x768x32 + press F2 key + +- Modules: + + PatchKernel=Yes + Enable on the fly kernel patching. + Index: branches/azimutz/Chazi/doc-azi/AutoResolution.txt =================================================================== --- branches/azimutz/Chazi/doc-azi/AutoResolution.txt (revision 0) +++ branches/azimutz/Chazi/doc-azi/AutoResolution.txt (revision 815) @@ -0,0 +1,70 @@ + + ---------------// AutoResolution Info //--------------- + + Project topic: http://forum.voodooprojects.org/index.php/topic,1227.0.html +there you can find latest sources and boot files posted by LeBidou, as well as most +of the feedback and project history. Source can also be found, in a more or less +up to date form on AutoResolution branch and CleanCut folder under my branch; +as of this writing i'm considering those as "obsolete", replaced by what i have at +the moment on Chazi folder. + +Some more references can be found on this topic by DieBuche: +http://www.insanelymac.com/forum/index.php?showtopic=211294&st=0 +in fact, the first post is the best explanation you can get on how the patch works, +with the difference that the patch does it "on the fly" while booting, in an "Auto" +way (hence the AutResolution name) using the resolution retrieved from the display's +EDID or provided with "Graphics Mode" argument. +But, don't stay only with the first post! I won't get into technical details, simply +because i don't have the knowledge to. All i do is try to keep the patch working with +latest Chameleon changes and that's obviously because i use it :) +Will add more info with time if it's justifiable. + +Enough talk... +What can this patch do for you and when? + +Well, if you never experienced booting with your native resolution, or worse, you don't +even have it after login, there's a chance that this can help you, providing you have +the luck of having the right hardware. If it works, it will provide you with native +resolution even if you don't have any graphics acceleration at all; remember, this has +nothing to do with "Graphics Enabler" or depends on it in any way. +Intel chipset is needed; the newer the worse :P read the topics and check the list below. +Graphics card, it depends... ATI's are the best supported, but BIOS and motherboard have +something to say so, the best is try it. + +How to try? + + + + + + + + + + + +Working: + +Intel X4500MHD, on Acer Aspire 1810TZ, (2a428086) (no qe/ci) - leader86 +GMA950, on MSI Wind u100 (Atom n270), (27ae8086) - smith@@ +GMA X3100, on Sony Vaio (old model), (2a028086) - smith@@ +nVidia 9800GT, on p5q deluxe and pro, (061410de) - smith@@ +nVidia 8600GTS, on p5q deluxe and pro, (040010de) - smith@@ +ATI Radeon X1300, on HP 7730, (81711002) - mine + +Not working: + +nVidia 9800GT, on p5k se epu, (061410de) - smith@@ +- the screen becomes completely green with some horizontal lines. +GMA950, on HP 7730, (27728086) - mine + + + + +http://www.insanelymac.com/forum/index.php?s=44134eab9a3c0832fdff3f5a43394a72&showtopic=211294&view=findpost&p=1422921 + + + +Azimutz + + Index: branches/azimutz/Chazi/doc-azi/README.txt =================================================================== --- branches/azimutz/Chazi/doc-azi/README.txt (revision 0) +++ branches/azimutz/Chazi/doc-azi/README.txt (revision 815) @@ -0,0 +1,82 @@ +About me: + + Just the average curious guy, that likes to know a bit of this and that. + I'm not a skilled coder or even a developer, nor i pretend to be! Most of what i'm doing here + is simply tweaking code that already exists, though lack of knowledge is not the only reason + for this behavior. + Just trying to learn, share my opinion (as noob as it may be) and give back some help, + within my skills, knowledge and available time. + So bare with me :) i'll remember to do the same with you when the time comes. + + Thanks. + Azi + +About the branch: + + First, the usual warning: use it at your own risk! + No, it's not going to set your machine on fire or something like that :) + Everything is tested on my machine first and i don't mess with stuff i don't have knowledge to mess + with, but you never know. Be sure you fully understand the changes before you use this booter + (CleanCut included) and always keep a plan B!!! + I will do my best to explain what these changes are and more. + + Although i use this stuff on a daily basis, this is not meant to be an alternative to Chameleon! + Any use of this booter/s should be considered "testing". If you do find a certain patch or + functionality useful to your self and the "great" majority of Chameleon users, please make a request + to the Chameleon team, on the appropriate places(*). + Any other stuff can/should be reported to me directly, at the forum (*) by pm. + I might miss a topic so, if you create one, pm me anyway. + + The layout of the branch can change, but at least 2 folders will always be present (at least for now): + CleanCut and Chazi: + + - Chazi is the main stuff! It's My Work Folder, Test Bed and "Personal" Booter. Comparing it to the + trunk will probably be a "pain in" for anyone in the future. That's were CleanCut comes in. + + - CleanCut, as the name implies, is a "clean" cut of Chazi; will always be as close to the trunk as + possible and i won't commit there patches that don't work for everyone, like the AutoResolution + one i use on Chazi (this may change in the future). + It's meant to be compared easily and keep the stuff i consider most useful to Chameleon "at hand". + Stuff committed there, besides trunk updates, will always come from and reflect changes on Chazi, + keeping the limitations above in mind. + This project it's not meant to be used! Want to test something, use Chazi. + +Guidelines: + + - learn and spread the knowledge. + - make the code more understandable for Sorcerer's Apprentice like my self. + - help applying Coding Standards. + - help improving Chameleon documentation. + - help testing and integrating new useful code to Chameleon. + + - simplify booter use as much as possible. + - all files loaded by the booter stay confined to Extra folder. + - fixes that are not absolutely needed by all users, are disabled by default. (reviewable) + - no absolute priority to Selected volume. + - emulating a Mac it's not a priority!!! + + ---------------//---------------//--------------- + + Any feedback is highly appreciated. I mean ANY! Good, bad, suggestion, opinion, bug, issue, etc... + About requests, keep in mind that my knowledge is limited! + Think "baby steps" ;) + + Read the rest of the docs for more info and keep an eye on the forge and forum (*) for news. + Stay safe and enjoy. + +Thanks: + any contribution to this OSx86 scene, with a true sense of "community" deserves a "Thank you very much", + from the small post, to the nice booter :) + + + ---------------//---------------//--------------- + ---------------//---------------//--------------- + + +(*) http://forge.voodooprojects.org/ + http://forum.voodooprojects.org/ + + +Azimutz + + Index: branches/azimutz/Chazi/doc-azi/FileLoad.txt =================================================================== --- branches/azimutz/Chazi/doc-azi/FileLoad.txt (revision 0) +++ branches/azimutz/Chazi/doc-azi/FileLoad.txt (revision 815) @@ -0,0 +1,219 @@ +Well, the intention here is to give some insight on Chameleon file loading, as well as providing +detailed info about what files are (or can be) loaded, from what devices, used paths, differences +between paths, if there's user overriding available, etc... +For now, it will just focus on comparing what's available (on trunk) and one of the many "paths" +we can follow (my branch); also, only the most frequently used files are featured. +For the purpose of comparison, there's a FileLoad-trunk.txt similar to this one, that will +reflect the current Chameleon (trunk) status on the matter. + +To be honest, the info on this file will depend greatly on "feedback"; writing down this stuff it's +not the most pleasing and fruitful task i have to do atm, time is never enough and i don't feel +particularly inspired for the job atm; so if i see no interest in this, +i will ditch it as quickly as i started it. + + +Note: unless other wise specified, first file found is the one used. + +Note: path/name search is not case sensitive! Meaning that: +- this /Extra/DSDT.aml +- or this /extra/dsdt.aml +points exactly to the same location. + +Before we go on: +- Selected volume = root volume (volume/partition were a system is installed) +- Booter volume = boot volume (volume/partition were the bootloader installed) + + ---------------//---------------//--------------- + Chazi - CleanCut + ---------------//---------------//--------------- + + +- Extra extensions (kext) + +Default name: Extensions (a directory with kext/s) +Name override: No + +Default path/s: - User override + - ramdisk: + rd(0,0)/Extensions + - booter volume or ramdisk aliased as bt(0,0) (1*): + bt(0,0)/Extra/specificOSfolder/Extensions + - same as above: + bt(0,0)/Extra/Extensions + - Helper partition/s (Apple_Boot): checked only if exists (2*) + /com.apple.boot.P/System/Library/Extensions + /com.apple.boot.R/System/Library/Extensions + /com.apple.boot.S/System/Library/Extensions +Path override: Yes + +User override: kext=path to folder with Extensions sub folder; e.g. /Extra/drivers/ + Note: see CHANGES.txt, (revs 337 --> 360), second Change. + + -------/-/------- - same search scheme as above. + +- Extra extensions (mkext) + +Default name: Extensions.mkext (kext cache) +Name override: No + +Default path/s: User override + rd(0,0)/Extensions.mkext + bt(0,0)/Extra/specificOSfolder/Extensions.mkext + bt(0,0)/Extra/Extensions.mkext + /com.apple.boot.P/System/Library/Extensions.mkext + /com.apple.boot.R/System/Library/Extensions.mkext + /com.apple.boot.S/System/Library/Extensions.mkext +Path override: Yes + +User override: kext=path to folder with a Extensions.mkext; e.g. /Extra/drivers/ + Note: see CHANGES.txt, (revs 337 --> 360), second Change. + + ---------------//---------------//--------------- + +- Default configuration file (plist) + +Default name: com.apple.Boot.plist +Name override: No + +Default path/s: (3*) + bt(0,0)/Extra/com.apple.Boot.plist + /Library/Preferences/SystemConfiguration/com.apple.Boot.plist + - Helper partition/s (Apple_Boot): + /com.apple.boot.P/Library/Preferences/SystemConfiguration/com.apple.Boot.plist + /com.apple.boot.R/Library/Preferences/SystemConfiguration/com.apple.Boot.plist + /com.apple.boot.S/Library/Preferences/SystemConfiguration/com.apple.Boot.plist +Path override: No + + ---------------//---------------//--------------- + +- Override configuration file (plist) + +Default name: com.apple.Boot.plist +Name override: Yes + +Default path/s: User override + rd(0,0)/com.apple.Boot.plist + bt(0,0)/Extra/specificOSfolder/com.apple.Boot.plist + (4*) +Path override: Yes + +User override: config=path to file; e.g. /Extra/test/com.apple.Boot.plist or /Extra/b.plist + + ---------------//---------------//--------------- + +- ACPI table (aml) + +Default name: DSDT.aml +Name override: Yes + +Default path/s: User override + rd(0,0)/DSDT.aml + bt(0,0)/Extra/specificOSfolder/DSDT.aml + bt(0,0)/Extra/DSDT.aml +Path override: Yes + +User override: DSDT=path to file; e.g. rd(0,0)/Extra/dsdt.aml or /Extra/test.aml + + -------/-/------- +ssdt.aml (5*) + ---------------//---------------//--------------- + +- SMBIOS (plist) + +Default name: SMBIOS.plist +Name override: Yes + +Default path/s: User override + rd(0,0)/SMBIOS.plist + bt(0,0)/Extra/specificOSfolder/SMBIOS.plist + bt(0,0)/Extra/SMBIOS.plist +Path override: Yes + +User override: SMBIOS=path to file; e.g. bt(0,0)/Extra/smbios.plist or /Extra/MP21.plist + + ---------------//---------------//--------------- + +- ramdisk (dmg) + +Default name: Preboot.dmg +Name override: Yes + +Default path/s: User override + bt(0,0)/Extra/Preboot.dmg +Path override: Yes + +User override: rd=path to file; e.g. /Extra/Preboot.dmg or /Leo.dmg + + ---------------//---------------//--------------- +The long story: + ---------------//---------------//--------------- + + +(1*) +Ramdisks (rd) are simple image files (dmg, etc...) most commonly associated with the pre-boot discs +used to boot retail Mac OS X Installer dvd's; in this case, they are used to load needed files into +memory, before discs can be swapped. But, pre-boot it's not their only use; they can be loaded from +any device the booter has access to and used to test/load, from kexts to complete boot configurations. +A rd aliased as bt(0,0), is a normal rd with a btalias activated pointing to it. The btalias is activated +via a configuration file placed on the root of the rd (RAMDisk.plist), using the pair BTAlias=y. +When this alias is activated on a rd, all paths started by bt(0,0) (pointing to the Booter volume) +will instead point to the rd. This makes rd's aliased as bt, ideal to load full sets of files, +like when using the mentioned pre-boot discs. + +(2*) +Helper partitions - boot support partitions (Apple_Boot) +Need to gather more info on these, since i have no experience with them. +All i can say for now is that /com.apple.boot.P /com.apple.boot.R /com.apple.boot.S are directories on +Apple_boot partitions. So far, the only real case scenario i could find that uses these partitions is +software RAID, were the root partition can't be accessed before the "software RAID" is running. +In this situation, these partitions are used as Booter volume and hold the necessary files, that on a +normal setup are loaded directly from the root volume (were the system is installed). +Here is a link to the only decent explanation i ever found on the net: +http://lists.apple.com/archives/boot-dev/2009/May/msg00009.html + +(RPS) Rock, Paper, Scissors (the next beats the previous) + +(3*) +I'm not searching /Extra/com.apple.Boot.plist on Default paths (c.a.B.plist on selected volume). +The reason is pretty evident, if we don't forget that this booter only loads files from booter volume. +But that's not all; there's also a concept so, for now i'm going to focus only on it. +The concept is: Default configuration file should be loaded either from the Booter volume or from one +of the default system paths. +Why? Because it's the Default configuration file, with the Default configuration files, that the booter +is supposed to use by Default, on a hands-off situation. All these values can still be override by +the user in more ways than one, if the user wishes so! (read 4*) +Wish we could use just "One" default path!?? + +(4*) +Here i have my doubts if what i have is the ideal, if there's any ideal situation to follow?! +Anyway, explaining what i have now and why. +I'm not searching Default paths for now because: +- they are already checked when loading the Default configuration. In "many" situations + (not to say "most") this will just be reloading the already loaded values. +- on this booter, Selected volume is replaced by the use of a specific OS folder so, in some sense + the selected volume is still checked. And there's also a override key! + +My doubts are related to the fact that, searching default paths here does make sense (in a way) +and i'm not entirely sure that's not needed in some configurations?! It's just that, the way +it's done now it gets confuse... +Does using a different name for the Override configuration file make any sense?? + +(5*) +ssdt: need to gather more info on these, since i have no experience with them. +As far as i understand, same paths as for dsdt.aml are used and if anything different from "dsdt.aml" +is found, it's loaded. 30 tables can be loaded and must be named as: +ssdt.aml, ssdt-1.aml, ssdt-2.aml,... ssdt-30.aml ??? bla bla bla... damn confusion :-/ + + +reminder: +- no ambiguous paths +- what override paths can be used. + + ---------------//...still plenty to edit...//--------------- + ---------------//...still plenty brainstorm...//--------------- + + + +Azimutz + + Index: branches/azimutz/Chazi/doc-azi/FileLoad-trunk.txt =================================================================== --- branches/azimutz/Chazi/doc-azi/FileLoad-trunk.txt (revision 0) +++ branches/azimutz/Chazi/doc-azi/FileLoad-trunk.txt (revision 815) @@ -0,0 +1,136 @@ + Check FileLoad.txt for full comments. + + +Note: unless other wise specified, first file found is the one used. + + ---------------//---------------//--------------- + trunk + ---------------//---------------//--------------- + +- Extra extensions (kext) + +Default name: Extensions (a directory with kext/s) +Name override: No + +Default path/s: - ramdisk: checked only if exists + rd(0,0)/Extra/Extensions + - selected volume: always checked, even if theres a hit on rd(0,0) + /Extra/Extensions + - booter volume or ramdisk aliased as bt(0,0) (1*): checked only if there's no hit on the previous + bt(0,0)/Extra/specificOSfolder/Extensions + - same as previous + bt(0,0)/Extra/Extensions + - Helper partition/s (Apple_Boot): checked only if exists (2*) + /com.apple.boot.P/System/Library/Extensions + /com.apple.boot.R/System/Library/Extensions + /com.apple.boot.S/System/Library/Extensions + +Path override: No + + -------/-/------- - same search scheme as above. + +- Extra extensions (mkext) + +Default name: Extensions.mkext +Name override: No + +Default path/s: rd(0,0)/Extensions.mkext + /Extra/Extensions.mkext + bt(0,0)/Extra/specificOSfolder/Extensions.mkext + bt(0,0)/Extra/Extensions.mkext + /com.apple.boot.P/System/Library/Extensions.mkext + /com.apple.boot.R/System/Library/Extensions.mkext + /com.apple.boot.S/System/Library/Extensions.mkext +Path override: No + + ---------------//---------------//--------------- + +- Default configuration file (plist) + +Default name: com.apple.Boot.plist +Name override: No + +Default path/s: /Extra/com.apple.Boot.plist + bt(0,0)/Extra/com.apple.Boot.plist + /Library/Preferences/SystemConfiguration/com.apple.Boot.plist + - Helper partition/s (Apple_Boot): + /com.apple.boot.P/Library/Preferences/SystemConfiguration/com.apple.Boot.plist + /com.apple.boot.R/Library/Preferences/SystemConfiguration/com.apple.Boot.plist + /com.apple.boot.S/Library/Preferences/SystemConfiguration/com.apple.Boot.plist +Path override: No + + ---------------//---------------//--------------- + +- Override configuration file (plist) + +Default name: com.apple.Boot.plist +Name override: No + +Default path/s: rd(0,0)/Extra/com.apple.Boot.plist + /Extra/com.apple.Boot.plist + /Library/Preferences/SystemConfiguration/com.apple.Boot.plist + Helper partition/s: + /com.apple.boot.P/Library/Preferences/SystemConfiguration/com.apple.Boot.plist + /com.apple.boot.R/Library/Preferences/SystemConfiguration/com.apple.Boot.plist + /com.apple.boot.S/Library/Preferences/SystemConfiguration/com.apple.Boot.plist +Path override: No + + ---------------//---------------//--------------- + +- ACPI table/s (aml) + +Default name: DSDT.aml +Name override: Yes + +Default path/s: - User override or default name: + user path or + DSDT.aml = current volume!? + - selected volume: checked only if there's no hit on the previous + /Extra/DSDT.aml + - booter volume or ramdisk aliased as bt(0,0) (1*): checked only if there's no hit on the previous + bt(0,0)/Extra/DSDT.aml +Path override: Yes + +User override: DSDT=path to file; e.g. rd(0,0)/Extra/dsdt.aml or /Extra/test.aml + + -------/-/------- +ssdt.aml (5*) + ---------------//---------------//--------------- + +- SMBIOS (plist) + +Default name: SMBIOS.plist +Name override: Yes + +Default path/s: - User override + - selected volume: checked only if there's no hit on the previous + /Extra/SMBIOS.plist + - booter volume or ramdisk aliased as bt(0,0) (1*): checked only if there's no hit on the previous + bt(0,0)/Extra/SMBIOS.plist +Path override: Yes + +User override: SMBIOS=path to file; e.g. bt(0,0)/Extra/smbios.plist or /Extra/MP21.plist + + ---------------//---------------//--------------- + +- ramdisk (dmg) + +Default name: Preboot.dmg +Name override: Yes + +Default path/s: User override + bt(0,0)/Extra/Preboot.dmg +Path override: Yes + +User override: rd=path to file; e.g. /Extra/Preboot.dmg or /Leo.dmg + + + ---------------//---------------//--------------- + +Note: (n*) comments are located on FileLoad.txt. + + + +Azimutz + + Index: branches/azimutz/Chazi/i386/boot0/chain0.s =================================================================== --- branches/azimutz/Chazi/i386/boot0/chain0.s (revision 814) +++ branches/azimutz/Chazi/i386/boot0/chain0.s (revision 815) @@ -697,4 +697,4 @@ times 510-($-$$) db 0 dw kBootSignature -;END +; END Index: branches/azimutz/Chazi/i386/boot0/boot0.s =================================================================== --- branches/azimutz/Chazi/i386/boot0/boot0.s (revision 814) +++ branches/azimutz/Chazi/i386/boot0/boot0.s (revision 815) @@ -317,33 +317,33 @@ .Pass1: %ifdef 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. + ; equipped with boot1h in its boot record + ; regardless if it's active or not. jne .continue - mov dh, 1 ; Argument for loadBootSector to check HFS+ partition signature. + mov dh, 1 ; Argument for loadBootSector to check HFS+ partition signature. %else cmp BYTE [si + part.bootid], kPartActive ; In pass 1 we are walking on the standard path - ; by trying to hop on the active partition. + ; by trying to hop on the active partition. jne .continue - xor dh, dh ; Argument for loadBootSector to skip HFS+ partition - ; signature check. + xor dh, dh ; Argument for loadBootSector to skip HFS+ partition + ; signature check. %endif - jmp .tryToBoot + jmp .tryToBoot .Pass2: %ifdef 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. + ; by trying to hop on the active partition. jne .continue - xor dh, dh ; Argument for loadBootSector to skip HFS+ partition - ; signature check. + xor dh, dh ; Argument for loadBootSector to skip HFS+ partition + ; signature check. %else cmp BYTE [si + part.type], kPartTypeHFS ; In pass 2 we're going to find a HFS+ partition - ; equipped with boot1h in its boot record - ; regardless if it's active or not. + ; equipped with boot1h in its boot record + ; regardless if it's active or not. jne .continue - mov dh, 1 ; Argument for loadBootSector to check HFS+ partition signature. + mov dh, 1 ; Argument for loadBootSector to check HFS+ partition signature. %endif DebugChar('*') @@ -359,7 +359,7 @@ jmp SHORT initBootLoader .continue: - add si, BYTE part_size ; advance SI to next partition entry + add si, BYTE part_size ; advance SI to next partition entry loop .loop ; loop through all partition entries ; @@ -369,7 +369,7 @@ ; dec bl jnz .switchPass2 ; didn't find Protective MBR before - call checkGPT + call checkGPT .switchPass2: ; @@ -406,7 +406,7 @@ ; checkGPT: push bx - + mov di, kLBA1Buffer ; address of GUID Partition Table Header cmp DWORD [di], kGPTSignatureLow ; looking for 'EFI ' jne .exit ; not found. Giving up. @@ -496,8 +496,8 @@ .exit: pop bx ret ; no more GUID partitions. Giving up. - + ;-------------------------------------------------------------------------- ; loadBootSector - Load boot sector ; Index: branches/azimutz/Chazi/i386/boot0/Makefile =================================================================== --- branches/azimutz/Chazi/i386/boot0/Makefile (revision 814) +++ branches/azimutz/Chazi/i386/boot0/Makefile (revision 815) @@ -2,24 +2,20 @@ DIR = boot0 include ../MakePaths.dir -#NASM = /Developer/usr/bin/nasm -NASM = $(shell which 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)/$@ +boot0: boot0.s Makefile $(NASM) + $(NASM) boot0.s -o $(SYMROOT)/$@ boot0hfs: boot0.s Makefile $(NASM) - @echo "\t[NASM] $@" - @$(NASM) boot0.s -DHFSFIRST -o $(SYMROOT)/$@ + $(NASM) boot0.s -DHFSFIRST -o $(SYMROOT)/$@ chain0: chain0.s Makefile $(NASM) - @echo "\t[NASM] $@" - @$(NASM) chain0.s -o $(SYMROOT)/$@ + $(NASM) chain0.s -o $(SYMROOT)/$@ install_i386:: all $(INSTALLDIR) cp $(SYMROOT)/boot0 $(SYMROOT)/chain0 $(INSTALLDIR) Index: branches/azimutz/Chazi/i386/MakeInc.dir =================================================================== --- branches/azimutz/Chazi/i386/MakeInc.dir (revision 814) +++ branches/azimutz/Chazi/i386/MakeInc.dir (revision 815) @@ -42,63 +42,52 @@ .SUFFIXES: .s .i .c .o .o32 .o64 .c.o32: - @echo "\t[CC32] $<" - @$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) -arch i386 $< -o $(OBJROOT)/$*.o32 \ - -MD -dependency-file $(OBJROOT)/$*.d - @md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d + $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) -arch i386 $< -o $(OBJROOT)/$*.o32 \ + -MD -dependency-file $(OBJROOT)/$*.d + md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d .c.o64: - @echo "\t[CC64] $<" - @$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) -arch x86_64 $< -o $(OBJROOT)/$*.o64 \ - -MD -dependency-file $(OBJROOT)/$*.d - @md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d + $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) -arch x86_64 $< -o $(OBJROOT)/$*.o64 \ + -MD -dependency-file $(OBJROOT)/$*.d + md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d .c.o .m.o: - @echo "\t[CC] $<" - @$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $(OBJROOT)/$*.o \ - -MD -dependency-file $(OBJROOT)/$*.d - @md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d + $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $(OBJROOT)/$*.o \ + -MD -dependency-file $(OBJROOT)/$*.d + md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d $(OBJROOT)/%.o: %.c - @echo "\t[CC] $<" - @$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $(OBJROOT)/$*.o \ - -MD -dependency-file $(OBJROOT)/$*.d - @md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d + $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $(OBJROOT)/$*.o \ + -MD -dependency-file $(OBJROOT)/$*.d + md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d $(OBJROOT)/%.o32: %.c - @echo "\t[CC32] $<" - @$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) -arch i386 $< -o $(OBJROOT)/$*.o32 \ - -MD -dependency-file $(OBJROOT)/$*.d - @md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d + $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) -arch i386 $< -o $(OBJROOT)/$*.o32 \ + -MD -dependency-file $(OBJROOT)/$*.d + md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d $(OBJROOT)/%.o64: %.c - @echo "\t[CC64] $<" - @$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) -arch x86_64 $< -o $(OBJROOT)/$*.o64 \ - -MD -dependency-file $(OBJROOT)/$*.d - @md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d + $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) -arch x86_64 $< -o $(OBJROOT)/$*.o64 \ + -MD -dependency-file $(OBJROOT)/$*.d + md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d $(OBJROOT)/%.o: %.m - @echo "\t[CC] $<" - @$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $(OBJROOT)/$*.o \ - -MD -dependency-file $(OBJROOT)/$*.d - @md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d + $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $(OBJROOT)/$*.o \ + -MD -dependency-file $(OBJROOT)/$*.d + md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d #.s.o: # cc $(INC) -E $< > $(OBJROOT)/$*.o2 # $(AS) -o $(OBJROOT)/$@ $(OBJROOT)/$*.o2 .s.o: - @echo "\t[AS] $<" - @cc $(CPPFLAGS) -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) $< + cc $(CPPFLAGS) -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) $< boot2.o: - @echo "\t[AS] boot2.s" - @cc $(CPPFLAGS) -Wa,-n -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) boot2.s + cc $(CPPFLAGS) -Wa,-n -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) boot2.s $(OBJROOT)/%.o: %.s - @echo "\t[CC] $<" - @cc $(CPPFLAGS) -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) $< + cc $(CPPFLAGS) -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) $< $(DIRS_NEEDED) $(INSTALLDIR) $(SRCROOT): - @echo "\t[MKDIR] $@" - @$(MKDIRS) $@ + $(MKDIRS) $@ Index: branches/azimutz/Chazi/i386/boot1/Makefile =================================================================== --- branches/azimutz/Chazi/i386/boot1/Makefile (revision 814) +++ branches/azimutz/Chazi/i386/boot1/Makefile (revision 815) @@ -5,7 +5,6 @@ INSTALLDIR = $(DSTROOT)/usr/standalone/i386 DIRS_NEEDED = $(OBJROOT) $(SYMROOT) -#NASM = /Developer/usr/bin/nasm NASM = $(shell which nasm) VERSIONED_FILES = boot1h @@ -21,14 +20,10 @@ all embedtheme: $(DIRS_NEEDED) $(VERSIONED_FILES) 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 + $(NASM) boot1.s -o $(SYMROOT)/boot1h + $(NASM) boot1hp.s -o $(SYMROOT)/boot1hp + $(NASM) boot1he.s -o $(SYMROOT)/boot1he + $(NASM) boot1f32.s -o $(SYMROOT)/boot1f32 install_i386:: all $(INSTALLDIR) cp $(SYMROOT)/boot1h $(INSTALLDIR)/ Index: branches/azimutz/Chazi/i386/boot2/ramdisk.h =================================================================== --- branches/azimutz/Chazi/i386/boot2/ramdisk.h (revision 814) +++ branches/azimutz/Chazi/i386/boot2/ramdisk.h (revision 815) @@ -7,6 +7,8 @@ #ifndef __BOOT_RAMDISK_H #define __BOOT_RAMDISK_H +#include "memory.h" + #define RAMDISKCONFIG_FILENAME "rd(0,0)/RAMDisk.plist" //#define kPostbootRamdisk void md0Ramdisk(); Index: branches/azimutz/Chazi/i386/boot2/options.h =================================================================== --- branches/azimutz/Chazi/i386/boot2/options.h (revision 0) +++ branches/azimutz/Chazi/i386/boot2/options.h (revision 815) @@ -0,0 +1,105 @@ +/* + * Copyright (c) 1999-2004 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * Portions Copyright (c) 1999-2004 Apple Computer, Inc. All Rights + * Reserved. This file contains Original Code and/or Modifications of + * Original Code as defined in and that are subject to the Apple Public + * Source License Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. Please obtain a copy of the + * License at http://www.apple.com/publicsource and read it before using + * this file. + * + * The Original Code and all software distributed under the License are + * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the + * License for the specific language governing rights and limitations + * under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#ifndef __BOOT2_OPTIONS_H +#define __BOOT2_OPTIONS_H + +//#include "boot.h" +//#include "bootstruct.h" +//#include "graphics.h" + +//AZI: KEEP THIS FILE ??? + +extern int gDeviceCount; +void clearBootArgs(void); + +typedef struct { + int x; + int y; + int type; +} CursorState; + +enum { + kMenuTopRow = 5, + kMenuMaxItems = 10, + kScreenLastRow = 24 +}; + +/* +extern const MenuItem * gMenuItems; + + + +void addBootArg(const char * argStr); +void changeCursor( int col, int row, int type, CursorState * cs ); +void moveCursor( int col, int row ); +void restoreCursor( const CursorState * cs ); +void printMemoryInfo(void); +void lspci(void); +void printMenuItem( const MenuItem * item, int highlight ); +bool flushKeyboardBuffer(void); + + +extern bool shouldboot; + +#ifdef UNUSED +extern int multiboot_timeout; +extern int multiboot_timeout_set; +#endif + +extern BVRef bvChain; +//extern int menucount; + + + + +//========================================================================== + +extern char gBootArgs[BOOT_STRING_LEN]; +extern char * gBootArgsPtr; +extern char * gBootArgsEnd; +extern char booterCommand[BOOT_STRING_LEN]; +extern char booterParam[BOOT_STRING_LEN]; + + +//========================================================================== + +extern int gMenuItemCount; +extern int gMenuRow; +extern int gMenuHeight; +extern int gMenuTop; +extern int gMenuBottom; +extern int gMenuSelection; + +extern int gMenuStart; +extern int gMenuEnd; + +extern unsigned char chainbootdev; +extern unsigned char chainbootflag; + + +// Maximum config table value size +#define VALUE_SIZE 2048 +*/ +#endif /* __BOOT2_OPTIONS_H */ \ No newline at end of file Index: branches/azimutz/Chazi/i386/boot2/graphics.c =================================================================== --- branches/azimutz/Chazi/i386/boot2/graphics.c (revision 814) +++ branches/azimutz/Chazi/i386/boot2/graphics.c (revision 815) @@ -27,7 +27,6 @@ */ #include "boot.h" -#include "vbe.h" #include "appleClut8.h" #include "gui.h" #include "IOHibernatePrivate.h" @@ -42,8 +41,6 @@ uint8_t *previewSaveunder = 0; #define VIDEO(x) (bootArgs->Video.v_ ## x) - -#define MIN(x, y) ((x) < (y) ? (x) : (y)) //========================================================================== // getVBEInfoString @@ -180,7 +177,8 @@ // Return the VESA mode that matches the properties specified. // If a mode is not found, then return the "best" available mode. -static unsigned short +//static //Azi:autoresolution +unsigned short getVESAModeWithProperties( unsigned short width, unsigned short height, unsigned char bitsPerPixel, @@ -369,6 +367,8 @@ unsigned char bitsPerPixel, unsigned short refreshRate ) { + bool debugInfo = false; //Azi:debuginfo + extern bool showBootBanner; // || VBEModeInfoBlock minfo; unsigned short mode; unsigned short vesaVersion; @@ -387,6 +387,8 @@ break; } + if (refreshRate != 60) refreshRate = 60; //Azi:autoresolution + // // FIXME : generateCRTCTiming() causes crash. // @@ -424,12 +426,22 @@ // err = setVBEMode( mode | kLinearFrameBufferBit, NULL ); // } +//Azi:autoresolution +#ifdef AUTORES_DEBUG + printf("Is about to set mode #%d with resolution %dx%d\n", mode, minfo.XResolution, minfo.YResolution); + //getc(); //Azi: boot hangs, on the second call (like "old" Wait=y issue). + sleep(2); +#endif // Set the mode with default refresh rate. - err = setVBEMode( mode | kLinearFrameBufferBit, NULL ); if ( err != errSuccess ) { +#ifdef AUTORES_DEBUG + printf("setVBEMode failed to set mode %d (%dx%d) with error #%d\n", + mode, minfo.XResolution, minfo.YResolution, err); + sleep(2); //Azi: i suppose the same as above. +#endif break; } @@ -438,7 +450,7 @@ if ( minfo.BitsPerPixel == 8 ) { VBEPalette palette; - setupPalette( &palette, appleClut8 ); + setupPalette( &palette, appleClut8 ); //Azi:autoresolution - check this stuff, appleClut8 if ((err = setVBEPalette(palette)) != errSuccess) { break; @@ -461,7 +473,19 @@ bootArgs->Video.v_depth = minfo.BitsPerPixel; bootArgs->Video.v_rowBytes = minfo.BytesPerScanline; bootArgs->Video.v_baseAddr = VBEMakeUInt32(minfo.PhysBasePtr); +/* Azi: keep this or i keep forgeting ?????? +#if AUTORES_DEBUG + gui.screen.mm = minfo.MemoryModel; + gui.screen.attr = minfo.ModeAttributes; +#endif*/ + //Azi: mm & attr info on DebugInfo - from autoResolution branch. + getBoolForKey(kDebugInfoKey, &debugInfo, &bootInfo->bootConfig); + if (debugInfo && showBootBanner) + { + gui.screen.mm = minfo.MemoryModel; + gui.screen.attr = minfo.ModeAttributes; + } } while ( 0 ); @@ -1030,8 +1054,8 @@ //========================================================================== // getNumberArrayFromProperty -static int -getNumberArrayFromProperty( const char * propKey, +//static //Azi:autoresolution +int getNumberArrayFromProperty( const char * propKey, unsigned long numbers[], unsigned long maxArrayCount ) { @@ -1104,34 +1128,40 @@ { unsigned long params[4]; int count; - int err = errSuccess; + int err = errSuccess; // = 0 if ( mode == GRAPHICS_MODE ) { - if ( (err=initGraphicsMode ()) == errSuccess ) { - if (gVerboseMode) { - // Tell the kernel to use text mode on a linear frame buffer display - bootArgs->Video.v_display = FB_TEXT_MODE; - } else { - bootArgs->Video.v_display = GRAPHICS_MODE; + if ( (err = initGraphicsMode() ) == errSuccess ) + { + if (gVerboseMode) + { + // Tell the kernel to use text mode on a linear frame buffer display + bootArgs->Video.v_display = FB_TEXT_MODE; + } + else + { + bootArgs->Video.v_display = GRAPHICS_MODE; + } } - } } if ( (mode == VGA_TEXT_MODE) || (err != errSuccess) ) { - count = getNumberArrayFromProperty( kTextModeKey, params, 2 ); + count = getNumberArrayFromProperty( kTextModeKey, params, 2 ); + if ( count < 2 ) { params[0] = 80; // Default text mode is 80x25. params[1] = 25; } - setVESATextMode( params[0], params[1], 4 ); + setVESATextMode( params[0], params[1], 4 ); bootArgs->Video.v_display = VGA_TEXT_MODE; } - - currentIndicator = 0; +// printf("Res: %dx%d (setvm: gsw/h final?)\n", gui.screen.width, gui.screen.height); + + currentIndicator = 0; } void getGraphicModeParams(unsigned long params[]) { @@ -1202,7 +1232,7 @@ { lastTickTime = currentTickTime; } - + if (getVideoMode() == VGA_TEXT_MODE) { if (currentIndicator >= sizeof(indicator)) @@ -1219,7 +1249,7 @@ { if ( getVideoMode() == VGA_TEXT_MODE ) { - putc(' '); + putc(' '); putc('\b'); } } Index: branches/azimutz/Chazi/i386/boot2/graphic_utils.h =================================================================== --- branches/azimutz/Chazi/i386/boot2/graphic_utils.h (revision 814) +++ branches/azimutz/Chazi/i386/boot2/graphic_utils.h (revision 815) @@ -9,7 +9,6 @@ #ifndef GRAPHIC_UTILS_H #define GRAPHIC_UTILS_H -#include "boot.h" typedef union { Index: branches/azimutz/Chazi/i386/boot2/graphics.h =================================================================== --- branches/azimutz/Chazi/i386/boot2/graphics.h (revision 814) +++ branches/azimutz/Chazi/i386/boot2/graphics.h (revision 815) @@ -7,14 +7,16 @@ * */ -#include "boot.h" -#include "bootstruct.h" -#include "graphic_utils.h" - - #ifndef __BOOT_GRAPHICS_H #define __BOOT_GRAPHICS_H +//#include "libsaio.h" +//#include "bootstruct.h" +//#include "boot.h" +#include "saio_types.h" +#include "graphic_utils.h" +#include "vbe.h" + #define DEFAULT_SCREEN_WIDTH 1024 #define DEFAULT_SCREEN_HEIGHT 768 @@ -37,9 +39,23 @@ int loadEmbeddedPngImage(uint8_t *pngData, int pngSize, uint16_t *width, uint16_t *height, uint8_t **imageData); +//Azi:autoresolution ?? +int getNumberArrayFromProperty( const char * propKey, + unsigned long numbers[], + unsigned long maxArrayCount ); char *getVBEInfoString(); char *getVBEModeInfoString(); + +//Azi:autoresolution ?? +unsigned short getVESAModeWithProperties( unsigned short width, + unsigned short height, + unsigned char bitsPerPixel, + unsigned short attributesSet, + unsigned short attributesClear, + VBEModeInfoBlock * outModeInfo, + unsigned short * vesaVersion ); + void getGraphicModeParams(unsigned long params[]); #endif /* !__BOOT_GRAPHICS_H */ Index: branches/azimutz/Chazi/i386/boot2/drivers.c =================================================================== --- branches/azimutz/Chazi/i386/boot2/drivers.c (revision 814) +++ branches/azimutz/Chazi/i386/boot2/drivers.c (revision 815) @@ -33,14 +33,12 @@ #include #include +//#include "bootstruct.h" +//#include "ramdisk.h" +#include "boot.h" #include "sl.h" -#include "boot.h" -#include "bootstruct.h" #include "xml.h" -#include "ramdisk.h" -//extern char gMacOSVersion[8]; - struct Module { struct Module *nextModule; long willLoad; @@ -70,7 +68,7 @@ unsigned long signature1; unsigned long signature2; unsigned long length; - unsigned long adler32; + unsigned long alder32; unsigned long version; unsigned long numDrivers; unsigned long reserved1; @@ -85,7 +83,7 @@ long (*LoadExtraDrivers_p)(FileLoadDrivers_t FileLoadDrivers_p); -/*static*/ unsigned long Adler32( unsigned char * buffer, long length ); +static unsigned long Alder32( unsigned char * buffer, long length ); static long FileLoadDrivers(char *dirSpec, long plugin); static long NetLoadDrivers(char *dirSpec); @@ -109,8 +107,8 @@ static char * gTempSpec; static char * gFileName; -/*static*/ unsigned long -Adler32( unsigned char * buffer, long length ) +static unsigned long +Alder32( unsigned char * buffer, long length ) { long cnt; unsigned long result, lowHalf, highHalf; @@ -162,96 +160,105 @@ long LoadDrivers( char * dirSpec ) { - char dirSpecExtra[1024]; - - if ( InitDriverSupport() != 0 ) - return 0; - - // Load extra drivers if a hook has been installed. - if (LoadExtraDrivers_p != NULL) - { - (*LoadExtraDrivers_p)(&FileLoadDrivers); - } - - if ( gBootFileType == kNetworkDeviceType ) - { - if (NetLoadDrivers(dirSpec) != 0) { - error("Could not load drivers from the network\n"); - return -1; - } - } - else if ( gBootFileType == kBlockDeviceType ) - { - // First try to load Extra extensions from the ramdisk if isn't aliased as bt(0,0). - if (gRAMDiskVolume && !gRAMDiskBTAliased) - { - strcpy(dirSpecExtra, "rd(0,0)/Extra/"); - FileLoadDrivers(dirSpecExtra, 0); - } - - // Next try to load Extra extensions from the selected root partition. - strcpy(dirSpecExtra, "/Extra/"); - if (FileLoadDrivers(dirSpecExtra, 0) != 0) - { - // If failed, then try to load Extra extensions from the boot partition - // in case we have a separate booter partition or a bt(0,0) aliased ramdisk. - if ( !(gBIOSBootVolume->biosdev == gBootVolume->biosdev && gBIOSBootVolume->part_no == gBootVolume->part_no) - || (gRAMDiskVolume && gRAMDiskBTAliased) ) - { - // Next try a specfic OS version folder ie 10.5 - sprintf(dirSpecExtra, "bt(0,0)/Extra/%s/", &gMacOSVersion); - if (FileLoadDrivers(dirSpecExtra, 0) != 0) - { - // Next we'll try the base - strcpy(dirSpecExtra, "bt(0,0)/Extra/"); - FileLoadDrivers(dirSpecExtra, 0); - } - } - } - - // Also try to load Extensions from boot helper partitions. - if (gBootVolume->flags & kBVFlagBooter) - { - strcpy(dirSpecExtra, "/com.apple.boot.P/System/Library/"); - if (FileLoadDrivers(dirSpecExtra, 0) != 0) - { - strcpy(dirSpecExtra, "/com.apple.boot.R/System/Library/"); - if (FileLoadDrivers(dirSpecExtra, 0) != 0) - { - strcpy(dirSpecExtra, "/com.apple.boot.S/System/Library/"); - FileLoadDrivers(dirSpecExtra, 0); - } - } - } - - if (gMKextName[0] != '\0') - { - verbose("LoadDrivers: Loading from [%s]\n", gMKextName); - if ( LoadDriverMKext(gMKextName) != 0 ) - { - error("Could not load %s\n", gMKextName); - return -1; - } - } - else - { - strcpy(gExtensionsSpec, dirSpec); - strcat(gExtensionsSpec, "System/Library/"); - FileLoadDrivers(gExtensionsSpec, 0); - } - } - else - { - return 0; - } - - MatchPersonalities(); - - MatchLibraries(); - - LoadMatchedModules(); - - return 0; + char dirSpecExtra[128]; + const char *override_pathfolder = NULL; // full path to a folder. + int fd = 0, len = 0; + + if ( InitDriverSupport() != 0 ) + return 0; + + // Load extra drivers if a hook has been installed. + if (LoadExtraDrivers_p != NULL) + { + (*LoadExtraDrivers_p)(&FileLoadDrivers); + } + + if ( gBootFileType == kNetworkDeviceType ) + { + if (NetLoadDrivers(dirSpec) != 0) + { + error("Could not load drivers from the network\n"); + return -1; + } + } + else if ( gBootFileType == kBlockDeviceType ) + { + // Take in account user overriding. - does this still work ??? + if (getValueForKey(kAltExtensionsKey, &override_pathfolder, &len, &bootInfo->bootConfig)) + { + // Specify a path to a folder, ending with / e.g. kext=/Extra/testkext/ + strcpy(dirSpecExtra, override_pathfolder); + fd = FileLoadDrivers(dirSpecExtra, 0); + if (fd >= 0) goto success_fd; + } + + // No need to specify (gRAMDiskVolume && !gRAMDiskBTAliased). + // First try to load Extra extensions from a ramdisk if isn't aliased as bt(0,0). + strcpy(dirSpecExtra, "rd(0,0)/"); // check it's "root". + fd = FileLoadDrivers(dirSpecExtra, 0); + if (fd >= 0) goto success_fd; + + // Also no need to specify (gRAMDiskVolume && gRAMDiskBTAliased); checking paths on a + // ramdisk aliased as bt(0,0) (rdbt), is the same as checking paths on booter volume. + // In this case the following two will point to the ramdisk. + + // Check booter volume/rdbt Extra for specific OS files, on specific OS folders. + sprintf(dirSpecExtra, "bt(0,0)/Extra/%s/", &gMacOSVersion); + fd = FileLoadDrivers(dirSpecExtra, 0); + if (fd >= 0) goto success_fd; + + // Removed /Extra path from search algo. If needed can be specified with override key! + + // Check booter volume/rdbt Extra in case we don't keep specific OS folders. + strcpy(dirSpecExtra, "bt(0,0)/Extra/"); + fd = FileLoadDrivers(dirSpecExtra, 0); + if (fd >= 0) goto success_fd; + + // Also try to load Extensions from boot helper partitions. + if (gBootVolume->flags & kBVFlagBooter) + { + strcpy(dirSpecExtra, "/com.apple.boot.P/System/Library/"); + if (FileLoadDrivers(dirSpecExtra, 0) != 0) + { + strcpy(dirSpecExtra, "/com.apple.boot.R/System/Library/"); + if (FileLoadDrivers(dirSpecExtra, 0) != 0) + { + strcpy(dirSpecExtra, "/com.apple.boot.S/System/Library/"); + FileLoadDrivers(dirSpecExtra, 0); + } + } + } + +success_fd: + // if user initialized gMKextName ("MKext Cache" flag)... + if (gMKextName[0] != '\0') + { + verbose("LoadDrivers: Loading from [%s]\n", gMKextName); + if ( LoadDriverMKext(gMKextName) != 0 ) + { + error("Could not load %s\n", gMKextName); + return -1; + } + } + else // else load kext cache from default paths. + { + strcpy(gExtensionsSpec, dirSpec); // = "/" + strcat(gExtensionsSpec, "System/Library/"); // "/" + "System/Library/" + FileLoadDrivers(gExtensionsSpec, 0); // "/System/Library/" - legacy path + } + } + else + { + return 0; + } + + MatchPersonalities(); + + MatchLibraries(); + + LoadMatchedModules(); + + return 0; } //========================================================================== @@ -260,23 +267,32 @@ static long FileLoadMKext( const char * dirSpec, const char * extDirSpec ) { - long ret, flags, time, time2; - char altDirSpec[512]; + long ret, flags, time, time2; + char altDirSpec[512]; - sprintf (altDirSpec, "%s%s", dirSpec, extDirSpec); - ret = GetFileInfo(altDirSpec, "Extensions.mkext", &flags, &time); - if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeFlat)) - { - ret = GetFileInfo(dirSpec, "Extensions", &flags, &time2); - if ((ret != 0) || ((flags & kFileTypeMask) != kFileTypeDirectory) || - (((gBootMode & kBootModeSafe) == 0) && (time == (time2 + 1)))) - { - sprintf(gDriverSpec, "%sExtensions.mkext", altDirSpec); - verbose("LoadDrivers: Loading from [%s]\n", gDriverSpec); - if (LoadDriverMKext(gDriverSpec) == 0) return 0; - } - } - return -1; + sprintf (altDirSpec, "%s%s", dirSpec, extDirSpec); + ret = GetFileInfo(altDirSpec, "Extensions.mkext", &flags, &time); + msglog("(%s) Extensions.mkext time = %d\n", __FUNCTION__, time); + + if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeFlat)) + { + ret = GetFileInfo(dirSpec, "Extensions", &flags, &time2); + //Azi: hum... finaly got it :P + verbose("(%s) Extensions time +1 = %d\n", __FUNCTION__, time2 + 1); + + if ((ret != 0) + || ((flags & kFileTypeMask) != kFileTypeDirectory) + || (((gBootMode & kBootModeSafe) == 0) && (time == (time2 + 1)))) + { + sprintf(gDriverSpec, "%sExtensions.mkext", altDirSpec); + //Azi: hum... finaly got it :P + msglog("LoadDrivers: Loading from [%s]\n", gDriverSpec); + + if (LoadDriverMKext(gDriverSpec) == 0) + return 0; + } + } + return -1; } //========================================================================== @@ -294,7 +310,7 @@ { // First try 10.6's path for loading Extensions.mkext. if (FileLoadMKext(dirSpec, "Caches/com.apple.kext.caches/Startup/") == 0) - return 0; + return 0; // "bt(0,0)/Extra/10.6/" // Next try the legacy path. else if (FileLoadMKext(dirSpec, "") == 0) @@ -305,6 +321,7 @@ index = 0; while (1) { + ret = GetDirEntry(dirSpec, &index, &name, &flags, &time); if (ret == -1) break; @@ -397,8 +414,8 @@ if (( GetPackageElement(signature1) != kDriverPackageSignature1) || ( GetPackageElement(signature2) != kDriverPackageSignature2) || ( GetPackageElement(length) > kLoadSize ) || - ( GetPackageElement(adler32) != - Adler32((unsigned char *)&package->version, GetPackageElement(length) - 0x10) ) ) + ( GetPackageElement(alder32) != + Alder32((unsigned char *)&package->version, GetPackageElement(length) - 0x10) ) ) { return -1; } @@ -798,7 +815,7 @@ return -1; } if (OSSwapBigToHostInt32(kernel_header->adler32) != - Adler32(binary, uncompressed_size)) { + Alder32(binary, uncompressed_size)) { printf("adler mismatch\n"); return -1; } Index: branches/azimutz/Chazi/i386/boot2/mboot.c =================================================================== --- branches/azimutz/Chazi/i386/boot2/mboot.c (revision 814) +++ branches/azimutz/Chazi/i386/boot2/mboot.c (revision 815) @@ -2,10 +2,10 @@ File added by David F. Elliott on 2007/06/26 */ -#include "libsaio.h" +//#include "libsaio.h" +//#include "bootstruct.h" #include "boot.h" -#include "bootstruct.h" - +#include "memory.h" #include "mboot.h" int multiboot_timeout=0; @@ -344,14 +344,15 @@ bootArgs = NULL; return bootdevice; } - +/* declared on gui.h - moved to boot.h enum { kReturnKey = 0x0d, kEscapeKey = 0x1b, kBackspaceKey = 0x08, kASCIIKeyMask = 0x7f -}; +};*/ +//Azi:reminder // This is the meat of our implementation. It grabs the boot device from // the multiboot_info and returns it as is. If it fails it returns // BAD_BOOT_DEVICE. We can call an awful lot of libsa and libsaio but Index: branches/azimutz/Chazi/i386/boot2/prompt.c =================================================================== --- branches/azimutz/Chazi/i386/boot2/prompt.c (revision 814) +++ branches/azimutz/Chazi/i386/boot2/prompt.c (revision 815) @@ -32,6 +32,9 @@ "Build date: " I386BOOT_BUILDDATE "\n" "%dMB memory\n"; +char bootLogBanner[] = "\nChameleon v" I386BOOT_CHAMELEONVERSION " r" I386BOOT_CHAMELEONREVISION "\n" + "Build date: " I386BOOT_BUILDDATE "\n\n"; + char bootPrompt[] = "Press Enter to start up Darwin/x86 with no options, or you can:\n" " Type -v and press Enter to start up with diagnostic messages\n" Index: branches/azimutz/Chazi/i386/boot2/mboot.h =================================================================== --- branches/azimutz/Chazi/i386/boot2/mboot.h (revision 814) +++ branches/azimutz/Chazi/i386/boot2/mboot.h (revision 815) @@ -1,4 +1,5 @@ /* File added by David F. Elliott on 2007/06/27 */ + #include "multiboot.h" /* Index: branches/azimutz/Chazi/i386/boot2/resume.c =================================================================== --- branches/azimutz/Chazi/i386/boot2/resume.c (revision 814) +++ branches/azimutz/Chazi/i386/boot2/resume.c (revision 815) @@ -7,12 +7,11 @@ * */ -#include "saio_internal.h" -#include "libsa.h" +//#include "libsa.h" +//#include "bootstruct.h" +#include "boot.h" #include "IOHibernatePrivate.h" #include "memory.h" -#include "bootstruct.h" -#include "boot.h" #include "pci.h" extern int previewTotalSectors; @@ -139,11 +138,14 @@ mem_base = getmemorylimit() - allocSize;//TODO: lower this printf("mem_base %x\n", mem_base); - // Rek : hibernate fix - if (!((long long)mem_base+allocSize<1024*bootInfo->extmem+0x100000)) + // Rek : hibernate fix +// http://www.insanelymac.com/forum/index.php?s=&showtopic=225766&view=findpost&p=1598473 +// http://www.insanelymac.com/forum/index.php?s=&showtopic=225766&view=findpost&p=1598502 +//Azi: ??? - check Mek's! + if ( (long long)mem_base + allocSize < 1024*bootInfo->extmem + 0x100000 ) { - printf ("Not enough space to restore image. Press any key to proceed with normal boot.\n"); - getc (); + printf("Not enough space to restore image. Press any key to proceed with normal boot.\n"); + getc(); return; } Index: branches/azimutz/Chazi/i386/boot2/boot.c =================================================================== --- branches/azimutz/Chazi/i386/boot2/boot.c (revision 814) +++ branches/azimutz/Chazi/i386/boot2/boot.c (revision 815) @@ -49,42 +49,48 @@ * Reworked again by Curtis Galloway (galloway@NeXT.com) */ +//#define DEBUG 1 +//#include "bootstruct.h" +//#include "libsa.h" #include "boot.h" -#include "bootstruct.h" -#include "fake_efi.h" -#include "sl.h" -#include "libsa.h" -#include "ramdisk.h" +//#include "io_inline.h" // Lion +#include "ramdisk.h" // bootstruct.h: memory.h instead of saio_internal.h #include "gui.h" -#include "platform.h" #include "modules.h" +#include "fake_efi.h" +#include "platform.h" // bootstruct.h - device_tree.h +#include "sl.h" // bootstruct.h: memory.h instead of saio_types.h long gBootMode; /* defaults to 0 == kBootModeNormal */ bool gOverrideKernel; +//--- testing +#define PLATFORM_NAME_LEN 64 +#define ROOT_PATH_LEN 256 +static char gCacheNameAdler[PLATFORM_NAME_LEN + ROOT_PATH_LEN]; +#define BOOT_DEVICE_PATH "\\System\\Library\\CoreServices\\boot.efi" static char gBootKernelCacheFile[512]; -static char gCacheNameAdler[64 + 256]; -char *gPlatformName = gCacheNameAdler; +//--- +char *gPlatformName = gCacheNameAdler; // disabled ?? char gRootDevice[512]; char gMKextName[512]; -char gMacOSVersion[8]; bool gEnableCDROMRescan; bool gScanSingleDrive; -int bvCount = 0; +int bvCount = 0; // global ?? - Slice //int menucount = 0; -int gDeviceCount = 0; +int gDeviceCount = 0; BVRef bvr; -BVRef menuBVR; +//BVRef menuBVR; - doesn't seem used here BVRef bvChain; bool useGUI; //static void selectBiosDevice(void); +//Azi: this doesn't match the function; matches the "Alder32" on drivers.c static unsigned long Adler32(unsigned char *buffer, long length); -static bool checkOSVersion(const char * version); -static bool getOSVersion(); + static bool gUnloadPXEOnExit = false; /* @@ -96,9 +102,10 @@ /* * Default path to kernel cache file */ -//Slice - first one for Leopard -#define kDefaultCachePathLeo "/System/Library/Caches/com.apple.kernelcaches/" -#define kDefaultCachePathSnow "/System/Library/Caches/com.apple.kext.caches/Startup/" +// OS X 10.5 & 10.4 +#define kDefaultCachePath "/System/Library/Caches/com.apple.kernelcaches/kernelcache" +// OS X 10.6 +#define kDefaultCachePathSnow "/System/Library/Caches/com.apple.kext.caches/Startup/kernelcache" //========================================================================== // Zero the BSS. @@ -132,14 +139,17 @@ //========================================================================== // execKernel - Load the kernel image (mach-o) and jump to its entry point. +//Azi:autoresolution +extern void initAutoRes(); +extern void finishAutoRes(); + static int ExecKernel(void *binary) { entry_t kernelEntry; int ret; bootArgs->kaddr = bootArgs->ksize = 0; - execute_hook("ExecKernel", (void*)binary, NULL, NULL, NULL); - + //Azi: here we get to know if we have a kernel or a prelinked kernel ret = DecodeKernel(binary, &kernelEntry, (char **) &bootArgs->kaddr, @@ -151,14 +161,13 @@ // Reserve space for boot args reserveKernBootStruct(); - // Notify modules that the kernel has been decoded - execute_hook("DecodedKernel", (void*)binary, NULL, NULL, NULL); - - // Load boot drivers from the specifed root path. - if (!gHaveKernelCache) - LoadDrivers("/"); + //Azi: ... + // Load boot drivers from the specifed root path, + // if we don't have a prelinked kernel - check load.c 43 & 264 + if (!gHaveKernelCache) { + LoadDrivers("/"); + } - clearActivityIndicator(); if (gErrors) { @@ -167,7 +176,7 @@ sleep(kBootErrorTimeout); } - setupFakeEfi(); + setupFakeEfi(); //Azi: check position on Mek (plkernel) md0Ramdisk(); @@ -184,15 +193,30 @@ } bool dummyVal; + + //Azi: Wait=y is breaking other keys when typed "after them" at boot prompt. + // Works properly if typed in first place or used on Boot.plist. if (getBoolForKey(kWaitForKeypressKey, &dummyVal, &bootInfo->bootConfig) && dummyVal) { - printf("Press any key to continue..."); - getc(); + verbose("(Wait) "); + pause(); } usb_loop(); +//autoresolution - Check if user disabled AutoResolution at the boot prompt. + // we can't check the plist here if we have AutoResolution=n there and we anabled it + // at boot prompt...????? +// getBoolForKey(kAutoResolutionKey, &gAutoResolution, &bootInfo->bootConfig); - execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgs, NULL, NULL); // Notify modules that the kernel is about to be started + finishAutoRes(); + + //Azi: closing Vbios after "if (gVerboseMode)" stuff eliminates the need for setting + // AutoResolution = true above; but creates another bug when booting in TextMode with -v arg. + // Simptoms include: staring some seconds at a nicely drawn white screen, after boot prompt. + // Think i'm just going to end up removing setting gAutoResolution = false + // on closeVbios().. the more i think, the less sense it makes doing it there!! +//autoresolution - end + // If we were in text mode, switch to graphics mode. // This will draw the boot graphics unless we are in // verbose mode. @@ -201,29 +225,21 @@ setVideoMode( GRAPHICS_MODE, 0 ); else drawBootGraphics(); - + + // Notify modules that the kernel is about to be started + execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgs, NULL, NULL); + setupBooterLog(); finalizeBootStruct(); - - if (checkOSVersion("10.7")) { - - // Masking out so that Lion doesn't doublefault - outb(0x21, 0xff); /* Maskout all interrupts Pic1 */ - outb(0xa1, 0xff); /* Maskout all interrupts Pic2 */ - - // Jump to kernel's entry point. There's no going back now. - - startprog( kernelEntry, bootArgs ); - } - else { - // Jump to kernel's entry point. There's no going back now. - - startprog( kernelEntry, bootArgsPreLion ); - } + + // Jump to kernel's entry point. There's no going back now. +//Azi: Lion - http://netkas.org/?p=745 +// see asm.s - same stuff by DHP http://www.insanelymac.com/forum/index.php?s=&showtopic=255866&view=findpost&p=1677779 +// outb(0x21, 0xff); +// outb(0xa1, 0xff); + startprog( kernelEntry, bootArgs ); - - // Not reached return 0; @@ -260,7 +276,7 @@ bool quiet; bool firstRun = true; bool instantMenu; - bool rescanPrompt; + bool rescanPrompt = false; unsigned int allowBVFlags = kBVFlagSystemVolume|kBVFlagForeignBoot; unsigned int denyBVFlags = kBVFlagEFISystem; @@ -275,12 +291,15 @@ initKernBootStruct(); initBooterLog(); + + //Azi: log booter version, revision & build date, for bdmesg. + msglog(bootLogBanner); // Setup VGA text mode. // Not sure if it is safe to call setVideoMode() before the // config table has been loaded. Call video_mode() instead. #if DEBUG - printf("before video_mode\n"); + printf("before video_mode\n"); //Azi: this one is not printing... i remember it did.. check trunk. #endif video_mode( 2 ); // 80x25 mono text mode. #if DEBUG @@ -293,8 +312,20 @@ // First get info for boot volume. scanBootVolumes(gBIOSDev, 0); bvChain = getBVChainForBIOSDev(gBIOSDev); + //Azi: initialising gBIOSBootVolume & gBootVolume for the first time.. i think!? + // also, kDefaultPartitionKey is checked here, on selectBootVolume. setBootGlobals(bvChain); - + msglog("setBootGlobals:\n Default: %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBootVolume, gBootVolume->biosdev, gBootVolume->part_no, gBootVolume->flags); + msglog(" bt(0,0): %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBIOSBootVolume, gBIOSBootVolume->biosdev, gBIOSBootVolume->part_no, gBIOSBootVolume->flags); + + // Boot Volume is set as Root at this point so, pointing to Extra, /Extra or bt(0,0)/Extra + // is exactly the same. Review bt(0,0)/bla bla paths...... (Reviewing...) + + //Azi: works as expected but... trying this because Kernel=mach_kernel doesn't work on a + // override Boot.plist; this makes it impossible to override e.g. Kernel=bt(0,0)mach_kernel + // on the main Boot.plist, when loading kernel from ramdisk btAliased. + loadPrebootRAMDisk(); + // Load boot.plist config file status = loadSystemConfig(&bootInfo->bootConfig); @@ -303,76 +334,101 @@ } // Override firstRun to get to the boot menu instantly by setting "Instant Menu"=y in system config - if (getBoolForKey(kInsantMenuKey, &instantMenu, &bootInfo->bootConfig) && instantMenu) { + if (getBoolForKey(kInstantMenuKey, &instantMenu, &bootInfo->bootConfig) && instantMenu) { firstRun = false; } - // Loading preboot ramdisk if exists. - loadPrebootRAMDisk(); + // Loading preboot ramdisk if exists. +// loadPrebootRAMDisk(); //Azi: this needs to be done before load_all_modules() + // because of btAlias... (Reviewing...) + // Intialize module system + if (init_module_system()) + { + load_all_modules(); + } + // Disable rescan option by default gEnableCDROMRescan = false; - // Enable it with Rescan=y in system config - if (getBoolForKey(kRescanKey, &gEnableCDROMRescan, &bootInfo->bootConfig) && gEnableCDROMRescan) { - gEnableCDROMRescan = true; - } + // If we're loading the booter from optical media... (Reviewing...) + if (biosDevIsCDROM(gBIOSDev)) + { + // ... ask the user for Rescan option by setting "Rescan Prompt"=y in system config... + if (getBoolForKey(kRescanPromptKey, &rescanPrompt, &bootInfo->bootConfig) && rescanPrompt) + { + gEnableCDROMRescan = promptForRescanOption(); + } + else // ... or enable it with Rescan=y in system config. + if (getBoolForKey(kRescanKey, &gEnableCDROMRescan, &bootInfo->bootConfig) && gEnableCDROMRescan) + { + gEnableCDROMRescan = true; + } + } - // Ask the user for Rescan option by setting "Rescan Prompt"=y in system config. - rescanPrompt = false; - if (getBoolForKey(kRescanPromptKey, &rescanPrompt , &bootInfo->bootConfig) && rescanPrompt && biosDevIsCDROM(gBIOSDev)) { - gEnableCDROMRescan = promptForRescanOption(); - } - + //Azi: Is this a cdrom only thing? (Reviewing...) // Enable touching a single BIOS device only if "Scan Single Drive"=y is set in system config. - if (getBoolForKey(kScanSingleDriveKey, &gScanSingleDrive, &bootInfo->bootConfig) && gScanSingleDrive) { - gScanSingleDrive = true; + if (getBoolForKey(kScanSingleDriveKey, &gScanSingleDrive, &bootInfo->bootConfig) && gScanSingleDrive) + { + scanBootVolumes(gBIOSDev, &bvCount); } - - // Create a list of partitions on device(s). - if (gScanSingleDrive) { - scanBootVolumes(gBIOSDev, &bvCount); - } else { - scanDisks(gBIOSDev, &bvCount); - } - + else + { + //Azi: scanDisks uses scanBootVolumes. + scanDisks(gBIOSDev, &bvCount); + } + // Create a separated bvr chain using the specified filters. bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &gDeviceCount); gBootVolume = selectBootVolume(bvChain); - // Intialize module system - init_module_system(); +//#if DEBUG +//printf + msglog(":something...???\n Default: %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBootVolume, gBootVolume->biosdev, gBootVolume->part_no, gBootVolume->flags); + msglog(" bt(0,0): %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBIOSBootVolume, gBIOSBootVolume->biosdev, gBIOSBootVolume->part_no, gBIOSBootVolume->flags); +// getc(); +//#endif + + useGUI = true; + // Override useGUI default + getBoolForKey(kGUIKey, &useGUI, &bootInfo->bootConfig); + + // AutoResolution - Azi: default to false + // http://forum.voodooprojects.org/index.php/topic,1227.0.html + gAutoResolution = false; -#if DEBUG - printf(" Default: %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBootVolume, gBootVolume->biosdev, gBootVolume->part_no, gBootVolume->flags); - printf(" bt(0,0): %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBIOSBootVolume, gBIOSBootVolume->biosdev, gBIOSBootVolume->part_no, gBIOSBootVolume->flags); - getc(); -#endif + // Check if user enabled AutoResolution on Boot.plist... + getBoolForKey(kAutoResolutionKey, &gAutoResolution, &bootInfo->bootConfig); + + // Patch the Video Bios with the extracted resolution, before initGui. + if (gAutoResolution == true) + { + initAutoRes(); + } - useGUI = true; - // Override useGUI default - getBoolForKey(kGUIKey, &useGUI, &bootInfo->bootConfig); - if (useGUI && initGUI()) + if (useGUI && initGUI()) { // initGUI() returned with an error, disabling GUI. useGUI = false; } setBootGlobals(bvChain); + msglog("setBootGlobals:\n Default: %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBootVolume, gBootVolume->biosdev, gBootVolume->part_no, gBootVolume->flags); + msglog(" bt(0,0): %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBIOSBootVolume, gBIOSBootVolume->biosdev, gBIOSBootVolume->part_no, gBIOSBootVolume->flags); // Parse args, load and start kernel. while (1) { const char *val; int len; int trycache; - long flags, cachetime, kerneltime, exttime, sleeptime, time; + long flags, cachetime, kerneltime, exttime, sleeptime, time; int ret = -1; void *binary = (void *)kLoadAddr; bool tryresume; bool tryresumedefault; bool forceresume; - bool usecache; + bool ignoreKC = false; // additional variable for testing alternate kernel image locations on boot helper partitions. char bootFileSpec[512]; @@ -385,32 +441,11 @@ status = getBootOptions(firstRun); firstRun = false; if (status == -1) continue; - - status = processBootOptions(); - // Status==1 means to chainboot - if ( status == 1 ) break; - // Status==-1 means that the config file couldn't be loaded or that gBootVolume is NULL - if ( status == -1 ) - { - // gBootVolume == NULL usually means the user hit escape. - if(gBootVolume == NULL) - { - freeFilteredBVChain(bvChain); - if (gEnableCDROMRescan) - rescanBIOSDevice(gBIOSDev); - - bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &gDeviceCount); - setBootGlobals(bvChain); - setupDeviceList(&bootInfo->themeConfig); - } - continue; - } - - // Other status (e.g. 0) means that we should proceed with boot. - - // Turn off any GUI elements - if( bootArgs->Video.v_display == GRAPHICS_MODE ) + //Azi: test (gBootVolume == NULL) - so far Ok! + // test with optical media again...? + // Turn off any GUI elements, draw background and update VRAM. + if ( bootArgs->Video.v_display == GRAPHICS_MODE ) { gui.devicelist.draw = false; gui.bootprompt.draw = false; @@ -420,32 +455,66 @@ drawBackground(); updateVRAM(); } + + status = processBootOptions(); + + //Azi: AutoResolution - closing Vbios here without restoring, causes an allocation error, + // if the user tries to boot, after a e.g."Can't find bla_kernel" msg. + // Doing it on execKernel() instead. + + // Status == 1 means to chainboot + if ( status == 1 ) break; - // Find out which version mac os we're booting. - getOSVersion(); + // Status == -1 means that gBootVolume is NULL. Config file is not mandatory anymore! + if ( status == -1 ) + { + // gBootVolume == NULL usually means the user hit escape. (Reviewing...) + if (gBootVolume == NULL) + { + freeFilteredBVChain(bvChain); + + if (gEnableCDROMRescan) + rescanBIOSDevice(gBIOSDev); + + bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &gDeviceCount); + setBootGlobals(bvChain); + setupDeviceList(&bootInfo->themeConfig); + } + continue; + } + + // Other status (e.g. 0) means that we should proceed with boot. - if (platformCPUFeature(CPU_FEATURE_EM64T)) { + // If cpu handles 64 bit instructions... + if (platformCPUFeature(CPU_FEATURE_EM64T)) + { + // use x86_64 kernel arch,... archCpuType = CPU_TYPE_X86_64; - } else { + } + else + { + // else use i386 kernel arch. archCpuType = CPU_TYPE_I386; } - if (getValueForKey(karch, &val, &len, &bootInfo->bootConfig)) { - if (strncmp(val, "i386", 4) == 0) { + // If user override... + if (getValueForKey(kArchKey, &val, &len, &bootInfo->bootConfig)) + { + // matches i386... + if (strncmp(val, "i386", 4) == 0) + { + // use i386 kernel arch. archCpuType = CPU_TYPE_I386; } } - - // Notify moduals that we are attempting to boot - execute_hook("PreBoot", NULL, NULL, NULL, NULL); - - if (!getBoolForKey (kWake, &tryresume, &bootInfo->bootConfig)) { + + if (!getBoolForKey (kWakeKey, &tryresume, &bootInfo->bootConfig)) { tryresume = true; tryresumedefault = true; } else { tryresumedefault = false; } - if (!getBoolForKey (kForceWake, &forceresume, &bootInfo->bootConfig)) { + if (!getBoolForKey (kForceWakeKey, &forceresume, &bootInfo->bootConfig)) { forceresume = false; } @@ -457,7 +526,7 @@ while (tryresume) { const char *tmp; BVRef bvr; - if (!getValueForKey(kWakeImage, &val, &len, &bootInfo->bootConfig)) + if (!getValueForKey(kWakeKeyImageKey, &val, &len, &bootInfo->bootConfig)) val="/private/var/vm/sleepimage"; // Do this first to be sure that root volume is mounted @@ -474,119 +543,151 @@ break; if (!forceresume && ((sleeptime+3)modTime)) { - printf ("Hibernate image is too old by %d seconds. Use ForceWake=y to override\n",bvr->modTime-sleeptime); + //Azi: no need for printf at this point - reminder + printf ("Hibernate image is too old by %d seconds. Use ForceWake=y to override.\n",bvr->modTime-sleeptime); break; } HibernateBoot((char *)val); break; } - - if(getBoolForKey(kUseKernelCache, &usecache, &bootInfo->bootConfig)) { - if (getValueForKey(kKernelCacheKey, &val, &len, &bootInfo->bootConfig)) { - strlcpy(gBootKernelCacheFile, val, len+1); + +//Azi:kernelcache stuff + //Azi: avoiding having to use -f to ignore kernel cache + //Azi: ignore kernel cache but still use kext cache (E/E.mkext & S/L/E.mkext). - explain... + getBoolForKey(kIgnoreKCKey, &ignoreKC, &bootInfo->bootConfig); + if (ignoreKC) + { + verbose("KC: cache ignored by user.\n"); + // make sure the damn thing get's cleaned, just in case... :)* + bzero(gBootKernelCacheFile, sizeof(gBootKernelCacheFile)); + } + else if (getValueForKey(kKernelCacheKey, &val, &len, &bootInfo->bootConfig)) + { + strlcpy(gBootKernelCacheFile, val, len + 1); + verbose("KC: path set by user = %s\n", gBootKernelCacheFile); + //Azi: bypass time check when user sets path ??? + // cache is still ignored if time doesn't match... (e.g. usb stick) + } + else + { + // Reset cache name. + bzero(gCacheNameAdler + 64, sizeof(gCacheNameAdler) - 64); + + // kextcache_main.c: Construct entry from UUID of boot volume...(reminder) + // assemble ?string? to generate adler from... +// sprintf(gCacheNameAdler + 64, "%s,%s", gRootDevice, bootInfo->bootFile); + const char *ProductName = getStringForKey("SMproductname", &bootInfo->smbiosConfig); + sprintf(gCacheNameAdler, ProductName); // well, at least the smbios.plist can be loaded this early... + // to set/get "ProductName" this early, booter needs complete rewrite!! + verbose("KC: gCacheNameAdler 1 = %s\n", gCacheNameAdler); + sprintf(gCacheNameAdler + 64, "%s", "\\System\\Library\\CoreServices\\boot.efi"); + verbose("KC: gCacheNameAdler 2 = %s\n", gCacheNameAdler + 64); + sprintf(gCacheNameAdler + (64 + 38), "%s", bootInfo->bootFile); + verbose("KC: gCacheNameAdler 3 = %s\n", gCacheNameAdler + (64 + 38)); + + // generate adler + adler32 = Adler32((unsigned char *)gCacheNameAdler, sizeof(gCacheNameAdler)); + verbose("KC: Adler32 = %08X\n", adler32); + + // append arch and/or adler (checksum) to kc path... + if (gMacOSVersion[3] < '6') // change to >= for Lion? + { + sprintf(gBootKernelCacheFile, "%s.%08lX", kDefaultCachePath, adler32); + verbose("KC: adler added to path = %s\n", gBootKernelCacheFile); } - else { - //Lion - if (checkOSVersion("10.7")) { - sprintf(gBootKernelCacheFile, "%skernelcache", kDefaultCachePathSnow); - } - // Snow Leopard - else if (checkOSVersion("10.6")) { - sprintf(gBootKernelCacheFile, "kernelcache_%s", (archCpuType == CPU_TYPE_I386) ? "i386" : "x86_64"); - int lnam = sizeof(gBootKernelCacheFile) + 9; //with adler32 - //Slice - TODO - /* - - but the name is longer .adler32 and more... - kernelcache_i386.E102928C.qSs0 - so will opendir and scan for some files - */ - char* name; - long prev_time = 0; - - struct dirstuff* cacheDir = opendir(kDefaultCachePathSnow); - - while(readdir(cacheDir, (const char**)&name, &flags, &time) >= 0) - { - if(((flags & kFileTypeMask) != kFileTypeDirectory) && time > prev_time && strstr(name, gBootKernelCacheFile) && (name[lnam] != '.')) - { - sprintf(gBootKernelCacheFile, "%s%s", kDefaultCachePathSnow, name); - prev_time = time; - } - } - } - else { - // Reset cache name. - bzero(gCacheNameAdler + 64, sizeof(gCacheNameAdler) - 64); - - sprintf(gCacheNameAdler + 64, "%s,%s", gRootDevice, bootInfo->bootFile); - - adler32 = Adler32((unsigned char *)gCacheNameAdler, sizeof(gCacheNameAdler)); - - sprintf(gBootKernelCacheFile, "%s.%08lX", kDefaultCachePathLeo, adler32); - } + else + { + sprintf(gBootKernelCacheFile, "%s_%s.%08X", kDefaultCachePathSnow, + (archCpuType == CPU_TYPE_I386) ? "i386" : "x86_64", adler32); + verbose("KC: arch & adler added to path = %s\n", gBootKernelCacheFile); } - } - + } + // Check for cache file. - trycache = (usecache && - ((gBootMode & kBootModeSafe) == 0) && - !gOverrideKernel && - (gBootFileType == kBlockDeviceType) && - (gMKextName[0] == '\0') && - (gBootKernelCacheFile[0] != '\0')); + //Azi: trycache is done if... + trycache = ( ( (gBootMode & kBootModeSafe) == 0) //... we're not booting in safe mode (-x arg), + && !gOverrideKernel // we're not overriding default kernel "name", + && (gBootFileType == kBlockDeviceType) // we're booting from local storage device, + && (gMKextName[0] == '\0') // "MKext Cache" key IS NOT in use, and + && (gBootKernelCacheFile[0] != '\0') ); // gBootKernelCacheFile is populated. + // we could add the use of "kernelpatcher" to this bunch..?? - verbose("Loading Darwin %s\n", gMacOSVersion); +// verbose("Loading Darwin %s\n", gMacOSVersion); //Azi: move?? to getOSVersion? :) - if (trycache) do { - + if (trycache) do + { + verbose("KC: checking kernel cache (system prelinked kernel)...\n"); // if we haven't found the kernel yet, don't use the cache ret = GetFileInfo(NULL, bootInfo->bootFile, &flags, &kerneltime); - if ((ret != 0) || ((flags & kFileTypeMask) != kFileTypeFlat)) { - trycache = 0; + if ((ret != 0) || ((flags & kFileTypeMask) != kFileTypeFlat)) + { + verbose("KC: no kernel found (shouldn't happen?!?)\n"); + trycache = 0; // ignore kernel cache... break; } + verbose("KC: kerneltime = %d\n", kerneltime); + ret = GetFileInfo(NULL, gBootKernelCacheFile, &flags, &cachetime); if ((ret != 0) || ((flags & kFileTypeMask) != kFileTypeFlat) - || (cachetime < kerneltime)) { + || (cachetime < kerneltime)) + { + if (cachetime <= 100) // confirm: 100 = inexistent path, -xxxxxxxxx = wrong name + // not confirming... i also get -xxxxxxxxx with inexisting prelinked kernel + verbose("KC: cachetime = %d, kernel cache path/adler is incorrect, ignoring it. ??? \n", + cachetime); + else + verbose("KC: cachetime = %d, kernel cache is older than the kernel, ignoring it.\n", + cachetime); trycache = 0; break; } + verbose("KC: cachetime = %d\n", cachetime); + ret = GetFileInfo("/System/Library/", "Extensions", &flags, &exttime); if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory) - && (cachetime < exttime)) { + && (cachetime < exttime)) + { + verbose("KC: exttime = %d, kernel cache is older than S/L/E, ignoring it.\n", exttime); trycache = 0; break; } - if (kerneltime > exttime) { + verbose("KC: exttime = %d\n", exttime); + + if (kerneltime > exttime) // if S/L/E is older than the kernel... + { + verbose("KC: S/L/E is older than the kernel, matching exttime with kerneltime...\n"); exttime = kerneltime; } - if (cachetime != (exttime + 1)) { + verbose("KC: exttime +1 = %d\n", exttime + 1); + + if (cachetime != (exttime + 1)) + { + verbose("KC: kernel cache time is diff from S/L/E time, ignoring it.\n"); trycache = 0; break; } + verbose("KC: kernel cache found and up to date, will be used.\n"); + } while (0); - do { - if (trycache) { + do + { + // Load kernel cache if not ignored. + if (trycache) + { bootFile = gBootKernelCacheFile; - - verbose("Loading kernel cache %s\n", bootFile); + verbose("Loading kernel cache %s\n", bootFile); - if (checkOSVersion("10.7")) { - ret = LoadThinFatFile(bootFile, &binary); - } - else { - ret = LoadFile(bootFile); - binary = (void *)kLoadAddr; - } - + ret = LoadFile(bootFile); + binary = (void *)kLoadAddr; + if (ret >= 0) + { break; - - verbose("Kernel cache did not loaded %s\n ", bootFile); + } } - + bootFile = bootInfo->bootFile; // Try to load kernel image from alternate locations on boot helper partitions. @@ -594,53 +695,38 @@ ret = GetFileInfo(NULL, bootFileSpec, &flags, &time); if (ret == -1) { - sprintf(bootFileSpec, "com.apple.boot.R/%s", bootFile); - ret = GetFileInfo(NULL, bootFileSpec, &flags, &time); - if (ret == -1) - { - sprintf(bootFileSpec, "com.apple.boot.S/%s", bootFile); - ret = GetFileInfo(NULL, bootFileSpec, &flags, &time); - if (ret == -1) - { - // Not found any alternate locations, using the original kernel image path. - strcpy(bootFileSpec, bootFile); - } - } + sprintf(bootFileSpec, "com.apple.boot.R/%s", bootFile); + ret = GetFileInfo(NULL, bootFileSpec, &flags, &time); + if (ret == -1) + { + sprintf(bootFileSpec, "com.apple.boot.S/%s", bootFile); + ret = GetFileInfo(NULL, bootFileSpec, &flags, &time); + if (ret == -1) + { + // No alternate locations found, using the original kernel image path. + strcpy(bootFileSpec, bootFile); + } + } } - if (checkOSVersion("10.7")) + verbose("Loading kernel %s\n", bootFileSpec); + ret = LoadThinFatFile(bootFileSpec, &binary); + if (ret <= 0 && archCpuType == CPU_TYPE_X86_64) { - //Lion, dont load kernel if haz cache - if (!trycache) { - verbose("Loading kernel %s\n", bootFileSpec); - ret = LoadThinFatFile(bootFileSpec, &binary); - if (ret <= 0 && archCpuType == CPU_TYPE_X86_64) { - archCpuType = CPU_TYPE_I386; - ret = LoadThinFatFile(bootFileSpec, &binary); - } - } - else ret = 1; - } - else { - //Snow leopard or older - verbose("Loading kernel %s\n", bootFileSpec); - ret = LoadThinFatFile(bootFileSpec, &binary); - if (ret <= 0 && archCpuType == CPU_TYPE_X86_64) { - archCpuType = CPU_TYPE_I386; - ret = LoadThinFatFile(bootFileSpec, &binary); - } + archCpuType = CPU_TYPE_I386; + ret = LoadThinFatFile(bootFileSpec, &binary); } - } while (0); clearActivityIndicator(); -#if DEBUG +/*#if DEBUG printf("Pausing..."); sleep(8); #endif - - if (ret <= 0) { +Azi: annoying stuff :P */ + if (ret <= 0) + { printf("Can't find %s\n", bootFile); sleep(1); @@ -650,21 +736,27 @@ gUnloadPXEOnExit = false; break; } - } else { - /* Won't return if successful. */ + } + else + { + // Won't return if successful. + // Notify modules that ExecKernel is about to be called + execute_hook("ExecKernel", binary, NULL, NULL, NULL); + ret = ExecKernel(binary); } - } + } // while (1) // chainboot if (status==1) { - if (getVideoMode() == GRAPHICS_MODE) { // if we are already in graphics-mode, - setVideoMode(VGA_TEXT_MODE, 0); // switch back to text mode - } + if (getVideoMode() == GRAPHICS_MODE) { // if we are already in graphics-mode, + setVideoMode(VGA_TEXT_MODE, 0); // switch back to text mode + } } - if ((gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit) { - nbpUnloadBaseCode(); + if ((gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit) + { + nbpUnloadBaseCode(); } } @@ -689,43 +781,6 @@ } */ -bool checkOSVersion(const char * version) -{ - return ((gMacOSVersion[0] == version[0]) && (gMacOSVersion[1] == version[1]) && (gMacOSVersion[2] == version[2]) && (gMacOSVersion[3] == version[3])); -} - -bool getOSVersion() -{ - bool valid = false; - config_file_t systemVersion; - const char *val; - int len; - - if (!loadConfigFile("System/Library/CoreServices/SystemVersion.plist", &systemVersion)) - { - valid = true; - } - else if (!loadConfigFile("System/Library/CoreServices/ServerVersion.plist", &systemVersion)) - { - valid = true; - } - - if (valid) - { - if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) - { - // getValueForKey uses const char for val - // so copy it and trim - *gMacOSVersion = '\0'; - strncat(gMacOSVersion, val, MIN(len, 4)); - } - else - valid = false; - } - - return valid; -} - #define BASE 65521L /* largest prime smaller than 65536 */ #define NMAX 5000 // NMAX (was 5521) the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 Index: branches/azimutz/Chazi/i386/boot2/boot.h =================================================================== --- branches/azimutz/Chazi/i386/boot2/boot.h (revision 814) +++ branches/azimutz/Chazi/i386/boot2/boot.h (revision 815) @@ -29,102 +29,147 @@ #ifndef __BOOT2_BOOT_H #define __BOOT2_BOOT_H -#include "libsaio.h" +//Azi: +// Todo: don't include headers like boot.h on other headers, unless...! +// move keys to the headers of the files they're in, if they have it!? +// check header wrappers... +//#include "saio_internal.h" // the only one needed by boot.h it self. +#include "bootstruct.h" + /* - * Keys used in system Boot.plist + * Default names - these end with "Name" (easier to sort them). */ -#define kGraphicsModeKey "Graphics Mode" -#define kTextModeKey "Text Mode" -#define kQuietBootKey "Quiet Boot" -#define kKernelFlagsKey "Kernel Flags" -#define kMKextCacheKey "MKext Cache" -#define kKernelNameKey "Kernel" -#define kKernelCacheKey "Kernel Cache" -#define kBootDeviceKey "Boot Device" -#define kTimeoutKey "Timeout" -#define kRootDeviceKey "rd" -#define kBootUUIDKey "boot-uuid" -#define kHelperRootUUIDKey "Root UUID" -#define kPlatformKey "platform" -#define kACPIKey "acpi" -#define kCDROMPromptKey "CD-ROM Prompt" -#define kCDROMOptionKey "CD-ROM Option Key" -#define kRescanPromptKey "Rescan Prompt" -#define kRescanKey "Rescan" -#define kScanSingleDriveKey "Scan Single Drive" -#define kInsantMenuKey "Instant Menu" -#define kDefaultKernel "mach_kernel" -#define kGUIKey "GUI" -#define kBootBannerKey "Boot Banner" -#define kWaitForKeypressKey "Wait" +#define kDefaultKernelName "mach_kernel" +#define kDefaultThemeName "Default" // revert? +/* +#define kDefaultBootPlistName "com.apple.Boot.plist" +#define kDefaultDSDTName "dsdt.aml" +#define kDefaultSMBIOSName "smbios.plist" +#define kDefaultRamdiskName "Preboot.dmg" +???*/ -#define kUseAtiROM "UseAtiROM" /* ati.c */ -#define kAtiConfig "AtiConfig" /* ati.c */ -#define kATYbinimage "ATYbinimage" /* ati.c */ +/* + * Default paths????? + */ -#define kWake "Wake" /* boot.c */ -#define kForceWake "ForceWake" /* boot.c */ -#define kWakeImage "WakeImage" /* boot.c */ -#define kProductVersion "ProductVersion" /* boot.c */ -#define karch "arch" /* boot.c */ -#define kUseKernelCache "UseKernelCache" /* boot.c */ +/* + * Undeclared (or undeclared here) + */ +/* +"-checkers" gui.c, getValFK; +"biosdev" mboot.c, getValFBK +"timeout" mboot.c, getValFBK +"partno" mboot.c, getValFBK +"DumpSPD" spd.c, getBollFK +*/ -#define kDSDT "DSDT" /* acpi_patcher.c */ -#define kDropSSDT "DropSSDT" /* acpi_patcher.c */ -#define kRestartFix "RestartFix" /* acpi_patcher.c */ -#define kGeneratePStates "GeneratePStates" /* acpi_patcher.c */ -#define kGenerateCStates "GenerateCStates" /* acpi_patcher.c */ -#define kEnableC2States "EnableC2State" /* acpi_patcher.c */ -#define kEnableC3States "EnableC3State" /* acpi_patcher.c */ -#define kEnableC4States "EnableC4State" /* acpi_patcher.c */ +/* + * Keys used in system Boot.plist - these end with "Key". + */ +// identifier string location type comment +#define kTextModeKey "Text Mode" // graphics.c getNumberArraiFP - default 80x25 - kFlag - does it work?? +//#define kProductVersionKey "ProductVersion" // options.c getValFK - (boot.c on trunk) - reverted -#define kDeviceProperties "device-properties" /* device_inject.c */ +#define kDefaultPartitionKey "Default Partition" // sys.c getStringFK +#define kHidePartitionKey "Hide Partition" // disk.c getValFK +#define kRenamePartitionKey "Rename Partition" // disk.c getStringFK -#define kHidePartition "Hide Partition" /* disk.c */ -#define kRenamePartition "Rename Partition" /* disk.c */ +#define kInstantMenuKey "Instant Menu" // boot.c getBoolFK +#define kQuietBootKey "Quiet Boot" // boot.c getBoolFK - kFlag +#define kTimeoutKey "Timeout" // options.c getIntFK +#define kThemeNameKey "Theme" // gui.c getValFK +#define kGUIKey "GUI" // boot.c getBoolFK +#define kBootBannerKey "Boot Banner" // options.c getBoolFK +#define kLegacyLogoKey "Legacy Logo" // gui.c getBoolFK - revert? +#define kDebugInfoKey "DebugInfo" // gui.c, graphics.c getBoolFK +#define kRescanPromptKey "Rescan Prompt" // boot.c getBoolFK - cdrom only - firstrun +#define kRescanKey "Rescan" // boot.c getBoolFK - cdrom only?? - firstrun +#define kCDROMPromptKey "CD-ROM Prompt" // options.c getValFK - internal?? +#define kCDROMOptionKey "CD-ROM Option Key" // options.c getIntFK - internal?? (F8) +#define kScanSingleDriveKey "Scan Single Drive" // boot.c getBoolFK +#define kDevicePropertiesKey "device-properties" // device_inject.c getValFK +#define kWaitForKeypressKey "Wait" // boot.c getBoolFK +#define kAltConfigKey "config" // stringTable.c getValFK - kFlag - hum.. handle like kFlag?? +#define kCanOverrideKey "CanOverride" // stringTable.c getBoolFK - remember -F *** +#define kRootDeviceKey "rd" // options.c processBootArg - kFlag +#define kBootDeviceKey "Boot Device" // options.c getValFK - kFlag/option?????? +#define kBootUUIDKey "boot-uuid" // options.c processBootArg - kFlag +#define kHelperRootUUIDKey "Root UUID" // options.c getValFK - kFlag +#define kArchKey "arch" // boot.c getValFK - kFlag - after all, +// it's to be passed via "kernel Flags" ?? - "man com.apple.Boot.plist" +#define kKernelNameKey "Kernel" // options.c getValFK - kFlag*** bFlag ? +#define kKernelCacheKey "Kernel Cache" // boot.c getValFK - kFlag +#define kIgnoreKCKey "ignoreKC" // boot.c getBoolFK - testing*** +#define kKernelFlagsKey "Kernel Flags" // options.c getValFK - kFlags*** +#define kKPatcherKey "PatchKernel" // kernel_patcher.c getBoolFK +#define kAltExtensionsKey "kext" // drivers.c getValFK +#define kMKextCacheKey "MKext Cache" // options.c getValFK - kFlag +#define kMD0ImageKey "md0" // ramdisk.c getValFK +#define kWakeKey "Wake" // boot.c getBoolFK +#define kForceWakeKey "ForceWake" // boot.c getBoolFK +#define kWakeKeyImageKey "WakeImage" // boot.c getValFK - location??? +#define kUseAtiROMKey "UseAtiROM" // ati.c getBoolFK +#define kUseNvidiaROMKey "UseNvidiaROM" // nvidia.c getBoolFK +#define kVBIOSKey "VBIOS" // nvidia.c getBoolFK +#define kGraphicsModeKey "Graphics Mode" // graphics.c getNumberArraiFP - kFlag +#define kAutoResolutionKey "AutoResolution" // boot.c getBoolFK +#define kGraphicsEnablerKey "GraphicsEnabler" // GraphicsEnabler.c getBoolFK +#define kDSDTKey "DSDT" // acpi_patcher.c getValFK +#define kDropSSDTKey "DropSSDT" // acpi_patcher.c getBoolFK +#define kRestartFixKey "RestartFix" // acpi_patcher.c getBoolFK - revert to true? +#define kGeneratePStatesKey "GeneratePStates" // acpi_patcher.c getBoolFK +#define kGenerateCStatesKey "GenerateCStates" // acpi_patcher.c getBoolFK +#define kEnableC2StatesKey "EnableC2State" // acpi_patcher.c getBoolFK +#define kEnableC3StatesKey "EnableC3State" // acpi_patcher.c getBoolFK +#define kEnableC4StatesKey "EnableC4State" // acpi_patcher.c getBoolFK +#define kUseMemDetectKey "UseMemDetect" // platform.c getBoolFK +#define kSMBIOSdefaultsKey "SMBIOSdefaults" // smbios_patcher.c getBoolFK +#define kSMBIOSKey "SMBIOS" // fake_efi.c getValFK +//Azi: should this be changed to "SystemID"? BootHelp.txt matches SystemId +// cleaned obsolete comments on fake_efi.c, lines 500/508 & 608. +// fixed CHANGES file, lines 39/40. +#define kSystemIDKey "SystemId" // fake_efi.c getStringFK +#define kSystemTypeKey "SystemType" // fake_efi.c getStringFK +#define kPCIRootUIDKey "PciRoot" // pci_root.c getValFK +#define kEthernetBuiltInKey "EthernetBuiltIn" // pci_setup.c getBoolFK +#define kForceHPETKey "ForceHPET" // pci_setup.c getBoolFK +#define kUSBBusFixKey "USBBusFix" // usb.c getBoolFK - trouble! - USBLegacyOff + the other = hang +#define kEHCIacquireKey "EHCIacquire" // usb.c getBoolFK +#define kEHCIhardKey "EHCIhard" // usb.c getBoolFK - ?? +#define kUHCIresetKey "UHCIreset" // usb.c getBoolFK +#define kLegacyOffKey "USBLegacyOff" // usb.c getBoolFK -#define kSMBIOSKey "SMBIOS" /* fake_efi.c */ -#define kSystemID "SystemId" /* fake_efi.c */ -#define kSystemType "SystemType" /* fake_efi.c */ - -#define kUseNvidiaROM "UseNvidiaROM" /* nvidia.c */ -#define kVBIOS "VBIOS" /* nvidia.c */ - -#define kPCIRootUID "PCIRootUID" /* pci_root.c */ - -#define kEthernetBuiltIn "EthernetBuiltIn" /* pci_setup.c */ -#define kGraphicsEnabler "GraphicsEnabler" /* pci_setup.c */ -#define kForceHPET "ForceHPET" /* pci_setup.c */ - -#define kUseMemDetect "UseMemDetect" /* platform.c */ - -#define kSMBIOSdefaults "SMBIOSdefaults" /* smbios_patcher.c */ - -#define kUSBBusFix "USBBusFix" /* usb.c */ -#define kEHCIacquire "EHCIacquire" /* usb.c */ -#define kUHCIreset "UHCIreset" /* usb.c */ -#define kLegacyOff "USBLegacyOff" /* usb.c */ -#define kEHCIhard "EHCIhard" /* usb.c */ -#define kDefaultPartition "Default Partition" /* sys.c */ - -#define kMD0Image "md0" /* ramdisk.h */ - /* - * Flags to the booter or kernel + * Flags to the booter and/or kernel - these end with "Flag". */ -#define kVerboseModeFlag "-v" -#define kSafeModeFlag "-x" -#define kIgnoreCachesFlag "-f" -#define kIgnoreBootFileFlag "-F" -#define kSingleUserModeFlag "-s" +// identifier string location type comment +#define kVerboseModeFlag "-v" // options.c getValFK - kFlag +#define kSafeModeFlag "-x" // options.c getValFBootK & getValFK - ?? - kFlag +#define kIgnoreCachesFlag "-f" // options.c getValFK - kFlag +#define kIgnoreBootFileFlag "-F" // options.c getValFBootK - kFlag +#define kSingleUserModeFlag "-s" // options.c getValFK - kFlag /* * Booter behavior control */ -#define kBootTimeout -1 -#define kCDBootTimeout 8 +#define kBootTimeout -1 +#define kCDBootTimeout 8 +//Azi: place ?? +enum { + kBackspaceKey = 0x08, + kTabKey = 0x09, + kReturnKey = 0x0d, + kEscapeKey = 0x1b, + kUpArrowkey = 0x4800, + kDownArrowkey = 0x5000, + kASCIIKeyMask = 0x7f, + kF2Key = 0x3c00, //Azi:autoresolution + kF5Key = 0x3f00, + kF10Key = 0x4400 +}; + /* * A global set by boot() to record the device that the booter * was loaded from. @@ -133,10 +178,12 @@ extern long gBootMode; extern bool sysConfigValid; extern char bootBanner[]; +extern char bootLogBanner[]; extern char bootPrompt[]; extern bool gOverrideKernel; -extern char *gPlatformName; +extern char *gPlatformName; // disabled ?? extern char gMKextName[]; +extern char gMacOSVersion[]; extern char gRootDevice[]; extern bool gEnableCDROMRescan; extern bool gScanSingleDrive; @@ -192,7 +239,6 @@ /* * drivers.c */ -extern long LoadExtraDrivers(char * dirSpec); extern long LoadDrivers(char * dirSpec); extern long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize); Index: branches/azimutz/Chazi/i386/boot2/modules.c =================================================================== --- branches/azimutz/Chazi/i386/boot2/modules.c (revision 814) +++ branches/azimutz/Chazi/i386/boot2/modules.c (revision 815) @@ -6,6 +6,13 @@ #define DEBUG_MODULES 0 #endif +//#include "boot.h" +//#include "libsa.h" +//#include "saio_internal.h" +//#include "bootstruct.h" +//#include "multiboot.h" +//#include "modules.h" + #include "boot.h" #include "bootstruct.h" #include "modules.h" Index: branches/azimutz/Chazi/i386/boot2/modules.h =================================================================== --- branches/azimutz/Chazi/i386/boot2/modules.h (revision 814) +++ branches/azimutz/Chazi/i386/boot2/modules.h (revision 815) @@ -4,13 +4,13 @@ * */ +#ifndef __BOOT_MODULES_H +#define __BOOT_MODULES_H + #include #include -#ifndef __BOOT_MODULES_H -#define __BOOT_MODULES_H - #define MODULE_PATH "/Extra/modules/" #define SYMBOLS_MODULE "Symbols.dylib" #define VOID_SYMBOL "dyld_void_start" Index: branches/azimutz/Chazi/i386/boot2/bmdecompress.c =================================================================== --- branches/azimutz/Chazi/i386/boot2/bmdecompress.c (revision 814) +++ branches/azimutz/Chazi/i386/boot2/bmdecompress.c (revision 815) @@ -19,8 +19,9 @@ * * @APPLE_LICENSE_HEADER_END@ */ -#include "boot.h" +#include "libsa.h" // replaced boot.h + typedef uint8_t UInt8; typedef uint16_t UInt16; typedef int8_t SInt8; Index: branches/azimutz/Chazi/i386/boot2/gui.c =================================================================== --- branches/azimutz/Chazi/i386/boot2/gui.c (revision 814) +++ branches/azimutz/Chazi/i386/boot2/gui.c (revision 815) @@ -8,32 +8,23 @@ * */ +#include "boot.h" #include "gui.h" #include "appleboot.h" #include "vers.h" #define IMG_REQUIRED -1 -#define THEME_NAME_DEFAULT "Default" -static const char *theme_name = THEME_NAME_DEFAULT; +#define LOADPNG(img, alt_img) if (loadThemeImage(#img, alt_img) != 0) { return 1; } +#define VIDEO(x) (bootArgs->Video.v_ ## x) +#define vram VIDEO(baseAddr) #ifdef EMBED_THEME #include "art.h" #endif -#define LOADPNG(img, alt_img) if (loadThemeImage(#img, alt_img) != 0) { return 1; } - -#define MIN(x, y) ((x) < (y) ? (x) : (y)) -#define MAX(x, y) ((x) > (y) ? (x) : (y)) - -#define VIDEO(x) (bootArgs->Video.v_ ## x) - -#define vram VIDEO(baseAddr) - int lasttime = 0; // we need this for animating maybe +static const char *theme_name = kDefaultThemeName; // #define'ed on boot.h -extern int gDeviceCount; - - /* * ATTENTION: the enum and the following array images[] MUST match !!! */ @@ -138,7 +129,7 @@ int imageCnt = 0; extern int gDeviceCount; -extern int selectIndex; +//extern int selectIndex; Azi: not in use extern MenuItem *menuItems; @@ -168,7 +159,8 @@ static bool infoMenuNativeBoot = false; -static unsigned long screen_params[4] = {DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT, 32, 0}; // here we store the used screen resolution +// here we store the used screen resolution +static unsigned long screen_params[4] = {DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT, 32, 0}; static int getImageIndexByName(const char *name) { @@ -189,8 +181,8 @@ int compareIndex = (upperLimit - lowerLimit) >> 1; // Midpoint int result; - // NOTE: This algorithm assumes that the embeddedImages is sorted. - // This is currently done using the make file. If the array is every + // NOTE: This algorithm assumes that the embedded images are sorted. + // This is currently done using the make file. If the array is ever // manualy generated, this *will* fail to work properly. while((result = strcmp(name, embeddedImages[compareIndex].name)) != 0) { @@ -225,7 +217,7 @@ static int loadThemeImage(const char *image, int alt_image) { - char dirspec[256]; + char dirspec[128]; //Azi: testing int i; #ifdef EMBED_THEME int e; @@ -243,7 +235,7 @@ if (images[i].image == NULL) { images[i].image = malloc(sizeof(pixmap_t)); } - sprintf(dirspec, "/Extra/Themes/%s/%s.png", theme_name, image); + sprintf(dirspec, "bt(0,0)/Extra/Themes/%s/%s.png", theme_name, image); width = 0; height = 0; imagedata = NULL; @@ -393,7 +385,7 @@ gui.backbuffer->width = gui.screen.width; gui.backbuffer->height = gui.screen.height; - + return 0; } @@ -530,7 +522,7 @@ unsigned int pixel; int alpha; // transparency level 0 (obligue) - 255 (transparent) uint32_t color; // color value formatted RRGGBB - int val; + int val; /* * Parse screen parameters @@ -580,7 +572,7 @@ if(getDimensionForKey("countdown_pos_y", &pixel, theme, screen_height , 0 ) ) gui.countdown.pos.y = pixel; - /* + /* * Parse devicelist parameters */ setupDeviceList(theme); @@ -679,59 +671,108 @@ int initGUI(void) { - int val; - int len; - char dirspec[256]; - - getValueForKey( "Theme", &theme_name, &len, &bootInfo->bootConfig ); - if ((strlen(theme_name) + 27) > sizeof(dirspec)) { + int valW, valH, len; //Azi: messing... AR + char dirspec[128]; //Azi: testing + + getValueForKey( kThemeNameKey, &theme_name, &len, &bootInfo->bootConfig ); + if ((strlen(theme_name) + 27) > sizeof(dirspec)) + { return 1; } - sprintf(dirspec, "/Extra/Themes/%s/theme.plist", theme_name); - if (loadConfigFile(dirspec, &bootInfo->themeConfig) != 0) { + + sprintf(dirspec, "bt(0,0)/Extra/Themes/%s/theme.plist", theme_name); + + if (loadConfigFile(dirspec, &bootInfo->themeConfig) != 0) + { #ifdef EMBED_THEME - config_file_t *config; - - config = &bootInfo->themeConfig; - if (ParseXMLFile((char *)__theme_plist, &config->dictionary) != 0) { - return 1; - } + config_file_t *config; + + config = &bootInfo->themeConfig; + if (ParseXMLFile((char *)__theme_plist, &config->dictionary) != 0) + { + return 1; + } #else return 1; #endif } - // parse display size parameters - if (getIntForKey("screen_width", &val, &bootInfo->themeConfig) && val > 0) { - screen_params[0] = val; + else + { + //Azi: just messing around... + getIntForKey("screen_width", &valW, &bootInfo->themeConfig); + getIntForKey("screen_height", &valH, &bootInfo->themeConfig); } - if (getIntForKey("screen_height", &val, &bootInfo->themeConfig) && val > 0) { - screen_params[1] = val; + + // AutoResolution + if (gAutoResolution == true) + { + screen_params[0] = paramsAR[0]; + screen_params[1] = paramsAR[1]; } - + else + { + if (valW > 0) + { + screen_params[0] = valW; + } + + if (valH > 0) + { + screen_params[1] = valH; + } + /* parse screen size parameters + if (getIntForKey("screen_width", &val, &bootInfo->themeConfig) && val > 0) + { + screen_params[0] = val; + } + + if (getIntForKey("screen_height", &val, &bootInfo->themeConfig) && val > 0) + { + screen_params[1] = val; + }*/ + //Azi: how about using default values? - think Azi... + } + // Initalizing GUI strucutre. bzero(&gui, sizeof(gui_t)); // find best matching vesa mode for our requested width & height + //loadConfigFile(dirspec, &bootInfo->themeConfig); //Azi:autoresolution - check this later. getGraphicModeParams(screen_params); - + // set our screen structure with the mode width & height gui.screen.width = screen_params[0]; gui.screen.height = screen_params[1]; - + + PRINT("Theme resolution: %dx%d (theme.plist)\n", valW, valH); + PRINT("Found mode %dx%d in VESA Table\n", gui.screen.width, gui.screen.height); + //Azi: check why is this printing... (reloadAutoRes/debug) + // load graphics otherwise fail and return - if (loadGraphics() == 0) { + if (loadGraphics() == 0) + { loadThemeValues(&bootInfo->themeConfig); colorFont(&font_small, gui.screen.font_small_color); colorFont(&font_console, gui.screen.font_console_color); - + // create the screen & window buffers - if (createBackBuffer(&gui.screen) == 0) { - if (createWindowBuffer(&gui.screen) == 0) { - if (createWindowBuffer(&gui.devicelist) == 0) { - if (createWindowBuffer(&gui.bootprompt) == 0) { - if (createWindowBuffer(&gui.infobox) == 0) { - if (createWindowBuffer(&gui.menu) == 0) { - gui.logo.draw = true; + if (createBackBuffer(&gui.screen) == 0) + { + if (createWindowBuffer(&gui.screen) == 0) + { + if (createWindowBuffer(&gui.devicelist) == 0) + { + if (createWindowBuffer(&gui.bootprompt) == 0) + { + if (createWindowBuffer(&gui.infobox) == 0) + { + if (createWindowBuffer(&gui.menu) == 0) + { + +#ifdef AUTORES_DEBUG + pause(); +#endif + gui.logo.draw = true; drawBackground(); // lets copy the screen into the back buffer memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 ); @@ -739,12 +780,20 @@ gui.initialised = true; return 0; } + else printf("createWindowBuffer(&gui.menu) Failed\n"); } + else printf("createWindowBuffer(&gui.infobox) Failed\n"); } + else printf("createWindowBuffer(&gui.bootprompt) Failed\n"); } + else printf("createWindowBuffer(&gui.devicelist) Failed\n"); } + else printf("createWindowBuffer(&gui.screen) Failed\n"); } + else printf("createBackBuffer(&gui.screen) Failed\n"); } + else printf("loadGraphics() Failed\n"); + return 1; } @@ -805,8 +854,10 @@ void drawDeviceList (int start, int end, int selection) { - int i; - position_t p, p_prev, p_next; + int i; + bool debugInfo = false; //Azi:debuginfo + extern bool showBootBanner; // || + position_t p, p_prev, p_next; //uint8_t maxDevices = MIN( gui.maxdevices, menucount ); @@ -862,23 +913,29 @@ if(gui.menu.draw) drawInfoMenuItems(); - -#if DEBUG - gui.debug.cursor = pos( 10, 100); - dprintf( &gui.screen, "label %s\n", param->label ); - dprintf( &gui.screen, "biosdev 0x%x\n", param->biosdev ); - dprintf(&gui.screen, "width %d\n", gui.screen.width); - dprintf(&gui.screen, "height %d\n", gui.screen.height); - dprintf( &gui.screen, "type 0x%x\n", param->type ); - dprintf( &gui.screen, "flags 0x%x\n", param->flags ); - dprintf( &gui.screen, "part_no %d\n", param->part_no ); - dprintf( &gui.screen, "part_boff 0x%x\n", param->part_boff ); - dprintf( &gui.screen, "part_type 0x%x\n", param->part_type ); - dprintf( &gui.screen, "bps 0x%x\n", param->bps ); - dprintf( &gui.screen, "name %s\n", param->name ); - dprintf( &gui.screen, "type_name %s\n", param->type_name ); - dprintf( &gui.screen, "modtime %d\n", param->modTime ); -#endif + + //Azi: make this info more accessible. + getBoolForKey(kDebugInfoKey, &debugInfo, &bootInfo->bootConfig); + + if (debugInfo && showBootBanner) + { + gui.debug.cursor = pos( 10, 100); + dprintf( &gui.screen, "label: %s\n", param->label ); + dprintf( &gui.screen, "biosdev: 0x%x\n", param->biosdev ); + dprintf( &gui.screen, "type: 0x%x\n", param->type ); + dprintf( &gui.screen, "flags: 0x%x\n", param->flags ); + dprintf( &gui.screen, "part_no: %d\n", param->part_no ); + dprintf( &gui.screen, "part_boff: 0x%x\n", param->part_boff ); + dprintf( &gui.screen, "part_type: 0x%x\n", param->part_type ); + dprintf( &gui.screen, "bps: 0x%x\n", param->bps ); + dprintf( &gui.screen, "name: %s\n", param->name ); + dprintf( &gui.screen, "type_name: %s\n", param->type_name ); + dprintf( &gui.screen, "modtime: %d\n", param->modTime ); + dprintf( &gui.screen, "width: %d\n", gui.screen.width ); + dprintf( &gui.screen, "height: %d\n", gui.screen.height ); + dprintf( &gui.screen, "attr: 0x%x\n", gui.screen.attr ); + dprintf( &gui.screen, "mm: %d\n", gui.screen.mm ); + } } drawDeviceIcon( param, gui.devicelist.pixmap, p, isSelected); @@ -1792,21 +1849,29 @@ // loadBootGraphics static void loadBootGraphics(void) { - if (bootImageData != NULL) { + if (bootImageData != NULL) + { return; } - - char dirspec[256]; - - if ((strlen(theme_name) + 24) > sizeof(dirspec)) { + + char dirspec[128]; //Azi: testing + + if ((strlen(theme_name) + 24) > sizeof(dirspec)) + { usePngImage = false; return; } - sprintf(dirspec, "/Extra/Themes/%s/boot.png", theme_name); - if (loadPngImage(dirspec, &bootImageWidth, &bootImageHeight, &bootImageData) != 0) { + + sprintf(dirspec, "bt(0,0)/Extra/Themes/%s/boot.png", theme_name); + + if (loadPngImage(dirspec, &bootImageWidth, &bootImageHeight, &bootImageData) != 0) + { + #ifdef EMBED_THEME - if ((loadEmbeddedPngImage(__boot_png, __boot_png_len, &bootImageWidth, &bootImageHeight, &bootImageData)) != 0) + if ((loadEmbeddedPngImage(__boot_png, __boot_png_len, + &bootImageWidth, &bootImageHeight, &bootImageData)) != 0) #endif + usePngImage = false; } } @@ -1815,44 +1880,66 @@ // drawBootGraphics void drawBootGraphics(void) { - int pos; - int length; + bool legacy_logo; const char *dummyVal; - int oldScreenWidth, oldScreenHeight; - bool legacy_logo; + int pos, length, oldScreenWidth, oldScreenHeight; uint16_t x, y; - if (getBoolForKey("Legacy Logo", &legacy_logo, &bootInfo->bootConfig) && legacy_logo) { + if (getBoolForKey(kLegacyLogoKey, &legacy_logo, &bootInfo->bootConfig) && legacy_logo) + { usePngImage = false; - } else if (bootImageData == NULL) { + } + else if (bootImageData == NULL) + { loadBootGraphics(); } - // parse screen size parameters - if (getIntForKey("boot_width", &pos, &bootInfo->themeConfig) && pos > 0) { - screen_params[0] = pos; - } else { - screen_params[0] = DEFAULT_SCREEN_WIDTH; + // Save current screen resolution. + oldScreenWidth = gui.screen.width; + oldScreenHeight = gui.screen.height; +// printf("Res: %dx%d (drawbg: current/old)\n", oldScreenWidth, oldScreenHeight); + + // AutoResolution + if (gAutoResolution == true) + { + screen_params[0] = paramsAR[0]; + screen_params[1] = paramsAR[1]; +// printf("Res: %dx%d (drawbg: AR)\n", screen_params[0], screen_params[1]); } - if (getIntForKey("boot_height", &pos, &bootInfo->themeConfig) && pos > 0) { - screen_params[1] = pos; - } else { - screen_params[1] = DEFAULT_SCREEN_HEIGHT; + else + { + // parse boot screen size parameters + if (getIntForKey("boot_width", &pos, &bootInfo->themeConfig) && pos > 0) + { + screen_params[0] = pos; + } + else + { + screen_params[0] = DEFAULT_SCREEN_WIDTH; + } + + if (getIntForKey("boot_height", &pos, &bootInfo->themeConfig) && pos > 0) + { + screen_params[1] = pos; + } + else + { + screen_params[1] = DEFAULT_SCREEN_HEIGHT; + } + //Azi: and how about not using default values here? like on initGUI... } - // Save current screen resolution. - oldScreenWidth = gui.screen.width; - oldScreenHeight = gui.screen.height; - gui.screen.width = screen_params[0]; gui.screen.height = screen_params[1]; - +// printf("Res: %dx%d (drawbg: gsw/h new)\n", gui.screen.width, gui.screen.height); + // find best matching vesa mode for our requested width & height getGraphicModeParams(screen_params); + //Azi: isn't this sort of done on ExecKernel() ?? // Set graphics mode if the booter was in text mode or the screen resolution has changed. if (bootArgs->Video.v_display == VGA_TEXT_MODE - || (screen_params[0] != oldScreenWidth && screen_params[1] != oldScreenHeight) ) + || (screen_params[0] != oldScreenWidth && screen_params[1] != oldScreenHeight)) { setVideoMode(GRAPHICS_MODE, 0); } Index: branches/azimutz/Chazi/i386/boot2/gui.h =================================================================== --- branches/azimutz/Chazi/i386/boot2/gui.h (revision 814) +++ branches/azimutz/Chazi/i386/boot2/gui.h (revision 815) @@ -8,15 +8,12 @@ * */ -#include "boot.h" -#include "bootstruct.h" +#ifndef __BOOT2_GUI_H +#define __BOOT2_GUI_H + #include "graphics.h" -#include "graphic_utils.h" #include "picopng.h" -#ifndef __BOOT2_GUI_H -#define __BOOT2_GUI_H - #define CHARACTERS_COUNT 223 #define BOOT_NORMAL 0 @@ -37,7 +34,7 @@ HorizontalLayout = 0, VerticalLayout = 1, }; - +/* moved to boot.h ?? enum { kBackspaceKey = 0x08, kTabKey = 0x09, @@ -46,9 +43,10 @@ kUpArrowkey = 0x4800, kDownArrowkey = 0x5000, kASCIIKeyMask = 0x7f, + kF2Key = 0x3c00, //Azi:autoresolution kF5Key = 0x3f00, kF10Key = 0x4400 -}; +};*/ /* * Menu item structure. @@ -96,6 +94,16 @@ uint32_t font_small_color; // Color for small font AARRGGBB uint32_t font_console_color; // Color for consle font AARRGGBB bool draw; // Draw flag + // Azi:autoresolution + //resolution specifics + uint16_t htotal; + uint16_t vtotal; + uint16_t hsyncstart; + uint16_t hsyncend; + uint16_t vsyncstart; + uint16_t vsyncend; + uint8_t mm; // Azi:autoresolution - debuginfo + uint16_t attr; } window_t; /* Index: branches/azimutz/Chazi/i386/boot2/ramdisk.c =================================================================== --- branches/azimutz/Chazi/i386/boot2/ramdisk.c (revision 814) +++ branches/azimutz/Chazi/i386/boot2/ramdisk.c (revision 815) @@ -4,8 +4,8 @@ * */ +//#include "bootstruct.h" #include "boot.h" -#include "bootstruct.h" #include "multiboot.h" #include "ramdisk.h" @@ -16,7 +16,7 @@ bool gRAMDiskBTAliased = false; char gRAMDiskFile[512]; -// Notify OS X that a ramdisk has been setup. XNU with attach this to /dev/md0 +// Notify OS X that a ramdisk has been setup. XNU will attach this to /dev/md0 void md0Ramdisk() { RAMDiskParam ramdiskPtr; @@ -25,53 +25,40 @@ int fh = -1; int len; - if(getValueForKey(kMD0Image, &override_filename, &len, - &bootInfo->bootConfig)) + if (getValueForKey(kMD0ImageKey, &override_filename, &len, &bootInfo->bootConfig)) { // Use user specified md0 file sprintf(filename, "%s", override_filename); fh = open(filename, 0); - if(fh < 0) + if (fh < 0) { - sprintf(filename, "rd(0,0)/Extra/%s", override_filename); + sprintf(filename, "rd(0,0)/Extra/Postboot.img"); fh = open(filename, 0); - if(fh < 0) + if (fh < 0) { - sprintf(filename, "/Extra/%s", override_filename); + sprintf(filename, "bt(0,0)/Extra/Postboot.img"); // Check /Extra if not in rd(0,0) fh = open(filename, 0); } } - } - - if(fh < 0) - { - sprintf(filename, "rd(0,0)/Extra/Postboot.img"); - fh = open(filename, 0); - - if(fh < 0) - { - sprintf(filename, "/Extra/Postboot.img"); // Check /Extra if not in rd(0,0) - fh = open(filename, 0); - } } if (fh >= 0) { verbose("Enabling ramdisk %s\n", filename); - ramdiskPtr.size = file_size(fh); + ramdiskPtr.size = file_size(fh); ramdiskPtr.base = AllocateKernelMemory(ramdiskPtr.size); - if(ramdiskPtr.size && ramdiskPtr.base) + if (ramdiskPtr.size && ramdiskPtr.base) { // Read new ramdisk image contents in kernel memory. if (read(fh, (char*) ramdiskPtr.base, ramdiskPtr.size) == ramdiskPtr.size) { AllocateMemoryRange("RAMDisk", ramdiskPtr.base, ramdiskPtr.size, kBootDriverTypeInvalid); Node* node = DT__FindNode("/chosen/memory-map", false); - if(node != NULL) + if (node != NULL) { DT__AddProperty(node, "RAMDisk", sizeof(RAMDiskParam), (void*)&ramdiskPtr); } @@ -91,7 +78,6 @@ } close(fh); - } } @@ -118,7 +104,7 @@ // Reset ramdisk bvr gRAMDiskVolume = NULL; - printf("\nunmounting: done"); + printf("unmounting: done\n"); //Azi: change line breaks on all mesgs...*** } } @@ -131,7 +117,7 @@ fh = open(param, 0); if (fh != -1) { - printf("\nreading ramdisk image: %s", param); + printf("reading ramdisk image: %s\n", param); //Azi: check this later... ramDiskSize = file_size(fh); if (ramDiskSize > 0) @@ -175,7 +161,7 @@ if(gRAMDiskVolume == NULL) { umountRAMDisk(); - printf("\nRamdisk contains no partitions."); + printf("Ramdisk contains no partitions.\n"); } else { @@ -190,10 +176,10 @@ } else { - printf("\nno ramdisk config...\n"); + printf("no ramdisk config...\n"); } - printf("\nmounting: done"); + printf("mounting: done\n"); } } } @@ -206,11 +192,11 @@ gRAMDiskBTAliased = mode; if (mode) { - printf("\nEnabled bt(0,0) alias."); + printf("Enabled bt(0,0) alias.\n"); } else { - printf("\nDisabled bt(0,0) alias."); + printf("Disabled bt(0,0) alias.\n"); } } @@ -223,32 +209,33 @@ { struct multiboot_module * ramdisk_module = (void *)gRAMDiskMI->mi_mods_addr; - printf("\nfile: %s %d", gRAMDiskFile, + printf("file: %s %d\n", gRAMDiskFile, ramdisk_module->mm_mod_end - ramdisk_module->mm_mod_start); - printf("\nalias: %s", gRAMDiskBTAliased ? "enabled" : "disabled"); + printf("alias: %s\n", gRAMDiskBTAliased ? "enabled" : "disabled"); // Display ramdisk information if available. if (getValueForKey("Info", &val, &len, &bootInfo->ramdiskConfig)) { - printf("\ninfo: %s", val); + printf("info: %s\n", val); } else { - printf("\nramdisk info not available."); + printf("ramdisk info not available.\n"); } } else { - printf("\nNo ramdisk mounted."); + printf("No ramdisk mounted.\n"); } } int loadPrebootRAMDisk() { mountRAMDisk("bt(0,0)/Extra/Preboot.dmg"); + if (gRAMDiskMI != NULL) { - printf("\n"); + printf("\n"); // just a line break.. helps separating bdmesg*** return 0; } else @@ -289,6 +276,7 @@ clearScreenRows(0, 24); setCursorPosition(0, 0, 1); showInfoRAMDisk(); + //Azi: check Chazileon on these line breaks here*** printf("\n\nPress any key to continue.\n"); getc(); setActiveDisplayPage(0); Index: branches/azimutz/Chazi/i386/boot2/lzss.c =================================================================== --- branches/azimutz/Chazi/i386/boot2/lzss.c (revision 814) +++ branches/azimutz/Chazi/i386/boot2/lzss.c (revision 815) @@ -40,7 +40,8 @@ * DRI: Josh de Cesare */ -#include +//#include // can't find this guy on the system; maybe we should stop looking for it there first!? +#include "sl.h" //Azi:??? #define N 4096 /* size of ring buffer - must be power of 2 */ #define F 18 /* upper limit for match_length */ Index: branches/azimutz/Chazi/i386/boot2/options.c =================================================================== --- branches/azimutz/Chazi/i386/boot2/options.c (revision 814) +++ branches/azimutz/Chazi/i386/boot2/options.c (revision 815) @@ -23,13 +23,15 @@ */ #include "boot.h" -#include "bootstruct.h" #include "fdisk.h" #include "ramdisk.h" #include "gui.h" #include "embedded.h" #include "pci.h" +#include "options.h" +#include "efi.h" +bool showBootBanner = true; //Azi:debuginfo static bool shouldboot = false; extern int multiboot_timeout; @@ -38,26 +40,17 @@ extern BVRef bvChain; //extern int menucount; -extern int gDeviceCount; +//extern int gDeviceCount; //Azi: header +char gMacOSVersion[8]; //Azi: moved from boot.c ??? declared on boot.h as extern :-/ +static bool getOSVersion(char *str); // || int selectIndex = 0; MenuItem * menuItems = NULL; -enum { - kMenuTopRow = 5, - kMenuMaxItems = 10, - kScreenLastRow = 24 -}; - //========================================================================== -typedef struct { - int x; - int y; - int type; -} CursorState; - -static void changeCursor( int col, int row, int type, CursorState * cs ) +//static //Azi:autoresolution +void changeCursor( int col, int row, int type, CursorState * cs ) { if (cs) getCursorPositionAndType( &cs->x, &cs->y, &cs->type ); setCursorType( type ); @@ -178,7 +171,8 @@ static char booterCommand[BOOT_STRING_LEN]; static char booterParam[BOOT_STRING_LEN]; -static void clearBootArgs(void) +//static //Azi:autoresolution +void clearBootArgs(void) { gBootArgsPtr = gBootArgs; memset(gBootArgs, '\0', BOOT_STRING_LEN); @@ -200,7 +194,8 @@ //========================================================================== -static void showBootPrompt(int row, bool visible) +//static //Azi:autoresolution +void showBootPrompt(int row, bool visible) { extern char bootPrompt[]; extern char bootRescanPrompt[]; @@ -267,7 +262,8 @@ putchar(key); // echo to screen else updateGraphicBootPrompt(key); - *gBootArgsPtr++ = key; + + *gBootArgsPtr++ = key; } break; @@ -302,7 +298,8 @@ //========================================================================== -static void showMenu( const MenuItem * items, int count, +//static //Azi:autoresolution +void showMenu( const MenuItem * items, int count, int selection, int row, int height ) { int i; @@ -320,11 +317,11 @@ gMenuHeight = height; gMenuItemCount = count; gMenuTop = 0; - gMenuBottom = min( count, height ) - 1; + gMenuBottom = MIN( count, height ) - 1; gMenuSelection = selection; gMenuStart = 0; - gMenuEnd = min( count, gui.maxdevices ) - 1; + gMenuEnd = MIN( count, gui.maxdevices ) - 1; // If the selected item is not visible, shift the list down. @@ -446,13 +443,15 @@ gBootMode = kBootModeNormal; addBootArg(kVerboseModeFlag); break; - + case BOOT_IGNORECACHE: gVerboseMode = false; gBootMode = kBootModeNormal; addBootArg(kIgnoreCachesFlag); + //Azi: this one crossed my mind a lot of times.. nice going :) + addBootArg(kVerboseModeFlag); //Slice - if ignore cache then verbose break; - + case BOOT_SINGLEUSER: gVerboseMode = true; gBootMode = kBootModeNormal; @@ -674,17 +673,24 @@ } //========================================================================== +//Azi: autoresolution +int key; +int nextRow; +BVRef menuBVR; +bool showPrompt; +extern void reloadAutoRes(); int getBootOptions(bool firstRun) { int i; - int key; - int nextRow; +// int key; +// int nextRow; int timeout; int bvCount; BVRef bvr; - BVRef menuBVR; - bool showPrompt, newShowPrompt, isCDROM; +// BVRef menuBVR; +// bool showPrompt; + bool newShowPrompt, isCDROM; // Initialize default menu selection entry. gBootVolume = menuBVR = selectBootVolume(bvChain); @@ -775,20 +781,28 @@ int cnt; int optionKey; - if (getValueForKey(kCDROMPromptKey, &val, &cnt, &bootInfo->bootConfig)) { + //Azi:--- + if (getValueForKey(kCDROMPromptKey, &val, &cnt, &bootInfo->bootConfig)) + { prompt = malloc(cnt + 1); strncat(prompt, val, cnt); - } else { + } + else + { name = malloc(80); getBootVolumeDescription(gBootVolume, name, 79, false); prompt = malloc(256); + //Azi: too long for 80X25, GUI=n, vmware, depending on the device name (more than 5 char). sprintf(prompt, "Press any key to start up from %s, or press F8 to enter startup options.", name); free(name); } - if (getIntForKey( kCDROMOptionKey, &optionKey, &bootInfo->bootConfig )) { + if (getIntForKey( kCDROMOptionKey, &optionKey, &bootInfo->bootConfig )) + { // The key specified is a special key. - } else { + } + else + { // Default to F8. optionKey = 0x4200; } @@ -871,7 +885,6 @@ gui.devicelist.draw = true; gui.redraw = true; if (!(gBootMode & kBootModeQuiet)) { - bool showBootBanner = true; // Check if "Boot Banner"=N switch is present in config file. getBoolForKey(kBootBannerKey, &showBootBanner, &bootInfo->bootConfig); @@ -897,7 +910,7 @@ printf("Use \30\31 keys to select the startup volume."); } showMenu( menuItems, gDeviceCount, selectIndex, kMenuTopRow + 2, kMenuMaxItems ); - nextRow += min( gDeviceCount, kMenuMaxItems ) + 3; + nextRow += MIN( gDeviceCount, kMenuMaxItems ) + 3; } // Show the boot prompt. @@ -941,30 +954,50 @@ /* * TODO: this needs to be refactored. */ - if (strcmp( booterCommand, "video" ) == 0) { - if (bootArgs->Video.v_display == GRAPHICS_MODE) { + if (strcmp( booterCommand, "video" ) == 0) + { + if (bootArgs->Video.v_display == GRAPHICS_MODE) + { showInfoBox(getVBEInfoString(), getVBEModeInfoString()); - } else { + } + else + { printVBEModeInfo(); } - } else if ( strcmp( booterCommand, "memory" ) == 0) { - if (bootArgs->Video.v_display == GRAPHICS_MODE ) { + } + else if ( strcmp( booterCommand, "memory" ) == 0) + { + if (bootArgs->Video.v_display == GRAPHICS_MODE ) + { showInfoBox("Memory Map", getMemoryInfoString()); - } else { + } + else + { printMemoryInfo(); } - } else if (strcmp(booterCommand, "lspci") == 0) { + } + else if (strcmp(booterCommand, "lspci") == 0) + { lspci(); - } else if (strcmp(booterCommand, "more") == 0) { + } + else if (strcmp(booterCommand, "more") == 0) + { showTextFile(booterParam); - } else if (strcmp(booterCommand, "rd") == 0) { + } + else if (strcmp(booterCommand, "rd") == 0) + { processRAMDiskCommand(&argPtr, booterParam); - } else if (strcmp(booterCommand, "norescan") == 0) { - if (gEnableCDROMRescan) { + } + else if (strcmp(booterCommand, "norescan") == 0) + { + if (gEnableCDROMRescan) + { gEnableCDROMRescan = false; break; } - } else { + } + else + { showHelp(); } key = 0; @@ -980,6 +1013,12 @@ clearBootArgs(); break; + // AutoResolution - Reapply the patch if Graphics Mode was incorrect + // or EDID Info was insane. + case kF2Key: + reloadAutoRes(); + break; + case kF5Key: // New behavior: // Clear gBootVolume to restart the loop @@ -991,7 +1030,7 @@ } break; - case kF10Key: + case kF10Key: //Azi: disable "Scan Single Drive"=y (if set) and rescan disks. gScanSingleDrive = false; scanDisks(gBIOSDev, &bvCount); gBootVolume = NULL; @@ -1022,7 +1061,7 @@ if (gDeviceCount) { printf("Use \30\31 keys to select the startup volume."); showMenu(menuItems, gDeviceCount, selectIndex, kMenuTopRow + 2, kMenuMaxItems); - nextRow += min(gDeviceCount, kMenuMaxItems) + 3; + nextRow += MIN(gDeviceCount, kMenuMaxItems) + 3; } showPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot); @@ -1138,8 +1177,9 @@ bool uuidSet = false; char * configKernelFlags; char * valueBuffer; + extern void setupSmbiosConfigFile(); // test :P - valueBuffer = malloc(VALUE_SIZE); + valueBuffer = malloc(VALUE_SIZE); // 2048 skipblanks( &cp ); @@ -1170,19 +1210,29 @@ // trying to load the config file anyway. else return -1; - + + // Moved here to enable search for override Boot.plist on OS specific folders. + // Find out which Mac OS version we're booting. + // make sure the damn thing get's cleaned, just in case... :)* + bzero(gMacOSVersion, sizeof(gMacOSVersion)); // do this to argP ??... check it***** + getOSVersion(gMacOSVersion); + + //Azi: implemented at loadOverrideConfig. ??? // Load config table specified by the user, or use the default. + //if (!getValueForBootKey(cp, "config", &val, &cnt)) { + // val = 0; + // cnt = 0; + //} +// loadSystemConfig(val, cnt); Azi:reminder +// if ( !sysConfigValid ) return -1; - if (!getValueForBootKey(cp, "config", &val, &cnt)) { - val = 0; - cnt = 0; - } - // Load com.apple.Boot.plist from the selected volume // and use its contents to override default bootConfig. - // This is not a mandatory opeartion anymore. + // This is not a mandatory operation anymore. loadOverrideConfig(&bootInfo->overrideConfig); + // testing ugly hack :P + setupSmbiosConfigFile("SMBIOS.plist"); // Use the kernel name specified by the user, or fetch the name // in the config table, or use the default if not specified. @@ -1191,122 +1241,143 @@ // overriding the kernel, which causes the kernelcache not // to be used. - gOverrideKernel = false; - if (( kernel = extractKernelName((char **)&cp) )) { - strcpy( bootInfo->bootFile, kernel ); - gOverrideKernel = true; - } else { - if ( getValueForKey( kKernelNameKey, &val, &cnt, &bootInfo->bootConfig ) ) { - strlcpy( bootInfo->bootFile, val, cnt+1 ); - if (strcmp( bootInfo->bootFile, kDefaultKernel ) != 0) { - gOverrideKernel = true; - } - } else { - strcpy( bootInfo->bootFile, kDefaultKernel ); - } - } + gOverrideKernel = false; + //Azi: setting bootFile - kernel name (path) used in common_boot() + if (( kernel = extractKernelName((char **)&cp) )) // boot prompt + { + strcpy( bootInfo->bootFile, kernel ); + gOverrideKernel = true; + } + else + { + if ( getValueForKey( kKernelNameKey, &val, &cnt, &bootInfo->bootConfig ) ) // Boot.plist + { + strlcpy( bootInfo->bootFile, val, cnt+1 ); + if (strcmp( bootInfo->bootFile, kDefaultKernelName ) != 0) + { + gOverrideKernel = true; + } + } + else + { + strcpy( bootInfo->bootFile, kDefaultKernelName ); // mach_kernel + } + } cntRemaining = BOOT_STRING_LEN - 2; // save 1 for NULL, 1 for space argP = bootArgs->CommandLine; // Get config table kernel flags, if not ignored. - if (getValueForBootKey(cp, kIgnoreBootFileFlag, &val, &cnt) || - !getValueForKey( kKernelFlagsKey, &val, &cnt, &bootInfo->bootConfig )) { + if (getValueForBootKey(cp, kIgnoreBootFileFlag, &val, &cnt) || // if -F arg was used... + // don't get the value/s passed by "Kernel Flags" key on "override" Boot.plist. + //Azi: test this***** + !getValueForKey( kKernelFlagsKey, &val, &cnt, &bootInfo->bootConfig )) + { val = ""; cnt = 0; } configKernelFlags = malloc(cnt + 1); strlcpy(configKernelFlags, val, cnt + 1); - if (processBootArgument(kBootUUIDKey, cp, configKernelFlags, bootInfo->config, &argP, &cntRemaining, 0)) { - // boot-uuid was set either on the command-line - // or in the config file. + // user provided a uuid... at boot prompt or override Boot.plist ?? + if (processBootArgument(kBootUUIDKey/*boot-uuid*/, cp, configKernelFlags, bootInfo->config, &argP, &cntRemaining, 0)) + { + // "boot-uuid" was set either on the command-line or in the config file. uuidSet = true; - } else { - - // + } + else + { // Try an alternate method for getting the root UUID on boot helper partitions. - // if (gBootVolume->flags & kBVFlagBooter) { - if((loadHelperConfig(&bootInfo->helperConfig) == 0) - && getValueForKey(kHelperRootUUIDKey, &val, &cnt, &bootInfo->helperConfig) ) + if ((loadHelperConfig(&bootInfo->helperConfig) == 0) && + getValueForKey(kHelperRootUUIDKey, &val, &cnt, &bootInfo->helperConfig) ) { - getValueForKey(kHelperRootUUIDKey, &val, &cnt, &bootInfo->helperConfig); - copyArgument(kBootUUIDKey, val, cnt, &argP, &cntRemaining); - uuidSet = true; + getValueForKey(kHelperRootUUIDKey, &val, &cnt, &bootInfo->helperConfig); + copyArgument(kBootUUIDKey/*boot-uuid*/, val, cnt, &argP, &cntRemaining); + uuidSet = true; } } - if (!uuidSet && gBootVolume->fs_getuuid && gBootVolume->fs_getuuid (gBootVolume, uuidStr) == 0) { + if (!uuidSet && gBootVolume->fs_getuuid && gBootVolume->fs_getuuid(gBootVolume, uuidStr) == 0) + { verbose("Setting boot-uuid to: %s\n", uuidStr); - copyArgument(kBootUUIDKey, uuidStr, strlen(uuidStr), &argP, &cntRemaining); + copyArgument(kBootUUIDKey/*boot-uuid*/, uuidStr, strlen(uuidStr), &argP, &cntRemaining); uuidSet = true; } } - if (!processBootArgument(kRootDeviceKey, cp, configKernelFlags, bootInfo->config, &argP, &cntRemaining, gRootDevice)) { + // if no rd=diskXsY key issued by user... at boot prompt or override Boot.plist ?? + if (!processBootArgument(kRootDeviceKey, + cp, configKernelFlags, bootInfo->config, &argP, &cntRemaining, gRootDevice)) + { cnt = 0; - if ( getValueForKey( kBootDeviceKey, &val, &cnt, &bootInfo->bootConfig)) { - valueBuffer[0] = '*'; + // try "Boot Device" key ??? + if (getValueForKey(kBootDeviceKey, &val, &cnt, &bootInfo->bootConfig)) + { + valueBuffer[0] = '*'; // check for rd=*uuid ??? cnt++; strlcpy(valueBuffer + 1, val, cnt); val = valueBuffer; - } else { - if (uuidSet) { + } + else + { + if (uuidSet) + { val = "*uuid"; - cnt = 5; - } else { + cnt = 5; // nr of characters on *uuid + } + else + { // Don't set "rd=.." if there is no boot device key // and no UUID. val = ""; cnt = 0; } - } - if (cnt > 0) { - copyArgument( kRootDeviceKey, val, cnt, &argP, &cntRemaining); } - strlcpy( gRootDevice, val, (cnt + 1)); + + if (cnt > 0) + { + copyArgument(kRootDeviceKey, val, cnt, &argP, &cntRemaining); + } + strlcpy(gRootDevice, val, (cnt + 1)); } - /* - * Removed. We don't need this anymore. - * - if (!processBootArgument(kPlatformKey, cp, configKernelFlags, bootInfo->config, &argP, &cntRemaining, gPlatformName)) { - getPlatformName(gPlatformName); - copyArgument(kPlatformKey, gPlatformName, strlen(gPlatformName), &argP, &cntRemaining); - } - */ - if (!getValueForBootKey(cp, kSafeModeFlag, &val, &cnt) && - !getValueForBootKey(configKernelFlags, kSafeModeFlag, &val, &cnt)) { - if (gBootMode & kBootModeSafe) { + !getValueForBootKey(configKernelFlags, kSafeModeFlag, &val, &cnt)) + { + if (gBootMode & kBootModeSafe) + { copyArgument(0, kSafeModeFlag, strlen(kSafeModeFlag), &argP, &cntRemaining); } } // Store the merged kernel flags and boot args. - - cnt = strlen(configKernelFlags); - if (cnt) { - if (cnt > cntRemaining) { - error("Warning: boot arguments too long, truncating\n"); - cnt = cntRemaining; - } - strncpy(argP, configKernelFlags, cnt); - argP[cnt++] = ' '; - cntRemaining -= cnt; - } - userCnt = strlen(cp); - if (userCnt > cntRemaining) { - error("Warning: boot arguments too long, truncating\n"); - userCnt = cntRemaining; - } - strncpy(&argP[cnt], cp, userCnt); - argP[cnt+userCnt] = '\0'; - - if(!shouldboot) + cnt = strlen(configKernelFlags); + if (cnt) { + if (cnt > cntRemaining) { + error("Warning: boot arguments too long, truncating\n"); + cnt = cntRemaining; + } + strncpy(argP, configKernelFlags, cnt); + argP[cnt++] = ' '; + cntRemaining -= cnt; + } + + userCnt = strlen(cp); + if (userCnt > cntRemaining) + { + error("Warning: boot arguments too long, truncating\n"); + userCnt = cntRemaining; + } + strncpy(&argP[cnt], cp, userCnt); + verbose("BootArgs = %s\n", argP); //Azi: checking... + argP[cnt+userCnt] = '\0'; + verbose("BootArgs check = %s\n", argP); // || + + if (!shouldboot) + { gVerboseMode = getValueForKey( kVerboseModeFlag, &val, &cnt, &bootInfo->bootConfig ) || getValueForKey( kSingleUserModeFlag, &val, &cnt, &bootInfo->bootConfig ); @@ -1314,7 +1385,7 @@ kBootModeSafe : kBootModeNormal; if ( getValueForKey( kIgnoreCachesFlag, &val, &cnt, &bootInfo->bootConfig ) ) { - gBootMode = kBootModeSafe; + gBootMode = kBootModeSafe; //Azi: ?? } } @@ -1329,7 +1400,42 @@ return 0; } +static bool getOSVersion(char *str) //Azi: moved from boot.c +{ + bool valid = false; + config_file_t systemVersion; + const char *val; + int len; + if (!loadConfigFile("/System/Library/CoreServices/SystemVersion.plist", &systemVersion)) + { //Azi: so, is this path on selected or current volume?? ... clean! + valid = true; + } + else if (!loadConfigFile("/System/Library/CoreServices/ServerVersion.plist", &systemVersion)) + { + valid = true; + } + + if (valid) + { + if (getValueForKey("ProductVersion", &val, &len, &systemVersion)) + { + // getValueForKey uses const char for val + strncat(str, val, len); //Azi: nothing better to do :P +// msglog("System Version: %s\n", str); + verbose("Loading Darwin %s\n", str); + + // so copy it and trim + *str = '\0'; + strncat(str, val, MIN(len, 4)); + } + else + valid = false; + } + + return valid; +} + //========================================================================== // Load the help file and display the file contents on the screen. @@ -1410,26 +1516,31 @@ } } -void showTextFile(const char * filename) +void showTextFile(const char * filename) //Azi:?more { #define MAX_TEXT_FILE_SIZE 65536 - char *buf; - int fd; - int size; + char *buf; + int fd; + int size; - if ((fd = open_bvdev("bt(0,0)", filename, 0)) < 0) { + if ((fd = open_bvdev("bt(0,0)", filename, 0)) < 0) + { printf("\nFile not found: %s\n", filename); sleep(2); return; } - size = file_size(fd); - if (size > MAX_TEXT_FILE_SIZE) { + size = file_size(fd); + + if (size > MAX_TEXT_FILE_SIZE) + { size = MAX_TEXT_FILE_SIZE; } - buf = malloc(size); - read(fd, buf, size); - close(fd); + + buf = malloc(size); + read(fd, buf, size); + close(fd); + showTextBuffer(buf, size); free(buf); } @@ -1438,6 +1549,7 @@ // Eventually we need to do something more user-friendly like display a menu // based off of the Multiboot device list +//Azi: is this stuff still used for anything?? check multiboot()... int selectAlternateBootDevice(int bootdevice) { int key; Index: branches/azimutz/Chazi/i386/doc/README =================================================================== --- branches/azimutz/Chazi/i386/doc/README (revision 814) +++ branches/azimutz/Chazi/i386/doc/README (revision 815) @@ -20,7 +20,7 @@ For DOS compatibility reason, one extra stage of boot is required if the boot device is a hard disk. The first sector of the hard disk will - contain the MOS-DOS boot code and a boot record partition table. + contain the MS-DOS boot code and a boot record partition table. When this sector is loaded into 0000:7C00H, it will relocate itself to somewhere else and then load the first sector of the active partition into 0000:7C00H. Both UNIX and DOS use the command "fdisk" @@ -51,7 +51,7 @@ stage bootstrap loader "boot2()". In order to be able to load the big kernel image (bigger than 512K or 640K, depends on the memory configuration), the second stage boot loader will run on the protected - mode. This bootstarp loader does not have any stand alone device + mode. This bootstrap loader does not have any stand alone device drivers, all the I/O's are through the BIOS calls. Since the first stage boot code will no longer be used at this moment, the memory location of the first stage boot code (0000:1000H to 0000:1200H) will @@ -62,7 +62,7 @@ and boot data segments must not be greater than 64K. The boot loader loads the kernel image at memory location above 1 MB - to skip the memory hole between 521K/640K and 1MB. After the kernel + to skip the memory hole between 512K/640K and 1MB. After the kernel is loaded, the boot loader stores the information in the stack and then passes control to kernel. Currently, the three information passed from the boot loader to the kernel are type of the boot device, size Index: branches/azimutz/Chazi/i386/cdboot/Makefile =================================================================== --- branches/azimutz/Chazi/i386/cdboot/Makefile (revision 814) +++ branches/azimutz/Chazi/i386/cdboot/Makefile (revision 815) @@ -3,19 +3,17 @@ include ../MakePaths.dir NASM = $(shell which nasm) -#/Developer/usr/bin/nasm INSTALLDIR = $(DSTROOT)/usr/standalone/i386 DIRS_NEEDED = $(SYMROOT) -all embedtheme optionrom: $(DIRS_NEEDED) cdboot +all embedtheme: $(DIRS_NEEDED) cdboot cdboot: cdboot.s $(SYMROOT)/boot Makefile $(NASM) - @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 + $(NASM) cdboot.s -o $(SYMROOT)/cdboot + dd if=$(SYMROOT)/boot of=$(SYMROOT)/cdboot conv=sync bs=2k seek=1 &> /dev/null - @# Update cdboot with boot file size info - @stat -f%z $(SYMROOT)/boot \ + # Update cdboot with boot file size info + stat -f%z $(SYMROOT)/boot \ | perl -ane "print pack('V',@F[0]);" \ | dd of=$(SYMROOT)/cdboot bs=1 count=4 seek=2044 conv=notrunc &> /dev/null Index: branches/azimutz/Chazi/i386/libsa/zalloc.c =================================================================== --- branches/azimutz/Chazi/i386/libsa/zalloc.c (revision 814) +++ branches/azimutz/Chazi/i386/libsa/zalloc.c (revision 815) @@ -30,10 +30,13 @@ */ #include "libsa.h" -//#include "saio_internal.h" - Azi: needed for ZDEBUG (printf) +//#include "saio_internal.h" //Azi: needed for ZDEBUG (printf). +// Check other DEBUG's, i forgot those while messing with includes. #include "memory.h" -#define ZDEBUG 0 //Azi: booter doesn't load with this enabled; instant reboot at "boot1: ..." +#define ZDEBUG 0 +//Azi: this DEBUG is messed up; it hangs while "boot1: ..." with +// black screen on my branch and instant reboot on trunk. #if ZDEBUG int zout; @@ -250,8 +253,9 @@ zcoalesce(); return; } - -static void +//Azi: static - Mek +//static +void zallocate(char * start,int size) { #if ZDEBUG Index: branches/azimutz/Chazi/i386/libsa/qsort.c =================================================================== --- branches/azimutz/Chazi/i386/libsa/qsort.c (revision 814) +++ branches/azimutz/Chazi/i386/libsa/qsort.c (revision 815) @@ -58,11 +58,11 @@ #include #include +#include "saio_types.h" //Azi: min/max + static inline char *med3 __P((char *, char *, char *, int (*)())); static inline void swapfunc __P((char *, char *, int, int)); -#define min(a, b) (a) < (b) ? a : b - /* * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function". */ @@ -178,9 +178,9 @@ } pn = a + n * es; - r = min(pa - (char *)a, pb - pa); + r = MIN(pa - (char *)a, pb - pa); vecswap(a, pb - r, r); - r = min(pd - pc, (pn - pd) - (int)es); + r = MIN(pd - pc, (pn - pd) - (int)es); vecswap(pb, pn - r, r); if ((r = pb - pa) > (int)es) qsort(a, r / es, es, cmp); Index: branches/azimutz/Chazi/i386/libsa/Makefile =================================================================== --- branches/azimutz/Chazi/i386/libsa/Makefile (revision 814) +++ branches/azimutz/Chazi/i386/libsa/Makefile (revision 815) @@ -45,12 +45,9 @@ all embedtheme: $(DIRS_NEEDED) $(LIBS) libsa.a: $(SA_OBJS) - @echo "\t[RM] $(SYMROOT)/$(@F)" - @rm -f $(SYMROOT)/$(@F) - @echo "\t[AR] $@" - @ar q $(SYMROOT)/$(@F) $^ &> /dev/null - @echo "\t[RANLIB] $@" - @ranlib $(SYMROOT)/$(@F) + rm -f $(SYMROOT)/$(@F) + ar q $(SYMROOT)/$(@F) $^ + ranlib $(SYMROOT)/$(@F) $(INSTALL_SA_DIR) $(INSTALL_MD_DIR): $(MKDIRS) $@ Index: branches/azimutz/Chazi/i386/util/bdmesg.c =================================================================== --- branches/azimutz/Chazi/i386/util/bdmesg.c (revision 814) +++ branches/azimutz/Chazi/i386/util/bdmesg.c (revision 815) @@ -18,7 +18,7 @@ io_registry_entry_t root = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/"); if (!root) { - printf("IORegistryEntry \"IOIOService:/\" not found.\n"); + printf("IORegistryEntry \"IOService:/\" not found.\n"); return 0; } Index: branches/azimutz/Chazi/i386/util/Makefile =================================================================== --- branches/azimutz/Chazi/i386/util/Makefile (revision 814) +++ branches/azimutz/Chazi/i386/util/Makefile (revision 815) @@ -26,39 +26,23 @@ all embedtheme: $(DIRS_NEEDED) $(PROGRAMS) -dyldsymboltool: dyldsymboltool.o32 dyldsymboltool.o64 - @echo "\t[LD32] $@_32" - @$(CC) $(CFLAGS) $(LDFLAGS) $(DEFINES) -arch i386 -o $(SYMROOT)/$(@F)_32 $(OBJROOT)/$(@F).o32 - @echo "\t[LD64] $@_64" - @$(CC) $(CFLAGS) $(LDFLAGS) $(DEFINES) -arch x86_64 -o $(SYMROOT)/$(@F)_64 $(OBJROOT)/$(@F).o64 - @echo "\t[LIPO] $@" - @lipo -create -arch i386 $(SYMROOT)/$(@F)_32 -arch x86_64 $(SYMROOT)/$(@F)_64 -output $(SYMROOT)/$(@F) - @$(RM) $(SYMROOT)/$(@F)_32 $(SYMROOT)/$(@F)_64 - - machOconv: machOconv.o32 machOconv.o64 - @echo "\t[LD32] $@_32" - @$(CC) $(CFLAGS) $(LDFLAGS) $(DEFINES) -arch i386 -o $(SYMROOT)/$(@F)_32 $(OBJROOT)/$(@F).o32 - @echo "\t[LD64] $@_64" - @$(CC) $(CFLAGS) $(LDFLAGS) $(DEFINES) -arch x86_64 -o $(SYMROOT)/$(@F)_64 $(OBJROOT)/$(@F).o64 - @echo "\t[LIPO] $@" - @lipo -create -arch i386 $(SYMROOT)/$(@F)_32 -arch x86_64 $(SYMROOT)/$(@F)_64 -output $(SYMROOT)/$(@F) - @$(RM) $(SYMROOT)/$(@F)_32 $(SYMROOT)/$(@F)_64 + $(CC) $(CFLAGS) $(LDFLAGS) $(DEFINES) -arch i386 -o $(SYMROOT)/$(@F)_32 $(OBJROOT)/$(@F).o32 + $(CC) $(CFLAGS) $(LDFLAGS) $(DEFINES) -arch x86_64 -o $(SYMROOT)/$(@F)_64 $(OBJROOT)/$(@F).o64 + lipo -create -arch i386 $(SYMROOT)/$(@F)_32 -arch x86_64 $(SYMROOT)/$(@F)_64 -output $(SYMROOT)/$(@F) + $(RM) $(SYMROOT)/$(@F)_32 $(SYMROOT)/$(@F)_64 bdmesg: bdmesg.o32 bdmesg.o64 - @echo "\t[LD32] $@_32" - @$(CC) $(CFLAGS) $(LDFLAGS) -framework IOKit -framework CoreFoundation -mmacosx-version-min=10.5 \ - -arch i386 -o $(SYMROOT)/$(@F)_32 $(OBJROOT)/$(@F).o32 - @echo "\t[LD64] $@_64" - @$(CC) $(CFLAGS) $(LDFLAGS) -framework IOKit -framework CoreFoundation -mmacosx-version-min=10.5 \ - -arch x86_64 -o $(SYMROOT)/$(@F)_64 $(OBJROOT)/$(@F).o64 - @echo "\t[LIPO] $@" - @lipo -create -arch i386 $(SYMROOT)/$(@F)_32 -arch x86_64 $(SYMROOT)/$(@F)_64 -output $(SYMROOT)/$(@F) - @$(RM) $(SYMROOT)/$(@F)_32 $(SYMROOT)/$(@F)_64 + $(CC) $(CFLAGS) $(LDFLAGS) -framework IOKit -framework CoreFoundation -mmacosx-version-min=10.5 \ + -arch i386 -o $(SYMROOT)/$(@F)_32 $(OBJROOT)/$(@F).o32 + $(CC) $(CFLAGS) $(LDFLAGS) -framework IOKit -framework CoreFoundation -mmacosx-version-min=10.5 \ + -arch x86_64 -o $(SYMROOT)/$(@F)_64 $(OBJROOT)/$(@F).o64 + lipo -create -arch i386 $(SYMROOT)/$(@F)_32 -arch x86_64 $(SYMROOT)/$(@F)_64 -output $(SYMROOT)/$(@F) + $(RM) $(SYMROOT)/$(@F)_32 $(SYMROOT)/$(@F)_64 include ../MakeInc.dir #dependencies --include $(OBJROOT)/Makedep \ No newline at end of file +-include $(OBJROOT)/Makedep Property changes on: branches/azimutz/Chazi ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r809-813