Index: branches/valv/doc/README =================================================================== --- branches/valv/doc/README (revision 171) +++ branches/valv/doc/README (revision 172) @@ -18,8 +18,7 @@ - automatic FSB detection code even for recent AMD CPUs. - Apple Software RAID support. - stage2 loader (boot) can be placed as a regular file in the boot - partition's root folder. It has precedence over the embedded - startupfile. + partition's root folder. Installation @@ -31,7 +30,7 @@ Suppose that your installation is on /dev/disk0s2 - Install boot0 to the MBR: - sudo fdisk -f boot0 -u -y /dev/rdisk0 + sudo ./fdisk440 -f boot0 -u -y /dev/rdisk0 - Install boot1h to the partition's bootsector: sudo dd if=boot1h of=/dev/rdisk0s2 @@ -52,8 +51,8 @@ namely /dev/disk0s3 and /dev/disk1s3 - Install boot0 to the MBR of both disks: - sudo fdisk -f boot0 -u -y /dev/rdisk0 - sudo fdisk -f boot0 -u -y /dev/rdisk1 + sudo ./fdisk440 -f boot0 -u -y /dev/rdisk0 + sudo ./fdisk440 -f boot0 -u -y /dev/rdisk1 - Install boot1h to the bootsector of each boot partition: sudo dd if=boot1h of=/dev/rdisk0s3 @@ -67,13 +66,6 @@ cp boot /Volumes/Boot\ OSX diskutil unmount disk1s3 - - Add "rd=uuid boot-uuid=506D8F03-0596-32D8-BE0B-E3A4E7D5C72A" to your kernel flags - (replace with your root volume's UUID; find out using "Disk Utility.app", right - click on your root volume, then Get Info"): - nano /Library/Preferences/SystemConfiguration/com.apple.Boot.plist - touch /System/Library/Extensions - - Support: -------- @@ -93,5 +85,3 @@ Chameleon is released under the terms and conditions of Apple Public Source License (see APPLE_LICENSE). - To use "Chameleon" for commercial purposes please contact us at: - http://chameleon.osx86.hu/contact Index: branches/valv/i386/libsaio/smbios_patcher.c =================================================================== --- branches/valv/i386/libsaio/smbios_patcher.c (revision 171) +++ branches/valv/i386/libsaio/smbios_patcher.c (revision 172) @@ -240,22 +240,22 @@ {.name="SMmanufacter", .table_type= 1, .value_type=SMSTRING, .offset=0x04, .auto_str=sm_get_defstr }, {.name="SMproductname", .table_type= 1, .value_type=SMSTRING, .offset=0x05, .auto_str=sm_get_defstr }, {.name="SMsystemversion", .table_type= 1, .value_type=SMSTRING, .offset=0x06, .auto_str=sm_get_defstr }, - {.name="SMserial", .table_type= 1, .value_type=SMSTRING, .offset=0x07, .auto_str=sm_get_defstr }, - {.name="SMUUID", .table_type= 1, .value_type=SMOWORD, .offset=0x08, .auto_oword=0 }, - {.name="SMfamily", .table_type= 1, .value_type=SMSTRING, .offset=0x1a, .auto_str=sm_get_defstr }, + {.name="SMserial", .table_type= 1, .value_type=SMSTRING, .offset=0x07, .auto_str=sm_get_defstr }, + {.name="SMUUID", .table_type= 1, .value_type=SMOWORD, .offset=0x08, .auto_oword=0 }, + {.name="SMfamily", .table_type= 1, .value_type=SMSTRING, .offset=0x1a, .auto_str=sm_get_defstr }, {.name="SMboardmanufacter", .table_type= 2, .value_type=SMSTRING, .offset=0x04, .auto_str=sm_get_defstr }, {.name="SMboardproduct", .table_type= 2, .value_type=SMSTRING, .offset=0x05, .auto_str=sm_get_defstr }, - {.name="SMexternalclock", .table_type= 4, .value_type=SMWORD, .offset=0x12, .auto_int=sm_get_fsb }, - {.name="SMmaximalclock", .table_type= 4, .value_type=SMWORD, .offset=0x14, .auto_int=sm_get_cpu }, - {.name="SMmemdevloc", .table_type=17, .value_type=SMSTRING, .offset=0x10, .auto_str=0 }, - {.name="SMmembankloc", .table_type=17, .value_type=SMSTRING, .offset=0x11, .auto_str=0 }, - {.name="SMmemtype", .table_type=17, .value_type=SMBYTE, .offset=0x12, .auto_int=sm_get_memtype}, - {.name="SMmemspeed", .table_type=17, .value_type=SMWORD, .offset=0x15, .auto_int=sm_get_memspeed}, + {.name="SMexternalclock", .table_type= 4, .value_type=SMWORD, .offset=0x12, .auto_int=sm_get_fsb }, + {.name="SMmaximalclock", .table_type= 4, .value_type=SMWORD, .offset=0x14, .auto_int=sm_get_cpu }, + {.name="SMmemdevloc", .table_type=17, .value_type=SMSTRING, .offset=0x10, .auto_str=0 }, + {.name="SMmembankloc", .table_type=17, .value_type=SMSTRING, .offset=0x11, .auto_str=0 }, + {.name="SMmemtype", .table_type=17, .value_type=SMBYTE, .offset=0x12, .auto_int=sm_get_memtype}, + {.name="SMmemspeed", .table_type=17, .value_type=SMWORD, .offset=0x15, .auto_int=sm_get_memspeed}, {.name="SMmemmanufacter", .table_type=17, .value_type=SMSTRING, .offset=0x17, .auto_str=sm_get_memvendor}, {.name="SMmemserial", .table_type=17, .value_type=SMSTRING, .offset=0x18, .auto_str=sm_get_memserial}, - {.name="SMmempart", .table_type=17, .value_type=SMSTRING, .offset=0x1A, .auto_str=sm_get_mempartno}, - {.name="SMcputype", .table_type=131,.value_type=SMWORD, .offset=0x04, .auto_int=sm_get_cputype}, - {.name="SMbusspeed", .table_type=132,.value_type=SMWORD, .offset=0x04, .auto_str=0 } + {.name="SMmempart", .table_type=17, .value_type=SMSTRING, .offset=0x1A, .auto_str=sm_get_mempartno}, + {.name="SMcputype", .table_type=131,.value_type=SMWORD, .offset=0x04, .auto_int=sm_get_cputype}, + {.name="SMbusspeed", .table_type=132,.value_type=SMWORD, .offset=0x04, .auto_str=0 } }; struct smbios_table_description smbios_table_descriptions[]= Index: branches/valv/i386/libsaio/nvidia.c =================================================================== --- branches/valv/i386/libsaio/nvidia.c (revision 171) +++ branches/valv/i386/libsaio/nvidia.c (revision 172) @@ -267,6 +267,7 @@ { 0x10DE05E2, "GeForce GTX 260" }, { 0x10DE05E3, "GeForce GTX 285" }, { 0x10DE05E6, "GeForce GTX 275" }, + { 0x10DE05EA, "GeForce GTX 260" }, { 0x10DE05EB, "GeForce GTX 295" }, { 0x10DE05F9, "Quadro CX" }, { 0x10DE05FD, "Quadro FX 5800" }, Index: branches/valv/i386/libsaio/915resolution.c =================================================================== --- branches/valv/i386/libsaio/915resolution.c (revision 171) +++ branches/valv/i386/libsaio/915resolution.c (revision 172) @@ -210,10 +210,11 @@ */ if (map->chipset == CT_UNKWN) { + /* printf("Unknown chipset type and unrecognized bios.\n"); printf("915resolution only works with Intel 800/900 series graphic chipsets.\n"); - + */ printf("Chipset Id: %x\n", map->chipset_id); close_vbios(map); return 0; Index: branches/valv/i386/boot0/boot0.s =================================================================== --- branches/valv/i386/boot0/boot0.s (revision 171) +++ branches/valv/i386/boot0/boot0.s (revision 172) @@ -55,7 +55,7 @@ ; ; Set to 1 to enable verbose mode ; -VERBOSE EQU 0 +VERBOSE EQU 1 ; ; Various constants. @@ -313,17 +313,36 @@ jne .Pass2 .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. + jne .continue + 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 - jne .continue ; 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. +%endif + jmp .tryToBoot .Pass2: -; cmp BYTE [si + part.type], kPartTypeHFS ; In pass 2 we're going to find a HFS+ partition -; jne .continue ; equipped with boot1h in its boot record -; ; regardless if it's active or not. +%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. + jne .continue + 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. + jne .continue mov dh, 1 ; Argument for loadBootSector to check HFS+ partition signature. +%endif DebugChar('*') @@ -755,7 +774,7 @@ %if VERBOSE gpt_str db 'GPT', 0 -test_str db 'testing', 0 +test_str db 'test', 0 done_str db 'done', 0 %endif @@ -773,27 +792,6 @@ pad_boot: times 440-($-$$) db 0 -%ifdef FLOPPY -;-------------------------------------------------------------------------- -; Put fake partition entries for the bootable floppy image -; -part1bootid db 0x80 ; first partition active -part1head db 0x00 ; head # -part1sect db 0x02 ; sector # (low 6 bits) -part1cyl db 0x00 ; cylinder # (+ high 2 bits of above) -part1systid db 0xab ; Apple boot partition -times 3 db 0x00 ; ignore head/cyl/sect #'s -part1relsect dd 0x00000001 ; start at sector 1 -part1numsect dd 0x00000080 ; 64K for booter -part2bootid db 0x00 ; not active -times 3 db 0x00 ; ignore head/cyl/sect #'s -part2systid db 0xa8 ; Apple UFS partition -times 3 db 0x00 ; ignore head/cyl/sect #'s -part2relsect dd 0x00000082 ; start after booter -; part2numsect dd 0x00000abe ; 1.44MB - 65K -part2numsect dd 0x000015fe ; 2.88MB - 65K -%endif - pad_table_and_sig: times 510-($-$$) db 0 dw kBootSignature Index: branches/valv/i386/boot1/boot1.s =================================================================== --- branches/valv/i386/boot1/boot1.s (revision 171) +++ branches/valv/i386/boot1/boot1.s (revision 172) @@ -52,7 +52,7 @@ ; ; Set to 1 to enable verbose mode. ; -VERBOSE EQU 0 +VERBOSE EQU 1 ; ; Various constants. Index: branches/valv/i386/boot1/boot1f32-install.sh =================================================================== --- branches/valv/i386/boot1/boot1f32-install.sh (revision 0) +++ branches/valv/i386/boot1/boot1f32-install.sh (revision 172) @@ -0,0 +1,26 @@ +#!/bin/sh + +# boot1f32-install.sh +# +# Created by mackerintel on 2/2/09. +# Copyright 2009 mackerintel. All rights reserved. + +if [[ x$1 == x ]]; then + echo Usage: $0 disknumber; + exit 0; +fi + +if [[ `dd if=/dev/disk${1}s1 count=8 bs=1 skip=82 | uuencode -m -|head -n 2|tail -n 1` != "RkFUMzIgICA=" ]]; then + echo "/dev/disk${1}s1" "isn't" a FAT32 partition; + exit 1; +fi + +if [ ! -f boot1f32 ]; then + echo "boot1f32 not found"; + exit 1; +fi + +dd if=/dev/disk${1}s1 count=1 bs=512 of=/tmp/origbs +cp boot1f32 /tmp/newbs +dd if=/tmp/origbs of=/tmp/newbs skip=3 seek=3 bs=1 count=87 conv=notrunc +dd of=/dev/disk${1}s1 count=1 bs=512 if=/tmp/newbs Index: branches/valv/i386/boot2/ramdisk.h =================================================================== --- branches/valv/i386/boot2/ramdisk.h (revision 171) +++ branches/valv/i386/boot2/ramdisk.h (revision 172) @@ -7,8 +7,16 @@ #ifndef __BOOT_RAMDISK_H #define __BOOT_RAMDISK_H -#define RAMDISKCONFIG_FILENAME "rd(0,0)/RAMDisk.plist" +#define RAMDISKCONFIG_FILENAME "bt(0,0)/RAMDisk.plist" +//#define kPostbootRamdisk +void md0Ramdisk(); +typedef struct RAMDiskParam +{ + ppnum_t base; + unsigned int size; +} RAMDiskParam; + /* mboot.c */ extern struct multiboot_info *gMI; extern int multibootRamdiskReadBytes( int biosdev, unsigned int blkno, Index: branches/valv/i386/boot2/boot.c =================================================================== --- branches/valv/i386/boot2/boot.c (revision 171) +++ branches/valv/i386/boot2/boot.c (revision 172) @@ -162,6 +162,8 @@ sleep(kBootErrorTimeout); } + md0Ramdisk(); + setupFakeEfi(); verbose("Starting Darwin %s\n",( archCpuType == CPU_TYPE_I386 ) ? "x86" : "x86_64"); @@ -479,7 +481,7 @@ if ((ret != 0) || ((flags & kFileTypeMask) != kFileTypeFlat)) break; - if (!forceresume && sleeptime+3modTime) { + if (!forceresume && ((sleeptime+3)modTime)) { printf ("Hibernate image is too old by %d seconds. Use ForceWake=y to override\n",bvr->modTime-sleeptime); break; } Index: branches/valv/i386/boot2/ramdisk.c =================================================================== --- branches/valv/i386/boot2/ramdisk.c (revision 171) +++ branches/valv/i386/boot2/ramdisk.c (revision 172) @@ -16,6 +16,67 @@ bool gRAMDiskBTAliased = false; char gRAMDiskFile[512]; + +// Notify OS X that a ramdisk has been loaded. XNU will attach this to /dev/md0 +void md0Ramdisk() +{ + RAMDiskParam ramdiskPtr; + char* filename = 0; + int fh = 0; + + // Look for ramdisk at Postboot.img + filename = "bt(0,0)/Postboot.img"; + if((fh = open(filename, 0)) == -1) + { + filename = "/Postboot.img"; // Check rd(0,0) if not in bt(0,0) + fh = open(filename, 0); + + } + + + if (fh != -1) + { + verbose("Loading ramdisk %s\n", filename); + + ramdiskPtr.size = file_size(fh); + ramdiskPtr.base = AllocateKernelMemory(ramdiskPtr.size); + + 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) + { + DT__AddProperty(node, "RAMDisk", sizeof(RAMDiskParam), (void*)&ramdiskPtr); + + } + else + { + verbose("Unable to notify Mac OS X of the ramdisk %s.\n", filename); + } + + } + else { + verbose("Unable to read ramdisk %s\n", filename); + } + + } else { + verbose("Ramdisk %s is empty.\n", filename); + } + + + close(fh); + + } + else { + verbose("Unable to open %s\n", filename); + } +} + + void umountRAMDisk() { if (gRAMDiskMI != NULL) Index: branches/valv/i386/boot2/options.c =================================================================== --- branches/valv/i386/boot2/options.c (revision 171) +++ branches/valv/i386/boot2/options.c (revision 172) @@ -724,33 +724,85 @@ gBootMode |= kBootModeSafe; } - // If user typed F8, abort quiet mode, and display the menu. +#define QUICK_KEYS_ENABLED 1 +#if QUICK_KEYS_ENABLED { - bool f8press = false, spress = false, vpress = false; + /* 18seven's Quick-args macro */ + bool f8 = false, altf = false, shiftf = false, alts = false, + altv = false, x32 = false, x64 = false, altx = false; int key; while (readKeyboardStatus()) { key = bgetc (); - if (key == 0x4200) f8press = true; - if ((key & 0xff) == 's' || (key & 0xff) == 'S') spress = true; - if ((key & 0xff) == 'v' || (key & 0xff) == 'V') vpress = true; + if (key == 0x4200) f8 = true; + if (key == 0x2100) altf = true; + if (key == 0x2146) shiftf = true; + if (key == 0x1F00) alts = true; + if (key == 0x2F00) altv = true; + if (key == 0x2D00) altx = true; + if (key == 0x0403) x32 = true; + if (key == 0x0705) x64 = true; } - if (f8press) { + if (f8) { gBootMode &= ~kBootModeQuiet; timeout = 0; } - if ((gBootMode & kBootModeQuiet) && firstRun && vpress && (gBootArgsPtr + 3 < gBootArgsEnd)) { + if ((altf) && (gBootArgsPtr + 3 < gBootArgsEnd)) { *(gBootArgsPtr++) = ' '; *(gBootArgsPtr++) = '-'; - *(gBootArgsPtr++) = 'v'; + *(gBootArgsPtr++) = 'f'; + } + if ((shiftf) && (gBootArgsPtr + 3 < gBootArgsEnd)) { + *(gBootArgsPtr++) = ' '; + *(gBootArgsPtr++) = '-'; + *(gBootArgsPtr++) = 'F'; } - if ((gBootMode & kBootModeQuiet) && firstRun && spress && (gBootArgsPtr + 3 < gBootArgsEnd)) { + if ((alts) && (gBootArgsPtr + 3 < gBootArgsEnd)) { *(gBootArgsPtr++) = ' '; *(gBootArgsPtr++) = '-'; *(gBootArgsPtr++) = 's'; } + if ((altv) && (gBootArgsPtr + 3 < gBootArgsEnd)) { + *(gBootArgsPtr++) = ' '; + *(gBootArgsPtr++) = '-'; + *(gBootArgsPtr++) = 'v'; } - clearBootArgs(); + if ((altx) && (gBootArgsPtr + 3 < gBootArgsEnd)) { + *(gBootArgsPtr++) = ' '; + *(gBootArgsPtr++) = '-'; + *(gBootArgsPtr++) = 'x'; + } + if ((x32) && (gBootArgsPtr + 5 < gBootArgsEnd)) { + *(gBootArgsPtr++) = ' '; + *(gBootArgsPtr++) = '-'; + *(gBootArgsPtr++) = 'x'; + *(gBootArgsPtr++) = '3'; + *(gBootArgsPtr++) = '2'; + } + + if ((x64) && (gBootArgsPtr + 5 < gBootArgsEnd)) { + *(gBootArgsPtr++) = ' '; + *(gBootArgsPtr++) = '-'; + *(gBootArgsPtr++) = 'x'; + *(gBootArgsPtr++) = '6'; + *(gBootArgsPtr++) = '4'; + } + } +#else + { + bool f8 = false; + int key; + while (readKeyboardStatus()) { + key = bgetc (); + if (key == 0x4200) f8 = true; + } + if (f8) { + gBootMode &= ~kBootModeQuiet; + timeout = 0; + } + } +#endif + if (bootArgs->Video.v_display == VGA_TEXT_MODE) { setCursorPosition(0, 0, 0); clearScreenRows(0, kScreenLastRow);