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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
09-01-2005, 01:54 PM
|
#1
|
|
Member
Registered: May 2005
Location: Utah
Posts: 102
Rep:
|
Confused Newbie
I am totally confused! I get as far as compiling the first package, binutils.
I have mounted my new LFS partition on /mnt/lfs. /mnt/lfs has sources and tools and lost+found directories. The sources directory has all of the packages and patches.
The instructions for installing binutils says execute mkdir ../binutils-build and then execute cd ../binutils-build and then execute ../binutils-2.15.94...etc.
But, binutils-2.15.94...etc doesn't exist until I unpack the .tar.bz2 file and there is no hint of where to unpack that file. I have tried a couple of approaches but none seem to work properly. The instructions say that binutils gets installed to the tools subdirectory but nothing ever gets installed there.
I need help before proceeding. Where should I copy the tar file and do the unpacking? And the instructions mkdir ../etc and cd ../etc followed by ../binutils..etc seems inconsistent. Is the last step really correct?
Thanks for any help, jimbo
|
|
|
|
09-01-2005, 02:02 PM
|
#2
|
|
Member
Registered: Feb 2004
Location: United States
Distribution: Ubuntu 10.10
Posts: 319
Rep:
|
Each section assumes that you are under the source directory for that section's packge. For example, Section "5.3. Binutils-2.15.94.0.2.2 - Pass1" assumes that you are under "$LFS/sources/binutils-2.15.94.0.2.2" directory. As of the tar.bz2 files, you need to run "tar -xvjf filename.tar.bz2 under $LFS/sources.
The following quote is from LFS-6.1 Page 53:
Quote:
Now prepare Binutils for compilation:
../binutils-2.15.94.0.2.2/configure --prefix=/tools --disable-nls
The meaning of the configure options:
--prefix=/tools
This tells the configure script to prepare to install the Binutils programs in the /tools directory.
--disable-nls
This disables internationalization as i18n is not needed for the temporary tools.
|
Last edited by Basel; 09-01-2005 at 02:06 PM.
|
|
|
|
09-01-2005, 02:24 PM
|
#3
|
|
Member
Registered: May 2005
Location: Utah
Posts: 102
Original Poster
Rep:
|
Thanks for your reply. Yes, I understand that part of the instructions. But the instructions also say binutils should be built in it's own build directory and then gives instructions to: mkdir ../binutils-build, etc. etc. That is the confusing part.
Thanks for any additional advice, jimbo
|
|
|
|
09-01-2005, 07:21 PM
|
#4
|
|
Member
Registered: Jul 2004
Distribution: LFS, I felt the itch and scratched it
Posts: 227
Rep:
|
Here's the instructions:
cd $LFS/sources
tar xvjf binutils-2.15.94.0.2
cd binutils-2.15.94.0.2
mkdir ../binutils-build
cd ../bintutils-build
Then continue with the instructions on the LFS page.
|
|
|
|
09-02-2005, 03:33 AM
|
#5
|
|
Member
Registered: Feb 2004
Location: United States
Distribution: Ubuntu 10.10
Posts: 319
Rep:
|
Just follow the instructions kjordan gave you. Here is the reason:
The Binutils documentation recommends building Binutils outside of the source directory in a dedicated build directory.
|
|
|
|
09-02-2005, 12:21 PM
|
#6
|
|
Senior Member
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 4,548
|
Okay, let's say you're parked in lfs's home directory. You have a subdirectory called sources in which you have all your sources, and maybe one called patches in which you've got the patches.
So, now you unpack the binutils package with something like: tar xjvf sources/Binutils-2.15.94.0.2.2.tar.bz2.
This creates a Binutils-2.15.94.0.2.2 directory in the current (home) directory.
(Let us assume for convenience that there are no patches.)
Now you: mkdir binutils-build and then you enter that directory with cd binutils-build.
Now, how do you reach the configure command that you want to execute, which is in "the directory next-door?" You do it using a relative path name, starting with ".." which refers to "the parent of whatever directory I'm in." Since you have cd'd to binutils-build, the parent-directory is the home-directory, and the Binutils-2.15.94.0.2.2 directory is in that.
So you type: ../Binutils-2.15.94.0.2.2/configure ... Linux resolves the pathname, locates the command in "the directory next door," and executes it.
Q.E.D. (Quodo erat demonstradum: "which was to be proved.")
Now, what if there were patches? Here, you would cd Binutils-2.15.94.0.2.2 (from the home directory), and execute patch commands, once again using the relative-path-name syntax such as ../patches/name-of-patch-file. Once you have finished, use cd .. to step up one level, back to the home directory.
If you are ever uncertain about where you are, and the shell-prompt does not tell you, freely use the pwd ("print working directory") command to find out.
H.T.H! (Hope This Helps!)
|
|
|
|
09-02-2005, 01:45 PM
|
#7
|
|
Member
Registered: Feb 2004
Location: United States
Distribution: Ubuntu 10.10
Posts: 319
Rep:
|
Here are some examples to support sundialsvcs and to help you:
Quote:
So, now you unpack the binutils package with something like: tar xjvf sources/Binutils-2.15.94.0.2.2.tar.bz2.
This creates a Binutils-2.15.94.0.2.2 directory in the current (home) directory.
|
You should not refer to $LFS/sources as the current home directory. the home directory has nothing to do with this.
Code:
basel@slackware:~$ su - lfs
Password:
lfs:~$ cd $LFS/sources
lfs:/mnt/lfs_6.1/sources$ tar -xjf binutils-2.15.94.0.2.2.tar.bz2
lfs:/mnt/lfs_6.1/sources$ cd binutils-2.15.94.0.2.2
lfs:/mnt/lfs_6.1/sources/binutils-2.15.94.0.2.2$
Quote:
|
Now you: mkdir binutils-build and then you enter that directory with cd binutils-build.
|
the build directory get created under $LFS/sources:
Code:
lfs:/mnt/lfs_6.1/sources/binutils-2.15.94.0.2.2$ mkdir ../binutils-build
lfs:/mnt/lfs_6.1/sources/binutils-2.15.94.0.2.2$ cd ../binutils-build
lfs:/mnt/lfs_6.1/sources/binutils-build$
Quote:
Now, how do you reach the configure command that you want to execute, which is in "the directory next-door?" You do it using a relative path name, starting with ".." which refers to "the parent of whatever directory I'm in." Since you have cd'd to binutils-build, the parent-directory is the home-directory, and the Binutils-2.15.94.0.2.2 directory is in that.
So you type: ../Binutils-2.15.94.0.2.2/configure ... Linux resolves the pathname, locates the command in "the directory next door," and executes it.
|
Again, you never work under the home directory.
Code:
lfs:/mnt/lfs_6.1/sources/binutils-build$ ../binutils-2.15.94.0.2.2/configure <parameters>
Quote:
|
Now, what if there were patches? Here, you would cd Binutils-2.15.94.0.2.2 (from the home directory), and execute patch commands, once again using the relative-path-name syntax such as ../patches/name-of-patch-file. Once you have finished, use cd .. to step up one level, back to the home directory.
|
You need to execute the patch under binutils source directory and not the build directory:
Code:
lfs:/mnt/lfs_6.1/sources/binutils-build$ cd ../binutils-2.15.94.0.2.2
lfs:/mnt/lfs_6.1/sources/binutils-2.15.94.0.2.2$ patch -Np1 -i ../patch-file-name.patch
|
|
|
|
09-03-2005, 09:07 AM
|
#8
|
|
Member
Registered: May 2005
Location: Utah
Posts: 102
Original Poster
Rep:
|
OK, I appreciate the clarification. I still am worried about proceeding, because nothing gets installed in /mnt/lfs/tools directory which the instructions say binutils build will do.
And a related question. I don't have the time or inclination to do Chapter 5 in one long session. So I want to compile one or two packages, then shutdown and go away. Then return later, boot up and compile a few more packages. I think I am doing the "return" correctly, but I would appereciate some advice. Here is how I "return".
Boot my host system. (The live CD.)
# export LFS=/mnt/lfs
# mkdir -p $LFS
# mount /dev/hda12 $LFS
# mkswap /dev/hda7
# ln -s $LFS/tools
# su - lfs
This procedure seems to bring me back to where I left off, but am I missing something?
Thanks, jimbo
|
|
|
|
09-03-2005, 01:21 PM
|
#9
|
|
Member
Registered: Feb 2004
Location: United States
Distribution: Ubuntu 10.10
Posts: 319
Rep:
|
Quote:
|
OK, I appreciate the clarification. I still am worried about proceeding, because nothing gets installed in /mnt/lfs/tools directory which the instructions say binutils build will do.
|
Could you post the commands that you used to build binutils?
Quote:
Boot my host system. (The live CD.)
# export LFS=/mnt/lfs
# mkdir -p $LFS
# mount /dev/hda12 $LFS
# mkswap /dev/hda7
# ln -s $LFS/tools
# su - lfs
|
You only need to mount the partition and then su - lfs. Remember the two files that you have created earlier: .bashrc and .bash_profile
|
|
|
|
09-03-2005, 01:35 PM
|
#10
|
|
Member
Registered: May 2005
Location: Utah
Posts: 102
Original Poster
Rep:
|
OK, I followed your example.
# cd $LFS/sources
# tar -xvjf binutils-2.15...etc
# cd binutils-2.15..etc
# mkdir ../binutils-build
# cd ../binutils-build
# ../binutils-2.15..etc/configure --prefix=/tools --disable-nls
# make
# make install
# make -C ld clean
# make -C ld LIB_PATH=/tools/lib
I am guessing host system /tools is being used rather than /mnt/lfs/tools? Since my host system is the live CD, anything installed there will not survive a reboot. So could I just copy the host /tools directory to /mnt/lfs before I end a session? Or maybe I could change any reference to /tools to /mnt/lfs/tools?
Thanks for the continued help, jimbo
|
|
|
|
09-04-2005, 09:50 AM
|
#11
|
|
Member
Registered: May 2005
Location: Utah
Posts: 102
Original Poster
Rep:
|
Just an update with more details.
I formatted and started over. Everything went as expected through binutils build. The $LFS/tools directory was populated with files and subdirectories. Then I shut down and had lunch. After lunch I rebooted the live CD and attempted to resume with building the gcc package.
# mount /dev/hda12 $LFS failed with an error message about no fstab entry.
So I did # export LFS=/mnt/lfs and # mkdir -p $LFS
Now hda12 was mounted with no errors.
Next, I did # mkswap /dev/hda7 to activate the swap partition.
# su - lfs failed with an error message about no such ID as lfs.
I believe all of the setup work done before Chapter 5 is lost when the live CD is rebooted. Is there a special procedure to follow when using the live CD for a host? It seems to me that I will have to complete all of the setup work everytime I reboot the live CD.
Any additional advice will be appreciated, jimbo
|
|
|
|
09-05-2005, 09:11 AM
|
#12
|
|
Member
Registered: Feb 2004
Location: United States
Distribution: Ubuntu 10.10
Posts: 319
Rep:
|
Quote:
Originally posted by jimbo-62
I believe all of the setup work done before Chapter 5 is lost when the live CD is rebooted. Is there a special procedure to follow when using the live CD for a host? It seems to me that I will have to complete all of the setup work everytime I reboot the live CD.
Any additional advice will be appreciated, jimbo
|
Nothing is lost except the /home/lfs directory since you are booting from a LiveCD. Everything under the LFS partition persists after a reboot. The first thing you need to do after a reboot is to mount the LFS partition.
You will not need the lfs user after chapter five. In addition, you only need the .bashrc and .bash_profile for that user. If you need to reboot the system you have to do the following:
1. mount your partition.
2. add the lfs group
3. add the lfs user and make sure that you execute the two scripts.
If you need to reboot after chapter five you might have to mount other file systems such as sysfs, devpts, and tmpfs.
|
|
|
|
09-05-2005, 09:49 AM
|
#13
|
|
Member
Registered: May 2005
Location: Utah
Posts: 102
Original Poster
Rep:
|
Thanks for your reply. I found the correct procedure in "Hints" on the LFS web site. It would have been nice if the Live CD page had referenced the hints. Anyway, the variable definition $LFS, the user definitions and the two scripts do not exist on the LFS partition, so they are lost when the Live CD is rebooted. That means almost all of the setup done prior to Chapter 5 is lost on a Live CD reboot.
The "Hints" page gives a script and a procedure to overcome this issue when using a Live CD for a host system.
Thanks, jimbo
|
|
|
|
09-05-2005, 10:01 AM
|
#14
|
|
Member
Registered: Feb 2004
Location: United States
Distribution: Ubuntu 10.10
Posts: 319
Rep:
|
Quote:
Originally posted by jimbo-62
That means almost all of the setup done prior to Chapter 5 is lost on a Live CD reboot.
|
I don't think so.
All your work is done under /mnt/lfs which is a partition on your HD. You don't lose the file under that partition by simply rebooting the LiveCD.
|
|
|
|
09-05-2005, 10:23 AM
|
#15
|
|
Member
Registered: May 2005
Location: Utah
Posts: 102
Original Poster
Rep:
|
All I know is that it is lost on a Live CD reboot on my system. Maybe I missed something in the instructions, but all of that stuff is saved on the host system, not on the LFS partition. The procedure and script in the "Hints" solves that problem, at least for me.
Thanks, jimbo
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 05:48 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|