LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
楼主: yhyzh

我制作USB启动Linux系统的过程

[复制链接]
发表于 2006-1-9 16:06:59 | 显示全部楼层
感谢之中。。。。。

已经整理入库;http://www.linuxsir.cn/main/?q=node/153


北南 呈上
回复 支持 反对

使用道具 举报

发表于 2006-1-16 09:16:22 | 显示全部楼层
有没有2.6.15的补丁?
谢谢


Post by yhyzh

    1 编译内核
    具体的编译过程就不说了,资料随处可见,在这里关键是注意为了使U盘启动时能找到自己的根目录系统,需要打一个补丁。
    关于这个补丁的详情可见:
    http://www.lammerts.org/software/kernelpatches/
    由于这个补丁是针对内核2.4.22的,所以我专门下载了2.4.22版本的源码---我不知道这个补丁是否对2.4内核的其他版本起作用,而针对2.6内核的补丁又有不同。
    然后,解压—打补丁—编译—得到bzImage,不提。
回复 支持 反对

使用道具 举报

发表于 2006-1-16 09:25:05 | 显示全部楼层
请问你是怎么折腾的啊?
我怎么弄都不行,可以看到U盘已经初始化好了,sda1,sda2设备文件也建立好了,但是就是报告cannot open root device or unknown-block(0,0)

谢谢

Post by yhyzh

    制作完成,现在启动电脑就可以顺利进入到我的U盘了---虽然内核在启动的时候还会报告找不到root文件系统,但是折腾了几下之后,它就找到了并顺利执行init,
回复 支持 反对

使用道具 举报

发表于 2006-1-18 23:06:39 | 显示全部楼层

2.6.11以后的内核不需要这个延时补丁了

我用google怎么也搜不到2.6的能用的内核补丁,后来实在无奈,仔细研读了源代码里面的/init/do_mounts.c部分,发现源代码里本来就提供了一个rootdelay参数,可以设定加载根文件系统之前的延时时间,以秒为单位,一般在启动引导程序syslinux,grub,lilo中直接加一个rootdelay=5,肯定就可以了。
后来我在kernel.org上查了一下,好像是在2.6.11-rc2中加入的。
-------------------------------------------------------------------
From: Daniel Drake <dsd@gentoo.org>

Adds a boot parameter which can be used to specify a delay (in seconds)
before the root device is decoded/discovered/mounted.

Example usage for 10 second delay:

        rootdelay=10

Useful for usb-storage devices which no longer make their partitions
immediately available, and for other storage devices which require some
"spin-up" time.

Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

25-akpm/Documentation/kernel-parameters.txt |    3 +++
25-akpm/init/do_mounts.c                    |   15 +++++++++++++++
2 files changed, 18 insertions(+)

diff -puN Documentation/kernel-parameters.txt~configurable-delay-before-mounting-root-device Documentation/kernel-parameters.txt
--- 25/Documentation/kernel-parameters.txt~configurable-delay-before-mounting-root-device        2005-01-22 23:33:13.038162280 -0800
+++ 25-akpm/Documentation/kernel-parameters.txt        2005-01-22 23:33:13.043161520 -0800
@@ -1117,6 +1117,9 @@ running once the system is up.

        root=                [KNL] Root filesystem

+        rootdelay=        [KNL] Delay (in seconds) to pause before attempting to
+                        mount the root filesystem
+
        rootflags=        [KNL] Set root filesystem mount option string

        rootfstype=        [KNL] Set root filesystem type
diff -puN init/do_mounts.c~configurable-delay-before-mounting-root-device init/do_mounts.c
--- 25/init/do_mounts.c~configurable-delay-before-mounting-root-device        2005-01-22 23:33:13.039162128 -0800
+++ 25-akpm/init/do_mounts.c        2005-01-22 23:33:13.044161368 -0800
@@ -6,6 +6,7 @@
#include <linux/suspend.h>
#include <linux/root_dev.h>
#include <linux/security.h>
+#include <linux/delay.h>

#include <linux/nfs_fs.h>
#include <linux/nfs_fs_sb.h>
@@ -228,8 +229,16 @@ static int __init fs_names_setup(char *s
        return 1;
}

+static unsigned int __initdata root_delay;
+static int __init root_delay_setup(char *str)
+{
+        root_delay = simple_strtoul(str, NULL, 0);
+        return 1;
+}
+
__setup("rootflags=", root_data_setup);
__setup("rootfstype=", fs_names_setup);
+__setup("rootdelay=", root_delay_setup);

static void __init get_fs_names(char *page)
{
@@ -387,6 +396,12 @@ void __init prepare_namespace(void)

        mount_devfs();

+        if (root_delay) {
+                printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
+                       root_delay);
+                ssleep(root_delay);
+        }
+
        md_run_setup();

        if (saved_root_name[0]) {
_
回复 支持 反对

使用道具 举报

发表于 2006-2-5 09:34:51 | 显示全部楼层
有没有做好的安装包?
回复 支持 反对

使用道具 举报

发表于 2006-3-21 15:48:22 | 显示全部楼层
楼主是怎么折腾的,要写就写明白点嘛。
回复 支持 反对

使用道具 举报

发表于 2006-4-4 10:35:33 | 显示全部楼层
我在u盘上安装的grub,用u盘启动时出现了grub菜单选项,选择自己编译的内核,回车,提示root filesystem unknown,下边还有一句: couldn't mount selected partion.怎么办哪?
回复 支持 反对

使用道具 举报

发表于 2006-4-7 08:28:49 | 显示全部楼层
我自己解决了这个问题,这会能从u盘启动内核了,但又出现了错误:
Mounting root filesystem
mount:error 6 mounting ext3
Switching to new root
ERROR opening /dev/console!!!!: 2
error dup'2ing fd of 0 to 0
error dup'2ing fd of 0 to 1
error dup'2ing fd of 0 to 2
umounting old /proc
Switchroot :mount failed:22
kernel panic - not syning: Attempted to kill init

自己解决不了了,请各位linux sir帮帮忙!谢谢啦!
回复 支持 反对

使用道具 举报

发表于 2006-4-7 16:52:53 | 显示全部楼层
我猜是不是initrd问题,内核起来了,可是u盘还没初始化好,找不到u盘的根文件系统。
回复 支持 反对

使用道具 举报

发表于 2006-4-7 17:37:30 | 显示全部楼层
U盘上的Linux?
我的老机器不支持usb启动啊, 5555...
不过还是顶一下,等到机器支持那一天一定要玩一下~~
回复 支持 反对

使用道具 举报

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

本版积分规则

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