LinuxSir.cn,穿越时空的Linuxsir!

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

initramfs 到底该怎么用, initrd里到底该放些什么文件

[复制链接]
发表于 2007-5-1 02:25:47 | 显示全部楼层 |阅读模式
我下载了最新内核并编译通过, 生下的问题是制作 initrd, 但不知道该在里面放些什么文件。
于是使用 mkinitramfs -o initrd.img-2.6.21制作了一个,但结果发现, initrd.img-2.6.21/lib/modules 下是 2.6.20.15 是我现在运行的内核版本,而新内核期待里面应该是 2.6.21, 那我该怎么办, 非得要重新解压, 改名字, 在压缩吗, 问题是既然名字是不是2.6.21, 那么里面的驱动很可能也不是本次编译的2.6.21版本的, 就算改名字, 也存在版本不一致的问题, 如果将其中的文件一一用新编译的模块取代, 则一来麻烦, 而来存在两个版本编译时config不一样, 不可能能够一一对应的起来, 现在就迷惑了, 升级内核这个 initrd.img到底该怎么制作才好
 楼主| 发表于 2007-5-1 11:34:10 | 显示全部楼层
我晕, 居然没一条回复, 问题太挫, 还是太难了?
回复 支持 反对

使用道具 举报

发表于 2007-5-1 13:24:34 | 显示全部楼层
initrd 里放启动时必要的 ko ,比如 / 的文件系统, lvm 之类。
还有装载 ko 必须的 sh(nash ,busybox),mount ,moprobe ,udev,一个启动脚本 /linuxrc

但如果 kernel 里编译进了(buildin)相关ko ,可以不要 initrd 。

其实 initrd里装什么都可以,我见过把 linux 整个系统都装在 initrd 里的,就是 minimax 。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-5-1 14:09:27 | 显示全部楼层
我知道放什么都可以,问题是我不是到什么应该放进去什么不应该, 至少我不想把整个linux 文件系统都放进去。
initramfs 是整这个的, 偏偏不会用/

Tips: 在IRC上问人, 解决了, 呵呵: mkinitramfs -o initrd.img-2.6.21.1 2.6.21.1
倒腾了半天, 就是最后一个2.6.21.1没有加上, 结果initramfs 默认 将running kernel版本包含了进去
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-5-1 14:15:42 | 显示全部楼层
不过又一个问题, 新内核启动后没见的快多少, 倒是终端下字体变得不好看了, 是一种比较细长的字体, 感觉不是很好看。

新内核没小多少, 从1.7M--->1.3M, 模块倒是大幅度减少 , 从61M-->13.5M
回复 支持 反对

使用道具 举报

发表于 2007-5-1 17:49:20 | 显示全部楼层
不要initrd,内核启动更快
回复 支持 反对

使用道具 举报

发表于 2007-5-2 00:01:26 | 显示全部楼层
制作initrd.gz不是用mkinitrd这个命令么?

我的还不到300kb。

如果你有mkinitrd这个命令的话,建议你可以试试啊。
  1. 3.  How do I build the initrd?
  2. The easiest way to make the initrd is to use the mkinitrd script included
  3. in Slackware's mkinitrd package.  We'll walk through the process of
  4. upgrading to the 2.6.13 Linux kernel using the packages found in
  5. Slackware's testing/packages/linux-2.6.13/ directory.
  6. First, make sure the kernel, kernel modules, and mkinitrd package are
  7. installed (the current version numbers might be a little different, so
  8. this is just an example):
  9.   installpkg kernel-generic-2.6.13-i486-1.tgz
  10.   installpkg kernel-modules-2.6.13-i486-1.tgz
  11.   installpkg mkinitrd-1.0.1-i486-1.tgz
  12. Change into the /boot directory:
  13.   cd /boot
  14. Now you'll want to run "mkinitrd".  I'm using reiserfs for my root
  15. filesystem, and since it's an IDE system the reiserfs module will be
  16. the only one I need to load:
  17.   mkinitrd -c -k 2.6.13 -m reiserfs
  18. This should do two things.  First, it will create a directory
  19. /boot/initrd-tree containing the initrd's filesystem.  Then it will
  20. create an initrd (/boot/initrd.gz) from this tree.  If you wanted to,
  21. you could make some additional changes in /boot/initrd-tree/ and
  22. then run mkinitrd again without options to rebuild the image.  That's
  23. optional, though, and only advanced users will need to think about that.
  24. Here's another example:  Build an initrd image using Linux 2.6.13
  25. kernel modules for a system with an ext3 root partition on /dev/hdb3.
  26. Note that you need both the jbd and ext3 modules to use ext3:
  27.   mkinitrd -c -k 2.6.13 -m jbd:ext3 -f ext3 -r /dev/hdb3
复制代码
回复 支持 反对

使用道具 举报

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

本版积分规则

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