LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 09-01-2005, 02:54 PM   #1
jimbo-62
Member
 
Registered: May 2005
Location: Utah
Posts: 102

Rep: Reputation: 15
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
 
Old 09-01-2005, 03:02 PM   #2
Basel
Member
 
Registered: Feb 2004
Location: United States
Distribution: Ubuntu 10.10
Posts: 319

Rep: Reputation: 30
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 03:06 PM.
 
Old 09-01-2005, 03:24 PM   #3
jimbo-62
Member
 
Registered: May 2005
Location: Utah
Posts: 102

Original Poster
Rep: Reputation: 15
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
 
Old 09-01-2005, 08:21 PM   #4
kjordan
Member
 
Registered: Jul 2004
Distribution: LFS, I felt the itch and scratched it
Posts: 227

Rep: Reputation: 31
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.
 
Old 09-02-2005, 04:33 AM   #5
Basel
Member
 
Registered: Feb 2004
Location: United States
Distribution: Ubuntu 10.10
Posts: 319

Rep: Reputation: 30
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.
 
Old 09-02-2005, 01:21 PM   #6
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,455

Rep: Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172
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!)
 
Old 09-02-2005, 02:45 PM   #7
Basel
Member
 
Registered: Feb 2004
Location: United States
Distribution: Ubuntu 10.10
Posts: 319

Rep: Reputation: 30
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
 
Old 09-03-2005, 10:07 AM   #8
jimbo-62
Member
 
Registered: May 2005
Location: Utah
Posts: 102

Original Poster
Rep: Reputation: 15
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
 
Old 09-03-2005, 02:21 PM   #9
Basel
Member
 
Registered: Feb 2004
Location: United States
Distribution: Ubuntu 10.10
Posts: 319

Rep: Reputation: 30
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
 
Old 09-03-2005, 02:35 PM   #10
jimbo-62
Member
 
Registered: May 2005
Location: Utah
Posts: 102

Original Poster
Rep: Reputation: 15
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
 
Old 09-04-2005, 10:50 AM   #11
jimbo-62
Member
 
Registered: May 2005
Location: Utah
Posts: 102

Original Poster
Rep: Reputation: 15
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
 
Old 09-05-2005, 10:11 AM   #12
Basel
Member
 
Registered: Feb 2004
Location: United States
Distribution: Ubuntu 10.10
Posts: 319

Rep: Reputation: 30
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.
 
Old 09-05-2005, 10:49 AM   #13
jimbo-62
Member
 
Registered: May 2005
Location: Utah
Posts: 102

Original Poster
Rep: Reputation: 15
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
 
Old 09-05-2005, 11:01 AM   #14
Basel
Member
 
Registered: Feb 2004
Location: United States
Distribution: Ubuntu 10.10
Posts: 319

Rep: Reputation: 30
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.
 
Old 09-05-2005, 11:23 AM   #15
jimbo-62
Member
 
Registered: May 2005
Location: Utah
Posts: 102

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


Reply

Tags
binutils


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
linux newbie question :confused: trey85stang General 18 08-24-2005 07:01 AM
iptables - firewalls - confused newbie mymojo Linux - Newbie 7 12-16-2003 05:50 PM
Help for A Very Confused Newbie.. flamesrock Mandriva 15 08-30-2003 10:20 PM
Confused Newbie - No mouse (sort of!) keebz Linux - Newbie 7 12-03-2002 11:46 PM
newbie soo confused edman Linux - General 3 12-18-2000 08:02 PM


All times are GMT -5. The time now is 04:02 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration