LZVN take II

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. I also published a link to the opcode tables that I made available via dropbox. Then I said:

Anyone willing to have a go with it? Yes. You will need to convert it and figure out how to get it going, but we are hackers. Right?

Then someone with the nickname ‘coercion’ said: That looks pretty straightforward. I’ll give it a shot this evening if no one else has gotten around to it.

My thoughts exactly. Pretty straightforward, but he somehow never delivered. Which I’m glad he didn’t, because after this a well known company contacted me and said:

Pike. We know that you are a busy man, but what about making a quick extra 5K for your home? We are open to suggestions. Contact me…

Right. I could not say NO so that was basically when I stepped in, but I had to sign a NDA agreement, and thus you, the community, won’t ever get to see it. In other words; I had to wait for someone else to publish something that I could use/refer to, and Andy Vandijck was that person. That is, almost, because he did not publish source code that could be used – lzvn_decode was still the same assembler code.

Some weeks later a person using the nick name ‘MinusZwei’ published a flat-conversion of the disassembled code that I published here, but this would have been something that I could use. Unfortenately not, because he slammed a copyright on it. Even on main.c written and published by Andy Vancijcke. But that wasn’t it. Nope. He also went on putting a claim of ownership (copyright) on something that clearly doesn’t belong to him, but Apple’s copyright portfolio. Next to that; there is no word of thanks for my work. I guess thanks but no thanks. Hmm. I wonder when people will start to be nice.

Edit: I should have asked ‘MinusZwei’ per PM why he did it, but it turns out that there was no wrong doing. The copyright string was generated by Xcode. He just forgot to remove it. Not only that. Andy was totally fine with it. Cased closed.

Anyway. I still want to help out where I can, but with the remark that I will not claim overship (copyright) of something that is not mine. That is why you will find this on top on the file that I am about to publish:

/*
* Copyright (c) 2014 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* Portions Copyright (c) 2003 Apple Computer, Inc. All Rights
* Reserved. This file contains Original Code and/or Modifications of
* Original Code as defined in and that are subject to the Apple Public
* Source License Version 2.0 (the "License"). You may not use this file
* except in compliance with the License. Please obtain a copy of the
* License at http://www.apple.com/publicsource and read it before using
* this file.
*
* The Original Code and all software distributed under the License are
* distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the
* License for the specific language governing rights and limitations
* under the License.
*
* @APPLE_LICENSE_HEADER_END@
*
* The lzvn_decode function was first located and disassembled by Pike R.
* Alpha and later converted to flat C code by someone using the handle
* 'MinusZwei' over at insanelymac.com. This after Andy Vandijcke published
* a working version at the for mentioned website.
*
* Thanks to Andy Vandijcke and 'MinusZwei' for their work, but I (Pike
* R. Alpha) will not claim ownership of this work, other than the work
* that I have done, for educational purpose, to improve the readability
* so that it is understandable for everyone.
*
*/

So Pike. Where is the source code/file you talked about? Ok. Hold on. I am writing this during my tea break, and we want to have something that works. Right? Also. The minute you see what I did, you definitely understand that this – my work – is not only ‘quite different’ but it will also show you why I said this.

Later…

Edit I am currently waiting for approval, but we should be good to go some time later today.

Edit-2 Nope. They want me to make three more changes and then it’s fine, but I am getting some sleep first of course 😉

Edit-3 And nope again! One of their software engineers discovered a huge flaw in the software that Andy and ‘MinusZwei’ released and they don’t want me to publish ‘my’ source code until they fixed their code.

Note to Andy: I know that you asked for my help, but now you know that I am in a difficult spot and thus this is also why I didn’t reply to your request. I hope that you can understand this and I am sure that you guys will figure out what is missing. Without my help of course 😉

Edit-4 I made some changes and now I can publish the polished source code. Finally. I must admit. It sucks to have to wait just because someone says that you cannot do that what needs to be done. Deliver!

22 thoughts on “LZVN take II

  1. Some time ago, I noticed that someone mentioned Tiamo’s boot.efi, which allows unsupported Mac Pros to boot Mavericks (and possibly Mountain Lion as well), by identifying itself as a 64-bit bootloader, but actually interacting with the 32-bit EFI of those machines. Unfortunately, the current version of Tiamo’s boot.efi isn’t compatible with Yosemite. I haven’t found your reaction as to whether you’d be willing to contribute to Tiamo’s boot.efi by making it compatible with Yosemite. Would it work by simply implementing the lzvn routine and a call to it, or would it require further refinements?

    • The LZNV compression is only one part, but there is more work to be done. I’ll see if I can get it to compile with the patches, this weekend, and report all progress in my blog.

      • Wonderful. As you now, Yosemite GM 1 has been released today. It would be great to have a Tiamo-Pike’s boot.efi in place by the time Yosemite is finally released. That way, owners of unsupported 64-bit Macs (such as the old Mac Pros) can still run the new OS without Chameleon or Clover.

      • I’ve just got in touch (via private mail) with one fellow poster in the Mac Rumors forum who might help test drive your patches. I hope he’ll somehow get in touch with you. I can’t help myself, as I only have access to one old Mac Pro, but it’s a production machine running Mavericks, and it can’t be shut down or there’ll be plenty of complaints from angry people.

  2. woah! nice to see that somebody’s working on a yosemite compatible version of tiamo’s boot.efi! I think I was the first one to try tiamo’s boot.efi back in november 2013. I’d be more than plesaed to test drive your patch.

    • Thanks. Can you compile the current files? I am thinking about adding a proof of concept version. One that should let you boot Yosemite with the -f (skip kernel cache) boot argument. That is until the LZVN routine is implemented.

      • unfortunately I’m lacking the skills (and software) to compile the sourcecode. I’m pretty good when it comes to tinkering with all sorts of systems and hardware but I never wrote any code… what about tiamo, did you or anybody else try to contact him?

      • I personally have not, but other people have tried to contact him, and without success I am told. I’m sure that other people can compile the source code, hopefully, because I cannot share compiled code.

  3. Hi Piker,

    Peter sent me a message on MacRumors and I would be happy to help test. I have several drives that I can test the boot.efi on in my Mac Pro 1,1 that is flashed to a 2,1. I don’t have much experience compiling source code but I can usually figure things out unless of course you just want to send me the compiled boot.efi files. Right now I am running the GM1 release using Clover but can clone that to another drive with your boot.efi files in place and test. Just let me know how I can help.

    • Hi,

      It would be nice if someone (you?) could get it to compile, either the patched or the original (Tiamo’s) source code. Don’t ask me for help with this, because I do not use Microsoft software (grew up with Ubuntu Linux). Also. I use USB sticks for testing, so can you if you like. We first need it to stop rebooting after all.

      p.s. If you can’t get it compiled, see if you know other people that can help you with this. After that it should not take long to get it to boot Yosemite. We just need to connect the dots 😉

      • I am going to take a crack at compiling it but what am I supposed to compile it to? Is this the boot.efi or is this just the method to get past the new compression used on the kernel? I need a little more clarification.

    • Correct. The source code is not yet compatible with Yosemite, but good to hear that compiling worked for you, because the person I asked for help could not get it to compile with VC 2013. Do you have any pointers for him, so that he can start testing? He gets a load of undefined warnings and a cmd error.

  4. The compilation was quite simple. I’ve installed MS Visual Studio 2013 (Ultimate, 90-days-trial), installed also NASM, added the path to NASM to the PATH-Variable from Windows (rebooted after that) and opened the ‘boot.sln’ for the project. Leave the Debugger in Win32 mode. Then clicked simply ‘Build’ (result: 2 succeeded, 0 failed, 0 skipped). No error messages. Output file is Boot.efi (461.312 bytes). OK, it took several attempts – but compiling works now flawless.

  5. Pingback: LZVN packed Apple Logo’s | Pike's Universum

Leave a comment