Orange's notes (1)

Source: Internet
Author: User

Chapter 1

Write a small Bootstrap code:

 1     org    07c00h 2     mov    ax,cs 3     mov    ds,ax 4     mov     es,ax 5     call     DispStr 6     jmp    $ 7 DispStr: 8     mov    ax,BootMessage 9     mov    bp,ax10     mov    cx,1611     mov    ax,01301h12     mov    bx,000ch13     mov    dl,014     int    10h15     ret16 BootMessage:    db    "Hello, OS World!"17 times    510-($-$$)    db    018 dw    0xaa55

Compile with NASM

nasm boot.asm -o boot.bin

Install bochs

Installation environment:

sudo apt-get install build-essential xorg-dev libgtk2.0-dev

 

Download and install the latest version from the official website.

 

./configure --enable-debugger --enable-disasmmakesudo make install

Prompt when making

/Usr/bin/ld: Gui/libgui. A (gtk_enh_dbg_osdep.o): Undefined reference to symbol' [email protected] @ glibc_2.1 '// lib/i386-linux-gnu/libpthread. so.0: error adding symbols: DSO missing from command linecollect2: Error: LD returned 1 exit statusmake: *** [bochs] Error 1

Solution

Add the following content to libs of makefile:

-lz -lrt -lm -lpthread 

Use bximage to generate a virtual floppy disk and write the Boot Sector to the virtual floppy disk:

dd if=boot.bin of=a.img bs=512 conv=notrunc

Configure bochs and then start

################################################################ Configuration file for Bochs################################################################ how much memory the emulated machine will have megs: 32# filename of ROM images romimage: file=/usr/local/share/bochs/BIOS-bochs-latest vgaromimage: file=/usr/local/share/bochs/VGABIOS-lgpl-latest# what disk images will be used floppya: 1_44=a.img, status=inserted# choose the boot disk. boot: floppy# where do we send log messages?# log: bochsout.txt# disable the mouse mouse: enabled=0# enable key mapping, using US layout as default. keyboard_mapping: enabled=1, map=/usr/local/share/bochs/keymaps/sdl-pc-us.map

 

The dump_cpu command is not available in the new bochs.

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.