LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 03-06-2012, 07:03 PM   #1
Johnburrell
Member
 
Registered: May 2004
Distribution: FC3
Posts: 87

Rep: Reputation: 27
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.
 
Old 03-08-2012, 04:21 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Interesting. Thank you.

https://github.com/JohnBurrell/LFS-BuildScripts
$ git clone https://github.com/JohnBurrell/LFS-BuildScripts.git
 
Old 04-08-2012, 03:24 AM   #3
lich000king
Member
 
Registered: Jun 2011
Posts: 56

Rep: Reputation: Disabled
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
 
Old 04-08-2012, 03:35 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,
Quote:
Originally Posted by lich000king View Post
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.
 
1 members found this post helpful.
Old 04-08-2012, 07:28 AM   #5
lich000king
Member
 
Registered: Jun 2011
Posts: 56

Rep: Reputation: Disabled
Hi druuna
Quote:
Originally Posted by druuna View Post
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.
 
Old 04-08-2012, 07:48 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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.
 
1 members found this post helpful.
Old 04-08-2012, 08:29 AM   #7
lich000king
Member
 
Registered: Jun 2011
Posts: 56

Rep: Reputation: Disabled
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!
 
Old 05-13-2012, 03:45 AM   #8
lich000king
Member
 
Registered: Jun 2011
Posts: 56

Rep: Reputation: Disabled
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
 
Old 05-13-2012, 10:01 AM   #9
Johnburrell
Member
 
Registered: May 2004
Distribution: FC3
Posts: 87

Original Poster
Rep: Reputation: 27
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.
 
1 members found this post helpful.
Old 05-14-2012, 01:51 PM   #10
lich000king
Member
 
Registered: Jun 2011
Posts: 56

Rep: Reputation: Disabled
Quote:
Originally Posted by Johnburrell View Post
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.
I must have made a mistake when copying it.

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!
 
Old 05-14-2012, 03:27 PM   #11
Johnburrell
Member
 
Registered: May 2004
Distribution: FC3
Posts: 87

Original Poster
Rep: Reputation: 27
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.
 
Old 05-21-2012, 03:39 AM   #12
lich000king
Member
 
Registered: Jun 2011
Posts: 56

Rep: Reputation: Disabled
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
 
Old 05-21-2012, 08:35 AM   #13
Johnburrell
Member
 
Registered: May 2004
Distribution: FC3
Posts: 87

Original Poster
Rep: Reputation: 27
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
 
Old 05-30-2012, 01:46 PM   #14
lich000king
Member
 
Registered: Jun 2011
Posts: 56

Rep: Reputation: Disabled
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.
 
Old 05-30-2012, 04:18 PM   #15
Johnburrell
Member
 
Registered: May 2004
Distribution: FC3
Posts: 87

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


Reply

Tags
automated, lfs



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
[SOLVED] LFS 6.7 : $LFS/sources and $LFS/tools folders missing prakashsince92 Linux From Scratch 5 12-09-2010 02:26 PM
LFS newbie stuck in Linux API headers step 5.5 LFS book 6.3 Vxplus Linux From Scratch 2 11-10-2008 08:13 PM
LXer: Speaking Unix, Part 6: Automate, automate, automate! LXer Syndicated Linux News 0 01-04-2007 09:54 AM
LFS Book Chapter 6 - 1st step (chroot to /mnt/lfs) doens't work bauld Linux From Scratch 11 03-15-2006 12:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 09:13 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
Open Source Consulting | Domain Registration