Thursday, June 3, 2010

Chapter 5.31 and 32

Well, no package called stripping, so just follow the text. I do not like having unused files cluttering up the disk, so I am going to learn this.

Remaining in tools,620 directories, 8251 files. I forgot to run tree before this. Oh well.  I have 10GB partition so I am not worried about space.

Chapter 5.32 Getting ready for the big test. 

I am going to back up tools directory regardless. Just in case I mess up somewhere in chapter 6. I have not spend all my time doing this setup, but I estimate that it took about 20 hours altogether.

Chapter 5.29 Tar

## ------------- ##
## Test results. ##
## ------------- ##

70 tests were successful.
7 tests were skipped.

Chapter 5.28 SED

make check results:


======================================================
All 65 tests behaved as expected (4 expected failures)
======================================================

Chapter 5.27 Perl

ok.

Chapter 5.26 Patch

During make, I get: $LFS/sources/patch-2.6.1/src/patch.c:1542: warning: the use of `mktemp' is dangerous, better use `mkstemp'

Igonore for now.

Chapter 5.25 Make

Result of make check.

351 Tests in 96 Categories Complete ... No Failures :-)

The system uptime program believes the load average to be:
uptime
 12:20pm  up   5:27,  5 users,  load average: 0.53, 0.68, 0.88
The GNU load average checking code thinks:
./loadavg
1-minute: 0.530000  5-minute: 0.680000  15-minute: 0.880000

=====================================================================
 Regression PASSED: GNU Make 3.81 (i686-pc-linux-gnu) built with gcc
=====================================================================

Chapter 5.22 Grep

Sigh, 10 more packages. Slow and steady. Let's not be hasty.

Chapter 5.21 Gettext

Starting to get bored. Oh, I have to go into a subdirectory here. $LFS/sources/gettext-0.17%cd gettext-tools. Pay attention.

334 directories, 7783 files

Chapter 5.20 Gawk

I saw a "Good Luck?" message after the gawk configure.

Just for fun, make check:
======== Done with tests that can vary based on character set or locale support ========
make[2]: Entering directory `/media/lfs/sources/gawk-3.1.7/test'
3 TESTS FAILED

This should be ok.

Chapter 5.19 Findutils

OK.

Chapter 5.18 Diffutils

Ok. Not installiing patches unless explicitly stated.

Chapter 5.17 Coreutils

No problem installing. All 184 tests passed
(18 tests were not run)

Chapter 5.16 Bzip

Another familiar name, and a patch file. Ah, at least this time it is mentioned that the configure script is not needed. (unlike the missing make with DejaGnu) Done.

Wait, there was a patch. I checked Chapter 6 and it is explicitly installed there so I will NOT install it here.

Chapter 5.15 Bash

Ah, I know what bash is.  Just a minor glitch, no doubt due to my messing with the color of the prompt. Up until now, when I copy and paste from the documents, I have seen the entire command output on several lines. Now, the long lines are output to the beginning of the same line.
i.e. This:  ./configure --prefix=/tools --without-bash-malloc

Looked like:
-malloclfs/sources/bash-4.1%./configure --prefix=/tools --without-bash-

I checked that it worked properly by the first line in config.log, which helpfully repeats the command.

Run make test, just to familiarize myself with what it is doing. All is well. Using tree, I get:
277 directories, 7349 files

Chapter 5.14 Ncurses

Another package whose name I have seen but I have no idea what it does.
Ok, followed the instructions. Nothing odd to report.

Chapter 5.13 DejaGNU

I'm beginning to get the hang of this.
$LFS/sources/dejagnu-1.4.4$ ./configure --prefix=/tools OK!

Where is the make command?After much digging, I found this here:
September 22nd, 2003 [jeremy]: Removed the make command from DejaGnu, since it performs nothing.
Well, if it doesn't do anything, running it should not do any harm, right? What does the Makefile look like? I don't see anything.

$LFS/sources/dejagnu-1.4.4$ make
Making all in doc
make[1]: Entering directory `/media/lfs/sources/dejagnu-1.4.4/doc'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/media/lfs/sources/dejagnu-1.4.4/doc'
make[1]: Entering directory `/media/lfs/sources/dejagnu-1.4.4'
make[1]: Nothing to be done for `all-am'.
make[1]: Leaving directory `/media/lfs/sources/dejagnu-1.4.4'
Indeed, it does nothing. Running make install and make check. I have got problems with make check. The word ERROR shows up clearly.

I did some searching just in case. I installed expect on my normal session and ran the command: expect -c "spawn ls". The output was "spawn ls" with no message of errors.  I conclude that it is the $LFS which cannot do this, and since it does not even have a kernel yet, it seems pointless to try and correct this error now.  But, it is good that I have been alerted to this anyway, in case it does come up in Chapter 6.

Wednesday, June 2, 2010

Chapter 5.12 Expect

There are several expect files:
$LFS/sources$ ls -l expect*
-rw-r--r-- 1 lfs lfs 6824 Mar 1 21:30 expect-5.43.0-spawn-1.patch
-rw-r--r-- 1 lfs lfs 6824 Mar 1 21:30 expect-5.43.0-spawn-1.patch.1
-rw-r--r-- 1 lfs lfs 4150 Mar 1 21:30 expect-5.43.0-tcl_8.5.5_fix-1.patch
-rw-r--r-- 1 lfs lfs 4150 Mar 1 21:30 expect-5.43.0-tcl_8.5.5_fix-1.patch.1
-rw-r--r-- 1 lfs lfs 525572 Feb 2 2006 expect-5.43.0.tar.gz

Hmmm. Looks like I downloaded this twice, because the .1 at the end of the spawn and fix means that they are doubles. The document applies only two patches.

Do all the configure,make and make test. Some errors which I am told not to worry about (one of which is the ptys error which I have been warned about. I will skip it for now.
all.tcl: Total 15 Passed 2 Skipped 0 Failed 13
Sourced 0 Test Files.
Files with failing tests: cat.test logfile.test pid.test send.test spawn.test stty.test

I forgot to run tree after the tcl/unix install, but here it is at the end of this chapter. $LFS/tools$ tree
213 directories, 3833 files.

Chapter 5.11 Tcl

Unpack tcl8.5.8 and cd into it. That's where the directory unix is. Although not necessary, I am running ths suggested test, remaining inside the unix subdirectory.

Here's the result:

Tests ended at Wed Jun 02 08:07:30 UTC 2010
all.tcl: Total 24472 Passed 23366 Skipped 1106 Failed 0
Sourced 137 Test Files.


Next, install to $LFS/tools directory using make install (as user lfs).
Before changing the permissions,
$LFS/tools/lib$ ls -l libtcl*
-r-xr-xr-x 1 lfs lfs 1146739 Jun 2 10:09 libtcl8.5.so

After changing permissions (chmod -v u+w /tools/lib/libtcl8.5.so)
tools/lib$ ls -l libtcl*.so
-rwxr-xr-x 1 lfs lfs 1146739 Jun 2 10:09 libtcl8.5.so

Ok, writable for user lfs. Follow remaining commands. I stay in the unix directory. I am deleting all the created tcl directories under $LFS/source. There is only one, no build directory was created.

Tuesday, June 1, 2010

Chapter 5.10 GCC Pass 2

Oh dear. Now they want the patch installed? I have done this already. Did this affect the first pass? Should I run it again? Yes, because I deleted the sources and have to re-configure.

Being sure to cd into gcc directory first, run the patch command.

Bootstrap is a funny word.


"Before starting to build GCC, remember to unset any environment variables that override the default optimization flags. " This sounds rather important but I don't know what to do. I have saved my environment (using env) just in case something goes wrong. But for now, continue. During the make, all the paths have the word tools in them.

Hooray! So far so good,

readelf -l a.out | grep ': /tools'
[Requesting program interpreter: /tools/lib/ld-linux.so.2]


Tools directory, tree gives me 200 files,2879 files.

Chapter 5.9 Binutils Pass 2

Can you find the error?

$LFS/sources$ mkdir -v ../binutils-build
mkdir: cannot create directory `../binutils-build': Permission denied

A moments lapse and near disaster. I went to make some tea and forgot which directory I was in. This makes the insistance that everything be done as user lfs so important.

Not much else to say. I just followed the rest of the instructions and everything went ok.

Chapter 5.8 Toolchain

Getting a bit scary...Reading technical notes because I really do not know what they are talking about. The purpose of this discussion is, I believe, to demonstrate that I am NOT supposed to see ANYTHING in the text that refers to /usr or /lib.

  1. Name of the platform? I dutifully unpacked binutils and ran the command ./config.guess (I got a "command not found" without the dot) and I have: i686-pc-linux-gnu.
  2. Platform's dynamic linker*. A random binary? I tried gcc. readelf -l /usr/bin/gcc | grep interpreter

    [Requesting program interpreter: /lib/ld-linux.so.2]
  3. Linker library search order: ld --verbose | grep SEARCH

    SEARCH_DIR("/usr/i586-mandriva-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
  4. Detailed information about the preprocessor, compilation, and assembly stages, gcc dummy.c -Wl,--verbose 2>&1 | grep succeeded

    Several lines that look like: "attempt to open /lib/ld-linux.so.2 succeeded"
(*) definition: "dynamic linker provided by Glibc finds and loads the shared libraries needed by a program, prepares the program to run, and then runs it)"



I believe that the next commands will change the environment. It is therefore not important from which directory they are run. I do not understand what the SPECS is doing but note that it is unset at the end. Meaning, it has no meaning in my current environment (not lfs yet).

OK, this looks good! Before all this, in the technical notes section, I had obtained /lib/ld-linux.so.2. Now, when I run: readelf -l a.out | grep ': /tools', I get:  [Requesting program interpreter: /tools/lib/ld-linux.so.2]

All paths should have the word tools in them!

Chapter 5.7 Glib

A quick uname -a tells me I have a i686 AMD Duron(tm) processor and do not have to worry about the i486 note. (I might, if I try to install this on my Pentium II machine. ) I ran this anyway, being unused to using case at the command line, I was curious.
case `uname -m` in i?86) echo "CFLAGS += -march=i486 -mtune=native" > configparms ;; esac
No errors... Copy and paste the configure from the web book...aside from the warnings they warn me about, I also get "WARNING: cpuid.h" statements which I will ignore. How many files? $LFS/tools, tree shows 145 directories and 2031 files. Wow. 14% of a 10GB partition.

Chapter 5.6 Linux

Yesterday, I did not know what to do at first with this section because I did not read the chapter heading, just searched for the next command in a box. A sort of tunnel vision. I wrote this in my notes: "Though not instructed to do so, I surmised that the linux file was necessary. I confirmed this by looking for evidence of mrproper and I found it in the Makefile." I have used make clean and make distclean but mrproper was new. Everything went smoothly until: $LFS/sources/linux-2.6.32.8$ make headers_check
/media/lfs/sources/linux-2.6.32.8/usr/include/scsi/scsi.h:162: userspace cannot call function or variable defined in the kernel /media/lfs/sources/linux-2.6.32.8/usr/include/scsi/scsi.h:288: userspace cannot call function or variable defined in the kernel
Googling finds me this response to a similar question:
Where is the error? It's just giving a warning. /usr/include/scsi/scsi.h will be overwritten when you install glibc so the fact that it is broken should cause you no problems.
So, I'll ignore it. Next comes $LFS/sources/linux-2.6.32.8$ make INSTALL_HDR_PATH=dest headers_install $LFS/sources/linux-2.6.32.8$ cp -rv dest/include/* /tools/include And I turn the page...and find that the book has moved on to glib. No configure, make, make install sequence? In tools, the command tree tells me what has changed. 55 directories, 761 files so far. remove ..../sources/linux-2.6.32.8 directory as instructed.

Chapter 5.5 GCC

Unpack gcc from within $LFS/sources/ and enter directory $LFS/sources/gcc-4.4.3 The first time, something went wrong and that is when I realized the purpose of the tools directory. But I will review what I did first. Unpack in the $LFS/sources directory. CD into the gcc directory. There is a patch, which I am unfamiliar with, so I applied this command from within gcc directory (sorry to be repetitive but it is really important to keep track of where one is):  

patch -Np1 -i ../gcc-4.4.3-startfiles_fix-1.patch

I get message, patching file ..../sources/gcc-4.4.3/gcc.c Followed the rest of the instructions from the book until I got to the ln command. I knew this was a soft link and whenever I have done this in the past, I always created the link assuming that it would be made in the directory from which I ran the command. But, everything in sources/ was to be deleted so this did not make sense. I ran it and got an error, something about libgcc.a not being found. Oh. I tried using locate libgcc.a but that only found the one in /usr/lib which I am not supposed to use. This is when I looked at the tools directory and realized its importance (I mentioned this also in the binutils section of this blog). I saw the ownership conflicts between lfs and root and decided that I must be doing something wrong.

I started over. Delete all created directories in sources and tools. Re-installed bin-utils. This created 10 directories and 66 files in $LFS/tools directory (using tree). Re-installed gcc. I saw that the path $LFS/tools/bin.../lib/gcc/i686-lfs.../4.4.3/ was being created and that that is where the libgcc.a was located. I ran the soft link command from the $LFS/sources/gcc-4.4.3 directory and, to my surprise, it wrote it in the directory under tools. Well, curiosity got the best of me and I read the info page:info ln. It turns out that there are three ways to make a soft link, one of which is implied. These are my least favorite kind of commands:

If the `--target-directory' (`-t') option is given, or failing that if the last file is a directory and the `--no-target-directory' (`-T') option is not given, `ln' creates a link to each TARGET file in the specified directory, using the TARGETs' names.

This a bit confusing, from my perspective. But, no errors. Next, make mrproper gives me an error. No rule to make target. Well, searched around a bit and after wasting I don't know how much time, realized that I was suppposed to move on to the next package. I was so deep in following the instructions that I did not look at the Section headers. in $LFS/tools, tree command shows: 27 directories and 135 files.

Chapter 5.4 Binutils

Here is where I encountered the distinction between sources directory and package sources. The word sources was used in two different contexts. Everything had to be in the $LFS/sources directory. This means the downloaded compressed files. I decided to unpack them one by one, at need. My first suspicion that something was going wrong was the mixture of file ownership in the tools directory (varied between roor and lfs). This is because I was doing "make install" as root. I started over again. Another problem I have is interpreting the text which scrolls by during the configure, make and make install. Words such as "cannot find" cause me alarm. But, upon more reading, I found someone who said: If there is an error, you will know about it at the end. After the "make install" which is the step where everything needed is placed in the $LFS/tools directory. That's why I can safely delete the binutils-source and binutils-2.2.0 directories. I keep the compressed file in case I have to re-do the process.

Linux from Scratch Version 6.6

I finally have taken the plunge. After fiddling with linux for so many years, I hope to finally understand how it works (and hopefully how to fix it when it goes wrong). Except where explicitly said, all commands should run as lfs and not root. This includes even "make install" which ordinarily I would have run as root. Comments from me are usually something I forgot to note, or something I did not realize until the next day. This saves me from having to edit the original note.

I use the directory structure $LFS/source$. It's too bad I did not change the $ after source. Somewhere in the bash it can be changed. To the uninitiated, the multiple $ with very different meanings, might be confusing. Perhaps at the end of all this I will go back and change it to something else.

Monday, May 31, 2010

Introduction

This will be the third blog that I am attempting to start. It's purpose is to summarize things that I am doing and what I may be learning. Linux will appear frequently, as well as some science related notes. Mostly it is a place for me to keep important linux commands that I keep forgetting. I currently work between 3 computers, 2 of which are dual booted with Linux and Windows XP. So, it helps to have my notes on the internet where I can find them.