overdue-scratch

Author Topic: Custom Build of Chameleon 2rc4, won't load GUI  (Read 2862 times)

0 Members and 1 Guest are viewing this topic.

nuiluidwde

  • Entrant
  • Posts: 4
Custom Build of Chameleon 2rc4, won't load GUI
« on: May 14, 2010, 10:45:31 PM »
Hi, I'm currently trying to add a small bit of cosmetic functionality to Chameleon, but every time I compile it and then boot it on my hackint0sh, the gui doesn't load and instead I am presented with a boot prompt. I tried compiling the original, unmodified source as well, but no luck. It cannot be my system installation, because using the precompiled boot file from http://chameleon.osx86.hu/ works perfectly. Is there a special method used to compile the chameleon bootloader that I haven't come across? I'm using
Code: [Select]
cd Chameleon-2.0-RC4-r684-src
make all
cp ./sym/i386/boot /Volumes/MemStick
on a Mac OS X 10.5 Intel iMac 2006

This puts it on my bootable memory stick, which has chameleon stock 2rc4 installed on it, and I am simply replacing the boot file on the hfs+ partition. Do I need to replace the whole installation with freshly compiled binaries, or is it something in the way I am compiling it.


And if you want to know, all I am doing is adding the following:
Code: [Select]
if( param->part_type == 0x1c )
{
param->part_type = 0x07;
param->label = "Windows Vista";
}
to ./i386/boot2/gui.c (v2 RC4 revision 684) at line 679, in order to make an unrecognised partition format look like a Windows partition

nuiluidwde

  • Entrant
  • Posts: 4
Re: Custom Build of Chameleon 2rc4, won't load GUI
« Reply #1 on: May 15, 2010, 12:08:17 AM »
I think it was the source I was using, I just checked out the latest source and it booted, then I needed to change my code:-
Code: [Select]
if( param->part_type == 0x1c )
{
unsigned int partType = 0x07;
char volLabel[BVSTRLEN] = "Windows Vista";
param->part_type = partType;

char *p="";
strncpy(p, volLabel, BVSTRLEN);
sprintf(param->label, p);
}
which is inserted after
Code: [Select]
// draw visible device icons
for ( i=0; i < gui.maxdevices; i++ )
{
BVRef param = menuItems[start+i].param;
in the drawDeviceList function, gui.c, line 719

Now it works great but it doesn't boot properly, so I may need to stop it from changing the partition type. I am going to try to add this functionality to the theme plist file, so that you can specify a partition type, anything from http://www.win.tue.nl/~aeb/partitions/partition_types-1.html, an image, i.e.: device_ntfs.png, and possibly an alternative volume label, and then chameleon will override normal handling and replace with the specified information.

meklort

  • VoodooLabs
  • Posts: 65
Re: Custom Build of Chameleon 2rc4, won't load GUI
« Reply #2 on: May 15, 2010, 04:05:19 AM »
Code: [Select]
char *p="";
strncpy(p, volLabel, BVSTRLEN);
sprintf(param->label, p);

That code isn't correct. Your making a char pointer to somewhere, with one byte reserved. You then go to copy "Windows Vista" into that one byte... overwriting anything after it (up to BVSTRLEN). Then go to to use sprintf (why? you oculd use strncpy here too...).

Anyways, one way to fix it is the following. Note that your code (probably) works, but you *are* overwriting memory that you shoudl not be doing. This can cause issues (and probably is). Either way, fix it.
Code: [Select]
strncpy(param->label, volLabel, BVSTRLEN);
« Last Edit: May 15, 2010, 04:07:37 AM by meklort »
return c ? c : !c;

nuiluidwde

  • Entrant
  • Posts: 4
Re: Custom Build of Chameleon 2rc4, won't load GUI
« Reply #3 on: May 15, 2010, 08:47:20 PM »
Thank you, I haven't done C programming for a while so I'm still forgetting some stuff!

Any way, I've now made a patch file that lets Chameleon take in custom options from the theme.plist file in regard to extra images for different partition types and optionally overriding the volume label of a partition - http://forum.voodooprojects.org/index.php/topic,1398.0.html

meklort

  • VoodooLabs
  • Posts: 65
Re: Custom Build of Chameleon 2rc4, won't load GUI
« Reply #4 on: May 15, 2010, 09:43:32 PM »
Sounds good.

I'll take a look and (most likely) make it so that the code uses xml instead of a custom method to specify info.
return c ? c : !c;