Jump to content
InsanelyMac Forum
  • Announcements

    • Allan

      Solution to create a topic or post.   04/24/2018

      Hello guys. The majority of you are having issues to create a topic or post here. This are a problem with our current theme InsanelyMac.  Now the theme will be the Default IPS. Sorry for any inconvenience.
smartie77

fresh for Lion from source : single 32 and 64bit kernels

Recommended Posts

Apples mach_kernel is 15MB and is a hybrid, contains as well 32 and 64bit code. It all depends on if you boot with i386 or x86_x64 as arch argument.

 

Today I downloaded the official xnu source code for Lions kernel and set up my build environment. I just did a compile without any changes ( will play later with what is possible ). So this is still a Apple "vanilla" kernel, meaning it will run on the CPUs that Lion "needs" ( by Apples specifications ) .

 

But I made two kernels : one for i386, 32bit and the other for 64bit, x86_x64. Each one is now only 7,5MB in size and I feel they perform both better then the stock one. My machine loads quicker , if for anything this alone is nice.

 

"my" 32bit kernel can still execute 64bit apps, see proof - Photoshop CS5 x64 mode on 32bit kernel :

 

 

post-156995-1311333456_thumb.png

So here they are, fresh compiled for you - put in / and rename to mach_kernel ( or leave the names and specify one to load in your com.apple.boot.plist :

 

32 Bit 32_kernel.zip

 

64 bit 64_kernel.zip

Share this post


Link to post
Share on other sites
Advertisement
( will play later with what is possible ).

 

Sounds very promising let me know if u need a Dummy to test with since we both german !

Share this post


Link to post
Share on other sites
Sounds very promising let me know if u need a Dummy to test with since we both german !

 

this will take a bit I fear - I know my way around for Linux but never played with OSX kernel configs. I did just compile the stock kernels to see if they build and if they boot and if OSX still functions like it should - so that's what they do - and I just share them now.

 

I specifically am onto one single disabled feature in Lion : Rosetta. .. :wacko:

Share this post


Link to post
Share on other sites

i get what u did we sort of succeeded on this earlier too... also started to use the legacy diffs provided all over the place with not much luck tough ..thats what happens when knowledge is very limited !!

Share this post


Link to post
Share on other sites
i get what u did we sort of succeeded on this earlier too... also started to use the legacy diffs provided all over the place with not much luck tough ..thats what happens when knowledge is very limited !!

 

 

yeah :-P

 

Now I learned so much in the last months alone.. set up Snow, learned about Lion, made that work, made my hack book work and now providing people with infos for the damn ati mobility card every second Laptop seems to have these days.. Hexediting, kexts modify, smbios tweaks ..

 

Kernel is new, but nothing is impossible.. but now I need a break, happy Weekend all.

Share this post


Link to post
Share on other sites

Tried it, renamed it to "light_kernel", copied to root, then set boot.plist <key>Kernel</key><string>light_kernel</string>.

It starts, but now every time it loads all kexts on boot. Tried to rebuild kernelcache via terminal, but same issue. (already using "UseKernelCache" option in boot.plist)

 

Edit.: I set back to mach_kernel and now don't load kexts every time.

 

@smartie77: how did you "installed" it? Did you renamed it to mach_kernel?

Share this post


Link to post
Share on other sites

Tried it... Did seem to boot up a lil faster.

 

Problem is, now it takes about 2 minutes to login o.o

not sure what that's about?

Share this post


Link to post
Share on other sites
Can i use this now on a ATOM N270 32 bit processer

Thnx

 

no - it still vanilla apple cpu support ( already said it -- pls read the next time before asking )

 

Tried it... Did seem to boot up a lil faster.

 

Problem is, now it takes about 2 minutes to login o.o

not sure what that's about?

 

This is not in my case. It is faster from cold boot to the login screen. Otherwise I would not thought about sharing it if it would be slower..

 

Maybe depends on the boot loader ? I use chimera from latest [url=&quot;http://www.insanelymac.com/forum/topic/279450-why-insanelymac-does-not-support-tonymacx86/&quot;]#####[/url].

 

Tried it, renamed it to "light_kernel", copied to root, then set boot.plist <key>Kernel</key><string>light_kernel</string>.

It starts, but now every time it loads all kexts on boot. Tried to rebuild kernelcache via terminal, but same issue. (already using "UseKernelCache" option in boot.plist)

 

Edit.: I set back to mach_kernel and now don't load kexts every time.

 

@smartie77: how did you "installed" it? Did you renamed it to mach_kernel?

 

I call it 64_kernel // 32_kernel and have set it ( the 64 one for me ) to boot via com.apple.boot.plist from /Extra:

 

Bootloader latest chimera as found in "[url=&quot;http://www.insanelymac.com/forum/topic/279450-why-insanelymac-does-not-support-tonymacx86/&quot;]#####[/url]" ( based onchameleon 2rc5 it seems to be ), its a reliable booter for me.

 

Before I had a "full options" build of chameleon ( obtained via kexts.com ) and this was the slowest boot loader ever, also full of errors and "waiting for root device".. Horrible , therefore I tried chimera and everything was quick as now.

 

"

<dict>

<key>Kernel Flags</key>

<string>arch=x86_x64</string>

<key>UseAtiROM</key>

<string>Yes</string>

<key>RestartFix</key>

<string>Yes</string>

<key>GeneratePStates</key>

<string>Yes</string>

<key>pmVersion</key>

<string>102</string>

<key>GenerateCStates</key>

<string>Yes</string>

<key>EthernetBuiltIn</key>

<string>Yes</string>

<key>GraphicsEnabler</key>

<string>No</string>

<key>Default Partition</key>

<string>hd(0,2)</string>

<key>DSDT</key>

<string>/Extra/dsdt.aml</string>

<key>Kernel</key>

<string>64_kernel</string>

<key>PciRoot</key>

<string>1</string>

<key>USBBusFix</key>

<string>Yes</string>

<key>SMBIOS</key>

<string>/Extra/smbios.plist</string>

</dict>"

 

I have a smbios.plist + applegraphicspowermanagement.kext that matches 100% the real hardware , and ethernet is turned OFF because I use WiFi and thus booting is quicker when Ethernet is not trying to load a self-assigned address.

 

but this is only a 2 second delay if I would turn it on.

 

The old mach_kernel ( the invisible one from OSX default ) sits still in / - but it is not used anymore. Keep it only if something horrible goes wrong - but it seems to work exactly like the fat one before.

 

ps: the new kernel caches in Lion are not yet clear to me - I never booted with -f or such in Lion. If I need to exchange kexts then I simply do it in single user mode , set chmods and chowns and make a reboot by shutdown -r now - sometimes it takes two reboots until a kernel is loaded by this brutal mode, but it always works this way sooner or later.

 

So OSX builds its caches on its own without manual interfering needed .

Share this post


Link to post
Share on other sites

Everything is much simpler:

lipo /mach_kernel -extract i386 -output /mach_kernel_32
lipo /mach_kernel -extract x86_64 -output mach_kernel_64

:rolleyes:

Share this post


Link to post
Share on other sites
Everything is much simpler:

lipo /mach_kernel -extract i386 -output /mach_kernel_32
lipo /mach_kernel -extract x86_64 -output mach_kernel_64

:)

 

 

Yes someone told me already so .. What shall I say ? I did not knew it . This output was the product of my first Kernel build which I did for learning purpose only to make sure I understand it..

 

I am new into Kernel config/build.. So I started with a clean copy of Apples release and out came that what I have.. And I just thought I am a genius ;.)

 

No seriously, before I go and edit config options and maybe producing some garbage kernel I needed to do it once with a 100% working copy. You know.. learning by doing.. At least now I know for sure that all tools and the build environment are working on my machine.

 

And it was damn quick to produce these kernels.. Core2Duo with 4Gigs of Ram, it ran in the background and lasted not long .. doing a rebuild of Linux 3.0 :rolleyes: takes longer..

Share this post


Link to post
Share on other sites

Great work :D

 

But Lion's frameworks and system files are Intel, and universal frameworks (PPC/Intel) are required to enable rosetta.

So you have to get all sources of all system files (Frameworks, extensions, etc) and compile to an universal binary

to get rosetta working :D

 

I will try to get something for AMD

Share this post


Link to post
Share on other sites
Great work :(

 

But Lion's frameworks and system files are Intel, and universal frameworks (PPC/Intel) are required to enable rosetta.

So you have to get all sources of all system files (Frameworks, extensions, etc) and compile to an universal binary

to get rosetta working ;)

 

I will try to get something for AMD

 

rosetta is very small and much independent from the rest of OSX. 99% of all stuff needed sits in /usr/libexec/oah . In Lion the folder is empty with only the blocking exe inside. ut that can be replaced with the content from SL dvd or extracted installer packs.

 

The problem is that ( as I understand it ) inside the Lion kernel all calls to the rosetta exe ( which is called "translate" ) are returned to another exe ( "RosettaNonGrata" which simply blocks it.

 

Hardcoded "No-go" if you want so ..

 

-

Share this post


Link to post
Share on other sites

Not bad. Anybody running Lion in 32 bit mode on a a Core Duo (NOT Core 2 Duo)?

 

@ smartie77: which screen size is your Toshi? Googled but found contradicting sizes. I guess u bought it in Deutschland?

Share this post


Link to post
Share on other sites
Not bad. Anybody running Lion in 32 bit mode on a a Core Duo (NOT Core 2 Duo)?

 

@ smartie77: which screen size is your Toshi? Googled but found contradicting sizes. I guess u bought it in Deutschland?

i could test later today if needed

Share this post


Link to post
Share on other sites
i could test later today if needed

 

Yes, could you? I would love to have Lion on my old MacBook 1.1 ;)

Share this post


Link to post
Share on other sites
im installing snow leo as i speak. starting fresh

 

I was to excited.... It will not work. The Finder is 64 bits and my MacBook is 32 bits. Maybe a hacker will come with something i hope ;)

Share this post


Link to post
Share on other sites

The Finder.app of Lion DP 1 (Developer Preview) build 11a390 was still 32/64. You might be able to use that one (+ maybe some Framework(s), Application Support etc.). The closest (but not complete) 32 bit hack I was able to find is for DP4: http://osxdaily.com/2011/06/11/run-lion-dp4-core-duo-mac/

 

it also mentions three kexts that need to be replaced for 32 bit support of DP4.

 

I bet there is solutions for GM/RTM 32 bit on CPUs <Core 2 Duo out there already somewhere .. :(

Share this post


Link to post
Share on other sites
Everything is much simpler:

lipo /mach_kernel -extract i386 -output /mach_kernel_32
lipo /mach_kernel -extract x86_64 -output mach_kernel_64

:(

Great :) Does it work with Snow Leopard kernel ?

Share this post


Link to post
Share on other sites
Just wondering if this bodes well for the netbook scene. I know it's still too early to tell anything for sure, but is it a bleak outlook, or is there hope?

 

If we can get hold of a patched kernel for Atom, Theres still problem running it coz Finder app is 64bit.

Share this post


Link to post
Share on other sites
Everything is much simpler:

lipo /mach_kernel -extract i386 -output /mach_kernel_32
lipo /mach_kernel -extract x86_64 -output mach_kernel_64

:P

yeah, and probably a better idea; the last time i looked, Apple was not sharing all the sources for the mach_kernel.

For instance: using Meklort's kernelpatcher on 10.6, i can boot vanilla kernel using -legacy flag and in this case,

i can use the old Processor pane (came with XCode) to switch off one of the Pentium D cores.

With a "home made" kernel (e.g. legacy_kernel, this is not possible!

Some stuff (that i can't remember the name atm) is missing from the sources so, beware...

only compile the kernel if you really need to ;)

Share this post


Link to post
Share on other sites

64bit kernel only consumes about 200mb less memory (268mb instead of over 460mb for the regular kernel) and my boot time is much faster, as is the time from enabling my ATI 4670 mobility card to the Lion login screen.

 

Thanks - Should learn how to compile my own kernels as well.

 

Peter

Share this post


Link to post
Share on other sites
lipo /mach_kernel -extract i386 -output /mach_kernel_32
lipo /mach_kernel -extract x86_64 -output mach_kernel_64

how do these kernels compare RAM usage and speed wise?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.



×