Tuesday, December 30, 2008

How to automate LFS 6.4

There must be some way to build LFS 6.4 with jhalfs in a manner similar to the original post.

What this requires is
- Get the XML
- Get the source packages

I found you can get the XML with
svn co svn://svn.linuxfromscratch.org/LFS/tags/6.4/BOOK

NOTICE: Line wrap problems
Where a line ends with a backward slash \
it means the next line is part of the same line.

I found you can get a wget list for the source packages at:
http://www.linuxfromscratch.org/lfs/\
downloads/stable/LFS-BOOK-6.4-wget-list

As it turns out, there is another way to get the XML at:
http://www.linuxfromscratch.org/lfs/\
downloads/stable/LFS-BOOK-6.4-XML.tar.bz2

In the above 2 URLs, "6.4" may be substituted for "stable"

http://www.linuxfromscratch.org/lfs/\
downloads/6.4/LFS-BOOK-6.4-wget-list

http://www.linuxfromscratch.org/lfs/\
downloads/6.4/LFS-BOOK-6.4-XML.tar.bz2

good for when "stable" may agiain change to, perhaps, "6.5", or "7.0"

Here goes:
mke2fs -j /dev/????? (this time, my ?????=sdb11)
mkdir /mnt/build_dir
mount /dev/????? /mnt/build_dir
mkdir /mnt/build_dir/sources
mkdir /mnt/build_dir/BOOK

I already have some sources from LFS-6.3 and BLFS 6.3.
Most of the new files will have to be downloaded, but
I'll optionally go ahead and copy what I've got first:
cd /sources
find . -maxdepth 1 ! -type d \
-exec cp -v -t /mnt/build_dir/sources {} \;

So, download the LFS-BOOK-6.4-wget-list and use it to download the newest source packages:
wget -c -i LFS-BOOK-6.4-wget-list \
-P /mnt/build_dir/sources

The -c switch on wget tells no need to download a file that is already there (if the remote server cooperates)

Then download LFS-BOOK-6.4-XML.tar.bz2 and unpack it:
tar -C /mnt/build_dir/BOOK -xf LFS-BOOK-6.4-XML.tar.bz2
mv /mnt/build_dir/BOOK/{BOOK,LFS-BOOK-6.4-XML}

Download and unpack jhalfs (stick with 2.3.1 for now):
wget http://www.linuxfromscratch.org/alfs/\
downloads/jhalfs/stable/jhalfs-2.3.1.tar.bz2
tar -C /mnt/build_dir -xf jhalfs-2.3.1.tar.bz2
mv /mnt/build_dir/jhalfs{-2.3.1,}

The above mv command renames jhalfs-2.3.1 to jhalfs.
Because the jhalfs software expects the name to be jhalfs.

That replaces the steps from the original post:
mkdir /tmp/livecd
to:
umount /tmp/livecd

Then adjust the jhalfs configuration settings from:
BOOK.............. /mnt/build_dir/BOOK/LFS-BOOK-6.3-XML
to:
BOOK.............. /mnt/build_dir/BOOK/LFS-BOOK-6.4-XML

Aw heck, I'm gonna twiddle with the linux kernel to make it 2.6.28.
Skip this and use linux-2.6.27.4 that comes with LFS-6.4 unless you want to break it.

To make the change, download the desired kernel and edit the file called packages.ent in the LFS-BOOK-6.4-XML directory:

wget -P /mnt/build_dir/sources -c \
http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.28.tar.bz2
cp \
/mnt/build_dir/BOOK/LFS-BOOK-6.4-XML/packages.ent{,.orig}
(because I'm gonna try and \\fix\\it\\good\\...[break it].)
cd /mnt/build_dir/BOOK/LFS-BOOK-6.4-XML
edit (I use vim) packages.ent
change linux-minor-version from 27 to 28
on line with ENTITY linux-version, change:
".&linux-patch-version;" to ""
I changed the .&linux-patch-version; to nothing, because linux-2.6.28 does not have a patch version yet.
So, the diff is like this:
*** packages.ent.orig 2008-12-29 22:14:23.000000000 -0500
--- packages.ent 2008-12-29 22:12:02.000000000 -0500
***************
*** 313 ****
! <!ENTITY linux-minor-version "27">
--- 313 ----
! <!ENTITY linux-minor-version "28">
***************
*** 315 ****
! <!ENTITY linux-version "&linux-major-version;.&linux-minor-version;.&linux-patch-version;">
--- 315 ----
! <!ENTITY linux-version "&linux-major-version;.&linux-minor-version;">

Then the linux version is different, so that must be adjusted in the jhalfs configuration as well as the instructions for perparing the kernel config.
cd /mnt/build_dir/sources
tar -xf linux-2.6.28.tar.bz2
mv linux-2.6.28 linux-2.6.28.unpacked
cd linux-2.6.28.unpacked
make mrproper
# If you have a .config file you wish to use copy it here
# Ex: cp /boot/config-2.6.22.5 .config
# LFS recommends:
# It is often better to explore all the configuration menus
# and create the kernel configuration from scratch.
make menuconfig
chown -R regular_user:regular_user /mnt/build_dir

You must be root or sudo to change ownership to the regular_user that is going to do the build:
chown -R regular_user:regular_user /mnt/build_dir

(if regular_user is jhalfs, then it is:
chown -R jhalfs:jhalfs /mnt/build_dir
)

As regular_user {
cd /mnt/build_dir/jhalfs
cp Makefile{,.orig}
###In case I may want to redo###
make
}

--- BOOK SETTINGS --->
Use BOOK (Linux From Scratch)
Release --->
(X) Working Copy
(** EDIT ME**) Book Version
change:
** EDIT ME**
to:
/mnt/build_dir/BOOK/LFS-BOOK-6.4-XML
[*] Add custom tools support (only if you know what this is and you already have put the scripts in the /mnt/build_dir/custom/config directory)

--- General Settings --->
[*] Change the default user/group and homedir for this build
(lfs) User account (NEW)
change it to the regular_user (I will use jhalfs)
--- Build Settings --->
[*] Build the kernel
(***EDIT ME***) Kernel config file (NEW)
change:
***EDIT ME***
to:
/mnt/build_dir/sources/linux-2.6.28.unpacked/.config


Do you wish to save your new JHALFS configuration
Yes

It will do some processing and then exit without reporting an error.
The Makefile will have changed.
You can look at the Makefile,
especially the 136-kernel part and make sure
it is the same kernel that is intended.

The next time you type "make" it will start building.

If anything didn't seem right, there is only 1 possibility to do over at this point:
cp Makefile{.orig,}
GOTO ###In case I may want to redo### (above)

make

... it will be busy building for the next several hours ...


--------------------------------------------------------------------------------
mk_SETUP
ROOT privilege is required to perform a number commands
sudo will request a password to all high privilege cmds to execute correctly
make[1]: Entering directory `/mnt/build_dir/jhalfs'
--------------------------------------------------------------------------------
Building target 020-creatingtoolsdir

Target 020-creatingtoolsdir OK
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Building target 021-addinguser

Target 021-addinguser OK
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Building target 022-settingenvironment

Target 022-settingenvironment OK
--------------------------------------------------------------------------------
make[1]: Leaving directory `/mnt/build_dir/jhalfs'
--------------------------------------------------------------------------------
mk_LUSER
You are going to log into the user account jhalfs
sudo requires a password
--------------------------------------------------------------------------------
Building target 029-binutils-pass1
[++++++++++++++++++++++++++++++++++++++++ ] 9 min. 39 sec
Target 029-binutils-pass1 OK
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Building target 030-gcc-pass1
[++++++++++++++++++++++++++++++++++++++++++++++++++++++| ] 206 min. 54 sec

"Two million things can still go wrong with this stunt."

--------------------------------------------------------------------------------
Building target 031-linux-headers
[+++++++++++++++++++++ ++++++/ ] 2 min. 28 sec
Target 031-linux-headers OK
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Building target 032-glibc
[\ls: cannot access /mnt/build_dir/sources/glibc-2.8-20080929.tar.bz2: No such file or directory
tar: option requires an argument -- f
Try `tar --help' or `tar --usage' for more information.
make: *** [032-glibc] Error 1
make: *** [mk_LUSER] Error 2

Glibc (2.8-20080929) can no longer be found at the location specified in the LFS-6.4 BOOK and in the wget list:
ftp://sources.redhat.com/pub/glibc/snapshots/glibc-2.8-20080929.tar.bz2
The errata says you can get it at:
ftp://ftp.lfs-matrix.net/pub/lfs/lfs-packages/development/glibc-2.8-20080929.tar.bz2

wget -c -P /mnt/build_dir/sources \ ftp://ftp.lfs-matrix.net/pub/lfs/lfs-packages/development/glibc-2.8-20080929.tar.bz2

--14:26:48-- ftp://ftp.lfs-matrix.net/pub/lfs/lfs-packages/development/glibc-2.8-20080929.tar.bz2
=> `/mnt/build_dir/sources/glibc-2.8-20080929.tar.bz2'
Resolving ftp.lfs-matrix.net... 208.113.193.9
Connecting to ftp.lfs-matrix.net|208.113.193.9|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD /pub/lfs/lfs-packages/development ... done.
==> PASV ... done. ==> RETR glibc-2.8-20080929.tar.bz2 ... done.
Length: 16,231,976 (15M) (unauthoritative)

100%[====================================>] 16,231,976 26.14K/s ETA 00:00

14:36:56 (26.11 KB/s) - `/mnt/build_dir/sources/glibc-2.8-20080929.tar.bz2' saved [16231976]

make
--------------------------------------------------------------------------------
mk_LUSER
You are going to log into the user account jhalfs
sudo requires a password
--------------------------------------------------------------------------------
Building target 032-glibc
[ +++++++++++++++++++ ] 2 min. 28 sec
...
...
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Building target 103-kbd
[++++++++++++++++++++++++++|make: *** [103-kbd] Error 2 ] 0 min. 26 sec
make: *** [mk_CHROOT] Error 2
In file included from fgconsole.c:9:
/usr/include/linux/serial.h:164: error: expected specifier-qualifier-list before '__u32'
make[2]: *** [fgconsole.o] Error 1
make[2]: Leaving directory `/sources/kbd-1.14.1/src'
make[1]: *** [all] Error 1
make[1]: Leaving directory `/sources/kbd-1.14.1'

Maybe linux-2.6.28 not so hot.
Maybe try again with linux-2.6.27.4 that comes with LFS-6.4 ...

But first, try and be a linux trainee and seek deep solutions.
I see linux-2.6.28 complaints and mentions of patches like this one.

Hmmmm ....
Gentoo Bug 252721 - Many packages don't compile with linux-headers-2.6.28: /usr/include/linux/serial.h:164: error: expected specifier-qualifier-list before ‘__u32

Hack it:
I make some kind of patch like this /mnt/build_dir/sources/u32-include-types.patch
In the commit below a new struct serial_rs485 was introduced for a new
ioctl:

commit c26c56c0f40e200e61d1390629c806f6adaffbcc
Author: Alan Cox <a...@redhat.com>
Date: Mon Oct 13 10:37:48 2008 +0100

tty: Cris has a nice RS485 ioctl so we should steal it

This structure uses the __u32 types for some of its members, which leads
to the following compile error:

$ cc -I.../include -c X.c
In file included from X.c:2: .../include/linux/serial.h:185:
error: expected specifier-qualifier-list before `__u32'
$

It seems that these types are appropriate for this structure as it is
to be exposed to userspace. These types are available via linux/types.h
so move the include of that outside the __KERNEL__ section.

Signed-off-by: Andy Whitcroft <a...@canonical.com>
---
include/linux/serial.h | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/linux/serial.h b/include/linux/serial.h
index 1ea8d92..9136cc5 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -10,8 +10,9 @@
#ifndef _LINUX_SERIAL_H
#define _LINUX_SERIAL_H

-#ifdef __KERNEL__
#include <linux/types.h>
+
+#ifdef __KERNEL__
#include <asm/page.h>


I stick code before make headers_check:
patch -Np1 -i ../u32-include-types.patch

Into
lfs-commands/chapter05/031-linux-headers
And
lfs-commands/chapter06/066-linux-headers

* The serial.h issue in linux-headers will apparently be fixed in linux-2.6.28.1 since it seems fixed in the git.

I wish for luck for it to build ok.

...

Pentium III 800 1.5GB
LFS-6.3: SBU=518: BUILD_TIME=78*SBU =40404 seconds =11.25 hours
LFS-6.4: SBU=544: BUILD_TIME=114.9*SBU = 62506 seconds =17.36 hours
It took 1.5 as much time to build 6.4 as it took to build 6.3.
This article about different gcc versions made interesting reading since I prefer faster to slower.
Gpm gets compile errors.
Adding gpm hacks
I went back and rebuilt the kernel.
Under makemenu config, GENERAL SETUP, I answered N to:
[ ] Create deprecated sysfs files
and recompiled the kernel to get rid of crazy boot up message:
 kernel: udev: deprecated sysfs layout (kernel too old, or CONFIG_SYSFS_DEPRECATED) is unsupported, some udev features may fail

Still get crazy boot up message that google search seem to indicate is harmless:
 kernel: Driver 'sd' needs updating - please use bus_type methods


Not realy great omens.

Things not compile:
dhcpcd-2.0.8
MesaLib-6.5.2
Tried installing /opt/gcc-3.3.6 and compile MesaLib with that -- NOPE!
Source-based system can't compile, what's the good?
I'll likely bail out to LFS 6.3.

Maybe I jumped the gun.
The MesaLib-6.5.2 must be built upon exactly libdrm-2.3.0 and I had built libdrm-2.3.1 which is the likely culprit in causing it to throw an error.

It is a challenge to maintain optimism when so many things go awry.

Pay attention that Some issues and possible solutions regarding the use of Glibc 2.8 and GCC 4.3.2 in BLFS.
LFS-6.4 "breaks" some things in BLFS-6.3 and there is work in progress on BLFS-6.4.
Least hassles to stick with the original post and LFS-6.3 plus BLFS-6.3 until both become stabilized at the same level (e.g., LFS-6.4 and BLFS-6.4), unless you are lucky enough to be a fun person who loves solving unexpected surprises.

1 Comments:

Blogger . said...

Good work. Did 6.3 or 6.4 build okay?

February 23, 2009 at 2:22 AM  

Post a Comment

Subscribe to Post Comments [Atom]

Click blog title for the latest post