Web Analytics

GCC警告选项例解

程序员是追求完美的一族,即使是一般的程序员大多也都不想看到自己的程序中有甚至那么一点点的瑕疵。遇到任意一条编译器警告都坚决不放过。有人会说:我们可以使用比编译器更加严格的静态代码检查工具,如splint。这个建议也很不错。不过lint工具使用起来较繁琐,有时候还需要记住一些特定符号并插入到你自己的代码中才行,门槛较高,这也让很多人止步于此。那么我们就从此放弃么?不,如今的编译器做得都很好,它可以帮助我们的找到绝大多数可能出现问题的代码,前提是你要学会控制编译器去找到这些问题代码,而熟悉编译器的警告选项恰恰是体现控制力的好方法。当你可以自如控制编译器警告输出的时候,你就算是’入道’了,同时你对语言的理解也更进一步了。 ...

March 14, 2006 · 10 min · Tony Bai

Kernel 'head.S'

After being decompressed, the kernel image starts with another ‘startup_32′ function included in $(linux-2.6.15.3_dir/arch/i386/kernel/head.S’. This ‘head.S’ is the second one in linux source package, which is also called ‘kernel head’. And it is exactly what we want to describe in this artical. ...

March 2, 2006 · 3 min · Tony Bai

Compressed 'head.S'

_Why do we do this? Don’t ask me.. Incomprehensible are the ways of bootloaders. _ — comments in arch/i386/boot/compressed/misc.c There are two ‘head.S’ in linux source package. One is in $(Linux-2.6.15.3_dir/arch/i386/boot/compressed and the other one is in $(Linux-2.6.15.3_dir/arch/i386/kernel. The first one will be analyzed in this artical. Before we go ahead, let’s show a news of linux, that is ‘Army leans toward Linux for FCS(Future Combat System)’. ...

February 25, 2006 · 3 min · Tony Bai

Transfer to '32-bit'

The phase we talked about before is in ‘Real-address Mode’, which runs 16-bit program modules. At the tail of “Begin ‘setup.S’”, we had moved to ‘Protected Mode’, which usu runs 32-bit program modules. So there are two big problems which are ‘How to transfer control between 16-bit code and 32-bit code’ and how to transfer control from ‘real-mode’ to protected mode’. They are also what we wanna talk about in this artical. ...

February 17, 2006 · 5 min · Tony Bai

Outline 'memory layout'

So far we have arrived at the gate leading to the real kernel. And we’d better stop for a short break in order that we would have more energy to go ahead. Now let’s examine what we do to memory these days. Virtually what we want to do is drawing some pictures to describe the layout of the memory in various phases. For the layout is related to the bootloader, we’d better make our work based on the following assumption: The machine has two systems installed (Windows XP and Linux) and uses LILO as the bootloader. Let us look at the LILO configuration: ...

February 15, 2006 · 3 min · Tony Bai

Begin 'setup.S'

It is time for ‘setup.S’ to show its power. The ‘setup.S’ is loaded by the bootloader and virtually it belongs to neither the ‘bootstrap’ routine nor the kernel program, although it is a portion of the kernel image. The source of the ‘setup.S’ is kinda ‘big’ and what it does can be summarized into one word: “the ‘setup.S’ is responsible to establish the environment for the execution of the kernel program”. ...

February 13, 2006 · 5 min · Tony Bai

Goto 'Bootstrap'

The term ‘Bootstrap’, which originally refers to a person who tries to stand up by pulling his own boots, refers to a subroutine used to establish the full routine(its own left part, i think) or another routine in computer science. Today modern computers act as a vital role in our daily life and many of you may wonder what happens to the computer when you have it powered on. The ‘Bootstrap’, which is also called ‘boot’ for short, is the first step to be done by the computer. The process of ‘Bootstrap’, which starts on when the computer is powered on and usu ends off when the kernel of the operating system begins to run, is just what we are gonna describe. ...

February 11, 2006 · 4 min · Tony Bai

Inside the 'i386'

The term ‘i386′ in the title does not refer to the real Intel 80386 processor but the representative of Intel 32-bit architecture(IA32). I prefer ‘i386′ rather than ‘IA32′ just like what the linux kernel does, since you can find ‘i386′ folder in $(linux-2.6.x_dir)/arch directory. This artical describes some basic knowledge of ‘i386′, which may be kinda useful to those guys who wanna do research on or develop operating system. ...

February 9, 2006 · 4 min · Tony Bai

Retired 'bootsect.S'

We know that the latest linux kernel version is 2.6.x, which is different from the ‘old kernels’ in booting. The ‘bootsect.S’, which used to make the kernel image in the floppy disk bootable in the early days, becomes useless in linux kernel 2.6.x today, although it is still a part of the kernel image. ...

February 8, 2006 · 3 min · Tony Bai

收到Ubuntu光盘

一个月以前在Ubuntu上订购了Ubuntu Linux 5.10发行版,今天终于拿到手了^_^。 在Linux发行版世界,大家最熟悉的几种发行版包括RedHat(或其开源版Fedora)、Debian、SuSE等,提到Ubuntu这个奇怪的名字大家都会感到陌生,在一个多月前我也不例外。Ubuntu是一个基于Debian的Linux操作系统发行版,它完全免费,这次我收到的Ubuntu光盘就是在其官方网站上免费订购的。一次偶然的机会在’Ubuntu中文论坛‘得知Linux世界还有Ubuntu这个发行版的存在,并且可以免费寄送光盘介质,当时的我非常希望手中能有张Linux正式发行版光盘,曾经考虑过Fedora,但是由于缺少刻录条件放弃了。Ubuntu恰好让我的愿望得到满足。当时还有一个担心就是Ubuntu不是主流发行版,是否影响自己在Linux上的体验呢?我Google了一下,发现自己大可不必为此担忧,Ubuntu在Linux社区中的口碑还是很好的,而且还获得了’Linux Journal‘杂志评选出的’2005最佳Linux发行版’奖。 ...

January 23, 2006 · 2 min · Tony Bai