November 12, 2009
Scratching the Linux Itch, pt. I
So I'm going to try a Linux From Scratch build and installation, just because I need another pointless project to write about :)
Here is the result of my version-check.sh script on my openSUSE 11.0 system:
bash, version 3.2.39(1)-release
/bin/sh -> /bin/bash
Binutils: (GNU Binutils; openSUSE 11.0) 2.18.50.20080409-11.1
bison (GNU Bison) 2.3
/usr/bin/yacc -> /usr/bin/yacc
bzip2, Version 1.0.5, 10-Dec-2007.
Coreutils: 6.11
diff (GNU diffutils) 2.8.7-cvs
find (GNU findutils) 4.4.0
GNU Awk 3.1.5h
/usr/bin/awk -> /bin/gawk
gcc (SUSE Linux) 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036]
GNU C Library stable release version 2.8
GNU grep 2.5.2
gzip 1.3.12
Linux version 2.6.25.20-0.5-pae (geeko@buildhost) (gcc version 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision
135036] (SUSE Linux) ) #1 SMP 2009-08-14 01:48:11 +0200
m4 (GNU M4) 1.4.11
GNU Make 3.81
patch 2.5.9
Perl version='5.10.0';
GNU sed version 4.1.5
tar (GNU tar) 1.19
makeinfo (GNU texinfo) 4.11
Compilation OK
So it looks pretty good so far. It's always scary when reformatting an existing partition. I have 3 primary 50gb partitions on a 250gb hard drive used to play with Linux distros. The fourth partition is an extended one with 2 logical partitions, a 90gb /home partition and a 2gb Swap. One of the primary partitions houses my regular distro, openSUSE 11.0, while the other 2 currently have an openSUSE 11.1 and an Ubuntu 9.04, neither of which I've used recently. So I'll just use the Ubuntu one, which is /dev/sdb3, and already created, so I just need to reformat it:
# mke2fs -jv /dev/sdb3
mke2fs 1.40.8 (13-Mar-2008)
Warning: 256-byte inodes not usable on older systems
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2883584 inodes, 11520613 blocks
576030 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
352 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
So far so good. Mount it on /mnt/lfs and we're good to go. On to chapter 3.
One small confusion about getting the matching packages is that while the manual says that an easy way to download all the packages is "by using wget-list as an input to wget", only they don't explain what that means. So here's what I did:
# cd $LFS/sources # wget -i wget-list [... 77 downloads later ...] FINISHED --2009-11-12 09:22:42-- Downloaded: 77 files, 257M in 39m 57s (110 KB/s)
Actually, it turns out there is a slight clarification in the FAQ here, although they still don't clearly mention that you should cd into the $LFS/sources folder before doing the wget command. Maybe getting a little too anal but I think every little bit helps. So it took about 40 minutes to download all 77 packages. Now, onto Chapter 4, Final Preparations.
My next bit of anal retentiveness comes in the section 4.4, Setting Up the Environment. The book suggests a way to create a .bash_profile that restarts the bash shell in a "good" (ie, clean) working environment. But it doesn't really help in my openSUSE distro, because there is a system wide /etc/bash.bashrc that gets executed, "cluttering" up the environment even when the system wide /etc/profile isn't executed. So I modified the .bash_profile to be:
exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash --norc ./bash-startup
The --norc prevents both the system and the user .bashrc file from executing. And I copied the .bashrc file they say to create to bash-startup, and appended a couple of lines, leaving me with:
set +h umask 022 LFS=/mnt/lfs LC_ALL=POSIX LFS_TGT=$(uname -m)-lfs-linux-gnu PATH=/tools/bin:/bin:/usr/bin export LFS LC_ALL LFS_TGT PATH # my added lines to create a brand new, empty shell: export PS1='\u:\w\$ ' exec bash --norc --noprofile
So I added the PS1 export and then re-exec bash, this time with neither the rc files or the profile files getting executed, just to be safe. Even then, there are a bunch of environment variables, but I think they are just ones that bash sets up for itself:
$ su - lfs Password: lfs:~$ set BASH=/bin/bash BASH_ARGC=() BASH_ARGV=() BASH_LINENO=() BASH_SOURCE=() BASH_VERSINFO=([0]="3" [1]="2" [2]="39" [3]="1" [4]="release" [5]="i586-suse-linux-gnu") BASH_VERSION='3.2.39(1)-release' COLUMNS=80 DIRSTACK=() EUID=1003 GROUPS=() HISTFILE=/home/lfs/.bash_history HISTFILESIZE=500 HISTSIZE=500 HOME=/home/lfs HOSTNAME=touch HOSTTYPE=i586 IFS=$' \t\n' LC_ALL=POSIX LFS=/mnt/lfs LFS_TGT=i686-lfs-linux-gnu LINES=24 MACHTYPE=i586-suse-linux-gnu MAILCHECK=60 OPTERR=1 OPTIND=1 OSTYPE=linux-gnu PATH=/tools/bin:/bin:/usr/bin PPID=16656 PS1='\u:\w\$ ' PS2='> ' PS4='+ ' PWD=/home/lfs SHELL=/bin/bash SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor SHLVL=1 TERM=vt100 UID=1003 _=bash lfs:~$
Now that the environment is set, time to move on to Chapter 5.
The series so far:
del.icio.us | Digg it | Furl | Yahoo MyWeb | Create Social Bookmark Links
Posted by jdarnold at 10:36 AM | TrackBack
Track with co.mments
Track with co.mments 


