From 3d394d391344e7f70e99e747fbece94a24ee5da5 Mon Sep 17 00:00:00 2001 From: os_lab_user Date: Wed, 11 Feb 2015 03:18:12 +0800 Subject: [PATCH] update lab1_ans and README, README-chinese --- .gitignore | 2 ++ README | 27 ++++++++++++-------- README-chinese.md | 42 +++++++++++++++++++++++-------- labcodes_answer/lab1_result/Makefile | 4 +-- labcodes_answer/lab1_result/tools/gdbinit | 2 -- 5 files changed, 52 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index 4ccad4e..8af701a 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ tags *swp .cproject .project +*.bak +*.org diff --git a/README b/README index 2fe398c..ed33b4b 100644 --- a/README +++ b/README @@ -23,7 +23,8 @@ CONTENTS os course info ---------------- -[os course summary materials](https://github.com/chyyuu/mooc_os) +* [newest os course summary materials](https://github.com/chyyuu/mooc_os) +* [newest chinese README for ucore_lab](https://github.com/chyyuu/ucore_lab/README-chinese.md) labs info ---------------- @@ -45,17 +46,17 @@ VirtualBox soft (https://www.virtualbox.org/) and a virtual disk image with all You can download this virtual disk image -- oslabs_for_student_2012.zip (576.2MB,) from http://pan.baidu.com/share/link?shareid=69868&uk=2585194235, which is an VirtualBox disk image (contains ubuntu 12.04 and needed softs, and is zipped with zip and xz format), and can be unzipped by haozip software (http://www.haozip.com). -After unzip oslabs_for_student_2012.zip, you will get +After unzip oslabs_for_student_XXX.zip, you will get --- -C:\vms\ubuntu-12.04.vbox.xz -C:\vms\ubuntu-12.04.vmdk.vmdk.xz -C:\vms\ubuntu-12.04.vmdk-flat.vmdk.xz +C:\vms\ubuntu-14.04.vbox.xz +C:\vms\ubuntu-14.04.vmdk.vmdk.xz +C:\vms\ubuntu-14.04.vmdk-flat.vmdk.xz --- then you will continue unzip all these files, and get --- -C:\vms\ubuntu-12.04.vbox -C:\vms\ubuntu-12.04.vmdk.vmdk -C:\vms\ubuntu-12.04.vmdk-flat.vmdk +C:\vms\ubuntu-14.04.vbox +C:\vms\ubuntu-14.04.vmdk.vmdk +C:\vms\ubuntu-14.04.vmdk-flat.vmdk --- If you installed VirtualBox soft, then the last step is: double clik file "ubuntu-12.04.vbox" and run ubuntu 12.04 in VirtualBox. In ubuntu 12.04 login Interface: @@ -72,11 +73,11 @@ FEDORA 20: GCC-4.8.2 EXERCISE STEPS ============== 0 Get the newest os lab src codes/docs.(Insure you can connect to github in ubuntu running on VrtualBox) -0.1 If you try to get all codes/docs +0.1 If you try to get all codes $rm -rf ucore_lab $git clone git://github.com/chyyuu/ucore_lab.git $cd ucore_lab -0.2 If you gloned ucore_lab and only try to get the updated codes/docs +0.2 If you gloned ucore_lab and only try to get the updated codes $cd ucore_lab $git pull 1 $cd labX @@ -88,7 +89,11 @@ EXERCISE STEPS $make qemu OR $make grade -6 handin your code + +6 debug your code + $make debug + +7 handin your code $make handin OPTION diff --git a/README-chinese.md b/README-chinese.md index 71df1d1..05a40d9 100644 --- a/README-chinese.md +++ b/README-chinese.md @@ -96,7 +96,7 @@ ucore OS实验了。 ``` $ sudo apt-get update $ sudo apt-get upgrade - $ sudo apt-get install build-essential git qemu-system-x86 vim-gnome gdb make diffutils exuberant-ctags tmux openssh-server cscope meld + $ sudo apt-get install build-essential git qemu-system-x86 vim-gnome gdb cgdb eclipse-cdt make diffutils exuberant-ctags tmux openssh-server cscope meld ``` [NOTICE] 最小需要的安装包: build-essential git qemu-system-x86 gdb make diffutils @@ -112,21 +112,43 @@ ucore OS实验了。 ``` 2. 学习源码 ``` - $cd labX #X为 1--8 + $cd labX #X为 1--8 ``` -3. 阅读,修改源码,可以用understand软件或vim软件 +3. 阅读,修改源码,可以用eclipse-cdt, understand, gedit或vim软件 ``` + $eclipse +OR $understand ``` 4. 修改完毕后,编译实验代码 ``` $make -``` +``` 5. 如果编译无误,则可以运行测试一下 ``` $make qemu ``` -6. 可以运行如下命令,看看自己的得分 + +6. 如果需要调试, + a. 可基于cgdb的字符方式(以lab1_ans为例) +``` + $cd labcodes_answer/lab1_ans + $make debug +``` +可以看到弹出两个窗口,一个是qemu,一个是cgdb +可以看到在bootloader的bootmain函数处停了下来。 +然后我们就可以进一步在cgdb中用gdb的命令进行调试了 +``` + (gdb)file bin/kernel #加载ucore kernel的符号信息 + (gdb)break kern_init #在函数kern_init处(即 0x100000地址处)设置断点 + (gdb)continue #继续执行 +``` +这时就可以看到在kern_init处停了下来,可进一步调试。 + + b. 基于eclipse-CDT的debug view进行调试,如果安装了zylin debug插件,则完成初步配置后, + 也可很方便地进行调试。 + +7. 可以运行如下命令,看看自己的得分 $make grade # 相关资料 @@ -134,14 +156,14 @@ ucore OS实验了。 ## 希望了解OS基本概念和原理的同学 - . [OS课程资料]( http://pan.baidu.com/s/1bncWxyv) - . [OS MOOC公开课(原理部分)](http://www.topu.com/mooc/4100) + . [OS课程资料]( http://pan.baidu.com/s/1bncWxyv) + . [OS MOOC公开课(原理部分)](http://www.topu.com/mooc/4100) ## 希望了解OS设计与实现细节的同学 - . [OS实验资料](http://pan.baidu.com/s/1i3vbdXV) - . [OS实验代码](https://github.com/chyyuu/mooc_os_lab) - . [OS MOOC公开课(实验部分)](http://www.topu.com/mooc/4100) + . [OS实验资料](http://hejq.me/ucore_docs/) + . [OS实验代码](https://github.com/chyyuu/ucore_lab) + . [OS MOOC公开课(实验部分)](http://www.topu.com/mooc/4100) ## 希望自己动手实践OS的同学 diff --git a/labcodes_answer/lab1_result/Makefile b/labcodes_answer/lab1_result/Makefile index e770c79..360819e 100644 --- a/labcodes_answer/lab1_result/Makefile +++ b/labcodes_answer/lab1_result/Makefile @@ -216,11 +216,11 @@ qemu-nox: $(UCOREIMG) $(V)$(QEMU) -serial mon:stdio -hda $< -nographic TERMINAL :=gnome-terminal gdb: $(UCOREIMG) - $(V)$(QEMU) -S -s -parallel stdio -hda $< -serial null & + $(V)$(QEMU) -S -s -parallel stdio -hda $< -serial null debug: $(UCOREIMG) $(V)$(QEMU) -S -s -parallel stdio -hda $< -serial null & $(V)sleep 2 - $(V)$(TERMINAL) --full-screen -e "gdb -tui -q -x tools/gdbinit" + $(V)$(TERMINAL) -e "cgdb -q -x tools/gdbinit" debug-nox: $(UCOREIMG) $(V)$(QEMU) -S -s -serial mon:stdio -hda $< -nographic & diff --git a/labcodes_answer/lab1_result/tools/gdbinit b/labcodes_answer/lab1_result/tools/gdbinit index bbeb8aa..ecbbb7b 100644 --- a/labcodes_answer/lab1_result/tools/gdbinit +++ b/labcodes_answer/lab1_result/tools/gdbinit @@ -1,6 +1,4 @@ -file bin/kernel file obj/bootblock.o target remote :1234 break bootmain -break kern_init continue