Jump to content

Different solutions


Andy Vandijck
 Share

925 posts in this topic

Recommended Posts

Assert can happen in FreePool if you pass it something that is not allocated with AllocatePool. For example: possible issue in grub_driver.c, GetFSGuid(): FreePool(FsName).

Thanks dmazar.

 

Indeed that is one issue.

Another issue is in driver.c, FreeFsInstance(): FreePool(Instance->RootFile). That one assets also for FreePool on EFI_INVALID_PARAMETER.

Link to comment
Share on other sites

You should probably just comment that line - I do no see this one allocated.

Regarding FreeFsInstance(), I think that RootFile is being allocated by grub_file.c, GrubCreateFile(). The assert is because it tries to free it without checking it if its value is NULL, so it may end up trying to FreePool(NULL). I think we should just add checks for non-NULL values in FreeFsInstance(), for both DevicePathString and RootFile, as I see in the code cases where FreeFsInstance() may be called without any of these being allocated.

 

Anyway, with the above checks added, and commenting out the FreePool which you mentioned (which is not being allocated, so there's no reason to free it), there seem to be no more asserts.

Link to comment
Share on other sites

Now to some testing of the Grub HfsPlus driver:

Unfortunately, for media created by 'createinstallmedia' the situation is similar to VboxHfs, so it also doesn't handle hfs hard links properly. It seems to support symlinks though (which VBoxHfs does not), but this doesn't really help us.

post-42278-0-03000600-1408986413_thumb.jpeg

  • Like 1
Link to comment
Share on other sites

Consider that for this reason the legacy bootloader they needed to have the kernel in the installer, downloaded here and there, to boot the installer, but no longer because with the tool, of AnV, you can remove it from the kernelcache!

 

PS : should be so, at least I think .... or not Andy?

That is not true. You can install Yosemite without first having to copy the kernel, as long as the boot loader knows where to load it from (/System/Library/Kernels) but that was one of the problems in Chameleon when the first DP came out. Should work by now. Not to mention that Pacifist can be used to extract any file from the packages.

  • Like 1
Link to comment
Share on other sites

That is not true. You can install Yosemite without first having to copy the kernel, as long as the boot loader knows where to load it from (/System/Library/Kernels) but that was one of the problems in Chameleon when the first DP came out. Should work by now. Not to mention that Pacifist can be used to extract any file from the packages.

 

Hi Pike, 
 
from last time I used Pacifist, was not able to extract anything from Yosemite installer. Today I see that version 3.2.15 is capable of doing this. wow!
 
Each Payloads of each packages inside the Yosemite installer is no longer cpio format archive, but simply "data". 
Can you or AnV evaluate what type of compression have now?  ....I suppose lzvn .. but it is just a guess. 
 
Thanks in advance
 
 
@AnV sorry if this is Off Topic but curiosity is so great  and for now this is only place to talk about lzvn decompression.
 
 
EDIT
this:Payload.zip is from AsianLanguagesSupport.pkg of Yosemite Beta installer,
where I found no occurrence of 0X06 0X76 0X7A 0X6C, ie lzvn  :(
 
Micky
  • Like 1
Link to comment
Share on other sites

 

Hi Pike, 
 
from last time I used Pacifist, was not able to extract anything from Yosemite installer. Today I see that version 3.2.15 is capable of doing this. wow!
 
Each Payloads of each packages inside the Yosemite installer is no longer cpio format archive, but simply "data". 
Can you or AnV evaluate what type of compression have now?  ....I suppose lzvn .. but it is just a guess. 
 
Thanks in advance
 
 
@AnV sorry if this is Off Topic but curiosity is so great  and for now this is only place to talk about lzvn decompression.
 
 
EDIT
this:attachicon.gifPayload.zip is from AsianLanguagesSupport.pkg of Yosemite Beta installer,
where I found no occurrence of 0X06 0X76 0X7A 0X6C, ie lzvn  :(
 
Micky
http://www.tonymacx86.com/general-help/135458-pbzx-stream-parser.html

pbzx is the first compression (1)

//
//  main.c
//  pbzx
//
//  Created by PHPdev32 on 6/20/14.
//  Licensed under GPLv3, full text at http://www.gnu.org/licenses/gpl-3.0.txt
//

#include <stdio.h>
#include <string.h>
#define err(m,e) { fprintf(stderr, m"\n"); return e; }
#define fswap64(f,s) fread(&s, 8, 1, f); s = __builtin_bswap64(s)
#define BSIZE 8 * 1024

int main(int argc, const char * argv[])
{

    // insert code here...
    char buffer[BSIZE];
    fread(buffer, 4, 1, stdin);
    if (strncmp(buffer, "pbzx", 4))
        err("Not a pbzx stream", 1);
    uint64_t length = 0, flags = 0, last = 0;
    fswap64(stdin, flags);
    while (flags & 1 << 24) {
        fswap64(stdin, flags);
        fswap64(stdin, length);
        fread(buffer, 1, 6, stdin);
        if (strncmp(buffer, "\xfd""7zXZ\0", 6))
            err("Header is not <FD>7zXZ<00>", 2);
        length -= fwrite(buffer, 1, 6, stdout);
        while (length)
            length -= last = fwrite(buffer, 1, fread(buffer, 1, BSIZE < length ? BSIZE : length, stdin), stdout);
        if (strncmp(buffer + last - 2, "YZ", 2))
            err("Footer is not YZ", 3);
    }
    return 0;
} 

Code needs minor adjustments btw for Windows, if you need them, ask me

Code you see reads from standard in (<) to standard out (>)

Next is xz compression (2) (Use unxz)

Final is cpio archive (3) (Use pax or 7zip)

 

Got it extracted for you...

System.zip

  • Like 1
Link to comment
Share on other sites

..

 

Thank you Sir, 
 
I have much to learn, thanks for taking the time to this. 
This seems an additional passage by Apple, definitely not as fast as it was before, but more this seems only a "protection"
AnV, if you want to fix for Windows, many people will thank you, but for me it is enough. 
 
Thank you, and thanks @PHPdev32.
 
Micky
  • Like 1
Link to comment
Share on other sites

http://www.tonymacx86.com/general-help/135458-pbzx-stream-parser.html

pbzx is the first compression (1)

//
//  main.c
//  pbzx
//
//  Created by PHPdev32 on 6/20/14.
//  Licensed under GPLv3, full text at http://www.gnu.org/licenses/gpl-3.0.txt
//

#include <stdio.h>
#include <string.h>
#define err(m,e) { fprintf(stderr, m"\n"); return e; }
#define fswap64(f,s) fread(&s, 8, 1, f); s = __builtin_bswap64(s)
#define BSIZE 8 * 1024

int main(int argc, const char * argv[])
{

    // insert code here...
    char buffer[BSIZE];
    fread(buffer, 4, 1, stdin);
    if (strncmp(buffer, "pbzx", 4))
        err("Not a pbzx stream", 1);
    uint64_t length = 0, flags = 0, last = 0;
    fswap64(stdin, flags);
    while (flags & 1 << 24) {
        fswap64(stdin, flags);
        fswap64(stdin, length);
        fread(buffer, 1, 6, stdin);
        if (strncmp(buffer, "\xfd""7zXZ\0", 6))
            err("Header is not <FD>7zXZ<00>", 2);
        length -= fwrite(buffer, 1, 6, stdout);
        while (length)
            length -= last = fwrite(buffer, 1, fread(buffer, 1, BSIZE < length ? BSIZE : length, stdin), stdout);
        if (strncmp(buffer + last - 2, "YZ", 2))
            err("Footer is not YZ", 3);
    }
    return 0;
} 

Code needs minor adjustments btw for Windows, if you need them, ask me

Code you see reads from standard in (<) to standard out (>)

Next is xz compression (2) (Use unxz)

Final is cpio archive (3) (Use pax or 7zip)

 

Got it extracted for you...

 

pbzx for Windows, source, compiled, binaries, etc...

Works slightly different than the other code above, uses argv[1] and argv[2] (arguments after the code, 1 and 2)

pbzx.zip

  • Like 2
Link to comment
Share on other sites

That is not true. You can install Yosemite without first having to copy the kernel, as long as the boot loader knows where to load it from (/System/Library/Kernels) but that was one of the problems in Chameleon when the first DP came out. Should work by now. Not to mention that Pacifist can be used to extract any file from the packages.

 

Could you please give some more explanations here ?

 

I am trying to create a bootable USB stick out of the Yosemite DP7 InstallESD dmg file.

I have manually installed Chameleon r2391 to be able to boot it correctly, and set the 'UseKernelCache' to 'No', as the default kernel cache provided by the BaseSystem.dmg is compressed using lzvn.

 

Usually, I was extracting the kernel out of the the 'Essentials.pkg' package, and added the FakeSMC in /S/L/E for the stick to boot properly.

If I don't copy the kernel, Chameleon complained that it cannot find it and/or that the kernelcache cannot be extracted.

 

Is there something I am missing here?

 

 

Also, it seems that the Essentials.pkg Payload file cannot be fully uncompressed using the pzbx stream uncompressor routines.

There are 2 "streams" that does not have a correct 'xz' header.

Link to comment
Share on other sites

Perhaps it's a stupid question, but I have to ask...

 

Can testvideobios load EFI part of the ROM on real Mac?

Or is this only possible in EFI shell?

 

I'm trying to mod D700 EFI part to work with regular 7970/280X and it would be great if there would be a possibility to test EFI ROMs without a need of flashing the card every time.

So far modded EFI driver is crashing Mac Pro EFI in early booting stage. I must use old 32-bit MP to recover the card every time, because computer refuses to boot even DOS as long card is installed, even along second GPU with good EFI on it.

 

Thank you in advance for your answer.

Link to comment
Share on other sites

@mathf, supposing that you have "decomplzvn" on your Desktop... then mount BaseSystem.dmg an then in Terminal copy/paste:

 

$HOME/Desktop/decomplzvn /Volumes/OS\ X\ Base\ System/System/Library/Caches/com.apple.kext.caches/Startup/kernelcache $HOME/Desktop/kernel

 

The kernel will be on your Desktop...is not enough?

  • Like 1
Link to comment
Share on other sites

This is of course completly OK. Don't get me wrong, I have managed to make a bootable stick.

However, Piker Alpha's comment made me think that extracting the kernel and place it somewhere on the stick, so that Chameleon can use it to boot was somehow not needed...

 

I also managed to extract the kernel from the 'Essentials.pkg' using Pacifist.

However, if I expand the package using 'pkgutil', and then run the 'pbzx' stream reader package on it, it reports that 2 "streams" contains a wrong header: 

 

 

I modified a little the stream reader program, in order to get more details on the unsupported headers, and exclude them from the "extracted data":

Header is not <FD>7zXZ<00>: C?ª??  (flags: 0x1000000 length: 0x1000000)  43 b2 c2 aa f5 d7
Header is not <FD>7zXZ<00>: `??i?? (flags: 0x1000000 length: 0x1000000)  60 91 83 69 e2 f3

(If needed, I also have both "blocks" of 16M)

 

Once I have run my modified pbzx stream reader, I fed the output to cpio (cpio -id).

Many files got created, however the /System/Library/Kernels folder was not present (and cpio reported that some bytes needed to be skipped).

 

 

I am really curious on what exactly this new Payload format is, and also, how to improve the pbzx stream reader to get any Payload exactrable, like Pacifist.

Link to comment
Share on other sites

Pike maybe was refear that now the job can be implement in Chameleon (to do the same as actually do with lzss decompression)...otherwise, I also do not understand him (for my fault).

 

For 'pbzx' or other I suggest that you or AnV open a new Topic :yes:

 

Micky

Link to comment
Share on other sites

Pike maybe was refear that now the job can be implement in Chameleon (to do the same as actually do with lzss decompression)...otherwise, I also do not understand him (for my fault).

 

This is exactly what I wanted to do tonight.

I guess, now that we have the lzvn routine ready, integrating in Chameleon will not be that difficult.

 

(Of course, if I manage to do it, I will publish the patch on the voodooprojects forum)

Link to comment
Share on other sites

This is exactly what I wanted to do tonight.

I guess, now that we have the lzvn routine ready, integrating in Chameleon will not be that difficult.

 

(Of course, if I manage to do it, I will publish the patch on the voodooprojects forum)

If you need a tester...I'm ready.

 

If you want do not hesitate to open a topic here.
 
Micky
Link to comment
Share on other sites

NASM version (64-bit) added.

Pike, please help me find those tables for 32-bit... Apple did a lot of obfuscation in it unfortunately...

  • Like 1
Link to comment
Share on other sites

NASM version (64-bit) added.

Pike, please help me find those tables for 32-bit... Apple did a lot of obfuscation in it unfortunately...

 

Hi Andy,

I managed to convert your 64bit asm code into pure C yesterday.

My code is still a little ugly, however, it produces the same output as your assembly routine both in 32 and 64 bit.

 

EDIT: I have attached the lzvn extraction routine + modified main.c

extract_lzvn.zip

Link to comment
Share on other sites

One short note: I found a small mistake in the C routine that I have attached in the previous post:

A jump condition was not correctly set.

 -> I will correct that tonight.

Link to comment
Share on other sites

Here is a better, yet working routine for decoding LZVN.

I checked it against my own kernelcache, and the stock ones from DP1, DP5 and DP7.

 

BtW, the apps from AnV have a small bug in the main.c:

The compressed and uncompressed sizes must be byte-swapped!

 

PS: I think you can expect Chameleon with LZVN support soon... very soon... :-P

lzvn.c.zip

Link to comment
Share on other sites

Here is a better, yet working routine for decoding LZVN.

I checked it against my own kernelcache, and the stock ones from DP1, DP5 and DP7.

 

BtW, the apps from AnV have a small bug in the main.c:

The compressed and uncompressed sizes must be byte-swapped!

 

PS: I think you can expect Chameleon with LZVN support soon... very soon... :-P

Great job!

Is it possible for you to create a diff against the source please.

Thanks

Link to comment
Share on other sites

Can I use this to overcome the pixel clock limit.  I was reading someone said that there 144hz monitor at 1440p was being used with a Mac (ASUS PG278Q) and the newer drivers where allowing them to set 120hz in OSX with 1440p.  I currently have a monitor that can do 120hz @ 1440p in windows.  I'm wondering if I inject that EDID from the Asus monitor, if it will allow me to overcome the current pixel clock limit.  Right now I can only get switchresX to do 82hz at 1440p.

Link to comment
Share on other sites

 Share

×
×
  • Create New...