X01. OS. 8: load the kernel and x01. OS. 8

Source: Internet
Author: User

X01. OS. 8: load the kernel and x01. OS. 8

InX01. OS. 7With the helpFreedos, Learned the protection mode. However, the operating system must complete boot, load the kernel: loader, kernel, and manage process, memory, and file.

Boot is relatively simple. When the boot starts, the CPU uses a hard method to directly load the BIOS into the memory and run it somewhere. This is what you can see when you press the DEL key on your computer. At this time, no hard disk is available, and no memory is available. BIOS is a read-only chip, but I think it still has writable parts. Otherwise, the startup disk settings cannot be saved. When the BIOS exits, it checks whether the last two bytes of the 0 sector of the boot disk are 0xAA55. If yes, load the 512 bytes of the slice into the memory 0x7C00. The subsequent control is handed over to 0x7C00. The so-called Boot Sector, but so. These settings are hard indicators and there is no room for bargaining. When 0x7C00 is entered, although only 512 bytes are entered, this does not prevent construction.FAT12Format File. The method is as follows:

Org 0x7C00

Jmp short l_start

Nop

% Include "fat12.s"

The file "fat12.s" contains the definition of a boot parameter block. To complete the FAT12 formatting of a. img. Copy the loader, kernel, and other files to a. img. There are too few 512 bytes, so you can only find and load the loader. After loading the loader, you can do more, but it is not necessary. You only need to perform some simple settings as a stepping stone and jump into the kernel. Necessary settings, mainly for the kernel memory addressSel:Entry_point. Kernel is in the elf format and can interact with C.

Let's follow the footsteps of Yuanyuan and see how to run C.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Pressing the keyboard causes an interruption. The last line is.

Complete code can be downloaded from x01.Lab. download.

 


How does one load the kernel in linux?

Load the kernel? In linux, grub contains the configuration file menu. lst, which contains the kernel to be loaded when grub is started. Do you mean how to load the kernel after the system is started ?. Ko files are generally hardware drivers, and make files are used for makefile. makefile configures the compilation conditions and related information, and you can use make to execute the configuration in makefile. It is usually used when installing software with source code. The makefile file is generated through configure in the source code package.
 
Linux Kernel Loading Problems

I will not elaborate on how to compile it. It seems that you have generated the. ko file.
In menconfig. I don't know which directory you put the kernel module in.
However, when you add an accesskey, you need to use the "M" key, that is, the '*' in the front must be changed to 'M'

Then save
Put it on the board.

First 1: load the kernel module, insmod./xxx. ko (generated module)
2: apply for the primary and secondary device numbers for the module, mknod/dev/(device name, your own defined) c xxx (master device number) 0
More/proc/devices

3. Finally, test your loaded driver with the test program.

If you don't understand what I said, I can give a detailed example!

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.