《嵌入式操作系统》,了解Linux内核在ARM设备上移植的一些基本步骤及常识。学习Linux内核裁剪定制的基本配置方法,利用UP-Magic210型设备配套Linux内核进行自定义功能(如helloworld显示)的添加,并重新编译内核源码,生成内核压缩文件zImage,下载到UP-Magic210型设备中测试。:/UP-Magic210/SRC/kernel/linux-:在宿主机端为UP-(内核),添加对测试驱动程序的支持。(1)、:#include<linux/>#include<linux/>MODULE_LICENSE("DualBSD/GPL");//驱动程序入口函数staticinthello_init(void){printk(KERN_ALERT"##############Hello,world############\n");return0;}//驱动程序出口函数staticvoidhello_exit(void){printk(KERN_ALERT"###############Goodbye,world#########\n");}module_init(hello_init);module_exit(hello_exit);有关驱动程序的编写规范,请参考课程教材,本实验只在编写简单的驱动(内核)程序并加入到Linux内核目录树中,使用户熟悉编译内核的过程。该驱动程序是向终端输出相关程序信息。。[******@localhost/]#-Magic210/SRC/kernel/linux-/(2)、进入实验内核源码目录修改driver/char/目录下的Kconfig文件,按照Kconfig语法添加helloworld程序的菜单支持[******@localhost/]#cdUP-Magic210/SRC/kernel/linux-/[******@localhostlinux-]#vidrivers/char/Kconfig例如:在Kconfig文件中的source“driver/char/hw_random/Kconfig”下面添加如下:source“driver/char/hw_random/Kconfig”configHELLO_MODULEbool"HelloWorldTest"dependsonCPU_S5PV210helpThisisademototestkernelexperimentOnUP-Magic210.(3)、进入实验内核源码目录修改driver/char/目录下的Makefile文件,按照内核中Makefile语法添加helloworld程序的编译支持[******@localhostlinux-]#vidrivers/char/Makefile在Makefile中(大约在91行)添加如下一行obj-$(CONFIG_TOSHIBA) += -$(CONFIG_I8K) += -$(CONFIG_DS1620) += -$(CONFIG_HW_RANDOM) += hw_random/obj-$(CONFIG_HELLO_MODULE) += -$(CONFIG_PPDEV) += (4)、运行makemenuconfig配置内核对helloworld程序的支持: [******@localhostlinux-]#makedistclean[******@localhostlinux-]#makemenuconfig先加载内核配置单,如图:然后进入到DeviceDrivers--->菜单中如图:进入到Characterdevices--->如图:进入该菜单会发现[]HelloWorld
《嵌入式操作系统》实验报告 来自淘豆网m.daumloan.com转载请标明出处.