0

I want to get into kernel development, and the first practical step is obviously to run a Linux kernel to develop.

I think the best solution for me would be to dual boot windows and Linux, with Linux as a daily driver and kernel dev environment/ test bed. I would keep windows as a backup option seeing as how last time I ran this setup I managed to brick my Linux system when I was trying to install video drivers... I would want to avoid running Linux from windows since I'm not sure I have the processing power to run both, especially if I wanted an IDE within Linux...

My questions about this setup are as follows:

Is there a fundamental problem I'm missing where Linux could corrupt my windows system if something goes wrong? I would be running my own edited version of the kernel, and I'm worried that a particularly unstable change could result in disk corruption, but I don't know if this is a relevant concern.

Are there windows native tools for recovering a Linux system on the same device?

If not then what Linux tools are available for recovery if I ran a third operating system on the side for recovery purposes?

Edit: For background I have a degree in CS (with a course in OS, including an IPC kernel module), but I'm doing malware analysis/ RE and I want to get into development, and mainline kernel development would give me a competitive edge. I want to get into something low level where correctness/ optimization counts as a business concern. Security/ speed/ power efficiency/ multithread/multiprocessing or some other form of optimization where I can put my low level experience/ passion to use.

2
  • 1
    Why not use a virtual machine? Also developing for Linux kernel while not using daily Linux looks a bit strange (not "Eating your own dog food"?)
    – A.B
    Nov 23, 2019 at 6:03
  • 1
    Linux would be my daily driver, I would just have windows for gaming, and potentially any programs I might need that don't exist on Linux such as IDA Pro. So GRUB defaults into Linux with windows remaining an option. If that isn't clear in my question, how should I edit it to make it more clear?
    – solumnant
    Nov 23, 2019 at 16:53

2 Answers 2

0

Maybe you are a bit confused by the different possibilities when it comes to "combining" different OSs, like Windows and Linux.

"Dual Boot", or "Multi-Boot" is what you, and many others, need, even when they boot only into different versions of the same OS.

Using a VM would make sense, but only later, when you start to test lots of new kernels and modules. You could boot into a stable Linux, and then virtually boot into one or more test versions -- even at the same time.

But first problem is to separate your running Windows from any additional installation, and vice versa.

You don't even need a second disk, but you need a free partition, a couple of GB at least.

"(Multi-)Booting", "boot loader" (grub) and "partition" are things to look up in wikipedia for a start, and then, depending on things like UEFI or not, you can make a plan.


A lot can go wrong when you have to install a second OS on your system, and have to install a new boot loader. But once your "grub" is working, you don't have to worry about linux and windows interfering.

That is one of the main ideas of partitions: to make separate block devices. A kernel crash plus whatever filesystem corruption will be only on the mounted partitions. (You can mount the windows partition(s) also, but then you don't play with it.).


"recovery" would mostly mean to keep a bootable USB drive ready, to repair the boot loader.


"If not then what linux tools are available for recovery if I ran a third operating system on the side for recovery purposes?"

How do you mean that? Normally (outside a VM) OS are run one after the other.

A bootable USB is both the "third OS" and the linux (or windows) tool for recovery purposes.


1
  • My main concern for corruption is that I'm going to be writing/testing kernel level code, and even though I don't plan on touching disk I/O, I'm worried that an unstable kernel may do completely unexpected things. I don't want to write an unstable kernel, but it's always a possibility. I'm going to add this to my question, and if you edit your answer to address it then I'll accept it.
    – solumnant
    Nov 23, 2019 at 18:03
0

Is virtualisation fast enough?

How old is your machine, and what processor does it have?: Virtualisation (e.g. virtual box will not reduce performance by any noticeable amount). Almost any processor make in the last 10 to 20 years has hardware support.

My experience of virtual box, has been that Gnu/Linux in virtual-box in Microsoft's Windows, is faster that Microsoft's Windows. Even on an old CPU with no hardware support (so long as I did nothing that needed more than one core: You need hardware support for more than one core.)

Dangers of dual boot

Yes dual booting can cause problems to the other OS. Especially if you are working on the kernel.

What is Linux, and what it is not

And do you know what is what?

  • The whole OS is Gnu/Linux (The kernel named Linux, plus the Gnu non-kernel parts of the OS). However people often call the whole thing Linux. This leads to a lot of confusion.
  • The kernel is the small part in the middle, (well actually at the bottom, but the name means middle). It is the hardest bit to work on: You have to program in C, and any mistake can crash the machine, stop it booting, and scramble the content of the hard disk.

Concluding remarks

I would recommend installing a Gnu/Linux in virtual box. Use it for a bit, learn the command line (shell), learn to write basic shell scripts, learn one language that is good for beginners (python is quite good), learn another, learn C and write user mode programs, start studying the kernel, make a change and test it.

7
  • 1
    I already know a few languages, and I do want to work in/with the kernel so I can get a job doing the same since my degree in CS (including a course in OS with some kernel dev) isn't enough to look competitive in that market (or a least something low level where correctness/speed/power usage matters). At work I run Mint/Debian as the foundation of my malware analysis/RE machine, with windows in my VM to avoid the possibility of infecting my host. I would be open to any other career that scratches my low level coding itch. I'm going to edit my question to reflect my background.
    – solumnant
    Nov 23, 2019 at 17:03
  • I still recommend Virtual box, you can snap-shot your VM, and restore it after you toast it. Also consider Arduino, and other similar. And good luck, working of free-software / open-source projects is a good way to get experience. Nov 23, 2019 at 18:25
  • The main reason I'm looking to run Linux directly is because I want to have my dev environment be in Linux. It will help with IDE speed, reference correctness (I think), and I know that doing any kind of work inside of a VM with snapshots is a PITA since the snapshots also cover the files I'm editing.
    – solumnant
    Nov 23, 2019 at 18:38
  • I run Gnu/Linux (Debian) as the host, and guest. I then set up a share, so that the files that I am working on are stored on the host (not subject to snap shotting. I revision control them independently). Also this way I can edit the code from ever host or guest. Nov 23, 2019 at 18:42
  • Doing malware analysis I tried to do the same thing with some of my tools, and I've found that they run orders of magnitude slower on the guest when run off the share even when the whole thing is run off an SSD. Taking an hour to open a tool vs 3-4 minutes when it's directly on the desktop. I think there's some sort of severe read penalty to accessing a share no matter what.
    – solumnant
    Nov 23, 2019 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.