LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Taking frequent breaks during LFS build (https://www.linuxquestions.org/questions/linux-from-scratch-13/taking-frequent-breaks-during-lfs-build-580360/)

sundar22in 08-28-2007 05:02 AM

Taking frequent breaks during LFS build
 
Hi,

I am planning to try out LFS installation and I am ready with the tools required for LFS installation(both s/w and h/w). I have a doubt regarding taking breaks during LFS build. Here is my question...

I am not planning to build LFS from source overnight, so I am planning to complete it within 1-2 weeks. Is it advicable to stop the build process at any step and resume from that position? Is it easy to stop and resume ? Can we shut down our PC at completion of any step??

Your advice is hignly appreciated and thanks in advance.

-Sundar

Daws 08-28-2007 08:17 AM

It's not too hard. Tell me are you going to be using the Live CD or an existing OS as a host?

Daws 08-28-2007 11:04 AM

Actually never mind, I'll put everything I can think of down for future reference.

Firstly, I recommend not taking breaks in the middle of building a package. Although make is supposed to be able to continue where it left off, I have had problems with this before. I advise letting the current package build to completion, install it, remove the source directory, and THEN shutdown the computer.
I also recommend noting the last program built, to avoid confusion (hehe don't ask).

I assume you are at least up to Chapter 5 before taking a break.

So. If you want to take a break somewhere in Chapter 5:

If you are using an existing distro as a host, then all you need to do is remount the lfs partition and login as the lfs user again. You can then start where you left off.

Code:

export LFS=/mnt/lfs
mount -v /dev/xxx $LFS
su - lfs
cd $LFS/sources

Then you can start on the next package. If you are using a different LFS variable then adjust as necessary. Likewise /dev/xxx should refer to the lfs partition.

I have assumed that only one partition is used for lfs. If you are using separate partitions for /usr or /var etc. then you need to mount them too as in chapter 2.4. Don't forget to mount swap each time, if it is necessary.

If you are using the LFS Live CD, then it's the same thing, except you need to recreate the lfs user and its environment. Using a live cd means the lfs user is not stored across reboots.You also need to recreate the /tools --> $LFS/tools symlink.

Code:

export LFS=/mnt/lfs
mkdir -pv $LFS
mount -v /dev/xxx $LFS
ln -sv $LFS/tools /
groupadd lfs
useradd -s /bin/bash -g lfs -m -k /dev/null lfs
passwd lfs
chown -v lfs $LFS/tools
chown -v lfs $LFS/sources
su - lfs

Set up the environment:

Code:

cat > ~/.bash_profile << "EOF"
exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
EOF

cat > ~/.bashrc << "EOF"
set +h
umask 022
LFS=/mnt/lfs
LC_ALL=POSIX
PATH=/tools/bin:/bin:/usr/bin
export LFS LC_ALL PATH
EOF

source ~/.bash_profile
cd $LFS/sources

From there start on the next package.

--------

If you want to take a break somewhere after 6.6 "Creating Essential File and symlinks" (Taking a break between 5.31 and 6.6 is pointless, as it does not take very long.)

If you are using an existing distro as a host:

Remount the lfs partition and enter chroot.

Code:

export LFS=/mnt/lfs
mount -v /dev/xxx $LFS
mount --bind /dev $LFS/dev
mount -vt devpts devpts $LFS/dev/pts
mount -vt tmpfs shm $LFS/dev/shm
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
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
cd /sources

Now you can start on the next package.

If you are using the LFS Live CD, then the only extra thing to do is recreate the lfs mount point.

Code:

export LFS=/mnt/lfs
mkdir -pv $LFS
mount -v /dev/xxx $LFS
mount --bind /dev $LFS/dev
mount -vt devpts devpts $LFS/dev/pts
mount -vt tmpfs shm $LFS/dev/shm
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
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
cd /sources

Continue the build.

From chapter 6.60 onwards, a different chroot command is used, otherwise the procedure is no different in either case:

Code:

chroot "$LFS" /usr/bin/env -i HOME=/root TERM="$TERM" PS1='\u:\w\$ '  PATH=/bin:/usr/bin:/sbin:/usr/sbin /bin/bash --login
I think I covered everything. If I missed something, please tell me and I will update the post accordingly.

sundar22in 08-28-2007 11:43 PM

Daws,

Thank you verymuch for spending your valuble time for providing a detailed reply. It really clear my doubts.

I am using Oracle Unbreakable linux 4 as my host OS and single partition for LFS.

Thanks again!

-Sundar


All times are GMT -5. The time now is 01:27 AM.