最小的Linux系统制作过程详解
it mkswap poweroff route swapon telnetd
查看到sbin下有上述链接
转到bin下
#cd /babylinux/rootfs/bin
重新做这些链接:
#ln -s busybox chroot
#ln -s busybox getty
#ln -s busybox ifconfig
...
然后把sbin下的链接删除,以节省空间
#rm -rf /babylinux/rootfs/sbin/*
再把原先inittab中所有的sbin改成bin
init.d下的文件:
rcS
请确保这个文件是可执行的,否则请改成可执行的:
#chmod u+x rcS
rcS的内容:
#! /bin/sh
mount -o remount,rw /
/bin/mount -a
>/etc/mtab
echo
echo
echo
echo
echo -en \t\tWelcom to \\033[0;32mBabyLinux\\033][0;39m\n
echo -en \\033][0;36m\n
echo
echo -en ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\t\t\n
echo -en + This is a tiny linux system based on a floppy.It contains \t\t\n
echo -en + more than 100 basic Linux commands and tools.The kernel of \t\t\n
echo -en + this tiny system support all kinds of normal filesystems. \t\t\n
echo -en + linux ext2,ext3,jfs,reiserfs and windows fat,vfat,ntfs][readonly]\t\t\n
echo -en + is supported! So it is a powerful small system you can use it \t\t\n
echo -en + as a linux and windows rescue disk.Beside this,the kernel also\t\t\n
echo -en + contains the drivers of Reltek8139,NE2000,via-rhine ethernet\t\t\n
echo -en + adpater. you can configure the IPaddress and netmask with tools\t\t\n
echo -en + 'ifconfig' and config the default gateway with command 'route'. \t\t\n
echo -en + Is there anything else? Haha,this is a telnet server build-in\t\t\n
echo -en + you can type 'telnetd' to startd it and thus your friends can\t\t\n
echo -en + logon to your system to help you solve the problem.\t\t\n
echo -en + \\033[0;32mAll these great features are powered by BusyBox 1.0\\033][0;36m\t\t\n
echo -en + This is a free system tool developed by GuCuiwen.\t\t\n
echo -en + RUN YOUR OWN RISK of using it ! if you have any problem please\t\t\n
echo -en + mailto : win2linux@163.com Enjoy!!\t\t\n
echo -en ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\t\t\n
echo -en \\033][0;39m\n
hostname BabyLinux
可以自己作相应的修改.
以上是babylinux根文件系统的所有内容,他的总大小应该在1M左右.
][root@gucuiwen baby]# du -hs
1.1M .
九,制作ramdisk映象文件
babylinux根文件系统所有东西都放在/babylinux/rootfs下,我们将利用ramdisk把这些内容做成ramdisk映象文件并压缩他.
以下主要是ramdisk的用法,看完以下内容,你应当学会ramdisk的使用.
[root@gucuiwen babylinux]# dd if=/dev/zero of=/dev/ram1
dd: 正在写入 ‘/dev/ram1’: 设备上没有空间
读入了 8193+0 个块
输出了 8192+0 个块
zero是一个特殊的设备,表示全部为0的字符块.上面这条命令的意思是把系统的第一个ramdisk用全部为0的数据填充,因为ramdisk默认大小为4M,因此当读满8192个块(每块512字节)后,显示'设备上没空间'.这很正常,/dev/ram1已经被填充满了.
如果指定块的大小:
[root@gucuiwen babylinux]# dd if=/dev/zero of=/dev/ram1 bs=1M count=4
读入了 4+0 个块
输出了 4+0 个块
不会有错误提示,这里演示了dd的一般用法,接下来还要频繁用到dd命令.
在/dev下有很多ramdisk设备,ram1,ram2,ram3....
一般用第一个就可以了.
填充后,ram1就有可空间,可以在这个空间上创见一个文件系统:
[root@gucuiwen babylinux]# mkfs.ext2 -m0 /dev/ram1
mke2fs 1.32 (09-Nov-2002)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
1024 inodes, 4096 blocks
0 blocks (0.00%) reserved for the super user
First data block=1
1 block group
8192 blocks per group, 8192 fragments per group
1024 inodes per group
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
将ram1挂装到文件系统中:
先建立一个挂装点:
#mkdir /mnt/ram
挂上ram1:
#mount /dev/ram1 /mnt/ram
将先前做好的babylinux根文件
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)
