2 AUTHOR: youbest <youbest at sina dot com>
4 TRANSLATOR: d00m3d <d00m3d at sina dot com>
8 LICENSE: GNU Free Documentation License Version 2
10 SYNOPSIS: How to resume your work after a break at different LFS stages.
12 DESCRIPTION: This hint helps you setting up your building environment at
13 different stages. LFS LiveCD is used as the host system.
15 PRIMARY URI: http://www.linuxsir.org/bbs/showthread.php?t=242880
17 PREREQUISITES: LFS LiveCD-6.1.1-3
23 For those who have built their own LFS systems more than once, they must
24 be very "impressed" with the extremely long building time. In
25 particular, if the computer is not a powerful one. It is quite scary to
26 learn about such lengthy building time.
28 Sometimes, you may be forced to shutdown or reboot the computer, which
29 you have to resume your previous working conditions before continuing
30 the job. However, this process would be quite confusing to those who are
31 not familiar with the principles of LFS and they are likely to have
32 difficulties in resuming their previous building environment. To avoid
33 this from happening, they often keep the computer running for several
34 days until the whole LFS is finished.
36 Thus it is very useful to know how to have a smooth connection after a
37 reboot/shutdown. Based on my own experiences I did a research on this
38 topic and would like to share my results. Every steps are carefully
39 verified and should be correct. Hope this hint may assist those who are
40 building their own LFS system and relief some of their "pains".
42 Throughout the article, sda is block device being used. sda1 is being
43 used as swap and sda2 is the partition for building LFS.
45 The following procedures are based on LFS6.1.1-3. If a different book
46 version is used, the section number may be different as well, please
47 refer to the sub-heading of each section in such case.
49 From beginning to Section 4.4 Setting up the Environment
50 ========================================================
51 You may simply restart the process from the very beginning.
53 From section 4.5 About SBUs to section 5.33 Stripping
54 =====================================================
55 Following are the steps you need if you stop in any section from
56 4.5(About SBUs) and 5.33 (Stripping).
57 1. Restart computer and boot from LiveCD
58 2. Mount your lfs partition
62 3. Mount your swap partition (skip this step if you do not use any swap
65 4. Establish symbolic link for toolchain
69 useradd -s /bin/bash -g lfs -m -k /dev/null lfs
71 chown -v lfs $LFS/tools
72 chown -v lfs $LFS/sources
74 6. Define the lfs user profile
75 cat > ~/.bash_profile << "EOF"
76 exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
79 cat > ~/.bashrc << "EOF"
84 PATH=/tools/bin:/bin:/usr/bin
85 export LFS LC_ALL PATH
88 source ~/.bash_profile
89 7. Verify the environment variables
90 export //the export command should output the following:
91 declare -x HOME="/home/lfs"
92 declare -x LC_ALL="POSIX"
93 declare -x LFS="/mnt/lfs"
95 declare -x PATH="/tools/bin:/bin:/usr/bin"
96 declare -x PS1="\\u:\\w\\\$ "
97 declare -x PWD="/home/lfs"
99 declare -x TERM="linux"
100 If you get these variables correct, then you have already resumed your
101 building environment.
103 Section 6.1 Introduction
104 ========================
105 At this point, you are probably tired and prefer to shutdown your
106 computer for a rest. Steps to resume the building environment are:
107 1. Restart computer and boot from LiveCD
108 2. Mount your lfs partition
112 3. Mount your swap partition (skip this step if you do not use any swap
116 At this point, the toolchain is ready and existed in /tools, thus there
117 is no need to create a symbolic link for the /tools directory again.
119 From section 6.2. Mounting Virtual Kernel File Systems to section 6.8.
121 ======================================================================================
122 At this point, if you reboot or shutdown your computer. Steps to resume
123 the building environment are:
124 1. Restart computer and boot from LiveCD
125 2. Mount your lfs partition
129 3. Mount your swap partition (skip this step if you do not use any swap
132 4. Mount the virtual kernel filesystems
133 mount -vt proc proc $LFS/proc
134 mount -vt sysfs sysfs $LFS/sys
135 5. Entering the chroot environment
136 chroot "$LFS" /tools/bin/env -i \
137 HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
138 PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
139 /tools/bin/bash --login +h
141 From section 6.9. Linux-Libc-Headers-2.6.11.2 to section 6.37. Bash-3.0
142 =======================================================================
143 Following are the commands you need if you stop at any sections between
144 6.9 (Linux-Libc-Headers) and 6.37 (Bash-3.0).
145 1. Restart computer and boot from LiveCD
146 2. Mount your lfs partition
150 3. Mount your swap partition (skip this step if you do not use any swap
153 4. Mount the virtual kernel filesystems
154 mount -vt proc proc $LFS/proc
155 mount -vt sysfs sysfs $LFS/sys
156 5. Entering the chroot environment
157 chroot "$LFS" /tools/bin/env -i \
158 HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
159 PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
160 /tools/bin/bash --login +h
162 mount -nvt tmpfs none /dev
163 mknod -m 622 /dev/console c 5 1
164 mknod -m 666 /dev/null c 1 3
165 mknod -m 666 /dev/zero c 1 5
166 mknod -m 666 /dev/ptmx c 5 2
167 mknod -m 666 /dev/tty c 5 0
168 mknod -m 444 /dev/random c 1 8
169 mknod -m 444 /dev/urandom c 1 9
170 chown -v root:tty /dev/{console,ptmx,tty}
171 ln -sv /proc/self/fd /dev/fd
172 ln -sv /proc/self/fd/0 /dev/stdin
173 ln -sv /proc/self/fd/1 /dev/stdout
174 ln -sv /proc/self/fd/2 /dev/stderr
175 ln -sv /proc/kcore /dev/core
178 mount -vt devpts -o gid=4,mode=620 none /dev/pts
179 mount -vt tmpfs none /dev/shm
180 7. Entering your working directory
183 From 6.38. File-4.13 to section 6.58. Udev-056
184 ==============================================
185 Following are the commands you need if you stop at any sections between
186 6.37 (Bash-3.0) and 6.58 (Udev-056)
187 1. Restart computer and boot from LiveCD
188 2. Mount your lfs partition
192 3. Mount your swap partition (skip this step if you do not use any swap
195 4. Mount the virtual kernel filesystems
196 mount -vt proc proc $LFS/proc
197 mount -vt sysfs sysfs $LFS/sys
198 5. Entering the chroot environment
199 chroot "$LFS" /tools/bin/env -i \
200 HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
201 PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
204 mount -nvt tmpfs none /dev
205 mknod -m 622 /dev/console c 5 1
206 mknod -m 666 /dev/null c 1 3
207 mknod -m 666 /dev/zero c 1 5
208 mknod -m 666 /dev/ptmx c 5 2
209 mknod -m 666 /dev/tty c 5 0
210 mknod -m 444 /dev/random c 1 8
211 mknod -m 444 /dev/urandom c 1 9
212 chown -v root:tty /dev/{console,ptmx,tty}
213 ln -sv /proc/self/fd /dev/fd
214 ln -sv /proc/self/fd/0 /dev/stdin
215 ln -sv /proc/self/fd/1 /dev/stdout
216 ln -sv /proc/self/fd/2 /dev/stderr
217 ln -sv /proc/kcore /dev/core
220 mount -vt devpts -o gid=4,mode=620 none /dev/pts
221 mount -vt tmpfs none /dev/shm
222 7. Entering your working directory
225 From section 6.59. Util-linux-2.12q to section 6.60. About Debugging
227 ============================================================================
228 Following are the commands you need if you stop at 6.59
229 (Util-linux-2.12q) or 6.60 (About Debugging Symbols).
230 1. Restart computer and boot from LiveCD
231 2. Mount your lfs partition
235 3. Mount your swap partition (skip this step if you do not use any swap
238 4. Mount the virtual kernel filesystems
239 mount -vt proc proc $LFS/proc
240 mount -vt sysfs sysfs $LFS/sys
241 5. Entering the chroot environment
242 chroot "$LFS" /tools/bin/env -i \
243 HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
244 PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
247 mount -nvt tmpfs none /dev
251 mount -vt devpts -o gid=4,mode=620 none /dev/pts
252 mount -vt tmpfs none /dev/shm
253 7. Entering your working directory
256 Section 6.61. Stripping Again
257 =============================
258 If you reboot your system at this moment, steps to resume the building
260 1. Restart computer and boot from LiveCD
261 2. Mount your lfs partition
265 3. Mount your swap partition (skip this step if you do not use any swap
268 4. Mount the virtual kernel filesystems
269 mount -vt proc proc $LFS/proc
270 mount -vt sysfs sysfs $LFS/sys
271 5. Entering the chroot environment
272 chroot $LFS /tools/bin/env -i \
273 HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
274 PATH=/bin:/usr/bin:/sbin:/usr/sbin \
275 /tools/bin/bash --login
277 mount -nvt tmpfs none /dev
281 mount -vt devpts -o gid=4,mode=620 none /dev/pts
282 mount -vt tmpfs none /dev/shm
283 7. Entering your working directory
286 From section 6.62. Cleaning Up to The End
287 =========================================
288 From this point till the end of the whole LFS build. Steps to resume
291 1. Restart computer and boot from LiveCD
292 2. Mount your lfs partition
296 3. Mount your swap partition (skip this step if you do not use any swap
299 4. Mount the virtual kernel filesystems
300 mount -vt proc proc $LFS/proc
301 mount -vt sysfs sysfs $LFS/sys
302 5. Entering the chroot environment
303 chroot "$LFS" /usr/bin/env -i \
304 HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
305 PATH=/bin:/usr/bin:/sbin:/usr/sbin \
308 mount -nvt tmpfs none /dev
312 mount -vt devpts -o gid=4,mode=620 none /dev/pts
313 mount -vt tmpfs none /dev/shm
314 7. Entering your working directory
321 1.1. Email address correction.
322 Description improvement.
326 http://linuxfromscratch.org/mailman/listinfo/hints
327 FAQ: http://www.linuxfromscratch.org/faq/
328 Unsubscribe: See the above information page