Fanx文档资料

请点击标题查看

这是文章目录

CheckInstal Readme

##############################################################################
# # checkinstall 1.6.0beta3 # #
# ############################# #
# #
# Installs a compiled program from the program's source directory using #
# "make install" or any other command supplied on checkinstall's command #
# line. checkinstall will create a Slackware, RPM or Debian compatible #
# package and install it using your distribution's standard package #
# administration utilities. #
# #
# This version of checkinstall needs enough free space on the partition #
# holding the temp dir (/var/tmp by default) to write there a #
# temporary copy of the package. #
# #
##############################################################################

====== CONTENTS ======

1. Introduction

2. Usage

2.1. Download, configure, build

2.2. The "doc-pak" directory

2.3. Package description

2.4. Preinstall, postinstall, preremove and postremove

2.5. Package information

2.6. Package creation

2.6.1 Slackware packages

2.6.2 RPM packages

2.6.3 Debian packages

3. Customization

3.1. The checkinstallrc file

3.2. Command line switches

3.3. Native language support

4. Notes


====== 1. INTRODUCTION ======

A lot of people has asked me how can they remove from their boxes a program
they compiled and installed from source. Some times - very few - the program's
author adds an "uninstall" rule to the Makefile, but that's not usually the
case. That's my primary reason to write checkinstall. After you ./configure;make
your program, It will run "make install" (or whatever you tell it to run) and
keep track of every file modified by this installation, using the excellent
installwatch utility written by Pancrazio 'Ezio' de Mauro <p at demauro.net>.

When "make install" is done, checkinstall will create a Slackware, RPM or
Debian package and install it with Slackware's installpkg, "rpm -i" or "dpkg -i"
as appropriate, so you can view it's contents in /var/log/packages or remove it
with removepkg (for Slackware), "rpm -ql" and "rpm -e" (RPM) or "dpkg -I" and
"dpkg -r" (Debian).


Additionally, this script will leave a copy of the installed package in the
source directory or in the storage directory you specify (see the PAK_DIR option
later in the checkinstallrc file) so you can install it wherever you want,
which is my second motivation: I don't have to compile the same software again
and again every time I need to install it on another box :-).


Another nice thing about checkinstall is that it can be run simultaneously by
any number of users and each instance will get only the files modified by it's
processes and no one else's, unlike some other tools based on a
"find / -atime etc etc etc". Not to mention that checkinstall is A LOT faster =)


It is important to note that checkinstall can keep track of files modified by
any command line, not just a "make install". You can create your own
installation script with lots of command in it and then have checkinstall track
them for you.



====== 2. USAGE ======


== 2.1 == Download, configure, build

o Download your software, i.e. Afterstep-1.8.4.tgz

o Extract the files:

tar xzvf Afterstep-1.8.4

o cd to the source directory, configure and compile:

cd Afterstep-1.8.4
./configure
make

== 2.2 == The "doc-pak" directory

o Optionally you can make a directory called "doc-pak" whose contents
will be installed in /usr/doc/<package_name> inside the package you're
about to create. checkinstall will remind you about this one if it notices
there is no "doc-pak" on the source directory. Good candidates to be there
are: README, INSTALL, COPYING, Changelog, TODO, CREDITS, etc. It's up to you
what to copy in there.

mkdir doc-pak
cp README INSTALL COPYING Changelog TODO CREDITS doc-pak

As of checkinstall-1.1 if you don't create the "doc-pak" directory then
checkinstall will ask if you want it to build a default documentation
directory with files having common documentation names like those mentioned
in the above paragraph. If you say no, your package will have no
documentation.


== 2.3 == Package description (Changed in checkinstall-1.3.0)

If you create a file named "description-pak" it's contents will be used to
include a description and summary in the new package, which will be
displayed when you use "pkgtool" or "rpm -qi". For example:

Create the file "description-pak":

---------------------- Cut here ----------------------
AfterStep window manager

The one and only!
This is a window manager with a NexT inspiration.
---------------------- Cut here ----------------------

If checkinstall doesn't find that file it will create one, asking you
for a description to put in it.

NOTE: Slackware's pkgtool doesn't seem to handle package filenames longer
than 8 characters when displaying the package list in the "Remove" section,
but the "View" option works OK. I hope that Pat or someone can take the
time to fix this. I'll try to fix it myself if i find the time to do it.

As a result, I've decided not to prepend every line in the PACKAGE
DESCRIPTION section of the /var/log/packages entry with package-name:. It is
difficult to read in the /var/log/packages file and it's pretty useless in
the pkgtool's remove package section listing. The description is stored
"as is".

Anyway, it's not that bad.. ;-)

NOTE 2: As of checkinstall 1.5.3, support for the new (8.1+) Slackware
description file format is included, available when using the "--newslack"
command line switch.

== 2.4 == Preinstall, postinstall, preremove and postremove scripts

CheckInstall supports preinstall, postinstall, preremove and postremove
scripts for RPM and Debian packages.

For Debian, these scripts must meet some requirements to be accepted by dpkg
while building the .deb package. See:

http://www.debian.org/doc/debian-policy/ch-maintainerscripts.html

In short, any shell script will do as long as it specifies an interpreter
(i.e. put #!/bin/sh as the first line) and has an exit status of zero for
success or non-zero for failure.

To include the scripts in your package, put them in the current directory
and name them:

+-----------------+--------------------------------------+
| Script name | Action |
+--------------------------------------------------------+
| preinstall-pak | Run BEFORE the package is INSTALLED |
+--------------------------------------------------------+
| postinstall-pak | Run AFTER the package is INSTALLED |
+--------------------------------------------------------+
| preremove-pak | Run BEFORE the package is REMOVED |
+--------------------------------------------------------+
| postremove-pak | Run AFTER the package is REMOVED |
+--------------------------------------------------------+

All scripts are optional. You can write all of them if you need them, or
only the ones you need, or even none.

Remember that the scripts are run only when the .rpm or .deb package is
installed or removed. NOT when the initial install command (i.e. "make
install") is run.

For Slackware packages, the "postinstall-pak" script is already supported as
"install-pak". Either name will work.


== 2.5 == Package information

CheckInstall will display a menu with several values that can be customized
for this package, like the package's name, version, release number, etc.

Most of the values are self-descriptive, however there are three values that
deserve special attention: "Name", "Source Location" and "Alternate Source
Location".

The "Name" field allows you to change the name for the package you are about
to create. This is useful when CheckInstall fails to properly set this name
from the source directory's name. This also applies to the version field.

The "Source Location" values are -for now- only hooks for the upcoming
"auto-unpack-configure-compile-install" feature in future CheckInstall's
versions. The "Source Location" will tipically be the original source archive
and the "Alternate Source Location" would be some FTP or HTTP URL where the
source archive can be retrieved from. Keep your eyes on these ones ;-).

Please note that as of checkinstall-1.5.0 (not 1.5.0betax) all of these values
can be specified via command line options. See the COMMAND LINE OPTIONS
section below.

== 2.6 == Package creation

o You normally would su and make install. Now it's only su:

su
password: xxxxx

o Run checkinstall:

checkinstall

NOTE: If you give no arguments to checkinstall it will run a "make install".
If you give arguments, the first non-option argument will be used as the
install command. This is useful when the install command is not "make install"
but something else like "make install_packages" or "setup" or whatever, i.e.

checkinstall make install_packages
checkinstall make modules_install
checkinstall install.sh
checkinstall setup
checkinstall rpm -i my-package-1.0.i386-1.rpm


== 2.6.1 == Slackware packages

o checkinstall will ask if you want to see the installation results, then run
the modified Slackware package maker "makepak". If you want checkinstall to
use the original Slackware's "makepkg" then change the MAKEPKG variable
inside the checkinstall script and read this:

makepkg will ask you a couple of questions:

If there are any symbolic links in the installed package it will ask you
to remove them and make an installation script to re-create them whenever
you install the package. This is a GOOD THING, so answer YES. --> BTW,
makepkg doesn't always ask you this (depending on whether you have symbolic
links or not) so be careful and read before you answer, you could be
answering the wrong question. Read on:

makepkg will *always* ask if you want to change the owner, group and
permissions of EVERY file in the package to root:root:755. This is BAD most
of the times, always answer NO to that question, unless you know
what you are doing, of course ;)


o In the end, checkinstall will install the package with installpkg so you
can remove it later with Slackware's removepkg (Our initial intention :) ).
Additionally, it will leave a copy of the package in the source directory,
the package's name will be name-version-architecture-release.tgz. Using the
Afterstep example, the file would be named Afterstep-1.8.4-i386-1.tgz.

Starting with checkinstall-1.5.1, the created packages will be named
using the new (post-Slackware 8.0) Slackware package naming scheme.

o You can add a customized installation script which will be run by "installpkg"
every time you use it to install your new package.

Write it and name it "install-pak" or "postinstall-pak" and checkinstall will
include it for you.

This script can be useful to set up the system to fit the newly installed
package: create new users, set permissions, initialize databases, rcscripts,
etc.


== 2.6.2 == RPM package creation support

CheckInstall has the ability to build binary RPM packages. After you write
the package's description the script will prompt you to choose a package
type. If you chose RPM ("R") then it will figure out some sane values and write
a minimal spec file. You can of course supply your own file, in this case
checkinstall will use the values you put in there to build the rpm and skip
the spec file writing step. If any problems arise while building/installing
the rpm you'll get a chance to see the log files and figure out what went
wrong.


== 2.6.3 == Debian package creation support


That's right, CheckInstall can now create Debian packages. Do I need to say
more? =)

The Debian support in CheckInstall is still new, so handle it with care.
It has been reported to work OK in some Debian systems and it certainly works
OK in my Slackware development system with dpkg installed. Your mileage may
vary.

And of course, it it *does* vary, I'd really like it if you send me a message
telling me about it so I can fix it ;-).

NOTE to non-Debian-based users:
===============================

To build Debian packages you need the dpkg utility. I got mine from:

http://www.debian.org/Packages/unstable/base/dpkg.html

Also, you should have all of your basic filesystem structure included
("installed") in your dpkg database, or you won't be able to remove most
.deb packages installed (either checkinstall-generated ones or not). dpkg
seems to be unwilling to remove things like "/", "/usr" and such, wich are
obviously included in nearly every package you install. The way to avoid this
particular problem is to have a "base" package installed containing those
directories, in this way dpkg won't complain about removing other packages.

I've put a "aaa_base-1.0-1.deb" package in the CheckInstall's home page as a
work-around for this problem. Install it with "dpkg -i aaa_base-1.0-1.deb" and
then forget about it =).

"dpkg -I aaa_base-1.0-1.deb" should give you some useful info about the package.



====== 3. CheckInstall customization ======


== 3.1 == The checkinstallrc file

CHANGE in CheckInstall 1.4.0:

The variable declaration section in the checkinstall script has been removed,
you should now edit the checkinstallrc file, normally installed under
/usr/local/lib/checkinstall.


In the checkinstallrc file you will find some variables wich modify
checkinstall's default behaviour. They're described here (and are also well
commented in the file, BTW).


The checkinstallrc values are these:

o DEBUG: Set the debug level (Default: 0)
0 => No debug
1 => Keep all files except the ones inside the package
3 => Keep those files too.

o INSTALLWATCH_PREFIX: Prefix to installwatch's library and program

o INSTALLWATCH: Location of the installwatch program

o MAKEPKG: Location of Slackware's makepkg

Location of the makepkg program. "makepak" is the default, and is
included with checkinstall. If you want to use Slackware's native "makepkg"
then set this to "makepkg"

o MAKEPKG_FLAGS: makepkg optional flags.

These are recommended if running a newer Slackware version: "-l y -c n"

o SHOW_MAKEPKG: Boolean (Default: 0)

Show -or not- the results of the MAKEPKG command as it runs. Useful when
running it with interactive options. If checkinstall seems to halt and
sleep after saying "Building Slackware package..." then you might want to
set this to 1.

o BASE_TMP_DIR: Prefix to all checkinstall's temporary files/dirs

NEVER, EVER set this to "/tmp" or "/". Setting it to "/tmp" will
change /tmp's permission to 700 (definitely no good) and setting it
to "/" one will erase all of your files by means of a "rm -rf /*".

You have been warned!

o DOC_DIR: Where to place the installed document files

o ARCHITECTURE: Default target architecture for the package. (Default: empty)

If your rpm program is configured to build packages for i686 instead of i386
(for example) then you'll find this handy to avoid the need to tell
checkinstall your architecture type every time it is run. The default is
auto-detect.

o INSTYPE: What kind of packages are we building? (Default: empty)

Set it to "S" for Slackware's .tgz, "R" for RedHat and friends' .rpm,
"D" for Debian and leave it empty to have checkinstall ask you every time.

o RPM_FLAGS: RPM install command optional flags.

o DPKG_FLAGS: dpkg install command optional flags.

o PAK_DIR: Package storage directory

If non-empty, all the created packages will be saved in this directory.
In this way you can keep all of your packages in one place.

o CKUMASK: Set the umask to this value (Default: 0022)

o SHOW_INSTALL: Boolean (0 or 1) (Default: 1)
Show -or not- the results of the install command as it runs. Useful for
interactive install commands.

o SHOW_SLACK_INSTALL: Boolean (0 or 1) (Default: 0)
Show -or not- the results of the Slackware's installpkg command as it runs.
As the option above, this can be useful for interactive install scripts.

o DEL_DOCPAK: Boolean (Default: 1)
Delete -or not- the "doc-pak" directory upon program's termination.

o DEL_SPEC: Boolean (Default: 1)
Delete -or not- the .spec file upon termination.

o DEL_DESC: Boolean (Default: 1)
Delete -or not- the "description-pak" file.

o STRIP_ELF: Boolean (Default: 1)
Strip -or not- any ELF binaries found inside the package.

o STRIP_SO_ELF: Boolean (Default: 0)
Automatically strip all ELF shared libraries?
Note: this setting will automatically be set to "0" if STRIP_ELF=0

o ADD_SO: Boolean (Default: 0)
Automatically search for shared libraries and add them to /etc/ld.so.conf?

o COMPRESS_MAN: Boolean (Default: 1)
Automatically compress all man pages?

o BACKUP: Boolean (Default: 1)
Backup -or not- any pre-existent files that would be overwritten by the
package installation.

o AUTODOINST: Boolean (Default: 1)
Write a doinst.sh script wich will be executed everytime you install the
package with installpkg.

o NEW_SLACK: Boolean (Default: 1)
Use the new (8.1+) Slackware description file format?

o EXCLUDE: Comma delimited list
List of files/directories to be ignored when searching for files to be
included in the package.

Example: EXCLUDE="/dev,/tmp,bad_file,bad_dir"

o CK_INCLUDE_FILE: Path to a file
This file should contain a list of files and directories that will
be included in the package in addition to the ones installed by your
installation command. The files or directories should be listed one per line.

Example: INCLUDE="/home/include-list.txt"

o ACCEPT_DEFAULT: Boolean (Default: 0)
Accept default values for all questions?

o CK_INSPECT: Boolean
Enable inspection of the list of files that will be included in the package,
before the package is created.

o REVIEW_SPEC: Boolean
Enable review of the .spec file before the creation of a RPM package.

o REVIEW_CONTROL: Boolean
Enable review of the Debian control file before the creation of
a Debian package.

o INSTALL: Boolean
Install or not the package as we create it.

== 3.2 == Command line options

Starting at version 1.4.0, checkinstall supports a lot of command line
switches, which if specified will override the options set in the
checkinstallrc file.


The command line options are these:

Usage: checkinstall [options] [command [command arguments]]
Options:

*Package type selection*

-t,--type=<slackware|rpm|debian> Choose packaging system
-S Build a Slackware package
-R Build a RPM package
-D Build a Debian package

*Install options*

--install=<yes|no> Toggle created package installation
--fstrans=<yes|no> Enable/disable the filesystem translation code

*Scripting options*

-y, --default Accept default answers to all questions
--pkgname=<name> Set name
--pkgversion=<version> Set version
-A, --arch, --pkgarch=<arch> Set architecture
--pkgrelease=<release> Set release
--pkglicense=<license> Set license
--pkggroup=<group> Set software group
--pkgsource=<source> Set source location
--pkgaltsource=<altsource> Set alternate source location
--pakdir=<directory> The new package will be saved here
--maintainer=<email addr> The package maintainer (.deb)
--provides=<list> Features provided by this package (.rpm)
--requires=<list> Features required by this package (.rpm)
--rpmflags=<flags> Pass this flags to the rpm installer
--rpmi Use the -i flag for rpm when installing a .rpm
--rpmu Use the -U flag for rpm when installing a .rpm
--dpkgflags=<flags> Pass this flags to the dpkg installer
--spec=<path> .spec file location
--nodoc Do not include documentacion files

*Info display options*

-d<0|1|2> Set debug level
-si Run an interactive install command
--showinstall=<yes|no> Toggle interactive install command
-ss Run an interactive Slackware installation script
--showslack=<yes|no> Toggle interactive Slackware installation script

*Package tuning options*

--autodoinst=<yes|no> Toggle the creation of a doinst.sh script
--strip=<yes|no> Strip any ELF binaries found inside the package
--stripso=<yes|no> Strip any ELF binary libraries (.so files)
--addso=<yes|no> Search for any shared libs and add
them to /etc/ld.so.conf
--reset-uids=<yes|no> Reset perms for all files/dirs to 755 aand
the owner/group for all dirs to root.root
--gzman=<yes|no> Compress any man pages found inside the package
--docdir=<path> Where to put documentation files
--umask=<mask> Set the umask value
--exclude=<file|dir[,...]> Exclude these files/directories from the package
--include=<listfile> Force the inclusion in the package of the
files/dirs listed in "listfile"
--inspect Inspect the package's file list
--review-spec Review the spec file before creating a .rpm
--review-control Review the control file before creating a .deb
--newslack Use the new (8.1+) Slackware description format
("--newslack" implies "-S")
--with-tar=/path/to/tar Manually set the path to the tar binary
in this system

*Cleanup options*

--deldoc=<yes|no> Delete doc-pak upon termination
--deldesc=<yes|no> Delete description-pak upon termination
--delspec=<yes|no> Delete spec file upon termination
--bk Backup any overwritten files
--backup=<yes|no> Toggle backup

*About CheckInstall*

--help, -h Show this message
--copyright Show Copyright information
--version Show version information


== 3.3 == Native Language Support

Checkinstall now uses GNU gettext to support native language translation of
all messages sent to the terminal. Set your LC_ALL variable to your
ISO-639 language and ISO-3166 country codes. For example, to set spanish and
Mexico you would use:

export LC_ALL=es_MX


Translators needed!

Please read the file NLS_SUPPORT for information on how to translate
checkinstall if your language is not already supported.

The supported languages so far are:

o English
o Spanish


====== 4. Notes ======

So far I've seen -or heard of- checkinstall running and building packages
in these distributions/operating systems:

o Slackware 7.x/8.x,9.x
o RedHat 6.2/7.x/8.x
o SuSe 7.x/8.x/9.x
o Mandrake 7.x/8.x/9.x
o Gentoo Linux
o Solaris (version?)
o Debian 2.x/3.0

In x86, ppc, sparc and arm, BTW.

If you have succesfully used checkinstall in some other distro I'd really
appreciate if you let me know =).

CheckInstall currently is unable to track any file system changes made by
statically linked programs. This is being worked on and I hope to have it ready
in a couple of weeks or so. Then again, it could be a couple of months, but the
important thing is that it will be ready soon ;).

NOTE ON SUID/SGID PROGRAMS: CheckInstall can't track their actions because of
some limitations in the LD_PRELOAD system that installwatch uses. This is
good for security reasons, but it can generate unexpected results when
the installation process uses SUID/SGID binaries.

So, before asking questions about some files not being included in your
package, check the binaries that you're using ;-).

SLACKWARE 8.0 USERS:

Slack8.0 ships with a statically linked "ln", so any symlinks your installation
process creates WON'T be detected nor included in your package. The way to
fix this is to substitute your static "ln" for a dynamically linked one, like
the one from a Slackware 7.x installation. There's link to download it
from the CheckInstall's homepage.

Debian support is now included!

UPDATE jan-18-2001: RPM support is already in place, inst2rpm supplied the
template for the mini-spec file used by checkinstall. Thanks to
Jon A. Christopher for writing it.

Another thing in the works is the addition of a friendlier interface based on
the dialog tool (which will give us curses-like character based menus AND X11
graphical menus at no extra cost =) )

There are some extra features planned like package updating, automated friendly
installation process going from extracting the files to the installation
including configure options, build, etc.

Sometime in the future I will rewrite this in C/Gtk or something, too.

Ideas, bug reports, patches, etc:

* CheckInstall author: <izto at asic-linux.com.mx>

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

* CheckInstall users list: <checkinstall-list at asic-linux.com.mx>

To join the list, send an empty message to:

<checkinstall-list-subscribe at asic-linux.com.mx>

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

* CheckInstall developers list: <checkinstall-devel at asic-linux.com.mx>

To join the list, send an empty message to:

<checkinstall-devel-subscribe at asic-linux.com.mx>


==========
$Id: README,v 1.6.0.6 2004/12/01 21:36:17 izto Exp $

checkinstall使用详解

制作你自己的slackware软件包--checkinstall使用详解

checkinstall的简介请看realhyg的帖子:
http://www.linuxsir.org/bbs/showthread.php?s=&threadid=67811

checkinstall现在的最新版本是1.6.0beta2,稳定版本是1.5.3,可以到
http://asic-linux.com.mx/~izto/checkinstall/download.php
下载pkg包。
下载下来的文件为checkinstall-1.5.3-i386-1.tgz,请用installpkg 安装。

下面以zhcon为例,说明制作的过程。

tar zxvf zhcon-0.2.3.tar
cd zhcon-0.2.3
./configure
make

上面这几步同从源代码编译安装一样,如果不用checkinstall制作slackware软件包,下一步该是make install了。我们要用checkinstall,所以用执行checkinstall代替。

在运行checkinstall之前,要在当前目录下创建一个对这个软件包的描述文件description-pak,但这个文件不是必须的。

cat > description-pak
zhcon-0.2.3
Zhcon is a fast Linux Console Chinese System which supports
framebuffer device.It can display Chinese, Japanese or Korean
double byte characters.Supported language encodings include:
GB2312, GBK, BIG5, JIS and KSC.

另外还可以在当前目录下创建4个特殊的脚本文件preinstall-pak, postinstall-pak, preremove-pak和postremove-pak。
preinstall-pak在被安装之前执行,postinstall-pak在被安装之后执行,preremove-pak在被删除之前执行,postremove-pak在被删除之后执行。同样,这4个脚本文件不是必须的。
如果要制作的软件有一些特殊的要求,比如创建一个特殊的用户或者组,这4个脚本就有作用了。

然后在当前目录下创建一个doc-pak的目录,这个目录是用来存放软件的相关文档的。比如说README, INSTALL, COPYING, Changelog, TODO, CREDITS等文件。这些文件在安装软件包时将被拷到/usr/doc/”软件包名称“目录下。如果你现在不创建,在生成软件包时将提醒你是否创建这个目录和拷贝相关文件,如果你再选择否,那么制作的软件包将没有文档。

下面开始用checkinstall创建软件包了,在执行之前确保你是root用户。执行checkinstall。

checkinstall

如果开始你没有创建doc-pak目录,此时将会提示你是否创建。

The package documentation directory ./doc-pak does not exist.
Should I create a default set of package docs? [y]:

按y自动创建和拷贝,按n取消。
下面checkinstall将创建安装软件包,checkinstall默认安装命令是 make install,你得根据你的软件安装说明具体而定,有些软件的安装命令不是make install,而是其他,你则换成

checkinstall make modules_install
checkinstall install.sh
checkinstall setup

等形式。这样,我们也可以把一些以二进制包发布的软件用checkinstall创建为slackware的软件包,只要再checkinstall后面加上安装指令作为参数即可。
下一步checkinstall将会询问创建什么软件包,

Please choose the packaging method you want to use.
Slackware [S], RPM [R] or Debian [D]?

选择s创建slackware的pkg软件包,选r创建redhat的rpm软件包,选d创建debian的deb软件包。我们选择s继续。

This package will be built according to these values:

1 - Summary: [ zhcon-0.2.3 ]
2 - Name: [ zhcon ]
3 - Version: [ 0.2.3 ]
4 - Release: [ 1 ]
5 - License: [ GPL ]
6 - Group: [ Applications/System ]
7 - Architecture: [ i386 ]
8 - Source location: [ zhcon-0.2.3 ]
9 - Alternate source location: [ ]

Enter a number to change any of them or press ENTER to continue:

checkinstall给出一个菜单让你选择修改软件包的一些属性,想修改就按对应的数字键,否则回车继续。我们按7修改软件包的系统平台,

Enter the architecture type:
>> i686

This package will be built according to these values:

1 - Summary: [ zhcon-0.2.3 ]
2 - Name: [ zhcon ]
3 - Version: [ 0.2.3 ]
4 - Release: [ 1 ]
5 - License: [ GPL ]
6 - Group: [ Applications/System ]
7 - Architecture: [ i686 ]
8 - Source location: [ zhcon-0.2.3 ]
9 - Alternate source location: [ ]

Enter a number to change any of them or press ENTER to continue:

然后回车继续,checkinstall将会在当前目录生成制作好的pkg软件包并安装它。
我们的软件包创建到此成功结束。

FanX/SLAX相关文档之一,slax中的模块

FanX/SLAX相关文档之一,slax中的模块
模块的制作
对slax4系列
0.建议先将软件包安装到系统后尝试在控制台启动软件查看运行状态,确保没有问题后再进一步制作模块。如果是缺少某些库文件,请想办法将其找到,并复制到对应的目录中。
1.如果是单个的tgz包做模块,直接使用tgz2img some.tgz some.img即可。
2.如果想要尝试rpm包,首先将其转换成tgz包,用rpm2tgz some.rpm,然后同1。
3.如果是源码包请先到其它平台上编译成二进制包,最好是在slackware对应版本的平台。
4.如果制作的模块涉及到多个软件包,那就先用installpkg的-root参数将所有tgz包安装到一个特定目录下的data文件夹内,这个data文件夹是必不可少的。
installpkg -root /tmp/modules/data *.tgz
5.然后到data文件夹中删除不需要的东西,比如所有的include文件夹,其它国家的locale等等,能删的就删,还需要做的更改都在这里完成。
6.到tmp下目录下运行 dir2img modules /tmp/mymodule.img 即可
7.为了方便以后使用,可以将整理好的目录制作成tgz包供以后使用
在data目录下运行 makepkg mypack.tgz 素有问题都回答yes即可(回答no也可)

对slax5来说,data文件夹是没有必要的,其它都类似。不过slax5的模块是后缀为mo的文件 ,命令也是像tgz2mo,dir2mo这样。
img模块可以转换为mo模块,用img2mo 命令

模块的使用
在光盘目录base和modules文件夹中的所有模块在系统启动时会自动加载
在optional文件夹中的模块需要在光盘启动出现boot:时输入 slax mymodule.img来启用模块
其它地方的模块可以在运行的系统中使用,4系列的模块用moduse命令,5系列用uselivemod命令。
4系列中,moduse只能在livecd中使用,5系列中尚不明确。

原文的地址: http://www.linuxfans.org/nuke/modules.php?name=Forums&file=viewtopic&t=1...

Frankie Live CD 简要制作过程

Frankie Linux 简要制作过程

准备: slackware 10.2, linux-live scripts, goblinx livecd, bootsplash,frankielinux 3

首先,安装最小化的slackware,不包括X,仅仅是能够运行的最小化的linux。
然后安装bootsplash的slackware包,需要给内核打补丁,内核的配置与slax类似(这里比较麻烦,需要2.6的内核,而且又不能装太多东西,我是先安装了完全的slacware,升级kernel为2.6,打bootsplash补丁,重编kernel,然后这个系统就被格式化了,只保留了vmlinuz这个内核),把制作好的bootsplash生成initrd放在boot里面。
安装linux-live脚本。
运行frankielinux3,从goblinx中提取rc.*,进行修改,主要是为了像goblinx那样自动加载nVidia或Ati的驱动,同时也不用自己添加bootsplash的progress [int],这样的控制滚动条的命令了,另外由于我使用的脚本有bug(不能自动建立/root目录,而goblinx也有同样问题,而goblinx的作者通过别的办法,结局了这个问题,就是把root压缩为root.tar.gz,然后自动解开)。同时发现goblinx改变了终端文本的颜色(意外收获)。
用修改后的rc.*替换原有的文件,同时清理/var/log中的日志。
使用dir2mo将先前安装好的基本的系统生成mo文件。

把xfce和依赖的包tgz2mo成mo文件,把这些mo文件用mo2dir到同一个目录A,修改定制内容(如壁纸),最后用mo2dir把目录A生成mo文件。

kde模块制作类似。

将前面bootsplash生成的initrd cat到linux-live生成的initrd上面,重新压缩成.gz文件。

需要注意的问题:尽量使用来自slackware 10.2的包,以避免以外的问题。

以上只是粗略的过程,在具体制作中还会出现很多细节情况,但都不是很困难的,比较容易解决。可能制作方式有点bt,可能和我的洁癖有关,不好意思。

slax 5.1.6以后版本real模式的硬盘安装

本文的内容来自slax.org的论坛中,wjping119翻译了一下.

slax 5.1.6 5.1.7 5.1.8中,"kmdr-executor /usr/share/slax/slax-install.kmde" 不能完成以real模式的安装, "make_disk.sh" 只提供live模式的安装,所以只有用手动方式完成以real模式的硬盘安装了。

假定你的hda1中安装了windows xp,并且还有足够的空闲空间hda2(等于大于1GB) 完成slax的硬盘安装。

1. 从CD启动,用账号root密码toor登录系统并启动到kde下(如果不能正常启动到kde下请先运行xconf命令后再startx),启动konsole并运行
mkfs.ext2 /dev/hda2 //这里用ext3也行
如果你的内存等于大于512MB,而且仅仅用于桌面应用,那么建立一个swap分区意义不大,我一般不用swap。
mkdir /mnt/hda2
mount /dev/hda2 /mnt/hda2

2. 下载 从slax.org的模块下载栏下载"grub" 模块或者到linuxpackages.net下载grub的tgz包,我们准备用grub来引导,lilo的引导稍候奉上。模块双击即可使用,tgz包用命令installpkg grub*.tgz安装,运行grub-install命令检验grub是否可用。
3.在konsole中运行下面的命令:
cp --preserve -R /{bin,dev,etc,home,lib,root,sbin,usr,var,opt} /mnt/hda3
mkdir /mnt/hda3/{boot,mnt,proc,sys,tmp}
cp /boot/boot/vmlinuz /mnt/hda2/boot

3. 安装grub
mount -t proc proc /mnt/hda3/proc
mount --bind /dev /mnt/hda3/dev

grub-install --root-directory=/mnt/hda2 /dev/hda

用kedit或者kwrite编辑/mnt/hda2/boot/grub/下的menu.lst
内容如下:

#####################################
# Globals
default 1
fallback 0
color white/blue black/light-gray
#####################################
#windows
title windows
chainloader (hd0,0)+1
# Linux kernels
title Slax
root (hd0,1)
kernel /boot/vmlinuz max_loop=255 init=linuxrc root=/dev/hda2

安装后可能声卡没有声音,运行alsaconf重新,alsamixer调节音量,alsactl store保存配置。

slax linux引导盘与dos引导盘的整合

  近来一直帮朋友安装系统,开始在安装的时候都是帮朋友重新分区,我的习惯一直是从硬盘安装windows系统,而且在WINDOWS的系统盘上保留DOS,这样方便以后的恢复。可是手头的工具盘已经很破了,都是4年前做的DOS引导光盘。
  后来看到slax linux的引导光盘很不错,小巧,速度也快,slax linux是从slackware linux裁减而来,系统的配置类似freebsd,这是我选择它的一个非常重要的原因。就想能否把dos和slax整合在一起,这样也可以快速分区, format分区,同时可以利用linux来利用网络连接其它的计算机。
     想到就动手开始干了,把最新的slax linux光盘下载下来,才50多兆,然后使用winrar解压这个iso文件,整个的光盘目录就出来了。发现slax 用的是syslinux来做启动,查了些资料,syslinux可以引导dos软盘镜像的。不过需要memdisk,这个文件是在内存中虚拟一个磁盘,把dos的img文件放在虚拟磁盘上执行的。在slax的modules里有syslinux的模块包下载,操作步骤如下:
1.将下载的syslinux.mo放在解压后的modules中
2.进入DOS提示符,敲入make_iso c:\slax.iso
3.利用vmplayer来加载这个光盘镜像,启动slax
4.进入虚拟机的linux,配置好网络,利用find -name "memdisk"找到memdisk文件。
5.在虚拟机中利用FTP上传或者在WINDOWS下利用FTP从虚拟机中下载这个文件。
将memdisk放在解压后的光盘根目录,然后把找到的dos7.1工具盘镜像(dos.img)放在boot目录下,修改isolinux.cfg,改为如下的形式:

display boot/splash.cfg
default dos
prompt 1
timeout 40
F1 boot/splash.txt
F2 boot/splash2.txt
F3 boot/splash.cfg
label dos
kernel memdisk
append initrd=boot/dos.img

label slax
kernel boot/vmlinuz
append vga=769 changes=slaxsave.dat max_loop=255 initrd=boot/initrd.gz init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=4444 root=/dev/ram0 rw

label memtest
kernel boot/memtest

  修改好文件以后,需要对当前的slax进行扩充,下载了python(方便以后利用它来写些小的使用程序),namp(做网络扫描),tcpdump (网络监听),vim(非常棒的编辑器),vsftpd(FTP服务软件),这些都是以二进制模块的方式放在modules文件夹下,还需要一个好用的 FTP客户端软件,自我感觉lftp不错,可是slax的网站上没有提供这个软件的mo文件。看了下文档,发现可以利用slackware的tgz安装包来直接制做,到slackware的网站下载了lftp的tgz,在vmplayer里启动slax.iso文件,下载到系统里,使用tgz2mo就可以转换过来了,然后上传到windows系统里,把转换好的lftp.mo文件放在modules文件下。 
  现在slax下的软件已经备齐了,顺便把DOS下的DM分区工具,ghost工具也全部拷贝到了这个文件夹里。好了,一切就绪,在WINDOWS的 DOS命令符下敲入make_iso c:\slax.iso,一张整合了DOS启动盘,扩展的slax光盘就出来了,按照上面的配置,默认是启动到dos的,我们也可以在提示符下敲入 slax来启动linux,如果进入了dos,可以切到光盘的盘符,假设光盘盘符为C: ,那么做如下操作:

A:\>c:
c:\>cd boot\DOS
c:\boot\DOS\>linux

我们的slax又照样的启动起来了。
整个光盘的目录如下:

│  COPYING
│  LICENSE
│  README
│  autorun.inf
│  changelog.txt
│  cheatcodes.txt
│  filelist.txt
│  livecd.sgn
│  make_disk.bat
│  make_disk.sh
│  make_iso.bat
│  make_iso.sh
│  requirements.txt
│  slaxsave.zip
│  unionfs.html
│  memdisk
│  isolinux.cfg
│  vim.exe
│  
├─base
│      01_kernel.mo
│      02_core.mo
│      03_frodo.mo
│      
├─boot
│  │  initrd.gz
│  │  isolinux.bi_
│  │  isolinux.bin
│  │  isolinux.boot
│  │  memtest
│  │  slax.ico
│  │  splash.cfg
│  │  splash.lss
│  │  splash.txt
│  │  splash2.txt
│  │  vmlinuz
│  │  dos.img
│  │  
│  └─DOS
│          config
│          linux.bat
│          loadlin.exe
│          readme.txt
│         
├─devel
│      slax-build-5.1.8.tar.gz
│      
├─modules
│      Tcpdump_3_9_3.mo
│      Vim_6_3_078.mo
│      nmap_4_11.mo
│      Python_2_4_3.mo
│      vsftpd_2_0_4_i486_1.mo
│      UnRAR_3_6_8.mo
│      bzip2_1_0_3.mo
│      lftp-3.5.4.mo
│      
├─optional
├─rootcopy
│  └─usr
│      └─share
│          └─vim
│                  vimrc
│                  
├─tools
│  │  README
│  │  deb2mo
│  │  dir2mo
│  │  img2mo
│  │  liblinuxlive
│  │  mksquashfs
│  │  mo2dir
│  │  tgz2mo
│  │  unionctl
│  │  uniondbg
│  │  unsquashfs
│  │  uselivemod
│  │  
│  └─WIN
│          config
│          cygwin1.dll
│          mkisofs.exe
│          syslinux.cfg
│          syslinux.exe
│         
└─DM
        DDLOADER.BIN
        DM.COM
        DM.OVL
        DM1.EXE
        DM1.HLP
        DM1.REC
        INI13.exe
        INT13.386
        ONTRACKD.SYS
        ONTRACKW.386
        XBIOS.OVL

  一张功能强大的启动光盘就出来了,一共只有73兆。

来源:http://bbs.chinaunix.net/viewthread.php?tid=852459 

Slax中模块的建立,修改和操作的技巧

MO:Slax Module是slax特有的添加程序的方法,它使用了SQUASHFS(一个压缩的文件系统)来存储文件.掌握了它的制作,就能完全自制SLAX.

1.如果你要查询哪个文件或哪个目录属于哪个mo文件,请到/mnt/live/memory查找(Slax自带).
2.把Slackware的tgz安装包转换成mo:

代码:
tgz2mo application.tgz application.mo


3.在修改安装包之后建立模块:

代码:
installpkg -root /tmp/package application.tgz
# 进入/tmp/package进行修改
dir2mo /tmp/package module.mo


3.修改模块:

代码:
mo2dir module.mo /tmp/directory
dir2mo /tmp/directory module.mo


4.使用模块:

代码:
uselivemod /path/module.mo

比如,自制一个mPlayer codecs mo文件:
到mplayer官方网站去下载一个ess. codes包
解压缩,建立一个文件夹
mkdir -p /tmp/package/usr/lib/win32/codecs
把所有codecs拷贝到那个目录.
最后:dir2mo /tmp/package/ codecs.mo
就完成了一个自制包

为了发扬DIY的精神,slax提供了SLAX Frodo Edition版,里面只样最基础的SLAX库.如果有兴趣的话,可以自定义出什么SLAX Gnome, SLAX Server, SLAX Hacker Edition出来!

原文地址:

 http://www.linuxfans.org/nuke/modules.php?name=Forums&file=viewtopic&t=126664

Slax完全手动安装视频教程

下载

SLAX的启动参数

启动参数(又叫欺骗代码)被用来影响SLAX的启动过程。其中的一部分启动参数对其它的Linux也是一样适用的,但是一些却只是被SLAX来使用,你能够使用这些参数禁止不想进行的硬件侦测、从硬盘启动SLAX、跳过登录界面和手工用startx来启动GUI等等。

重启你的电脑,等候几秒钟直到出现漂亮的slax标志界面(一般会少于5秒),你将会看到“boot:”(不含引号)提示符,在图形标志下面(屏幕的最下方)开始迅速输入下列选项中的其中之一,或者按F1查看简明帮助。

boot: slax nohotplug

禁止几乎所有的硬件自动探测以防止启动过程中挂起,但同时你的电脑硬件将不会被探测到,你需要在启动完成登录slax后,用"pcimodules"modprobe命令来手工启动所有需要的东西。

boot: slax nopcmciaboot: slax noagpboot: slax acpi=off

跳过指定的硬件探测防止系统在启动过程中挂起。

boot: slax passwd=somepassboot: slax passwd=ask

设置root用户的密码为“somepass”或者在启动SLAX之前要求设置新密码,输入的密码不会显示在登录屏幕上。

boot: slax copy2ramboot: slax toram

复制所有的文件(所有必须的和可选择启动的模块)到RAM中,这至少需要384MBRAM才能使用这个启动参数。这将会使SLAX的启动速度变慢(要复制所有文件,这需要一定的时间),但是一旦启动进去以后你会发现SLAX的运行速度会相当快。如果只想载入想要的模块或者不想载入某些模块的情况下,可以搭配noload 启动参数。

boot: slax changes=/dev/device

这个启动选项将会把你对运行中的SLAX所做的所有更改保存到指定的设备。但是使用此启动选项你需要告知SLAX使用不同的设备来储存更改。你可以将一个分区比如/dev/hda1格式化为一个Linux分区,然后你就可以用 changes=/dev/hda1 来保存所有更改到这个分区中。用这种方法在系统启动后就不会丢失所作的更改了。

boot: slax ramsize=60%

你对slax做的所有更改将会保存在内存中,但是默认情况下,slax不会使用超过60% 的内存来保存更改,下载的文件等等。剩余的内存将不会被用来保存文件,以便有充足的空间来运行程序,你可以使用一个百分数值来指定使用的内存(比如 ramsize=80%)或者使用一个容量值来指定内存的使用(比如ramsize=100M).

boot: slax load=moduleboot: slax load=module[1];module[n]

optional文件夹中加载模块,你可以使用模块的全文件名 (module.lzm) 也可以忽略模块文件的扩展名,甚至可以使用*来匹配一个或者多个字符。例如,可以使用 load=wine* 来加载所有文件名以wine开头的模块,比如wine-hq.lzm, wine123.lzm等等。

boot: slax noload=moduleboot: slax noload=module[1];module[n]

不挂载指定的模块,这个启动参数涉及SLAX CD中的所有模块,包括/base/modules,因此,使用 noload=*kde* 将会禁止载入所有名字中带有连续字符串“kde”的模块,这对使用copy2ram 启动参数特别有用,因为不使用的模块可以不用复制到ram.

boot: slax autoexec=...boot: slax autoexec=startxboot: slax autoexec=xconf;startx

执行指定的命令来代替SLAX的登录。在上面的例子中,系统将跳过SLAX的登录并自动执行startx,不同的命令用分号隔开按顺序执行。

boot: slax debug

启动调试模式(start bash several times during the boot). Hit Ctrl+D to continue booting

boot: slax floppy

启动在启动过程中自动挂载软驱,这个个启动参数同样可以读取由configsave保存到软盘的系统配置。

slax noguest

不允许guest用户登录

boot: slax webconfig=passphraseboot: slax webconfig=ask

启动SLAX webconfig 功能,这个功能允许你将对SLAX的更改保存到SLAX的网站上。

boot: memtest

mentest测试RAM(不启动SLAX)

『转贴』Slax的本地化

linuxsir.org上slackware板块关于slax的本地化帖子,很不错转来大家看看。有问题一起来探讨。作者liquid_zigong 原贴地址在 http://www.linuxsir.org/bbs/showthread.php?t=210970

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

Slax的本地化:一个在移动硬盘上的Linux中文套件

Slax是一个基于Slackware而形成的套件,它的主要用途是Linux桌面应用,而且支持LiveCD和LiveUSB.它预装的是 Kde3.4.1和KWord(KOffice中的字处理器).它的桌面简洁大方,速度很快.又十分方便.所以我将用它来实现一个中文化的U盘Linux 套件.

http://www.linuxsir.org/bbs/attachm...tid=27736&stc=1

1.U盘启动的方式选择

U盘的启动方式有许多种,其中主要有[USB-HDD], [USB-FD], [USB-CDROM].对于我的IBM 40GB移动硬盘来说, [USB-HDD]是正确的.大家知道,硬盘有分区表,而软盘没有分区表.而[USB-HDD]方式就是从U盘分区表中读出引导记录从而完成启动.所以, 大多数的U盘应选择[USB-HDD]方式启动.

2. 如何从U盘启动

我选择syslinux而不是lilo或grub.经过我的个人的兼容性测试,lilo不能在相当一部分计算机上成功引导,而grub似乎完全不能从 USB上工作.于是我选择了syslinux,一个工作在FAT16上的引导器.
注意:syslinux 不能工作在FAT32的分区上,而且分区大小不能超过128M.原因是多数计算机BIOS使用的INT13调用不能处理超过一定大小的分区.于是我的移动硬盘就如此分区:第一个分区(SDA1)只有128M,而且是 FAT16.第二个分区(SDA5)和第三分区(SDA6)就有20G.
这是分区的详细信息:

代码:
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 6 FAT16
/dev/sda2 14 4863 38957625 f W95 Ext'd (LBA)
/dev/sda5 14 2435 19454683+ b W95 FAT32
/dev/sda6 2436 4863 19502878+ b W95 FAT3

*
安装方法

在建立文件系统之后, syslinux /dev/sda1(Linux下要求解除挂载)或syslinux iWin98下i盘是第一个分区).

在第一个分区/dev/sda1下建立一个SYSlinux.cfg内容如下:

代码:
prompt 1
timeout 300
display SYSlinux.msg
default slax

label slax
kernel vmlinuz
append root=/dev/ram0 rw initrd=initrd.gz init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=4444 max_loop=255 nocd

内容的意义就是使用vmlinuz和initrd.gz引导.另外你可自定义同目录下SYSlinux.msg的内容,这个信息将在启动时被显示:
Welcome to Slax Chinese Version!

3. 安装Slax

从http://slax.linux-live.org/download.php下载Slax Standard Edition.这个版本里有KDE3.4,kmplayer,一个KDE的音频播放器和KWord,还有K征服者用来上网.
典型界面

1. 使用指令:"mount -o loop slax-5.0.6.iso /mnt/cdrom",把ISO文件挂载到/mnt/cdrom目录,进入/mnt/cdrom/boot目录,复制vmlinuz和 initrd.gz文件到/mnt/sda1(移动硬盘的第一个分区,以后省略说明).
2. 在/mnt/sda5中建立目录slax,把/mnt/cdrom下所有文件和目录复制到/mnt/sda5/slax:cp -rf /mnt/cdrom/* /mnt/sda5/slax/

这就完成安装.

4.
本地化

先介绍下如何在Slax上安装自定义软件:
Slax的SQUASHFS
SQUASHFS是一个实行压缩的文件系统.Slax使用它来安装根目录.在base目录中,slax有一些基本的mo(SQUASHFS映象文件扩展名)文件.如KDE,X,基础库等等.如果你要查询哪个文件或哪个目录属于哪个mo文件,请到/mnt/live/memory查找(Slax自带).
Slax提供了创建,修改和使用SQUASHFS module的方法.

*
创建模块

*

把Slackware的tgz安装包转换成mo:tgz2mo application.tgz application.mo

*

如果要在修改安装包之后建立模块:

installpkg -root /tmp/package application.tgz

进入/tmp/package进行修改,完成后制作模块:

dir2mo /tmp/package module.mo

*
修改模块
o 将模块释放到/tmp/directory

mo2dir module.mo /tmp/directory

o 修改完之后,创建模块

dir2mo /tmp/directory module.mo

*
使用模块
o

Slax运行时挂载mo:

uselivemod /path/module.mo

o slax/modules目录中的mo文件将被自动挂载

注意:SQUASHFS有时不太稳定,要特别注意避免如下几种情况:

1. 太多层次的重叠.A文件被A.mo所拥有,新来的B.mo也有一个A文件把A.mo所覆盖.
2. 太少的内存空间,mo挂载时需要内存,模块太多内存太少时会导致一系统的问题.

开始工作
请参见Slackware的汉化工作,来做汉化工作,这里是一些不同点:

Slax-5.0.6的一个BUG:/etc/profile.d/slax.sh自作聪明的加入export LC_ALL=c,删除它.

下载firefly字体(http://cle.linux.org.tw/Slackware/s...11-noarch-1.tgz) 后,安装它,生成fc.cache和fonts.dir等等,等到万事具备时:

代码:
mkdir -p /tmp/package/usr/local/font
cp -rf /usr/local/font/* /tmp/package/usr/local/font
mo2dir /tmp/package /mnt/sda5/slax/modules/fonts.mo

安装Xorg.6.8.2-firefly版本(下载地址:http://cle.linux.org.tw/Slackware/s...1.Firefly.tgz):

代码:
installpkg --root /tmp/package x11-6.8.2-i486-1.Firefly.tgz
cd /tmp/package/etc/X11/
cp /etc/X11/xorg.conf . # 把符合你显卡配置的xorg.conf复制到这里来
cd /tmp/package
mo2dir /tmp/package /mnt/sda5/slax/modules/xorg682.mo

安装fcitx:
tgz2mo fcitx.tgz /mnt/sda5/slax/modules/fcitx.mo

安装kde-i18n-zh_CN-3.4.1-noarch-1.tgz(KDE中文化)
http://ftp.cgu.edu.tw/Linux/Slackwa....1-noarch-1.tgz
tgz2mo kde-i18n-zh_CN-3.4.1-noarch-1.tgz /mnt/sda5/slax/modules/kde.mo

同样的方法,可以下载并安装XMMS,firefox,thunderbird等等.

一些细节
为了使KMplayer能播放RMVB,下载
代码:
http://www1.mplayerhq.hu/MPlayer/re...0050412.tar.bz2
tar -jxvf essential-20050412.tar.bz2
mv essential-20050412 /usr/lib/win32
rm -rf /tmp/package
mkdir -p /tmp/package/usr/lib/win32
cp -rf /usr/lib/win32/* /tmp/package/usr/lib/win32
dir2mo /tmp/package/usr/lib/win32 /mnt/sda5/slax/modules/codecs.mo

这样KMPlayer就能完美播放各种各样的视频文件

我的/etc/gtk/gtkrc.zh_CN文件:

代码:
style "gtk-default-zh-cn" {
fontset = "-adobe-helvetica-medium-r-normal--12-*-*-*-*-*-iso8859-1,\
-*-*-medium-r-normal--12-*-*-*-*-*-gbk-0,*-r-*"
}
class "GtkWidget" style "gtk-default-zh-cn"

我的profile.d/lang.sh

代码:
export LC_ALL=zh_CN.gbk
export G_BROKEN_FILENAMES=1
export XMODIFIERS="@im=fcitx"

自动启动fcitx
在/root/.kde/Autostart/中加入文件fcitx.desktop,文件内容如下:

代码:
[Desktop Entry]
Encoding=UTF-8
Name=fcitx
Name[zh_CN]=fcitx
GenericName=输入法
Exec=fcitx
Icon=fcitx
Type=Application
Terminal=0
X-KDE-StartupNotify=false
X-KDE-AuthorizeAction=shell_access

这是一个成品,上网,听MP3,可以中文输入.

利用GRUB4DOS制作可启动光盘

在GRUB中,可以利用 stage2_eltorito 来制作启动光盘:

mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o grub.iso iso

stage2_eltorito和menu.lst应该放在光盘的/boot/grub目录里。

在GRUB4DOS中,可以利用 grldr 来制作启动光盘。制作方法有两种:

mkisofs -R -b grldr -no-emul-boot -boot-load-seg 0x1000 -o bootable.iso iso_root

mkisofs -R -b grldr -no-emul-boot -boot-load-size 4 -o grldr.iso iso_root

grldr和menu.lst应该放在光盘的根目录里。

第一种方法告诉 BIOS,希望它能够装入整个 GRLDR 文件到内存。装入内存后,BIOS 还应该正确设置堆栈,使得不至于把堆栈设置到 GRLDR 的程序体内,造成冲突。一般情况下,BIOS 做到这一点很容易,因为它可以设置堆栈指针为装入的起始地址。但也不排除存在 BUGGY BIOS 的可能性。

有些 BIOS 不完全符合可启动的 CDROM 规范,比如 VirtualPC 的就是的。这类 BIOS 只是装入了一部分 GRLDR 扇区到内存,典型的可能只装入了一个扇区(2048 字节的大扇区)到内存。不过我们的代码已经替这些 BUGGY BIOS 打了补丁。只要这些 BIOS 能够设置正确的堆栈,不至于和装入内存中的 GRLDR 扇区数据产生冲突就 OK 了。

也就是说,上述第一种制作光盘的方法,应该没有多大问题了。这种方法很有可能适应于所有的 BIOS。

第二种方法本身就只要求 BIOS 装入一个 CDROM 扇区到内存(等同于 4 个 512 字节的小扇区)。这种方法是最保守的,没有理由会失败了。微软的 win2000 启动光盘就是这么做的,isolinux 和 stage2_eltorito 也都是这么做的。如果这种方法失败了,那么 win2000,isolinux 和 stage2_eltorito 应该都会失败的。

对于第二种方法,我们不需要 -boot-info-table 这个参数。但是允许你用这个参数(用了和没用是一样的,我们的引导代码将忽略由这个参数所传递的数据结构)。

对于第一种方法也一样,不需要 -boot-info-table 这个参数,同时也是允许你用这个参数(用了和没用是一样的,我们的引导代码将忽略由这个参数所传递的数据结构)。

这样,stage2_eltorito 就可以完全用 grldr 来代替了。

http://grub4dos.sourceforge.net/wiki

制作整合Fanx和WINPE的U盘

制作整合Fanx和WINPE的U盘作者:BILLYKANE 来源:www.linuxfans.org 场面话就不说了,呵呵,新手的新贴。 step1:首先将U盘制成dos启动盘。本人对linux下如何制作可启动U盘不熟,所以使用windows下制作工具,在这里我采用liubenBootU,将U盘制作成可启动DOS启动盘,当然你也可以使用HPUSBFW.EXE等工具,这并不唯一,只要保证U盘可以启动就行。对于将U盘究竟格式成zip还是hdd,这根据你的机子状况决定。(顺便说一句,HPUSBFW.EXE网上很多人说是惠普U盘格式化工具,在这里鄙视一下,作者在关于对话框中说的清清楚楚了,是Hewlett-Packard Development Company)。格式化后,重启计算机,用制作好的U盘启动你的电脑,如果发现进入DOS了(屏幕出现a:\或c:\命令提示符),那么请进入下一步。 Step 2:安装grub for dos。下载grub for dos,将grub.exe、grubldr.sys、ntdetect.com放到U盘根目录下,建立boot\grub文件夹,拷贝Fonts.gz、memdisk.gz到此。这时应注意,之前做的U盘中的DOS应该是纯净的,就是说只有command.com、msdos.sys、io.sys三个文件。如果包含了其它dos相关文件,反而会导致grub for dos启动失败。 Step 3:配置grub启动。首先是启动grub。通常的做法是将grub写入到autoexec.bat文件中,但是经过笔者验证,发现这并不是好办法,由于各主办厂家对U盘启动的处理方式不同,导致U盘格式并不确定,本人有两台机子,正好是走了两个极端,一台始终将U盘认为是zip格式,也就是说u盘启动的dos时屏幕出现a:\,另一台则始终将U盘认为是hdd格式,也就是说u盘启动的dos时屏幕出现c:\。由于这些情况,致使grub寻找menu.lst困难,故本人写了两个bat文件,其一a.bat,内容如下: grub --config-file=(fd0)/menu.lst 其二c.bat,内容如下: grub --config-file=/menu.lst。 a.bat对应u盘启动的dos时屏幕出现a:\的情况,c.bat对应u盘启动的dos时屏幕出现c:\的情况。我的menu.lst放在U盘根目录下,当然你也可以放在别处,这由您自己决定,只要对应修改上述文件中路径即可。 U盘根目录下文件
U盘根目录下文件
fanx目录下文件
fanx目录下文件
/boot/grub下文件
/boot/grub下文件
Step 4:安装fanx。根据以上步骤,相信大家应该猜到我的安装方式了,没错,是PMI,我的fanx版本是1.2rc。这里在U盘根目录下建立fanx目录,复制fanx整张光盘文件到此。当然,为减小体积,您可以删除一些与系统无关的文件(如isolinux的文件等)。这是就开始写menu.lst文件了。参照光盘里的isolinux.cfg文件,grub添加如下语句: title Boot from Fanx Linux kernel /fanx/vmlinuz append root=/dev/ram0 rw init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=7777 max_loop=255 livecd_subdir=/fanx/ initrd /fanx/initrd.gz 其中kernel /fanx/vmlinuz和initrd /fanx/initrd.gz根据您的文件位置自己修改。这样就完成了fanx的安装。 Step 5:安装winpe。对于一个256M的U盘来说,fanx已经占用了近200M空间,再想安装大一点的深山红叶等PE实属困难,故我使用无忧启动论坛中老九制作的PE,最小的有20多M,您可以根据自身需要再加入一些工具,这里请恕不在赘述。下载老九的winpe.is_文件。同时下载avldr.xpe、peldr、winnt.xpe等启动文件拷贝至U盘根目录下,menu.lst加入: title Boot from pe chainloader /peldr boot 大功告成。当然U盘还剩余一点空间,这里你可以充分利用空间,比如说我就找了个WIN98还有MenuetOS以及Dos、qnx放进U盘玩。 最终我menu.lst如下: timeout 30 default 0 splashimage /boot/grub/splash.xpm.gz fontfile /boot/grub/Fonts.gz title 从 WinPE迷你系统 启动(Boot from Mini WinPe) chainloader /peldr boot title 从 Fanx Linux迷你系统(Boot from Fanx Linux) kernel /fanx/vmlinuz append root=/dev/ram0 rw init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=7777 max_loop=255 livecd_subdir=/fanx/ initrd /fanx/initrd.gz title 从 Mini Win98 启动 ( Boot from Mini Win98 ) kernel /BOOT/GRUB/MEMDISK.GZ initrd /BOOT/GRUB/win98.zip title 从 Dos 启动 ( Boot from Dos ) kernel /boot/grub/memdisk.gz initrd /boot/grub/dos.zip title 从 MenuetOS for 32位CPU 启动 ( Boot from MenuetOS for 32) kernel /boot/grub/memdisk.gz initrd /boot/grub/mos.zip title 从 MenuetOS for 64位CPU 启动 ( Boot from MenuetOS for 64) kernel /boot/grub/memdisk.gz initrd /boot/grub/mos64.zip title 从 qnx 启动 ( Boot from qnx ) kernel /boot/grub/memdisk.gz initrd /boot/grub/qnx.zip title 重新启动电脑(Restart Your Computer) reboot title 关闭计算机(Shut Down Your Computer) halt

另一篇checkinstall的文章

CheckInstall

摘要:

Checkinstall 是一个能从 tar.gz类的源代码自动生成RPM/Debian或Slackware安装包的程序。这样使你能用几乎所有的 tar.gz 类的源代码生成“干净”的安装或者卸载包。

简介

经常出现这样的问题:你很想试用的程序只有 tar.gz的源代码可用(没人提供 rpm 或者 Debian包)。这样,你只好下载回源代码,解压,然后手动编译。到目前为止,一切正常。然而,当你想删掉它的时候呢?

Makefile文件只包括了很少情况下的卸载例程。当然,你可以把程序安装到临时文件夹,然后记下所有由程序生成或修改的文件,最后删除他们。但是如果这个程序要经常重新编译,那样做是非常痛苦的,工作量也是相当大的。 Felipe Eduardo所写的 CheckInstall [1] Sánchez Díaz Durán 就是用来解决这个问题的。

一般说来,我们编译安 装一个由GNU Autoconf配置的程序是采用如下的步骤:
./configure && make && make install.
这个 configure 脚本文件是用来“猜”出一系列系统相关的变量,这些变量是在后面的编译过程要用到的。它将检查系统变量值是否满足编译要求,然后使用这些变量在程序包内每个文件夹下生成 Makefile 。此外,configure 脚本还会生成其他文件,他们是:

configure脚本文件成功运行之后, 你会输入make来编译程序,得到你需要的可执行文件。你也可能在make之后马上使用make check来运行测试。但是这只是可选的步骤,因为这需要这个程序包的支持。如果 make成功的完成了,你可以使用make install来安装这个程序了——很明显,完成这步你需要一些相关权限。程序安装好了,你可以在源代码的文件夹下输入make clean来清除这些生成的可执行文件和目标文件。如果你还想删除由configure生成的文件,那么输入 then typemake distclean。后两步同make check一样(是可选的),它们通常是开发者在开发和测试阶段所使用,也可以被一般使用者用来节省硬盘空间或者保持文件夹的结构简洁明快。另外make distclean使得我们在不同类型的电脑上编译程序成为可能。

关于GNU Autoconf的详细资料可以在在线文档[2]上找到。在基本介绍之外,你可以通过写你自己的configure脚本、用M4编程和创建自己的宏等方式来学习更多有关GNU Build System的知识。

CheckInstall

前面提到,我们采用GNU Autoconf通过一系列如下指令来编译程序:

./configure && make && make install

现在该是换一种方式的时候了,你可以使用CheckInstall。它采用自己的指令checkinstall来代替make install。其他两个指令保留下来跟以前一样,因此,现在这个指令序列使用 CheckInstall变成了:

./configure && make && checkinstall

指令checkinstall不仅默认运行了make install,而且还监测所有安装过程中的写操作。为此,CheckInstall使用了Pancrazio de Mauro 所写的程序Installwatch [3]。在make install成功完成之后,CheckInstall会产生一个Slackware-, Debian- 或RPM- 安装包,然后按照软件包的默认配置安装程序,并在当前目录(或标准安装包存储目录)留下一个生成的安装包。而外,你可以通过修改变量PAK_DIR来修改保存这个目录。这样生成的安装包安装到其他机器上而无须重新编译——当然,还得考虑软件包的相互依赖性。

CheckInstall并不只是使用make install,它还可以与其他安装指令相协调。例如,如果安装指令为setup.sh,那么安装指令序列变成:

./configure && make && checkinstall setup.sh

我们还可以让CheckInstall带着很多参数运行。如下命令会显示所有可用的子参数,这些子参数大致分为:安装选项(Install options), 脚本处理选项(Scripting options), 信息显示选项(Info display options),安装包选项(Package tuning options),清除选项(Cleanup options)关于CheckInstall(About CheckInstall)等。

# checkinstall -h

如果CheckInstall带着这些参数运行,他会使用这些参数值来代替配置文件checkinstallrc中相应的值。

CheckInstall也有自己的局限之处。它不能处理静态连接的程序,因为这样Installwatch就不能监测到安装过程中修改过文件了。总体说来,有两类连接库:动态的和静态的。这些连接库通过include-指令整合到程序中。静态连接过的程序已经包含了所有需要的库文件,运行时也就不需要再将这些库载入内存中。这种程序与安装在系统中的连接库无关,因为所谓的连接器(Linker)已经在编译时把这些库内置到可执行程序里了。

安装

CheckInstall已经在大一些的发行版的“程序池”(software pools)中存在很长的时间了,可以通过发行版各自提供的安装方式安装。你也可以在主页[4]上下载各种预编译好的安装包或者合适的源码包。

CheckInstall的安装非常简单,只需要很少的步骤——但要成功的安装CheckInstall你似乎需要 CheckInstall。在必要的make install之后,你输入checkinstall,就会从编译好的程序生成合适的二进制安装包。现在,你可以使用你的安装包管理程序来“干净的”安装或者卸载了。在CheckInstall创建安装包之前,你还得必须回答一个关于程序安装包管理器的问题,并且还要检查相关信息的正确性。这些信息将会出现在稍后生成的安装包的头部。

下面将展示安装checkinstall-1.6.0beta4.tgz的全过程。这会安装上CheckInstallInstallwatchmakepak,其中makepakmakepkg的修改版。如果你对新版本的改进感兴趣,请参看Release Notes [5] 和/或 Changelog [6].

$ tar xzf checkinstall-1.6.0beta4.tgz $ cd checkinstall-1.6.0beta4 checkinstall-1.6.0beta4 $ make [...] checkinstall-1.6.0beta4 $ su Password: checkinstall-1.6.0beta4 # make install [...] checkinstall-1.6.0beta4 # checkinstall  checkinstall 1.6.0beta4, Copyright 2002 Felipe Eduardo Sanchez Diaz Duran This software is released under the GNU GPL.  Please choose the packaging method you want to use. Slackware [S], RPM [R] or Debian [D]? R  ************************************* *** RPM package creation selected *** *************************************  This package will be built according to these values:  1 -  Summary:  [ CheckInstall installations tracker, version 1.6.0beta4 ] 2 -  Name:     [ checkinstall ] 3 -  Version:  [ 1.6.0beta4 ] 4 -  Release:  [ 1 ] 5 -  License:  [ GPL ] 6 -  Group:    [ Applications/System ] 7 -  Architecture: [ i386 ] 8 -  Source location: [ checkinstall-1.6.0beta4 ] 9 -  Alternate source location: [  ] 10 - Provides: [ checkinstall ] 11 - Requires: [  ]  Enter a number to change any of them or press ENTER to continue:  Installing with make install...  ========================= Installation results ========================= [...]    ========================= Installation successful ======================  Copying documentation directory... ./ ./NLS_SUPPORT ./README ./FAQ ./TODO ./CREDITS ./INSTALL ./Changelog ./BUGS ./installwatch-0.7.0beta4/ ./installwatch-0.7.0beta4/README ./installwatch-0.7.0beta4/TODO/usr/src/redhat/RPMS/i386/checkinstall-1.6.0beta4-1.i386.rpm ./installwatch-0.7.0beta4/VERSION ./installwatch-0.7.0beta4/INSTALL ./installwatch-0.7.0beta4/CHANGELOG ./installwatch-0.7.0beta4/BUGS ./installwatch-0.7.0beta4/COPYING ./RELNOTES ./COPYING  Copying files to the temporary directory...OK  Striping ELF binaries and libraries...OK  Compressing man pages...OK  Building file list...OK  Building RPM package...OK  NOTE: The package will not be installed  Erasing temporary files...OK  Writing backup package...OK  Deleting temp dir...OK  ****************************************************************  完成。 新的安装包保存在 /usr/src/redhat/RPMS/i386/checkinstall-1.6.0beta4-1.i386.rpm 你可以在系统中随时安装它:    rpm -i checkinstall-1.6.0beta4-1.i386.rpm  ****************************************************************  checkinstall-1.6.0beta4 # cd /usr/src/redhat/RPMS/i386/ i386 # rpm -i checkinstall-1.6.0beta4-1.i386.rpm i386 # 

Debian 的用户可以使用dpkg -i来安装。 Slackware用户用 installpkg可以达到同样目的。

使用包管理程序的查询语句,你可以检查安装包中文件是否完全在程序库中记录了,还可以查看安装包头部的一些额外信息。在此,使用 RPM 作为例子:

$ rpm -qi checkinstall Name        : checkinstall            Relocations: (not relocatable) Version     : 1.6.0beta4              Vendor     : (none) Release     : 1                       Build Date : Mo 06 Dez 2004 17:05:45 CET Install Date: Di 07 Dez 2004 01:41:49 Build Host : deimos.neo5k.lan Group       : Applications/System     Source RPM : checkinstall-1.6.0beta4-1.src.rpm Size        : 264621                  License    : GPL Signature   : (none) Packager    : checkinstall-1.6.0beta4 Summary     : CheckInstall installations tracker, version 1.6.0beta4 Description : CheckInstall installations tracker, version 1.6.0beta4  CheckInstall  keeps  track of all the files created  or modified  by your installation  script  ("make install" "make install_modules",  "setup",   etc),   builds    a standard   binary   package and  installs  it  in  your system giving you the ability to uninstall it with your distribution's  standard package management  utilities. 

配置

你可以通过修改文件/usr/lib/local/checkinstall/checkinstallrcCheckInstall的默认配置。

尽管CheckInstall每次运行都会询问生成何种类型安装包,明智的办法还是手工修改/设置INSTYPE变量。看看变量INSTALLPAK_DIRRPM_FLAGS或者DPKG_FLAGS也是值得推荐的。最后两个变量允许你定义一些可选的安装标志,通过修改PAK_DIR你可以指定安装包的存储目录。而INSTALL让你决定是只生成安装包呢还是一起将这个包马上安装。

$ cat /usr/lib/local/checkinstall/checkinstallrc  ####################################################################                  #    CheckInstall configuration file   #                  ########################################  #################################################################### # These are default settings for CheckInstall, modify them as you  # # need. Remember that command line switches will override them.    # ####################################################################  # Debug level #   0: No debug #   1: Keep all temp files except the package's files #   2: Keep the package's files too  DEBUG=0  # Location of the "installwatch" program INSTALLWATCH_PREFIX="/usr/local" INSTALLWATCH=${INSTALLWATCH_PREFIX}/bin/installwatch  # Location of the makepkg program. "makepak" is the default, and is # included with checkinstall. If you want to use Slackware's native "makepkg" # then set this to "makepkg"  MAKEPKG=/sbin/makepkg  # makepkg optional flags. These are recommended if running a newer Slackware # version: "-l y -c n"  MAKEPKG_FLAGS="-l y -c n"  # Is MAKEPKG running interactively? If so, you might want # to see what it's doing:  SHOW_MAKEPKG=0  # Where will we keep our temp files? BASE_TMP_DIR=/var/tmp   ##  Don't set this to /tmp or / !!  # Where to place the installed document files DOC_DIR=""  # Default architecture type (Leave it empty to allow auto-guessing) ARCHITECTURE=""  # Default package type. Leave it empty to enable asking everytime #   S : Slackware #   R : RPM #   D : Debian  INSTYPE="R"  # Storage directory for newly created packages # By default they will be stored at the default # location defined for the package type  PAK_DIR=""  # RPM optional flags RPM_FLAGS=" --force --nodeps --replacepkgs "  # dpkg optional flags DPKG_FLAGS=""   ## These are boolean. Set them to 1 or 0  # Interactively show the results of the install command (i.e. "make install")? # This is useful for interactive installation commands SHOW_INSTALL=1  # Show Slackware package installation script while it runs? Again, useful if # it's an interactive script SHOW_SLACK_INSTALL=0  # Automatic deletion of "doc-pak" upon termination? DEL_DOCPAK=1  # Automatic deletion of the spec file? DEL_SPEC=1  # Automatic deletion of "description-pak"? DEL_DESC=1  # Automatically strip all ELF binaries? STRIP_ELF=1  # Automatically strip all ELF shared libraries? # Note: this setting will automatically be set to "0" if STRIP_ELF=0 STRIP_SO_ELF=1  # Automatically search for shared libraries and add them to /etc/ld.so.conf? # This is experimental and could mess up your dynamic loader configuration. # Use it only if you know what you are doing. ADD_SO=0  # Automatically compress all man pages? COMPRESS_MAN=1  # Set the umask to this value CKUMASK=0022  # Backup files overwritten or modified by your install command? BACKUP=1  # Write a doinst.sh file that installs your description (Slackware)? AUTODOINST=1  # Are we going to use filesystem translation? TRANSLATE=1  # Reset the owner/group of all files to root.root? RESET_UIDS=0  # Use the new (8.1+) Slackware description file format? NEW_SLACK=1  # Comma delimited list of files/directories to be ignored EXCLUDE=""  # Accept default values for all questions? ACCEPT_DEFAULT=0  # Use "-U" flag in rpm by default when installing a rpm package # This tells rpm to (U)pdate the package instead of (i)nstalling it. RPM_IU=U  # Inspect the file list before creating the package CK_INSPECT=0  # Review the .spec file before creating a .rpm REVIEW_SPEC=0  # Review the control file before creating a .deb REVIEW_CONTROL=0  # Install the package or just create it? INSTALL=0 

结论

CheckInstall是一款优秀的软件,它能使得管理Linux更加方便。特别是在源码需要经常重复编译的情况下,CheckInstall可以让你丝毫不破坏系统一致性的前提下完全的卸载程序。另外,你还可以使用这些编译好的安装包直接在其他的机器上安装(而无须重新编译!)——当然,你得考虑软件包的相互依赖性,不过,这在同类的机器上一般并不是什么问题。

Links

[1] http://asic-linux.com.mx/~izto/checkinstall/ [Home of CheckInstall]
[2] http://www.gnu.org/software/autoconf/manual/autoconf-2.57/autoconf.html [GNU Autoconf Online Manual]
或者中文的: http://littleone.go.nease.net/AutoConf.html[AutoConf 中文手册]
[3] http://asic-linux.com.mx/~izto/checkinstall/installwatch.html [Installwatch]
[4] http://asic-linux.com.mx/~izto/checkinstall/download.php [CheckInstall Downloads]
[5] http://asic-linux.com.mx/~izto/checkinstall/docs/RELNOTES [Release Notes]
[6] http://asic-linux.com.mx/~izto/checkinstall/docs/Changelog [Changelog]

在Windows下定制Slax并将Slax写入U盘详解

在Windows下使用MySlax Creator轻松制作自己的Slax ISO并将其装入256M U盘制得Slax Live USB DISK的方法

第一步:下载并安装MySlax Creator(下载地址见本站链接),双击桌面图标启动。

Welcome screen

第二步:选择光盘来源,最简单的方法是选择ISO-Default,然后找到你下载的slax ISO的路径,并点击“Mount”,如果你不想对光盘进行任何修改或者你已经修改过了,你可直接点击“USB Stick”将其写入U盘中,也可以点击“Burn this ISO” 将其刻录在可写入光盘上,当然前提是你有刻录机并安装了刻录软件。如果你想对ISO文件进行修改的话,请直接点击“Next”。

Select the source for our new ISO

第三步:你现在可以加入你做好或者下载的模块了,找到你要加入的模块,点击“Add=>”将其加入/modules中,当然你也可以把模块放在/optional和/extra中,只不过这样制作出来的ISO在使用时需要手动输入加载相应模块的参数。所以推荐你把模块放在/modules中。

Add the modules you want

第四步,移除原来ISO中的模块,我想大多数人应该是加入模块,所以这一步可以跳过去。

Remove modules if you want

第五步:调整启动参数,在这里,你可以改变诸如是否默认启动图形界面、启动时不加载声卡(还有很多可供选择)、设置密码、更换壁纸等各项操作,当然最省事的方式是什么也不改,其实也挺好的,需要注意的是如果你选择gui模式启动X的话,你将遇到是Fluxbox,而不是原本的KDE桌面。

Select some default boot options

第六步:模块和参数都弄好了,接下来就是生成ISO了,点击“Create ISO”就行了,默认的ISO文件名为原来的文件名前面加上My,当然你有权修改它的保存路径和名字。

Create your new ISO image

第七步:如果你有刻录光驱的话,你可以把它刻录到一张可写入光盘中。如果你没有,直接Next。

Burn your new ISO image

第八步:我比较喜欢把Slax装入一个256M的U盘中,前提是你有一个这么大的U盘(当然更大也是可以的),而且你的机器的主板支持从USB设备启动系统。从Select USB drive的下拉框中选择你的USB设备的盘符后,点击“Creat USB Stick”,这时候会跳出来一个让你格式化你的USB设备的提示框,默认设置是格式化成FAT32文件系统,你不用修改,直接开始就可以了,这样你的U盘还是FAT32的,仍然可以在Windows下面使用。格式化以后,写入会自动进行,稍等片刻,一个属于你自己的可以启动的Slax Live USB就搞定了,拿着这个小小的U盘你都可以在任何一台可以从USB设备启动的电脑上开始你的美妙Slax之旅,而不用考虑这台机器上有没有硬盘有没有系统,更不用管它原来装的是是Windows还是Linux。是不是很有成就感啊!拿去show吧!

Prepare your USB Stick for booting SLAX

多重启动光盘制作全面解析

一、背景资料
  我们都知道,Windows 98直到Windows XP系列的安装光盘都是可启动的,但Windows 95安装光盘却不能启动,你知道为什么吗?要想知道事情的原因,我们就必须要探寻一下可启动CD-ROM的起源。
  可启动CD-ROM(或称可引导光盘)的概念早在1994年(辉煌的DOS年代)就被提出来了,当时CD-ROM还是PC机的一个昂贵的附属设备(CD-ROM加声卡在当时被成为多媒体套件,带多媒体套件的电脑被成为多媒体电脑),而且在DOS平台下实现光盘引导还存在一些技术上的困难:要在载入 DOS之前就必须检测到CD-ROM,而这一点,当时从软件上是无法实现的,惟一的解决之道就是修改电脑主板上的BIOS(或是SCSI与IDE控制器上的BIOS),使之在硬件级而不是软件级首先识别CD-ROM,并自动加载CD-ROM上的启动引导器(存放在CD-ROM上特定区域的一段特殊代码,用以控制CD-ROM的启动)。
  1995年1月25日,Phoenix Technologies与IBM联合发表了可启动CD-ROM格式规范(Bootable CD-ROM Format Specification)1.0——El Torito规范,该规范中定义了可启动CD-ROM的数据结构与映像数据的配置及光盘制作的一些详细说明。实际上,该规范也隐含地制定了能够读取可启动 CD-ROM光盘的BIOS的规范,使得符合El Torito规范的可启动CD-ROM在电脑上能够正常启动。如果可启动CD-ROM有了,但在电脑上无法读取,岂不还是白搭?!
  随后,Phoenix又独自或联合其他厂家相继发布了一系列支持可启动CD-ROM的规范和标准,其中值得一提的是1996年1月11日 COMPAQ、Phoenix与Intel联合发布的BIOS启动规范(BIOS Boot Specification)1.01,该规范为BIOS厂家提供了制造支持可启动CD-ROM的BIOS的标准。
  El Torito规范原本参见http://www.phoenix.com/resources/specs-cdrom.pdf(英文)。
  BIOS启动规范原本参见http://www.phoenix.com/resources/specs-bbs101.pdf(英文)。
  如果你想了解更多有关El Torito的故事,比如为什么称为“El Torito”,都有谁参与了规范的起草,等等,你可以从下述文件中找到答案:
  http://www.cdpage.com/Compact_Disc_Variations/danaboot.html(英文)
  自从El Torito规范推出之后,采用单重启动映像的可启动CD-ROM大量涌现,El Torito规范也成为事实上的工业标准。
  可启动CD-ROM仍遵循ISO 9660的规范,简单地说,普通CD-ROM+开机功能=可启动CD-ROM。
  这也就是为什么Windows 95安装光盘不可启动的根本原因——Windows 95发布时El Torito规范还没有诞生。
  El Torito规范定义了CD-ROM中启动映像(bootable image)的配置,还提供了有关可启动CD-ROM的制作与结构的一些详细说明。这些说明的技术性很强,要想弄得很明白需要花费一番大力气。但我们的目的是制作出符合El Torito规范的可启动CD-ROM,所以没有必要在理论上了解那么多,很多现成的烧录软件以能够帮助我们制作出完美的单启动CD-ROM。
二、多重启动CD-ROM的工作原理
  El Torito规范中不仅定义了单重启动映像(single boot image)的配置,而且非常富有远见地定义了多重启动映像(multiple boot images)的配置。
  
图1
  图1是El Torito规范中定义的普通CD-ROM、单重启动CD-ROM和多重启动CD-ROM的启动映像配置图(图片来源:http: //www.phoenix.com/resources/specs-cdrom.pdf)。从图中可以看出,可启动CD-ROM的工作原理如下:
  BIOS首先检查光盘的第17个扇区(sector 17),查找其中的代码,若发现其中的启动记录卷描述表(Boot Record Volume Descripter),它就根据表中的地址继续查找启动目录(Booting Catalog),找到启动目录后,再根据其中描述的启动入口(Boot Entry)找到相应的启动磁盘映像(Bootable Disk Image)或启动引导文件,找到启动磁盘映像后,读取其中的数据,并执行相应的开机动作。
  相对于单重启动CD-ROM而言,多重启动CD-ROM的启动目录中包含多个启动入口,指向多个启动磁盘映像。
  图1所描述的多重启动配置是El Torito规范所描述的多重启动映像配置,但由于多重启动CD-ROM在实际工作中的应用较少,目前大多数主板的BIOS对此支持得不是很好。在这类主板上,用遵循El Torito规范所制作的多重启动CD-ROM往往只能引导第1个(默认启动出口所指向的)启动映像,而其他的启动映像莫名其妙地消失了!
  为了解决这个问题,人们又相继研究出了一些办法来实现CD-ROM的多重启动,目前最流行的办法是“非模拟”(软盘、硬盘)式BIOS模拟法。其工作原理与El Torito规范所描述的单重启动映像配置原理基本相同,只是默认启动的不是软盘映像,而是1个启动引导文件,该启动引导文件引导光盘启动,再由它去查找其他的启动磁盘映像或引导文件,根据配置文件列出启动选项共用户选择。
  目前采用这种方法的工具软件主要有3个:Diskemu、ISOLINUX/MEMDISK和Boot Scriptor。实际上,Boot Scriptor是Michael K Ter Louw在ISOLINUX的基础上二次开发的产品,但它对ISOLINUX的功能和性能都进行了非常大的扩充,与ISOLINUX的差别较大,特别是从 1.2.3b版开始引入了Diskemu,使其兼容性大大提高,所以我们将其作为第3种方法加以介绍。
  这3个软件的网址分列如下:
  Diskemu:
  http://www.nu2.nu/diskemu/
  ISOLINUX:
  http://syslinux.zytor.com/iso.php
  Boot Scriptor:
  http://www.bootscriptor.org/
三、BIOS模拟法多重启动CD-ROM的运行流程
  “非模拟”式BIOS模拟法要求有1个引导器和1套启动映像/菜单管理器。引导器必须以非模拟方式加载,即启动后不能模拟为软盘或硬盘,这是制作 BIOS模拟法多重启动CD-ROM的关键。下面以Diskemu为例简述其运行流程,ISOLINUX与Boot Scriptor的运行流程与此基本类似。
  Diskemu包含3个主要文件:
  loader.bin:启动引导器;
  diskem1x.bin:启动映像/菜单管理器;
  diskemu.cmd:默认的启动菜单配置文件,纯文本文件,需要用户手工创建。
  启动引导器loader.bin是启动目录中默认的启动入口,loader.bin将最先被加载到默认的加载地址0:7c00h。 loader.bin被加载后,首先将自己移至地址5000:0h,然后搜索光盘的根目录,查找文件diskem1x.bin。找到后, diskem1x.bin将被加载到地址0:7c00h,loader.bin的使命完成。diskem1x.bin被加载后,首先也将自己移至地址 5000:0h,然后搜索光盘根目录,查找默认的启动菜单配置文件diskemu.cmd,找到后,显示其中的菜单项,并根据用户按键运行相应的启动映像。如果没有在光盘的根目录下找到diskemu.cmd,或者在diskem1x.bin的加载过程中用户按下了Shift键, diskem1x.bin将进入命令行模式(可以进行各种调试)。
  从Diskemu的运行流程来看,其本质是单重启动, diskem1x.bin加载后,它与启动菜单配合,为用户提供多个启动入口,模拟El Torito规范中的多重启动的启动目录,并根据用户的选择,完成多重启动的动作。这也正式“BIOS 模拟法”名称的由来。
四、所需烧录软件
  制作多重启动CD-ROM一般要经过三个步骤:
  准备所需资料→制作光盘映像ISO文件→将ISO文件烧录到CD-ROM
  烧录软件的作用就是完成后两步操作。
  当然,不制作ISO文件而直接烧录出多重启动CD-ROM也是办得到的,但除非十分有把握,否则最好不要冒险。
  能够制作多重启动CD-ROM映像文件的烧录软件很多。从BIOS模拟法的工作流程即可知道:只要是能够制作单重启动CD-ROM映像文件的烧录软件也应该能够制作多重启动CD-ROM映像文件。但凡事总有例外:ISOLINUX就很特殊,不是所有的烧录软件都适用。后面我们会再讨论它。
  我在这里推荐3个经典且常用的软件:Nero、CDImage和Mkisofs。其他一些软件如Easy CD Creator、CDRWIN等在功能上都与Nero类似,用户可自行试验。
  CDImage和Mkisofs可以制作出标准的ISO文件,最新版本的Nero既能制作出其专有格式的NRG文件,也能制作出ISO文件。
  Nero:是德国人开发的一款很经典的烧录软件,功能非常强大,支持中文文件名及长文件名,用它制作出来的单重启动CD-ROM很完美,隐藏掉了所有不必要的东西。但如何用它制作多重启动CD-ROM恐怕就没有多少人知道了。Nero的下载地址:
  http://www.nero.com/en/index.html#download
  Mkisofs:运行于Unix下的经典烧录软件,已经被人用cygwin移植到了Windows下。Mkisofs的功能非常强大,提供了丰富的命令行选项如果你对其使用十分熟悉,可以直接使用命令行命令。Windows下的Mkisofs已经被Bart用WBAT改造成了DOS下的菜单驱动程序包,使用很方便。Mkisofs的下载地址:
  http://www.nu2.nu/nu2files/cdrpack13.zip(Bart改造过的Mkisofs)
  http://www.fokus.gmd.de/research/cc/glone/employees/joerg.schilling/private/cdrecord.html(官方网址)
  CDImage:微软开发的小工具。CDImage也是个命令行程序,提供众多的参数,现在有不少人为其开发了多种图形界面版本。CDImage的最大特点就是能够剔除光盘上的相同文件(只保留1个),从而大大节约光盘空间,这是目前为止制作Windows n合1光盘的惟一工具。CDImage的下载地址:
  http://www.tech-hints.com/prog/cdimage.zip
  http://www.tech-hints.com/prog/cdimagegui.zip(图形界面版)
  下表列出了上面介绍的3中烧录软件与多重启动CD-ROM引导程序的兼容性列表,Mkisofs是最通用的。

Diskemu ISOLINUX Boot Scriptor
Nero 适用 不适用 适用
Mkisofs 适用 适用 适用
CDImage 适用 不适用 适用

五、启动磁盘映像文件的制作
  这里我们制作3个启动软盘映像文件:1.img、2.img和3.img,各映像文件的内容分述如下。
  1. 1.img:MS-DOS 98SE & Tools,DOS启动盘和工具集,2.88 MB。
  制作方法:首先制作Windows 98SE的启动盘,用WinImage将其制作为1.44 MB的映像文件,在WinImage中,执行“Image-Change format”命令,将其格式改为2.88 MB,并进行适当修改,增减文件,做成自己的工具盘。
  2. PowerQuest PartitionMagic 7,硬盘分区软件,2.88 MB。
  制作方法:同上,加入DOS版的PowerQuest PartitionMagic 7,在CONFIG.SYS文件中配置2 MB的虚拟磁盘,将PowerQuest PartitionMagic 7调入虚拟磁盘运行,否则在光盘上无法运行。
  3. DocMemory RAM Diagnostic-ver V2.0,内存诊断工具,1.44 MB。现在的内存质量良莠不齐,装机时如果出现莫名其妙的错误,可以用该软件检查一下系统内存,说不定能发现点问题。
  软件下载地址:
  http://www.simmtester.com/software_updates/docmemory/DocMem1_45a.exe
  http://www.simmtester.com/software_updates/docmemory/DocMem20.exe
  运行程序,按照提示制作1张启动软盘,将此软盘用WinImage制作成软盘映像文件。
六、Diskemu
  1. 下载地址与技术文档
  下载地址:http://www.nu2.nu/nu2files/diskem1x.zip
  技术文档:http://www.nu2.nu/diskemu/(英文)
  2. 软件主要特点
  可以毫不夸张地说,Diskemu是个划时代的经典之作。在Diskemu被开发出来之前,人们要制作1张多重启动CD-ROM真的需要花费九牛二虎之力:按照El Torito规范需要进行繁琐的地址计算,找到地址后再去修改ISO文件,最后辛辛苦苦制作出来的多重启动CD-ROM还不能保证兼容所有的BIOS!真是费力不讨好。后来,Gary Tong为了解决可启动CD-ROM无法浏览CD-ROM上文件的问题而开发了Diskemu(支持单重启动CD-ROM),BIOS模拟法这时才真正诞生。Bart Lagerweij继续这项工作,使Diskemu能够最多支持20个启动磁盘映像!但非常可惜,2001年11月,Bart在写完 Diskem1x.bin v1.1 BETA后便停止了对Diskemu的继续开发(参见http://www.nu2.nu/diskemu,英文)。但不可否认,知道现在, Diskemu仍然是非常优秀的,其兼容性最好。下面是Diskemu的主要特点:
  (1)支持ISO 9660文件系统。
  (2)使用一种简单的类似批处理形式的脚本语言来执行一定的动作,例如:清屏,显示提示信息,等待按键,运行特定磁盘映像,等等。
  (3)可以快速地编写自己定制的启动菜单,并启动相应的磁盘映像。
  (4)为专业人员提供一个命令行调试模式,手工执行一些操作。
  (5)自动检查软盘映像类型。支持多种软盘映像:160 KB,180 KB,320 KB,360 KB,1.2 MB,720 KB,820 KB,1.44 MB,1.68 MB,1.72 MB,2.88 MB。
  (6)使用1张可启动的Diskemu CD-Rom,你甚至可以从另外不能启动的CD-ROM上启动磁盘映像文件。当然需要首先用可启动的Diskemu CD-Rom启动,然后进入命令行模式,再更换光盘,键入“cd \”,再运行光盘上的映像文件(在实际工作中这项功能应用得并不多)。
  (7)它使用一个单独的引导器(loader.bin),将能够正确地加载diskem1x.bin,甚至在BIOS不完全兼容El-Torito规范的主板上,也能保证正确引导。
  Bart还有几个计划没有完成,当然也是Diskemu的主要不足:
  (1)检测第1快硬盘是否看似能够启动。
  (2)让diskem1x直接将信息写入屏幕缓存。
  (3)增加颜色功能。
  (4)键盘映射(以支持其他国家的键盘)。
  (5)增加软盘映像热交换功能。
  (6)加载COM文件(COM文件一定不能用DOS功能)。
  3. 软件使用方法
  Diskemu的兼容性非常好,适用于Nero,Cdimage和Mkisofs。这里我们分别讲解利用这三种软件制作ISO映像文件的方法。
  (1)目录结构
  假定xcd\root\为多重启动CD-ROM的根目录,建立如下目录结构,将下载到的文件diskem1x.zip展开,将展开后的loader.bin、diskem1x.bin及我们制作的软盘映像文件1.img、2.img、3.img分别复制到相应位置:
  xcd\loader.bin
  xcd\root\diskem1x.bin
  xcd\root\diskemu.cmd
  xcd\root\1.img
  xcd\root\2.img
  xcd\root\3.img
  如果还希望增加其他文件和子目录,只需将其复制到,xcd\root\目录下,这是光盘的根目录。
  (2)编写启动菜单配置文件diskemu.cmd
  ;
  :start
  cls
  print
  print  BOOT MENU
  print  ===================================================
  print  [ 1 ] MS-DOS 98SE & Tools
  print  [ 2 ] PowerQuest PartitionMagic 7
  print  [ 3 ] DocMemory RAM Diagnostic-ver V2.0
  print
  print  [ Q ] Quit to command prompt
  print  [ R ] Reboot
  print  [Esc] Boot first Hard Disk
  print  ===================================================
  print  Press the HOTKEY for your choice.
  :mainkey
  getkey
  onkey 1 goto dos98
  onkey 2 goto pq7
  onkey 3 goto docmem
  onkey q quit
  onkey Q quit
  onkey r reboot
  onkey R reboot
  onkey esc boot 80
  ;When no key found...
  goto mainkey
  ;
  :dos98
  cls
  print Starting MS-DOS 98SE...
  run 1.img
  ;when run has failed
  print
  print Failed to run "1.img", press any key to return to the boot menu.
  getkey
  goto start
  ;
  :pq7
  cls
  print Loading PowerQuest PartitionMagic...
  run 2.img
  ;when run has failed
  print
  print Failed to run "2.img", press any key to return to the boot menu.
  getkey
  goto start
  ;
  :docmem
  cls
  print Loading DocMemory RAM Diagnostic...
  run 3.img
  ;when run has failed
  print
  print Failed to run "3.img", press any key to return to the boot menu.
  getkey
  goto start
  ;
  ;EOF
  配置菜单中不要包含制表符(ASCII 9),可以使用空格符。
  (3)用CDImage制作ISO文件
  将cdimage.exe文件复制到xcd\目录下,打开DOS窗口,在xcd目录下运行如下命令:
  cdimage -lMultiBootCD -n -m -bloader.bin root xcd.iso
  运行完毕后,将生成多重启动ISO映像文件xcd\xcd.iso,我们可利用VMware Workstation(http://www.vmware.com/)或Virtual PC(http://www.connectix.com)测试其效果。正确无误后,可将xcd.iso烧录到光盘。
  (4)用Nero制作ISO/NRG文件
  运行Nero 5.5.9.0,选择菜单“档案—开新档案”,选择“CD-ROM(开机)”,在“可开机的映像文件位置”中选择loader.bin,“模拟类型”选择“不模拟”,“加载扇区”选择默认的“07C0”,“已加载扇区数”必须为“4”,如图2所示。
  
图2
  随后将文件diskem1x.bin、diskemu.cmd、1.img、2.img、3.img拖放到光盘根目录下。
  这样,最基本的文件就准备齐了,你还可以再适当添加文件和目录。最后,制作映像文件,可以选择NRG格式,也可以选择标准的ISO格式。利用VMware Workstation或Virtual PC测试其效果。
  (5)用Mkisofs制作ISO文件
  如果你对Mkisofs的用法十分熟悉,可以使用cdrpack13.zip中的命令行程序mkisofs.exe(必须包含cygwin1.dll),否则还是使用Bart为我们制作好的程序包吧。
  首先下载cdrpack13.zip,然后再下载配合cdrpack13.zip的diskemu插件(http: //www.nu2.nu/nu2files/diskemu_addon.zip),将下载到的cdrpack13.zip连同子目录一起展开,假定释放到目录cdrpack13,再将diskemu_addon.zip连同子目录展开到同一目录下。这样,目录cdrpack13中将包含如下子目录和文件:
  cdrpack13\cdrpack.txt
  cdrpack13\gnugpl.txt
  cdrpack13\main.bat
  cdrpack13\run.bat
  cdrpack13\bin
  cdrpack13\cds
  cdrpack13\lib
  其中,cdrpack13\cds和cdrpack13\lib是包含在diskemu_addon.zip中的,其他的文件和子目录包含在cdrpack13.zip中。
  将文件diskemu.cmd、1.img 、2.img、3.img复制到子目录cdrpack13\cds\diskemu\disk1中。如果有其他需要添加的文件,也要复制到该目录,这是光盘的根目录。
  修改文件cdrpack13\cds\diskemu\build.mak,将其中的“volumeid:="Diskem1x"”(卷标)和“preparer:="Bart Lagerweij"”(制作人)改为用户定义的方式。
  执行批处理程序cdrpack13\run.bat,从“Main menu”中选择“Build & Burn”,按4次回车,如果不出问题,又会回到“Main menu”,生成的ISO文件存放在cdrpack13\tmp目录下,文件名为mycd.iso,利用VMware Workstation或Virtual PC测试其效果。
  如果你想将默认文件名mycd.iso修改为其他名称,只需打开并编辑文件cdrpack13\bin\global.mak中的相应内容。
七、ISOLINUX
  安装过Linux的朋友应该知道SYSLINUX这个软件,它是安装Linux光盘的启动引导器,著名的Redhat 7.3使用的是SYSLINUX 1.52,Mandrake Linux 8.2使用的则是SYSLINUX 1.67。而ISOLINUX(还有一个PXELINUX)正是SYSLINUX的孪生兄弟。所以其本质上是个小型的Linux。
  ISOLINUX只能配合Mkisofs制作ISO映像文件。为什么?因为ISOLINUX需要在ISO文件中插入一段特殊的代码:El Torito启动信息表(El Torito Boot Information Table),目前只有Mkisofs能够自动完成这项工作,而Nero和CDImage则不行。
  1. 下载地址与技术文档
  下载地址:
  cdrpack13.zip:
  http://www.nu2.nu/nu2files/cdrpack13.zip
  multi_memdisk_addon.zip:
  http://www.nu2.nu/nu2files/multi_memdisk_addon.zip
  syslinux-1.75.zip:
  http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-1.75.zip
  技术文档:http://syslinux.zytor.com/iso.php(英文)
  2. 软件主要特点
  ISOLINUX是Linux/i386的一个启动引导器,其核心是Linux,如果用户配置过LILO,你将发现ISOLINUX的配置文件isolinux.cfg与LILO的配置lilo.conf有点相似。ISOLINUX本身以非模拟方式运行于ISO 9660/El Torito CD-ROMs,这避开了软盘模拟的磁盘空间容量问题和硬盘模拟会产生的一些兼容性问题。
  注意:ISOLINUX 只使用标准的ISO 9660文件名格式,例如,它不支持Rock Ridge 或Joliet文件名。当然,它也可以用在使用Rock Ridge和/或Joliet扩展的磁盘上。
  ISOLINUX也支持“长”(level 2)ISO 9660文件名,所以,如果短格式操作系统(如MS-DOS)的兼容性不是一个问题,你可以使用“-l”或“-iso-level 2”参数控制mkisofs来生成标准长文件名(扩展至31个字符)。
  ISOLINUX默认地内建两个版本:标准版和诊断版,诊断版带有额外的诊断信息。如果你使用ISOLINUX遇到了问题,建议你使用诊断版本(isolinux-debug.bin)。
  从1.65版开始,ISOLINUX支持其他操作系统的引导磁盘映像。当然,这一特性依赖于BIOS的功能,现在的大部分BIOS都支持该功能,但仍有可能在一些特殊的系统中不能正常工作。
  ISOLINUX仅支持下列软盘映像:
  1,222,800 bytes:1 200 KB软盘(标准5.25英寸软盘)
  1,474,560 bytes:1 440 KB软盘(标准3.5英寸软盘)
  2,949,120 bytes:2 880 KB软盘(增强3.5英寸软盘)
  其他的尺寸将被认为是硬盘映像。为了尽可能地在更多的操作系统上正常工作,硬盘映像必须要包含一个已经激活的分区。尽管如此,还是有很多BIOS不能正常支持硬盘映像。
  与Diskemu相比,ISOLINUX在显示菜单上做得相当出色:不仅支持彩色文本菜单,而且还支持图像!不过它支持的图像格式太特殊了:LSS16。syslinux-1.75.zip里提供了一个Perl的处理程序,可以用它将需要的图像转换为LSS16格式。syslinux-1.75.zip里面同时也包含了一个图像菜单的例子。
  ISOLINUX的菜单配置文件和映像配置文件是分开的:菜单配置文件中只包含显示的文本和颜色及图像控制命令,是一个文本文件,映像配置文件是一个对应于菜单配置文件的映像启动命令文件。这种安排多少有些不方便。另外,颜色和图像等的控制命令是用不可打印ASCII码控制的,你必须要找到一个适当的 DOS下的编辑软件以输入这些特殊的ASCII码,或用Ultraedit的“查看—ASCII字符表—插入字符”输入,但在中文Windows下的显示却乱得一团糟。
  ISOLINUX本身是无法启动软