Re: booting custom kernel
Re: booting custom kernel
- Subject: Re: booting custom kernel
- From: Shantonu Sen <email@hidden>
- Date: Tue, 9 Aug 2011 19:01:32 -0700
On Aug 9, 2011, at 11:34 AM, Andreas Fink wrote:
> I've followed the excellent up to date page on http://shantonu.blogspot.com/ for building a stock 10.7 kernel from source so I can experiment later with a modified version.
> I realize compiling xnu these days have becomesquicker and easier than with 10.4 and older.
>
> I however wonder:
>
> What is the currently recommended way to define another boot kernel as boot argument?
In the absence of of FileVault, what I'd probably recommend is:
1) Copy your kernel to "/mach_kernel.test"
2) Create "/Library/Preferences/SystemConfiguration/test.plist" following com.apple.Boot.plist(5), with a Kernel=mach_kernel.test key/value
3) Run:
sudo bless --mount / --setBoot --options "config=test"
When you boot up, test.plist will be loaded, which will in turn indicate that your custom kernel should be used.
If at any point you want to revert to the stock kernel, hold down option during boot, and select your hard disk partition. Per the bless(8) man page, since the "config=test" is tied to the NVRAM setting for your boot preference, booting via the OS picker discards that and uses the stock plist and kernel. You can also add in custom Kernel Flags like -v just for testing.
> In my case the filesystem is encrypted (FileVault 2.0), so its being booted through the file vault EFI driver.
There's no File Vault EFI driver. Boot files are hosted by an auxiliary partition. kextd manages syncing to that partition on demand.
> I want to be able to go back to my normal kernel easily and quickly in case the experimental fails totally.
Since the boot partition has a fixed size, we do not allow for open-ended kernel configuration. While you could probably reverse-engineer a mechanism based on open source code, I would not recommend trying to do anything sophisticated. Rather, it would be easiest to use a machine that supports both the 32-bit and 64-bit kernel, and have the i386 slice be the stock Apple-provided kernel, and your test kernel be lipo(1)-ed in as the x86_64 slice. The amalgam will get linked into a prelinked kernel cache and synced to the Apple_Boot partition. If you ever want to revert to a working kernel, hold down '3' and '2' during boot to use the stock 32-bit kernel.
> Booting to emergency partition and copying kernel file back and forth would be an option but then how to mount encrypted partition in that case?
> Just wondering whats the easiest and safest and recommended way
>
You can use Disk Utility from the recovery partition to unlock encrypted volumes.
Shantonu
> Andreas
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-kernel mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden