Compile a minimal Linux 3.5 Kernel for Hyper-V - linux

I'm looking for to compile a minimal linux 3.5 kernel for Hyper-V.
The "selecting" hyper-v drivers part is quite easy. However, how to remove unnecessary modules/drivers and improve performance.

Read Linux Kernel in a Nutshell by Greg Kroah
http://www.kroah.com/lkn/

Related

Is it possible to get OpenCL on Windows Linux Subsystem?

I'v been trying for the past day to get Tensorflow built with OpenCL on the Linux Subsystem.
I followed this guide. But when typing clinfo it says
Number of platforms 0
Then typing /usr/local/computecpp/bin/computecpp_info gives me
OpenCL error -1001: Unable to retrieve number of platforms. Device Info:
Cannot find any devices on the system. Please refer to your OpenCL vendor documentation.
Note that OPENCL_VENDOR_PATH is not defined. Some vendors may require this environment variable to be set.
Am I doing anything wrong? Is it even possible to install OpenCL on Windows Linux Subsystem?
Note:
I'm using an AMD R9 390X from MSI, 64bit Windows Home Edition
With the launch of WSL2, CUDA programs are now supported in WSL (more information here), however there is still no support for OpenCL as of this writing: https://github.com/microsoft/WSL/issues/6951.
According to a Microsoft representative in this forum post, Windows Subsystem for Linux does not support OpenCL or CUDA GPU programs, and support is not currently planned. To experiment with TensorFlow/OpenCL it would probably be easiest to install Linux in a dual-boot configuration.
You could use the Intel OpenCL SDK for the CPU, https://software.intel.com/en-us/articles/opencl-drivers.

QEMU-KVM vs VMWare for kernel debugging with GDB

I have been using QEMU-KVM and GDB for hacking the Linux Kernel. I ran into some situations where reverse debugging will be useful. QEMU doesn't seem to support reverse debugging, but I heard VMWare does (http://lwn.net/Articles/356332/).
What are the pros and cons of VMWare + GDB compared to QEMU + GDB? Are there any pitfalls I would run into by switching from QEMU to VMWare?
VMware dropped support for reversible/replay debugging some years ago.
There are some patches to QEMU for reversible debugging, but AFAIK not yet merged: http://lists.gnu.org/archive/html/qemu-devel/2014-11/msg03947.html
You can use UndoDB (http://undo-software.com/) for reversible debugging of userspace, but not kernel.
I'd imagine those patches are your best bet, but I don't think there is a particularly easy solution.
Greg

Linux Kernel Examination in Windows

I want to examine the Linux kernel source code using Visual Studio on Windows. But I don't know how to do that. Do I need a virtual machine to run or debug the kernel or is there any special way for me to do that ???
What does "kernel examination" means to you?
Why can't you more simply study the source code of the Linux kernel?
It is free software, you cant fetch its source code from kernel.org
it is extremely likely that your Linux vendor publishes either the source code of his variant of Linux kernel, or patches against vanilla kernel source code. The GPLv2 license of the Linux kernel nearly requires such a behavior.
And a Linux system gives you a lot of tools (objdump, ....) to study ELF executable image (like the Linux kernel mostly is....)
You probably won't be able to compile the Linux kernel with Visual Studio. You need GCC (or a very compatible compiler). Linux source code uses many GCC extensions.
My advice is to install a Linux system on your development machine (you can have a dual boot if you want to keep Windows for games....) and to learn it and to use Linux tools (including emacs, grep, etags etc....) to study the source code of Linux. Remember that Linux is the preferred platform to build the Linux kernel... (if your distribution is Debian or Ubuntu or similar, learn about make-kpkg)
Also read some good books about Advanced Linux Programming and about the Linux kernel (there are many of them).
BTW, you could even customize your GCC compiler, e.g. with a plugin or a MELT extension, to measure, search, or even refactor the source code of the kernel. See also cocinelle.

Anyone tried to compile Intel xf86_video_intel for another OS

Has anyone tried to compile Intel xf86_video_intel for another OS. This code is written for Linux. I am wondering if there is any experience with porting the code to another operating system? The code is located at:
http://intellinuxgraphics.org/documentation.html
Thanks,
FM
The latest Intel Linux graphics drivers are very dependent of features of the linux kernel (kernel mode setting being one of the most talked about recently). Porting the driver may not be a trivial, if possible, task.
Usually Linux graphic code is written for the X server. X is available for many different platforms / OS'es. For more information see (http://www.x.org/wiki/).

Can I run a 64-bit VMware image on a 32-bit machine? [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 months ago.
The community reviewed whether to reopen this question 6 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
Can I run a 64-bit VMware image on a 32-bit machine?
I've googled this, but there doesn't seem to be a conclusive answer.
I know that it would have to be completely emulated and would run like a dog - but slow performance isn't necessarily an issue as I'm just interested in testing some of my background services code on 64-bit platforms.
The easiest way to check your workstation is to download the VMware Processor Check for 64-Bit Compatibility tool from the VMware website.
You can't run a 64-bit VM session on a 32-bit processor. However, you can run a 64-bit VM session if you have a 64-bit processor but have installed a 32-bit host OS and your processor supports the right extensions. The tool linked above will tell you if yours does.
If you have 32-bit hardware, no, you cannot run a 64-bit guest OS. "VMware software does not emulate an instruction set for different hardware not physically present".
However, QEMU can emulate a 64-bit processor, so you could convert the VMWare machine and run it with this
From this 2008-era blog post (mirrored by archive.org):
$ cd /path/to/vmware/guestos
$ for i in \`ls *[0-9].vmdk\`; do qemu-img convert -f vmdk $i -O raw {i/vmdk/raw};done
$ cat *.raw >> guestos.img
To run it,
qemu -m 256 -hda guestos.img
The downside? Most of us runs VMware without preallocation space for the virtual disk. So, when we make a conversion from VMware to QEMU, the raw file will be the total space WITH preallocation. I am still testing with -f qcow format will it solve the
problem or not. Such as:
for i in `ls *[0-9].vmdk`; do qemu-img convert -f vmdk $i -O qcow ${i/vmdk/qcow}; done && cat *.qcow >> debian.img
Yes, running a 64-bit OS in VMWare is possible from a 32-bit OS if you have a 64 bit processor.
I have an old Intel Core 2 Duo with Windows XP Professional 2002 running on it, and I got it to work.
First of all, see if your CPU is capable of running a 64-bit OS. Search for 'Processor check for 64-bit compatibility' on the VMware site. Run the program.
If it says your processor is capable, restart your computer and go into the BIOS and see if you have 'Virtualization' and are able to enable it. I was able to and got Windows Server 2008 R2 running under VMware on this old laptop.
I hope it works for you!
If your hardware is 32-bit only, then no. If you have 64 bit hardware and a 32-bit operating system, then maybe. See Hardware and Firmware Requirements for 64-Bit Guest Operating Systems for details. It has nothing to do with one vs. multiple processors.
It boils down to whether the CPU in your machine has the the VT bit (Virtualization), and the BIOS enables you to turn it on. For instance, my laptop is a Core 2 Duo which is capable of using this. However, my BIOS doesn't enable me to turn it on.
Note that I've read that turning on this feature can slow normal operations down by 10-12%, which is why it's normally turned off.
I honestly doubt it, for a number of reasons, but the most important one is that there are some instructions that are allowed in 32-bit mode, but not in 64-bit mode. Specifically, the REX prefix that is used to encode some instructions and registers in 64-bit mode is a byte of the form 0x4f:0x40, but in 32 bit mode the same byte is either INC or DEC with a fixed operand.
Because of this, any 64-bit instruction that is prefixed by REX will be interpreted as either INC or DEC, and won't give the VMM the chance to emulate the 64-bit instruction (for instance by signaling an undefined opcode exception).
The only way it might be done is to use a trap exception to return to the VMM after each and every instruction so that it can see if it needs special 64-bit handling. I simply can't see that happening.
VMware? No. However, QEMU has an x86_64 system target that you can use. You likely won't be able to use a VMware image directly (IIRC, there's no conversion tool), but you can install the OS and such yourself and work inside it. QEMU can be a bit of a PITA to get up and running, but it tends to work quite nicely.
VMware does not allow you to run a 64-bit guest on a 32-bit host. You just have to read the documentation to find this out.
If you really want to do this, you can use QEMU, and I recommend a Linux host, but it's going to be very slow (I really mean slow).
Yes, you can. I have a 64-bit Debian running in VMware on Windows XP 32-Bit. As long as you set the Guest to use two processors, it will work just fine.
You can if your processor is 64-bit and Virtualization Technology (VT) extension is enabled (it can be switched off in BIOS). You can't do it on 32-bit processor.
To check this under Linux you just need to look into /proc/cpuinfo file. Just look for the appropriate flag (vmx for Intel processor or svm for AMD processor)
egrep '(vmx|svm)' /proc/cpuinfo
To check this under Windows you need to use a program like CPU-Z which will display your processor architecture and supported extensions.

Resources