几个重要的配置文件

本文介绍了嵌入式系统的启动脚本配置细节,包括关键的系统初始化步骤、设备挂载命令及网络设置等。通过分析 rcS 脚本与 inittab 配置文件,展示了如何设置系统运行级别、挂载文件系统、启动服务以及配置网络接口。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

/ etc/init.d/rcS
#!/bin/sh

PATH
=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/home/swordzj:
runlevel
=S
prevlevel
=N
umask 
022
export PATH runlevel prevlevel

/bin/mount -t proc none /proc
/bin/mount -t tmpfs none /tmp
/bin/mount -t tmpfs none /var
/bin/mount --t sysfs /sys
/bin/mount -t yaffs /dev/mtdblock/3 /usr/local
/bin/mkdir -/var/lib
/bin/mkdir -/var/run
/bin/mkdir -/var/log

/etc/rc.d/init.d/netd start
/etc/rc.d/init.d/httpd start

/sbin/ifconfig lo 127.0.0.1
/sbin/ifconfig eth0 192.168.0.2

/bin/hostname -/etc/sysconfig/HOSTNAME

/etc/inittab
console::sysinit:-/etc/init.d/rcS
ttySAC0::respawn:-/bin/sh

ll /dev/
drwxr-xr-x    1 root     root          512 Jan  1 00:00 adc
drwxr-xr-x    1 root     root          512 Jan  1 00:00 bon
crw-------    1 root     root     232,   0 Jan  1 00:02 buttons
crw-------    1 root     root       5,   1 Jan  1 00:02 console
crw-------    1 root     root     205,   5 Jan  1 00:02 cua0
crw-------    1 root     root     205,   6 Jan  1 00:02 cua1
crw-------    1 root     root     205,   7 Jan  1 00:02 cua2
lrwxrwxrwx    1 root     root           14 Jan  1 00:02 dsp -> /dev/sound/dsp
drwxr-xr-x    1 root     root          512 Jan  1 00:00 fb
lrwxrwxrwx    1 root     root            9 Jan  1 00:02 fb0 -> /dev/fb/0
crw-r--r--    1 root     root       1,   7 Jan  1 00:02 full
drwxr-xr-x    1 root     root          512 Jan  1 00:00 ide
crw-r-----    1 root     root       1,   2 Jan  1 00:02 kmem
crw-r-----    1 root     root       1,   1 Jan  1 00:02 mem
drwxr-xr-x    1 root     root          512 Jan  1 00:00 misc
lrwxrwxrwx    1 root     root           16 Jan  1 00:02 mixer -> /dev/sound/mixer
drwxr-xr-x    1 root     root          512 Jun 30  2007 mtd
drwxr-xr-x    1 root     root          512 Jun 30  2007 mtdblock
crw-r--r--    1 root     root       1,   3 Jan  1 00:02 null
crw-r-----    1 root     root       1,   4 Jan  1 00:02 port
crw-r--r--    1 root     root       5,   2 Jan  1 00:02 ptmx
drwxr-xr-x    1 root     root          512 Jan  1 00:00 pts
drwxr-xr-x    1 root     root          512 Jan  1 00:00 pty
crw-r--r--    1 root     root       1,   8 Jan  1 00:02 random
lrwxrwxrwx    1 root     root           10 Jan  1 00:02 root -> mtdblock/0
drwxr-xr-x    1 root     root          512 Jan  1 00:00 scsi
lrwxrwxrwx    1 root     root           39 Jan  1 00:02 sda1 -> /dev/scsi/host1/bus0/target0/lun0/part1
drwxr-xr-x    1 root     root          512 Jan  1 00:00 shm
drwxr-xr-x    1 root     root          512 Jan  1 00:00 sound
crw-r--r--    1 root     root       5,   0 Jan  1 00:02 tty
lrwxrwxrwx    1 root     root            9 Jan  1 00:02 tty0 -> /dev/vc/0
lrwxrwxrwx    1 root     root            9 Jan  1 00:02 tty2 -> /dev/vc/2
crw-r--r--    1 root     root     204,  64 Jan  1 00:27 ttySAC0
crw-r--r--    1 root     root     204,  65 Jan  1 00:02 ttySAC1
crw-r--r--    1 root     root     204,  66 Jan  1 00:02 ttySAC2
crw-r--r--    1 root     root       1,   9 Jan  1 00:02 urandom
drwxr-xr-x    1 root     root          512 Jan  1 00:00 usb
drwxr-xr-x    1 root     root          512 Jan  1 00:00 vc
drwxr-xr-x    1 root     root          512 Jan  1 00:00 vcc
crw-r--r--    1 root     root       1,   5 Jan  1 00:02 zero

[root@swordzj /]$ ll
drwxr-xr-x    1 root     root          512 Jun 27  2007 bin
-rwxrwxrwx    1 root     root       731160 Jan  1 00:06 busybox
drwxr-xr-x    1 root     root          512 Jun 30  2007 dev
drwxr-xr-x    1 root     root          512 Jun 29  2007 etc
drwxr-xr-x    1 root     root          512 Jul  1  2007 home
drwxr-xr-x    1 root     root          512 Apr  1  2007 lib
lrwxrwxrwx    1 root     root           11 Jan  1 00:03 linuxrc -> bin/busybox
drw-rw-rw-    1 root     root          512 Sep 13  1988 lost+found
drwxr-xr-x    1 root     root          512 Dec 13  2001 mnt
dr-xr-xr-x   31 root     root            0 Jan  1 00:00 proc
drwxr-xr-x    1 root     root          512 Mar 31  2006 root
drwxr-xr-x    1 root     root          512 Jul  1  2007 sbin
drwxr-xr-x   10 root     root            0 Jan  1 00:00 sys
drwxrwxrwt    2 root     root           40 Jan  1 00:00 tmp
drwxr-xr-x    1 root     root          512 Jun 27  2007 usr
drwxrwxrwt    5 root     root          100 Jan  1 00:00 var
drwxr-xr-x    1 root     root          512 Dec 27  2006 www

挂载nfs的命令
mount -t nfs -o nolock 192.168.0.1:/home/swordzj /home/swordzj

uboot 的启动参数
使用nfs:root=/dev/nfs rw nfsroot=192.168.0.1:/home/swordzj/arm/rootfs ip=192.168.0.2:192.168.0.1:192.168.0.1:255.255.255.0:swordzjj:eth0:off console=ttySAC0 115200 ethaddr=08:00:3e:26:0a:5b mem=32M init=/linuxrc
使用nand flash(yaffs的文件系统):noinitrd root=/dev/mtdblock2 rw rootfstype=yaffs init=/linuxrc console=ttySAC0 115200 ethaddr=08:00:3e:26:0a:5b mem=32M
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值