LFS6.3安装全过程(五)
chroot $LFS /tools/bin/env -i \
HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
/tools/bin/bash --login
/tools/bin/find /{,usr/}{bin,lib,sbin} -type f \
-exec /tools/bin/strip --strip-debug '{}' ';'
cd sources
tar xvf lfs-bootscripts-6.3.tar.bz2
cd lfs-bootscripts-6.3
make install
cd ..
rm -rf lfs-bootscripts-6.3
cat > /etc/sysconfig/clock << "EOF"
# Begin /etc/sysconfig/clock
UTC=1
# End /etc/sysconfig/clock
EOF
cat > /etc/sysconfig/console << "EOF"
# Begin /etc/sysconfig/console
# End /etc/sysconfig/console
EOF
cat > /etc/inputrc << "EOF"
# Begin /etc/inputrc
# Modified by Chris Lynn <roryo@roryo.dynup.net>
# Allow the command prompt to wrap to the next line
set horizontal-scroll-mode Off
# Enable 8bit input
set meta-flag On
set input-meta On
# Turns off 8th bit stripping
set convert-meta Off
# Keep the 8th bit for display
set output-meta On
# none, visible or audible
set bell-style none
# All of the following map the escape sequence of the value
# contained in the 1st argument to the readline specific functions
"\eOd": backward-word
"\eOc": forward-word
# for linux console
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[3~": delete-char
"\e[2~": quoted-insert
# for xterm
"\eOH": beginning-of-line
"\eOF": end-of-line
# for Konsole
"\e[H": beginning-of-line
"\e[F": end-of-line
# End /etc/inputrc
EOF
cat > /etc/profile << "EOF"
# Begin /etc/profile
export INPUTRC=/etc/inputrc
source /etc/bashrc
LANG="zh_CN" ; export LANG
[ "$TERM" = "linux" ] && LC_ALL=C
export LC_ALL
# End /etc/profile
EOF
cat > /etc/bashrc << "EOF"
# Begin /etc/bashrc
alias ls='ls --color=auto'
alias ll='ls -l'
#eval $(dircolors -b /etc/dircolors)
# Setup a red prompt for root and a green one for users.
NORMAL="\[\e[0m\]"
RED="\[\e[1;31m\]"
GREEN="\[\e[1;32m\]"
YELLOW="\[\e[1;33m\]"
BLUB="\[\e[1;34m\]"
if [[ $EUID == 0 ]] ; then
PS1="$RED[\u@$YELLOW\h $BLUB\W$RED]\\$ $NORMAL"
else
PS1="$GREEN[\u@$YELLOW\h $BLUB\W$GREEN]\\$ $NORMAL"
fi
if [ "`locale charmap 2>/dev/null`" = "UTF-8" ]
then
stty iutf8
fi
# End /etc/bashrc
EOF
echo "HOSTNAME=mylinux" > /etc/sysconfig/network
cat > /etc/hosts << "EOF"
# Begin /etc/hosts (network card version)
127.0.0.1 mylinux localhost
# End /etc/hosts (network card version)
EOF
cd /etc/sysconfig/network-devices
mkdir -v ifconfig.eth0
cat > ifconfig.eth0/ipv4 << "EOF"
ONBOOT=yes
SERVICE=ipv4-static
IP=192.168.1.9
GATEWAY=192.168.1.1
PREFIX=24
BROADCAST=192.168.1.255
EOF
cat > /etc/resolv.conf << "EOF"
# Begin /etc/resolv.conf
nameserver 202.106.196.115
# End /etc/resolv.conf
EOF
cat > /etc/fstab << "EOF"
# Begin /etc/fstab
# file system mount-point type options dump fsck
# order
/dev/hda2 / ext3 defaults 1 1
/dev/hda5 swap swap pri=1 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
devpts /dev/pts devpts gid=4,mode=620 0 0
shm /dev/shm tmpfs defaults 0 0
# End /etc/fstab
EOF
cd /sources
tar xvf linux-2.6.22.5.tar.bz2
cd linux-2.6.22.5
make mrproper
make menuconfig
make
make modules_install
cp -v arch/i386/boot/bzImage /boot/lfskernel-2.6.22.5
cp -v System.map /boot/System.map-2.6.22.5
cp -v .config /boot/config-2.6.22.5
install -d /usr/share/doc/linux-2.6.22.5
cp -r Documentation/* /usr/share/doc/linux-2.6.22.5
grub
root (hd0,1)
setup (hd0)
quit
cat > /boot/grub/menu.lst << "EOF"
# Begin /boot/grub/menu.lst
# By default boot the first menu entry.
default 0
# Allow 30 seconds before booting the default.
timeout 30
# Use prettier colors.
color green/black light-green/black
# The first entry is for LFS.
title LFS 6.3
root (hd0,1)
kernel /boot/lfskernel-2.6.22.5 root=/dev/hda2
EOF
mkdir -v /etc/grub
ln -sv /boot/grub/menu.lst /etc/grub
echo 6.3 > /etc/lfs-release
logout