LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1369|回复: 2

修改initrd.img linuxrc 使用新shell 问题

[复制链接]
发表于 2005-11-25 16:11:02 | 显示全部楼层 |阅读模式
由于新系统初始化需要,更换initrd.img 中/bin 默认的shell。使用busybox sh来替代 原nash shell 但修改 linuxrc 脚本后发现新shell 不能正常工作,提示“找不到 echo, mount ,umount等命令”错误。我的busybox 是1.0 采用静态联编生成。

原 linuxrc 脚本:
#!/bin/nash
mount -t proc /proc /proc
mkdevices /dev
mkrootdev /dev/root
echo 0x0100 > /proc/sys/kernel/real-root-dev
mount -o defaults --ro -t ext2 /dev/root /sysroot
pivot_root /sysroot /sysroot/initrd
umount /initrd/proc

更换busybox sh
#cp -a busybox /initrd/bin
#cp -a sh /initrd/bin

修改后 linuxrc 脚本:
#!/bin/sh
mount -t proc /proc /proc
mkdevices /dev
mkrootdev /dev/root
echo 0x0100 > /proc/sys/kernel/real-root-dev
mount -o defaults --ro -t ext2 /dev/root /sysroot
pivot_root /sysroot /sysroot/initrd
umount /initrd/proc
发表于 2005-11-26 00:50:47 | 显示全部楼层
Post by hysundy
由于新系统初始化需要,更换initrd.img 中/bin 默认的shell。使用busybox sh来替代 原nash shell 但修改 linuxrx 脚本后发现新shell 不能正常工作,提示“找不到 echo, mount ,umount等命令”错误。我的busybox 是1.0 采用静态联编生成。

linuxrx 脚本:
#!/bin/nash
mount -t proc /proc /proc
mkdevices /dev
mkrootdev /dev/root
echo 0x0100 > /proc/sys/kernel/real-root-dev
mount -o defaults --ro -t ext2 /dev/root /sysroot
pivot_root /sysroot /sysroot/initrd
umount /initrd/proc

更换busybox sh
#cp -a busybox /initrd/bin
#cp -a sh /initrd/bin

修改 linuxrx 脚本:
#!/bin/sh
mount -t proc /proc /proc
mkdevices /dev
mkrootdev /dev/root
echo 0x0100 > /proc/sys/kernel/real-root-dev
mount -o defaults --ro -t ext2 /dev/root /sysroot
pivot_root /sysroot /sysroot/initrd
umount /initrd/proc
nash shell及linuxrx 脚本是啥?是指bash shell及linuxrc脚本乎?很多命令及语法不常见的,兄台用的是什麽系统?

另外是否编译busybox的时候编漏了echo,mount,umount?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-11-26 15:13:07 | 显示全部楼层
linuxrx 笔误 应该是 initrd.img 文件里的 linuxrc 执行脚本,我是想基于redhat 9.0制作一个小型linux系统。想使用 busybox  的shell 肯定是编译了所需要得命令。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表