applewolf 发表于 2009-9-12 21:27:09

Slax 6.1.2 自己动手做内核之 支持PAE的

我在 Tomas M 的 Blog 里看到,据称支持PAE的Slax 6.1.2 将会被命名为 Slax 6.2.2.

但是我等了巨长时间,也没有等到新版本出来,但是我又想用新版的 2.6.27.27 内核,Slax 6.2.0 的内核还跟 Slax 6.0.9 一样,是 2.6.27.8 的,有点老,呵呵,于是只好自己动手做了,没办法,谁让我的本子是4G内存呢。

下面是我发在官网上的贴子
Build the kernel enable PAE support fro Slax 6.1.2

First

You need download all scripts and sources from ftp://ftp.slax.org/source/slax/kernel/2.6.27.27/

Second

Boot system with Slax 6.1.2 (Kernel 2.6.27.27)
Put all scripts and sources to


/usr/src


open file "/usr/src/config" and edit it

find
-----------------------
# CONFIG_M486=y
CONFIG_M586 is not set
-----------------------

Change it to
-----------------------
# CONFIG_M486=y
CONFIG_M586=y
-----------------------

find
-----------------------
CONFIG_HIGHMEM4G
-----------------------

Change this line and next line like this
-----------------------------
# CONFIG_HIGHMEM4G is not set
CONFIG_HIGHMEM64G=y
-----------------------------

find
-----------------------------
CONFIG_HIGHMEM
-----------------------------

Add next line
-----------------------------
CONFIG_X86_PAE=y
-----------------------------

OK, Save this file, run there's command

cp /usr/src/config /usr/src/linux-2.6.27.27/.config
cp /usr/src/config /boot/.config

(I'm not very sure this is should be do, but I did it)

Next

open a new terminal and run this command:

cd /usr/src
chmod +x build.kernel
chmod +x get-aufs-cvs.sh
chmod +x prepare-crippled-kernel-sources
chmod +x scripts/rc.modules
./build.kernel

The scripts will be ask you a few questions, just answer "Y", But some question's end is (new),you just enter.

At last ,the scripts will be report a error and exit.
Don't be worry it, you just copy this scripts to a new file and chmod it 777.(exp: The file name is build.fix)

build.fix
-----------------------------------------------------------

#!/bin/sh

LZMA=lzma457
AUFS=aufs
KERNEL=linux-2.6.27.27
SQUASHFS=squashfs3.4
TMP=/usr/src
PKG=/tmp/$KERNEL
cd $TMP
mkdir -p $PKG/usr/bin
cp $TMP/$SQUASHFS/squashfs-tools/{mk,un}squashfs $PKG/usr/bin
strip --strip-unneeded $PKG/usr/bin/*
cd $PKG/lib/modules/*
rm -f modules.*
mkdir -p kernel/fs/squashfs/
cp $TMP/$LZMA/C/Compress/Lzma/kmod/{un,sq}lzma.ko kernel/fs/squashfs/
cp $TMP/$KERNEL/fs/squashfs/squashfs.ko kernel/fs/squashfs/

cd $TMP/$KERNEL
mkdir -p $PKG/boot
cp .config $PKG/boot/
cp arch/i386/boot/bzImage $PKG/boot/vmlinuz
mkdir -p $PKG/etc/rc.d/
cp $TMP/scripts/rc.modules $PKG/etc/rc.d/
cd $PKG
cd ..
dir2lzm $KERNEL $KERNEL.lzm

-----------------------------------------------------------

At after, you run this command :

/usr/src/build.fix

OK, A new kernel build was finish, and this kernel was supported PAE.

The new kernel was put in /tmp, name is linux-2.6.27.27.lzm.

/tmp/linux-2.6.27.27.lzm

And new kernel directory is put to /tmp/linux-2.6.27.27

/tmp/linux-2.6.27.27


But! it still can not boot your system.

Now you need remake a new bootable system .

First

Copy two files to /tmp ,

(Path to your boot disk)/slax/modules/1-001.core.lzm
(Path to your boot disk)/boot/initrd.gz

in first step, I try to remake initrd.gz, Open a terminal run these command:

cd /tmp
mkdir i
mknod /dev/loop100 b 7 100
gzip -d initrd.gz
mount initrd i

Then I use two konqueror to find and replace some files in /tmp/i with new files from /tmp/linux-2.6.27.27

Find the files in need initrd , and copy new files from /tmp/linux-2.6.27.27 to replace the old files.

Don't forget these have two lzm file in initrd (usr.lzm and drivers.lzm), you need unpack there's file and replace the files inside to new files from /tmp/linux-2.6.27.27

When you all be down, run this command

cd /tmp
umount i
gzip -9 initrd

OK, A new boot file was maked finish

copy the file initrd.gz to your boot disk /boot replace the old file

the next , you need unpack the 1-001-core.lzm

Same with initrd.gz file, you just copy new files from directory /tmp/linux-2.6.27.27 to directory /tmp/1-001-core to replace the old file.

When you complete, you rebuild 1-001-core.lzm, and copy it to your boot disk to replace the old file.

At this time , the works still not finished, you need copy a new kernel image to your boot disk /boot

this file was puted in(and named)

/tmp/linux-2.6.27.27/boot/vmlinuz

copy it to

(Path to your bootdisk)/boot

replace the old file.

At last time , I think you may want to backup the file: /tmp/linux-2.6.27.27.lzm

Good luck!

applewolf 发表于 2009-9-12 22:04:33

英文太累

我的英文水平实在低下得没法说,所以,写得我累死了,还是改成中文版的吧。

构建支持PAE的Slax 6.1.2内核
首先
你需要下载最新的源码包和脚本 ftp://ftp.slax.org/source/slax/kernel/2.6.27.27/
然后
用 Slax 6.1.2 (Kernel 2.6.27.27) 来启动你的计算机
把你下来的所有源码和脚本都放到这里去(切记,目录结构一定要和 FTP 上的目录结构相同)/usr/src然后,你需要到这个目录下打开名为 config 的文件编辑一下,用Kwrite 打开它比较省事儿
找到# CONFIG_M486=y
CONFIG_M586 is not set把它改成# CONFIG_M486=y
CONFIG_M586=y找到CONFIG_HIGHMEM4G把连续的两行改成# CONFIG_HIGHMEM4G is not set
CONFIG_HIGHMEM64G=y找到CONFIG_HIGHMEM在它下面添加一行CONFIG_X86_PAE=yOK,大告成,保存文件,然后把这个文件拷到这些地方,注意,别忘了改成   .config ,原文件是不带点的(原文件不要改名)
cp /usr/src/config /usr/src/linux-2.6.27.27/.config
cp /usr/src/config /boot/.config(其实我并不确定是不是需要这样做,只是出于保险起见,所以我做了)

然后
打开一个新的终端,运行下面的命令:cd /usr/src
chmod +x build.kernel
chmod +x get-aufs-cvs.sh
chmod +x prepare-crippled-kernel-sources
chmod +x scripts/rc.modules
./build.kernel运行这个脚本时,它会问你几个问题,你只需要回答"Y”就行了,不过可能有几个问题的结尾是(new),不用回答,只要回车就行了。
脚本运行到最后,会出错,然后退出。
别担心,其实脚本已经差不多做完了该做的工作了,你只需要拷贝下面的代码到一个新文件里,并设定这个文件可执行:(比如说,文件名叫   build.fix)
build.fix#!/bin/sh
LZMA=lzma457
AUFS=aufs
KERNEL=linux-2.6.27.27
SQUASHFS=squashfs3.4
TMP=/usr/src
PKG=/tmp/$KERNEL
cd $TMP
mkdir -p $PKG/usr/bin
cp $TMP/$SQUASHFS/squashfs-tools/{mk,un}squashfs $PKG/usr/bin
strip --strip-unneeded $PKG/usr/bin/*
cd $PKG/lib/modules/*
rm -f modules.*
mkdir -p kernel/fs/squashfs/
cp $TMP/$LZMA/C/Compress/Lzma/kmod/{un,sq}lzma.ko kernel/fs/squashfs/
cp $TMP/$KERNEL/fs/squashfs/squashfs.ko kernel/fs/squashfs/

cd $TMP/$KERNEL
mkdir -p $PKG/boot
cp .config $PKG/boot/
cp arch/i386/boot/bzImage $PKG/boot/vmlinuz
mkdir -p $PKG/etc/rc.d/
cp $TMP/scripts/rc.modules $PKG/etc/rc.d/
cd $PKG
cd ..
dir2lzm $KERNEL $KERNEL.lzm
然后,你运行一下这个脚本/usr/src/build.fix好了,一个新的,支持PAE 的 内核做好了。

新的内核放在 /tmp, 包名字是 linux-2.6.27.27.lzm./tmp/linux-2.6.27.27.lzm用于打包的源文件在 /tmp/linux-2.6.27.27 目录里/tmp/linux-2.6.27.27但是,请注意,现在这个内核还不能用于引导你的 Slax。
现在需要重新做个可启动的系统
首先
把下面两个文件拷贝到/tmp ,(你启动盘所在路径)/slax/modules/1-001.core.lzm
(你启动盘所在路径)/boot/initrd.gz第一步,我是试着重做 initrd.gz 这个启动包,打开终端,运行这些命令:cd /tmp
mkdir i
mknod /dev/loop100 b 7 100
gzip -d initrd.gz
mount initrd i然后,我打开了两个资源管理器(Konqueror)在 /tmp/i 目录中找,有哪些文件是 /tmp/linux-2.6.27.27 目录中新编译生成的文件,一个一个都替换成新版本。
在替换文件时,不要忘了,在 /tmp/i 目录下还有两个 lzm 包文件,把它们拷出来,解包,也同样把老文件替换成 /tmp/linux-2.6.27.27 目录中的新文件。替换完后,重新打包,并覆盖掉 /tmp/i 目录中的这两个包文件。

当你做完上面所有的工作后,执行下面的命令:cd /tmp
umount i
gzip -9 initrd好了,新版的启动包文件做完了。
把这个文件拷到你启动盘的 boot 目录中,替换原文件(或者你会改 Slax.cfg 这个文件的话,你只需要重命名一下就行了,不用替换)

接下来,你把拷到 /tmp/下的那个 1-001-core.lzm 文件给解包出来。
和上面那个 initrd.gz 文件的操作一样,用 /tmp/linux-2.6.27.27 目录里的新文件去替换掉原来的老文件,在这里我建议一下,不要一网打尽式的拖过去覆盖,尽可能一个目录一个目录的替换文件,还有,在 /tmp/linux-2.6.27.27/boot 目录中有个文件叫 vmlinuz ,这个文件不用拷进去的,这点我没和老外说,哈哈哈

当你做完所有工作后,重新打包1-001-core.lzm 然后你用它替换掉你原来启动盘中的这个文件,当然还是老话,你会写 slax.cfg 的话,就可以考虑拷贝到 options 目录下,成为一个可选式的包。

好了,现在所有的工作接近尾声了,你还需要拷贝一个文件,到你启动盘的 boot 目录中去/temp/linux-2.6.27.27/boot/vmlinuz哈哈哈,现在知道这个文件是啥了吧,又是老话,如果你会写 slax.cfg 的话。。。。。。。

好了,至此工作全做完了,不过有点小小的建议,备份一下下面这个文件: /tmp/linux-2.6.27.27.lzm还有,老鸟们可能会喜欢备份一下 /usr/src/linux-2.6.27.27 目录下生成的几个 modules.* 文件,呵呵,以后再装一些与内核有关的驱动或程序时,就不会再说找不到这个文件了。呵呵。

好了,祝你好运!

本文也是 AppleWolf 在历经N 次试验后才得以成功的兴奋状态下写的。呵呵

(网上的资料太少了,Slax 和 Slackware 的更少了,不论老中还是老外大多说得要多含糊就有多含糊,似乎他们的手指都大舌头了,几乎等于没说,没办法,自己去拆了 slax 6.2.0 进行N次研究,才得到这个结果的)

npcomet 发表于 2009-9-12 23:20:08

支持

applewolf 近来很活跃 ^_^

tangfu 发表于 2009-9-13 15:04:20

活跃好啊,这个论坛一年前还行吧,越到后面越冷,不晓得为啥子

npcomet 发表于 2009-9-13 17:01:51


希望慢慢会好起来

roofers 发表于 2009-9-14 07:24:52

晕,上面的英文不是你写的吧,奇怪竟然看得懂!!!?

applewolf 发表于 2009-9-15 23:10:45

原帖由 roofers 于 2009-9-14 07:24 发表 http://www.linuxfans.org/bbs/images/common/back.gif
晕,上面的英文不是你写的吧,奇怪竟然看得懂!!!?
上面的英文就是我写的,全自己写的,绝对原装货,呵呵
因为以前改论坛代码时,经常看老外的修改文章,人家就是这样的风格写的,越简单越好,文字越少越好,关键是能一下就明白在哪儿去干什么,所以我也模仿了一把,用我那实在烂得不行的英文写了一篇。
幸好文字少,翻翻金山在线就能搞定,虽然错误多,语法、词性更是惨不忍睹,不然文字多的话,我还真写不出来了。

[ 本帖最后由 applewolf 于 2009-9-15 23:13 编辑 ]
页: [1]
查看完整版本: Slax 6.1.2 自己动手做内核之 支持PAE的