Giter Site home page Giter Site logo

ringwraith / cs630-qemu-lab Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zirandu/cs630-qemu-lab

0.0 2.0 0.0 2.13 MB

Qemu Based X86/Linux/AT&T Assembly Development Lab; 本项目作者发布了《360° 剖析 Linux ELF》视频课程,欢迎订阅:https://www.cctalk.com/m/group/88089283

Home Page: http://www.tinylab.org/cs630-qemu-lab/

License: GNU General Public License v2.0

Makefile 1.39% Assembly 73.90% C 4.12% C++ 15.46% HTML 4.86% GDB 0.13% Shell 0.14%

cs630-qemu-lab's Introduction

Subscribe Wechat

CS630 on Qemu in Ubuntu

CS630 Qemu Lab Usage

Contents

Prepare

Please install docker at first:

Notes:

In order to run docker without password, please make sure your user is added in the docker group:

$ sudo usermod -aG docker $USER

In order to speedup docker images downloading, please configure a local docker mirror in /etc/default/docker, for example:

$ grep registry-mirror /etc/default/docker
DOCKER_OPTS="$DOCKER_OPTS --registry-mirror=https://docker.mirrors.ustc.edu.cn"
$ service docker restart

In order to avoid network ip address conflict, please try following changes and restart docker:

$ grep bip /etc/default/docker
DOCKER_OPTS="$DOCKER_OPTS --bip=10.66.0.10/16"
$ service docker restart

If the above changes not work, try something as following:

$ grep dockerd /lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd -H fd:// --bip=10.66.0.10/16 --registry-mirror=https://docker.mirrors.ustc.edu.cn
$ service docker restart

Choose a working directory

If installed via Docker Toolbox, please enter into the /mnt/sda1 directory of the default system on Virtualbox, otherwise, after poweroff, the data will be lost for the default /root directory is only mounted in DRAM.

$ cd /mnt/sda1

For Linux or Mac OSX, please simply choose one directory in ~/Downloads or ~/Documents.

$ cd ~/Documents

Install

Using Ubuntu as example:

$ git clone https://gitee.com/tinylab/cloud-lab.git

$ cd cloud-lab/ && tools/docker/choose cs630-qemu-lab

$ tools/docker/run

Login the noVNC website with the printed password and launch the lab via the desktop shortcut.

Update

A backup of the cs630 exercises has been downloaded in res/, update it with:

$ make update

Usage

Bascially, please type:

$ make help

Compile and Boot

Some examples can be compiled for Real mode, some others need to be compiled for Protected mode.

To boot with curses based graphic (console friendly), please pass 'G=0' to make, exit with 'ESC' + '2' to Qemu monitor console and the 'quit' command, or use 'ALT' + '2' and 'quit'.

$ make boot G=0

By default, src/rtc.s is compiled and boot, Or use SRC to specify one:

$ make boot SRC=src/rtc.s
$ make boot SRC=res/rtcdemo.s

To boot with latest qemu and better performance (may not work with some floppy examples):

$ export QEMU_PREBUILT=0
$ make boot

To get better performance, you'd better enable cpu virtualization in bios to enable kvm:

CTRL+ALT+Delete (Reboot your host) --> Delete --> Bios features --> Intel Virtualization Technology

To debug with it:

$ make debug

$ make debug SRC=src/helloworld.s DST=boot.elf
$ make debug SRC=src/rtc.s DST=boot.elf

Modify .gdbinit to customize your own auto-load gdb scripts.

Notes:

  • Due to linking issue, debug not work with protected mode assembly currently, need to be fixed up later.

  • To debug the real mode example, please replace the 'ljmp $addr $label' instruntion with 'jmp label'

res/memsize.s: ljmp $0x07C0, $main --> jmp main, see git show 86555

Real mode exercise

  • helloworld

      $ make boot SRC=src/helloworld.s
    
  • rtc

      $ make boot SRC=src/rtc.s
    

Protected mode exercise

  • helloworld

      $ make boot SRC=src/pmhello.s
    
  • rtc

      $ make boot SRC=src/pmrtc.s
    

NOTES

In fact, some exercises not about "protected mode" also need to use the 2nd method to compile, for they begin execution with CS:IP = 1000:0002, and need a "bootloader" to load them, or their size are more than 512 bytes, can not be put in the first 512bytes of the disk (MBR).

See more notes from NOTE.md:

$ make note

Contact and Sponsor

** Contact us and Sponsor via wechat **

contact-sponsor

cs630-qemu-lab's People

Contributors

lzufalcon avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.