follow Sam哥 OS 课程的漫长之路

之前本来是要跟知乎上推荐的6.828的,然后死活卡在这里:

Simulating the x86

Instead of developing the operating system on a real, physical personal computer (PC), we use a program that faithfully emulates a complete PC: the code you write for the emulator will boot on a real PC too. Using an emulator simplifies debugging; you can, for example, set break points inside of the emulated x86, which is difficult to do with the silicon version of an x86.
In 6.828 we will use the QEMU Emulator, a modern and relatively fast emulator. While QEMU’s built-in monitor provides only limited debugging support, QEMU can act as a remote debugging target for the GNU debugger (GDB), which we’ll use in this lab to step through the early boot process.
To get started, extract the Lab 1 files into your own directory on Athena as described above in “Software Setup”, then type make (or gmake on BSD systems) in the lab directory to build the minimal 6.828 boot loader and kernel you will start with. (It’s a little generous to call the code we’re running here a “kernel,” but we’ll flesh it out throughout the semester.)
athena% cd lab
athena% make
+ as kern/entry.S
+ cc kern/init.c
+ cc kern/console.c
+ cc kern/monitor.c
+ cc kern/printf.c
+ cc lib/printfmt.c
+ cc lib/readline.c
+ cc lib/string.c
+ ld obj/kern/kernel
+ as boot/boot.S
+ cc -Os boot/main.c
+ ld boot/boot
boot block is 414 bytes (max 510)
+ mk obj/kern/kernel.img

这个make这里我怎么弄都弄不了。于是告吹。

这时候上github玩儿的时候无意中发现Sam哥的课程
https://github.com/SamyPesse/How-to-Make-a-Computer-Operating-System

哇,还是用C++的。随即follow之。

屁颠开始装环境。https://github.com/SamyPesse/How-to-Make-a-Computer-Operating-System/tree/master/Chapter-2

然后(;´д`)ゞ长征就开始了。

装完vagrant和virtualbox一切顺利。
然后是装镜像。

Once Vagrant and Virtualbox are installed, you need to download the ubuntu lucid32 image for Vagrant:

vagrant box add lucid32 http://files.vagrantup.com/lucid32.box

下了大概十次都没完整拖下来,最后开代理终于拖下来完整的249M,在本地安装之,终于成功了。

You can now access your box by using ssh to connect to the virtual box using:

vagrant ssh

之前尝试follow 6.828的时候就装好了Cygwin,所以就在Cygwin里面玩儿了。然后发现没装ssh包(虽然不太懂这什么),又要启动Cygwin安装程序安装 Openssh &openssl
到这一步还是比较顺利的。
连接成功:
这里写图片描述

然后:

Build and test our operating system
The file Makefile defines some basics rules for building the kernel, the user libc and some userland programs.
Build:
make all

快乐的输入之后,我的界面提示:
这里写图片描述

?????

之后尝试了无数次

sudo apt-get update
sudo apt-get install make

都无果。一大堆这样的错误:

Err http://security.ubuntu.com lucid-security/main Packages
404 Not Found [IP: 91.189.88.161 80]
Err http://security.ubuntu.com lucid-security/restricted Packages
404 Not Found [IP: 91.189.88.161 80]
Err http://security.ubuntu.com lucid-security/main Sources
404 Not Found [IP: 91.189.88.161 80]
Err http://security.ubuntu.com lucid-security/restricted Sources
404 Not Found [IP: 91.189.88.161 80]
Err http://security.ubuntu.com lucid-security/universe Packages
404 Not Found [IP: 91.189.88.161 80]
Err http://security.ubuntu.com lucid-security/universe Sources
404 Not Found [IP: 91.189.88.161 80]

我好绝望啊,我只是个技术小白啊,我啥都不懂啊(泪奔

上谷歌一顿狂找,找到potential的解决方案:

How to Fix Ubuntu/Debian apt-get 404 Not Found Repository Errors
https://futurestud.io/tutorials/how-to-fix-ubuntu-debian-apt-get-404-not-found-repository-errors
https://smyl.es/how-to-fix-ubuntudebian-apt-get-404-not-found-package-repository-errors-saucy-raring-quantal-oneiric-natty/

貌似是ubuntu官方的域名迁移问题,好气,然后我用了这个命令:

sudo sed -i -e ‘s/archive.ubuntu.com|security.ubuntu.com/old-releases.ubuntu.com/g’ /etc/apt/sources.list

貌似就是替换。

然后再次运行安装make的命令,结果:

vagrant@lucid32:/vagrant$ sudo apt-get install make
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package make is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package make has no installation candidate

还是不行。再更新:

vagrant@lucid32:/vagrant sudo apt-get update
Get:1 http://us.old-releases.ubuntu.com lucid Release.gpg [698B]
Get:2 http://us.old-releases.ubuntu.com/ubuntu/ lucid/main Translation-en_US [69 8B]
Get:3 http://us.old-releases.ubuntu.com/ubuntu/ lucid/restricted Translation-en_ US [698B]
Get:4 http://us.old-releases.ubuntu.com/ubuntu/ lucid/universe Translation-en_US [698B]
Get:5 http://us.old-releases.ubuntu.com/ubuntu/ lucid/multiverse Translation-en_ US [698B]
Get:6 http://us.old-releases.ubuntu.com lucid-updates Release.gpg [698B]
Get:7 http://us.old-releases.ubuntu.com/ubuntu/ lucid-updates/main Translation-e n_US [698B]
Get:8 http://us.old-releases.ubuntu.com/ubuntu/ lucid-updates/restricted Transla tion-en_US [698B]
Get:9 http://us.old-releases.ubuntu.com/ubuntu/ lucid-updates/universe Translati on-en_US [698B]
Get:10 http://us.old-releases.ubuntu.com/ubuntu/ lucid-updates/multiverse Transl ation-en_US [698B]
99% [2 Translation-en_US bzip2 0B] [Connecting to us.old-releases.ubuntu.com] [b zip2: (stdin) is not a bzip2 file.
Ign http://us.old-releases.ubuntu.com/ubuntu/ lucid/main Translation-en_US
89% [3 Translation-en_US bzip2 0B] [Waiting for headers] [Connecting to old-relb zip2: (stdin) is not a bzip2 file.
Ign http://us.old-releases.ubuntu.com/ubuntu/ lucid/restricted Translation-en_US
79% [4 Translation-en_US bzip2 0B] [Waiting for headers] [Connecting to old-relb zip2: (stdin) is not a bzip2 file.
Ign http://us.old-releases.ubuntu.com/ubuntu/ lucid/universe Translation-en_US
69% [5 Translation-en_US bzip2 0B] [Waiting for headers] [Connecting to old-relb zip2: (stdin) is not a bzip2 file.
Ign http://us.old-releases.ubuntu.com/ubuntu/ lucid/multiverse Translation-en_US
59% [7 Translation-en_US bzip2 0B] [Waiting for headers] [Connecting to old-relb zip2: (stdin) is not a bzip2 file.
Ign http://us.old-releases.ubuntu.com/ubuntu/ lucid-updates/main Translation-en_ US
49% [8 Translation-en_US bzip2 0B] [Waiting for headers] [Connecting to old-relb zip2: (stdin) is not a bzip2 file.
Ign http://us.old-releases.ubuntu.com/ubuntu/ lucid-updates/restricted Translati on-en_US
40% [9 Translation-en_US bzip2 0B] [Waiting for headers] [Connecting to old-relb zip2: (stdin) is not a bzip2 file.
Ign http://us.old-releases.ubuntu.com/ubuntu/ lucid-updates/universe Translation -en_US
30% [10 Translation-en_US bzip2 0B] [Waiting for headers] [Connecting to old-reb zip2: (stdin) is not a bzip2 file.
Ign http://us.old-releases.ubuntu.com/ubuntu/ lucid-updates/multiverse Translati on-en_US
Get:11 http://us.old-releases.ubuntu.com lucid Release [698B]
Get:12 http://us.old-releases.ubuntu.com lucid-updates Release [698B]
Ign http://us.old-releases.ubuntu.com lucid Release
Ign http://us.old-releases.ubuntu.com lucid-updates Release
Get:13 http://us.old-releases.ubuntu.com lucid/main Packages [698B]
38% [13 Packages bzip2 0B] [Connecting to old-releases.ubuntu.com (91.189.88.17b zip2: (stdin) is not a bzip2 file.
Err http://us.old-releases.ubuntu.com lucid/main Packages
Sub-process /bin/bzip2 returned an error code (2)
Get:14 http://us.old-releases.ubuntu.com lucid/restricted Packages [698B]
Get:15 http://us.old-releases.ubuntu.com lucid/main Sources [698B]
Get:16 http://us.old-releases.ubuntu.com lucid/restricted Sources [698B]
Get:17 http://us.old-releases.ubuntu.com lucid/universe Packages [698B]
Get:18 http://us.old-releases.ubuntu.com lucid/universe Sources [698B]
Get:19 http://us.old-releases.ubuntu.com lucid/multiverse Packages [698B]
Get:20 http://us.old-releases.ubuntu.com lucid/multiverse Sources [698B]
Get:21 http://us.old-releases.ubuntu.com lucid-updates/main Packages [698B]
Get:22 http://us.old-releases.ubuntu.com lucid-updates/restricted Packages [698B ]
Get:23 http://us.old-releases.ubuntu.com lucid-updates/main Sources [698B]
65% [14 Packages bzip2 0B] [Connecting to us.old-releases.ubuntu.com] [Waiting b zip2: (stdin) is not a bzip2 file.
Err http://us.old-releases.ubuntu.com lucid/restricted Packages
Sub-process /bin/bzip2 returned an error code (2)
65% [15 Sources bzip2 0B] [Connecting to us.old-releases.ubuntu.com (211.139.17b zip2: (stdin) is not a bzip2 file.
Err http://us.old-releases.ubuntu.com lucid/main Sources
Sub-process /bin/bzip2 returned an error code (2)
65% [16 Sources bzip2 0B] [Waiting for headers] [Waiting for headers]bzip2: (std in) is not a bzip2 file.
Err http://us.old-releases.ubuntu.com lucid/restricted Sources
Sub-process /bin/bzip2 returned an error code (2)
65% [17 Packages bzip2 0B] [Waiting for headers] [Waiting for headers]bzip2: (st din) is not a bzip2 file.
Err http://us.old-releases.ubuntu.com lucid/universe Packages
Sub-process /bin/bzip2 returned an error code (2)
65% [18 Sources bzip2 0B] [Waiting for headers] [Waiting for headers]bzip2: (std in) is not a bzip2 file.
Err http://us.old-releases.ubuntu.com lucid/universe Sources
Sub-process /bin/bzip2 returned an error code (2)
65% [19 Packages bzip2 0B] [Waiting for headers] [Waiting for headers]bzip2: (st din) is not a bzip2 file.
Err http://us.old-releases.ubuntu.com lucid/multiverse Packages
Sub-process /bin/bzip2 returned an error code (2)
65% [20 Sources bzip2 0B] [Waiting for headers] [Waiting for headers]bzip2: (std in) is not a bzip2 file.
Err http://us.old-releases.ubuntu.com lucid/multiverse Sources
Sub-process /bin/bzip2 returned an error code (2)
65% [21 Packages bzip2 0B] [Waiting for headers] [Waiting for headers]bzip2: (st din) is not a bzip2 file.
Err http://us.old-releases.ubuntu.com lucid-updates/main Packages
Sub-process /bin/bzip2 returned an error code (2)
65% [22 Packages bzip2 0B] [Waiting for headers] [Waiting for headers]bzip2: (st din) is not a bzip2 file.
Err http://us.old-releases.ubuntu.com lucid-updates/restricted Packages
Sub-process /bin/bzip2 returned an error code (2)
65% [23 Sources bzip2 0B] [Waiting for headers] [Waiting for headers]bzip2: (std in) is not a bzip2 file.
Err http://us.old-releases.ubuntu.com lucid-updates/main Sources
Sub-process /bin/bzip2 returned an error code (2)
Get:24 http://us.old-releases.ubuntu.com lucid-updates/restricted Sources [698B]
Get:25 http://us.old-releases.ubuntu.com lucid-updates/universe Packages [698B]
Get:26 http://us.old-releases.ubuntu.com lucid-updates/universe Sources [698B]
Get:27 http://us.old-releases.ubuntu.com lucid-updates/multiverse Packages [698B ]
Get:28 http://us.old-releases.ubuntu.com lucid-updates/multiverse Sources [698B]
71% [24 Sources bzip2 0B] [Waiting for headers]bzip2: (stdin) is not a bzip2 fil e.
Err http://us.old-releases.ubuntu.com lucid-updates/restricted Sources
Sub-process /bin/bzip2 returned an error code (2)
71% [25 Packages bzip2 0B] [Waiting for headers]bzip2: (stdin) is not a bzip2 fi le.
Err http://us.old-releases.ubuntu.com lucid-updates/universe Packages
Sub-process /bin/bzip2 returned an error code (2)
71% [26 Sources bzip2 0B] [Waiting for headers]bzip2: (stdin) is not a bzip2 fil e.
Err http://us.old-releases.ubuntu.com lucid-updates/universe Sources
Sub-process /bin/bzip2 returned an error code (2)
71% [27 Packages bzip2 0B] [Waiting for headers]bzip2: (stdin) is not a bzip2 fi le.
Err http://us.old-releases.ubuntu.com lucid-updates/multiverse Packages
Sub-process /bin/bzip2 returned an error code (2)
71% [28 Sources bzip2 0B] [Waiting for headers]bzip2: (stdin) is not a bzip2 fil e.
Err http://us.old-releases.ubuntu.com lucid-updates/multiverse Sources
Sub-process /bin/bzip2 returned an error code (2)
Get:29 http://old-releases.ubuntu.com lucid-security Release.gpg [198B]
Ign http://old-releases.ubuntu.com/ubuntu/ lucid-security/main Translation-en_US
Ign http://old-releases.ubuntu.com/ubuntu/ lucid-security/restricted Translation -en_US
Ign http://old-releases.ubuntu.com/ubuntu/ lucid-security/universe Translation-e n_US
Ign http://old-releases.ubuntu.com/ubuntu/ lucid-security/multiverse Translation -en_US
Get:30 http://old-releases.ubuntu.com lucid-security Release [58.7kB]
Get:31 http://old-releases.ubuntu.com lucid-security/main Packages [631kB]
Get:32 http://old-releases.ubuntu.com lucid-security/restricted Packages [2,881B ]
Get:33 http://old-releases.ubuntu.com lucid-security/main Sources [249kB]
Get:34 http://old-releases.ubuntu.com lucid-security/restricted Sources [1,281B]
Get:35 http://old-releases.ubuntu.com lucid-security/universe Packages [142kB]
Get:36 http://old-releases.ubuntu.com lucid-security/universe Sources [46.7kB]
Get:37 http://old-releases.ubuntu.com lucid-security/multiverse Packages [5,382B ]
Get:38 http://old-releases.ubuntu.com lucid-security/multiverse Sources [2,361B]
Fetched 1,159kB in 11s (102kB/s)
W: GPG error: http://us.old-releases.ubuntu.com lucid Release: The following sig natures were invalid: NODATA 1 NODATA 2
W: GPG error: http://us.old-releases.ubuntu.com lucid-updates Release: The follo wing signatures were invalid: NODATA 1 NODATA 2
W: Failed to fetch http://us.old-releases.ubuntu.com/ubuntu/dists/lucid/main/bin ary-i386/Packages.bz2 Sub-process /bin/bzip2 returned an error code (2)
W: Failed to fetch http://us.old-releases.ubuntu.com/ubuntu/dists/lucid/restrict ed/binary-i386/Packages.bz2 Sub-process /bin/bzip2 returned an error code (2)

W: Failed to fetch http://us.old-releases.ubuntu.com/ubuntu/dists/lucid/main/sou rce/Sources.bz2 Sub-process /bin/bzip2 returned an error code (2)
W: Failed to fetch http://us.old-releases.ubuntu.com/ubuntu/dists/lucid/restrict ed/source/Sources.bz2 Sub-process /bin/bzip2 returned an error code (2)
W: Failed to fetch http://us.old-releases.ubuntu.com/ubuntu/dists/lucid/universe /binary-i386/Packages.bz2 Sub-process /bin/bzip2 returned an error code (2)
W: Failed to fetch http://us.old-releases.ubuntu.com/ubuntu/dists/lucid/universe /source/Sources.bz2 Sub-process /bin/bzip2 returned an error code (2)
W: Failed to fetch http://us.old-releases.ubuntu.com/ubuntu/dists/lucid/multiver se/binary-i386/Packages.bz2 Sub-process /bin/bzip2 returned an error code (2)
W: Failed to fetch http://us.old-releases.ubuntu.com/ubuntu/dists/lucid/multiver se/source/Sources.bz2 Sub-process /bin/bzip2 returned an error code (2)
W: Failed to fetch http://us.old-releases.ubuntu.com/ubuntu/dists/lucid-updates/ main/binary-i386/Packages.bz2 Sub-process /bin/bzip2 returned an error code (2)
W: Failed to fetch http://us.old-releases.ubuntu.com/ubuntu/dists/lucid-updates/ restricted/binary-i386/Packages.bz2 Sub-process /bin/bzip2 returned an error co de (2)
W: Failed to fetch http://us.old-releases.ubuntu.com/ubuntu/dists/lucid-updates/ main/source/Sources.bz2 Sub-process /bin/bzip2 returned an error code (2)
W: Failed to fetch http://us.old-releases.ubuntu.com/ubuntu/dists/lucid-updates/ restricted/source/Sources.bz2 Sub-process /bin/bzip2 returned an error code (2)
W: Failed to fetch http://us.old-releases.ubuntu.com/ubuntu/dists/lucid-updates/ universe/binary-i386/Packages.bz2 Sub-process /bin/bzip2 returned an error code (2)
W: Failed to fetch http://us.old-releases.ubuntu.com/ubuntu/dists/lucid-updates/ universe/source/Sources.bz2 Sub-process /bin/bzip2 returned an error code (2)
W: Failed to fetch http://us.old-releases.ubuntu.com/ubuntu/dists/lucid-updates/ multiverse/binary-i386/Packages.bz2 Sub-process /bin/bzip2 returned an error co de (2)
W: Failed to fetch http://us.old-releases.ubuntu.com/ubuntu/dists/lucid-updates/ multiverse/source/Sources.bz2 Sub-process /bin/bzip2 returned an error code (2)
E: Some index files failed to download, they have been ignored, or old ones used instead.

还是一大堆的Failed。可能这样暴力替换域名还是有问题,但是我怎么才知道哪儿有问题啊……

好吧,而且也不知道怎么把那个文件恢复。

找了找,按这个网页:http://unix.stackexchange.com/questions/140119/every-package-has-no-installation-candidate
说的,用编辑器在source.list后面加上几行。

If that’s really the whole of your /etc/apt/sources.list file, that explains your current situation. And I’ve got no explanation for why you have a Hardy repo installed. I suspect you’ve followed an old tutorial and it has broken things.

Your first step is getting your repos back on track. I would suggest using a tool like RepoGen to get the basics in but failing that, here are the most essential:

deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse

Stick those in the right place with sudoedit /etc/apt/sources.list (you might as well ditch those lines about hardy). When that’s saved, run sudo apt-get update and then you should be able to install things again.

再来一遍

vagrant@lucid32:/vagrant$ sudo apt-get install make
Building dependency tree
Reading state information… Done
Package make is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package make has no installation candidate

信不信我死给你看啊!!!(白眼

-

痛定思痛,决定下载另一个ubuntu试试。
Ubuntu precise 32 VirtualBox http://files.vagrantup.com/precise32.box

明天再来装一次。于是Sam哥这个课程依然是卡在了qemu之前……
等安装的间隙都看了csapp第一章了(白眼

2017/03/08

-
Note

$ find /etc/apt/ -path *.list
查看source.list

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值