移植嵌入式Linux到ARM处理器S3C2410:操作系统
2012-06-02
宋宝华
标签: S3C2410

要轻而易举地进行上述马拉松式的内核移植工作并非一件轻松的事情,需要对Linux内核有很好的掌握,同时掌握硬件特定的知识和相关的汇编。幸而mizi公司的开发者们已经合力为我们完成了上述工作,这使得小弟们在将mizi-linux移植到自身开发的电路板的过程中只需要关心如下几点:

(1)内核初始化:

Linux内核的入口点是start_kernel()函数。它初始化内核的其他部分,包括捕获,IRQ通道,调度,设备驱动,标定延迟循环,最重要的是能够fork"init"进程,以启动整个多任务环境。

我们可以在init中加上一些特定的内容。

(2)设备驱动:

设备驱动占据了Linux内核很大部分。同其他操作系统一样,设备驱动为它们所控制的硬件设备和操作系统提供接口。

本文第四章将单独讲解驱动程序的编写方法。

(3)文件系统:

Linux最重要的特性之一就是对多种文件系统的支持。这种特性使得Linux很容易地同其他操作系统共存。文件系统的概念使得用户能够查看存储设备上的文件和路径而无须考虑实际物理设备的文件系统类型。Linux透明的支持许多不同的文件系统,将各种安装的文件和文件系统以一个完整的虚拟文件系统的形式呈现给用户。

我们可以在K9S1208 NAND FLASH上移植cramfs、jfss2、yaffs等FLASH文件系统。

3. init进程

在init函数中"加料",可以使得Linux启动的时候做点什么,例如广州友善之臂公司的demo板在其中加入了公司信息:

static int init(void * unused)

{

lock_kernel();

do_basic_setup();

prepare_namespace();

/*

* Ok, we have completed the initial bootup, and

* we're essentially up and running. Get rid of the

* initmem segments and start the user-mode stuff..

*/

free_initmem();

unlock_kernel();

if (open("/dev/console", O_RDWR, 0) < 0)

printk("Warning: unable to open an initial console.\n");

(void) dup(0);

(void) dup(0);

/*

* We try each of these until one succeeds.

*

* The Bourne shell can be used instead of init if we are

* trying to recover a really broken machine.

*/

printk("========================================\n");

printk("= Friendly-ARM Tech. Ltd. =\n");

printk("= http://www.arm9.net =\n");

printk("= http://www.arm9.com.cn =\n");

printk("========================================\n");

if (execute_command)

execve(execute_command,argv_init,envp_init);

execve("/sbin/init",argv_init,envp_init);

execve("/etc/init",argv_init,envp_init);

execve("/bin/init",argv_init,envp_init);

execve("/bin/sh",argv_init,envp_init);

panic("No init found. Try passing init= option to kernel.");

}

这样在Linux的启动过程中,会额外地输出:

========================================

= Friendly-ARM Tech. Ltd. =

= http://www.arm9.net =

= http://www.arm9.com.cn =

========================================

共 4 页   上一页1234下一页
可能会用到的工具/仪表
本站简介 | 意见建议 | 免责声明 | 版权声明 | 联系我们
CopyRight@2024-2039 嵌入式资源网
蜀ICP备2021025729号