如何用编译器打开linux0.11,使用docker搭建Linux 0.11 实验环境

使用docker搭建Linux 0.11 实验环境

对于学习linux内核的同学,Linux 0.11源码绝对是首选。但由于现在的硬件架构以及编译器的版本对于搭建Linux 0.11的实验环境会有一定的困难,因此本文目的是基于docker容器搭建一个纯净的Linux 0.11的环境。为你学习linux内核源码提供便利。

希望你的Linux内核学习之路能从这里开始。

获取源码

从github上获取Linux 0.11实验环境。

(base) frank@deepin:~/git$ git clone https://github.com/tinyclub/cloud-lab.git

正克隆到 'cloud-lab'...

remote: Enumerating objects: 332, done.

remote: Counting objects: 100% (332/332), done.

remote: Compressing objects: 100% (219/219), done.

remote: Total 4689 (delta 174), reused 214 (delta 92), pack-reused 4357

接收对象中: 100% (4689/4689), 3.22 MiB | 29.00 KiB/s, 完成.

处理 delta 中: 100% (2998/2998), 完成.

(base) frank@deepin:~/git$ cd cloud-lab/

(base) frank@deepin:~/git/cloud-lab$ ls

base configs COPYING doc images labs README.md TODO.md tools VERSION

(base) frank@deepin:~/git/cloud-lab$ tools/docker/choose linux-0.11-lab

LOG: Current Lab is linux-0.11-lab

LOG: Current Lab is linux-0.11-lab

LOG: Source code downloaded to /home/frank/git/cloud-lab/labs/linux-0.11-lab

操作步骤:

$ git clone https://github.com/tinyclub/cloud-lab.git

$ cd cloud-lab/

$ tools/docker/choose linux-0.11-lab

拉取docker镜像

$ sudo tools/docker/pull

启动环境

$ sudo tools/docker/run

Status: Downloaded newer image for tinylab/cloud-ubuntu-web:latest

LOG: VNC screen recorded in /home/frank/git/cloud-lab/recordings

LOG: VNC pages released in /home/frank/git/cloud-lab/releasings

LOG: VNC tokens stored in /home/frank/git/cloud-lab/.vnc-tokens

WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.

f850bc200aba1b2d5a5b9f1371caf34344883bae7481e7b7818c64588753a352

LOG: Wait for lab launching...

LOG: Container ID: 00a5cb415058 Container Name: linux-0.11-lab-2195

LOG: User: ubuntu ,Password: 93vrdc ,VNC Password: lvr7pz ,Viewonly Password: x7qvpx

LOG: Current Lab is linux-0.11-lab

LOG: Current Lab is linux-0.11-lab

Please login with:

User: 7827c9

Password: lvr7pz (Normal)

Password: x7qvpx (View)

Local URL:

* Normal: http://localhost:6080/?u=7827c9&p=lvr7pz

* View: http://localhost:6080/?r=7827c9x7qvpx

Note: Please ensure network available outside and then replace 'localhost' with the external ip or domain name.

E.g. Virtualbox setting 'Network->Adapter2->Host-only Adapter' adds eth1. 'ifconfig eth1' give us the ip.

Then 'echo $ip > .host_name' or 'echo $domain_name > .host_name'

Note: firefox, safari and edge work, but google chrome web browser is preferable.

ERR: No web browser found, are you running me in cloud? please open the 'Normal' url yourself.

LOG: Current Lab is linux-0.11-lab

Lab: linux-0.11-lab-2195, User: ubuntu

* VNC (Normal): http://localhost:6080/?u=7827c9&p=lvr7pz

* VNC (View): http://localhost:6080/?r=7827c9x7qvpx

* SSH (Web): http://localhost:4433/?ssh=ssh://ubuntu:93vrdc@172.17.0.3:22

LOG: Released to: /home/frank/git/cloud-lab/releasings/index.html

LOG: Labs online: http://localhost:6080/labs/index.html

使用环境

Normal

(Normal): http://localhost:6080/?u=7827c9&p=lvr7pz

在浏览器中输入上面的网址http://localhost:6080/?u=7827c9&p=lvr7pz

运行后会在web里面提供了一个Linux的环境(桌面环境),如图:

d3858fb89d029b3423c28da70358de72.png

ssh

(Web): http://localhost:4433/?ssh=ssh://ubuntu:93vrdc@172.17.0.3:22

在浏览器中输入上面的网址http://localhost:4433/?ssh=ssh://ubuntu:93vrdc@172.17.0.3:22

运行后会提供Ubuntu的终端环境(命令行环境)。

38dde96048e68846cd16304954287f81.png

硬盘启动Linux 0.11

$ make start-hd

95feb9b322f867e112a5dc1c197ac5c3.png

调试

$ make debug-hd

6770032e04be55dc035d04173f3fdf26.png

帮助

:: Compile ::

make --generate a kernel floppy Image with a fs on hda1

make clean -- clean the object files

make distclean -- only keep the source code files

:: Test ::

make start -- start the kernel in vm (qemu/bochs)

make start-fd -- start the kernel with fs in floppy

make start-hd -- start the kernel with fs in hard disk

make start-hd G=0 -- start with curses based terminal, instead of SDL

:: Debug ::

make debug -- debug the kernel in qemu/bochs & gdb at port 1234

make debug-fd -- debug the kernel with fs in floppy

make debug-hd -- debug the kernel with fs in hard disk

make debug DST=boot/bootsect.sym -- debug bootsect

make debug DST=boot/setup.sym -- debug setup

make boot BOCHS=bochs-debugger VM=bochs -- debug with bochs internal debugg

er

make switch -- switch the emulator: qemu and bochs

make boot VM=qemu|bochs -- switch the emulator: qemu and bochs

:: Read ::

make cscope -- genereate the cscope index databases

make tags -- generate the tag file

make cg -- generate callgraph of the default main entry

make cg f=func d=dir|file b=browser -- generate callgraph of func in file/d

irectory

:: More ::

>>> README.md <<<

生成调用关系

$ make cg

7c74c16ff68498f3fc9b05b24dc602e1.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值