Read linux source code and practices

Source: Internet
Author: User
Read the linux source code and practices-general Linux technology-Linux programming and kernel information. The following is a detailed description. Next we will look at a piece of code: this code will be the beginning of an operating system.

BOOTSEG = 0x07c0

Entry start
Start:
Jmpi go, BOOTSEG
Go: mov ax, cs
Mov ds, ax
Mov es, ax
Mov [msg1 + 17], ah
Mov cx, #20
Mov dx, #0x1004
Mov bx, # 0x00c
Mov bp, # msg1
Mov ax, #0x1301
Int 0x10
Loop0: jmp loop0
Msg1:. ascii "Loading system ..."
. Byte 13, 10
Org 1, 510
. Word 0xAA55

Although it is a little short, but do something accomplished first, you will be more interested in learning it.

Compile as follows:

(The operating system I use is ubuntu: I suddenly found that linux is really an operating system designed for programmers, which is really convenient to use .)

As86-0-a-o boot. o boot. s
Ld86-0-a-o boot. o
Dd bs = 32 if = boot of = bootseg skip = 1
Dd if = bootseg of = boot. img bs = 512 count = 2880

We can see that there is a boot. imgfile under the file, and then we will install virtualbox on the system, and then use the Administrator

Sudo virtualbox

Run it, create a system, load the soft drive, and then start the OS.
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.