Skip to content

Commit d4e5c3f

Browse files
committed
updated tools to 8.2
1 parent 35835e7 commit d4e5c3f

13 files changed

Lines changed: 278 additions & 169 deletions

File tree

LFSScripts/BuildFileSystem

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ pushd $LFS
4343
ln -sv /tools/bin/{perl,env,mkdir} usr/bin
4444
ln -sv /tools/lib/libgcc_s.so{,.1} usr/lib
4545
ln -sv /tools/lib/libstdc++.so{,.6} usr/lib
46-
sed 's/tools/usr/' tools/lib/libstdc++.la > usr/lib/libstdc++.la
4746
ln -sv bash bin/sh
4847
ln -sv /proc/self/mounts etc/mtab
4948

@@ -244,19 +243,35 @@ DISTRIB_CODENAME="$LFSNAME"
244243
DISTRIB_DESCRIPTION="Linux From Scratch"
245244
EOF
246245

247-
chown -R root:root $LFS/* 2>/dev/null
248-
touch var/log/{btmp,lastlog,wtmp}
249-
chmod -v 664 var/log/lastlog
250-
chmod -v 600 var/log/btmp
251-
chgrp -v utmp var/log/lastlog
252-
chmod 777 /tmp
246+
cat > etc/shells << EOF
247+
# Begin /etc/shells
248+
249+
/bin/sh
250+
/bin/bash
251+
252+
# End /etc/shells
253+
EOF
253254

254255
cat > root/.lfspkg.rc << EOF
256+
LFSVERSION=$LFSVERSION
257+
KERNELVERSION=$KERNELVERSION
258+
LIBDIRSUFFIX=$LIBDIRSUFFIX
259+
SCRIPTLOG=1
255260
OUTPUT=$BUILTPACKAGES
256261
SOURCEARCHIVES=$SOURCEARCHIVES
257262
BUILDSCRIPTS=$BUILDSCRIPTS
263+
COMPILEAT=\${COMPILEAT:-"\$SOURCEARCHIVES"}
264+
CONFIGOPTIONS="--disable-option-checking --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --libdir=/usr/lib$LIBDIRSUFFIX --disable-debug --disable-nls"
265+
CHECKETC=1
258266
EOF
259267

268+
chown -R root:root $LFS/* 2>/dev/null
269+
touch var/log/{btmp,lastlog,wtmp}
270+
chmod -v 664 var/log/lastlog
271+
chmod -v 600 var/log/btmp
272+
chgrp -v utmp var/log/lastlog
273+
chmod 777 /tmp
274+
260275
popd
261276

262277

LFSScripts/HowTo

Lines changed: 138 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,166 @@
11

22
1)
3+
4+
#It will be assumed that your LFS partition is mounted on /mnt/LFS, using /dev/sda1 and /dev/sda2 as swap, alter as needed.
5+
#Use sudo where necessary to create links etc.
6+
7+
#If compiling on raspberian you need to install some extra files like so:
8+
apt-get update
9+
apt-get install bison gawk m4 texinfo
10+
#Also make sure /bin/sh points to /bin/bash
11+
312
#Get the build scripts and helper scripts from:
413
#https://github.com/KeithDHedger/LFSPkgBuilds
514
#either via git clone or downloading the zip file and unpacking it.
615
#you should place the LFSPkgBuildScripts and LFSScripts folder in the root of what will be your new LFS eg /mnt/lfs/LFSPkgBuildScripts
716

817
###RECOMMENDED####
9-
#or cd into the mounted partition wher you intend to build LFS
10-
#sudo git clone https://github.com/KeithDHedger/LFSPkgBuilds.git --branch version8 --single-branch
11-
12-
#sudo chown -R $USER:$USER LFSPkgBuilds
13-
#sudo ln -sv LFSPkgBuilds/LFSPkgBuildScripts LFSPkgBuildScripts
14-
#sudo ln -sv LFSPkgBuilds/LFSScripts LFSScripts
18+
#or cd into the mounted partition wher you intend to build LFS:
19+
#LFS should point to your mounted LFS partition ( eg LFS=/mnt/LFS ).
20+
cd /mnt/LFS
21+
[sudo] git clone https://github.com/KeithDHedger/LFSPkgBuilds.git
1522

16-
2)
17-
#get the package manager archive wvia the host system
18-
cd LFSPkgBuildScripts/admin/LFSPkg
19-
wget -c --no-check-certificate "https://github.com/KeithDHedger/LFSPkg/archive/master.zip" -O LFSPkg.zip||true
20-
unzip LFSPkg.zip
23+
Own the files:
24+
[sudo] chown -R $USER:$USER $LFS/LFSPkgBuilds
25+
[sudo] ln -sv LFSPkgBuilds/LFSPkgBuildScripts $LFS/LFSPkgBuildScripts
26+
[sudo] ln -sv LFSPkgBuilds/LFSScripts $LFS/LFSScripts
2127

2228
3)
2329
#cd into the lfsscripts folder
24-
cd ./LFSScripts
25-
#Set variables in ./SystemData !!IMPORTANT!!
26-
#Run
30+
cd /mnt/LFS/LFSScripts
31+
#Set up config files !!IMPORTANT!!
32+
#You can just press 'Return' to accept the default.
33+
#Run:
34+
[sudo] ./LFSSetUp
35+
36+
#To check config:
2737
./ShowSystemData
28-
#to check all ok.
2938

3039
4)
31-
#Run BuildTools script.
40+
#Run BuildTools script:
3241
./BuildTools
3342

43+
4.5)
44+
#Mount bind external folder if set and if not already mounted.
45+
. ./SystemData
46+
mkdir -vp ${LFS}/${SOURCEARCHIVES}||true
47+
mkdir -vp ${LFS}/${BUILTPACKAGES}||true
48+
if [ "X$EXTFOLDER" != "X" ];then
49+
sudo mount --bind $EXTFOLDER/${BUILTPACKAGES} $LFS/${BUILTPACKAGES}
50+
sudo mount --bind $EXTFOLDER/${SOURCEARCHIVES} $LFS/${SOURCEARCHIVES}
51+
fi
52+
3453
5)
35-
#Run BuildFileSystem script.
54+
#Run BuildFileSystem script:
3655
./BuildFileSystem
3756

57+
5.2)
58+
#You may/will have to re-own the source folder etc, so:
59+
[sudo] chown -R $USER:$USER $LFS/LFSPkgBuilds
60+
61+
5.5)
62+
#Create a link from downloaded linux tarball to /LFSSourceArchives/8.2/KERNEL to prevent re-downloading source tarball.
63+
mkdir $LFS/LFSSourceArchives/$LFSVERSION/KERNEL
64+
cd $LFS/LFSSourceArchives/$LFSVERSION/KERNEL
65+
ln -sv ../SYSTEM/linux-$KERNELVERSION.tar.xz linux-$KERNELVERSION.tar.xz
66+
67+
5.6)
68+
#get the package manager archive via the host system:
69+
cd $LFS/LFSPkgBuildScripts/admin/LFSPkg
70+
wget -c --no-check-certificate "https://github.com/KeithDHedger/LFSPkg/archive/master.zip" -O LFSPkg.zip
71+
unzip LFSPkg.zip
72+
3873
6)
39-
#Chroot into tempory system.
40-
./Chroot system
74+
#Change back to $LFS/LFSScripts folder.
75+
cd $LFS/LFSScripts
76+
77+
#If you are building over ssh you may want to start a screen session that you can come back to later.
78+
screen
79+
80+
#Chroot into temporary system:
81+
[sudo] ./Chroot system
4182

4283
7)
4384
#You should now be in the chroot
44-
#First install lfspkg
85+
#First install lfspkg:
4586
cd /LFSPkgBuildScripts/admin/LFSPkg
4687
BOOTSTRAP=1 ./LFSPkg.LFSBuild install
4788

48-
#Set $LFS/etc/lfspkg.rc or $LFS/root/.lfspkg.rc (preferred) variables, make sure the SOURCEARCHIVES points to the same place as $SOURCEARCHIVES from SystemData as that's where the main LFS sytem source files are, you can do this either from in the chroot environment or from the host with root permisions.
49-
#The default SOURCEARCHIVES vaiable is set to /tmp/LFSSourceArchives.
50-
#You may also want to save built packages by setting the OUTPUT variable in lfspkg.rc, you may want to mount another folder in the chroot environment from the host for this, as you will need a fair amount of storage space for all the built packages for a full desktop system, you don't of course need to keep the built packages you can if space is short just delete them, in which case leave the OUTPUT variable as is and periodically delete everything in it.
51-
#It is handy to keep the built packages as if somthing goes wrong its's usually simpler and quicker to reinstall the binary package rather than building from source again, things like qt5 and firefox take a LOOooooonnng time to build from source.
52-
#
53-
#after first installing lfspkg and setting up $LFS/etc/lfspkg.rc you may want to manually move the lfspkg built package tarball to the folders set in the rc file, if you have changed them that is.
89+
#As part of the LFSSetUp script /mnt/LFS/root/.lfspkg.rc has been created to contain basic info needed by lfspkg, review and change if needed.
90+
#Set /mnt/LFS/etc/lfspkg.rc or /mnt/LFS/root/.lfspkg.rc (preferred) variables, make sure the SOURCEARCHIVES points to the same place as $SOURCEARCHIVES from #SystemData.local as that's where the main LFS system source files are, you can do this either from in the chroot environment or from the host with root permissions.
91+
#At this point wget/openssl is not installed so you will get a load of complaints from lfspkg, ignore them as lfspkg will be reinstalled later with the main system.
92+
93+
#You should run lfspkg --setup to create the lfspkg.rc file ( in ~ (/root) )
94+
#Rc files are sourced from /etc/lfspkg.rc then ~/.lfspkg.rc.
95+
#lfspkg --setup can be run again later if you need/want to change source/build folders etc.
96+
#For building the main system you should probably set the configure options config files in /etc and log options.
97+
lfspkg --setup
5498

5599
8)
56-
#Build main system
100+
#Build main system:
57101
cd /LFSPkgBuildScripts/system/system-meta
58-
#Use system-sysvinit-meta
59-
#for standard sysvinit like so:
102+
103+
#Use system-sysvinit-meta for standard sysvinit like so:
60104
./system-sysvinit-meta.LFSBuild install
61-
#Or use system-bbinit-meta.LFSBuild
62-
#for a RECOMMENDED busy box init system ( non standard ) like so:
105+
106+
#Or use system-bbinit-meta.LFSBuildfor a busy box init system ( non standard ) like so:
63107
./system-bbinit-meta.LFSBuild install
64108

65109
#Or for ##experimental## custom init system use:
66110
./system-LFSInit-meta.LFSBuild install
67111

112+
#Or for rpi sysvinit system use:
113+
./system-pi-sysvinit-meta.LFSBuild install
114+
115+
Wait for script to complete:
116+
...
117+
Have coffee
118+
Walk the dog
119+
...
120+
68121
9)
69-
#logout from temporary system
122+
#logout from temporary system:
70123
exit
71124

72125
10)
73-
#Remove tools folder link from host and if you want to save tools archive for futre use move/copy the ${LFS}/tools-${LFSVERSION}.tar.gz somewhere safe.
126+
#Remove tools folder link from host and if you want to save tools archive for futre use move/copy the ${LFS}/tools-${LFSVERSION}.tar.gz somewhere safe:
74127
sudo rm /tools
75-
#Remove the tools folder from your LFS install disk.
76-
sudo rm -rf ${LFS}/tools
128+
#Remove the tools folder from your LFS install disk:
129+
[sudo] rm -rf /mnt/LFS/tools
77130

78131
11)
79-
#Re-enter the chroot ( this time and subsequent times don't use the 'system' argument to Chroot ).
80-
sudo ./Chroot
132+
#Re-enter the chroot ( this time and subsequent times don't use the 'system' argument to Chroot ):
133+
[sudo] ./Chroot
81134

82135
12)
83136
#You MUST rebuild lfspkg after completeing the the basic system and removing the tools folder.
84137
#Use same process as 2)/7) EXCEPT do NOT use BOOTSTRAP=1
85138
#If you have set any vairiable in /etc/lfspkg.rc then reply 'R' ( without the quotes ) when asked about replacing files in /etc.
86-
#If you forgot to do the above bit just re-edit /etc/lfspkg.rc
139+
#If you forgot to do the above bit just re-edit /etc/lfspkg.rc:
140+
87141
cd /LFSPkgBuildScripts/admin/LFSPkg
88142
./LFSPkg.LFSBuild install
89143

90144
13)
91-
#Configure and build the kernel
145+
#No point in compiling your own kernel on pi so prebuilt one is used, so skip this bit on pi.
146+
#Configure and build the kernel:
92147
cd /LFSPkgBuildScripts/kernel
93148
./kernel.LFSBuild install
94149

150+
#Again on pi skip this bit as firmware is installed by the pi-system-meta package.
151+
#You may prefer to manually copy all firmware modules from the host sytem from /lib/firmware to your new LFS system.
152+
#Or use the firmware build script to install all the latest firmware from https://git.kernel.org/ eg Whilst still in the kernel build folder:
153+
./firmware.LFSBuild install
154+
95155
13.5)
156+
#No grub on pi
96157
#Optional install of grub, see here:
97-
http://www.linuxfromscratch.org/lfs/view/stable/chapter08/grub.html
158+
#http://www.linuxfromscratch.org/lfs/view/stable/chapter08/grub.html
98159

99-
The LFSSetup script will install a basic grub.cfg file in ${LFS}/${BUILDSCRIPTS}/system/grub/ based on the details given to the script.
100-
Check that the grub.cfg file is OK, make any changes and just copy it to /boot/grub, or manually do this:
160+
#The LFSSetup script will install a basic grub.cfg file in ${LFS}/${BUILDSCRIPTS}/system/grub/ based on the details given to the script.
161+
#Check that the grub.cfg file is OK, make any changes and just copy it to /boot/grub, or manually do this:
101162

102-
#assuming root device is /dev/sda and LFS system is on /dev/sda1 mounted at /mnt/LFS
163+
#assuming root device is /dev/sda and LFS system is on /dev/sda1 mounted at /mnt/LFS:
103164
grub-install /dev/sda
104165

105166
cat > /boot/grub/grub.cfg << "EOF"
@@ -110,13 +171,14 @@ set timeout=30
110171
insmod ext2
111172
set root=(hd0,1)
112173

113-
menuentry "GNU/Linux, Linux 4.9.9-lfs-8.0" {
114-
linux /boot/vmlinuz-4.9.9-lfs-8.0 root=/dev/sda1 ro
174+
menuentry "GNU/Linux, Linux 4.9.9" {
175+
linux /boot/vmlinuz-4.9.9 root=/dev/sda1 ro
115176
}
116177
EOF
117178

118179
14)
119-
#Build xorg
180+
#Before building the X server now is a good time to quickly boot into your new system and make sure all is OK, you can then reboot back to the host and continue building in the chroot or build in the 'real' system, the choice is yours but this HowTo assumes all building is done in the chroot.
181+
#Build xorg:
120182
cd /LFSPkgBuildScripts/xorg/xorg-meta/
121183
./xorg-meta.LFSBuild install
122184

@@ -139,6 +201,10 @@ cd /LFSPkgBuildScripts/print/cups
139201
cd /LFSPkgBuildScripts/gtk/gtk
140202
./gtk.LFSBuild install
141203

204+
#xsane frontends and xsane require gimp installed first to build the plugin
205+
cd /LFSPkgBuildScripts/desktop/gimp
206+
./gimp.LFSBuild install
207+
142208
#rest of printing stuff
143209
cd /LFSPkgBuildScripts/print/printing-meta
144210
./printing-meta.LFSBuild install
@@ -159,7 +225,7 @@ cd /LFSPkgBuildScripts/devel/development-meta
159225
#this is for an xfce4 desktop.
160226
cd /LFSPkgBuildScripts/desktop/desktop-meta
161227
./desktop-meta.LFSBuild install
162-
#Or for an LFSDesktop
228+
#Or fo r an LFSDesktop
163229
cd /LFSPkgBuildScripts/lfsdesktop/LFSDesktop-meta
164230
./LFSDesktop-meta.LFSBuild install
165231

@@ -202,24 +268,14 @@ cd /LFSPkgBuildScripts/net/davfs2
202268
cd /LFSPkgBuildScripts/net/curlftpfs
203269
./curlftpfs.LFSBuild install
204270

205-
#Qt5 stuff
206-
#cd /LFSPkgBuildScripts/qt/lxqt-meta
207-
#./lxqt-meta.LFSBuild install
208-
209271
#TODO
210272
cd /LFSPkgBuildScripts/qt/qt-creator
211273
./qt-creator.LFSBuild install
212274

275+
#If you are building in chroot you will pobably have to rerun the postinstall script for this package AFTER booting to the 'real' system.
213276
cd /LFSPkgBuildScripts/admin/mariadb
214277
./mariadb.LFSBuild install
215278

216-
#Busybox init
217-
#cd /LFSPkgBuildScripts/sys/busybox
218-
#./busybox.LFSBuild install
219-
#
220-
#cd /LFSPkgBuildScripts/sys/bootfiles
221-
#./bootfiles.LFSBuild install
222-
223279
#Odd stuff
224280
cd /LFSPkgBuildScripts/xorg/xbindkeys
225281
./xbindkeys.LFSBuild install
@@ -230,7 +286,29 @@ cd /LFSPkgBuildScripts/net/libcddb
230286
cd /LFSPkgBuildScripts/desktop/epdfview
231287
./epdfview.LFSBuild install
232288

233-
cd /LFSPkgBuildScripts/desktop/conky
234-
./conky.LFSBuild install
289+
#Conky is getting increasingly tied to gnome and difficult ( impossible! )to build.
290+
#cd /LFSPkgBuildScripts/desktop/conky
291+
#./conky.LFSBuild install
292+
293+
#Try an alternative!
294+
cd /LFSPkgBuildScripts/desktop/gkrellm
295+
./gkrellm.LFSBuild install
296+
297+
#System admin/security stuff
298+
cd /LFSPkgBuildScripts/admin/logrotate
299+
./logrotate.LFSBuild install
300+
301+
cd /LFSPkgBuildScripts/admin/fcron
302+
./fcron.LFSBuild install
303+
304+
cd /LFSPkgBuildScripts/admin/iptables
305+
./iptables.LFSBuild install
306+
307+
cd /LFSPkgBuildScripts/admin/fail2ban
308+
./fail2ban.LFSBuild install
309+
310+
311+
312+
235313

236314

0 commit comments

Comments
 (0)