mirror of
https://github.com/KeithDHedger/LFSPkgBuilds.git
synced 2025-08-19 16:25:24 +00:00
code cleaning ...
This commit is contained in:
544
LFSScripts/Common/BuildTools1
Executable file
544
LFSScripts/Common/BuildTools1
Executable file
@ -0,0 +1,544 @@
|
||||
#!/bin/bash -e
|
||||
#
|
||||
#©K. D. Hedger. Wed 3 Mar 14:36:07 GMT 2021 keithdhedger@gmail.com
|
||||
#
|
||||
#This file (BuildTools1) is part of LFSPkgBuilds.
|
||||
#
|
||||
#LFSPkgBuilds is free software: you can redistribute it and/or modify
|
||||
#it under the terms of the GNU General Public License as published by
|
||||
#the Free Software Foundation, either version 3 of the License, or
|
||||
#at your option) any later version.
|
||||
#
|
||||
#LFSPkgBuilds is distributed in the hope that it will be useful,
|
||||
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
#GNU General Public License for more details.
|
||||
#
|
||||
#You should have received a copy of the GNU General Public License
|
||||
#along with LFSPkgBuilds. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#Version 10.1
|
||||
|
||||
|
||||
RED='\e[1;31m'
|
||||
GREEN='\e[1;32m'
|
||||
NORMAL='\e[0;0m'
|
||||
|
||||
trap 'echo -e "$0 ${RED}FAILED${NORMAL} at line ${GREEN}${LINENO}${NORMAL}"' ERR
|
||||
|
||||
if [ -e ./SystemData ];then
|
||||
. ./SystemData
|
||||
else
|
||||
echo "No SystemData file found ..."
|
||||
exit 100
|
||||
fi
|
||||
|
||||
if [ -e ./PkgVersions ];then
|
||||
. ./PkgVersions
|
||||
else
|
||||
echo "No PkgVersions file found ..."
|
||||
exit 100
|
||||
fi
|
||||
|
||||
mkdir -vp "${LFS}${SOURCEARCHIVES}" "$LFS/${PKGARCHIVES}"|| true
|
||||
|
||||
if ! mountpoint $LFS/${PKGARCHIVES} && ! mountpoint $LFS/${SOURCEARCHIVES} ;then
|
||||
if [ "X$EXTFOLDER" != "X" ];then
|
||||
sudo -p "Enter admin PW to bind $EXTFOLDER to $LFS/${PKGARCHIVES}: " mount --bind $EXTFOLDER/${PKGARCHIVES} $LFS/${PKGARCHIVES}
|
||||
sudo -p "Enter admin PW to bind $EXTFOLDER $LFS/${SOURCEARCHIVES}: " mount --bind $EXTFOLDER/${SOURCEARCHIVES} $LFS/${SOURCEARCHIVES}
|
||||
fi
|
||||
fi
|
||||
|
||||
SYSTEMSOURCE="${LFS}${SOURCEARCHIVES}/SYSTEM"
|
||||
NETSOURCE="${LFS}${SOURCEARCHIVES}/NET"
|
||||
mkdir -vp "$SYSTEMSOURCE" "$NETSOURCE"|| true
|
||||
|
||||
mkdir -pv $LFS/{bin,etc,lib${LIBDIRSUFFIX},sbin,usr,var,tmp,usr/lib${LIBDIRSUFFIX}}
|
||||
case $(uname -m) in
|
||||
x86_64)
|
||||
ln -sfnv lib${LIBDIRSUFFIX} $LFS/lib
|
||||
ln -sfnv lib${LIBDIRSUFFIX} $LFS/usr/lib
|
||||
;;
|
||||
esac
|
||||
|
||||
mkdir -pv $LFS/tools
|
||||
|
||||
sudo -p "Enter admin PW to set ownership of $LFS/*: " chown -v $USER $LFS/{usr,lib${LIBDIRSUFFIX},var,etc,bin,sbin,tools,tmp,usr/lib${LIBDIRSUFFIX}}
|
||||
|
||||
cp ./SystemData* $SYSTEMSOURCE
|
||||
WGET_version=1.21.1
|
||||
|
||||
WGETTAR="https://ftp.gnu.org/gnu/wget/wget-$WGET_version.tar.gz"
|
||||
|
||||
set +h
|
||||
umask 022
|
||||
LC_ALL=POSIX
|
||||
LFS_TGT=$(uname -m)-lfs-linux-gnu
|
||||
PATH=/usr/bin
|
||||
if [ ! -L /bin ];then
|
||||
PATH=/bin:$PATH
|
||||
fi
|
||||
PATH=$LFS/tools/bin:$PATH
|
||||
export LFS LC_ALL LFS_TGT PATH
|
||||
export MAKEFLAGS=${MAKEFLAGS:-'-j4'}
|
||||
|
||||
if [ ! -e "${SYSTEMSOURCE}/gotsystem" ];then
|
||||
if [ "$USESYSTEMD" -eq 1 ];then
|
||||
wget --no-check-certificate http://www.linuxfromscratch.org/lfs/view/systemd/wget-list
|
||||
wget --no-check-certificate http://www.linuxfromscratch.org/lfs/view/systemd/md5sums
|
||||
else
|
||||
wget --no-check-certificate http://www.linuxfromscratch.org/lfs/view/$LFSVERSION/wget-list
|
||||
wget --no-check-certificate http://www.linuxfromscratch.org/lfs/view/$LFSVERSION/md5sums
|
||||
fi
|
||||
mv md5sums $SYSTEMSOURCE
|
||||
wget --no-check-certificate -i wget-list --no-check-certificate -c -P $SYSTEMSOURCE||true
|
||||
|
||||
#wget from the blfs book I prefer to make this as part of the main system
|
||||
wget --no-check-certificate -c "$WGETTAR" -P $NETSOURCE
|
||||
fi
|
||||
|
||||
cd "$SYSTEMSOURCE"
|
||||
if [ ! -e ${SYSTEMSOURCE}/gotsystem ];then
|
||||
if ! md5sum -c md5sums;then
|
||||
echo "Files don't match ..."
|
||||
exit 1
|
||||
else
|
||||
echo "All files check ..."
|
||||
touch "${SYSTEMSOURCE}/gotsystem"
|
||||
fi
|
||||
fi
|
||||
|
||||
TOOLNUM=$(cat ${SYSTEMSOURCE}/toolnum 2>/dev/null||true)
|
||||
|
||||
if [ "X$TOOLNUM" = "X" ];then
|
||||
TOOLNUM=1
|
||||
echo $TOOLNUM > ${SYSTEMSOURCE}/toolnum
|
||||
fi
|
||||
|
||||
while [ $TOOLNUM != "DONE" ]
|
||||
do
|
||||
cd "$SYSTEMSOURCE"
|
||||
case $TOOLNUM in
|
||||
1)
|
||||
NAME=binutils
|
||||
VERSION=$binutils_version
|
||||
tar -xvf ${NAME}-${VERSION}.$binutils_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
mkdir -v build
|
||||
cd build
|
||||
../configure --prefix=$LFS/tools --with-sysroot=$LFS --target=$LFS_TGT --disable-nls --disable-werror
|
||||
make $MAKEFLAGS||make
|
||||
make install
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
2)
|
||||
#pass 1
|
||||
NAME=gcc
|
||||
VERSION=$gcc_version
|
||||
tar -xvf ${NAME}-${VERSION}.$gcc_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
case $(uname -m) in
|
||||
armv6l)
|
||||
patch -Np1 -i ../gcc-9.1.0-rpi1-cpu-default.patch
|
||||
;;
|
||||
armv7l)
|
||||
case $(sed -n '/^Revision/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo) in
|
||||
a02082|a22082|a32082)
|
||||
patch -Np1 -i ../gcc-9.1.0-rpi3-cpu-default.patch
|
||||
;;
|
||||
*)
|
||||
patch -Np1 -i ../gcc-9.1.0-rpi2-cpu-default.patch
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
x86_64)
|
||||
sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64
|
||||
;;
|
||||
esac
|
||||
|
||||
tar -Jxf ../mpfr-${mpfr_version}.$mpfr_arctype
|
||||
mv -v mpfr-$mpfr_version mpfr
|
||||
tar -Jxf ../gmp-${gmp_version}.$gmp_arctype
|
||||
mv -v gmp-$gmp_version gmp
|
||||
tar -zxf ../mpc-${mpc_version}.$mpc_arctype
|
||||
mv -v mpc-$mpc_version mpc
|
||||
|
||||
mkdir -v build
|
||||
cd build
|
||||
../configure --target=$LFS_TGT --prefix=$LFS/tools --with-glibc-version=2.11 --with-sysroot=$LFS --with-newlib --without-headers --enable-initfini-array --disable-nls --disable-shared --disable-multilib --disable-decimal-float --disable-threads --disable-libatomic --disable-libgomp --disable-libquadmath --disable-libssp --disable-libvtv --disable-libstdcxx --enable-languages=c,c++
|
||||
make $MAKEFLAGS||make
|
||||
make install
|
||||
cd ..
|
||||
cat gcc/limitx.h gcc/glimits.h gcc/limity.h > $(dirname $($LFS_TGT-gcc -print-libgcc-file-name))/install-tools/include/limits.h
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
3)
|
||||
#TODO rpi odd version string
|
||||
NAME=linux
|
||||
VERSION=$linux_version
|
||||
(mkdir ${NAME}-${VERSION}||true;tar -C ${NAME}-${VERSION} -xvf ${NAME}-${VERSION}.$linux_arctype --strip-components=1)
|
||||
pushd ${NAME}-${VERSION}
|
||||
make mrproper
|
||||
make headers
|
||||
find usr/include -name '.*' -delete
|
||||
rm usr/include/Makefile
|
||||
cp -rv usr/include $LFS/usr
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
4)
|
||||
NAME=glibc
|
||||
VERSION=$glibc_version
|
||||
tar -xvf ${NAME}-${VERSION}.$glibc_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
ln -sfv ld-linux-x86-64.so.2 $LFS/lib${LIBDIRSUFFIX}/ld-lsb-x86-64.so.3
|
||||
patch -Np1 -i ../${NAME}-${VERSION}-fhs-1.patch
|
||||
mkdir -v build
|
||||
cd build
|
||||
../configure --prefix=/usr --host=$LFS_TGT --build=$(../scripts/config.guess) --enable-kernel=3.2 --with-headers=$LFS/usr/include libc_cv_slibdir=/lib
|
||||
make $MAKEFLAGS||make -j1|| exit 100
|
||||
make DESTDIR=$LFS install
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo 'int main(){}' > dummy.c
|
||||
$LFS_TGT-gcc dummy.c
|
||||
readelf -l a.out | grep '/ld-linux'
|
||||
read -t 30 -p "check out " ||true
|
||||
rm -v dummy.c a.out
|
||||
$LFS/tools/libexec/gcc/$LFS_TGT/$gcc_version/install-tools/mkheaders
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
5)
|
||||
#libstdc++
|
||||
NAME=gcc
|
||||
VERSION=$gcc_version
|
||||
tar -xvf ${NAME}-${VERSION}.$gcc_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
mkdir -pv build
|
||||
cd build
|
||||
../libstdc++-v3/configure --host=$LFS_TGT --build=$(../config.guess) --prefix=/usr --disable-multilib --disable-nls --disable-libstdcxx-pch --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/${VERSION}
|
||||
make $MAKEFLAGS||make
|
||||
make DESTDIR=$LFS install
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
6)
|
||||
NAME=m4
|
||||
VERSION=$m4_version
|
||||
tar -xvf ${NAME}-${VERSION}.$m4_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
|
||||
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
|
||||
./configure --prefix=/usr --host=$LFS_TGT --build=$(build-aux/config.guess)
|
||||
make $MAKEFLAGS||make
|
||||
make DESTDIR=$LFS install
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
7)
|
||||
NAME=ncurses
|
||||
VERSION=$ncurses_version
|
||||
tar -xvf ${NAME}-${VERSION}.$ncurses_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
sed -i s/mawk// configure
|
||||
mkdir build
|
||||
pushd build
|
||||
../configure
|
||||
make -C include
|
||||
make -C progs tic
|
||||
popd
|
||||
./configure --prefix=/usr --host=$LFS_TGT --build=$(./config.guess) --mandir=/usr/share/man --with-manpage-format=normal --with-shared --without-debug --without-ada --without-normal --enable-widec
|
||||
make $MAKEFLAGS||make
|
||||
make DESTDIR=$LFS TIC_PATH=$(pwd)/build/progs/tic install
|
||||
echo "INPUT(-lncursesw)" > $LFS/usr/lib/libncurses.so
|
||||
mv -v $LFS/usr/lib/libncursesw.so.6* $LFS/lib
|
||||
ln -sfv ../../lib/$(readlink $LFS/usr/lib/libncursesw.so) $LFS/usr/lib/libncursesw.so
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
8)
|
||||
NAME=bash
|
||||
VERSION=$bash_version
|
||||
tar -xvf ${NAME}-${VERSION}.$bash_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
./configure --prefix=/usr --build=$(support/config.guess) --host=$LFS_TGT --without-bash-malloc
|
||||
make $MAKEFLAGS||make
|
||||
make DESTDIR=$LFS install
|
||||
mv $LFS/usr/bin/bash $LFS/bin/bash
|
||||
ln -sfnv bash $LFS/bin/sh
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
9)
|
||||
NAME=coreutils
|
||||
VERSION=$coreutils_version
|
||||
tar -xvf ${NAME}-${VERSION}.$coreutils_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
./configure --prefix=/usr --host=$LFS_TGT --build=$(build-aux/config.guess) --enable-install-program=hostname --enable-no-install-program=kill,uptime
|
||||
make $MAKEFLAGS||make
|
||||
make DESTDIR=$LFS install
|
||||
mv -v $LFS/usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} $LFS/bin
|
||||
mv -v $LFS/usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} $LFS/bin
|
||||
mv -v $LFS/usr/bin/{rmdir,stty,sync,true,uname} $LFS/bin
|
||||
mv -v $LFS/usr/bin/{head,nice,sleep,touch} $LFS/bin
|
||||
mv -v $LFS/usr/bin/chroot $LFS/usr/sbin
|
||||
mkdir -pv $LFS/usr/share/man/man8
|
||||
mv -v $LFS/usr/share/man/man1/chroot.1 $LFS/usr/share/man/man8/chroot.8
|
||||
sed -i 's/"1"/"8"/' $LFS/usr/share/man/man8/chroot.8
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
10)
|
||||
NAME=diffutils
|
||||
VERSION=$diffutils_version
|
||||
tar -xvf ${NAME}-${VERSION}.$diffutils_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
./configure --prefix=/usr --host=$LFS_TGT
|
||||
make $MAKEFLAGS||make
|
||||
make DESTDIR=$LFS install
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
11)
|
||||
NAME=file
|
||||
VERSION=$file_version
|
||||
tar -xvf ${NAME}-${VERSION}.$file_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
mkdir build
|
||||
pushd build
|
||||
../configure --disable-bzlib --disable-libseccomp --disable-xzlib --disable-zlib
|
||||
make
|
||||
popd
|
||||
./configure --prefix=/usr --host=$LFS_TGT --build=$(./config.guess)
|
||||
make FILE_COMPILE=$(pwd)/build/src/file
|
||||
make DESTDIR=$LFS install
|
||||
#hack
|
||||
if [ "$USESYSTEMD" -eq 1 ];then
|
||||
mv -v $LFS/usr/lib/libmagic.so.* $LFS/lib
|
||||
ln -sfv ../../lib/$(readlink /usr/lib/libmagic.so) $LFS/usr/lib/libmagic.so
|
||||
fi
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
12)
|
||||
NAME=findutils
|
||||
VERSION=$findutils_version
|
||||
tar -xvf ${NAME}-${VERSION}.$findutils_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
./configure --prefix=/usr --host=$LFS_TGT --build=$(build-aux/config.guess)
|
||||
make $MAKEFLAGS||make
|
||||
make DESTDIR=$LFS install
|
||||
mv -v $LFS/usr/bin/find $LFS/bin
|
||||
sed -i 's|find:=${BINDIR}|find:=/bin|' $LFS/usr/bin/updatedb
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
13)
|
||||
NAME=gawk
|
||||
VERSION=$gawk_version
|
||||
tar -xvf ${NAME}-${VERSION}.$gawk_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
sed -i 's/extras//' Makefile.in
|
||||
./configure --prefix=/usr --host=$LFS_TGT --build=$(./config.guess)
|
||||
make $MAKEFLAGS||make
|
||||
make DESTDIR=$LFS install
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
14)
|
||||
NAME=grep
|
||||
VERSION=$grep_version
|
||||
tar -xvf ${NAME}-${VERSION}.$grep_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
./configure --prefix=/usr --host=$LFS_TGT --bindir=/bin
|
||||
make $MAKEFLAGS||make
|
||||
make DESTDIR=$LFS install
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
15)
|
||||
NAME=gzip
|
||||
VERSION=$gzip_version
|
||||
tar -xvf ${NAME}-${VERSION}.$gzip_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
./configure --prefix=/usr --host=$LFS_TGT
|
||||
make $MAKEFLAGS||make
|
||||
make DESTDIR=$LFS install
|
||||
mv -v $LFS/usr/bin/gzip $LFS/bin
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
16)
|
||||
NAME=make
|
||||
VERSION=$make_version
|
||||
tar -xvf ${NAME}-${VERSION}.$make_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
./configure --prefix=/usr --without-guile --host=$LFS_TGT --build=$(build-aux/config.guess)
|
||||
make $MAKEFLAGS||make
|
||||
make DESTDIR=$LFS install
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
17)
|
||||
NAME=patch
|
||||
VERSION=$patch_version
|
||||
tar -xvf ${NAME}-${VERSION}.$patch_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
./configure --prefix=/usr --host=$LFS_TGT --build=$(build-aux/config.guess)
|
||||
make $MAKEFLAGS||make
|
||||
make DESTDIR=$LFS install
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
18)
|
||||
NAME=sed
|
||||
VERSION=$sed_version
|
||||
tar -xvf ${NAME}-${VERSION}.$sed_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
./configure --prefix=/usr --host=$LFS_TGT --bindir=/bin
|
||||
make $MAKEFLAGS||make
|
||||
make DESTDIR=$LFS install
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
19)
|
||||
NAME=tar
|
||||
VERSION=$tar_version
|
||||
tar -xvf ${NAME}-${VERSION}.$tar_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
./configure --prefix=/usr --host=$LFS_TGT --build=$(build-aux/config.guess) --bindir=/bin
|
||||
make $MAKEFLAGS||make
|
||||
make DESTDIR=$LFS install
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
20)
|
||||
NAME=xz
|
||||
VERSION=$xz_version
|
||||
tar -xvf${NAME}-${VERSION}.$xz_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
./configure --prefix=/usr --host=$LFS_TGT --build=$(build-aux/config.guess) --disable-static --docdir=/usr/share/doc/xz-5.2.5
|
||||
make $MAKEFLAGS||make
|
||||
make DESTDIR=$LFS install
|
||||
mv -v $LFS/usr/bin/{lzma,unlzma,lzcat,xz,unxz,xzcat} $LFS/bin
|
||||
mv -v $LFS/usr/lib/liblzma.so.* $LFS/lib
|
||||
ln -sfnvf ../../lib/$(readlink $LFS/usr/lib/liblzma.so) $LFS/usr/lib/liblzma.so
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
21)
|
||||
#pass 2
|
||||
NAME=binutils
|
||||
VERSION=$binutils_version
|
||||
tar -xvf ${NAME}-${VERSION}.$binutils_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
mkdir -v build
|
||||
cd build
|
||||
../configure --prefix=/usr --build=$(../config.guess) --host=$LFS_TGT --disable-nls --enable-shared --disable-werror --enable-64-bit-bfd
|
||||
make $MAKEFLAGS||make
|
||||
make DESTDIR=$LFS install
|
||||
install -vm755 libctf/.libs/libctf.so.0.0.0 $LFS/usr/lib
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
22)
|
||||
#pass 2
|
||||
NAME=gcc
|
||||
VERSION=$gcc_version
|
||||
tar -xvf ${NAME}-${VERSION}.$gcc_arctype
|
||||
pushd ${NAME}-${VERSION}
|
||||
case $(uname -m) in
|
||||
armv6l)
|
||||
patch -Np1 -i ../gcc-9.1.0-rpi1-cpu-default.patch
|
||||
;;
|
||||
armv7l)
|
||||
case $(sed -n '/^Revision/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo) in
|
||||
a02082|a22082|a32082)
|
||||
patch -Np1 -i ../gcc-9.1.0-rpi3-cpu-default.patch
|
||||
;;
|
||||
*)
|
||||
patch -Np1 -i ../gcc-9.1.0-rpi2-cpu-default.patch
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
tar -Jxf ../mpfr-${mpfr_version}.$mpfr_arctype
|
||||
mv -v mpfr-$mpfr_version mpfr
|
||||
tar -Jxf ../gmp-${gmp_version}.$gmp_arctype
|
||||
mv -v gmp-$gmp_version gmp
|
||||
tar -zxf ../mpc-${mpc_version}.$mpc_arctype
|
||||
mv -v mpc-$mpc_version mpc
|
||||
|
||||
case $(uname -m) in
|
||||
x86_64)
|
||||
sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64
|
||||
;;
|
||||
esac
|
||||
mkdir -v build
|
||||
cd build
|
||||
mkdir -pv $LFS_TGT/libgcc
|
||||
ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h
|
||||
../configure --build=$(../config.guess) --host=$LFS_TGT --prefix=/usr CC_FOR_TARGET=${LFS_TGT}-gcc --with-build-sysroot=$LFS --enable-initfini-array --disable-nls --disable-multilib --disable-decimal-float --disable-libatomic --disable-libgomp --disable-libquadmath --disable-libssp --disable-libvtv --disable-libstdcxx --enable-languages=c,c++
|
||||
make $MAKEFLAGS||make
|
||||
make DESTDIR=$LFS install
|
||||
ln -sfnv gcc $LFS/usr/bin/cc
|
||||
popd
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
echo "$((++ TOOLNUM))" > ${SYSTEMSOURCE}/toolnum
|
||||
;;
|
||||
|
||||
23)
|
||||
sudo -p "Enter admin PW to set ownership of $LFS/* back to root: " chown -R root:root $LFS/{usr,lib,var,etc,bin,sbin,tools}
|
||||
echo "DONE" > ${SYSTEMSOURCE}/toolnum
|
||||
TOOLNUM="DONE"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
|
||||
|
289
LFSScripts/PiBuild/HowTo
Normal file
289
LFSScripts/PiBuild/HowTo
Normal file
@ -0,0 +1,289 @@
|
||||
|
||||
Instructions for Raspberry Pi 4 !ONLY!
|
||||
|
||||
1)
|
||||
|
||||
#Set some env vars to make copy/paste easier, ( change as needed for your setup ).
|
||||
#Folders should be pre created, change paths to suit,
|
||||
#Use sudo where necessary to create links etc.
|
||||
#It will be assumed that your LFS partition is mounted on /mnt/LFS, using /dev/mmcblk0p11 <--- You MUST set this correctly!
|
||||
|
||||
LFS=/mnt/LFS
|
||||
LFSVERSION=9.0
|
||||
SOURCEARCHIVES=/LFSSourceArchives/$LFSVERSION
|
||||
PKGARCHIVES=/LFSBuiltPackages/$LFSVERSION
|
||||
EXTFOLDER=
|
||||
KERNELVERSION=4.19
|
||||
PIVERS=4
|
||||
PIBUILD=1
|
||||
PIBOOTDEV=/dev/mmcblk0p10
|
||||
PIROOTDEV=/dev/mmcblk0p11
|
||||
#While building tools
|
||||
COMPILEAT=$LFS/$SOURCEARCHIVES
|
||||
|
||||
export LFS
|
||||
export LFSVERSION
|
||||
export SOURCEARCHIVES
|
||||
export PKGARCHIVES
|
||||
export EXTFOLDER
|
||||
export KERNELVERSION
|
||||
export PIVERS
|
||||
export PIBUILD
|
||||
export PIBOOTDEV
|
||||
export PIROOTDEV
|
||||
export COMPILEAT
|
||||
|
||||
sudo mount /dev/mmcblk0p11 $LFS
|
||||
sudo mkdir -vp $SOURCEARCHIVES $PKGARCHIVES
|
||||
|
||||
#If compiling on raspberian you need to install some extra files like so:
|
||||
apt-get update
|
||||
apt-get install bison gawk m4 texinfo
|
||||
#Also make sure /bin/sh points to /bin/bash
|
||||
|
||||
#Get the build scripts and helper scripts from:
|
||||
#https://github.com/KeithDHedger/LFSPkgBuilds
|
||||
#either via git clone or downloading the zip file and unpacking it.
|
||||
#you should place the LFSPkgBuildScripts and LFSScripts folder in the root of what will be your new LFS eg ${LFS}/LFSPkgBuildScripts
|
||||
|
||||
2)
|
||||
###RECOMMENDED####
|
||||
#or cd into the mounted partition wher you intend to build LFS:
|
||||
#LFS should point to your mounted LFS partition ( eg LFS=/mnt/LFS ).
|
||||
cd $LFS
|
||||
sudo git clone https://github.com/KeithDHedger/LFSPkgBuilds.git
|
||||
|
||||
Own the files:
|
||||
sudo chown -R $USER:$USER LFSPkgBuilds
|
||||
sudo ln -sv LFSPkgBuilds/LFSPkgBuildScripts LFSPkgBuildScripts
|
||||
sudo ln -sv LFSPkgBuilds/LFSScripts LFSScripts
|
||||
|
||||
#If you want a swap file set up for later do:
|
||||
#set count to the size of the swapfile needed.
|
||||
|
||||
sudo dd if=/dev/zero of=swapfile bs=1M count=512
|
||||
sudo chmod 600 swapfile
|
||||
sudo mkswap swapfile
|
||||
sudo swapon -v swapfile
|
||||
|
||||
#If you are mounting a network folder over SOURCEARCHIVES & PKGARCHIVES (reccomened to save room ) you may want to set where the actual compilation takes place.
|
||||
#You will need to compile in a place that can set linux permissions so an smb mount would be no good for compiling as some files need to have specific permissions.
|
||||
#This is usually at $LFS/$SOURCEARCHIVES, compiling over a network is slow so you can use a local compile instead, eg:
|
||||
COMPILEAT=$LFS/tmp
|
||||
export COMPILEAT
|
||||
|
||||
3)
|
||||
#cd into the lfsscripts folder
|
||||
cd $LFS/LFSScripts
|
||||
#Set up config files !!IMPORTANT!!
|
||||
#You can just press 'Return' to accept the default.
|
||||
#Run:
|
||||
sudo -E ./LFSSetUp
|
||||
|
||||
#To check config:
|
||||
./ShowSystemData
|
||||
|
||||
4)
|
||||
#Run BuildTools script:
|
||||
./BuildTools-Pi
|
||||
|
||||
4.5)
|
||||
#Mount bind external folder if set and if not already mounted.
|
||||
. ./SystemData
|
||||
mkdir -vp ${LFS}/${SOURCEARCHIVES}||true
|
||||
mkdir -vp ${LFS}/${PKGARCHIVES}||true
|
||||
if [ "X$EXTFOLDER" != "X" ];then
|
||||
sudo mount --bind $EXTFOLDER/${PKGARCHIVES} $LFS/${PKGARCHIVES}
|
||||
sudo mount --bind $EXTFOLDER/${SOURCEARCHIVES} $LFS/${SOURCEARCHIVES}
|
||||
fi
|
||||
|
||||
5)
|
||||
#Run BuildFileSystem script:
|
||||
sudo ./BuildFileSystem
|
||||
|
||||
5.2)
|
||||
#You may/will have to re-own/set perms the various folders etc, so:
|
||||
sudo chown -R $USER:$USER $LFS/LFSPkgBuilds
|
||||
#If these are not network mounts then
|
||||
sudo chown -R $USER:$USER $LFS/LFSSourceArchives/$LFSVERSION $LFS/LFSBuiltPackages/$LFSVERSION
|
||||
sudo chmod -R 755 $LFS/LFSSourceArchives/$LFSVERSION $LFS/LFSBuiltPackages/$LFSVERSION
|
||||
|
||||
5.5)
|
||||
#Create a link from downloaded linux tarball to /LFSSourceArchives/$LFSVERSION/KERNEL to prevent re-downloading source tarball.
|
||||
mkdir $LFS/LFSSourceArchives/$LFSVERSION/KERNEL
|
||||
cd $LFS/LFSSourceArchives/$LFSVERSION/KERNEL
|
||||
ln -sv ../SYSTEM/linux-$KERNELVERSION.tar.xz .
|
||||
|
||||
5.6)
|
||||
#get the package manager archive via the host system:
|
||||
cd $LFS/LFSPkgBuildScripts/admin/LFSPkg
|
||||
wget -c --no-check-certificate "https://github.com/KeithDHedger/LFSPkg/archive/master.zip" -O LFSPkg.zip
|
||||
unzip LFSPkg.zip
|
||||
|
||||
6)
|
||||
#Change back to $LFS/LFSScripts folder.
|
||||
cd $LFS/LFSScripts
|
||||
|
||||
#If you are building over ssh you may want to start a screen session that you can come back to later, if you haven't already.
|
||||
screen
|
||||
|
||||
#Chroot into temporary system:
|
||||
#make sure the /tools link on the host is valid
|
||||
#I necessary do:
|
||||
#sudo ln -sv $LFS/tools/ /tools
|
||||
sudo ./Chroot system
|
||||
|
||||
7)
|
||||
#You should now be in the chroot
|
||||
#First install lfspkg:
|
||||
cd /LFSPkgBuildScripts/admin/LFSPkg
|
||||
BOOTSTRAP=1 ./LFSPkg.LFSBuild install
|
||||
|
||||
#As part of the LFSSetUp script $LFS/etc/lfspkg.rc has been created to contain basic info needed by lfspkg, review and change if needed.
|
||||
#Set $LFS/etc/lfspkg.rc 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.
|
||||
#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.
|
||||
|
||||
#You should run lfspkg --setup to create the lfspkg.rc file ( in /etc )
|
||||
#lfspkg --setup can be run again later if you need/want to change source/build folders etc.
|
||||
#For building the main system you should probably set the configure options config files in /etc and log options.
|
||||
lfspkg --setup
|
||||
|
||||
8)
|
||||
#Build main system:
|
||||
cd /LFSPkgBuildScripts/system/system-meta
|
||||
|
||||
#LFSSetUp will have created a symlink to your desired init type so use:
|
||||
./system-meta.LFSBuild install
|
||||
|
||||
#Or if you have changed your mind you can install a different init system like so:
|
||||
|
||||
#Use system-sysvinit-meta for standard sysvinit like so:
|
||||
./system-sysvinit-meta.LFSBuild install
|
||||
|
||||
#Or use system-bbinit-meta.LFSBuildfor a busy box init system ( non standard ) like so:
|
||||
./system-bbinit-meta.LFSBuild install
|
||||
|
||||
#Or for ##experimental## custom init system use:
|
||||
./system-LFSInit-meta.LFSBuild install
|
||||
|
||||
#Or for rpi sysvinit system use:
|
||||
./system-pi-sysvinit-meta.LFSBuild install
|
||||
|
||||
Wait for script to complete:
|
||||
...
|
||||
Have coffee
|
||||
Walk the dog
|
||||
...
|
||||
|
||||
9)
|
||||
#logout from temporary system:
|
||||
exit
|
||||
|
||||
10)
|
||||
#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:
|
||||
sudo rm /tools
|
||||
#Remove the tools folder from your LFS install disk:
|
||||
sudo rm -rf $LFS/tools
|
||||
|
||||
11)
|
||||
#Change back to $LFS/LFSScripts folder and re-enter the chroot ( this time and subsequent times don't use the 'system' argument to Chroot ):
|
||||
cd $LFS/LFSScripts
|
||||
sudo ./Chroot
|
||||
|
||||
12)
|
||||
#You MUST rebuild lfspkg after completeing the the basic system and removing the tools folder.
|
||||
#Use same process as 2)/7) EXCEPT do NOT use BOOTSTRAP=1
|
||||
#If you have set any vairiable in /etc/lfspkg.rc then reply 'R' ( without the quotes ) when asked about replacing files in /etc.
|
||||
#If you forgot to do the above bit just re-edit /etc/lfspkg.rc:
|
||||
|
||||
cd /LFSPkgBuildScripts/admin/LFSPkg
|
||||
./LFSPkg.LFSBuild
|
||||
|
||||
#You may/probably want to run sudo lfspkg --setup to set up the full /etc/lfspkg.rc file
|
||||
|
||||
13)
|
||||
#No point in compiling your own kernel on pi so prebuilt one is used.
|
||||
#But you may want to set up wifi now so:
|
||||
cd /LFSPkgBuildScripts/net/wpa-supplicant/
|
||||
./wpa-supplicant.LFSBuild install
|
||||
#configure
|
||||
wpa_passphrase SSID SECRET_PASSWORD > /etc/sysconfig/wpa_supplicant-wifi0.conf
|
||||
#Set the country code:
|
||||
sed -i '1s/^/country=GB\n/' /etc/sysconfig/wpa_supplicant-wifi0.conf
|
||||
|
||||
cd /LFSPkgBuildScripts/HelperScripts/
|
||||
#dialog program not yet installed so use:
|
||||
./InstallService-NoDialog wpa
|
||||
|
||||
#Don't forget to set up /etc/sysconfig/ifconfig.wifi0 if nessasary ( a default is created based on /LFSSourceArchives/9.0/SYSTEM/SystemData.local ).
|
||||
#Disable eth0
|
||||
mv /etc/sysconfig/ifconfig.eth0 /etc/sysconfig/XXifconfig.eth0XX
|
||||
|
||||
#Openssh and the sshd init script is installed by the system-meta package.
|
||||
|
||||
#########################
|
||||
# If you have trouble ssh'ing into the 'real' LFS system you may need to manually set the date if the ntpd server takes too long, eg:
|
||||
ntpdate -s time.nist.gov
|
||||
#########################
|
||||
|
||||
#Install any extra hardware/firmware packages you need ( you may have to boot into the 'real' system for this ).
|
||||
#eg usb wireless package:
|
||||
cd /LFSPkgBuildScripts/hware/RTL88x2BU-Linux-Driver
|
||||
./RTL88x2BU-Linux-Driver.LFSBuild install
|
||||
|
||||
14)
|
||||
#The following are optional but useful
|
||||
#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.
|
||||
#Build xorg ( experimental at the moment ):
|
||||
cd /LFSPkgBuildScripts/xorg/xorg-meta/
|
||||
./xorg-meta.LFSBuild install
|
||||
|
||||
#Samba
|
||||
cd /LFSPkgBuildScripts/net/samba
|
||||
./samba.LFSBuild install
|
||||
|
||||
#nfs
|
||||
cd /LFSPkgBuildScripts/net/nfs-utils
|
||||
./nfs-utils.LFSBuild install
|
||||
|
||||
#Fuse and stuff
|
||||
cd /LFSPkgBuildScripts/net/sshfs
|
||||
./sshfs.LFSBuild install
|
||||
|
||||
cd /LFSPkgBuildScripts/net/davfs2
|
||||
./davfs2.LFSBuild install
|
||||
|
||||
cd /LFSPkgBuildScripts/net/curlftpfs
|
||||
./curlftpfs.LFSBuild install
|
||||
|
||||
#System admin/security stuff
|
||||
cd /LFSPkgBuildScripts/admin/logrotate
|
||||
./logrotate.LFSBuild install
|
||||
|
||||
cd /LFSPkgBuildScripts/admin/fcron
|
||||
./fcron.LFSBuild install
|
||||
|
||||
cd /LFSPkgBuildScripts/net/iptables
|
||||
./iptables.LFSBuild install
|
||||
|
||||
cd /LFSPkgBuildScripts/net/fail2ban
|
||||
./fail2ban.LFSBuild install
|
||||
|
||||
#If you are building in chroot you will pobably have to rerun the postinstall script for this package AFTER booting to the 'real' system.
|
||||
cd /LFSPkgBuildScripts/admin/mariadb
|
||||
./mariadb.LFSBuild install
|
||||
|
||||
#Kodi
|
||||
#Install needed deps
|
||||
cd /LFSPkgBuildScripts/mm/kodi
|
||||
./pi-kodi-mindeps
|
||||
#Add users
|
||||
cd /LFSPkgBuildScripts/HelperScripts/
|
||||
./UsersAndGroups YOURUSERNAME
|
||||
|
||||
#Add services
|
||||
cd /LFSPkgBuildScripts/HelperScripts/
|
||||
#Select from list, install/uninstall
|
||||
./InstallService-NoDialog
|
||||
#Auto install
|
||||
./InstallService-NoDialog "ntpd sshd gpm"
|
1
LFSScripts/SysVBuild/BuildFileSystem
Symbolic link
1
LFSScripts/SysVBuild/BuildFileSystem
Symbolic link
@ -0,0 +1 @@
|
||||
../Common/BuildFileSystem
|
1
LFSScripts/SysVBuild/BuildTools2
Symbolic link
1
LFSScripts/SysVBuild/BuildTools2
Symbolic link
@ -0,0 +1 @@
|
||||
../Common/BuildTools2
|
1
LFSScripts/SystemDBuild/BuildFileSystem
Symbolic link
1
LFSScripts/SystemDBuild/BuildFileSystem
Symbolic link
@ -0,0 +1 @@
|
||||
../Common/BuildFileSystem
|
1
LFSScripts/SystemDBuild/BuildTools1
Symbolic link
1
LFSScripts/SystemDBuild/BuildTools1
Symbolic link
@ -0,0 +1 @@
|
||||
../Common/BuildTools1
|
1
LFSScripts/SystemDBuild/BuildTools2
Symbolic link
1
LFSScripts/SystemDBuild/BuildTools2
Symbolic link
@ -0,0 +1 @@
|
||||
../Common/BuildTools2
|
411
LFSScripts/SystemDBuild/HowTo
Normal file
411
LFSScripts/SystemDBuild/HowTo
Normal file
@ -0,0 +1,411 @@
|
||||
|
||||
1)
|
||||
|
||||
#It will be assumed that your LFS partition is mounted on /mnt/LFS, using /dev/sda1 and /dev/sda2 as swap, alter as needed.
|
||||
#Use sudo where necessary to create links etc.
|
||||
|
||||
#If compiling on raspberian you need to install some extra files like so:
|
||||
apt-get update
|
||||
apt-get install bison gawk m4 texinfo
|
||||
#Also make sure /bin/sh points to /bin/bash
|
||||
|
||||
#Get the build scripts and helper scripts from:
|
||||
#https://github.com/KeithDHedger/LFSPkgBuilds
|
||||
#either via git clone or downloading the zip file and unpacking it.
|
||||
#you should place the LFSPkgBuildScripts and LFSScripts folder in the root of what will be your new LFS eg /mnt/lfs/LFSPkgBuildScripts
|
||||
|
||||
#Set some env vars to make it easier to copy and paste these instructions.
|
||||
#Folders should be pre created, change paths to suit,
|
||||
LFS=/mnt/LFS
|
||||
LFSVERSION=10.1
|
||||
SOURCEARCHIVES=/LFSSourceArchives/$LFSVERSION
|
||||
BUILTPACKAGES=/LFSBuiltPackages/$LFSVERSION
|
||||
EXTFOLDER=
|
||||
KERNELVERSION=5.11.10
|
||||
USESYSTEMD=1
|
||||
|
||||
export LFS
|
||||
export LFSVERSION
|
||||
export SOURCEARCHIVES
|
||||
export BUILTPACKAGES
|
||||
export EXTFOLDER
|
||||
export KERNELVERSION
|
||||
export USESYSTEMD
|
||||
###RECOMMENDED####
|
||||
#or cd into the mounted partition wher you intend to build LFS:
|
||||
#LFS should point to your mounted LFS partition ( eg LFS=/mnt/LFS ).
|
||||
cd $LFS
|
||||
[sudo] git clone https://github.com/KeithDHedger/LFSPkgBuilds.git
|
||||
|
||||
Own the files:
|
||||
[sudo] chown -R $USER:$USER $LFS/LFSPkgBuilds
|
||||
[sudo] ln -sv LFSPkgBuilds/LFSPkgBuildScripts $LFS/LFSPkgBuildScripts
|
||||
[sudo] ln -sv LFSPkgBuilds/LFSScripts $LFS/LFSScripts
|
||||
|
||||
3)
|
||||
#cd into the SystemDBuild folder
|
||||
cd ${LFS}//LFSPkgBuilds/LFSScripts/SystemDBuild
|
||||
|
||||
#Set up config files !!IMPORTANT!!
|
||||
#You can just press 'Return' to accept the default.
|
||||
#Run:
|
||||
[sudo] -E ./LFSSetUp
|
||||
|
||||
#To check config:
|
||||
./ShowSystemData
|
||||
|
||||
4)
|
||||
#make sure normal user owns $LFS ( if you are using a dedicated user change $USER if needed ).
|
||||
[sudo -E] chown $USER $LFS
|
||||
#Run BuildTools script:
|
||||
./BuildTools1
|
||||
|
||||
5)
|
||||
#Run BuildFileSystem script:
|
||||
[sudo -E ] ./BuildFileSystem
|
||||
|
||||
6)
|
||||
#Enter chroot
|
||||
[sudo] ./Chroot
|
||||
cd /LFSScripts
|
||||
|
||||
7)
|
||||
#finish building tempory tools.
|
||||
./BuildTools2
|
||||
exit
|
||||
|
||||
#Make sure you are no longer in the chroot.
|
||||
|
||||
8)
|
||||
cd $LFS
|
||||
[sudo] strip --strip-debug usr/lib/*
|
||||
[sudo] strip --strip-unneeded usr/{,s}bin/*
|
||||
[sudo] strip --strip-unneeded tools/bin/*
|
||||
|
||||
#tar MUST be run as root to preserve permissions.
|
||||
#change ${HOME}/tools-${LFSVERSION}.tar.xz to suit.
|
||||
#make sure all virtual file systems etc are unmounted, including /LFSSourceArchives etc if you have mounted an extern drive there.
|
||||
[sudo -E] tar -apcv -f ${HOME}/tools-${LFSVERSION}.tar.xz .
|
||||
|
||||
9)
|
||||
#make sure you are back in the lfsscripts folder.
|
||||
cd $LFS/LFSScripts
|
||||
|
||||
#Mount bind external folder if set and if not already mounted.
|
||||
. ./SystemData
|
||||
mkdir -vp ${LFS}/${SOURCEARCHIVES}||true
|
||||
mkdir -vp ${LFS}/${BUILTPACKAGES}||true
|
||||
if [ "X$EXTFOLDER" != "X" ];then
|
||||
sudo mount --bind $EXTFOLDER/${BUILTPACKAGES} $LFS/${BUILTPACKAGES}
|
||||
sudo mount --bind $EXTFOLDER/${SOURCEARCHIVES} $LFS/${SOURCEARCHIVES}
|
||||
fi
|
||||
|
||||
10)
|
||||
#You may/will have to re-own/set perms the various folders etc, so:
|
||||
[sudo] chown -R $USER:$USER $LFS/LFSPkgBuilds $LFS/LFSSourceArchives/$LFSVERSION $LFS/LFSBuiltPackages/$LFSVERSION
|
||||
#chmod -R 755 $LFS/LFSSourceArchives/$LFSVERSION $LFS/LFSBuiltPackages/$LFSVERSION
|
||||
|
||||
11)
|
||||
#Create a link from downloaded linux tarball to /LFSSourceArchives/$LFSVERSION/KERNEL to prevent re-downloading source tarball.
|
||||
mkdir $LFS/LFSSourceArchives/$LFSVERSION/KERNEL
|
||||
cd $LFS/LFSSourceArchives/$LFSVERSION/KERNEL
|
||||
ln -snfv ../SYSTEM/linux-$KERNELVERSION.tar.xz .
|
||||
|
||||
12)
|
||||
#get the package manager archive via the host system:
|
||||
cd $LFS/LFSPkgBuildScripts/admin/LFSPkg
|
||||
wget -c --no-check-certificate "https://github.com/KeithDHedger/LFSPkg/archive/master.zip" -O LFSPkg.zip
|
||||
unzip LFSPkg.zip
|
||||
|
||||
13)
|
||||
#Change back to $LFS/LFSScripts folder.
|
||||
cd $LFS/LFSScripts
|
||||
|
||||
#If you are building over ssh you may want to start a screen session that you can come back to later.
|
||||
screen
|
||||
|
||||
#Chroot into temporary system:
|
||||
[sudo] ./Chroot
|
||||
|
||||
14)
|
||||
#You should now be in the chroot
|
||||
#First install lfspkg:
|
||||
cd /LFSPkgBuildScripts/admin/LFSPkg
|
||||
BOOTSTRAP=1 ./LFSPkg.LFSBuild install
|
||||
#If you are asked whether to replace files etc You should reply 'R' to keep the settings created by the LFSSetup script.
|
||||
|
||||
#As part of the LFSSetUp script $LFS/etc/lfspkg.rc has been created to contain basic info needed by lfspkg, review and change if needed.
|
||||
#Set $LFS/etc/lfspkg.rc 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.
|
||||
#At this point wget/openssl is not installed so you will get a load of complaints from lfspkg about no wget etc, ignore them as lfspkg will be reinstalled later with the main system.
|
||||
|
||||
#You should run lfspkg --setup to create the lfspkg.rc file ( in /etc )
|
||||
#Rc files are sourced from /etc/lfspkg.rc
|
||||
#lfspkg --setup can be run again later if you need/want to change source/build folders etc.
|
||||
#For building the main system you should probably set the configure options config files in /etc and log options.
|
||||
lfspkg --setup
|
||||
|
||||
#You shoud probably set log file to 1, and check etc to 0 when installing the base system.
|
||||
#You can rerun lfspkg --setup at any time to tweak the settings.
|
||||
#after installing the base system you will probably want to at least set check etc to 1.
|
||||
|
||||
15)
|
||||
#Build main system:
|
||||
cd /LFSPkgBuildScripts/system/system-meta
|
||||
|
||||
#LFSSetUp will have created a symlink to your desired init type so use:
|
||||
./system-meta.LFSBuild install
|
||||
|
||||
#Or if you have changed your mind you can install a different init system like so:
|
||||
|
||||
#Use system-sysvinit-meta for standard sysvinit like so:
|
||||
./system-sysvinit-meta.LFSBuild install
|
||||
|
||||
#Or use system-bbinit-meta.LFSBuildfor a busy box init system ( non standard ) like so:
|
||||
./system-bbinit-meta.LFSBuild install
|
||||
|
||||
#Or for ##experimental## custom init system use:
|
||||
./system-LFSInit-meta.LFSBuild install
|
||||
|
||||
#Or for rpi sysvinit system use:
|
||||
./system-pi-sysvinit-meta.LFSBuild install
|
||||
|
||||
Wait for script to complete:
|
||||
...
|
||||
Have coffee
|
||||
Walk the dog
|
||||
...
|
||||
|
||||
16)
|
||||
#logout from temporary system:
|
||||
exit
|
||||
|
||||
17)
|
||||
#optional strip etc see:
|
||||
#http://www.linuxfromscratch.org/lfs/view/stable/chapter08/strippingagain.html
|
||||
#Mostly not needed as the package manager does a strip before installing.
|
||||
cd $LFS
|
||||
save_lib="ld-2.33.so libc-2.33.so libpthread-2.33.so libthread_db-1.0.so"
|
||||
cd lib
|
||||
for LIB in $save_lib
|
||||
do
|
||||
sudo objcopy --only-keep-debug $LIB $LIB.dbg
|
||||
sudo strip --strip-unneeded $LIB
|
||||
sudo objcopy --add-gnu-debuglink=$LIB.dbg $LIB
|
||||
done
|
||||
|
||||
save_usrlib="libquadmath.so.0.0.0 libstdc++.so.6.0.28 libitm.so.1.0.0 libatomic.so.1.2.0"
|
||||
cd $LFS/usr/lib
|
||||
for LIB in $save_usrlib
|
||||
do
|
||||
sudo objcopy --only-keep-debug $LIB $LIB.dbg
|
||||
sudo strip --strip-unneeded $LIB
|
||||
sudo objcopy --add-gnu-debuglink=$LIB.dbg $LIB
|
||||
done
|
||||
unset LIB save_lib save_usrlib
|
||||
|
||||
cd $LFS
|
||||
sudo find usr/lib/ -type f -name "*.a" -exec strip --strip-debug {} ';'
|
||||
sudo find lib/ usr/lib/ -type f -name "*.so*" ! -name "*dbg" -exec strip --strip-unneeded {} ';'
|
||||
sudo find bin sbin usr/{bin,sbin,libexec} -type f -exec strip --strip-all {} ';'
|
||||
|
||||
18)
|
||||
#Re-enter the chroot:
|
||||
cd $LFS/LFSScripts
|
||||
[sudo] ./Chroot
|
||||
|
||||
19)
|
||||
#You MUST rebuild lfspkg after completeing the the basic system and removing the tools folder.
|
||||
#Use same process as 2)/7) EXCEPT do NOT use BOOTSTRAP=1
|
||||
#If you have set any vairiable in /etc/lfspkg.rc then reply 'R' ( without the quotes ) when asked about replacing files in /etc.
|
||||
#If you forgot to do the above bit just re-edit /etc/lfspkg.rc:
|
||||
|
||||
cd /LFSPkgBuildScripts/admin/LFSPkg
|
||||
./LFSPkg.LFSBuild
|
||||
#rerun setup if needed, ( probably best to set "Check /etc For Possible Config File Clashes" to 1 now.
|
||||
lfspkg --setup
|
||||
|
||||
20)
|
||||
#Configure and build the kernel:
|
||||
cd /LFSPkgBuildScripts/kernel
|
||||
|
||||
#Optional copy the config for the running kernel, don't do this if running from bootcd, you may have to set KERNELVERSION.
|
||||
#gunzip < /proc/config.gz > config-${KERNELVERSION}
|
||||
|
||||
./kernel.LFSBuild install
|
||||
|
||||
#You may prefer to manually copy all firmware modules from the host sytem from /lib/firmware to your new LFS system.
|
||||
#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:
|
||||
./firmware.LFSBuild install
|
||||
|
||||
#Install any extra hardware/firmware packages you need ( you may have to boot into the 'real' system for this ).
|
||||
#eg usb wireless package:
|
||||
cd /LFSPkgBuildScripts/hware/RTL88x2BU-Linux-Driver
|
||||
./RTL88x2BU-Linux-Driver.LFSBuild install
|
||||
|
||||
21)
|
||||
#Optional install of grub, see here:
|
||||
#http://www.linuxfromscratch.org/lfs/view/stable/chapter08/grub.html
|
||||
|
||||
#The LFSSetup script will install a basic grub.cfg file in ${LFS}/${BUILDSCRIPTS}/system/grub/ based on the details given to the script.
|
||||
#Check that the grub.cfg file is OK, make any changes and just copy it to /boot/grub, or manually do this:
|
||||
|
||||
#assuming root device is /dev/sda and LFS system is on /dev/sda1:
|
||||
grub-install /dev/sda
|
||||
|
||||
cat > /boot/grub/grub.cfg << "EOF"
|
||||
# Begin /boot/grub/grub.cfg
|
||||
set default=0
|
||||
set timeout=30
|
||||
|
||||
insmod ext2
|
||||
set root=(hd0,1)
|
||||
|
||||
menuentry "GNU/Linux, Linux $LFSVERSION" {
|
||||
linux /boot/vmlinuz-$KERNELVERSION root=/dev/sda1 ro
|
||||
}
|
||||
EOF
|
||||
|
||||
##all below here is for LFS9.0 needs updating to 10.1
|
||||
22)
|
||||
#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.
|
||||
#Build xorg:
|
||||
cd /LFSPkgBuildScripts/xorg/xorg-meta/
|
||||
./xorg-meta.LFSBuild install
|
||||
|
||||
15)
|
||||
#Install documentation stuff
|
||||
#Also installs python via dependency
|
||||
#Loads of apps need these for building documentation so might as well install now.
|
||||
cd /LFSPkgBuildScripts/devel/gtk-doc
|
||||
./gtk-doc.LFSBuild install
|
||||
|
||||
cd /LFSPkgBuildScripts/devel/doxygen
|
||||
./doxygen.LFSBuild install
|
||||
|
||||
16)
|
||||
#Install cups and gtk.
|
||||
#Gtk2 has a 'soft' dependency on cups so best to buils cups first.
|
||||
cd /LFSPkgBuildScripts/print/cups
|
||||
./cups.LFSBuild install
|
||||
|
||||
cd /LFSPkgBuildScripts/gtk/gtk
|
||||
./gtk.LFSBuild install
|
||||
|
||||
#xsane frontends and xsane require gimp installed first to build the plugin
|
||||
cd /LFSPkgBuildScripts/desktop/gimp
|
||||
./gimp.LFSBuild install
|
||||
|
||||
#rest of printing stuff
|
||||
cd /LFSPkgBuildScripts/print/printing-meta
|
||||
./printing-meta.LFSBuild install
|
||||
|
||||
16.5)
|
||||
#multi media
|
||||
cd /LFSPkgBuildScripts/mm/mm-meta
|
||||
./mm-meta.LFSBuild install
|
||||
|
||||
17)
|
||||
#Development stuff
|
||||
cd /LFSPkgBuildScripts/devel/development-meta
|
||||
./development-meta.LFSBuild install
|
||||
|
||||
18)
|
||||
#The big one! build a complete desktop
|
||||
#this meta packagage includes other meta packages and takes a LOOOooooonnnnggggg time to build!
|
||||
#this is for an xfce4 desktop.
|
||||
cd /LFSPkgBuildScripts/desktop/desktop-meta
|
||||
./desktop-meta.LFSBuild install
|
||||
|
||||
#Or for an LFSDesktop
|
||||
cd /LFSPkgBuildScripts/lfsdesktop/LFSDesktop-meta
|
||||
./LFSDesktop-meta.LFSBuild install
|
||||
|
||||
19)
|
||||
#Extra odd stuff
|
||||
#Chromium
|
||||
cd /LFSPkgBuildScripts/desktop/chromium
|
||||
./chromium.LFSBuild install
|
||||
#falkon
|
||||
cd /LFSPkgBuildScripts/qt/falkon/
|
||||
./falkon.LFSBuild install
|
||||
|
||||
#Cairo-dock-plugins pulls in cairo-dock as a dependency
|
||||
cd /LFSPkgBuildScripts/desktop/cairo-dock-plugins
|
||||
./cairo-dock-plugins.LFSBuild install
|
||||
|
||||
#Qemu builds both static and dynamically linked versions
|
||||
cd /LFSPkgBuildScripts/hware/qemu
|
||||
./qemu.LFSBuild install
|
||||
|
||||
#Seamonkey for web dev
|
||||
cd /LFSPkgBuildScripts/net/seamonkey
|
||||
./seamonkey.LFSBuild install
|
||||
|
||||
#Icedtea-web BROKEN
|
||||
#cd /LFSPkgBuildScripts/net/icedtea-web
|
||||
#./icedtea-web.LFSBuild install
|
||||
#For pulse audio
|
||||
#cd /LFSPkgBuildScripts/net/icedtea-sound
|
||||
#./icedtea-sound.LFSBuild install
|
||||
|
||||
#Samba
|
||||
cd /LFSPkgBuildScripts/net/samba
|
||||
./samba.LFSBuild install
|
||||
|
||||
#Fuse and stuff
|
||||
cd /LFSPkgBuildScripts/net/sshfs
|
||||
./sshfs.LFSBuild install
|
||||
|
||||
cd /LFSPkgBuildScripts/net/davfs2
|
||||
./davfs2.LFSBuild install
|
||||
|
||||
cd /LFSPkgBuildScripts/net/curlftpfs
|
||||
./curlftpfs.LFSBuild install
|
||||
|
||||
#System admin/security stuff
|
||||
cd /LFSPkgBuildScripts/admin/logrotate
|
||||
./logrotate.LFSBuild install
|
||||
|
||||
cd /LFSPkgBuildScripts/admin/fcron
|
||||
./fcron.LFSBuild install
|
||||
|
||||
cd /LFSPkgBuildScripts/net/iptables
|
||||
./iptables.LFSBuild install
|
||||
|
||||
cd /LFSPkgBuildScripts/net/fail2ban
|
||||
./fail2ban.LFSBuild install
|
||||
|
||||
#TODO
|
||||
cd /LFSPkgBuildScripts/qt/qt-creator
|
||||
./qt-creator.LFSBuild install
|
||||
|
||||
#If you are building in chroot you will pobably have to rerun the postinstall script for this package AFTER booting to the 'real' system.
|
||||
cd /LFSPkgBuildScripts/admin/mariadb
|
||||
./mariadb.LFSBuild install
|
||||
|
||||
#Odd stuff
|
||||
cd /LFSPkgBuildScripts/xorg/xbindkeys
|
||||
./xbindkeys.LFSBuild install
|
||||
|
||||
cd /LFSPkgBuildScripts/net/libcddb
|
||||
./libcddb.LFSBuild install
|
||||
|
||||
cd /LFSPkgBuildScripts/desktop/epdfview
|
||||
./epdfview.LFSBuild install
|
||||
|
||||
#Conky is getting increasingly tied to gnome and difficult ( impossible! )to build.
|
||||
#cd /LFSPkgBuildScripts/desktop/conky
|
||||
#./conky.LFSBuild install
|
||||
|
||||
#Try an alternative!
|
||||
cd /LFSPkgBuildScripts/desktop/gkrellm
|
||||
./gkrellm.LFSBuild install
|
||||
|
||||
|
||||
#Add users
|
||||
cd /LFSPkgBuildScripts/HelperScripts/
|
||||
./UsersAndGroups YOURUSERNAME
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user