I'm looking for a more elegant way of choosing which OS to boot than using the menu provided by grub, and I think it would be neat to have a switch on the case with two states (e.g. Ubuntu and Windows), that decide which OS will be loaded. I've been doing some thinking, and it seems to me like you should be able to solve it by hooking the switch to a PWM generator, and connect the generator to a fan speed input pin. Then from grub read the fan speed, and do a conditional test that determines which OS to load.
if (fan.speed > threshold) then load Windows; else load Ubuntu; end
My two questions are therefore:
- How do you use a test with grub to determine which OS to start?
- How can you read the fan speed from grub during startup?
Other solutions and ideas are of course welcome as well :)