Sunday, March 23, 2008

Install new Kernel / Boot from alternate Kernel


this post will display how to install new kernel,
and it will also display how to boot 
from alternative kernel, 
plus some trouble shooting advices.


1. what is a kernel?
Kernel is the core and center of the OS, it interface the hardware and it is the nearest code to hardware there is, it gives the OS and the applications services on the computer (such as CPU, memory access, threading, networking, filesystem etc.) for further reading you can refer to my dev blog post: Kernel Basics.

2. why would i like to update it?
the reasons mostly comes from bug fixed, features added to hackintosh and not available with the version you are using, or just to know you are up-to-date (any new post in insanelymac, netkas or on the net will relate to your version), if you are not confidant in your abilities to update the kernel, then avoid it until you must, it can crash your system (although can be easily reversed)

3. where can i get new kernels?
  • EFI supported kernel are available at netkas blog links from the irc channel.
  • you can also download the latest kernel and its relevant kext from the open source darwin project, compile it, and patch it using netkas EFI patch using this procedure(for more advanced users - not recommended).
4. how to install new kernel?
once downloaded (probably from netks blog) backup your current kernel (/mach_kernel), copy it to the root file system and rename it to "mach_kernel", fix permissions, and your done.
now for the step by step procedure:

a. download the binary mach_kernel file into a folder (for instance desktop)
b. copy the file from downloaded folder (e.g. desktop) to the root folder
  • open terminal
  • write: sudo -s
  • enter your password when prompt and press enter
  • cp ~/Desktop/mach_kernel_9.2 /
c. backup your current kernel by renaming it
  • mv /mach_kernel /mach_kernel_9.0
d. rename the downloaded kernel to the mach_kernel file name
  • mv /mach_kernel_9.2 /mach_kernel
e. fix permissions and reboot
  • chown 0:0 /mach_kernel
  • chmod 755 /mach_kernel

5. how to boot from alternate kernel?
if you do not trust the downloaded kernel, you can ask darwin boot loader to load from a different kernel file, just by stating the full path of the kernel as the first parameter in the boot prompt.

for instance if the downloaded kernel name is: mach_kernel_9.2 then you copy it to the root of the files system using finder or terminal, (from command line: cp mach_kernel_9.2 /).
next, in the boot prompt you write: /mach_kernel_9.2 -v
i added the -v so you can see where other parameters goes.

6. what if something goes wrong?
you can easily reverse the procedure, first you can use the boot from alternate kernel, and booting into the backed up kernel (/mach_kernel_9.0 as first parameter to darwin boot loader).
second you can boot from the install DVD into single user mode, mount the file system and rename the new kernel, copy the backed up kernel as /mach_kernel file name and reboot (i will add a post regarding single user boot, mount, and other unix shell commands needed for the procedure).

here is a 3pg video displaying several options of booting from alternate kernel file. (poor qulity video, opens with QuickTime)

Enjoy.

No comments:

 
the menu is from: Milonic DHTML menus