QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

楼主: sandr0

将lfs livecd安装在硬盘上

[复制链接]
 楼主| 发表于 2006-12-4 08:38:27 | 显示全部楼层
详细内容请看http://bbs.linuxsir.org/showthread.php?t=274629
1. 分析initramfs/init.c,发现函数mountlfscd()是问题的起因。
2. 大刀阔斧,直接删除init.c里面检查CD核对CD的部分,也就是从/* Try to open CD drive to see if we can use it */到/* Try to mount the cd drive*/之前(169到223行)的部分。
3. 第17行,加上一个"/dev/hda1", 这里我还删去了所有的我自己没有的设备,这样速度会快一些,这也是我说只支持hda1的原因。
4. 看init.h,这里面将32行中的iso9660改成ntfs,这也是我说的只支持ntfs的原因。
5. 看Makefile中的编译方法,用这个命令编译:gcc init.c -o init -static -Os -s -Wall
6. 准备好initramfs_data.cpio.gz的目录,比如tmp,在里面建立dev,bin,.tmpfs,.union四个目录,然后将/dev里面的loop0, null, console和hda1四个设备文件复制到tmp/dev里,将编译好的init复制到tmp里。
7. 看Makefile里面建立initramfs_data.cpio.gz的方法,进入到tmp目录,用这个命令建立:find . | cpio -o -H newc | gzip -9 > ../initramfs_data.cpio.gz
回复

使用道具 举报

 楼主| 发表于 2006-12-4 08:57:49 | 显示全部楼层
对于6.2-x,改起来其实更简单,只需要改init.c就可以了。
下面是我改的init.c中的mountlfscd()部分:
[code:1]int mountlfscd(void)
{

                char buf[ISO_BLOCK_SIZE];

                /* Try to mount the cd drive*/
                mount("/dev/hda8", "/hda8", "ext3", 0, 0);
                losetup("/dev/loop2", "/hda8/root.iso", O_RDONLY);
                mount("/dev/loop2", CDROM_MOUNT, CDROM_FSTYPE, MS_RDONLY, NULL);

                /* If we're here, we definitely have the LiveCD mounted at the mount point :) */


                memset(buf, 0, 32); /* Clear buffer so we don't have to check read's status */

                /* YAY! we have the LFS LiveCD mounted :) */
                lfscd = "/dev/loop2";
                return(1);

}
[/code:1]
回复

使用道具 举报

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

本版积分规则

GMT+8, 2024-5-6 02:20 , Processed in 0.141438 second(s), 12 queries .

© 2021 Powered by Discuz! X3.5.

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