感受200万行源程序
昨天有朋友提起reactos,问我怎么样调试它,幸好我还能记得起,也许是因为我对它的理解得太深了,到现在还没有忘记。在2004年那时,正跟着他们忙着去学习操作系统,并且找一个操作系统可以编译它,运行它,修改它。总之,那帮OS的朋友,总是梦想可以写自己的OS。他们也开发一个cnix出来了,还有显示中文的。而我又沉醉在OS里,后来发现reactos,而它的目的就是想让windows的程序可以运行在它上面,也就是说任何的windows程序,只要安装在它那里,就可以运行。这种操作系统,肯定是比linux更具有杀伤力。如果真有一天,可以完全跑起来的话,真是太成功的OS了。
开发现代的OS是一件很费力的事情,一般都有过百万行源程序,要想实现它,往往是耗费很多人力和物力。看一看reactos的源程序压缩包大小,就有 28M 这么大。源程序行数超过200万行,这么样的巨型软件,肯定是很复杂的。我在 2.5G 的赛扬机器里,编译它就需要30分钟,编译后总目录大小就占了 2G 的空间。
这么多的源程序,要想搞懂它,肯定要费很多时间和精力的。其实,也不需要全部看完它,就可以对它编程的。就看你对那部份感兴趣,就对它去了解它,然后修改和添加功能。 如果你也想编译它,就需要到http://www.reactos.org/ 网站上下载reactos 0.3.0 -RC1-src.zip源程序,然后再下载编译器ReactOS Build Environment 0.1-3.4.2.exe。把源程序解压C盘,然后安装编译器,就可以编译了。不像以前,没有做好的安装程序,需要解压和安装数个tar包才能编译它,现在这种方式太方便了,也降低参与人员的要求。如果解压和安装都很顺利,就可以在cmd.exe窗口里,进入源程序的顶层目录C:/reactos/SRC/0.3.0,然后运行mingw32-make.exe bootcd,就开始编译这个OS了。过30分钟后,希望你可以看到这个成功的信息。
[CDMAKE] bootcd
1: file output-i386/cd/autorun.inf
1: file output-i386/cd/icon.ico
1: file output-i386/cd/readme.txt
2: directory output-i386/cd/loader/
2: file output-i386/cd/loader/dosmbr.bin
2: file output-i386/cd/loader/ext2.bin
2: file output-i386/cd/loader/fat.bin
2: file output-i386/cd/loader/fat32.bin
2: file output-i386/cd/loader/freeldr.sys
2: file output-i386/cd/loader/isoboot.bin
2: file output-i386/cd/loader/setupldr.sys
2: directory output-i386/cd/reactos/
2: file output-i386/cd/reactos/atapi.sys
2: file output-i386/cd/reactos/blue.sys
2: file output-i386/cd/reactos/buslogic.sys
2: file output-i386/cd/reactos/cdfs.sys
2: file output-i386/cd/reactos/cdrom.sys
2: file output-i386/cd/reactos/class2.sys
2: file output-i386/cd/reactos/c_1252.nls
2: file output-i386/cd/reactos/c_437.nls
2: file output-i386/cd/reactos/disk.sys
2: file output-i386/cd/reactos/diskdump.sys
2: file output-i386/cd/reactos/floppy.sys
2: file output-i386/cd/reactos/green.sys
2: file output-i386/cd/reactos/hal.dll
2: file output-i386/cd/reactos/halmp.dll
2: file output-i386/cd/reactos/hivecls.inf
2: file output-i386/cd/reactos/hivedef.inf
2: file output-i386/cd/reactos/hivesft.inf
2: file output-i386/cd/reactos/hivesys.inf
2: file output-i386/cd/reactos/i8042prt.sys
2: file output-i386/cd/reactos/kbdclass.sys
2: file output-i386/cd/reactos/KDBinit
2: file output-i386/cd/reactos/l_intl.nls
2: file output-i386/cd/reactos/ntfs.sys
2: file output-i386/cd/reactos/ntoskrnl.exe
2: file output-i386/cd/reactos/reactos.cab
2: file output-i386/cd/reactos/reactos.exe
2: file output-i386/cd/reactos/scsiport.sys
2: file output-i386/cd/reactos/services
2: file output-i386/cd/reactos/txtsetup.sif
2: file output-i386/cd/reactos/vfatfs.sys
2: file output-i386/cd/reactos/welcome.exe
3: directory output-i386/cd/reactos/system32/
3: file output-i386/cd/reactos/system32/ntdll.dll
3: file output-i386/cd/reactos/system32/smss.exe
18,681,244 bytes in 43 files
21,092 unused bytes at ends of files
8,192 bytes in 4 directories
47,104 other bytes
-------------
18,757,632 total bytes
=============
Writing output-i386/cd/autorun.inf
Writing output-i386/cd/icon.ico
Writing output-i386/cd/readme.txt
Writing output-i386/cd/loader/dosmbr.bin
Writing output-i386/cd/loader/ext2.bin
Writing output-i386/cd/loader/fat.bin
Writing output-i386/cd/loader/fat32.bin
Writing output-i386/cd/loader/freeldr.sys
Writing output-i386/cd/loader/isoboot.bin
Writing output-i386/cd/loader/setupldr.sys
Writing output-i386/cd/reactos/atapi.sys
Writing output-i386/cd/reactos/blue.sys
Writing output-i386/cd/reactos/buslogic.sys
Writing output-i386/cd/reactos/cdfs.sys
Writing output-i386/cd/reactos/cdrom.sys
Writing output-i386/cd/reactos/class2.sys
Writing output-i386/cd/reactos/c_1252.nls
Writing output-i386/cd/reactos/c_437.nls
Writing output-i386/cd/reactos/disk.sys
Writing output-i386/cd/reactos/diskdump.sys
Writing output-i386/cd/reactos/floppy.sys
Writing output-i386/cd/reactos/green.sys
Writing output-i386/cd/reactos/hal.dll
Writing output-i386/cd/reactos/halmp.dll
Writing output-i386/cd/reactos/hivecls.inf
Writing output-i386/cd/reactos/hivedef.inf
Writing output-i386/cd/reactos/hivesft.inf
Writing output-i386/cd/reactos/hivesys.inf
Writing output-i386/cd/reactos/i8042prt.sys
Writing output-i386/cd/reactos/kbdclass.sys
Writing output-i386/cd/reactos/KDBinit
Writing output-i386/cd/reactos/l_intl.nls
Writing output-i386/cd/reactos/ntfs.sys
Writing output-i386/cd/reactos/ntoskrnl.exe
Writing output-i386/cd/reactos/reactos.cab
Writing output-i386/cd/reactos/reactos.exe
Writing output-i386/cd/reactos/scsiport.sys
Writing output-i386/cd/reactos/services
Writing output-i386/cd/reactos/txtsetup.sif
Writing output-i386/cd/reactos/vfatfs.sys
Writing output-i386/cd/reactos/welcome.exe
Writing output-i386/cd/reactos/system32/ntdll.dll
Writing output-i386/cd/reactos/system32/smss.exe
CD-ROM image made successfully