Is it Possable To Run Darwin/x86 On Joggler
Posted: Tue Nov 29, 2011 11:32 pm
Forum for users of the O2 Joggler
https://www.jogglerwiki.com/forum/
Possible, yes! Usable.. I doubt it. You'd be stuck on v10.4 (Tiger) or maybe v10.5 (Leopard), but even then the user experience would be awful. Mac OS X has not been designed with resolutions lower than 1024x768 in mind for a long time now.verg0 wrote:Yeah sorry OSX
Code: Select all
--- a/include/grub/i386/xnu.h
+++ b/include/grub/i386/xnu.h
@@ -45,6 +45,7 @@
grub_xnu_ptr_t lfb_base;
#define GRUB_XNU_VIDEO_SPLASH 1
#define GRUB_XNU_VIDEO_TEXT_IN_VIDEO 2
+#define GRUB_XNU_VIDEO_JOGGLER 0x70
grub_uint32_t lfb_mode;
grub_uint32_t lfb_line_len;
grub_uint32_t lfb_width;
Code: Select all
--- a/loader/i386/efi/xnu.c
+++ b/loader/i386/efi/xnu.c
@@ -19,15 +19,27 @@
#include <grub/env.h>
#include <grub/xnu.h>
#include <grub/cpu/xnu.h>
+#include <grub/i386/xnu.h>
#include <grub/efi/api.h>
#include <grub/efi/efi.h>
#include <grub/efi/uga_draw.h>
+#include <grub/efi/graphics_output.h>
#include <grub/pci.h>
#include <grub/misc.h>
/* Setup video for xnu. Big parts are copied from linux.c. */
static grub_efi_guid_t uga_draw_guid = GRUB_EFI_UGA_DRAW_GUID;
+static grub_efi_guid_t graphics_output_guid = GRUB_EFI_GOP_GUID;
+
+static grub_efi_gop_blt_t old_blt = 0;
+static struct grub_efi_gop *gop = 0;
+
+static grub_uint32_t ScreenWidth =0;
+static grub_uint32_t ScreenHeight =0;
+static grub_uint32_t ScreenDepth =0;
+static grub_uint32_t FrameBufferBase =0;
+static grub_uint32_t LineLength =0;
#define RGB_MASK 0xffffff
#define RGB_MAGIC 0x121314
@@ -139,40 +151,143 @@
return found;
}
+// Added Section...
+
+static grub_efi_status_t new_blt(struct grub_efi_gop *This,
+ void *BltBuffer,
+ grub_efi_uintn_t BltOperation,
+ grub_efi_uintn_t SourceX,
+ grub_efi_uintn_t SourceY,
+ grub_efi_uintn_t DestinationX,
+ grub_efi_uintn_t DestinationY,
+ grub_efi_uintn_t Width,
+ grub_efi_uintn_t Height,
+ grub_efi_uintn_t Delta)
+ {
+ grub_efi_uintn_t row,col,DeltaWidth;
+ grub_uint32_t *SourceBase, *DestinationBase;
+ This = This;
+
+ if(!FrameBufferBase)
+ return -1;
+
+ if(!Delta)
+ DeltaWidth = Width;
+ else
+ DeltaWidth = Delta/sizeof(grub_uint32_t);
+
+ switch(BltOperation)
+ {
+ case 0: //EfiBltVideoFill
+ DestinationBase = (grub_uint32_t*)FrameBufferBase + ScreenWidth*DestinationY + DestinationX;
+ for(row=0; row<Height; row++)
+ {
+ for(col=0; col<Width; col++)
+ DestinationBase[col]=*(grub_uint32_t*)BltBuffer;
+ DestinationBase+=ScreenWidth;
+ }
+ break;
+
+ case 1: // EfiBltVideoToBltBuffer
+ SourceBase = (grub_uint32_t*)FrameBufferBase + ScreenWidth*SourceY + SourceX;
+ DestinationBase = ((grub_uint32_t*)BltBuffer) + DeltaWidth*DestinationY + DestinationX;
+ for(row=0; row<Height; row++)
+ {
+ for(col=0; col<Width; col++)
+ DestinationBase[col]=SourceBase[col];
+ DestinationBase+=DeltaWidth;
+ SourceBase+=ScreenWidth;
+ }
+ break;
+
+ case 2: // EfiBltBufferToVideo
+ SourceBase = ((grub_uint32_t*)BltBuffer) + DeltaWidth*SourceY + SourceX;
+ DestinationBase = (grub_uint32_t*)FrameBufferBase + ScreenWidth*DestinationY + DestinationX;
+ for(row=0; row<Height; row++)
+ {
+ for(col=0; col<Width; col++)
+ DestinationBase[col]=SourceBase[col];
+ DestinationBase+=ScreenWidth;
+ SourceBase+=DeltaWidth;
+ }
+ break;
+
+ case 3: // EfiBltVideoToVideo
+ SourceBase = (grub_uint32_t*)FrameBufferBase + ScreenWidth*SourceY + SourceX;
+ DestinationBase = (grub_uint32_t*)FrameBufferBase + ScreenWidth*DestinationY + DestinationX;
+ for(row=0; row<Height; row++)
+ {
+ for(col=0; col<Width; col++)
+ DestinationBase[col]=SourceBase[col];
+ DestinationBase+=ScreenWidth;
+ SourceBase+=ScreenWidth;
+ }
+ break;
+ default:
+ return -1;
+ }
+
+ return 0;
+ }
+
grub_err_t
grub_xnu_set_video (struct grub_xnu_boot_params *params)
{
- grub_efi_uga_draw_protocol_t *c;
grub_uint32_t width, height, depth, rate, pixel, fb_base, line_len;
int ret;
- c = grub_efi_locate_protocol (&uga_draw_guid, 0);
- if (! c)
- return grub_error (GRUB_ERR_IO, "couldn't find UGADraw");
-
- if (efi_call_5 (c->get_mode, c, &width, &height, &depth, &rate))
- return grub_error (GRUB_ERR_IO, "couldn't retrieve video mode");
-
- grub_printf ("Video mode: %ux%u-%u@%u\n", width, height, depth, rate);
-
- grub_efi_set_text_mode (0);
- pixel = RGB_MAGIC;
- efi_call_10 (c->blt, c, (struct grub_efi_uga_pixel *) &pixel,
- GRUB_EFI_UGA_VIDEO_FILL, 0, 0, 0, 0, 1, height, 0);
- ret = find_framebuf (&fb_base, &line_len);
- grub_efi_set_text_mode (1);
+ gop = grub_efi_locate_protocol (&graphics_output_guid, 0);
- if (! ret)
- return grub_error (GRUB_ERR_IO, "can\'t find frame buffer address");
+ if (gop) {
+ ScreenWidth = gop->mode->info->width;
+ ScreenHeight = gop->mode->info->height;
+ ScreenDepth = 32;
+ LineLength = 4 * gop->mode->info->pixels_per_scanline;
+ FrameBufferBase = gop->mode->fb_base;
+ old_blt = gop->blt;
+ gop->blt = new_blt;
+ }
+
+ if (gop) {
+ width = ScreenWidth;
+ height = ScreenHeight;
+ depth = ScreenDepth;
+ line_len = LineLength;
+ fb_base = FrameBufferBase;
+ } else
+ {
+ grub_efi_uga_draw_protocol_t *c;
+
+ c = grub_efi_locate_protocol (&uga_draw_guid, 0);
+ if (! c)
+ return grub_error (GRUB_ERR_IO, "couldn't find UGADraw");
+
+ if (efi_call_5 (c->get_mode, c, &width, &height, &depth, &rate))
+ return grub_error (GRUB_ERR_IO, "couldn't retrieve video mode");
+
+ grub_efi_set_text_mode (0);
+ pixel = RGB_MAGIC;
+ efi_call_10 (c->blt, c, (struct grub_efi_uga_pixel *) &pixel,
+ GRUB_EFI_UGA_VIDEO_FILL, 0, 0, 0, 0, 1, height, 0);
+ ret = find_framebuf (&fb_base, &line_len);
+ grub_efi_set_text_mode (1);
- grub_printf ("Frame buffer base: 0x%x\n", fb_base);
- grub_printf ("Video line length: %d\n", line_len);
+ if (! ret)
+ return grub_error (GRUB_ERR_IO, "can\'t find frame buffer address");
+ }
+
+ //grub_printf ("Video mode: %ux%u-%u@%u\n", width, height, depth, rate);
+ //grub_printf ("Frame buffer base: 0x%x\n", fb_base);
+ //grub_printf ("Video line length: %d\n", line_len);
params->lfb_width = width;
params->lfb_height = height;
params->lfb_depth = depth;
params->lfb_line_len = line_len;
- params->lfb_mode = GRUB_XNU_VIDEO_TEXT_IN_VIDEO;
+ params->lfb_mode = GRUB_XNU_VIDEO_JOGGLER;
params->lfb_base = fb_base;
+
+ // gop->blt = old_blt; /* Including this breaks xnu verbose if boot from menu ?? */
+
return GRUB_ERR_NONE;
}
Code: Select all
set default="0"
set timeout=5
menuentry "OSX" {
set root=(hd0,1)
insmod hfsplus
xnu_kernel /mach_kernel
xnu_mkext /Extra/Extensions.mkext
xnu_mkext /System/Library/Caches/com.apple.kext.caches/Startup/Extensions.mkext
}
Aha. Forgot i written stuff there also. fidi=humphhawsey wrote:This may be helpful, i just came across it looking for something else
http://www.projectosx.com/forum/index.p ... topic=1423
Cheers