最新消息:

LFS之路1-关于恢复状态

Linux admin 2752浏览 0评论

很久之前就下载了LFS的一些资料,也做过一段时间,但是当时没坚持,现在把台式机弄好了,打算再完整的做一次LFS,下载的ISO是6.3,参考的资料是:

http://www.linuxsir.org/bbs/thread322894.html

我在这做一个自己的记录。

我不是用虚拟机装的 ,在自己的硬盘后面留了12G做LFS,用CD启动后运行cfdisk分区,分区完成后就开始做一些必要的准备工作。

挂载目标分区到/mnt/lfs;

在/mnt/lfs下面建立一下几个文件夹:
sources:存放源码
tools:工具链
prepare:我自己加的,用于存放一些恢复步骤的文件,主要有:
begin.sh:root用户时使用的一些初始化脚本,代码如下:

1
2
3
4
5
6
7
8
9
<span style="color: #666666; font-style: italic;">#!/bin/bash</span>
swapon <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda10
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-sv</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>lfs<span style="color: #000000; font-weight: bold;">/</span>tools <span style="color: #000000; font-weight: bold;">/</span>
groupadd lfs
useradd <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #660033;">-g</span> lfs <span style="color: #660033;">-m</span> <span style="color: #660033;">-k</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null lfs
<span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-v</span> lfs <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>lfs<span style="color: #000000; font-weight: bold;">/</span>tools
<span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-v</span> lfs <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>lfs<span style="color: #000000; font-weight: bold;">/</span>sources
<span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-v</span> lfs <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>lfs<span style="color: #000000; font-weight: bold;">/</span>prepare
<span style="color: #c20cb9; font-weight: bold;">passwd</span> lfs

.bash_profile:

1
<span style="color: #7a0874; font-weight: bold;">exec</span> <span style="color: #c20cb9; font-weight: bold;">env</span> <span style="color: #660033;">-i</span> <span style="color: #007800;">HOME</span>=<span style="color: #007800;">$HOME</span> <span style="color: #007800;">TERM</span>=<span style="color: #007800;">$TERM</span> <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">'u:w $'</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">bash</span>

.bashrc:

1
2
3
4
5
6
<span style="color: #000000; font-weight: bold;">set</span> +h
<span style="color: #7a0874; font-weight: bold;">umask</span> 022
<span style="color: #007800;">LFS</span>=<span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>lfs
<span style="color: #007800;">LC_ALL</span>=POSIX
<span style="color: #007800;">PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>tools<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin
<span style="color: #7a0874; font-weight: bold;">export</span> LFS LC_ALL PATH

begin2.sh:切换为lfs用户运行的一个初始化脚本:

1
2
3
4
5
<span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>lfs<span style="color: #000000; font-weight: bold;">/</span>prepare<span style="color: #000000; font-weight: bold;">/</span>.bash<span style="color: #000000; font-weight: bold;">*</span> ~<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #7a0874; font-weight: bold;">source</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bash_profile
<span style="color: #7a0874; font-weight: bold;">export</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$LFS</span><span style="color: #000000; font-weight: bold;">/</span>sources

这样,恢复就显得简单多了。

转载请注明:爱开源 » LFS之路1-关于恢复状态

您必须 登录 才能发表评论!