Boot Selector Switch for Linux or Windows

Stephen Holdaway's hack uses a physical switch and an STM32 processor to boot in Windows or Linux.

Jeremy Cook
3 years ago

If you’re a Linux user who also boots into Windows when needed, doing so requires careful timing when to select your “alternate” OS after powerup. On the other hand, booting up the default OS means that you just turn it on, wait a bit, and there it is. Either way, you know what you want to load beforehand, so why not a physical switch that you simply flip before powering the computer on?

Stephen Holdaway did just this, creating a switch with “Linux” and “Windows” labels, allowing you to boot into the correct OS with ease. It's mounted to his desk with a nice aluminum bar, as an installation that makes you think “why didn’t I do that?”

As explained in his project write-up, this hack is actually a bit more complicated than it looks. Since this device selects the OS using the GRUB bootloader before the OS is loaded, you’re restricted as to what peripherals you can use in this environment. To get around these issues, Holdaway is employing an STM32 microcontroller to act as a USB mass-storage device, which required a bit of a deep dive into the way GRUB works, as well as the FAT12 file system that he selected.

With these details worked out, the device serves a file to the computer, which changes dynamically based on the switch position. Through this, the computer’s boot behavior is set to one OS or the other. You can see a short demo of this clever setup in the video below, and code is available on GitHub if you’d like to try something similar.

Jeremy Cook
Engineer, maker of random contraptions, love learning about tech. Write for various publications, including Hackster!
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles