LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 08-28-2007, 05:02 AM   #1
sundar22in
LQ Newbie
 
Registered: Oct 2006
Distribution: Oracle Unbreakable linux 4
Posts: 23

Rep: Reputation: 15
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
 
Old 08-28-2007, 08:17 AM   #2
Daws
Member
 
Registered: May 2006
Location: UK
Distribution: Debian
Posts: 447

Rep: Reputation: 39
It's not too hard. Tell me are you going to be using the Live CD or an existing OS as a host?
 
Old 08-28-2007, 11:04 AM   #3
Daws
Member
 
Registered: May 2006
Location: UK
Distribution: Debian
Posts: 447

Rep: Reputation: 39
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.
 
Old 08-28-2007, 11:43 PM   #4
sundar22in
LQ Newbie
 
Registered: Oct 2006
Distribution: Oracle Unbreakable linux 4
Posts: 23

Original Poster
Rep: Reputation: 15
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
nvsound on an lfs build behmjoe Linux From Scratch 6 12-10-2005 06:28 AM
lfs 6.1 build on which linux distribution aneel Linux From Scratch 2 09-21-2005 08:24 AM
How to build LiveCD from LFS isilinux Linux From Scratch 1 08-24-2005 03:45 AM
Can I build LFS using Slackware10.1 sources? kornerr Linux From Scratch 9 07-01-2005 01:09 PM
Build LFS from dos partition? Phonics3k Linux From Scratch 7 07-05-2002 12:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 07:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration