Thursday, June 10, 2010

Chapter 6.33 Perl

  • Perl "Perl is set up, you can run the interactive Configure script and hand-pick the way this package is built." I would not know where to start so run the defaults.
  • autoconf (Interupted....See post after Second Weekend)

Chapter 6.17-32

  • sed
  • pkg-config
  • ncurses - did not "create non-wide-character Ncurses libraries". I do not know what it means. Not happy with this "Trick such applications".
  • util-linux-ng-2.17
  • e2fsprogs
  • Coreutils-8.4 (apply patches ). I am running the test suite so I need to do all that group name stuff. Tests taking a long time.
  • iana-etc-2.30 This is a new one for me. Internet assigned numbers authority.
  • m4
  • bison
  • procps
  • grep-
    • "Glibc's regex library is broken when building against Glibc-2.11.1. This switch forces the use of Glibc's regex". So there are multiple libraries with the same name?
    • 1 of 14 failed tests, ok.
  • readline
  • bash- I am not learning anything from running these tests. I don't understand the "nobody" stuff.
  • gdbm 
  • inetutils

Chapter 6.16 GCC

 gcc No mention of patch, so do not apply. Skip references to BLFS.

Doing the tests, I had to leave the computer on overnight, it was taking very log. There were an awful lot of worrisome errors appearing.

To receive a summary of the test suite results, run:
../gcc-4.4.3/contrib/test_summary
 

Well. Too much scrolled past.
root:/sources/gcc-build# ../gcc-4.4.3/contrib/test_summary | grep -A7 Summ > piped_summary

Now, I have to compare this output with LFS output gcc. This is not a simple matter. The statement "Unless the test results are vastly different from those at the above URL, it is safe to continue." is a bit vague. I'll interpret it as an understanding that some errors will occur. The libmudflap does appear in my report and is the only "unexpected" failure.  So proceed with the install.
Done.

Chapter 6.13-15 gmp, mpfr,file

  • gmp
  • mpfr
  • file

Wednesday, June 9, 2010

Chapter 6.12 Binutils-2.20

Ah, binutils again. There are no problems with the statement:
expect -c "spawn ls"

This had been a worry of mine when I first started in Chapter 5.
No problems.

Chapter 6.11 Zlib 1.2.3

Hmm. I have no zlib in my sources. It seems that just last week there has been an update to 1.2.5. Since the manual I am using is NOT the newest one (Version SVN-201006010), I would like to stay with the 1.2.3 version. So, I googled zlib .1.2.3 and found it on SourceForge. Since I cannot use wget in the root system to which I chroot'd, I open another xterm and log on to my regular session as root. I change directory to $LFS/sources and run:

[$LFS/sources#]wget http://sourceforge.net/projects/libpng/files/zlib/1.2.3/zlib-1.2.3.tar.gz

Ok! Now,return to the xterm to which I had  chroot'd. (Tip, change background color of these terminals just to diffentiate them from the normal one).

Back in business. Configure mentions CFLAGS variable, but since I have been following their instructions verbatum, I suppose it is not important.

Make shared library and then a static library.

Chapter 6.10 Re-adjusting the Toolchain

Follow instructions as is. I was a bit surprised to see: i686-pc-linux-gnu in the output because I thought that it should be lfs in place of pc. Not too worried.

"It is a good idea to visually inspect the specs file" but where is it? I ran the gcc -dumpspecs command at root level. Which is ok.
/root:/# find / -name specs
/tools/lib/gcc/i686-lfs-linux-gnu/4.4.3/specs
/tools/lib/gcc/i686-pc-linux-gnu/4.4.3/specs

Running diff betwen these two files yields too many differences. What I do notice is that, tools does not appear in the -pc- specs. And, it was created today. (That is what the command did, but the sed commands are quite intricate.)
root:/tools/lib/gcc# ls -lrt i686-*-linux-gnu/4.4.3/specs
-rw-r--r-- 1 root root 4616 Jun  1 13:17 i686-lfs-linux-gnu/4.4.3/specs
-rw-r--r-- 1 root root 4731 Jun  9 10:53 i686-pc-linux-gnu/4.4.3/specs
Proceed with remainder of commands and checks. Everything is OK!

Chapter 6.9. Glibc-2.11.1

Just input all statements in the outlined box. I have no idea what they mean. This is going to take a while, I think. Run all the commands and check whether there is any errors:

root:/sources/glibc-build# grep Error glibc-check-log
make[2]: [/sources/glibc-build/posix/annexc.out] Error 1 (ignored)


I don't really understand the locale stuff. I do not want other languages clogging up my system, as I intend to first stay with english.Since I live in the Netherlands,I will also add that. Hmm. more does not work.

root:/sources/glibc-2.11.1/localedata# cat SUPPORTED  | grep NL
Gives me (my comments after <<):
fy_NL/UTF-8 \                      << frisian NL
li_NL/UTF-8 \                       << belgian (limburg)
nds_NL/UTF-8 \                   << Lower Saxson
nl_NL.UTF-8/UTF-8 \           << Netherlands
nl_NL/ISO-8859-1 \              << Netherlands
nl_NL@euro/ISO-8859-15 \ << Netherlands

So, if I use the Frenchcommands as a template,

localedef -i fr_FR -f ISO-8859-1 fr_FR
localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro
localedef -i fr_FR -f UTF-8 fr_FR.UTF-8
 
localedef -i nl_NL -f ISO-8859-1 nl_NL
localedef -i nl_NL@euro -f ISO-8859-15 nl_NL@euro
localedef -i nl_NL -f UTF-8 nl_NL.UTF-8

I just installed hardinfo() on my session (not the LFS partition). This command will output some info, among which is the language labels and what they mean. That's what I used to add the comments above. Honestly, I have never heard of Lower Saxon Netherlands. Some overlap with lowe saxon Germany, no doubt.

Here's  a nice command, found here:

/home/myname%echo "I live in `locale territory`"
Output = I live in Netherlands
Here's the command for finding what is in locale_archive (it's binary so cat won't show anything human readable). This gives me a list. I will use it to verify that my dutch commands worked.

root:/usr/lib/locale#locale -a



So, first, save the original list and then install the dutch.
root:/usr/lib/locale# locale -a > original_files.txt

root:/usr/lib/locale# localedef -i nl_NL -f ISO-8859-1 nl_NL
root:/usr/lib/locale# locale -a > new_files.txt
root:/usr/lib/locale# diff -cw original_files.txt new_files.txt 



*** original_files.txt    Wed Jun  9 10:17:16 2010
--- new_files.txt    Wed Jun  9 10:18:13 2010
***************
*** 26,30 ****
--- 26,32 ----
  it_IT.iso88591
  ja_JP
  ja_JP.eucjp
+ nl_NL
+ nl_NL.iso88591
  tr_TR.utf8
  zh_CN.gb18030
Ok, I will add the second two lines as well. Next, timezone

root:/#cp -v --remove-destination /usr/share/zoneinfo/Europe/Amsterdam  /etc/localtime



Add directories to the dynamic loader's search path, I note this because the search defaults for linux are unkown to me. This is one clue.

Done.



Tuesday, June 8, 2010

Chapter 6.8 man-pages

make install. That's it.

Chapter 6.7. Linux-2.6.32.8 API Headers

Well, after some comentary about log files. we are back to installing all of a sudden. I remember the phrase make mrproper from Chapter 5. I guess I need to install the linux package again.

root:/sources# tar -jxf linux-2.6.32.8.tar.bz2



root:/sources# cd linux

make headers_check
make INSTALL_HDR_PATH=dest headers_install
find dest/include \( -name .install -o -name ..install.cmd \) -delete
cp -rv dest/include/* /usr/include

APT = Application Programming Interface.

I am not learning much from the short description.

root:/sources/linux-2.6.32.8#make install 

AAAAAAAAAAAAAh! lots of errors!

scripts/kconfig/conf -s arch/x86/Kconfig
***
*** You have not yet configured your kernel!
*** (missing kernel config file ".config")
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
sh /sources/linux-2.6.32.8/arch/x86/boot/install.sh arch/x86/boot/bzImage \
System.map "/boot"

*** Missing file: System.map
*** You need to run "make" before "make install".

make[1]: *** [install] E
rror 1
make: *** [install] Error 2




Not paying attention again. I should have left linux and moved on to unpacking the man package!

Chapter 6.6 Files and Links

Continue from yesterday (did all the mounting anc chroot).

I have no name!:/#ln -sv /tools/bin/{bash,cat,echo,pwd,stty} /bin

Notice that the tools directory does not have $LFS in front of it anymore.

 
 
exec /tools/bin/bash --login +h

Chapter 6.5 Creating Directories

Left off reading this link http://www.pathname.com/fhs/ It's a 52 page document that I just can't read at the moment. It seems though, tha theyhave standadized where everything should be put. That's handy.

Monday, June 7, 2010

Chapter 6.4 Entering the Chroot **Important commands**

Gulp. I read all that stuff in between about the package installers. I look forward to actually learning who does what.

It is important that all the commands throughout the remainder of this chapter and the following chapters are run from within the chroot environment. If you leave this environment for any reason (rebooting for example), ensure that the virtual kernel filesystems are mounted as explained in Section 6.2.2, “Mounting and Populating /dev” and Section 6.2.3, “Mounting Virtual Kernel File Systems” and enter chroot again before continuing with the installation.

I doubt that I will finish this today, so I must remember this. Here are the mount commands from Section 6.2.2 and 6.2.3.

Keep in mind that my root does not have LFS in it's bash file, so I first explicitly type,   
export LFS=/media/lfs
mount -v -t ext3 /dev/sdb6 $LFS

mount -v --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

Here's the command to change root.

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

I am curious about this command, chroot. According to the man page:

chroot - run command or interactive shell with special root directory
SYNOPSIS: chroot NEWROOT [COMMAND...]. "The Bash shell is told that $LFS is now the root (/) directory. " The result of this command, other than that it has no name,  is that, when I type, pwd, I get the "/" mark. There are 19 directories, including tools and sources.

This is just a little weird. if I cd /, I get to the top of this partition $LFS and not to my original session. This concept of chroot is totally alien to me. But, I will move on.

I added this after Second Weekend blog entry.

exec /bin/bash --login +h

I am not sure if it is necessary. The assumptions seem to be that this is all done in one sitting, except for the warning with the chroot.  I am assuming that running it again cannot hurt.

Chapter 6.2. Preparing Virtual Kernel File Systems

Here we go. Following all recomendations (no optimisation, no parallel compiling). Recall from Chapter 5,

The commands in the remainder of this book must be performed while logged in as user root and no longer as user lfs. Also, double check that $LFS is set in root's environment.

Ok, so type "su -" and log in as root. (check echo $LFS, else export LFS=/media/lfs)

This makes "directories onto which the file systems will be mounted:"
mkdir -v $LFS/{dev,proc,sys}

I have no idea what a device node is.The numbers 5 1 and 1 3 appear in the file listing.

mknod -m 600 $LFS/dev/console c 5 1
mknod -m 666 $LFS/dev/null c 1 3
 
crw------- 1 root root 5, 1 2010-06-07 16:43 console
crw-rw-rw- 1 root root 1, 3 2010-06-07 16:43 null

Not really sure what this means: "A bind mount is a special type of mount that allows you to create a mirror of a directory or mount point to some other location.", or rather its purpose.

Here are the outputs ($LFS replacing my real directory) of the mount command. Not sure why each one is different or whether I should worry about it.
  • mount: devpts already mounted or $LFS/dev/pts busy,
    mount: according to mtab, devpts is already mounted on $LFS/dev/pts
  • shm on $LFS/dev/shm type tmpfs (rw)
  • $LFS/proc on $LFS/proc type proc (rw)
  • sysfs on $LFS/sys type sysfs (rw)
Output of df looks very strange for shm:
 /dev/sdb6             9,9G  651M  8,8G   7% $LFS
shm                    760M     0      760M   0% $LFS/dev/shm
Maybe I do not see the others because they are virtual Kernel filesystems? shm is shared memory, it seems.


    Review after weekend

    I have lost momentum over the weekend. Upon re-reading the last entry (Chapter 5.31 and 5.32) I am reminded that I should make a backup of the tools directory. Good. I recall that being important. I'll make 2. I do this as root so that I can save it in a special directory called "backup", owned by root.

    [backup]#dump -A tools_toc -f tools_dump -L LFS_TOOLS_LABEL -v $LFS/tools

    Check using restore,

    [directory_where_to_unpack]#restore -xf /backup/tools_dump -A /backup/tools_toc

    OK. dump is much faster than tar'ing and zip'ing, although it creates a 255MB file whereas tar'ing and zip'ing make an 80 MB file.

    No matter, log in to current session as lfs, su - lfs. I had made a text file called "things_to_do_first" which is a reminder to umount and mount the lfs partition. cd to $LFS and I am ready to start.

    I am re-reading the section of Chapter 5. After all this effort at keeping tools ownership as lfs, now I have to change it to root.

    ....%$#$%! Cleaning up a bit, I did something stupid and deleted my sources and tools directory. I easily restored the tools directory, luckily. But I have to download the sources again. Problem was that I had mounted the same partition as / AND /home. I wonder why it is allowed to have multiple names. Anyway, I forgot about home and thought that it was just one of the test files I made while testing the dump and restore. Sad to say, I have made this kind of mistake long ago....

    As root,
    [$LFS/sources]#wget -i wget-list
     74 files, 260M in 6m 3s (734 KB/s)

    [$LFS/sources]#chown -R lfs:lfs * (should be owned by lfs, although tools is now root owned).