博文

目前显示的是 四月, 2010的博文

制作initrd

图片
首先,制作Initrd,需要了解,inidrd是什么,它由什么构成的。 然后,我们会发现,在嵌入式的Initrd中 busybox是一个非常常用的工具,可是,到底busybox在制作initrd中扮演什么样的角色呢? 其实,initrd只是引入了一些应用程序而已,只是,这些应用程序做的很好,体积很小。当然,因为它是缩水版的,于是,一些功能就没有啦,比如 ls -al ,就只相当于ls. 因此,不要指望busybox能够做所有的事情。 我们还需要做一些必要的目录,比如 etc lib 等。 下面是我做Initrd的一些步骤。其中,参考了cublog上的一篇日志。 http://blog.chinaunix.net/u2/70445/showart_1163143.html 转载,请注明。 首先下载busybox1.9.1版本,然后解压缩,相信大家都会。然后step by step 1、更改busybox1.9.1的Makefile ARCH ?=arm CROSS_COMPILE?= 自己的交叉编译环境的位置我的是:/opt/crosstool/gcc-4.1.0-glibc-2.3.2/arm-linux/bin/arm-linux- 2、make menuconfig Busybox Setting-----> build option--> [ ] Build BusyBox as a static binary (no shared libs) Build shared libbusybox Produce a binary for each applet, linked against libbusybox Produce additional busybox binary linked against libbusybox [ ] Build with Large File Support (for accessing files > 2 GB) installation option-->

Why cann’t we remove the ZONE_DMA from Linux

ZONE_DMA设置的原因是因为,当年主板上的ISA总线中的DMA控制器只能寻址24位物理地址,因此最多能够寻址到16MB的地方。现在,随着硬件的发展,ISA早已经成为历史。可是,为什么现在还要保留着ZONE_DMA区呢? 这是在linux-kernel mail list上的答案: http://lkml.org/lkml/2010/4/4/2 While ISA is gone as a true peripheral interconnect for new systems it does, actually, still live on in a lot of systems that Linux still supports. While those systems, generally, are running the same kernel and userspace they were a decade ago I have no doubt that somebody might find an old machine and put Linux on it - just because they could. And that also discounts the non-IBM PC machines that are out there that Linux also supports. While I don't know enough about them to say for sure, I am quite certain that at least some of them are still using the ISA bus. DRH > Thanks for your reply.And do you means that , If I use a modern PC,such as > my pc (CPU:Intel dual-core 2.6GHZ; Memory 2GB; And no pci ).I can remove > the ZONE_DMA .And make sure this system also run smoothly as before? *MAYBE* - if yo

CPU Rings, Privilege, and Protection

很不错的文章:http://blog.csdn.net/drshenlei/archive/2009/06/12/4265101.aspx 英文的博客出处:http://duartes.org/gustavo/blog/ 讲述了CPU与操作系统共同构筑保护模式的原理。

欣赏linux中的二级指针

__get_vm_area_node()中新线性区插入vmlist,代码片段 197 for (p = c&vmlist; (tmp = *p) != NULL ;p = &tmp->next) { 198 if ((unsigned long)tmp->addr < addr) { 199 if((unsigned long)tmp->addr + tmp->size >= addr) 200 addr = ALIGN(tmp->size + 201 (unsigned long)tmp->addr, align);//落在区的中间了,那么移到区的下边界 202 continue; 203 } 204 if ((size + addr) < addr)//超出了 205 goto out; 206 if (size + addr <= (unsigned long)tmp->addr)//这里找到了未用的区间 207 goto found; 208 addr = ALIGN(tmp->size + (unsigned long)tmp->addr, align);//否则,addr指向区间的下边界 209 if (addr > end - size)//end=VMALLOC_END 210 goto out; 211 } 212 213 found: 214 area->next = *p;//area->next=*p 215 *p = area; 216 217 area->flags = flags; 218 area->addr = (void *)addr; 219 area->size = size; 220 area->pages = NULL; 221 area->nr_pages = 0;//还没有映射,所以... 222 area->phys_addr = 0;//还没有映射,所以... 223 write_unlock(&vmlist_lock); 这里,理解area插入的关键是理解: 问题的关键是 p = &tmp->next, *p =area; p实际上存放的是tmp

Can we remove the Zone_DMA?

I'm a newbie on the linux kernel. Now I study the source code of Linux .I have a question in the following about ZONE_DMA。   In Linux, The Memory is divided to three zone. They are Zone_DMA 、Zone_NORMAL and Zone_HIGHMEM。The ZONE_DMA has the effect that the Direct Memory Access (DMA) processors for old ISA buses have a strong limitation: they are able to address only the first 16 MB of RAM. SO ,we must set a zone for the DMA on ISA bus。 And I suspect that the hardware has developed so quickly .And in this days the ISA has been weeded out。And so ,if we not defined the ZONE_DMA, is the system be effected? And why not remove ZONE_DMA from the kernel . If it cann't to do so,the compatibility is the only reason? Talk about it : http://lkml.org/lkml/2010/4/4/2