需要安装的包:
cdrtools
zisofs-tools
环境变量:
本例中 $WORK=/mnt/lfslivecd
需要的脚本:
$WORK/openlivecd
$WORK/closelivecd
$WORK/mklfslivecd
具体如下
$WORK/openlivecd
PHP 代码:
#!/bin/sh
export WORK=/mnt/lfslivecd
cd $WORK
# remount
mount -o loop $WORK/root.ext2 $WORK/root
mkdir $WORK/root/build
mount --bind $WORK/build $WORK/root/build
mount -t proc proc $WORK/root/proc
mount -t sysfs sysfs $WORK/root/sys
mount -t devpts devpts $WORK/root/dev/pts
mount -t tmpfs tmpfs $WORK/root/dev/shm
$WORK/closelivecd
PHP 代码:
#!/bin/sh
export WORK=/mnt/lfslivecd
cd $WORK
#umount
umount $WORK/root/dev/shm
umount $WORK/root/dev/pts
umount $WORK/root/sys
umount $WORK/root/proc
umount $WORK/root/build
rmdir $WORK/root/build
#remove history
rm $WORK/root/root/.bash_history
rm $WORK/root/root/.viminfo
#umount
umount $WORK/root
$WORK/mklfslivecd
PHP 代码:
#!/bin/sh
export WORK=/mnt/lfslivecd
cd $WORK
# umount
./closelivecd
# compress
mkzftree -v -F $WORK/root.ext2 iso/root.ext2
# burn cd
cd $WORK/iso
mkisofs -z -R -l --allow-leading-dots -D -o
../lfslivecd-x86-6.3-r2160-custom.iso -b boot/isolinux/isolinux.bin
-c boot/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table
-V "lfslivecd-x86-6.3-r2160" ./
# transfer
cd $WORK
ftp 192.168.101.1
# remount
./openlivecd
下面开始具体工作
1. mount ISO
代码:
root[ ~ ]# mount /dev/cdrom /media/cdrom/
mount: block device /dev/hda is write-protected, mounting read-only
root[ ~ ]# ll /media/cdrom/
total 383881
-rw-r--r-- 1 root root 32701 Dec 29 2007 README.html
drwxr-xr-x 3 root root 2048 Dec 29 2007 boot
drwxr-xr-x 2 root root 4096 Dec 29 2007 drivers
drwxr-xr-x 2 root root 14336 Dec 29 2007 lfs-sources
-rw-r--r-- 1 root root 1610612736 Dec 29 2007 root.ext2
root[ ~ ]#
2. 复制源 ISO 内容
代码:
mkdir $WORK/iso -p
mkdir $WORK/root
cp /media/cdrom/* $WORK/iso/ -a
如果 root.ext2 有 1.6G 左右,那么:
代码:
mv $WORK/iso/root.ext2 $WORK/
如果 root.ext2 有 400M 左右,那么:
代码:
mkzftree -u -F $WORK/iso/root.ext2 $WORK/root.ext2
3. 更新内容
代码:
cd $WORK
./openlivecd
3.1. lfs packages
代码:
rm $WORK/iso/lfs-sources/*
下载 6.5 所有 package, 放入 $WORK/iso/lfs-sources/
3.2. 6.5 LFS BOOK
下载 LFS-BOOK-6.5-HTML, LFS-BOOK-6.5-XML 解压到 $WORK/root/usr/share/
删除原 6.3 的 HTML 和 XML
3.3. jhalfs-2.3.2
下载 jhalfs-2.3.2 解压到 $WORK/root/home/jhalfs/
删除原 /$WORK/root/home/jhalfs/jhalfs-2.3.1
3.4. 其它
复制一份 kernel-config 及 fstab 到 $WORK/root/home/jhalfs/
(需要一份完备的 kernel-config, 好让 jhalfs 无缝地运行)
准备一份 jhalfs 的 configuration 到 $WORK/root/home/jhalfs/jhalfs-2.3.2/configuration
(configuration 内容见附录)
代码:
root[ /mnt/lfslivecd ]# ll $WORK/root/home/jhalfs
total 52
-rw-r--r-- 1 101 101 518 Aug 27 07:57 fstab
drwxr-xr-x 13 101 101 4096 Aug 27 11:21 jhalfs-2.3.2
-rw-r--r-- 1 101 101 44458 Aug 26 01:10 kernel-config
root[ /mnt/lfslivecd ]#
4. 制作 ISO
代码:
cd $WORK
./mklfslivecd
5. 结束
代码:
cd $WORK
./closelivecd
附录A. 如果需要 opensshd
代码:
touch $WORK/root/.autosshd
chroot $WORK/root
passwd
附录B. 关于 /media/cdrom/root.ext2 的大小
如果 kernel
代码:
File systems --->
CD-ROM/DVD Filesystems --->
[*] Transparent decompression extension
那么 root.ext2 就是 1.6G, 反之就是 400M, 需要先解压
附录C. $WORK/root/home/jhalfs/jhalfs-2.3.2/configuration
代码:
#
# Automatically generated configuration: don't edit
# use make menuconfig or make config to make changes
#
#
# --- BOOK Settings
#
BOOK_LFS=y
# BOOK_CLFS is not set
# BOOK_CLFS2 is not set
# BOOK_CLFS3 is not set
# BOOK_BLFS is not set
PROGNAME="lfs"
RUN_ME="./jhalfs run"
# relSVN is not set
WORKING_COPY=y
# BRANCH is not set
BRANCH_ID=""
BOOK="/usr/share/LFS-BOOK-6.5-XML"
# ARCH_X86 is not set
# ARCH_MIPS is not set
# ARCH_PPC is not set
# ARCH_SPARC is not set
# ARCH_ALPHA is not set
# ARCH_ARM is not set
# ARCH_HPPA is not set
# PLATFORM_GENERIC is not set
# PLATFORM_WRT is not set
# DATA_32 is not set
# DATA_64 is not set
# DATA_MULTI is not set
# PROC_i486 is not set
# PROC_i586 is not set
# PROC_i686 is not set
# PROC_mipsel is not set
# PROC_mips is not set
# PROC_unknown is not set
# PROC_hppa1 is not set
# PROC_hppa2 is not set
# PROC_EV5 is not set
# PROC_EV56 is not set
# PROC_PCA56 is not set
# PROC_PCA57 is not set
# PROC_EV6 is not set
# PROC_EV67 is not set
# PROC_EV68 is not set
# PROC_ARM is not set
# PROC_ARM5L is not set
# PROC_ARM5B is not set
# PROC_ULTRA1 is not set
# PROC_ULTRA2 is not set
# PROC_ULTRA3 is not set
# ABI_32 is not set
# ABI_N32 is not set
# ABI_64 is not set
TARGET=""
TARGET32=""
PLATFORM="GENERIC"
SPARC64_PROC="none"
ARCH=""
MIPS_LEVEL=""
ABI=""
ENDIAN=""
# BUILD_CHROOT is not set
# BUILD_BOOT is not set
METHOD=""
BOOT_CONFIG=""
# GRSECURITY_HOST is not set
# LIB_GLIBC is not set
# LIB_UCLIBC is not set
MODEL=""
# KERNEL_26 is not set
# KERNEL_24 is not set
KERNEL=""
SSP=",ssp,"
ASLR=",aslr,"
PAX=",pax,"
HARDENED_TMP=",hardened_tmp,"
WARNINGS=",warnings,"
MISC=",misc,"
BLOWFISH=",blowfish,"
# CUSTOM_TOOLS is not set
# BLFS_TOOL is not set
# BLFS_SVN is not set
# BLFS_BRANCH is not set
BLFS_BRANCH_ID=""
# DEP_LIBXML is not set
# DEP_LIBXSLT is not set
# DEP_TIDY is not set
# DEP_DBXML is not set
# DEP_UNZIP is not set
# DEP_LYNX is not set
# DEP_SUDO is not set
# DEP_WGET is not set
# DEP_GPM is not set
# DEP_SVN is not set
BLFS_ROOT=""
BLFS_XML=""
TRACKING_DIR=""
#
# --- General Settings
#
# CONFIG_USER is not set
DEF_USER="lfs"
SET_USER=""
# CONFIG_GROUP is not set
SET_GROUP=""
# CONFIG_HOME is not set
SET_HOME=""
LUSER="lfs"
LGROUP="lfs"
LHOME="/home"
BUILDDIR="/mnt/lfs"
GETPKG=y
SRC_ARCHIVE="/lfs-sources"
SERVER="http://ftp.lfs-matrix.net/"
GETKERNEL=y
RUNMAKE=y
# CLEAN is not set
#
# --- Build Settings
#
# CONFIG_TESTS is not set
# TST_1 is not set
# TST_2 is not set
# TST_3 is not set
TEST=0
# NO_BOMB is not set
# BOMB is not set
# BOMB_TEST is not set
# INSTALL_LOG is not set
HAVE_FSTAB=y
FSTAB="/home/jhalfs/fstab"
CONFIG_BUILD_KERNEL=y
CONFIG="/home/jhalfs/kernel-config"
STRIP=y
VIMLANG=y
# NO_PROGRESS_BAR is not set
TIMEZONE="GMT"
LANG="$LANG"
PAGE_LETTER=y
# PAGE_A4 is not set
PAGE="letter"
#
# --- Advanced Features
#
REPORT=y
# COMPARE is not set
ITERATIONS=0
# RUN_ICA is not set
# RUN_FARCE is not set
# CONFIG_OPTIMIZE is not set
# OPT_1 is not set
# OPT_2 is not set
OPTIMIZE=0
#
# --- Internal Settings (WARNING: for jhalfs developers only)
#
SCRIPT_ROOT="jhalfs"
JHALFSDIR="$BUILDDIR/$SCRIPT_ROOT"
LOGDIRBASE="logs"
LOGDIR="$JHALFSDIR/logs"
TESTLOGDIRBASE="test-logs"
TESTLOGDIR="$JHALFSDIR/test-logs"
FILELOGDIRBASE="installed-files"
FILELOGDIR="$JHALFSDIR/$FILELOGDIRBASE"
ICALOGDIR="$LOGDIR/ICA"
FARCELOGDIR="$LOGDIR/farce"
MKFILE="$JHALFSDIR/Makefile"
XSL="$PROGNAME.xsl"
PKG_LST="unpacked"
# REBUILD_MAKEFILE is not set