Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile Linux kernel code on Windows?

I want to compile and later modify a Linux kernel code but I cannot do it by installing and running separate Linux system like Ubuntu and then compiling this kernel on linux system as I am not able to work on full fledged Linux system(Laptop hardware problems).I want to do it on Windows 7.Is there a way that I can do it?

like image 442
user2916886 Avatar asked Oct 24 '13 17:10

user2916886


People also ask

Can I compile a Linux kernel on windows?

WSL 2 not only loads a native Linux Kernel, the image of the Linux Kernel is in the directory C:\WINDOWS\System32\lxss\tools\kernel, but it also gives us the option of loading a customized Linux kernel. That's right, we can compile and customize our own kernel to be loaded into WSL 2.

How is kernel code compiled?

The kernel doesn't compile itself -- it's compiled by a C compiler in userspace. In most CPU architectures, the CPU has a number of bits in special registers that represent what privileges the code currently running has. In x86, these are the current privilege level bits (CPL) in the code segment (CS) register.


2 Answers

The Linux kernel source tree has different files in some directories whose names only differ in capitalization, so unpacking the source tree would have to happen in a directory where the POSIX compatibility mode was active. Furthermore, you need a cross compiler targetting Linux, and an appropriate shell environment.

It can be done within the Cygwin environment if so desired, but I suspect it is significantly easier to run a Linux virtual machine, or CoLinux.

like image 69
Simon Richter Avatar answered Oct 13 '22 19:10

Simon Richter


i Think you are talking about this have a look on this site they provide a way to compile and modify and infact build a new kernel in Visual Studio hope it will help you

like image 24
Zain Ul Abidin Avatar answered Oct 13 '22 18:10

Zain Ul Abidin