In June 2014 I published a blog post about OS X 10.10 Yosemite DP1 kernel(cache) like how you can change the default/preferred compression from LZVN to LZSS and published a disassembled copy of the lzvn_decode routine.
A few months later, back in September 2014, I published a blog post titled LZVN take II with a link to the C source code of the lzvn_decode routine.
LZVN Take III
So now what you ask? Well. Today I committed a new update to the LZVN Github repository with two brand new private Apple libraries called libFastCompression.a and libFastCompression-Kernel.a And that’s not all because not only does it include the source code, but you can compile it yourself.
You may think. So what. But seriously. If you want to compile IOGraphics-485 (and later) for say to debug the mess some people see before the third stage Apple logo appears, then you simply need this library. Without it Xcode will fail to built it.
A new version of ssdtPRGen (v15.1) is now available from my Github repository. Please read the new change log to find out what changed, but there are a few things that I like to address here.
First. The generated SSDT will, from now on, be saved in: ~/Library/ssdtPRGen This instead of on your Desktop. Less clutter, but it will also make it a bit more difficult to locate. This is also why I added a new argument to open the previously generated SSDT:
More importantly. This change enabled me to make changes in the script so that it can do most of its work without requiring admin privileges. Reducing the risk of running a script with sudo.
One other thing I did was that I removed the zipped up byte data for extractACPITables from the script. A newer version will now be download from my Github repository and put in ~/Library/ssdtPRGen/Tools. The extracted ACPI tables are now saved in: ~/Library/ssdtPRGen. This because /tmp required administrator privileges, and the data was wiped on restarts.
The biggest change however is that I moved the model data and processor data to configuration files, downloaded when required. You’ll find the files in: ~/Library/ssdtPRGen/Data. This change makes it possible for me to change the data without having to update the script. And the script will only download what it needs. Another plus is that we can edit the SSDT without altering the file permissions.
You can get the latest version of ssdtPRGen.sh by entering this terminal command:
curl -o ~/ssdtPRGen.sh https://raw.githubusercontent.com/Piker-Alpha/ssdtPRGen.sh/master/ssdtPRGen.sh
The next step is to set the execute/search bits by entering this terminal command:
chmod +x ~/ssdtPRGen.sh
Bug reports (so called ‘issues’) can be filed at:
Please do not use my blog for this.
I am getting e-mails from people asking: What’s up Pike?
Ok. First. Let me apologise for being slow and none responsive, but the thing is that my father-in-law is terminally ill (maybe a week to live) and my wife got some bad news about here own health that I am not willing to share here in public.
In short. I’m a little occupied by other more private matters. I also can’t really sleep very long due to the fact that the contract with the security guards had to be terminated (theft crimes) so for the time being I am doing their job as well. All in all. I’m still here but I am currently busy with other stuff.
Apparently it helps if you work for a large company, because the security guard problems we had here is already solved. And how! We have now drones flying over our property, a police car is driving around and two new armed guards are standing at the gate. I am really glad that they are working this hard, but it took far too long. And what if I hadn’t worked for Google? To me it shouldn’t matter who you work for or how rich you are, but anyway. I can finally get some sleep now. Good night folks!
Angélica’s father died a few minutes ago. Jorge was only 53. I wish there was a cure for cancer. For everyone… but unfortunately this is not the case.
/me AFK for at least a week. Need to be there for my wife and her family. Later.
Right. My week off was kind of short. Too short. You know. Work related issues (Chrome crashing) and other changes at home forced me to get back to my schedule much earlier than I would have done otherwise but hey. This is how life goes. You make a plan, and then you have to adapt it to plan B. Which seems to happen a lot lately so maybe I am a bad planner. No problem. I am fine with it. We’ll go with the flow and see where the wind blows 😉
Thank you for the kind words folks!
My new hack will be put together for me today from the following components
– Cooler Master Silencio 452 case (new).
– Gigabyte Z87MX-D3H motherboard (replaced under warranty)
– Intel i7-4790K processor (new).
– Scythe Mugen 3 Rev B processor cooler (reused).
– Samsung 840 EVO 120 GB SSD (new).
– Seagate 1TB Barracuda harddrive (new).
– Apple Broadcom BCM94360CD 802.11ac mini PCI-E WLAN+Bluetooth 4.0 card (new).
The Scythe processor cooler was a gift from someone. Along with two speakers from Berlin. The drives will be setup as a Fusion drive, because I never really used a Fusion drive. The processor may look like overkill, and it normally would have been for what I do with a hack… if I didn’t had to use virtual machines so much.
No. This box won’t be standing next to me, in my house in Spain, but on a remote location. I have to do this to keep out of trouble. Not that I do illegal stuff with it, because trust me when I say I do not, but I cannot have software in my house that may be considered “illegal”. A simple measure to secure my job as a developer. And yeah. I’m glad that some countries in Europe are cool with using a hack, but Spain isn’t one of them 😉
Ehm Pike. There’s no memory and PSU? Right. I’m still like 200 Euro off of it. Had to install central heating before the winter kicks in. Actually. I am waiting – like right now – for someone to approve and certify it, so that we can finally get that stupid insurance policy. Done – after two small modifications and a second test.
My father apparently installed a Corsair AX750 PSU in the remote box, which is still working flawlessly, and thus I will keep using it. True. It is a bit overkill. Very much even, but I am very happy with it.
And I have more good news. Both the PSU and the Intel processor of the box that I had here, have been replaced under warranty. What a surprise. I tell you some parts were literally de-soldered. Blown off of the motherboard.
Too bad that my 4 G.Skill memory modules – worth over 1000 Euro – won’t be replaced under warranty. This is why I ordered two new 8 GB modules yesterday, and they should arrive today. Almost ready to get stuff going again.
Apple did not release the source code of the new LZVN functions, and you may not need it, because you can add the (private) PackageKit.framework to your development project. Here is an example taken from kernelcache.c to show you how it works:
if (compressionType == COMP_TYPE_FASTLIB)
size_t outSize = 0;
void * work_space = malloc(lzvn_encode_work_size());
if (work_space != NULL)
kernelHeader->compressType = OSSwapHostToBigInt32(COMP_TYPE_FASTLIB);
outSize = lzvn_encode(buf + offset, bufsize, (u_int8_t *)CFDataGetBytePtr(prelinkImage), CFDataGetLength(prelinkImage), work_space);
if (outSize != 0)
bufend = buf + offset + outSize;
The call to lzvn_encode_work_size() returns 0x80000 and thus malloc() will allocate a 512 KB buffer (work_space). And this call is used in IOGraphicsFamily.kext
extern "C" size_t lzvn_decode(void * __restrict dst, size_t dst_size, const void * __restrict src, size_t src_size);
In short. You can also use this for kexts that you (plan to) develop. However. It won’t work on Linux and Windows, of course, so you may want to look at my LZVN Github repository where you can find the source code of a command line tool that I wrote to encode (compress) a file.
Disassembled code removed and link to my Github repository added.