如何制作最简minilinux
如何制作最简minilinux
学习啦在线学习网 制作最简minilinux
学习啦在线学习网 在制作之前要保证几点:
init为指向busybox的链接,若为脚本最后一行为exec /sbin/init,并有执行权限。
目录建设好了,如dev,proc,sys,etc等。
学习啦在线学习网 inittab文件
把这个文件放到image的etc目录下。
::sysinit:/etc/init.d/rcS
学习啦在线学习网 tty1::askfirst:/bin/sh
tty2::askfirst:/bin/sh
tty3::askfirst:/bin/sh
tty4::askfirst:/bin/sh
学习啦在线学习网 tty5::askfirst:/bin/sh
学习啦在线学习网 tty6::askfirst:/bin/sh
::restart:/sbin/init
学习啦在线学习网 ::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r
fstab
为了执行reboot命令时避免提示找不到/etc/fstab文件,我们再在etc目录下创建一个空文件:
学习啦在线学习网 touch fstab
/etc/init.d/rcS
#!/bin/sh
mount -t proc proc /proc
学习啦在线学习网 mount -t sysfs sysfs /sys
mdev -s
学习啦在线学习网 /etc/mdev.conf
学习啦在线学习网 有些busybox配置中,mdev命令需要读取/etc/mdev.conf文件,为了避免出错信息,我们创建一个空文件。mdev.conf文件是用 来控制mdev生成的设备文件的读写权限的,在这里我们不需要对设备文件设置特别的权限,就使用mdev缺省的660的权限设置。
touch etc/mdev.conf
生成initramfs镜像
用生成initramfs镜像中讲的方法生成镜像。用如何运行initramfs中讲的方法来测试结果。
学习啦在线学习网 新生成的mini linux应该像通常的linux系统一样,用ALT+F1~F6键可以在6个终端间切换。
学习啦在线学习网 由于mini linux系统不需要登录,所以用askfirst的方式来模拟登录,用户敲回车键后,init进程才会启动shell。制作最简minilinux
学习啦在线学习网 在制作之前要保证几点:
init为指向busybox的链接,若为脚本最后一行为exec /sbin/init,并有执行权限。
学习啦在线学习网 目录建设好了,如dev,proc,sys,etc等。
学习啦在线学习网 inittab文件
把这个文件放到image的etc目录下。
学习啦在线学习网 ::sysinit:/etc/init.d/rcS
学习啦在线学习网 tty1::askfirst:/bin/sh
学习啦在线学习网 tty2::askfirst:/bin/sh
tty3::askfirst:/bin/sh
tty4::askfirst:/bin/sh
tty5::askfirst:/bin/sh
tty6::askfirst:/bin/sh
::restart:/sbin/init
学习啦在线学习网 ::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r
fstab
为了执行reboot命令时避免提示找不到/etc/fstab文件,我们再在etc目录下创建一个空文件:
学习啦在线学习网 touch fstab
/etc/init.d/rcS
#!/bin/sh
学习啦在线学习网 mount -t proc proc /proc
mount -t sysfs sysfs /sys
mdev -s
/etc/mdev.conf
有些busybox配置中,mdev命令需要读取/etc/mdev.conf文件,为了避免出错信息,我们创建一个空文件。mdev.conf文件是用 来控制mdev生成的设备文件的读写权限的,在这里我们不需要对设备文件设置特别的权限,就使用mdev缺省的660的权限设置。
touch etc/mdev.conf
生成initramfs镜像
用生成initramfs镜像中讲的方法生成镜像。用如何运行initramfs中讲的方法来测试结果。
学习啦在线学习网 新生成的mini linux应该像通常的linux系统一样,用ALT+F1~F6键可以在6个终端间切换。
由于mini linux系统不需要登录,所以用askfirst的方式来模拟登录,用户敲回车键后,init进程才会启动shell。制作最简minilinux
学习啦在线学习网 在制作之前要保证几点:
学习啦在线学习网 init为指向busybox的链接,若为脚本最后一行为exec /sbin/init,并有执行权限。
目录建设好了,如dev,proc,sys,etc等。
学习啦在线学习网 inittab文件
把这个文件放到image的etc目录下。
::sysinit:/etc/init.d/rcS
学习啦在线学习网 tty1::askfirst:/bin/sh
tty2::askfirst:/bin/sh
学习啦在线学习网 tty3::askfirst:/bin/sh
tty4::askfirst:/bin/sh
学习啦在线学习网 tty5::askfirst:/bin/sh
tty6::askfirst:/bin/sh
::restart:/sbin/init
学习啦在线学习网 ::ctrlaltdel:/sbin/reboot
学习啦在线学习网 ::shutdown:/bin/umount -a -r
fstab
为了执行reboot命令时避免提示找不到/etc/fstab文件,我们再在etc目录下创建一个空文件:
学习啦在线学习网 touch fstab
学习啦在线学习网 /etc/init.d/rcS
#!/bin/sh
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mdev -s
学习啦在线学习网 /etc/mdev.conf
有些busybox配置中,mdev命令需要读取/etc/mdev.conf文件,为了避免出错信息,我们创建一个空文件。mdev.conf文件是用 来控制mdev生成的设备文件的读写权限的,在这里我们不需要对设备文件设置特别的权限,就使用mdev缺省的660的权限设置。
学习啦在线学习网 touch etc/mdev.conf
学习啦在线学习网 生成initramfs镜像
用生成initramfs镜像中讲的方法生成镜像。用如何运行initramfs中讲的方法来测试结果。
新生成的mini linux应该像通常的linux系统一样,用ALT+F1~F6键可以在6个终端间切换。
由于mini linux系统不需要登录,所以用askfirst的方式来模拟登录,用户敲回车键后,init进程才会启动shell。