http://hi.baidu.com/jack_hunt/blog/item/cf7f0401900f73047bec2cb6.html
logout
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 ../packages/lfs-bootscripts-20090812.tar.bz2
cd lfs-bootscripts-20090812/
make install
cd ..
rm -rf lfs-bootscripts-20090812/
cat > /etc/sysconfig/clock << "EOF"
# Begin /etc/sysconfig/clock
UTC=1
# Set this to any options you might need to give to hwclock,
# such as machine hardware clock type for Alphas.
CLOCKPARAMS=
# 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
# 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)
NORMAL="/[/e[0m/]"
RED="/[/e[1;31m/]"
GREEN="/[/e[1;32m/]"
YELLOW="/[/e[1;33m/]"
BLUE="/[/e[1;34m/]"
if [[ $EUID == 0 ]] ; then
PS1="$RED[/u@$YELLOW/h $BLUE/W$RED]//$ $NORMAL"
else
PS1="$GREEN[/u@$YELLOW/h $BLUE/W$GREEN]//$ $NORMAL"
fi
if [ "`locale charmap 2>/dev/null`" = "UTF-8" ] ; then
stty iutf8
fi
#End /etc/bashrc
EOF
echo "HOSTNAME=LFS6.5" > /etc/sysconfig/network
cat > /etc/hosts << "EOF"
# Begin /etc/hosts (network card version)
127.0.0.1 LFS6.5 localhost
# End /etc/hosts (network card version)
EOF
for NIC in /sys/class/net/* ; do
INTERFACE=${NIC##*/} udevadm test --action=add $NIC
done
cat /etc/udev/rules.d/70-persistent-net.rules
cd /etc/sysconfig/network-devices
mkdir -v ifconfig.eth0
cat > ifconfig.eth0/ipv4 << "EOF"
ONBOOT=yes
SERVICE=ipv4-static
IP=192.168.224.145
GATEWAY=192.168.224.1
PREFIX=24
BROADCAST=192.168.224.255
EOF
cat > /etc/resolv.conf << "EOF"
# Begin /etc/resolv.conf
nameserver 192.168.1.1
# 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
tmpfs /dev/shm tmpfs defaults 0 0
# End /etc/fstab
EOF
cd /sources/
tar xvf ../packages/linux-2.6.30.2.tar.bz2
cd linux-2.6.30.2/
make mrproper
make menuconfig
make
make modules_install
cp -v arch/x86/boot/bzImage /boot/lfskernel-2.6.30.2
cp -v System.map /boot/System.map-2.6.30.2
cp -v .config /boot/config-2.6.30.2
install -d /usr/share/doc/linux-2.6.30.2
cp -r Documentation/* /usr/share/doc/linux-2.6.30.2
cat > /etc/modprobe.conf << "EOF"
# Begin /etc/modprobe.conf
install ohci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i ohci_hcd ; true
install uhci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i uhci_hcd ; true
# End /etc/modprobe.conf
EOF
cd ..
tar xvf ../packages/grub-0.97.tar.gz
cd grub-0.97/
patch -Np1 -i ../../packages/grub-0.97-disk_geometry-1.patch
patch -Np1 -i ../../packages/grub-0.97-256byte_inode-1.patch
./configure --prefix=/usr
make CFLAGS="-march=i486 -mtune=native -Os"
make check
make install
mkdir -v /boot/grub
cp -v /usr/lib/grub/i386-pc/stage{1,2} /boot/grub
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.5
root (hd0,1)
kernel /boot/lfskernel-2.6.30.2 root=/dev/hda2
EOF
mkdir -v /etc/grub
ln -sv /boot/grub/menu.lst /etc/grub
echo 6.5 > /etc/lfs-release
logout
umount -v $LFS/dev/pts
umount -v $LFS/dev/shm
umount -v $LFS/dev
umount -v $LFS/proc
umount -v $LFS/sys
umount -v $LFS
shutdown -r now
编译LFS 6.5全过程(五)
最新推荐文章于 2025-08-12 19:38:23 发布