LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (http://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Automate LFS 7.1 (http://www.linuxquestions.org/questions/linux-from-scratch-13/automate-lfs-7-1-a-933096/)

Johnburrell 03-06-2012 07:03 PM

Automate LFS 7.1
 
If you have installed LFS a few times and you want to automate your next build you use jhalfs - right? But if you use Matthias Benkmann's excellent package-user management system, you have to build manually - right? Wrong.

I have taken an original script by Firerat and added more flexibility and made it easier to use. I suggest you try it when you want to build LFS 7.1

Everything you need is at:
github.com/JohnBurrell/LFS-BuildScripts - just follow the instructions and if you have any questions, ask them here.

Also you have the opportunity of changing the lfsa script to suit exactly your needs - and have a lot of fun doing it.

Give it a try and let me know how you get on. If you need any help, I'll happily give it, but please don't use the scripts if you are a neophyte. Build manually a few times first.

jb.

knudfl 03-08-2012 04:21 AM

Interesting. Thank you.

https://github.com/JohnBurrell/LFS-BuildScripts
$ git clone https://github.com/JohnBurrell/LFS-BuildScripts.git

lich000king 04-08-2012 03:24 AM

Awesome, thanks a lot for this!

Working good so far.

In chapter02.sh I had to add
export LFS=/mnt/lfs
at the beginning even though echo $LFS would correctly output /mnt/lfs.

In chapter06-asroot.sh I got a weird problem, the command
$ mkdir -v $LFS/{dev,proc,sys}
actually created a directory called "{dev,proc,sys}".
I replaced the above command by three separate commands, no problem.
But still I don't understand why this happens?

Cheers
Oliver

druuna 04-08-2012 03:35 AM

Hi,
Quote:

Originally Posted by lich000king (Post 4647549)
In chapter06-asroot.sh I got a weird problem, the command
$ mkdir -v $LFS/{dev,proc,sys}
actually created a directory called "{dev,proc,sys}".

It looks like you are using dash instead of bash.

Code:

$ dash
$ mkdir -v $LFS/{dev,proc,sys}
$ ls -l $LFS
total 16
drwxr-xr-x 2 root root 4096 Apr  8 10:31 {dev,proc,sys}
$ exit

$ bash
$ mkdir -v $LFS/{dev,proc,sys}
$ ls -l $LFS
total 16
drwxr-xr-x 2 root root 4096 Apr  8 10:31 dev
drwxr-xr-x 2 root root 4096 Apr  8 10:31 {dev,proc,sys}
drwxr-xr-x 2 root root 4096 Apr  8 10:31 proc
drwxr-xr-x 2 root root 4096 Apr  8 10:31 sys

Hope this helps.

lich000king 04-08-2012 07:28 AM

Hi druuna
Quote:

Originally Posted by druuna (Post 4647554)
It looks like you are using dash instead of bash.

Err, not that I'm aware.

$ uname -r
2.6.38.8-generic

$ echo $SHELL
/bin/bash

However, the latter is not much of a proof, since
Code:

$ dash
$ echo $SHELL
/bin/bash

Ok, but when I do mkdir {a,b} outside of the script I actually get two directories. So where might my shell be turned into dash without me noticing?
The lfsa script does not contain a dash command.

druuna 04-08-2012 07:48 AM

Hi,

Most common mistake: sh is linked to dash on your host and not to bash as mentioned in the requirements.
Code:

on your host
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Dec 18 12:25 /bin/sh -> bash

Hope this helps.

lich000king 04-08-2012 08:29 AM

Hm, in earlier builds I did not have this problem.
So either this link does not matter when not using Johnburrell's script, or the link was changed somehow, maybe an ubuntu update?
In any event, you are of course right, thanks!

lich000king 05-13-2012 03:45 AM

Hi again

I tried this once more on a compliant Debian host.

In chapter05.sh I get an error:
Code:

mkdir: created directory `../gcc-build'
Configuring...success
Building...success
Installing...success
`/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.6.2/libgcc_eh.a' -> `libgcc.a'
cp: cannot stat `/mnt/lfs/sources/linux-headers*.*': No such file or directory

If I understand the script correctly, the relevant bit from chapter05.sh is:

Code:

CreateBuildDir () {
BuildDir=${LFS}${builddir05}/$FuncName
if [ ! -e $BuildDir ]; then
  install -d $BuildDir
  cd $BuildDir
else
  cd $BuildDir
fi
}
unpack05 () {
starttime=$( date +%s )
cp ${LFS}${sourcedir}/${Pkg}*.* .
cd `tar vxf ${Pkg}*z* | awk -F\/ 'END{print $1}'`

endtime=$( date +%s )
set +e
unpacktime=$( expr $endtime - $starttime )
set -e
starttime=$( date +%s )
}

So it tries to copy a linux-headers archive instead of the kernel archive.
But why does this happen? The last time I tried, I got beyond this point...

I am using the 7.1 stable book and the most recent version of the build-scripts.

Cheers
Oliver

Johnburrell 05-13-2012 10:01 AM

Hi Oliver

Yes you're right, it fails at the line:

cp ${LFS}${sourcedir}/${Pkg}*.* .

I think this is because the symlink from linux-headers to the linux kernel is not set up.

There is a function in lfsa called SymlinkFudge () which sets up the link like this:

case $File in
linux-*) ln -s $File $SOURCEDIR/linux-headers.tar.$( echo $File | awk -F\. '{print $NF}' );;

Have a look in the sources dir. Linux-headers.tar.xz should be a symlink to the linux source package.

Regards

jb.

lich000king 05-14-2012 01:51 PM

Quote:

Originally Posted by Johnburrell (Post 4677312)
I think this is because the symlink from linux-headers to the linux kernel is not set up.

Indeed, the link is not present. Actually the kernel is not present, either, so it is not surprising id did not create a link.:doh:
I must have made a mistake when copying it.:o

After making sure the kernel is in place, I reran chapter05.sh. I had to delete the book in order to do so. This time it completed succesfully.

Thanks for your help!

Johnburrell 05-14-2012 03:27 PM

That symlink is rather a nasty fudge so I got rid of it. I created a package name and a source name so now the two can be different with out any worries. I also created a command name as well which gets rid of the xz-utils symlink too. So the package name, the source name and the command name can all be different.

This is essential in blfs where such things happen frequently. I'm still playing with the blfs script but it installs x okay and I'm currently testing gnome. There are some querks which I can't iron out at the moment but that's not surprising when the script sets up the installation of over 300 packages.

I'll post the update of lfsa on github when I've tested it and you're welcome to try blfsa when you're ready.

jb.

lich000king 05-21-2012 03:39 AM

This is great!
Chapter 6 finished successfully.
I will just write some of my experiences here if somebody else wants to try this.

In chapter 6 I got
Code:

su: /bin/bash: Permission denied
but I could avoid it by doing
Code:

chmod 777 /mnt/lfs
before
Code:

./chapter06-chroot.sh
I also got
Code:

ldconfig: /usr/lib/libstdc++.so.6.0.16-gdb.py is not an ELF file - it has
# the wrong magic bytes at the start.

many times. Since I could not find out why this happens, I just ignored it.

Also, I got this kind of error on all the packages:
Code:

install: creating directory `/usr/src/core/vim'
Home directory will be /usr/src/core/vim
create user vim with uid 10053
create group vim with gid 10053
useradd: group '1000' does not exist
useradd: the GROUP= configuration in /etc/default/useradd will be ignored
Configuring...success
Building...success
Installing...success

I ignored that one as well.

Other than the ldconfig and the group error, everything seems fine as far as I can tell.

Quote:

I'll post the update of lfsa on github when I've tested it
Ok, I will test it. Is tere a way I can see the changes from your update?
When I go to "commits" on https://github.com/JohnBurrell/LFS-BuildScripts I seem to get the full code as "new" rather than the changes.

Quote:

you're welcome to try blfsa when you're ready
Sure, I would like to try this.
I already tried to install some blfs packages through the package management, but many of them give permission errors (which don't happen if I install them without package management).
Also, something bad happend when trying to install glib and pkg-config, I need to investigate further.

Cheers
Oliver

Johnburrell 05-21-2012 08:35 AM

Don't know why you get permission denied with /bin/bash. I'll investigate further.

You can safely ignore the ldconfig message. That goes away with latest version of glibc.

Also ignore the useradd messages. If you create group 1000 for your own personal username and useradd that name with that group, the message goes away.

I made quite a few changes to lfsa so I decided to post a new version of everything rather than update it. You'll have to replace your version with the new one.

I'll put up the BLFS-BuildScripts today. They seem to be working okay. I went from nothing to installed gnome over the weekend with only a couple of problems.

jb

lich000king 05-30-2012 01:46 PM

Ok, tried again with the new version.
Now I get:
Code:

mkdir: created directory `../glibc-build'
Configuring...successful!
Building...successful!
Installing...successful!
cp: cannot stat `/mnt/lfs/sources/adjusting-*.*': No such file or directory

If I understand correctly, chapter05.sh checks if 'adjusting-*.*' is present and if it is not is should skip it. But for some reason it is not skipped.

Another thing:
Is it possible to call lfsa in such a way that the menuconfig is skipped?
I am about to write a script that automates the process even further. There I have export commands for TZ, PAPPER_SIZE, etc which are then stored in the config file. So it would be nice if the menu did not show anymore.

Johnburrell 05-30-2012 04:18 PM

Are you sure you have the latest version of lfsa? I've just generated chapter05.sh and the word 'adjusting' does not appear anywhere in that script. At the end of glibc, there is this:

echo 'main(){}' > dummy.c
$LFS_TGT-gcc dummy.c
readelf -l a.out | grep ': /tools'
rm -v dummy.c a.out

and then it goes on to binutilspass2. I don't see the cp command anywhere. The adjusting commands are in chapter06.sh.

Ah, I guess you are building 7.1, are you? I made the changes to lfsa but have only tested them on current_development. May be the commands for 7.1 are different - there must be an 'adjusting' after glibc in there. In current_development this has gone. Is it possible for you to download the current_development book version and sources and try that? If that works, I'll go back and test 7.1 and make the necessary changes.

With regard to the config file, you could change the lfsa script so that it doesn't use dialog. Then it won't display anything - but of course you won't be able to change anything.

Regards

jb.


All times are GMT -5. The time now is 01:52 AM.