Development Environment in Windows

Source: Internet
Author: User

Development Environment in Windows

We mentioned in qemu that in Windows, you need a virtual Linux to help you compile the source code of the operating system. Compiling and linking the operating system kernel to the ELF format has many advantages. We can not only use the ready-made tools (such as readelf) in Linux to analyze the compiled kernel, we can also refer to the source code of the Linux kernel to help our own development when necessary. In short, this brings us closer to Linux. Therefore, it is easy to install a Linux system.
However, installing a virtual Linux is different from installing a real Linux, mainly in two aspects. First, we only want to use this Linux to compile links. Therefore, we try to remove unnecessary content when selecting components, which can save time and space; the second is to make sure that the virtual machine you selected is easy to communicate with the host machine over the network, because you need to give the source code on the host machine for compilation.
There are multiple options for the installation method. The simple method is to install it on a CD. Of course, the CD can also be "virtual", that is, a CD image. First download an image for the installation of the CD from the official website of your favorite Linux release. Some releases also provide free or paid mail services. You can choose one as you like. Assume that you have obtained a CD image named Inst. ISO.
With the CD image, we still lack a hard disk image. You can use the bximage mentioned above to generate it, or use the following command:
$ Qemu-IMG create HD. IMG 1500 m
In this way, a hard disk image of about GB can be generated.
Next we can install it:
$ Qemu-CDROM Inst. iso-hda HD. IMG-boot d
During the installation process, try to streamline your components as much as possible. Do not install too many useless things. These components are required for us: GCC, GNU make, NASM, Samba. If they are not installed by default during installation, you need to install them after the system installation is complete. Currently, most virtual machines have easy-to-use network functions, so it is not difficult to install them.
After installation, we also need to solve the problem of making the host machine communicate with the virtual machine. In fact, you can regard them as two machines in the LAN. the method used in the LAN is also applicable here, So Samba is very suitable.
First, share a folder in a read/write mode in windows, assuming it is called oranges, and then run the following command on virtual Linux:
$ Sudo Mount-T smbfs-O username = user, password = blah // 10.0.2.2/oranges/mnt
Assume that your host IP address is 10.0.2.2. In this way, you can see the content in the Windows shared folder under the/mnt directory of Linux. You can read and write the content in the virtual machine at will, just like treating local files.
In this way, your compiling environment is installed. Next, you need an editor, just like in Linux. It is said that some people always use NotePad to write code. For whatever reason, I hope you will not do this, because you can find many editors that are more suitable for coding than notepad, there are charges and free items. They usually have keyword color, automatic indentation, and other convenient functions for developers, which can greatly improve work efficiency.
To sum up, you need to do the following to build a development environment in Windows:
• Install Windows.
• Install bochs (the installer can be obtained from its official website ).
• Install an editor you like to write code.
• Install a fast virtual machine, such as qemu (the installer can be obtained from its official website }).
• Install a Linux instance on a fast-paced virtual machine.
• Install GCC, GNU make, NASM, and samba in virtual Linux -- if they are not installed by default.
• Share a read/write folder between a virtual Linux instance and a host.
In the future, your development process may look like this:
• Compile code in an editor in windows.
• Use make in virtual Linux to call GCC, NASM, and other tools to generate the kernel and write it into the disk image.
• Use bochs in Windows to run your operating system.
• If there is any problem.
O uses various methods for debugging, such as bochs;
O returns step 1.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.