制作小型操作系统 的思路

一、首先了解Linux的启动流程:
1、首先Linux要通过POST自检,检查硬件设备有没有故障
2、如果有多块启动盘的话,需要在BIOS中选择启动磁盘
3、启动MBR中的bootloader引导程序
4、加载内核文件
5、执行所有进程的父进程、老祖宗init
6、打印欢迎界面
二、在Linux的启动流程中,加载内核文件时还需要借助别外两个文件:
1)initrd,是CentOS5上用内存模拟的磁盘设备
2)initramfs,是CentOS6上用内存模拟的文件系统
在启程的流程中,init主要是用来做哪些操作的呢?
init通过调用/etc/inittab这个配置文件,然后再去执行/etc/rc.d/rc.sysinit的系统初始化脚本

三、制作操作系统思路
1、我们要在一个现有的Linux系统上加一块硬盘/dev/sdb,在硬盘上分两个分区,一个是/boot,一个是/,并将其格式化。当然,我们需要明确的概念是,我们现在加的这个硬盘在现有的Linux系统中是/dev/sdb,但是,当我们把东西全部设置好时,我们就需要把这个硬盘拔除,放在我们的新系统上,此时,他就是/dev/sda啦。
2、在/dev/sdb这个硬盘上,我们要将其打造成一个独立的Linux系统,里面的所有文件是需要我们一个一个拷贝进去的。而且,作为一个将来要当/dev/sda的硬盘,里面一定要有grub文件诺~所以我们要安装grub文件。
3、同时,作为一个能独立运行的Linux系统,内核是一定不能少的!所以,我们要把内核文件和initramfs文件也一起拷到我们的/dev/sdb上。
4、现在我们系统已经初具规模了,接下来就是需要程序了0.0关于程序的拷贝我们可以通过一个脚本来实现。

一个小型操作系统,采用gcc进行开发,几千行的代码,方便初学者学习,内含有编译好的映像文件,及bochs模拟器配置文件,可在bochs下模拟运行。如下为源码包内的README文件: # # Snixos Project version 1.0, 2003.6 # (C) Copyright 2003,2004,2005 Jockeyson,KeqianGao # All Rights Reserved. # Distributed under the terms of the GNU General Public License. # # This program is a free and open source software and you can redistribute # it and/or modify it under the terms of the GNU General Public License as # published by the Free Software Foundation. As no any liability is assumed # for any incidental or consequential damages in connection with the # information or program fragments contained herein,so any exception arised # is at your own risk. It is ABSOLUTELY WITHOUT ANY WARRANTY. # Bug report please send to Snallie@tom.com . # 0. What is Snixos Project? Snixos Project is an experimental operating system designed by Jockeyson , KeqianGao aiming at multitask/multithread, Chinese envionment including Chinese characters input and ouput etc... 1. What you need to run Snixos PC with the following minimum configuration: CPU: i386 or above MEM: 2M extended memory or more DISPLAY: VGA or above Floppy Drive: 1.44M 2. Compile Environment RH Linux 7.2 or above (kernel 2.4.7-10 ) NASM 0.98 gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98) 3. Compile and install a. unpack the source package tar zxvf snixos_x.x_YYYYMMDD_HHMMSS.tgz b. cd to snixos cd snixos c. before make insert a 1.44M floppy in drive c.1 to make snixos run in VGA text mode make clean make VIDEO=TEXT diskimg make floppy c.2 to make snixos run VGA graphics mode make clean make diskimg make floppy d. bootup with the floppy just created in step c also you can follow this way to run snixos in bochs either in Windows or Linux a. just as the above b. just as the above c. invoke these command: make clean; make diskimg you'll get a snixos ima
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值