当前位置:编程学习 > 网站相关 >>

编译LFS---个人心得教程

老大布置了一个作业, 这是LFS教程。。
这个网址,其实里面的教程是不全的,你弄到后面,发现怎么命令都一样。其实是错的
   手动编译是个蛋疼的东西。。。我这里也参照某高人提供了一个半自动脚本编译
说是半自动,因为部分命令还需要自己打,不过已经少了很多了。。
半自动脚本一共有9个shell。。。执行教程如下:
半自动教程:
cfdisk
#分区
mkswap /dev/sda1
mke2fs /dev/sda2

#下载lfs_6.3.zip

unzip *.zip
mkdir /share
cp *.sh /share
chmod 777 /share/*.sh
/share/01.sh
su - lfs
/share/02.sh
source ~/.bash_profile
cd $LFS/sources
/share/03.sh
strip --strip-debug /tools/lib/*
strip --strip-unneeded /tools/{,s}bin/*
rm -rf /tools/{info,man}
exit   www.zzzyk.com
chown -R root:root $LFS/tools
/share/04.sh
export LFS=/mnt/lfs
chroot "$LFS" /tools/bin/env -i \
HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
/tools/bin/bash --login +h
#这里会提示I have no name
#另外开一个终端复制脚本到/mnt/lfs下
sh /05.sh
exec /tools/bin/bash --login +h
sh /06.sh
cd /sources
export LFS=/sources
sh /07.sh
exec /bin/bash --login +h
sh /08.sh
logout
export LFS=/mnt/lfs
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 '{}' ';'
logout
chroot "$LFS" /usr/bin/env -i \
HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
/bin/bash --login
cd /sources
export LFS=/sources
sh /09.sh
cd /sources
tar xvf $LFS/linux-2.6.22.5.tar.bz2
cd linux-2.6.22.5
make mrproper
make menuconfig
#这里:在Device Drivers->SCSI device support->SCSI low-level drivers下加*_BusLogic SCSI #support的支持
# 在Device Drivers->Networking support->Ethernet (10 or 100Mbit)加M_AMD PCnet32 PCI support的#支持
# 在Device Drivers->Sound->Advanced Linux Sound Architecture->PCI devices加入M_(Creative) #Ensoniq AudioPCI 1371/1373的支持
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/sda2 vga=788
EOF
mkdir -v /etc/grub
ln -sv /boot/grub/menu.lst /etc/grub
logout
#大功告成
#警告:01-09脚本只能在linux下修改,最好不要到win下修改;因为win的编辑器会自动添加符号使得脚

#本无法使用,09.sh必须根据自己的分区,网络环境等实际情况修改,我的是虚拟机,可作参考。
 编译LFS心得:我花了三天时间编译好了LFS,但是不支持中文,后来又花了三天时间去解决这个问题。编译LFS主要还是细心,分清楚L和1这两个。教程的确很全,容易出错的地方在于编译glibc,这个一旦出错,后面的编译也肯定不通过。

补充:综合编程 , 其他综合 ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,