免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 888 | 回复: 0
打印 上一主题 下一主题

增加系统调用 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-11-06 17:44 |只看该作者 |倒序浏览

本文原作者为:西南交大信息07届研究生陈曦

一 修改系统文件
1.在系统调用表中添加相应表项
# cd /usr/src/linux-2.4/arch/i386/kernel
# vi entry.S
添加.long SYMBOL_NAME(sys_pedagogictime)
见图1:

  
2. 添加系统调用号
# cd /usr/src/linux-2.4/include/asm
# vi unistd.h
添加# define  __NR_pedagogictime   259
见图2:

3. 在文件最后添加一个系统服务例程
# cd /usr/src/linux-2.4/kernel
# vi sys.c
添加sys_pedagogictime
见图三

二. 编译内核
# cd /usr/src/linux-2.4
# make mrproper
# make xconfig
Block devices à Loopback device support 选Y
SCSI support -> SCSI low-level drivers à BusLogic SCSI support 选Y
File systems -> Ext3 journallingfile system support 选Y
                NTFS file system support 选 Y
Save and exit

# make dep
# make clean
# make bzImage
# make modules
# make modules_install
从/etc/modules.conf中删除BusLogic的加载项#alias scsi_hostadapter BusLogic
/* 否则make install时总报错:No module BusLogic found for kernel 2.4.22 */
# cd /usr/src/linux-2.4
# make install

三 将新内核和System.map拷贝到/boot目录下
# cp  /usr/src/linux-2.4/arch/i386/boot/bzImage  /boot/vmlinux-2.4.20
# cp  /usr/src/linux-2.4/ System.map  /boot/System.map-2.4.20
# cd  /boot
# rm –f System.map
# ln –s System.map-2.4.20 System.map

四 修改Grub启动管理器
# cd /boot/grub
# vi menu.lst
修改menu.lst文件,将Red Hat Linux (2.4.20-8custom)部分中的
root=LABEL=/改为root=/dev/sda2
修改前见图四

修改后见图五

五 重启系统:
# reboot
重启后显示如图六:

选择Red Hat Linux (2.4.20-8custom),回车


六 编辑用户空间的测试程序:
.


运行结果:



本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/81997/showart_1384926.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP